@websline/system-components 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/components/atoms/actions/button/button.variants.d.ts +0 -9
  2. package/dist/components/atoms/actions/button/button.variants.js +10 -13
  3. package/dist/components/atoms/actions/closeButton/CloseButton.svelte +1 -1
  4. package/dist/components/atoms/actions/iconButton/iconButton.variants.js +3 -3
  5. package/dist/components/atoms/avatar/avatar.variants.js +2 -2
  6. package/dist/components/atoms/badge/badge.variants.js +1 -1
  7. package/dist/components/atoms/chip/chip.variants.js +2 -2
  8. package/dist/components/atoms/feedback/progressBar/progressBar.variants.js +2 -2
  9. package/dist/components/atoms/helperText/helperText.variants.d.ts +2 -2
  10. package/dist/components/atoms/helperText/helperText.variants.js +1 -1
  11. package/dist/components/atoms/icon/Icon.svelte +1 -1
  12. package/dist/components/atoms/input/input.variants.js +4 -4
  13. package/dist/components/atoms/label/label.variants.d.ts +2 -2
  14. package/dist/components/atoms/label/label.variants.js +1 -1
  15. package/dist/components/atoms/select/Select.svelte +0 -1
  16. package/dist/components/atoms/select/select.variants.js +2 -2
  17. package/dist/components/molecules/notification/notification.variants.js +4 -4
  18. package/dist/components/molecules/pickers/colorSwatch/colorSwatch.variants.js +2 -2
  19. package/dist/components/molecules/richTextEditor/richTextEditor.variants.js +1 -1
  20. package/dist/components/molecules/selectorCard/selectorCard.variants.js +6 -5
  21. package/dist/components/molecules/tagSelector/Dropdown.svelte +113 -0
  22. package/dist/components/molecules/tagSelector/Dropdown.svelte.d.ts +29 -0
  23. package/dist/components/molecules/tagSelector/TagSelector.svelte +241 -0
  24. package/dist/components/molecules/tagSelector/TagSelector.svelte.d.ts +87 -0
  25. package/dist/components/molecules/tagSelector/ValueList.svelte +52 -0
  26. package/dist/components/molecules/tagSelector/ValueList.svelte.d.ts +29 -0
  27. package/dist/components/molecules/tagSelector/tagSelector.variants.d.ts +79 -0
  28. package/dist/components/molecules/tagSelector/tagSelector.variants.js +44 -0
  29. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +16 -6
  30. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte.d.ts +8 -0
  31. package/dist/components/molecules/toggleGroup/toggleGroup.variants.js +3 -3
  32. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.d.ts +6 -0
  33. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.js +11 -10
  34. package/dist/components/organisms/modal/modal.variants.js +4 -3
  35. package/dist/components/organisms/popover/popover.variants.js +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +1 -0
  38. package/package.json +2 -2
@@ -34,9 +34,6 @@ export const buttonVariants: import("tailwind-variants").TVReturnType<{
34
34
  };
35
35
  };
36
36
  variant: {
37
- filled: {
38
- base: string;
39
- };
40
37
  outlined: {
41
38
  base: string;
42
39
  };
@@ -84,9 +81,6 @@ export const buttonVariants: import("tailwind-variants").TVReturnType<{
84
81
  };
85
82
  };
86
83
  variant: {
87
- filled: {
88
- base: string;
89
- };
90
84
  outlined: {
91
85
  base: string;
92
86
  };
@@ -134,9 +128,6 @@ export const buttonVariants: import("tailwind-variants").TVReturnType<{
134
128
  };
135
129
  };
136
130
  variant: {
137
- filled: {
138
- base: string;
139
- };
140
131
  outlined: {
141
132
  base: string;
142
133
  };
@@ -2,7 +2,7 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const buttonVariants = tv({
4
4
  slots: {
5
- base: "inline-flex cursor-pointer items-center rounded align-middle transition duration-200 select-none focus:outline-offset-2",
5
+ base: "inline-flex cursor-pointer items-center rounded-lg border border-transparent align-middle transition duration-200 select-none focus:outline-offset-2",
6
6
  icon: "flex h-lh items-center",
7
7
  spinner: "flex h-lh items-center justify-center",
8
8
  },
@@ -29,27 +29,24 @@ const buttonVariants = tv({
29
29
  },
30
30
  size: {
31
31
  small: {
32
- base: "gap-2 px-3 py-1.25 button-small",
32
+ base: "gap-2 px-3 py-1.25 ui-button-small",
33
33
  spinner: "w-4",
34
34
  },
35
35
  medium: {
36
- base: "gap-2 px-3 py-1.5 button-default",
36
+ base: "gap-2 px-3 py-[7px] ui-button-default",
37
37
  spinner: "w-5",
38
38
  },
39
39
  large: {
40
- base: "gap-3 px-3 py-2.5 button-default",
40
+ base: "gap-3 px-3 py-[7px] ui-button-default leading-6",
41
41
  spinner: "w-5",
42
42
  },
43
43
  },
44
44
  variant: {
45
- filled: {
46
- base: "border-1 border-transparent",
47
- },
48
45
  outlined: {
49
- base: "border-1",
46
+ base: "border-current",
50
47
  },
51
48
  text: {
52
- base: "relative !px-0 after:absolute after:bottom-0 after:left-0 after:h-[1.5px] after:w-0 after:transition-all after:duration-300 after:content-[''] hover:after:w-full",
49
+ base: "relative px-0! after:absolute after:bottom-0 after:left-0 after:h-[1.5px] after:w-0 after:transition-all after:duration-300 after:content-[''] hover:after:w-full",
53
50
  },
54
51
  },
55
52
  },
@@ -65,7 +62,7 @@ const buttonVariants = tv({
65
62
  color: "primary",
66
63
  variant: "outlined",
67
64
  class: {
68
- base: "border-blue-500 text-blue-500 hover:border-blue-600 hover:bg-blue-600 hover:text-white dark:border-blue-400 dark:text-blue-400 dark:hover:border-blue-500 dark:hover:bg-blue-500",
65
+ base: "text-blue-500 hover:border-blue-600 hover:bg-blue-600 hover:text-white dark:text-blue-400 dark:hover:border-blue-500 dark:hover:bg-blue-500",
69
66
  },
70
67
  },
71
68
  {
@@ -78,7 +75,7 @@ const buttonVariants = tv({
78
75
  color: "secondary",
79
76
  variant: "outlined",
80
77
  class: {
81
- base: "text-neutral-900 hover:border-neutral-700 hover:bg-neutral-700 hover:text-white dark:border-neutral-200 dark:text-neutral-200 dark:hover:border-neutral-500 dark:hover:bg-neutral-500 dark:hover:text-inherit",
78
+ base: "text-neutral-900 hover:border-neutral-700 hover:bg-neutral-700 hover:text-white dark:text-neutral-200 dark:hover:border-neutral-500 dark:hover:bg-neutral-500 dark:hover:text-neutral-900",
82
79
  },
83
80
  },
84
81
  {
@@ -92,7 +89,7 @@ const buttonVariants = tv({
92
89
  color: "success",
93
90
  variant: "outlined",
94
91
  class: {
95
- base: "border-green-500 text-green-500 hover:border-green-700 hover:bg-green-700 hover:text-white dark:border-green-500 dark:text-green-500 dark:hover:border-green-700 dark:hover:bg-green-700",
92
+ base: "text-green-500 hover:border-green-700 hover:bg-green-700 hover:text-white dark:text-green-500 dark:hover:border-green-700 dark:hover:bg-green-700",
96
93
  },
97
94
  },
98
95
  {
@@ -106,7 +103,7 @@ const buttonVariants = tv({
106
103
  color: "error",
107
104
  variant: "outlined",
108
105
  class: {
109
- base: "border-red-500 text-red-500 hover:border-red-700 hover:bg-red-700 hover:text-white dark:border-red-500 dark:text-red-500 dark:hover:border-red-700 dark:hover:bg-red-700",
106
+ base: "text-red-500 hover:border-red-700 hover:bg-red-700 hover:text-white dark:text-red-500 dark:hover:border-red-700 dark:hover:bg-red-700",
110
107
  },
111
108
  },
112
109
  {
@@ -67,7 +67,7 @@
67
67
  onclick={handleClose}
68
68
  onmouseenter={handleMouseOver}
69
69
  {...rest}>
70
- <Icon class="relative z-10" name="close" size={16} />
70
+ <Icon class="relative z-10" name="closeSmall" size={16} />
71
71
  {#if animate}
72
72
  <span
73
73
  bind:this={barEl}
@@ -19,9 +19,9 @@ const iconButtonVariants = tv({
19
19
  large: "p-2.75",
20
20
  },
21
21
  variant: {
22
- filled: "border-1 border-transparent",
23
- outlined: "border-1",
24
- transparent: "border-1 border-transparent",
22
+ filled: "border border-transparent",
23
+ outlined: "border",
24
+ transparent: "border border-transparent",
25
25
  },
26
26
  },
27
27
  compoundVariants: [
@@ -5,7 +5,7 @@ const avatarVariants = tv({
5
5
  base: "flex overflow-hidden",
6
6
  image: "h-full w-full object-cover",
7
7
  fallback:
8
- "flex h-full w-full items-center justify-center bg-blue-100 heading-h6 text-neutral-900",
8
+ "flex h-full w-full items-center justify-center bg-blue-100 ui-title-2 text-neutral-900",
9
9
  },
10
10
  variants: {
11
11
  as: {
@@ -13,7 +13,7 @@ const avatarVariants = tv({
13
13
  },
14
14
  shape: {
15
15
  circle: "rounded-full",
16
- square: "rounded",
16
+ square: "rounded-sm",
17
17
  },
18
18
  },
19
19
  });
@@ -2,7 +2,7 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const badgeVariants = tv({
4
4
  slots: {
5
- base: "absolute inline-flex items-center justify-center rounded-full body-extra-small select-none",
5
+ base: "absolute inline-flex items-center justify-center rounded-full ui-caption-helper select-none",
6
6
  wrapper: "relative inline-flex gap-0.5",
7
7
  },
8
8
  variants: {
@@ -2,7 +2,7 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const chipVariants = tv({
4
4
  base: [
5
- "relative inline-flex items-center gap-1 rounded border align-middle select-none [button]:cursor-pointer",
5
+ "relative inline-flex items-center gap-1 rounded-sm border align-middle select-none [button]:cursor-pointer",
6
6
  "ring-blue-500 ring-offset-1 ring-offset-transparent outline-0 focus-visible:ring-1 dark:ring-blue-400",
7
7
  ],
8
8
  variants: {
@@ -15,7 +15,7 @@ const chipVariants = tv({
15
15
  warning: "bg-yellow-500 text-neutral-900",
16
16
  },
17
17
  size: {
18
- small: "min-h-[20px] px-2 py-0.5 body-extra-small",
18
+ small: "min-h-[20px] px-2 py-0.5 ui-tag-badge",
19
19
  big: "min-h-[28px] px-3 py-1.5 body-small",
20
20
  },
21
21
  iconPosition: {
@@ -2,9 +2,9 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const progressBarVariants = tv({
4
4
  slots: {
5
- bar: "h-1 w-full rounded-sm bg-neutral-100 after:block after:h-full after:w-[var(--progress)] after:rounded-sm after:bg-neutral-900 after:transition-[width] after:duration-300 after:ease-in-out dark:bg-neutral-900 dark:after:bg-neutral-100",
5
+ bar: "h-1 w-full rounded-sm bg-neutral-100 after:block after:h-full after:w-(--progress) after:rounded-sm after:bg-neutral-900 after:transition-[width] after:duration-300 after:ease-in-out dark:bg-neutral-900 dark:after:bg-neutral-100",
6
6
  base: "flex items-center gap-4",
7
- label: "body-small text-nowrap text-neutral-500 tabular-nums",
7
+ label: "ui-select-label text-nowrap text-neutral-500 tabular-nums",
8
8
  },
9
9
  });
10
10
 
@@ -2,7 +2,7 @@ export const helperTextVariants: import("tailwind-variants").TVReturnType<{
2
2
  error: {
3
3
  true: string;
4
4
  };
5
- }, undefined, "body-extra-small text-neutral-500", {
5
+ }, undefined, "ui-caption-helper text-neutral-500", {
6
6
  error: {
7
7
  true: string;
8
8
  };
@@ -10,4 +10,4 @@ export const helperTextVariants: import("tailwind-variants").TVReturnType<{
10
10
  error: {
11
11
  true: string;
12
12
  };
13
- }, undefined, "body-extra-small text-neutral-500", unknown, unknown, undefined>>;
13
+ }, undefined, "ui-caption-helper text-neutral-500", unknown, unknown, undefined>>;
@@ -1,7 +1,7 @@
1
1
  import { tv } from "tailwind-variants";
2
2
 
3
3
  const helperTextVariants = tv({
4
- base: "body-extra-small text-neutral-500",
4
+ base: "ui-caption-helper text-neutral-500",
5
5
  variants: {
6
6
  error: {
7
7
  true: "text-red-500",
@@ -34,7 +34,7 @@
34
34
  <Comp
35
35
  aria-hidden={title ? undefined : "true"}
36
36
  aria-label={title || undefined}
37
- class={`cms-icon ${className}`}
37
+ class={`cms-icon${className ? ` ${className}` : ""}`}
38
38
  {color}
39
39
  height={wh}
40
40
  role={title ? "img" : undefined}
@@ -6,7 +6,7 @@ import { tv } from "tailwind-variants";
6
6
  const inputBaseVariant = tv({
7
7
  slots: {
8
8
  base: [
9
- "w-full rounded bg-transparent px-4 body-default",
9
+ "w-full rounded-lg px-4 body-small",
10
10
  "text-neutral-900 placeholder-neutral-500 dark:text-neutral-200",
11
11
  "bg-white dark:bg-neutral-800",
12
12
  "outline-transparent transition-[border,color,outline] duration-300",
@@ -29,9 +29,9 @@ const inputBaseVariant = tv({
29
29
  error: false,
30
30
  class: {
31
31
  base: [
32
- "hover:ring-1 focus:ring-1",
33
- "hover:border-blue-500 hover:ring-blue-500 focus:border-blue-500 focus:ring-blue-500",
34
- "dark:hover:border-blue-400 dark:hover:ring-blue-400 dark:focus:border-blue-400 dark:focus:ring-blue-400",
32
+ "focus-within:ring-1 hover:ring-1",
33
+ "focus-within:border-blue-500 focus-within:ring-blue-500 hover:border-blue-500 hover:ring-blue-500",
34
+ "dark:focus-within:border-blue-400 dark:focus-within:ring-blue-400 dark:hover:border-blue-400 dark:hover:ring-blue-400",
35
35
  ],
36
36
  },
37
37
  },
@@ -5,7 +5,7 @@ export const labelVariants: import("tailwind-variants").TVReturnType<{
5
5
  hidden: {
6
6
  true: string;
7
7
  };
8
- }, undefined, "body-small text-neutral-500", {
8
+ }, undefined, "ui-select-label text-neutral-500", {
9
9
  error: {
10
10
  true: string;
11
11
  };
@@ -19,4 +19,4 @@ export const labelVariants: import("tailwind-variants").TVReturnType<{
19
19
  hidden: {
20
20
  true: string;
21
21
  };
22
- }, undefined, "body-small text-neutral-500", unknown, unknown, undefined>>;
22
+ }, undefined, "ui-select-label text-neutral-500", unknown, unknown, undefined>>;
@@ -1,7 +1,7 @@
1
1
  import { tv } from "tailwind-variants";
2
2
 
3
3
  const labelVariants = tv({
4
- base: "body-small text-neutral-500",
4
+ base: "ui-select-label text-neutral-500",
5
5
  variants: {
6
6
  error: {
7
7
  true: "text-red-500",
@@ -30,7 +30,6 @@
30
30
  required = false,
31
31
  value = $bindable(),
32
32
  variant = "default",
33
-
34
33
  ...rest
35
34
  } = $props();
36
35
 
@@ -6,7 +6,7 @@ const selectVariants = tv({
6
6
  slots: {
7
7
  base: [
8
8
  "flex items-center",
9
- "[&::picker(select)]:my-1 [&::picker(select)]:rounded [&::picker(select)]:border-0 [&::picker(select)]:p-1",
9
+ "[&::picker(select)]:my-1 [&::picker(select)]:rounded-sm [&::picker(select)]:border-0 [&::picker(select)]:p-1",
10
10
  "[&::picker-icon]:hidden",
11
11
  "[&::picker(select)]:bg-white [&::picker(select)]:shadow-sm dark:[&::picker(select)]:bg-neutral-800",
12
12
  "bg-none after:bg-current after:bg-size-[100%] after:bg-center after:bg-no-repeat",
@@ -14,7 +14,7 @@ const selectVariants = tv({
14
14
  "[&:open]:after:rotate-180",
15
15
  ],
16
16
  option: [
17
- "flex rounded p-2 body-small",
17
+ "flex rounded-sm p-2 ui-select-label",
18
18
  "bg-white dark:bg-neutral-800",
19
19
  "bg-linear-to-r to-transparent",
20
20
  "[&::checkmark]:order-1 [&::checkmark]:ml-auto [&::checkmark]:shrink-0",
@@ -2,12 +2,12 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const notificationVariants = tv({
4
4
  slots: {
5
- base: "grid grid-cols-[40px_1fr_24px] gap-2 rounded-lg border-1 border-neutral-300 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-900",
6
- close: "col-[3] self-start",
5
+ base: "grid grid-cols-[40px_1fr_24px] gap-2 rounded-lg border border-neutral-300 bg-white p-2 dark:border-neutral-700 dark:bg-neutral-900",
6
+ close: "col-3 self-start",
7
7
  icon: "flex h-10 w-10 items-center justify-center rounded-sm text-white",
8
8
  content: "flex flex-col justify-center",
9
- message: "body-extra-small text-neutral-500",
10
- title: "body-default dark:text-white",
9
+ message: "ui-caption-helper text-neutral-500",
10
+ title: "body-small dark:text-white",
11
11
  },
12
12
  variants: {
13
13
  variant: {
@@ -2,8 +2,8 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const colorSwatchVariants = tv({
4
4
  slots: {
5
- base: "flex cursor-pointer items-center justify-center gap-1 rounded transition duration-200 select-none hover:bg-neutral-300 dark:hover:bg-neutral-700",
6
- iconText: "flex h-4 w-4 items-center justify-center rounded",
5
+ base: "flex cursor-pointer items-center justify-center gap-1 rounded-sm transition duration-200 select-none hover:bg-neutral-300 dark:hover:bg-neutral-700",
6
+ iconText: "flex h-4 w-4 items-center justify-center rounded-sm",
7
7
  iconArrow: "dark:text-white",
8
8
  },
9
9
  variants: {
@@ -2,7 +2,7 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const richTextEditorVariants = tv({
4
4
  slots: {
5
- base: "body-default text-neutral-800 dark:text-white",
5
+ base: "body-small text-neutral-800 dark:text-white",
6
6
  toolbar:
7
7
  "pointer flex gap-0.5 rounded-t-sm border border-b-0 border-neutral-300 px-5 py-2 dark:border-neutral-700",
8
8
  field: [
@@ -2,11 +2,12 @@ import { tv } from "tailwind-variants";
2
2
 
3
3
  const selectorCardVariants = tv({
4
4
  slots: {
5
- base: "flex cursor-pointer gap-3 rounded-sm border border-neutral-300 bg-white px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800",
6
- content: "flex grow flex-col items-start gap-1",
7
- helperText: "body-small text-neutral-500",
5
+ base: "flex cursor-pointer gap-3 rounded-lg border border-neutral-300 bg-white px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800",
6
+ content: "",
7
+ helperText: "ui-caption-helper text-neutral-500",
8
8
  input: "shrink-0",
9
- label: "cursor-[inherit] heading-h6 text-neutral-900 dark:text-neutral-200",
9
+ label:
10
+ "mb-0.5 cursor-[inherit] ui-title-2 text-neutral-900 dark:text-neutral-200",
10
11
  },
11
12
  variants: {
12
13
  disabled: {
@@ -16,7 +17,7 @@ const selectorCardVariants = tv({
16
17
  },
17
18
  error: {
18
19
  true: {
19
- base: "!border-red-500 outline-1 !outline-red-500",
20
+ base: "border-red-500! outline-1 outline-red-500!",
20
21
  label: "text-red-500 dark:text-red-500",
21
22
  },
22
23
  },
@@ -0,0 +1,113 @@
1
+ <script>
2
+ import { Icon } from "../../../index.js";
3
+ import { onDestroy, onMount } from "svelte";
4
+ import { tagSelectorVariants } from "./tagSelector.variants.js";
5
+
6
+ let {
7
+ filtered,
8
+ highlighted,
9
+ inputRef,
10
+ labelCreate,
11
+ localValues,
12
+ onCreateItem,
13
+ onSelectItem,
14
+ query,
15
+ showCreate,
16
+ value = [],
17
+ ...rest
18
+ } = $props();
19
+
20
+ let styles = $derived(tagSelectorVariants());
21
+
22
+ let dropdownPosition = $state("bottom");
23
+ let dropdownMaxHeight = $state(200);
24
+
25
+ const attachHighlightedItem = (item) => {
26
+ if (inputRef) {
27
+ // so the screen reader can read the highlighted option aloud
28
+ if (item.id) inputRef.setAttribute("aria-activedescendant", item.id);
29
+ else inputRef.removeAttribute("aria-activedescendant");
30
+ }
31
+
32
+ // maybe scroll item into view
33
+ if (item.offsetTop < item.offsetParent.scrollTop)
34
+ item.scrollIntoView({ block: "nearest" });
35
+ else if (
36
+ item.offsetTop + item.offsetHeight >
37
+ item.offsetParent.scrollTop + item.offsetParent.offsetHeight
38
+ )
39
+ item.scrollIntoView({ block: "nearest" });
40
+ };
41
+
42
+ const updateDropdownPosition = () => {
43
+ if (!inputRef) return;
44
+
45
+ const rect = inputRef.getBoundingClientRect();
46
+ const spaceBelow = window.innerHeight - rect.bottom;
47
+ const spaceAbove = rect.top;
48
+
49
+ dropdownPosition = spaceBelow > spaceAbove ? "bottom" : "top";
50
+
51
+ dropdownMaxHeight =
52
+ dropdownPosition === "bottom"
53
+ ? Math.min(300, spaceBelow - 24)
54
+ : Math.min(300, spaceAbove - 24);
55
+ };
56
+
57
+ const getOptionId = (itemId) =>
58
+ `${localValues?.id ?? "tagselector"}-option-${itemId}`;
59
+
60
+ onMount(() => updateDropdownPosition());
61
+ onDestroy(() => {
62
+ inputRef?.removeAttribute("aria-activedescendant");
63
+ });
64
+
65
+ let showDropdown = $derived(filtered.length > 0 || showCreate);
66
+ </script>
67
+
68
+ <svelte:window onscroll={updateDropdownPosition} onresize={updateDropdownPosition} />
69
+
70
+ <div
71
+ class={styles.dropdown({ dropdownPosition, showDropdown })}
72
+ id={localValues.id}
73
+ role="listbox"
74
+ style={`max-height: ${dropdownMaxHeight}px`}
75
+ tabindex="-1"
76
+ {...rest}>
77
+ {#snippet option({ highlighted, id, label, selected, ...rest })}
78
+ <button
79
+ aria-selected={selected}
80
+ {@attach highlighted ? attachHighlightedItem : null}
81
+ class={styles.dropdownItem()}
82
+ data-highlighted={highlighted}
83
+ {id}
84
+ role="option"
85
+ tabindex="-1"
86
+ {...rest}>
87
+ {label}
88
+ {#if selected}
89
+ <Icon class={styles.dropdownCheckmark()} name="check" size={16} />
90
+ {/if}
91
+ </button>
92
+ {/snippet}
93
+
94
+ {#each filtered as item, i (item.id)}
95
+ {@render option({
96
+ highlighted: highlighted === i,
97
+ id: getOptionId(item.id),
98
+ label: item.label,
99
+ selected: value.includes(item.id),
100
+ onclick: () => onSelectItem(item.id),
101
+ })}
102
+ {/each}
103
+
104
+ {#if showCreate}
105
+ {@render option({
106
+ highlighted: highlighted === filtered.length,
107
+ id: getOptionId("create"),
108
+ label: `${labelCreate}: "${query}"`,
109
+ selected: false,
110
+ onclick: onCreateItem,
111
+ })}
112
+ {/if}
113
+ </div>
@@ -0,0 +1,29 @@
1
+ export default Dropdown;
2
+ type Dropdown = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Dropdown: import("svelte").Component<{
7
+ filtered: any;
8
+ highlighted: any;
9
+ inputRef: any;
10
+ labelCreate: any;
11
+ localValues: any;
12
+ onCreateItem: any;
13
+ onSelectItem: any;
14
+ query: any;
15
+ showCreate: any;
16
+ value?: any[];
17
+ } & Record<string, any>, {}, "">;
18
+ type $$ComponentProps = {
19
+ filtered: any;
20
+ highlighted: any;
21
+ inputRef: any;
22
+ labelCreate: any;
23
+ localValues: any;
24
+ onCreateItem: any;
25
+ onSelectItem: any;
26
+ query: any;
27
+ showCreate: any;
28
+ value?: any[];
29
+ } & Record<string, any>;