-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve UX of the "Recipients" element in the Scheduled Report form (#…
…3500) * Edit info tooltip * Create `dashed` button variant * Create new recipients element * Fix `Enter` submitting the whole form * Refactor into a new `InputArray` form element * Delete unused code * Prevent button's height from collapsing * Handle overflow * Prevent `IconButton` from submitting form * Fix spacing to allow for scrollbar and focus state * Improve the `input` identifier * Focus on the new input element
- Loading branch information
1 parent
26c2b4f
commit f606072
Showing
7 changed files
with
179 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<script lang="ts"> | ||
import { createEventDispatcher } from "svelte"; | ||
import { slide } from "svelte/transition"; | ||
import { Button, IconButton } from "../button"; | ||
import Add from "../icons/Add.svelte"; | ||
import InfoCircle from "../icons/InfoCircle.svelte"; | ||
import Trash from "../icons/Trash.svelte"; | ||
import Tooltip from "../tooltip/Tooltip.svelte"; | ||
import TooltipContent from "../tooltip/TooltipContent.svelte"; | ||
export let id = ""; | ||
export let label = ""; | ||
export let values: any[]; | ||
export let errors: any[]; | ||
// The accessorKey is necessary due to the way svelte-forms-lib works with arrays. | ||
// See: https://svelte-forms-lib-sapper-docs.vercel.app/array | ||
export let accessorKey: string; | ||
export let placeholder = ""; | ||
export let hint = ""; | ||
export let addItemLabel = "Add item"; | ||
const dispatch = createEventDispatcher(); | ||
function handleKeyDown(event: KeyboardEvent) { | ||
if (event.key === "Enter") { | ||
event.preventDefault(); | ||
} | ||
} | ||
</script> | ||
|
||
<div class="flex flex-col gap-y-2.5"> | ||
<div class="flex items-center gap-x-1"> | ||
<label for={id} class="text-gray-800 text-sm font-medium">{label}</label> | ||
{#if hint} | ||
<Tooltip location="right" alignment="middle" distance={8}> | ||
<div class="text-gray-500" style="transform:translateY(-.5px)"> | ||
<InfoCircle size="13px" /> | ||
</div> | ||
<TooltipContent maxWidth="400px" slot="tooltip-content"> | ||
{hint} | ||
</TooltipContent> | ||
</Tooltip> | ||
{/if} | ||
</div> | ||
<div | ||
class="flex flex-col gap-y-4 max-h-[200px] pl-1 pr-4 py-1 overflow-y-auto" | ||
> | ||
{#each values as value, i} | ||
<div class="flex flex-col gap-y-2"> | ||
<div class="flex gap-x-2 items-center"> | ||
<input | ||
bind:value={values[i][accessorKey]} | ||
id="{id}.{i}.{accessorKey}" | ||
autocomplete="off" | ||
{placeholder} | ||
class="bg-white rounded-sm border border-gray-300 px-3 py-[5px] h-8 cursor-pointer focus:outline-blue-500 w-full text-xs {errors[ | ||
i | ||
]?.accessorKey && 'border-red-500'}" | ||
on:keydown={handleKeyDown} | ||
/> | ||
<IconButton | ||
on:click={() => | ||
dispatch("remove-item", { | ||
index: i, | ||
})} | ||
> | ||
<Trash size="16px" className="text-gray-500 cursor-pointer" /> | ||
</IconButton> | ||
</div> | ||
{#if errors[i]?.[accessorKey]} | ||
<div | ||
in:slide|local={{ duration: 200 }} | ||
class="text-red-500 text-sm py-px" | ||
> | ||
{errors[i][accessorKey]} | ||
</div> | ||
{/if} | ||
</div> | ||
{/each} | ||
<Button on:click={() => dispatch("add-item")} type="dashed"> | ||
<div class="flex gap-x-2"> | ||
<Add className="text-gray-700" /> | ||
{addItemLabel} | ||
</div> | ||
</Button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script lang="ts"> | ||
export let size = "1em"; | ||
export let color = "currentColor"; | ||
export let className = ""; | ||
</script> | ||
|
||
<svg | ||
height={size} | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
class={className} | ||
> | ||
<path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M9.33211 3.33211C9.09745 3.56676 9 3.82523 9 4V5H15V4C15 3.82523 14.9025 3.56676 14.6679 3.33211C14.4332 3.09745 14.1748 3 14 3H10C9.82523 3 9.56676 3.09745 9.33211 3.33211ZM17 5V4C17 3.17477 16.5975 2.43324 16.0821 1.91789C15.5668 1.40255 14.8252 1 14 1H10C9.17477 1 8.43324 1.40255 7.91789 1.91789C7.40255 2.43324 7 3.17477 7 4V5H3C2.44772 5 2 5.44772 2 6C2 6.55228 2.44772 7 3 7H4V20C4 20.8252 4.40255 21.5668 4.91789 22.0821C5.43324 22.5975 6.17477 23 7 23H17C17.8252 23 18.5668 22.5975 19.0821 22.0821C19.5975 21.5668 20 20.8252 20 20V7H21C21.5523 7 22 6.55228 22 6C22 5.44772 21.5523 5 21 5H17ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6ZM10 10C10.5523 10 11 10.4477 11 11V17C11 17.5523 10.5523 18 10 18C9.44772 18 9 17.5523 9 17V11C9 10.4477 9.44772 10 10 10ZM14 10C14.5523 10 15 10.4477 15 11V17C15 17.5523 14.5523 18 14 18C13.4477 18 13 17.5523 13 17V11C13 10.4477 13.4477 10 14 10Z" | ||
fill={color} | ||
/> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
web-common/src/features/dashboards/scheduled-reports/RecipientsList.svelte
This file was deleted.
Oops, something went wrong.
f606072
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://ui.rilldata.io as production
🚀 Deployed on https://655664551d9a260b245a204a--rill-ui-stage.netlify.app
f606072
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://ui.rilldata.com as production
🚀 Deployed on https://6556663bbd33ac10b4c687fb--rill-ui.netlify.app