@websline/system-components 1.3.3 → 1.3.5

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 (46) hide show
  1. package/dist/components/atoms/checkbox/Checkbox.svelte +1 -1
  2. package/dist/components/atoms/chip/Chip.svelte +4 -3
  3. package/dist/components/atoms/chip/chip.variants.d.ts +15 -15
  4. package/dist/components/atoms/chip/chip.variants.js +48 -29
  5. package/dist/components/atoms/radio/Radio.svelte +1 -1
  6. package/dist/components/atoms/switch/Switch.svelte +1 -1
  7. package/dist/components/atoms/tag/Tag.svelte +47 -0
  8. package/dist/components/atoms/tag/Tag.svelte.d.ts +73 -0
  9. package/dist/components/atoms/tag/tag.variants.d.ts +58 -0
  10. package/dist/components/atoms/tag/tag.variants.js +32 -0
  11. package/dist/components/molecules/richTextEditor/RichTextEditor.svelte +50 -63
  12. package/dist/components/molecules/richTextEditor/RichTextEditor.svelte.d.ts +15 -135
  13. package/dist/components/molecules/richTextEditor/toolbar/RichTextEditorToolbar.svelte +10 -11
  14. package/dist/components/molecules/richTextEditor/toolbar/RichTextEditorToolbar.svelte.d.ts +0 -2
  15. package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte +9 -2
  16. package/dist/components/molecules/richTextEditor/toolbar/ToolbarBold.svelte.d.ts +2 -7
  17. package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte +7 -4
  18. package/dist/components/molecules/richTextEditor/toolbar/ToolbarColor.svelte.d.ts +0 -2
  19. package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte +9 -2
  20. package/dist/components/molecules/richTextEditor/toolbar/ToolbarItalic.svelte.d.ts +2 -7
  21. package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte +11 -2
  22. package/dist/components/molecules/richTextEditor/toolbar/ToolbarLink.svelte.d.ts +0 -2
  23. package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte +9 -2
  24. package/dist/components/molecules/richTextEditor/toolbar/ToolbarList.svelte.d.ts +2 -7
  25. package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte +9 -2
  26. package/dist/components/molecules/richTextEditor/toolbar/ToolbarListOrdered.svelte.d.ts +2 -7
  27. package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte +2 -1
  28. package/dist/components/molecules/richTextEditor/toolbar/ToolbarRedo.svelte.d.ts +2 -7
  29. package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte +9 -2
  30. package/dist/components/molecules/richTextEditor/toolbar/ToolbarUnderline.svelte.d.ts +2 -7
  31. package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte +2 -1
  32. package/dist/components/molecules/richTextEditor/toolbar/ToolbarUndo.svelte.d.ts +2 -7
  33. package/dist/components/molecules/selectorCard/SelectorCard.svelte +1 -1
  34. package/dist/components/molecules/tagSelector/ValueList.svelte +5 -9
  35. package/dist/components/molecules/toggleGroup/ToggleGroup.svelte +21 -3
  36. package/dist/components/molecules/toggleGroup/ToggleGroup.svelte.d.ts +16 -0
  37. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +5 -3
  38. package/dist/components/molecules/toggleGroup/toggleGroup.variants.d.ts +32 -13
  39. package/dist/components/molecules/toggleGroup/toggleGroup.variants.js +12 -0
  40. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.d.ts +9 -0
  41. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.js +8 -5
  42. package/dist/components/organisms/dialog/DialogContent.svelte +2 -3
  43. package/dist/components/organisms/modal/ModalContent.svelte +2 -3
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +1 -0
  46. package/package.json +21 -21
@@ -1,143 +1,23 @@
1
1
  export default RichTextEditor;
2
- type RichTextEditor = SvelteComponent<{
3
- content?: string;
4
- size?: string;
5
- placeholder?: string;
6
- toolbarConfig?: {
7
- bold: {
8
- enabled: boolean;
9
- };
10
- history: {
11
- enabled: boolean;
12
- };
13
- italic: {
14
- enabled: boolean;
15
- };
16
- link: {
17
- enabled: boolean;
18
- };
19
- list: {
20
- enabled: boolean;
21
- };
22
- listOrdered: {
23
- enabled: boolean;
24
- };
25
- underline: {
26
- enabled: boolean;
27
- };
28
- color: {
29
- enabled: boolean;
30
- colors: string[];
31
- defaultColor: string;
32
- };
33
- };
34
- hideToolbar?: boolean;
35
- classes?: Props;
36
- fieldName?: string;
37
- }, {
38
- [evt: string]: CustomEvent<any>;
39
- }, {}> & {
40
- $$bindings?: string;
2
+ type RichTextEditor = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
41
5
  };
42
- declare const RichTextEditor: $$__sveltets_2_IsomorphicComponent<{
6
+ declare const RichTextEditor: import("svelte").Component<{
7
+ classes?: Record<string, any>;
43
8
  content?: string;
44
- size?: string;
45
- placeholder?: string;
46
- toolbarConfig?: {
47
- bold: {
48
- enabled: boolean;
49
- };
50
- history: {
51
- enabled: boolean;
52
- };
53
- italic: {
54
- enabled: boolean;
55
- };
56
- link: {
57
- enabled: boolean;
58
- };
59
- list: {
60
- enabled: boolean;
61
- };
62
- listOrdered: {
63
- enabled: boolean;
64
- };
65
- underline: {
66
- enabled: boolean;
67
- };
68
- color: {
69
- enabled: boolean;
70
- colors: string[];
71
- defaultColor: string;
72
- };
73
- };
74
- hideToolbar?: boolean;
75
- classes?: {
76
- /**
77
- * CSS class overrides for editor parts
78
- */
79
- classes?: any;
80
- /**
81
- * The initial content of the editor
82
- */
83
- content?: string;
84
- /**
85
- * The name of the field for form submissions
86
- */
87
- fieldName?: string;
88
- /**
89
- * Whether to hide the toolbar
90
- */
91
- hideToolbar?: boolean;
92
- /**
93
- * RichTextEditor size
94
- */
95
- size?: "small" | "medium" | "large";
96
- /**
97
- * Placeholder text for the editor
98
- */
99
- placeholder?: string;
100
- };
101
9
  fieldName?: string;
102
- }, {
103
- [evt: string]: CustomEvent<any>;
104
- }, {}, {}, string>;
105
- type Props = {
106
- /**
107
- * CSS class overrides for editor parts
108
- */
109
- classes?: any;
110
- /**
111
- * The initial content of the editor
112
- */
10
+ hideToolbar?: boolean;
11
+ placeholder?: string;
12
+ size?: string;
13
+ toolbarConfig?: Record<string, any>;
14
+ } & Record<string, any>, {}, "">;
15
+ type $$ComponentProps = {
16
+ classes?: Record<string, any>;
113
17
  content?: string;
114
- /**
115
- * The name of the field for form submissions
116
- */
117
18
  fieldName?: string;
118
- /**
119
- * Whether to hide the toolbar
120
- */
121
19
  hideToolbar?: boolean;
122
- /**
123
- * RichTextEditor size
124
- */
125
- size?: "small" | "medium" | "large";
126
- /**
127
- * Placeholder text for the editor
128
- */
129
20
  placeholder?: string;
130
- };
131
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
132
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
133
- $$bindings?: Bindings;
134
- } & Exports;
135
- (internal: unknown, props: Props & {
136
- $$events?: Events;
137
- $$slots?: Slots;
138
- }): Exports & {
139
- $set?: any;
140
- $on?: any;
141
- };
142
- z_$$bindings?: Bindings;
143
- }
21
+ size?: string;
22
+ toolbarConfig?: Record<string, any>;
23
+ } & Record<string, any>;
@@ -9,41 +9,40 @@
9
9
  import ToolbarRedo from "./ToolbarRedo.svelte";
10
10
  import ToolbarColor from "./ToolbarColor.svelte";
11
11
 
12
- let { editor, toolbarConfig } = $props();
12
+ let { toolbarConfig } = $props();
13
13
  </script>
14
14
 
15
15
  {#if toolbarConfig && toolbarConfig.bold && toolbarConfig.bold.enabled}
16
- <ToolbarBold {editor} />
16
+ <ToolbarBold />
17
17
  {/if}
18
18
 
19
19
  {#if toolbarConfig && toolbarConfig.italic && toolbarConfig.italic.enabled}
20
- <ToolbarItalic {editor} />
20
+ <ToolbarItalic />
21
21
  {/if}
22
22
 
23
23
  {#if toolbarConfig && toolbarConfig.underline && toolbarConfig.underline.enabled}
24
- <ToolbarUnderline {editor} />
24
+ <ToolbarUnderline />
25
25
  {/if}
26
26
 
27
27
  {#if toolbarConfig && toolbarConfig.link && toolbarConfig.link.enabled}
28
- <ToolbarLink {editor} onOpenLink={toolbarConfig.link.onOpenLink} />
28
+ <ToolbarLink onOpenLink={toolbarConfig.link.onOpenLink} />
29
29
  {/if}
30
30
 
31
31
  {#if toolbarConfig && toolbarConfig.color && toolbarConfig.color.enabled && toolbarConfig.color.colors.length > 0}
32
32
  <ToolbarColor
33
33
  colors={toolbarConfig.color.colors}
34
- defaultColor={toolbarConfig.color.defaultColor}
35
- {editor} />
34
+ defaultColor={toolbarConfig.color.defaultColor} />
36
35
  {/if}
37
36
 
38
37
  {#if toolbarConfig && toolbarConfig.list && toolbarConfig.list.enabled}
39
- <ToolbarList {editor} />
38
+ <ToolbarList />
40
39
  {/if}
41
40
 
42
41
  {#if toolbarConfig && toolbarConfig.listOrdered && toolbarConfig.listOrdered.enabled}
43
- <ToolbarListOrdered {editor} />
42
+ <ToolbarListOrdered />
44
43
  {/if}
45
44
 
46
45
  {#if toolbarConfig && toolbarConfig.history && toolbarConfig.history.enabled}
47
- <ToolbarUndo {editor} />
48
- <ToolbarRedo {editor} />
46
+ <ToolbarUndo />
47
+ <ToolbarRedo />
49
48
  {/if}
@@ -4,10 +4,8 @@ type RichTextEditorToolbar = {
4
4
  $set?(props: Partial<$$ComponentProps>): void;
5
5
  };
6
6
  declare const RichTextEditorToolbar: import("svelte").Component<{
7
- editor: any;
8
7
  toolbarConfig: any;
9
8
  }, {}, "">;
10
9
  type $$ComponentProps = {
11
- editor: any;
12
10
  toolbarConfig: any;
13
11
  };
@@ -1,12 +1,19 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let active = $state(false);
6
+ let editor = $derived(getContext("richt-text-editor")());
7
+
8
+ $effect(() => {
9
+ if (!editor) return;
10
+ return editor.on("transaction", () => (active = editor.isActive("bold")));
11
+ });
5
12
  </script>
6
13
 
7
14
  {#if editor}
8
15
  <IconButton
9
- color={editor.isActive("bold") ? "default" : "transparent"}
16
+ color={active ? "default" : "transparent"}
10
17
  icon="bold"
11
18
  onclick={() => editor.chain().focus().toggleBold().run()}
12
19
  shape="square" />
@@ -1,11 +1,6 @@
1
1
  export default ToolbarBold;
2
2
  type ToolbarBold = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarBold: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarBold: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,9 +1,11 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { ColorSwatch } from "../../../../index.js";
3
4
 
4
- let { colors = [], defaultColor = "#121110", editor } = $props();
5
+ let { colors = [], defaultColor = "#121110" } = $props();
5
6
 
6
7
  let isOpen = $state(false);
8
+ let editor = $derived(getContext("richt-text-editor")());
7
9
  let selectedColor = $derived(defaultColor);
8
10
 
9
11
  const handleColorSelect = (color) => {
@@ -15,9 +17,10 @@
15
17
 
16
18
  $effect(() => {
17
19
  if (!editor) return;
18
-
19
- const attrs = editor.getAttributes("textStyle");
20
- selectedColor = attrs.color || defaultColor;
20
+ return editor.on("transaction", () => {
21
+ const attrs = editor.getAttributes("textStyle");
22
+ selectedColor = attrs.color || defaultColor;
23
+ });
21
24
  });
22
25
  </script>
23
26
 
@@ -6,10 +6,8 @@ type ToolbarColor = {
6
6
  declare const ToolbarColor: import("svelte").Component<{
7
7
  colors?: any[];
8
8
  defaultColor?: string;
9
- editor: any;
10
9
  }, {}, "">;
11
10
  type $$ComponentProps = {
12
11
  colors?: any[];
13
12
  defaultColor?: string;
14
- editor: any;
15
13
  };
@@ -1,12 +1,19 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let active = $state(false);
6
+ let editor = $derived(getContext("richt-text-editor")());
7
+
8
+ $effect(() => {
9
+ if (!editor) return;
10
+ return editor.on("transaction", () => (active = editor.isActive("italic")));
11
+ });
5
12
  </script>
6
13
 
7
14
  {#if editor}
8
15
  <IconButton
9
- color={editor.isActive("italic") ? "default" : "transparent"}
16
+ color={active ? "default" : "transparent"}
10
17
  icon="italic"
11
18
  onclick={() => editor.chain().focus().toggleItalic().run()}
12
19
  shape="square" />
@@ -1,11 +1,6 @@
1
1
  export default ToolbarItalic;
2
2
  type ToolbarItalic = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarItalic: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarItalic: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,7 +1,16 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor, onOpenLink } = $props();
5
+ let { onOpenLink } = $props();
6
+
7
+ let active = $state(false);
8
+ let editor = $derived(getContext("richt-text-editor")());
9
+
10
+ $effect(() => {
11
+ if (!editor) return;
12
+ return editor.on("transaction", () => (active = editor.isActive("link")));
13
+ });
5
14
 
6
15
  const setLink = () => {
7
16
  const focus = () => editor.chain().focus();
@@ -27,7 +36,7 @@
27
36
 
28
37
  {#if editor}
29
38
  <IconButton
30
- color={editor.isActive("link") ? "default" : "transparent"}
39
+ color={active ? "default" : "transparent"}
31
40
  icon="link"
32
41
  onclick={handleOpenLinkModal}
33
42
  shape="square" />
@@ -4,10 +4,8 @@ type ToolbarLink = {
4
4
  $set?(props: Partial<$$ComponentProps>): void;
5
5
  };
6
6
  declare const ToolbarLink: import("svelte").Component<{
7
- editor: any;
8
7
  onOpenLink: any;
9
8
  }, {}, "">;
10
9
  type $$ComponentProps = {
11
- editor: any;
12
10
  onOpenLink: any;
13
11
  };
@@ -1,12 +1,19 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let active = $state(false);
6
+ let editor = $derived(getContext("richt-text-editor")());
7
+
8
+ $effect(() => {
9
+ if (!editor) return;
10
+ return editor.on("transaction", () => (active = editor.isActive("bulletList")));
11
+ });
5
12
  </script>
6
13
 
7
14
  {#if editor}
8
15
  <IconButton
9
- color={editor.isActive("bulletList") ? "default" : "transparent"}
16
+ color={active ? "default" : "transparent"}
10
17
  icon="listUnordered"
11
18
  onclick={() => editor.chain().focus().toggleBulletList().run()}
12
19
  shape="square" />
@@ -1,11 +1,6 @@
1
1
  export default ToolbarList;
2
2
  type ToolbarList = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarList: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarList: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,12 +1,19 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let active = $state(false);
6
+ let editor = $derived(getContext("richt-text-editor")());
7
+
8
+ $effect(() => {
9
+ if (!editor) return;
10
+ return editor.on("transaction", () => (active = editor.isActive("orderedList")));
11
+ });
5
12
  </script>
6
13
 
7
14
  {#if editor}
8
15
  <IconButton
9
- color={editor.isActive("orderedList") ? "default" : "transparent"}
16
+ color={active ? "default" : "transparent"}
10
17
  icon="listOrdered"
11
18
  onclick={() => editor.chain().focus().toggleOrderedList().run()}
12
19
  shape="square" />
@@ -1,11 +1,6 @@
1
1
  export default ToolbarListOrdered;
2
2
  type ToolbarListOrdered = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarListOrdered: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarListOrdered: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,7 +1,8 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let editor = $derived(getContext("richt-text-editor")());
5
6
  </script>
6
7
 
7
8
  {#if editor}
@@ -1,11 +1,6 @@
1
1
  export default ToolbarRedo;
2
2
  type ToolbarRedo = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarRedo: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarRedo: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,12 +1,19 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let active = $state(false);
6
+ let editor = $derived(getContext("richt-text-editor")());
7
+
8
+ $effect(() => {
9
+ if (!editor) return;
10
+ return editor.on("transaction", () => (active = editor.isActive("underline")));
11
+ });
5
12
  </script>
6
13
 
7
14
  {#if editor}
8
15
  <IconButton
9
- color={editor.isActive("underline") ? "default" : "transparent"}
16
+ color={active ? "default" : "transparent"}
10
17
  icon="underline"
11
18
  onclick={() => editor.chain().focus().toggleUnderline().run()}
12
19
  shape="square" />
@@ -1,11 +1,6 @@
1
1
  export default ToolbarUnderline;
2
2
  type ToolbarUnderline = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarUnderline: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarUnderline: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,7 +1,8 @@
1
1
  <script>
2
+ import { getContext } from "svelte";
2
3
  import { IconButton } from "../../../../index.js";
3
4
 
4
- let { editor } = $props();
5
+ let editor = $derived(getContext("richt-text-editor")());
5
6
  </script>
6
7
 
7
8
  {#if editor}
@@ -1,11 +1,6 @@
1
1
  export default ToolbarUndo;
2
2
  type ToolbarUndo = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const ToolbarUndo: import("svelte").Component<{
7
- editor: any;
8
- }, {}, "">;
9
- type $$ComponentProps = {
10
- editor: any;
4
+ $set?(props: Partial<Record<string, never>>): void;
11
5
  };
6
+ declare const ToolbarUndo: import("svelte").Component<Record<string, never>, {}, "">;
@@ -31,7 +31,7 @@
31
31
  name,
32
32
  required = false,
33
33
  type = "radio",
34
- value = "",
34
+ value = "on",
35
35
  ...rest
36
36
  } = $props();
37
37
 
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { Chip } from "../../../index.js";
2
+ import { Tag } from "../../../index.js";
3
3
  import { tagSelectorVariants } from "./tagSelector.variants.js";
4
4
 
5
5
  let {
@@ -21,17 +21,13 @@
21
21
  <div class={styles.valueList()}>
22
22
  {#each value as s (s)}
23
23
  {@const opt = options.find((i) => i.id === s)}
24
- <Chip
25
- class={styles.item()}
26
- clickable
27
- icon="closeSmall"
28
- onclick={() => onRemoveItem(s)}>
24
+ <Tag class={styles.item()} icon="closeSmall" onclick={() => onRemoveItem(s)}>
29
25
  {opt?.label ?? s}
30
- </Chip>
26
+ </Tag>
31
27
  {/each}
32
28
 
33
29
  {#if !localValues.disabled}
34
- <Chip class={styles.searchField()} icon="add" variant="outline">
30
+ <Tag class={styles.searchField()} icon="add" variant="outline">
35
31
  <input
36
32
  bind:this={inputRef}
37
33
  bind:value={query}
@@ -47,6 +43,6 @@
47
43
  : {}}
48
44
  {placeholder}
49
45
  role="searchbox" />
50
- </Chip>
46
+ </Tag>
51
47
  {/if}
52
48
  </div>
@@ -13,6 +13,8 @@
13
13
  * @property {"default" | "raised"} [appearance="default"] The appearance variant of the component
14
14
  * @property {import('svelte').Snippet} [children] Children content – can be text, HTML, or other Svelte components
15
15
  * @property {string} [class=""] Additional CSS classes to apply to the component
16
+ * @property {boolean} [disabled=false] Whether the toggle group is disabled
17
+ * @property {string} [name] The name of the toggle group, used for form submission
16
18
  * @property {"small" | "medium"} [size="medium"] The size variant of the component
17
19
  * @property {string} [value=""] The value of the toggle group
18
20
  * @property {"default" | "tabs"} [variant="default"] The variant of the toggle group
@@ -28,6 +30,8 @@
28
30
  appearance = "default",
29
31
  children,
30
32
  class: className = "",
33
+ disabled = false,
34
+ name,
31
35
  size = "medium",
32
36
  value = $bindable(),
33
37
  variant = "default",
@@ -50,17 +54,31 @@
50
54
  };
51
55
  });
52
56
 
57
+ let inputProps = $derived({
58
+ disabled,
59
+ name,
60
+ value,
61
+ });
62
+
53
63
  let styles = $derived.by(() => {
54
64
  if (variant === "tabs") {
55
- return toggleGroupTabVariants();
65
+ return toggleGroupTabVariants({ disabled });
56
66
  }
57
67
 
58
- return toggleGroupVariants({ appearance, size, variant });
68
+ return toggleGroupVariants({ appearance, disabled, size, variant });
59
69
  });
60
70
  </script>
61
71
 
62
72
  <XScroll class={styles.base({ class: className })}>
63
- <div bind:this={toggleGroupEl} class={styles.tabs()} role="tablist" {...rest}>
73
+ <div
74
+ bind:this={toggleGroupEl}
75
+ class={styles.tabs()}
76
+ inert={disabled}
77
+ role="tablist"
78
+ {...rest}>
79
+ {#if name}
80
+ <input type="hidden" {...inputProps} />
81
+ {/if}
64
82
  {@render children?.()}
65
83
  </div>
66
84
  </XScroll>
@@ -16,6 +16,14 @@ declare const ToggleGroup: import("svelte").Component<{
16
16
  * Additional CSS classes to apply to the component
17
17
  */
18
18
  class?: string;
19
+ /**
20
+ * Whether the toggle group is disabled
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * The name of the toggle group, used for form submission
25
+ */
26
+ name?: string;
19
27
  /**
20
28
  * The size variant of the component
21
29
  */
@@ -42,6 +50,14 @@ type Props = {
42
50
  * Additional CSS classes to apply to the component
43
51
  */
44
52
  class?: string;
53
+ /**
54
+ * Whether the toggle group is disabled
55
+ */
56
+ disabled?: boolean;
57
+ /**
58
+ * The name of the toggle group, used for form submission
59
+ */
60
+ name?: string;
45
61
  /**
46
62
  * The size variant of the component
47
63
  */