@sveltia/ui 0.16.0 → 0.17.0

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 (156) hide show
  1. package/package/components/alert/alert.svelte +22 -7
  2. package/package/components/alert/alert.svelte.d.ts +32 -28
  3. package/package/components/button/button-group.svelte +16 -6
  4. package/package/components/button/button-group.svelte.d.ts +23 -23
  5. package/package/components/button/button.svelte +41 -136
  6. package/package/components/button/button.svelte.d.ts +5 -146
  7. package/package/components/button/select-button-group.svelte +31 -37
  8. package/package/components/button/select-button-group.svelte.d.ts +76 -34
  9. package/package/components/button/select-button.svelte +19 -62
  10. package/package/components/button/select-button.svelte.d.ts +17 -73
  11. package/package/components/button/split-button.svelte +37 -47
  12. package/package/components/button/split-button.svelte.d.ts +40 -47
  13. package/package/components/calendar/calendar.svelte +80 -55
  14. package/package/components/calendar/calendar.svelte.d.ts +13 -10
  15. package/package/components/checkbox/checkbox-group.svelte +23 -20
  16. package/package/components/checkbox/checkbox-group.svelte.d.ts +49 -27
  17. package/package/components/checkbox/checkbox.svelte +57 -67
  18. package/package/components/checkbox/checkbox.svelte.d.ts +67 -55
  19. package/package/components/dialog/alert-dialog.svelte +9 -36
  20. package/package/components/dialog/alert-dialog.svelte.d.ts +5 -44
  21. package/package/components/dialog/confirmation-dialog.svelte +9 -41
  22. package/package/components/dialog/confirmation-dialog.svelte.d.ts +5 -46
  23. package/package/components/dialog/dialog.svelte +60 -105
  24. package/package/components/dialog/dialog.svelte.d.ts +5 -102
  25. package/package/components/dialog/prompt-dialog.svelte +32 -61
  26. package/package/components/dialog/prompt-dialog.svelte.d.ts +38 -62
  27. package/package/components/disclosure/disclosure.svelte +39 -34
  28. package/package/components/disclosure/disclosure.svelte.d.ts +74 -56
  29. package/package/components/divider/divider.svelte +18 -14
  30. package/package/components/divider/divider.svelte.d.ts +31 -10
  31. package/package/components/divider/spacer.svelte +13 -8
  32. package/package/components/divider/spacer.svelte.d.ts +20 -9
  33. package/package/components/drawer/drawer.svelte +63 -76
  34. package/package/components/drawer/drawer.svelte.d.ts +102 -84
  35. package/package/components/grid/grid-body.svelte +15 -10
  36. package/package/components/grid/grid-body.svelte.d.ts +30 -24
  37. package/package/components/grid/grid-cell.svelte +16 -6
  38. package/package/components/grid/grid-cell.svelte.d.ts +23 -23
  39. package/package/components/grid/grid-col-header.svelte +16 -6
  40. package/package/components/grid/grid-col-header.svelte.d.ts +23 -23
  41. package/package/components/grid/grid-foot.svelte +16 -6
  42. package/package/components/grid/grid-foot.svelte.d.ts +23 -23
  43. package/package/components/grid/grid-head.svelte +16 -6
  44. package/package/components/grid/grid-head.svelte.d.ts +23 -23
  45. package/package/components/grid/grid-row-header.svelte +16 -6
  46. package/package/components/grid/grid-row-header.svelte.d.ts +23 -23
  47. package/package/components/grid/grid-row.svelte +19 -23
  48. package/package/components/grid/grid-row.svelte.d.ts +48 -38
  49. package/package/components/grid/grid.svelte +26 -25
  50. package/package/components/grid/grid.svelte.d.ts +56 -32
  51. package/package/components/icon/icon.svelte +14 -9
  52. package/package/components/icon/icon.svelte.d.ts +20 -9
  53. package/package/components/listbox/listbox.svelte +46 -52
  54. package/package/components/listbox/listbox.svelte.d.ts +102 -40
  55. package/package/components/listbox/option-group.svelte +23 -19
  56. package/package/components/listbox/option-group.svelte.d.ts +49 -27
  57. package/package/components/listbox/option.svelte +44 -57
  58. package/package/components/listbox/option.svelte.d.ts +54 -84
  59. package/package/components/menu/menu-button.svelte +42 -63
  60. package/package/components/menu/menu-button.svelte.d.ts +18 -72
  61. package/package/components/menu/menu-item-checkbox.svelte +29 -41
  62. package/package/components/menu/menu-item-checkbox.svelte.d.ts +5 -44
  63. package/package/components/menu/menu-item-group.svelte +22 -19
  64. package/package/components/menu/menu-item-group.svelte.d.ts +41 -27
  65. package/package/components/menu/menu-item-radio.svelte +29 -41
  66. package/package/components/menu/menu-item-radio.svelte.d.ts +5 -44
  67. package/package/components/menu/menu-item.svelte +66 -75
  68. package/package/components/menu/menu-item.svelte.d.ts +5 -80
  69. package/package/components/menu/menu.svelte +25 -22
  70. package/package/components/menu/menu.svelte.d.ts +50 -30
  71. package/package/components/radio/radio-group.svelte +36 -42
  72. package/package/components/radio/radio-group.svelte.d.ts +85 -35
  73. package/package/components/radio/radio.svelte +45 -48
  74. package/package/components/radio/radio.svelte.d.ts +96 -42
  75. package/package/components/select/combobox.svelte +76 -101
  76. package/package/components/select/combobox.svelte.d.ts +5 -56
  77. package/package/components/select/select-tags.svelte +48 -59
  78. package/package/components/select/select-tags.svelte.d.ts +109 -28
  79. package/package/components/select/select.svelte +18 -37
  80. package/package/components/select/select.svelte.d.ts +5 -40
  81. package/package/components/slider/slider.svelte +71 -68
  82. package/package/components/slider/slider.svelte.d.ts +142 -31
  83. package/package/components/switch/switch.svelte +36 -46
  84. package/package/components/switch/switch.svelte.d.ts +83 -37
  85. package/package/components/table/table-body.svelte +15 -11
  86. package/package/components/table/table-body.svelte.d.ts +30 -24
  87. package/package/components/table/table-cell.svelte +16 -6
  88. package/package/components/table/table-cell.svelte.d.ts +23 -23
  89. package/package/components/table/table-col-header.svelte +16 -6
  90. package/package/components/table/table-col-header.svelte.d.ts +23 -23
  91. package/package/components/table/table-foot.svelte +16 -6
  92. package/package/components/table/table-foot.svelte.d.ts +23 -23
  93. package/package/components/table/table-head.svelte +16 -6
  94. package/package/components/table/table-head.svelte.d.ts +23 -23
  95. package/package/components/table/table-row-header.svelte +16 -6
  96. package/package/components/table/table-row-header.svelte.d.ts +23 -23
  97. package/package/components/table/table-row.svelte +16 -6
  98. package/package/components/table/table-row.svelte.d.ts +23 -23
  99. package/package/components/table/table.svelte +16 -6
  100. package/package/components/table/table.svelte.d.ts +23 -23
  101. package/package/components/tabs/tab-box.svelte +16 -9
  102. package/package/components/tabs/tab-box.svelte.d.ts +32 -22
  103. package/package/components/tabs/tab-list.svelte +36 -35
  104. package/package/components/tabs/tab-list.svelte.d.ts +65 -33
  105. package/package/components/tabs/tab-panel.svelte +16 -6
  106. package/package/components/tabs/tab-panel.svelte.d.ts +23 -23
  107. package/package/components/tabs/tab-panels.svelte +16 -6
  108. package/package/components/tabs/tab-panels.svelte.d.ts +23 -21
  109. package/package/components/tabs/tab.svelte +28 -25
  110. package/package/components/tabs/tab.svelte.d.ts +17 -63
  111. package/package/components/text-editor/lexical-root.svelte +38 -32
  112. package/package/components/text-editor/lexical-root.svelte.d.ts +74 -13
  113. package/package/components/text-editor/text-editor.svelte +63 -79
  114. package/package/components/text-editor/text-editor.svelte.d.ts +97 -20
  115. package/package/components/text-editor/toolbar/editor-toolbar.svelte +41 -24
  116. package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +32 -7
  117. package/package/components/text-editor/toolbar/format-text-button.svelte +15 -5
  118. package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +13 -6
  119. package/package/components/text-editor/toolbar/insert-link-button.svelte +18 -16
  120. package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +4 -8
  121. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +19 -7
  122. package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +13 -6
  123. package/package/components/text-field/number-input.svelte +63 -81
  124. package/package/components/text-field/number-input.svelte.d.ts +48 -55
  125. package/package/components/text-field/password-input.svelte +38 -57
  126. package/package/components/text-field/password-input.svelte.d.ts +16 -45
  127. package/package/components/text-field/search-bar.svelte +45 -62
  128. package/package/components/text-field/search-bar.svelte.d.ts +25 -66
  129. package/package/components/text-field/text-area.svelte +38 -54
  130. package/package/components/text-field/text-area.svelte.d.ts +100 -35
  131. package/package/components/text-field/text-input.svelte +30 -86
  132. package/package/components/text-field/text-input.svelte.d.ts +4 -78
  133. package/package/components/toast/toast.svelte +36 -30
  134. package/package/components/toast/toast.svelte.d.ts +50 -28
  135. package/package/components/toolbar/toolbar.svelte +25 -25
  136. package/package/components/toolbar/toolbar.svelte.d.ts +57 -29
  137. package/package/components/util/app-shell.svelte +22 -10
  138. package/package/components/util/app-shell.svelte.d.ts +25 -29
  139. package/package/components/util/group.svelte +20 -15
  140. package/package/components/util/group.svelte.d.ts +40 -26
  141. package/package/components/util/modal.svelte +89 -105
  142. package/package/components/util/modal.svelte.d.ts +6 -71
  143. package/package/components/util/placeholder.svelte +21 -0
  144. package/package/components/util/{portal.svelte.d.ts → placeholder.svelte.d.ts} +17 -25
  145. package/package/components/util/popup.svelte +65 -62
  146. package/package/components/util/popup.svelte.d.ts +89 -77
  147. package/package/services/{group.js → group.svelte.js} +11 -12
  148. package/package/services/{popup.js → popup.svelte.js} +6 -5
  149. package/package/typedefs.d.ts +545 -0
  150. package/package/typedefs.js +202 -0
  151. package/package.json +11 -18
  152. package/package/components/util/portal.svelte +0 -36
  153. /package/package/services/{events.d.ts → events.svelte.d.ts} +0 -0
  154. /package/package/services/{events.js → events.svelte.js} +0 -0
  155. /package/package/services/{group.d.ts → group.svelte.d.ts} +0 -0
  156. /package/package/services/{popup.d.ts → popup.svelte.d.ts} +0 -0
@@ -1,91 +1,16 @@
1
1
  export default MenuItem;
2
- type MenuItem = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- disabled?: boolean | undefined;
6
- label?: string | undefined;
7
- role?: "menuitem" | "menuitemcheckbox" | "menuitemradio" | undefined;
8
- hidden?: boolean | undefined;
9
- iconName?: string | undefined;
10
- iconLabel?: string | undefined;
11
- }, {
12
- 'start-icon': {
13
- slot: string;
14
- };
15
- default: {};
16
- 'end-icon': {
17
- slot: string;
18
- };
19
- 'chevron-icon': {};
20
- children: {};
21
- }>, {
22
- click: MouseEvent;
23
- focus: FocusEvent;
24
- blur: FocusEvent;
25
- select: CustomEvent<any>;
26
- change: CustomEvent<any>;
27
- } & {
2
+ type MenuItem = SvelteComponent<ButtonProps & MenuItemProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Record<string, any>, {
28
3
  [evt: string]: CustomEvent<any>;
29
- }, {
30
- 'start-icon': {
31
- slot: string;
32
- };
33
- default: {};
34
- 'end-icon': {
35
- slot: string;
36
- };
37
- 'chevron-icon': {};
38
- children: {};
39
- }> & {
40
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
41
6
  };
42
7
  /**
43
8
  * A menu item widget.
44
9
  * @see https://w3c.github.io/aria/#menuitem
45
10
  */
46
- declare const MenuItem: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
47
- [x: string]: any;
48
- class?: string | undefined;
49
- disabled?: boolean | undefined;
50
- label?: string | undefined;
51
- role?: "menuitem" | "menuitemcheckbox" | "menuitemradio" | undefined;
52
- hidden?: boolean | undefined;
53
- iconName?: string | undefined;
54
- iconLabel?: string | undefined;
55
- }, {
56
- 'start-icon': {
57
- slot: string;
58
- };
59
- default: {};
60
- 'end-icon': {
61
- slot: string;
62
- };
63
- 'chevron-icon': {};
64
- children: {};
65
- }>, {
66
- click: MouseEvent;
67
- focus: FocusEvent;
68
- blur: FocusEvent;
69
- select: CustomEvent<any>;
70
- change: CustomEvent<any>;
71
- } & {
11
+ declare const MenuItem: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").ButtonProps & import("../../typedefs").MenuItemProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & Record<string, any>, {
72
12
  [evt: string]: CustomEvent<any>;
73
- }, {
74
- 'start-icon': {
75
- slot: string;
76
- };
77
- default: {};
78
- 'end-icon': {
79
- slot: string;
80
- };
81
- 'chevron-icon': {};
82
- children: {};
83
- }, {}, string>;
84
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
85
- default: any;
86
- } ? Props extends Record<string, never> ? any : {
87
- children?: any;
88
- } : {});
13
+ }, {}, {}, "">;
89
14
  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> {
90
15
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
91
16
  $$bindings?: Bindings;
@@ -5,42 +5,45 @@
5
5
  @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
6
6
  -->
7
7
  <script>
8
- import { createEventDispatcher } from 'svelte';
9
- import { activateGroup } from '../../services/group';
8
+ import { activateGroup } from '../../services/group.svelte';
10
9
 
11
10
  /**
12
- * The `class` attribute on the wrapper element.
13
- * @type {string}
11
+ * @typedef {object} Props
12
+ * @property {string} [class] - The `class` attribute on the wrapper element.
13
+ * @property {boolean} [hidden] - Whether to hide the widget. An alias of the `aria-hidden`
14
+ * attribute.
15
+ * @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
16
+ * attribute.
17
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
18
+ * @property {(event: CustomEvent) => void} [onChange] - Custom `Change` event handler.
14
19
  */
15
- let className = '';
16
- export { className as class };
17
- /**
18
- * Whether to hide the widget. An alias of the `aria-hidden` attribute.
19
- * @type {boolean | undefined}
20
- */
21
- export let hidden = undefined;
20
+
22
21
  /**
23
- * Whether to disable the widget. An alias of the `aria-disabled` attribute.
24
- * @type {boolean}
22
+ * @type {Props & Record<string, any>}
25
23
  */
26
- export let disabled = false;
27
-
28
- const dispatch = createEventDispatcher();
24
+ let {
25
+ /* eslint-disable prefer-const */
26
+ class: className,
27
+ hidden = false,
28
+ disabled = false,
29
+ children,
30
+ onChange,
31
+ ...restProps
32
+ /* eslint-enable prefer-const */
33
+ } = $props();
29
34
  </script>
30
35
 
31
36
  <div
37
+ {...restProps}
32
38
  role="menu"
33
39
  class="sui menu {className}"
34
- hidden={hidden || undefined}
40
+ {hidden}
35
41
  aria-hidden={hidden}
36
42
  aria-disabled={disabled}
37
- {...$$restProps}
43
+ {onChange}
38
44
  use:activateGroup
39
- on:change={(/** @type {CustomEvent} */ event) => {
40
- dispatch('change', event.detail);
41
- }}
42
45
  >
43
- <slot />
46
+ {@render children?.()}
44
47
  </div>
45
48
 
46
49
  <style>.menu {
@@ -1,44 +1,64 @@
1
1
  export default Menu;
2
- type Menu = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- disabled?: boolean | undefined;
6
- hidden?: boolean | undefined;
7
- }, {
8
- default: {};
9
- }>, {
10
- change: CustomEvent<any>;
11
- } & {
2
+ type Menu = SvelteComponent<Props & Record<string, any>, {
12
3
  [evt: string]: CustomEvent<any>;
13
- }, {
14
- default: {};
15
- }> & {
16
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
17
6
  };
18
7
  /**
19
8
  * A menu widget.
20
9
  * @see https://w3c.github.io/aria/#menu
21
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
22
11
  */
23
- declare const Menu: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
24
- [x: string]: any;
12
+ declare const Menu: $$__sveltets_2_IsomorphicComponent<{
13
+ /**
14
+ * - The `class` attribute on the wrapper element.
15
+ */
25
16
  class?: string | undefined;
26
- disabled?: boolean | undefined;
17
+ /**
18
+ * - Whether to hide the widget. An alias of the `aria-hidden`
19
+ * attribute.
20
+ */
27
21
  hidden?: boolean | undefined;
28
- }, {
29
- default: {};
30
- }>, {
31
- change: CustomEvent<any>;
32
- } & {
22
+ /**
23
+ * - Whether to disable the widget. An alias of the `aria-disabled`
24
+ * attribute.
25
+ */
26
+ disabled?: boolean | undefined;
27
+ /**
28
+ * - Primary slot content.
29
+ */
30
+ children?: import("svelte").Snippet<[]> | undefined;
31
+ /**
32
+ * - Custom `Change` event handler.
33
+ */
34
+ onChange?: ((event: CustomEvent) => void) | undefined;
35
+ } & Record<string, any>, {
33
36
  [evt: string]: CustomEvent<any>;
34
- }, {
35
- default: {};
36
- }, {}, string>;
37
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
38
- default: any;
39
- } ? Props extends Record<string, never> ? any : {
40
- children?: any;
41
- } : {});
37
+ }, {}, {}, "">;
38
+ type Props = {
39
+ /**
40
+ * - The `class` attribute on the wrapper element.
41
+ */
42
+ class?: string | undefined;
43
+ /**
44
+ * - Whether to hide the widget. An alias of the `aria-hidden`
45
+ * attribute.
46
+ */
47
+ hidden?: boolean | undefined;
48
+ /**
49
+ * - Whether to disable the widget. An alias of the `aria-disabled`
50
+ * attribute.
51
+ */
52
+ disabled?: boolean | undefined;
53
+ /**
54
+ * - Primary slot content.
55
+ */
56
+ children?: import("svelte").Snippet<[]> | undefined;
57
+ /**
58
+ * - Custom `Change` event handler.
59
+ */
60
+ onChange?: ((event: CustomEvent) => void) | undefined;
61
+ };
42
62
  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> {
43
63
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
44
64
  $$bindings?: Bindings;
@@ -5,68 +5,62 @@
5
5
  @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
6
6
  -->
7
7
  <script>
8
- import { createEventDispatcher } from 'svelte';
9
- import { activateGroup } from '../../services/group';
8
+ import { activateGroup } from '../../services/group.svelte';
10
9
 
11
10
  /**
12
- * The `class` attribute on the wrapper element.
13
- * @type {string}
11
+ * @typedef {object} Props
12
+ * @property {string} [class] - The `class` attribute on the wrapper element.
13
+ * @property {boolean} [hidden] - Whether to hide the widget.
14
+ * @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
15
+ * attribute.
16
+ * @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
17
+ * `aria-readonly` attribute.
18
+ * @property {boolean} [required] - Whether to mark the widget required. An alias of the
19
+ * `aria-required` attribute.
20
+ * @property {boolean} [invalid] - Whether to mark the widget invalid. An alias of the
21
+ * `aria-invalid` attribute.
22
+ * @property {'horizontal'|'vertical'} [orientation] - Orientation of the widget. An alias of the
23
+ * `aria-orientation` attribute.
24
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
25
+ * @property {(event: CustomEvent) => void} [onChange] - Custom `Change` event handler.
14
26
  */
15
- let className = '';
16
- export { className as class };
17
- /**
18
- * Whether to hide the widget. An alias of the `aria-hidden` attribute.
19
- * @type {boolean | undefined}
20
- */
21
- export let hidden = undefined;
22
- /**
23
- * Whether to disable the widget. An alias of the `aria-disabled` attribute.
24
- * @type {boolean}
25
- */
26
- export let disabled = false;
27
- /**
28
- * Whether to make the widget read-only. An alias of the `aria-readonly` attribute.
29
- * @type {boolean}
30
- */
31
- export let readonly = false;
32
- /**
33
- * Whether to mark the widget required. An alias of the `aria-required` attribute.
34
- * @type {boolean}
35
- */
36
- export let required = false;
37
- /**
38
- * Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
39
- * @type {boolean}
40
- */
41
- export let invalid = false;
27
+
42
28
  /**
43
- * Orientation of the widget. An alias of the `aria-orientation` attribute.
44
- * @type {'horizontal' | 'vertical'}
29
+ * @type {Props & Record<string, any>}
45
30
  */
46
- export let orientation = 'horizontal';
47
-
48
- const dispatch = createEventDispatcher();
31
+ let {
32
+ /* eslint-disable prefer-const */
33
+ class: className,
34
+ hidden = false,
35
+ disabled = false,
36
+ readonly = false,
37
+ required = false,
38
+ invalid = false,
39
+ orientation = 'horizontal',
40
+ children,
41
+ onChange,
42
+ ...restProps
43
+ /* eslint-enable prefer-const */
44
+ } = $props();
49
45
  </script>
50
46
 
51
47
  <div
48
+ {...restProps}
52
49
  role="radiogroup"
53
50
  class="sui radio-group {className} {orientation}"
54
51
  tabindex="-1"
55
- hidden={hidden || undefined}
52
+ {hidden}
56
53
  aria-hidden={hidden}
57
54
  aria-disabled={disabled}
58
55
  aria-readonly={readonly}
59
56
  aria-required={required}
60
57
  aria-invalid={invalid}
61
58
  aria-orientation={orientation}
62
- {...$$restProps}
59
+ {onChange}
63
60
  use:activateGroup
64
- on:change={(/** @type {CustomEvent} */ event) => {
65
- dispatch('change', event.detail);
66
- }}
67
61
  >
68
62
  <div role="none" class="inner" inert={disabled}>
69
- <slot />
63
+ {@render children?.()}
70
64
  </div>
71
65
  </div>
72
66
 
@@ -1,52 +1,102 @@
1
1
  export default RadioGroup;
2
- type RadioGroup = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
3
- [x: string]: any;
4
- class?: string | undefined;
5
- disabled?: boolean | undefined;
6
- invalid?: boolean | undefined;
7
- required?: boolean | undefined;
8
- hidden?: boolean | undefined;
9
- readonly?: boolean | undefined;
10
- orientation?: "vertical" | "horizontal" | undefined;
11
- }, {
12
- default: {};
13
- }>, {
14
- change: CustomEvent<any>;
15
- } & {
2
+ type RadioGroup = SvelteComponent<Props & Record<string, any>, {
16
3
  [evt: string]: CustomEvent<any>;
17
- }, {
18
- default: {};
19
- }> & {
20
- $$bindings?: string | undefined;
4
+ }, {}> & {
5
+ $$bindings?: "" | undefined;
21
6
  };
22
7
  /**
23
8
  * The container of `<Radio>`s.
24
9
  * @see https://w3c.github.io/aria/#radiogroup
25
10
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
26
11
  */
27
- declare const RadioGroup: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
28
- [x: string]: any;
12
+ declare const RadioGroup: $$__sveltets_2_IsomorphicComponent<{
13
+ /**
14
+ * - The `class` attribute on the wrapper element.
15
+ */
29
16
  class?: string | undefined;
17
+ /**
18
+ * - Whether to hide the widget.
19
+ */
20
+ hidden?: boolean | undefined;
21
+ /**
22
+ * - Whether to disable the widget. An alias of the `aria-disabled`
23
+ * attribute.
24
+ */
30
25
  disabled?: boolean | undefined;
31
- invalid?: boolean | undefined;
26
+ /**
27
+ * - Whether to make the widget read-only. An alias of the
28
+ * `aria-readonly` attribute.
29
+ */
30
+ readonly?: boolean | undefined;
31
+ /**
32
+ * - Whether to mark the widget required. An alias of the
33
+ * `aria-required` attribute.
34
+ */
32
35
  required?: boolean | undefined;
36
+ /**
37
+ * - Whether to mark the widget invalid. An alias of the
38
+ * `aria-invalid` attribute.
39
+ */
40
+ invalid?: boolean | undefined;
41
+ /**
42
+ * - Orientation of the widget. An alias of the
43
+ * `aria-orientation` attribute.
44
+ */
45
+ orientation?: "vertical" | "horizontal" | undefined;
46
+ /**
47
+ * - Primary slot content.
48
+ */
49
+ children?: import("svelte").Snippet<[]> | undefined;
50
+ /**
51
+ * - Custom `Change` event handler.
52
+ */
53
+ onChange?: ((event: CustomEvent) => void) | undefined;
54
+ } & Record<string, any>, {
55
+ [evt: string]: CustomEvent<any>;
56
+ }, {}, {}, "">;
57
+ type Props = {
58
+ /**
59
+ * - The `class` attribute on the wrapper element.
60
+ */
61
+ class?: string | undefined;
62
+ /**
63
+ * - Whether to hide the widget.
64
+ */
33
65
  hidden?: boolean | undefined;
66
+ /**
67
+ * - Whether to disable the widget. An alias of the `aria-disabled`
68
+ * attribute.
69
+ */
70
+ disabled?: boolean | undefined;
71
+ /**
72
+ * - Whether to make the widget read-only. An alias of the
73
+ * `aria-readonly` attribute.
74
+ */
34
75
  readonly?: boolean | undefined;
76
+ /**
77
+ * - Whether to mark the widget required. An alias of the
78
+ * `aria-required` attribute.
79
+ */
80
+ required?: boolean | undefined;
81
+ /**
82
+ * - Whether to mark the widget invalid. An alias of the
83
+ * `aria-invalid` attribute.
84
+ */
85
+ invalid?: boolean | undefined;
86
+ /**
87
+ * - Orientation of the widget. An alias of the
88
+ * `aria-orientation` attribute.
89
+ */
35
90
  orientation?: "vertical" | "horizontal" | undefined;
36
- }, {
37
- default: {};
38
- }>, {
39
- change: CustomEvent<any>;
40
- } & {
41
- [evt: string]: CustomEvent<any>;
42
- }, {
43
- default: {};
44
- }, {}, string>;
45
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
46
- default: any;
47
- } ? Props extends Record<string, never> ? any : {
48
- children?: any;
49
- } : {});
91
+ /**
92
+ * - Primary slot content.
93
+ */
94
+ children?: import("svelte").Snippet<[]> | undefined;
95
+ /**
96
+ * - Custom `Change` event handler.
97
+ */
98
+ onChange?: ((event: CustomEvent) => void) | undefined;
99
+ };
50
100
  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> {
51
101
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
52
102
  $$bindings?: Bindings;
@@ -10,64 +10,64 @@
10
10
  import Button from '../button/button.svelte';
11
11
 
12
12
  /**
13
- * The `class` attribute on the wrapper element.
14
- * @type {string}
13
+ * @typedef {object} Props
14
+ * @property {string} [class] - The `class` attribute on the wrapper element.
15
+ * @property {boolean} [hidden] - Whether to hide the widget.
16
+ * @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
17
+ * attribute.
18
+ * @property {boolean} [checked] - Whether to check the widget. An alias of the `aria-checked`
19
+ * attribute.
20
+ * @property {string | undefined} [name] - The `name` attribute on the `<button>` element.
21
+ * @property {string | undefined} [value] - The `value` attribute on the `<button>` element.
22
+ * @property {string | undefined} [label] - Text label displayed next to the checkbox.
23
+ * @property {import('svelte').Snippet} [children] - Primary slot content.
24
+ * @property {import('svelte').Snippet} [default] - Default slot content.
25
+ * @property {(event: CustomEvent) => void} [onChange] - Custom `Change` event handler.
26
+ * @property {(event: CustomEvent) => void} [onSelect] - Custom `Select` event handler.
15
27
  */
16
- let className = '';
17
- export { className as class };
18
- /**
19
- * Whether to hide the widget. An alias of the `aria-hidden` attribute.
20
- * @type {boolean | undefined}
21
- */
22
- export let hidden = undefined;
23
- /**
24
- * Whether to disable the widget. An alias of the `aria-disabled` attribute.
25
- * @type {boolean}
26
- */
27
- export let disabled = false;
28
- /**
29
- * Whether to check the widget. An alias of the `aria-checked` attribute.
30
- * @type {boolean}
31
- */
32
- export let checked = false;
33
- /**
34
- * The `name` attribute on the `<button>` element.
35
- * @type {string | undefined}
36
- */
37
- export let name = undefined;
38
- /**
39
- * The `value` attribute on the `<button>` element.
40
- * @type {string | undefined}
41
- */
42
- export let value = undefined;
28
+
43
29
  /**
44
- * Text label displayed next to the checkbox.
45
- * @type {string | undefined}
30
+ * @type {Props & Record<string, any>}
46
31
  */
47
- export let label = undefined;
32
+ let {
33
+ /* eslint-disable prefer-const */
34
+ checked = false,
35
+ class: className,
36
+ hidden = false,
37
+ disabled = false,
38
+ name = undefined,
39
+ value = undefined,
40
+ label = undefined,
41
+ children,
42
+ onChange,
43
+ onSelect,
44
+ ...restProps
45
+ /* eslint-enable prefer-const */
46
+ } = $props();
48
47
 
49
48
  const id = generateElementId('checkbox');
50
49
 
51
50
  /**
52
- * Reference to the `Button` component.
53
- * @type {Button | undefined}
51
+ * Reference to the `<button>` element.
52
+ * @type {HTMLButtonElement | undefined}
54
53
  */
55
- let buttonComponent;
54
+ let buttonElement = $state();
56
55
  </script>
57
56
 
58
57
  <span
58
+ {...restProps}
59
59
  role="none"
60
60
  class="sui radio {className}"
61
61
  class:disabled
62
- hidden={hidden || undefined}
63
- {...$$restProps}
64
- on:click={(event) => {
62
+ {hidden}
63
+ onclick={(event) => {
65
64
  if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
66
- buttonComponent?.element?.click();
65
+ buttonElement?.click();
67
66
  }
68
67
  }}
69
68
  >
70
69
  <Button
70
+ bind:element={buttonElement}
71
71
  role="radio"
72
72
  {id}
73
73
  {hidden}
@@ -76,20 +76,17 @@
76
76
  {value}
77
77
  aria-checked={checked}
78
78
  aria-labelledby="{id}-label"
79
- bind:this={buttonComponent}
80
- on:click={(event) => {
79
+ onclick={(event) => {
81
80
  event.preventDefault();
82
81
  checked = true;
83
82
  }}
84
- on:focus
85
- on:blur
86
- on:select
87
- on:change
83
+ {onChange}
84
+ {onSelect}
88
85
  />
89
- {#if $$slots.default || label}
86
+ {#if children || label}
90
87
  <label id="{id}-label">
91
- {#if $$slots.default}
92
- <slot />
88
+ {#if children}
89
+ {@render children?.()}
93
90
  {:else}
94
91
  {label}
95
92
  {/if}