@websline/system-components 1.4.4 → 1.4.7

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 (66) hide show
  1. package/dist/assets/fonts/borna-bold-webfont.woff +0 -0
  2. package/dist/assets/fonts/borna-bold-webfont.woff2 +0 -0
  3. package/dist/assets/fonts/borna-bolditalic-webfont.woff +0 -0
  4. package/dist/assets/fonts/borna-bolditalic-webfont.woff2 +0 -0
  5. package/dist/assets/fonts/borna-medium-webfont.woff +0 -0
  6. package/dist/assets/fonts/borna-medium-webfont.woff2 +0 -0
  7. package/dist/assets/fonts/borna-mediumitalic-webfont.woff +0 -0
  8. package/dist/assets/fonts/borna-mediumitalic-webfont.woff2 +0 -0
  9. package/dist/assets/fonts/borna-regular-webfont.woff +0 -0
  10. package/dist/assets/fonts/borna-regular-webfont.woff2 +0 -0
  11. package/dist/assets/fonts/borna-regularitalic-webfont.woff +0 -0
  12. package/dist/assets/fonts/borna-regularitalic-webfont.woff2 +0 -0
  13. package/dist/assets/fonts/borna-semibold-webfont.woff +0 -0
  14. package/dist/assets/fonts/borna-semibold-webfont.woff2 +0 -0
  15. package/dist/assets/fonts/borna-semibolditalic-webfont.woff +0 -0
  16. package/dist/assets/fonts/borna-semibolditalic-webfont.woff2 +0 -0
  17. package/dist/components/atoms/checkbox/checkbox.variants.d.ts +2 -2
  18. package/dist/components/atoms/checkbox/checkbox.variants.js +1 -1
  19. package/dist/components/atoms/icon/components/Lightning.svelte +26 -0
  20. package/dist/components/atoms/icon/components/Lightning.svelte.d.ts +41 -0
  21. package/dist/components/atoms/icon/components/index.d.ts +1 -0
  22. package/dist/components/atoms/icon/components/index.js +1 -0
  23. package/dist/components/atoms/radio/Radio.svelte +57 -2
  24. package/dist/components/atoms/tag/Tag.svelte +9 -7
  25. package/dist/components/atoms/tag/Tag.svelte.d.ts +8 -8
  26. package/dist/components/atoms/tag/tag.variants.d.ts +0 -9
  27. package/dist/components/atoms/tag/tag.variants.js +1 -4
  28. package/dist/components/molecules/calendar/Calendar.svelte +95 -0
  29. package/dist/components/molecules/calendar/Calendar.svelte.d.ts +42 -0
  30. package/dist/components/molecules/calendar/Container.svelte +25 -0
  31. package/dist/components/molecules/calendar/Container.svelte.d.ts +25 -0
  32. package/dist/components/molecules/calendar/DayCell.svelte +47 -0
  33. package/dist/components/molecules/calendar/RootContext.svelte +28 -0
  34. package/dist/components/molecules/calendar/RootContext.svelte.d.ts +21 -0
  35. package/dist/components/molecules/calendar/WeekRow.svelte +65 -0
  36. package/dist/components/molecules/calendar/Weekdays.svelte +27 -0
  37. package/dist/components/molecules/calendar/Weekdays.svelte.d.ts +17 -0
  38. package/dist/components/molecules/calendar/calendar.variant.d.ts +79 -0
  39. package/dist/components/molecules/calendar/calendar.variant.js +36 -0
  40. package/dist/components/molecules/calendar/index.d.ts +8 -0
  41. package/dist/components/molecules/calendar/index.js +10 -0
  42. package/dist/components/molecules/formField/FormField.svelte +1 -1
  43. package/dist/components/molecules/formField/FormField.svelte.d.ts +2 -2
  44. package/dist/components/molecules/formField/formField.variants.d.ts +12 -12
  45. package/dist/components/molecules/formField/formField.variants.js +21 -5
  46. package/dist/components/molecules/richTextEditor/RichTextEditor.svelte +2 -4
  47. package/dist/components/molecules/selectorCard/SelectorCard.svelte +8 -2
  48. package/dist/components/molecules/selectorCard/SelectorCard.svelte.d.ts +2 -2
  49. package/dist/components/molecules/tagSelector/TagSelector.svelte +12 -0
  50. package/dist/components/molecules/tagSelector/TagSelector.svelte.d.ts +16 -0
  51. package/dist/components/molecules/tagSelector/ValueList.svelte +12 -2
  52. package/dist/components/molecules/tagSelector/ValueList.svelte.d.ts +4 -0
  53. package/dist/components/molecules/tagSelector/tagSelector.variants.js +2 -2
  54. package/dist/components/organisms/tooltip/Content.svelte +51 -0
  55. package/dist/components/organisms/tooltip/Content.svelte.d.ts +57 -0
  56. package/dist/components/organisms/tooltip/Tooltip.svelte +15 -0
  57. package/dist/components/organisms/tooltip/Tooltip.svelte.d.ts +17 -0
  58. package/dist/components/organisms/tooltip/Trigger.svelte +13 -0
  59. package/dist/components/organisms/tooltip/Trigger.svelte.d.ts +17 -0
  60. package/dist/components/organisms/tooltip/index.d.ts +4 -0
  61. package/dist/components/organisms/tooltip/index.js +5 -0
  62. package/dist/components/organisms/tooltip/tooltip.variant.d.ts +24 -0
  63. package/dist/components/organisms/tooltip/tooltip.variant.js +20 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.js +2 -0
  66. package/package.json +108 -99
@@ -0,0 +1,65 @@
1
+ <script>
2
+ import { Calendar } from "bits-ui";
3
+ import { getContext } from "svelte";
4
+ import { calendarVariants } from "./calendar.variant.js";
5
+
6
+ /**
7
+ * @typedef {import("bits-ui").CalendarGridRowPropsWithoutHTML} CalendarGridRowPropsWithoutHTML
8
+ * @typedef {import("bits-ui").CalendarRootPropsWithoutHTML} CalendarRootProps
9
+ *
10
+ * @typedef {Object} Props
11
+ * @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
12
+ * @property {string} [class=""] Additional CSS classes to apply to the component
13
+ * @property {CalendarRootProps["minValue"][]} weekDates
14
+ */
15
+
16
+ /** @type {CalendarGridRowPropsWithoutHTML & Props} */
17
+ let { children, class: className = "", weekDates, ...rest } = $props();
18
+
19
+ let ctx = $derived.by(getContext("calendar-root-store"));
20
+
21
+ /**
22
+ * The left/right margin or nothing
23
+ * @type {[number, number] | undefined}
24
+ */
25
+ let range = $derived.by(() => {
26
+ if (!Array.isArray(ctx.value) || ctx.maxDays !== 2 || ctx.value.length > 2)
27
+ return;
28
+
29
+ let dates = [...ctx.value];
30
+ if (dates.length === 1 && ctx.hoverValue) {
31
+ dates.push(ctx.hoverValue);
32
+ }
33
+ if (dates.length !== 2) return;
34
+ dates.sort();
35
+
36
+ const [startOffset, endOffset] = [
37
+ [dates[0], weekDates[0]],
38
+ [dates[1], weekDates.at(-1)],
39
+ ].map(([date, weekday]) => date.compare(weekday) / 7);
40
+
41
+ if (startOffset >= 1 || endOffset <= -1) return;
42
+
43
+ // 1.06 is to prevent the range bg from getting past the selected dates
44
+ return [
45
+ startOffset < 0 ? 0 : startOffset * 1.06, // left
46
+ endOffset > 0 ? 0 : endOffset * -1.06, // right
47
+ ].map((value) => Math.round(value * 1e5) / 1e3);
48
+ });
49
+
50
+ let styles = $derived(calendarVariants());
51
+ </script>
52
+
53
+ <Calendar.GridRow class={styles.gridRow({ class: className })} {...rest}>
54
+ {#each weekDates as date, i (i)}
55
+ {@render children?.({ date })}
56
+ {/each}
57
+ {#if range}
58
+ <div class={styles.rangeWrapper()}>
59
+ <div
60
+ class={styles.rangeBg()}
61
+ style={`margin-left:${range[0]}%;margin-right:${range[1]}%`}>
62
+ </div>
63
+ </div>
64
+ {/if}
65
+ </Calendar.GridRow>
@@ -0,0 +1,27 @@
1
+ <script>
2
+ import { Calendar } from "bits-ui";
3
+ import { getContext } from "svelte";
4
+ import { calendarVariants } from "./calendar.variant.js";
5
+
6
+ /**
7
+ * @typedef {import("bits-ui").CalendarGridHeadPropsWithoutHTML} CalendarGridHeadPropsWithoutHTML
8
+ *
9
+ * @typedef {Object} Props
10
+ * @property {string} [class=""] Additional CSS classes to apply to the component
11
+ */
12
+
13
+ /** @type {Omit<CalendarGridHeadPropsWithoutHTML, "child" | "children"> & Props} */
14
+ let { class: className = "", ...rest } = $props();
15
+
16
+ let ctx = $derived.by(getContext("calendar-root-store"));
17
+ let styles = $derived(calendarVariants());
18
+ </script>
19
+
20
+ <Calendar.GridHead class={styles.gridHead({ class: className })} {...rest}>
21
+ <Calendar.GridRow class={styles.gridRow()}>
22
+ {#each ctx.weekdays as day, i (i)}
23
+ <Calendar.HeadCell class={styles.gridHeadCell()} style="font-weight:inherit"
24
+ >{day}</Calendar.HeadCell>
25
+ {/each}
26
+ </Calendar.GridRow>
27
+ </Calendar.GridHead>
@@ -0,0 +1,17 @@
1
+ export default Weekdays;
2
+ type Weekdays = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Omit<CalendarGridHeadPropsWithoutHTML, "children" | "child"> & Props>): void;
5
+ };
6
+ declare const Weekdays: import("svelte").Component<Omit<import("bits-ui").CalendarGridHeadPropsWithoutHTML, "children" | "child"> & {
7
+ /**
8
+ * Additional CSS classes to apply to the component
9
+ */
10
+ class?: string;
11
+ }, {}, "">;
12
+ type Props = {
13
+ /**
14
+ * Additional CSS classes to apply to the component
15
+ */
16
+ class?: string;
17
+ };
@@ -0,0 +1,79 @@
1
+ export const calendarVariants: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-variants").ClassValue | {
4
+ heading?: import("tailwind-variants").ClassValue;
5
+ base?: import("tailwind-variants").ClassValue;
6
+ dateCell?: import("tailwind-variants").ClassValue;
7
+ dateDay?: import("tailwind-variants").ClassValue;
8
+ grid?: import("tailwind-variants").ClassValue;
9
+ gridHead?: import("tailwind-variants").ClassValue;
10
+ gridHeadCell?: import("tailwind-variants").ClassValue;
11
+ gridRow?: import("tailwind-variants").ClassValue;
12
+ gridWrapper?: import("tailwind-variants").ClassValue;
13
+ header?: import("tailwind-variants").ClassValue;
14
+ headerBtn?: import("tailwind-variants").ClassValue;
15
+ rangeBg?: import("tailwind-variants").ClassValue;
16
+ rangeWrapper?: import("tailwind-variants").ClassValue;
17
+ };
18
+ };
19
+ } | {
20
+ [x: string]: {
21
+ [x: string]: import("tailwind-variants").ClassValue | {
22
+ heading?: import("tailwind-variants").ClassValue;
23
+ base?: import("tailwind-variants").ClassValue;
24
+ dateCell?: import("tailwind-variants").ClassValue;
25
+ dateDay?: import("tailwind-variants").ClassValue;
26
+ grid?: import("tailwind-variants").ClassValue;
27
+ gridHead?: import("tailwind-variants").ClassValue;
28
+ gridHeadCell?: import("tailwind-variants").ClassValue;
29
+ gridRow?: import("tailwind-variants").ClassValue;
30
+ gridWrapper?: import("tailwind-variants").ClassValue;
31
+ header?: import("tailwind-variants").ClassValue;
32
+ headerBtn?: import("tailwind-variants").ClassValue;
33
+ rangeBg?: import("tailwind-variants").ClassValue;
34
+ rangeWrapper?: import("tailwind-variants").ClassValue;
35
+ };
36
+ };
37
+ }, {
38
+ base: string;
39
+ dateCell: string[];
40
+ dateDay: string[];
41
+ grid: string;
42
+ gridHead: string;
43
+ gridHeadCell: string;
44
+ gridRow: string;
45
+ gridWrapper: string;
46
+ header: string;
47
+ headerBtn: string[];
48
+ heading: string;
49
+ rangeBg: string;
50
+ rangeWrapper: string;
51
+ }, undefined, any, {
52
+ base: string;
53
+ dateCell: string[];
54
+ dateDay: string[];
55
+ grid: string;
56
+ gridHead: string;
57
+ gridHeadCell: string;
58
+ gridRow: string;
59
+ gridWrapper: string;
60
+ header: string;
61
+ headerBtn: string[];
62
+ heading: string;
63
+ rangeBg: string;
64
+ rangeWrapper: string;
65
+ }, import("tailwind-variants").TVReturnType<any, {
66
+ base: string;
67
+ dateCell: string[];
68
+ dateDay: string[];
69
+ grid: string;
70
+ gridHead: string;
71
+ gridHeadCell: string;
72
+ gridRow: string;
73
+ gridWrapper: string;
74
+ header: string;
75
+ headerBtn: string[];
76
+ heading: string;
77
+ rangeBg: string;
78
+ rangeWrapper: string;
79
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,36 @@
1
+ import { tv } from "../../../utils/tailwind.js";
2
+
3
+ const calendarVariants = tv({
4
+ slots: {
5
+ base: "w-fit rounded-lg bg-white shadow-sm",
6
+ dateCell: [
7
+ "group relative z-1 cursor-pointer p-1 ui-select-label",
8
+ "data-disabled:pointer-events-none data-disabled:text-neutral-400",
9
+ "data-unavailable:pointer-events-none data-unavailable:text-neutral-400 data-unavailable:line-through",
10
+ ],
11
+ dateDay: [
12
+ "grid size-8 place-items-center rounded-full",
13
+ "group-hover:bg-neutral-900 group-hover:text-neutral-100",
14
+ "data-selected:bg-neutral-900 data-selected:text-neutral-100",
15
+ // Today marker:
16
+ "before:absolute before:top-2 before:hidden before:size-0.75 before:rounded-full before:bg-current data-today:before:block",
17
+ ],
18
+ grid: "block border-l border-neutral-300 p-1 select-none first:border-0",
19
+ gridHead: "mb-1 ui-select-label text-neutral-500",
20
+ gridHeadCell: "py-1",
21
+ gridRow:
22
+ "relative flex items-center justify-around px-4 py-1 text-center data-readonly:pointer-events-none",
23
+ gridWrapper: "flex flex-wrap",
24
+ header:
25
+ "flex items-center justify-between gap-2 border-b border-neutral-300 px-6 py-4",
26
+ headerBtn: [
27
+ "inline-flex size-8 cursor-pointer items-center justify-center",
28
+ "data-disabled:pointer-events-none data-disabled:opacity-40",
29
+ ],
30
+ heading: "ui-select-label",
31
+ rangeBg: "h-full rounded-2xl bg-neutral-100",
32
+ rangeWrapper: "absolute inset-0 mx-6 my-2",
33
+ },
34
+ });
35
+
36
+ export { calendarVariants };
@@ -0,0 +1,8 @@
1
+ import Root from "./Calendar.svelte";
2
+ import Container from "./Container.svelte";
3
+ import DayCell from "./DayCell.svelte";
4
+ export const MonthGrid: import("svelte").Component<Calendar.GridBodyProps, {}, "ref">;
5
+ import Weekdays from "./Weekdays.svelte";
6
+ import WeekRow from "./WeekRow.svelte";
7
+ import { Calendar } from "bits-ui";
8
+ export { Root, Container, DayCell, Weekdays, WeekRow };
@@ -0,0 +1,10 @@
1
+ import { Calendar } from "bits-ui";
2
+ import Root from "./Calendar.svelte";
3
+ import Container from "./Container.svelte";
4
+ import DayCell from "./DayCell.svelte";
5
+ import Weekdays from "./Weekdays.svelte";
6
+ import WeekRow from "./WeekRow.svelte";
7
+
8
+ const MonthGrid = Calendar.GridBody;
9
+
10
+ export { Root, Container, DayCell, MonthGrid, Weekdays, WeekRow };
@@ -14,7 +14,7 @@
14
14
  * @property {string} [helperText=""] The helper text for the form field
15
15
  * @property {string} [id=""] The id attribute for the form field (passed down to the input)
16
16
  * @property {string} [label=""] The label text for the form field
17
- * @property {"stacked" | "inline"} [layout="stacked"] The layout of the input and label
17
+ * @property {"stacked" | "inline" | "checkable"} [layout="stacked"] The layout of the input and label
18
18
  * @property {boolean} [required=false] Whether the form field is required (passed down to the input)
19
19
  */
20
20
 
@@ -39,7 +39,7 @@ declare const FormField: import("svelte").Component<{
39
39
  /**
40
40
  * The layout of the input and label
41
41
  */
42
- layout?: "stacked" | "inline";
42
+ layout?: "stacked" | "inline" | "checkable";
43
43
  /**
44
44
  * Whether the form field is required (passed down to the input)
45
45
  */
@@ -81,7 +81,7 @@ type Props = {
81
81
  /**
82
82
  * The layout of the input and label
83
83
  */
84
- layout?: "stacked" | "inline";
84
+ layout?: "stacked" | "inline" | "checkable";
85
85
  /**
86
86
  * Whether the form field is required (passed down to the input)
87
87
  */
@@ -1,10 +1,10 @@
1
1
  export const formFieldVariants: import("tailwind-variants").TVReturnType<{
2
- disabled: {
3
- true: {
2
+ layout: {
3
+ checkable: {
4
+ base: string;
5
+ label: string;
4
6
  helperText: string;
5
7
  };
6
- };
7
- layout: {
8
8
  inline: {
9
9
  base: string;
10
10
  helperText: string;
@@ -15,12 +15,12 @@ export const formFieldVariants: import("tailwind-variants").TVReturnType<{
15
15
  label: string;
16
16
  helperText: string;
17
17
  }, undefined, {
18
- disabled: {
19
- true: {
18
+ layout: {
19
+ checkable: {
20
+ base: string;
21
+ label: string;
20
22
  helperText: string;
21
23
  };
22
- };
23
- layout: {
24
24
  inline: {
25
25
  base: string;
26
26
  helperText: string;
@@ -31,12 +31,12 @@ export const formFieldVariants: import("tailwind-variants").TVReturnType<{
31
31
  label: string;
32
32
  helperText: string;
33
33
  }, import("tailwind-variants").TVReturnType<{
34
- disabled: {
35
- true: {
34
+ layout: {
35
+ checkable: {
36
+ base: string;
37
+ label: string;
36
38
  helperText: string;
37
39
  };
38
- };
39
- layout: {
40
40
  inline: {
41
41
  base: string;
42
42
  helperText: string;
@@ -7,18 +7,34 @@ const formFieldVariants = tv({
7
7
  helperText: "-mt-1 ml-4",
8
8
  },
9
9
  variants: {
10
- disabled: {
11
- true: {
12
- helperText: "opacity-40",
13
- },
14
- },
15
10
  layout: {
11
+ checkable: {
12
+ base: "grid-cols-[min-content_auto] items-center",
13
+ label: "order-2 text-current",
14
+ helperText: "order-3 col-2 ml-0",
15
+ },
16
16
  inline: {
17
17
  base: "items-center sm:grid-cols-[minmax(120px,auto)_1fr]",
18
18
  helperText: "sm:col-2",
19
19
  },
20
20
  },
21
21
  },
22
+ compoundVariants: [
23
+ {
24
+ disabled: true,
25
+ layout: ["inline", "stacked"],
26
+ class: {
27
+ helperText: "opacity-40",
28
+ },
29
+ },
30
+ {
31
+ disabled: true,
32
+ layout: "checkable",
33
+ class: {
34
+ base: "opacity-40",
35
+ },
36
+ },
37
+ ],
22
38
  });
23
39
 
24
40
  export { formFieldVariants };
@@ -198,11 +198,9 @@
198
198
 
199
199
  $effect(() => {
200
200
  if (!editor) return;
201
-
202
- const current = editor.getHTML();
203
201
  const next = content ?? "";
204
-
205
- if (current !== next) {
202
+ const matches = next === editor.getText() || next === editor.getHTML();
203
+ if (!matches) {
206
204
  isContentPropUpdate = true;
207
205
  editor.commands.setContent(next, false);
208
206
  }
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import { settled } from "svelte";
3
3
  import { selectorCardVariants } from "./selectorCard.variants.js";
4
- import { Switch, Radio, Label, utils } from "../../../index.js";
4
+ import { Checkbox, Switch, Radio, Label, utils } from "../../../index.js";
5
5
 
6
6
  /**
7
7
  * @typedef {Object} Props
@@ -15,7 +15,7 @@
15
15
  * @property {string} [label=""] Label to display in the card
16
16
  * @property {string} [name] The name of the card, used for form submission
17
17
  * @property {boolean} [required=false] Whether the card is required
18
- * @property {"radio" | "switch"} [type="radio"] The type of card
18
+ * @property {"checkbox" | "radio" | "switch"} [type="radio"] The type of card
19
19
  * @property {string} [value=""] The value of the card
20
20
  */
21
21
 
@@ -79,6 +79,12 @@
79
79
  bind:checked
80
80
  class={styles.input()}
81
81
  {...inputProps} />
82
+ {:else if type === "checkbox"}
83
+ <Checkbox
84
+ {@attach utils.attachNode(bindInputRef)}
85
+ bind:checked
86
+ class={styles.input()}
87
+ {...inputProps} />
82
88
  {/if}
83
89
  <div class={styles.content()}>
84
90
  {#if label}
@@ -47,7 +47,7 @@ declare const SelectorCard: import("svelte").Component<{
47
47
  /**
48
48
  * The type of card
49
49
  */
50
- type?: "radio" | "switch";
50
+ type?: "checkbox" | "radio" | "switch";
51
51
  /**
52
52
  * The value of the card
53
53
  */
@@ -97,7 +97,7 @@ type Props = {
97
97
  /**
98
98
  * The type of card
99
99
  */
100
- type?: "radio" | "switch";
100
+ type?: "checkbox" | "radio" | "switch";
101
101
  /**
102
102
  * The value of the card
103
103
  */
@@ -10,6 +10,8 @@
10
10
  * @property {boolean} [autofocus=false] Whether the input should be autofocused on mount
11
11
  * @property {string} [class=""] Additional CSS classes to apply to the component
12
12
  * @property {boolean} [disabled=false] Whether the component is disabled
13
+ * @property {string|undefined} [fixedValueIcon] The name of the icon to distinguish fixed tags from others
14
+ * @property {Array<string>} [fixedValues=[]] The unremovable and always selected tags
13
15
  * @property {string} [id=""] The ID of the input element
14
16
  * @property {string} [labelCreate=""] The label for the create new tag option
15
17
  * @property {string} [name] The name of the input, used for form submission
@@ -23,6 +25,8 @@
23
25
  autofocus = false,
24
26
  class: className = "",
25
27
  disabled = false,
28
+ fixedValueIcon,
29
+ fixedValues = [],
26
30
  id = "",
27
31
  labelCreate = "",
28
32
  name,
@@ -140,6 +144,12 @@
140
144
  return;
141
145
  }
142
146
 
147
+ if (fixedValues.find((i) => i.toLowerCase() === lower)) {
148
+ // is already a fixed (pre-selected) value
149
+ refocusInput();
150
+ return;
151
+ }
152
+
143
153
  const selectedMatch = value.find(
144
154
  (id) => typeof id === "string" && id.toLowerCase() === lower,
145
155
  );
@@ -223,6 +233,8 @@
223
233
  {/if}
224
234
  <ValueList
225
235
  {@attach utils.attachNode(bindInputRef)}
236
+ {fixedValueIcon}
237
+ {fixedValues}
226
238
  {localValues}
227
239
  onKeydown={handleKey}
228
240
  onOpenDropdown={openDropdown}
@@ -16,6 +16,14 @@ declare const TagSelector: import("svelte").Component<{
16
16
  * Whether the component is disabled
17
17
  */
18
18
  disabled?: boolean;
19
+ /**
20
+ * The name of the icon to distinguish fixed tags from others
21
+ */
22
+ fixedValueIcon?: string | undefined;
23
+ /**
24
+ * The unremovable and always selected tags
25
+ */
26
+ fixedValues?: Array<string>;
19
27
  /**
20
28
  * The ID of the input element
21
29
  */
@@ -57,6 +65,14 @@ type Props = {
57
65
  * Whether the component is disabled
58
66
  */
59
67
  disabled?: boolean;
68
+ /**
69
+ * The name of the icon to distinguish fixed tags from others
70
+ */
71
+ fixedValueIcon?: string | undefined;
72
+ /**
73
+ * The unremovable and always selected tags
74
+ */
75
+ fixedValues?: Array<string>;
60
76
  /**
61
77
  * The ID of the input element
62
78
  */
@@ -3,6 +3,8 @@
3
3
  import { tagSelectorVariants } from "./tagSelector.variants.js";
4
4
 
5
5
  let {
6
+ fixedValueIcon,
7
+ fixedValues = [],
6
8
  localValues,
7
9
  onKeydown,
8
10
  onOpenDropdown,
@@ -19,15 +21,23 @@
19
21
  </script>
20
22
 
21
23
  <div class={styles.valueList()}>
24
+ {#each fixedValues as s (s)}
25
+ <Tag class={styles.item()} iconStart={fixedValueIcon} size="big">{s}</Tag>
26
+ {/each}
27
+
22
28
  {#each value as s (s)}
23
29
  {@const opt = options.find((i) => i.id === s)}
24
- <Tag class={styles.item()} icon="closeSmall" onclick={() => onRemoveItem(s)}>
30
+ <Tag
31
+ class={styles.item()}
32
+ iconEnd="closeSmall"
33
+ onclick={() => onRemoveItem(s)}
34
+ size="big">
25
35
  {opt?.label ?? s}
26
36
  </Tag>
27
37
  {/each}
28
38
 
29
39
  {#if !localValues.disabled}
30
- <Tag class={styles.searchField()} icon="add" variant="outline">
40
+ <Tag class={styles.searchField()} iconEnd="add" size="big" variant="outline">
31
41
  <input
32
42
  bind:value={query}
33
43
  autocomplete="off"
@@ -4,6 +4,8 @@ type ValueList = {
4
4
  $set?(props: Partial<$$ComponentProps>): void;
5
5
  };
6
6
  declare const ValueList: import("svelte").Component<{
7
+ fixedValueIcon: any;
8
+ fixedValues?: any[];
7
9
  localValues: any;
8
10
  onKeydown: any;
9
11
  onOpenDropdown: any;
@@ -15,6 +17,8 @@ declare const ValueList: import("svelte").Component<{
15
17
  value?: any[];
16
18
  } & Record<string, any>, {}, "query">;
17
19
  type $$ComponentProps = {
20
+ fixedValueIcon: any;
21
+ fixedValues?: any[];
18
22
  localValues: any;
19
23
  onKeydown: any;
20
24
  onOpenDropdown: any;
@@ -6,9 +6,9 @@ const tagSelectorVariants = tv({
6
6
  base: "relative min-h-10 p-1",
7
7
  valueList: "flex flex-wrap gap-1",
8
8
  item: "h-7.5",
9
- searchField: "relative h-7.5 w-30",
9
+ searchField: "relative h-7.5 w-30 flex-row-reverse gap-0",
10
10
  searchInput:
11
- "absolute inset-0 appearance-none border-0 bg-transparent pr-1 pl-7 ui-tag-badge placeholder-current focus:ring-0",
11
+ "absolute inset-0 appearance-none border-0 bg-transparent pr-8 pl-3 ui-tag-badge placeholder-current focus:ring-0",
12
12
  dropdown:
13
13
  "absolute z-1 w-full max-w-100 overflow-y-auto bg-white p-1 pr-5 shadow-sm dark:border-neutral-700 dark:bg-neutral-800",
14
14
  dropdownCheckmark: "ml-auto shrink-0",
@@ -0,0 +1,51 @@
1
+ <script>
2
+ import { Popover } from "bits-ui";
3
+ import { quintOut } from "svelte/easing";
4
+ import { scale } from "svelte/transition";
5
+ import { tooltipVariants } from "./tooltip.variant.js";
6
+
7
+ /**
8
+ * @typedef {Object} Props
9
+ * @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
10
+ * @property {string} [class=""] Additional CSS classes for the content
11
+ * @property {boolean} [portalDisabled=false] Whether the portal is disabled or not. When disabled, the content will be rendered in its original DOM location.
12
+ * @property {string} [portalTarget='body'] Where to render the content when it is open. Defaults to the body.
13
+ * @property {"top" | "right" | "bottom" | "left"} [side="top"] The preferred side of the anchor to render the floating element against when open. Will be reversed when collisions occur.
14
+ * @property {number} [sideOffset=8] The distance in pixels from the anchor to the floating element.
15
+ */
16
+
17
+ /** @type {Props} */
18
+ let {
19
+ children,
20
+ class: className = "",
21
+ portalDisabled = true,
22
+ portalTarget = "body",
23
+ side = "right",
24
+ sideOffset = 8,
25
+ ...rest
26
+ } = $props();
27
+
28
+ let styles = tooltipVariants();
29
+ </script>
30
+
31
+ <Popover.Portal disabled={portalDisabled} to={portalTarget}>
32
+ <Popover.Content
33
+ align="center"
34
+ class={styles.base()}
35
+ forceMount
36
+ {side}
37
+ {sideOffset}
38
+ {...rest}>
39
+ {#snippet child({ open, props, wrapperProps })}
40
+ {#if open}
41
+ <div {...wrapperProps}>
42
+ <div {...props} in:scale={{ duration: 300, easing: quintOut, start: 0.75 }}>
43
+ <div class={styles.child({ class: className })}>
44
+ {@render children()}
45
+ </div>
46
+ </div>
47
+ </div>
48
+ {/if}
49
+ {/snippet}
50
+ </Popover.Content>
51
+ </Popover.Portal>