fluentui-svelte 0.6.0 → 0.7.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 (243) hide show
  1. package/dist/components/app-surface/app-surface.svelte +96 -0
  2. package/dist/components/app-surface/app-surface.svelte.d.ts +22 -0
  3. package/dist/components/app-surface/docs/llms.md +73 -0
  4. package/dist/components/app-surface/types.d.ts +19 -0
  5. package/dist/components/app-surface/types.js +1 -0
  6. package/dist/components/app-window/app-window.d.ts +3 -0
  7. package/dist/components/app-window/app-window.js +3 -0
  8. package/dist/components/app-window/app-window.svelte +193 -0
  9. package/dist/components/app-window/app-window.svelte.d.ts +25 -0
  10. package/dist/components/app-window/docs/llms.md +119 -0
  11. package/dist/components/app-window/types.d.ts +66 -0
  12. package/dist/components/app-window/types.js +1 -0
  13. package/dist/components/auto-suggest-box/auto-suggest-box.svelte +47 -31
  14. package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +2 -2
  15. package/dist/components/auto-suggest-box/docs/llms.md +34 -33
  16. package/dist/components/auto-suggest-box/option.svelte +6 -4
  17. package/dist/components/auto-suggest-box/types.d.ts +13 -16
  18. package/dist/components/avatar/avatar.svelte +4 -3
  19. package/dist/components/avatar/docs/llms.md +1 -1
  20. package/dist/components/avatar/type.d.ts +1 -1
  21. package/dist/components/badge/badge-icon.svelte +2 -2
  22. package/dist/components/badge/badge.svelte +2 -2
  23. package/dist/components/badge/docs/llms.md +2 -2
  24. package/dist/components/badge/types.d.ts +2 -2
  25. package/dist/components/breadcrumb/breadcrumb-button.svelte +2 -2
  26. package/dist/components/breadcrumb/breadcrumb-divider.svelte +2 -2
  27. package/dist/components/breadcrumb/breadcrumb-item.svelte +2 -2
  28. package/dist/components/breadcrumb/breadcrumb.svelte +10 -5
  29. package/dist/components/breadcrumb/docs/llms.md +11 -11
  30. package/dist/components/breadcrumb/types.d.ts +7 -7
  31. package/dist/components/button/button.svelte +2 -2
  32. package/dist/components/button/docs/llms.md +17 -17
  33. package/dist/components/button/split-button.svelte +7 -7
  34. package/dist/components/button/types.d.ts +5 -5
  35. package/dist/components/calendar-date-picker/calendar-date-picker.svelte +98 -10
  36. package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +1 -1
  37. package/dist/components/calendar-date-picker/docs/llms.md +19 -14
  38. package/dist/components/calendar-date-picker/types.d.ts +22 -8
  39. package/dist/components/calendar-view/calendar-view-days.svelte +3 -2
  40. package/dist/components/calendar-view/calendar-view-grid.js +8 -3
  41. package/dist/components/calendar-view/calendar-view-item.svelte +10 -4
  42. package/dist/components/calendar-view/calendar-view-months.svelte +3 -2
  43. package/dist/components/calendar-view/calendar-view-years.svelte +3 -2
  44. package/dist/components/calendar-view/calendar-view.svelte +11 -4
  45. package/dist/components/calendar-view/calendar-view.svelte.js +5 -0
  46. package/dist/components/calendar-view/docs/llms.md +20 -19
  47. package/dist/components/calendar-view/types.d.ts +6 -1
  48. package/dist/components/card/card-footer.svelte +2 -2
  49. package/dist/components/card/card-header.svelte +5 -4
  50. package/dist/components/card/card-preview.svelte +13 -2
  51. package/dist/components/card/card.svelte +5 -5
  52. package/dist/components/card/docs/llms.md +22 -21
  53. package/dist/components/card/types.d.ts +8 -4
  54. package/dist/components/checkbox/checkbox.svelte +47 -26
  55. package/dist/components/checkbox/checkbox.svelte.d.ts +3 -24
  56. package/dist/components/checkbox/docs/llms.md +24 -23
  57. package/dist/components/checkbox/types.d.ts +10 -23
  58. package/dist/components/date-picker/date-picker.svelte +98 -27
  59. package/dist/components/date-picker/date-picker.svelte.d.ts +1 -1
  60. package/dist/components/date-picker/docs/llms.md +23 -20
  61. package/dist/components/date-picker/types.d.ts +24 -15
  62. package/dist/components/dialog/dialog-actions.svelte +2 -2
  63. package/dist/components/dialog/dialog-content.svelte +2 -2
  64. package/dist/components/dialog/dialog-surface.svelte +102 -9
  65. package/dist/components/dialog/dialog-title.svelte +2 -2
  66. package/dist/components/dialog/dialog-trigger.svelte +2 -2
  67. package/dist/components/dialog/dialog.svelte +22 -11
  68. package/dist/components/dialog/docs/llms.md +56 -19
  69. package/dist/components/dialog/types.d.ts +25 -7
  70. package/dist/components/divider/divider.svelte +6 -4
  71. package/dist/components/divider/types.d.ts +1 -1
  72. package/dist/components/dropdown/docs/llms.md +30 -28
  73. package/dist/components/dropdown/dropdown-option.svelte +17 -5
  74. package/dist/components/dropdown/dropdown.svelte +182 -84
  75. package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
  76. package/dist/components/dropdown/types.d.ts +26 -20
  77. package/dist/components/dropdown-select/docs/llms.md +24 -22
  78. package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
  79. package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
  80. package/dist/components/dropdown-select/types.d.ts +4 -4
  81. package/dist/components/expander/docs/llms.md +3 -3
  82. package/dist/components/expander/expander.svelte +13 -8
  83. package/dist/components/expander/types.d.ts +5 -5
  84. package/dist/components/flyout/docs/llms.md +1 -1
  85. package/dist/components/flyout/flyout.svelte +17 -6
  86. package/dist/components/flyout/types.d.ts +1 -1
  87. package/dist/components/hyperlink/docs/llms.md +6 -6
  88. package/dist/components/hyperlink/hyperlink.svelte +13 -4
  89. package/dist/components/hyperlink/types.d.ts +1 -1
  90. package/dist/components/info-bar/docs/llms.md +11 -10
  91. package/dist/components/info-bar/info-bar.svelte +3 -2
  92. package/dist/components/info-bar/types.d.ts +4 -0
  93. package/dist/components/label/docs/llms.md +75 -22
  94. package/dist/components/label/label-context.d.ts +14 -0
  95. package/dist/components/label/label-context.js +10 -0
  96. package/dist/components/label/label.svelte +153 -30
  97. package/dist/components/label/label.svelte.d.ts +1 -1
  98. package/dist/components/label/types.d.ts +48 -4
  99. package/dist/components/list-view/docs/llms.md +103 -33
  100. package/dist/components/list-view/list-view-item-branch.svelte +257 -0
  101. package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
  102. package/dist/components/list-view/list-view-item.svelte +164 -46
  103. package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
  104. package/dist/components/list-view/list-view.svelte +73 -25
  105. package/dist/components/list-view/types.d.ts +71 -8
  106. package/dist/components/list-view/utils.d.ts +10 -0
  107. package/dist/components/list-view/utils.js +17 -1
  108. package/dist/components/menu/docs/llms.md +98 -15
  109. package/dist/components/menu/menu-command-bar-item.svelte +61 -0
  110. package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
  111. package/dist/components/menu/menu-command-bar.svelte +218 -0
  112. package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
  113. package/dist/components/menu/menu-group.svelte +6 -3
  114. package/dist/components/menu/menu-item-checkbox.svelte +5 -4
  115. package/dist/components/menu/menu-item-radio.svelte +5 -4
  116. package/dist/components/menu/menu-item-switch.svelte +5 -4
  117. package/dist/components/menu/menu-item.svelte +5 -5
  118. package/dist/components/menu/menu-item.svelte.d.ts +2 -3
  119. package/dist/components/menu/menu-list.svelte +10 -1
  120. package/dist/components/menu/menu-popover.svelte +9 -5
  121. package/dist/components/menu/menu-trigger.svelte +2 -1
  122. package/dist/components/menu/menu.svelte.js +1 -0
  123. package/dist/components/menu/types.d.ts +62 -7
  124. package/dist/components/number-box/docs/llms.md +6 -4
  125. package/dist/components/number-box/number-box.svelte +35 -29
  126. package/dist/components/number-box/number-box.svelte.d.ts +1 -1
  127. package/dist/components/number-box/types.d.ts +1 -1
  128. package/dist/components/persona/docs/llms.md +29 -25
  129. package/dist/components/persona/persona.svelte +8 -6
  130. package/dist/components/persona/types.d.ts +4 -3
  131. package/dist/components/progress-bar/docs/llms.md +13 -13
  132. package/dist/components/progress-bar/progress-bar.svelte +6 -6
  133. package/dist/components/progress-bar/types.d.ts +4 -4
  134. package/dist/components/progress-ring/docs/llms.md +14 -14
  135. package/dist/components/progress-ring/progress-ring.svelte +5 -5
  136. package/dist/components/progress-ring/types.d.ts +3 -3
  137. package/dist/components/radio-button/docs/llms.md +11 -8
  138. package/dist/components/radio-button/radio-button.svelte +38 -12
  139. package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
  140. package/dist/components/radio-button/types.d.ts +11 -8
  141. package/dist/components/rating/docs/llms.md +15 -14
  142. package/dist/components/rating/rating.svelte +66 -29
  143. package/dist/components/rating/rating.svelte.d.ts +1 -1
  144. package/dist/components/rating/types.d.ts +8 -8
  145. package/dist/components/side-nav/docs/llms.md +110 -0
  146. package/dist/components/side-nav/side-nav-branch.svelte +43 -0
  147. package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
  148. package/dist/components/side-nav/side-nav-item.svelte +75 -0
  149. package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
  150. package/dist/components/side-nav/side-nav-list.svelte +32 -0
  151. package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
  152. package/dist/components/side-nav/side-nav.d.ts +2 -0
  153. package/dist/components/side-nav/side-nav.js +2 -0
  154. package/dist/components/side-nav/side-nav.svelte +355 -0
  155. package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
  156. package/dist/components/side-nav/types.d.ts +149 -0
  157. package/dist/components/side-nav/types.js +1 -0
  158. package/dist/components/skeleton/docs/llms.md +1 -1
  159. package/dist/components/skeleton/skeleton.svelte +2 -2
  160. package/dist/components/skeleton/types.d.ts +1 -1
  161. package/dist/components/slider/docs/llms.md +31 -28
  162. package/dist/components/slider/slider.svelte +126 -61
  163. package/dist/components/slider/slider.svelte.d.ts +1 -3
  164. package/dist/components/slider/types.d.ts +21 -14
  165. package/dist/components/tab-view/docs/llms.md +7 -7
  166. package/dist/components/tab-view/tab-view-tab.svelte +16 -14
  167. package/dist/components/tab-view/tab-view.svelte +16 -9
  168. package/dist/components/tab-view/types.d.ts +6 -6
  169. package/dist/components/table/docs/llms.md +38 -33
  170. package/dist/components/table/table-body.svelte +2 -2
  171. package/dist/components/table/table-cell-actions.svelte +8 -2
  172. package/dist/components/table/table-cell-layout.svelte +2 -2
  173. package/dist/components/table/table-cell.svelte +2 -2
  174. package/dist/components/table/table-header-cell.svelte +2 -2
  175. package/dist/components/table/table-header.svelte +2 -2
  176. package/dist/components/table/table-row.svelte +2 -2
  177. package/dist/components/table/table-selection-cell.svelte +6 -6
  178. package/dist/components/table/table.svelte +2 -2
  179. package/dist/components/table/types.d.ts +11 -11
  180. package/dist/components/tag/docs/llms.md +26 -26
  181. package/dist/components/tag/tag-group.svelte +2 -2
  182. package/dist/components/tag/tag.svelte +13 -12
  183. package/dist/components/tag/types.d.ts +6 -4
  184. package/dist/components/tag-picker/docs/llms.md +61 -55
  185. package/dist/components/tag-picker/option-group.svelte +17 -4
  186. package/dist/components/tag-picker/option-group.svelte.d.ts +1 -1
  187. package/dist/components/tag-picker/option.svelte +15 -4
  188. package/dist/components/tag-picker/tag-picker.svelte +137 -65
  189. package/dist/components/tag-picker/tag-picker.svelte.d.ts +2 -2
  190. package/dist/components/tag-picker/types.d.ts +36 -16
  191. package/dist/components/text-box/docs/llms.md +31 -4
  192. package/dist/components/text-box/text-box-button.svelte +3 -3
  193. package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
  194. package/dist/components/text-box/text-box.svelte +41 -14
  195. package/dist/components/text-box/types.d.ts +5 -5
  196. package/dist/components/textarea/docs/llms.md +4 -3
  197. package/dist/components/textarea/textarea.svelte +14 -6
  198. package/dist/components/textarea/types.d.ts +2 -4
  199. package/dist/components/time-picker/docs/llms.md +18 -15
  200. package/dist/components/time-picker/time-picker.svelte +133 -33
  201. package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
  202. package/dist/components/time-picker/types.d.ts +23 -13
  203. package/dist/components/title-bar/docs/llms.md +382 -0
  204. package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
  205. package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
  206. package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
  207. package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
  208. package/dist/components/title-bar/title-bar.d.ts +3 -0
  209. package/dist/components/title-bar/title-bar.js +4 -0
  210. package/dist/components/title-bar/title-bar.svelte +224 -0
  211. package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
  212. package/dist/components/title-bar/types.d.ts +165 -0
  213. package/dist/components/title-bar/types.js +1 -0
  214. package/dist/components/toggle-switch/docs/llms.md +11 -9
  215. package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
  216. package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
  217. package/dist/components/toggle-switch/types.d.ts +12 -10
  218. package/dist/components/tooltip/docs/llms.md +1 -1
  219. package/dist/components/tooltip/tooltip.svelte +5 -4
  220. package/dist/components/tooltip/types.d.ts +1 -1
  221. package/dist/components/top-nav/docs/llms.md +1 -1
  222. package/dist/components/top-nav/top-nav-item.svelte +2 -2
  223. package/dist/components/top-nav/top-nav.svelte +2 -2
  224. package/dist/components/top-nav/types.d.ts +2 -2
  225. package/dist/components/tree-view/docs/llms.md +11 -11
  226. package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
  227. package/dist/components/tree-view/tree-view-item.svelte +13 -5
  228. package/dist/components/tree-view/tree-view.svelte +20 -5
  229. package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
  230. package/dist/components/tree-view/tree-view.svelte.js +31 -3
  231. package/dist/components/tree-view/types.d.ts +7 -3
  232. package/dist/index.d.ts +18 -0
  233. package/dist/index.js +20 -0
  234. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
  235. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
  236. package/dist/internal/index.d.ts +1 -0
  237. package/dist/internal/index.js +1 -0
  238. package/dist/internal/native-field.svelte.d.ts +44 -0
  239. package/dist/internal/native-field.svelte.js +85 -0
  240. package/dist/internal/utils.d.ts +16 -2
  241. package/dist/internal/utils.js +25 -3
  242. package/dist/types/index.d.ts +3 -3
  243. package/package.json +50 -36
@@ -25,10 +25,10 @@
25
25
  onDismiss,
26
26
  onclick,
27
27
  onkeydown,
28
- primaryProps,
29
- dismissProps,
28
+ primaryButtonAttributes,
29
+ dismissButtonAttributes,
30
30
  class: classes,
31
- ref = $bindable(),
31
+ ref = $bindable(null),
32
32
  children,
33
33
  ...attributes
34
34
  }: TagProps = $props();
@@ -44,8 +44,8 @@
44
44
  /** A plain tag is the dismiss button itself when it is dismissible. An interactive one holds its own buttons. */
45
45
  const tag = $derived(interactive ? 'div' : _dismissible ? 'button' : 'span');
46
46
 
47
- const primaryId = $derived(primaryProps?.id ?? `${FALLBACK_ID}-primary`);
48
- const dismissId = $derived(dismissProps?.id ?? `${FALLBACK_ID}-dismiss`);
47
+ const primaryId = $derived(primaryButtonAttributes?.id ?? `${FALLBACK_ID}-primary`);
48
+ const dismissId = $derived(dismissButtonAttributes?.id ?? `${FALLBACK_ID}-dismiss`);
49
49
 
50
50
  /** The dismiss icon names the button, unless the consumer named the tag itself. */
51
51
  const named = $derived(!!(attributes['aria-label'] || attributes['aria-labelledby']));
@@ -109,6 +109,7 @@
109
109
 
110
110
  <svelte:element
111
111
  this={tag}
112
+ {...attributes}
112
113
  bind:this={ref}
113
114
  class={[
114
115
  'fs-tag',
@@ -125,31 +126,31 @@
125
126
  ]}
126
127
  type={tag === 'button' ? 'button' : undefined}
127
128
  disabled={tag === 'button' ? _disabled : undefined}
128
- {...attributes}
129
129
  onclick={rootClick}
130
130
  onkeydown={handleKeydown}
131
131
  >
132
132
  {#if interactive}
133
133
  <button
134
+ {...primaryButtonAttributes}
134
135
  type="button"
135
- class="fs-tag-primary"
136
+ class={['fs-tag-primary', primaryButtonAttributes?.class]}
136
137
  id={primaryId}
137
138
  disabled={_disabled}
138
139
  aria-pressed={group ? _selected : undefined}
139
- {...primaryProps}
140
140
  onclick={handlePrimaryClick}
141
141
  >
142
142
  {@render content()}
143
143
  </button>
144
144
  {#if _dismissible}
145
145
  <button
146
+ {...dismissButtonAttributes}
146
147
  type="button"
147
- class="fs-tag-dismiss"
148
+ class={['fs-tag-dismiss', dismissButtonAttributes?.class]}
148
149
  id={dismissId}
149
150
  disabled={_disabled}
150
- aria-label={dismissLabel}
151
- aria-labelledby="{primaryId} {dismissId}"
152
- {...dismissProps}
151
+ aria-label={dismissButtonAttributes?.['aria-label'] ?? dismissLabel}
152
+ aria-labelledby={dismissButtonAttributes?.['aria-labelledby'] ??
153
+ (dismissButtonAttributes?.['aria-label'] ? undefined : `${primaryId} ${dismissId}`)}
153
154
  onclick={dismiss}
154
155
  >
155
156
  <RenderSoC SoC={dismissIcon} />
@@ -68,18 +68,20 @@ export type TagProps = {
68
68
  onkeydown?: (e: KeyboardEvent) => void;
69
69
  /** Attributes for the primary button of an interactive tag, for example `aria-haspopup`. If you give it
70
70
  * a custom `id`, the dismiss button is named after it.
71
+ * @type HTMLButtonAttributes
71
72
  */
72
- primaryProps?: Omit<HTMLButtonAttributes, 'children' | 'onclick'>;
73
+ primaryButtonAttributes?: Omit<HTMLButtonAttributes, 'children' | 'onclick'>;
73
74
  /** Attributes for the dismiss button of an interactive tag. Use `aria-label` together with
74
75
  * `aria-labelledby: undefined` to give the button a name that stands on its own.
76
+ * @type HTMLButtonAttributes
75
77
  */
76
- dismissProps?: Omit<HTMLButtonAttributes, 'children' | 'onclick'>;
78
+ dismissButtonAttributes?: Omit<HTMLButtonAttributes, 'children' | 'onclick'>;
77
79
  /** The primary text of the tag. */
78
80
  children?: Snippet;
79
81
  /** The DOM reference of the tag element.
80
82
  * @bindable
81
83
  */
82
- ref?: HTMLElement;
84
+ ref?: HTMLElement | null;
83
85
  } & Omit<PolymorphicProps<'span'>, 'children' | 'onclick' | 'onkeydown'>;
84
86
  /** @propsmith TagGroupProps */
85
87
  export type TagGroupProps = {
@@ -118,7 +120,7 @@ export type TagGroupProps = {
118
120
  /** The DOM reference of the group element.
119
121
  * @bindable
120
122
  */
121
- ref?: HTMLDivElement;
123
+ ref?: HTMLDivElement | null;
122
124
  } & Omit<PolymorphicProps<'div'>, 'children' | 'role'>;
123
125
  export type TagGroupContext = FSContext<{
124
126
  readonly size?: TagSize;
@@ -15,7 +15,7 @@ A TagPicker combines a text field and a dropdown, giving people a way to choose
15
15
 
16
16
  <TagPicker
17
17
  bind:selectedOptions
18
- inputProps={{ 'aria-label': 'Select Employees' }}
18
+ inputAttributes={{ 'aria-label': 'Select Employees' }}
19
19
  tagGroupProps={{ 'aria-label': 'Selected Employees' }}
20
20
  >
21
21
  {#each options as option (option)}
@@ -30,7 +30,7 @@ A TagPicker combines a text field and a dropdown, giving people a way to choose
30
30
  - Selecting an option adds a tag and clears the text. The option is not offered again until its tag is removed.
31
31
  - The options are filtered by what is typed in the input: a case-insensitive substring of the `text` of the option (its `value` when there is no `text`). The first match is highlighted.
32
32
  - A multiple picker keeps the list open after each choice. With `single` a new choice replaces the tag and closes the list.
33
- - Give the input an accessible name with `inputProps={{ 'aria-label': '...' }}`, and the group of tags one with `tagGroupProps`.
33
+ - Give the input an accessible name with `aria-label="..."`, and the group of tags one with `tagGroupProps`.
34
34
  - Pressing Backspace in an empty input removes the last tag. Tell your users about it.
35
35
  - A tag shows the `text` of its option, and keeps it once the option leaves the screen. This holds for a tag preselected through `selectedOptions` too, as long as the options are children of the TagPicker. A value that no option has is shown as it is, and so is every value during server-side rendering. To control what a tag says, render the tags yourself with the `tag` snippet.
36
36
  - Do not use an interactive `Tag` inside a TagPicker.
@@ -40,7 +40,7 @@ A TagPicker combines a text field and a dropdown, giving people a way to choose
40
40
 
41
41
  ### Default
42
42
 
43
- The `tag` snippet renders the tag of a chosen option, here with an `Avatar` as its media. Render a `Tag` with the given `value` and `role="listitem"`.
43
+ The `tag` snippet renders the tag of a chosen option, here with an `Avatar` as its media. Render a `Tag` with the given `value`.
44
44
 
45
45
  ```svelte
46
46
  <script>
@@ -51,13 +51,13 @@ The `tag` snippet renders the tag of a chosen option, here with an `Avatar` as i
51
51
  {#snippet media()}
52
52
  <Avatar aria-hidden="true" name={text} size={16} color="colorful" />
53
53
  {/snippet}
54
- <Tag role="listitem" {value} {media} title={text}>{text}</Tag>
54
+ <Tag {value} {media} title={text}>{text}</Tag>
55
55
  {/snippet}
56
56
 
57
57
  <TagPicker
58
58
  bind:selectedOptions
59
59
  {tag}
60
- inputProps={{ 'aria-label': 'Select Employees' }}
60
+ inputAttributes={{ 'aria-label': 'Select Employees' }}
61
61
  tagGroupProps={{ 'aria-label': 'Selected Employees' }}
62
62
  >
63
63
  {#each options as option (option)}
@@ -71,13 +71,13 @@ The `tag` snippet renders the tag of a chosen option, here with an `Avatar` as i
71
71
 
72
72
  ### Button
73
73
 
74
- Make the input read only with `inputProps={{ readonly: true }}` to use the TagPicker as a button that opens the list.
74
+ Make the input read only with `inputAttributes={{ readonly: true }}` to use the TagPicker as a button that opens the list.
75
75
 
76
76
  ```svelte
77
77
  <TagPicker
78
78
  bind:selectedOptions
79
79
  placeholder="Select employees"
80
- inputProps={{ 'aria-label': 'Select Employees', readonly: true }}
80
+ inputAttributes={{ 'aria-label': 'Select Employees', readonly: true }}
81
81
  >
82
82
  {#each options as option (option)}
83
83
  <TagPickerOption value={option}>{option}</TagPickerOption>
@@ -90,7 +90,7 @@ Make the input read only with `inputProps={{ readonly: true }}` to use the TagPi
90
90
  A disabled TagPicker cannot be opened, typed in or changed, and its tags cannot be dismissed.
91
91
 
92
92
  ```svelte
93
- <TagPicker disabled selectedOptions={[options[0]]} inputProps={{ 'aria-label': 'Select Employees' }}>
93
+ <TagPicker disabled selectedOptions={[options[0]]} inputAttributes={{ 'aria-label': 'Select Employees' }}>
94
94
  {#each options as option (option)}
95
95
  <TagPickerOption value={option}>{option}</TagPickerOption>
96
96
  {/each}
@@ -107,12 +107,12 @@ Replace the dropdown arrow with `expandIcon`, a component or a snippet, or remov
107
107
  </script>
108
108
 
109
109
  <!-- A custom icon -->
110
- <TagPicker bind:selectedOptions expandIcon={ArrowDownFilled} inputProps={{ 'aria-label': 'Select Employees' }}>
111
- ...
112
- </TagPicker>
110
+ <TagPicker bind:selectedOptions expandIcon={ArrowDownFilled} inputAttributes={{ 'aria-label': 'Select Employees' }}
111
+ >...</TagPicker
112
+ >
113
113
 
114
114
  <!-- No icon -->
115
- <TagPicker bind:selectedOptions expandIcon={null} inputProps={{ 'aria-label': 'Select Employees' }}>...</TagPicker>
115
+ <TagPicker bind:selectedOptions expandIcon={null} inputAttributes={{ 'aria-label': 'Select Employees' }}>...</TagPicker>
116
116
  ```
117
117
 
118
118
  ### Filtering
@@ -123,7 +123,7 @@ The options are filtered as the user types, and the first match is highlighted s
123
123
  <TagPicker
124
124
  bind:selectedOptions
125
125
  notFoundText="We couldn't find any matches"
126
- inputProps={{ 'aria-label': 'Select Employees' }}
126
+ inputAttributes={{ 'aria-label': 'Select Employees' }}
127
127
  >
128
128
  {#each options as option (option)}
129
129
  <TagPickerOption value={option}>{option}</TagPickerOption>
@@ -136,7 +136,7 @@ The options are filtered as the user types, and the first match is highlighted s
136
136
  Group options with `TagPickerOptionGroup`. A group with no option left on screen hides itself.
137
137
 
138
138
  ```svelte
139
- <TagPicker bind:selectedOptions inputProps={{ 'aria-label': 'Select Employees' }}>
139
+ <TagPicker bind:selectedOptions inputAttributes={{ 'aria-label': 'Select Employees' }}>
140
140
  <TagPickerOptionGroup label="Managers">
141
141
  {#each managers as option (option)}
142
142
  <TagPickerOption value={option}>{option}</TagPickerOption>
@@ -164,7 +164,7 @@ Leave out the options to get a TagPicker without a list, to let users enter thei
164
164
  bind:selectedOptions
165
165
  bind:value
166
166
  placeholder="Type and press Enter"
167
- inputProps={{ 'aria-label': 'Add Employees' }}
167
+ inputAttributes={{ 'aria-label': 'Add Employees' }}
168
168
  querySubmitted={(e, query) => {
169
169
  if (!selectedOptions.includes(query)) selectedOptions = [...selectedOptions, query];
170
170
  value = '';
@@ -181,7 +181,7 @@ Add a button next to the dropdown arrow with the `secondaryAction` snippet.
181
181
  <Button appearance="subtle" onclick={() => (selectedOptions = [])}>All Clear</Button>
182
182
  {/snippet}
183
183
 
184
- <TagPicker bind:selectedOptions secondaryAction={allClear} inputProps={{ 'aria-label': 'Select Employees' }}>
184
+ <TagPicker bind:selectedOptions secondaryAction={allClear} inputAttributes={{ 'aria-label': 'Select Employees' }}>
185
185
  {#each options as option (option)}
186
186
  <TagPickerOption value={option}>{option}</TagPickerOption>
187
187
  {/each}
@@ -193,7 +193,7 @@ Add a button next to the dropdown arrow with the `secondaryAction` snippet.
193
193
  With `single` a new choice replaces the current tag and closes the list.
194
194
 
195
195
  ```svelte
196
- <TagPicker single bind:selectedOptions inputProps={{ 'aria-label': 'Select Employee' }}>
196
+ <TagPicker single bind:selectedOptions inputAttributes={{ 'aria-label': 'Select Employee' }}>
197
197
  {#each options as option (option)}
198
198
  <TagPickerOption value={option}>{option}</TagPickerOption>
199
199
  {/each}
@@ -206,7 +206,7 @@ A TagPicker is `medium` by default, or `large` or `extra-large`. The size of the
206
206
 
207
207
  ```svelte
208
208
  {#each ['medium', 'large', 'extra-large'] as size}
209
- <TagPicker {size} selectedOptions={[options[0]]} inputProps={{ 'aria-label': size }}>
209
+ <TagPicker {size} selectedOptions={[options[0]]} inputAttributes={{ 'aria-label': size }}>
210
210
  {#each options as option (option)}
211
211
  <TagPickerOption value={option}>{option}</TagPickerOption>
212
212
  {/each}
@@ -220,10 +220,10 @@ A tag that is wider than the control, or than its own `max-width`, shortens its
220
220
 
221
221
  ```svelte
222
222
  {#snippet tag({ value, text })}
223
- <Tag role="listitem" {value} title={text} style="max-width: 100px;">{text}</Tag>
223
+ <Tag {value} title={text} style="max-width: 100px;">{text}</Tag>
224
224
  {/snippet}
225
225
 
226
- <TagPicker bind:selectedOptions {tag} inputProps={{ 'aria-label': 'Select Employees' }}>
226
+ <TagPicker bind:selectedOptions {tag} inputAttributes={{ 'aria-label': 'Select Employees' }}>
227
227
  {#each [...longOptions, ...options] as option (option)}
228
228
  <TagPickerOption value={option}>
229
229
  <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;">{option}</span>
@@ -232,32 +232,36 @@ A tag that is wider than the control, or than its own `max-width`, shortens its
232
232
  </TagPicker>
233
233
  ```
234
234
 
235
+ HTML attributes, including class, id and ARIA attributes, apply to the control element. Bind ref to access that control. Use wrapperAttributes and wrapperRef for the outer container.
236
+
235
237
  ## Component Props (TagPicker)
236
238
 
237
239
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
238
240
  <!-- props:TagPickerProps -->
239
241
 
240
- | Name | Type | Default | Description |
241
- | --------------------------------------------------- | -------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
242
- | `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the wrapper element. |
243
- | `inputRef` _bindable_ | `HTMLInputElement` | | The DOM reference of the input element. |
244
- | `selectedOptions` _bindable_ | `string[]` | `[]` | The values of the chosen options, shown as tags in the control. A value no option has is shown as it is. |
245
- | `value` _bindable_ | `string` | `''` | The text typed in the input. It filters the options, and is cleared when one is chosen. |
246
- | `open` _bindable_ | `boolean` | `false` | Controls the open state of the option list. |
247
- | `single` | `boolean` | | Limits the picker to one tag: choosing an option replaces the current one and closes the list. |
248
- | `disabled` | `boolean` | | Disables the user interaction: the input, the tags and the list. |
249
- | `size` | `'medium'` &#124; `'large'` &#124; `'extra-large'` | `'medium'` | The size of the control. It also picks the size of the tags. |
250
- | `placeholder` | `string` | | The placeholder text of the input. |
251
- | `notFoundText` | `string` | `'No options available'` | The message shown in place of the list when there is no option left to choose. |
252
- | `expandIcon` | `Snippet` &#124; `Component` &#124; `null` | `ChevronDownRegular` | The dropdown arrow. Pass `null` to remove it. |
253
- | `secondaryAction` | `Snippet` | | A button-like element rendered at the end of the control, before the dropdown arrow. |
254
- | `tag` | `Snippet<[{ value: string; text: string }]>` | | Renders the tag of a chosen option, to give it media or custom text. Falls back to a plain tag. Render a `Tag` with the given `value`, and `role="listitem"`. |
255
- | `tagGroupProps` | `TagGroupProps` | | The props to spread on the group holding the tags. This is where its `aria-label` goes. |
256
- | `inputProps` | `HTMLInputAttributes` | | The props to spread on the input. This is where its accessible name (`aria-label`) and `readonly` (to turn the input into a plain trigger) go. |
257
- | `onSelectionChange` | `(e: Event, selectedOptions: string[]) => void` | | Called when an option is chosen, or a tag is removed. |
258
- | `querySubmitted` | `(e: KeyboardEvent, query: string) => void` | | Called when Enter is pressed with text in the input and no option under the cursor. This is where a free-form tag is added. |
259
- | `children` | `Snippet` | | The options. Leave it out to get a picker without a list. |
260
- | `HTMLAttributes<HTMLDivElement>` without `children` | | | |
242
+ | Name | Type | Default | Description |
243
+ | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
244
+ | `wrapperRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the wrapper element. |
245
+ | `ref` _bindable_ | `HTMLSelectElement` &#124; `null` | | The DOM reference of the native multiple select that holds the selected options. The other attributes of the picker are applied to it. |
246
+ | `inputRef` _bindable_ | `HTMLInputElement` &#124; `null` | | The DOM reference of the text input. |
247
+ | `inputAttributes` | `HTMLInputAttributes` | | The attributes to spread on the text input. |
248
+ | `selectedOptions` _bindable_ | `string[]` | `[]` | The values of the chosen options, shown as tags in the control. A value no option has is shown as it is. |
249
+ | `value` _bindable_ | `string` | `''` | The text typed in the input. It filters the options, and is cleared when one is chosen. |
250
+ | `open` _bindable_ | `boolean` | `false` | Controls the open state of the option list. |
251
+ | `single` | `boolean` | | Limits the picker to one tag: choosing an option replaces the current one and closes the list. |
252
+ | `disabled` | `boolean` | | Disables the user interaction: the input, the tags and the list. |
253
+ | `size` | `'medium'` &#124; `'large'` &#124; `'extra-large'` | `'medium'` | The size of the control. It also picks the size of the tags. |
254
+ | `placeholder` | `string` | | The placeholder text of the input. |
255
+ | `notFoundText` | `string` | `'No options available'` | The message shown in place of the list when there is no option left to choose. |
256
+ | `expandIcon` | `Snippet` &#124; `Component` &#124; `null` | `ChevronDownRegular` | The dropdown arrow. Pass `null` to remove it. |
257
+ | `secondaryAction` | `Snippet` | | A button-like element rendered at the end of the control, before the dropdown arrow. |
258
+ | `tag` | `Snippet<[{ value: string; text: string }]>` | | Renders the tag of a chosen option, to give it media or custom text. Falls back to a plain tag. Render a `Tag` with the given `value`. |
259
+ | `tagGroupProps` | `TagGroupProps` | | The props to spread on the group holding the tags. This is where its `aria-label` goes, `'Selected options'` by default. |
260
+ | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
261
+ | `onSelectionChange` | `(e: Event, selectedOptions: string[]) => void` | | Called when an option is chosen, or a tag is removed. |
262
+ | `querySubmitted` | `(e: KeyboardEvent, query: string) => void` | | Called when Enter is pressed with text in the input and no option under the cursor. This is where a free-form tag is added. |
263
+ | `children` | `Snippet` | | The options. Leave it out to get a picker without a list. |
264
+ | `NativeFieldAttributes<Omit<HTMLSelectAttributes, 'value'` &#124; `'multiple'` &#124; `'size'` &#124; `'disabled'` &#124; `'children'>>` | | | |
261
265
 
262
266
  <!-- /props:TagPickerProps -->
263
267
 
@@ -266,14 +270,14 @@ A tag that is wider than the control, or than its own `max-width`, shortens its
266
270
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
267
271
  <!-- props:TagPickerOptionProps -->
268
272
 
269
- | Name | Type | Default | Description |
270
- | ------------------------------------------------------------------------ | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
271
- | `value` | `string` | | The value added to `selectedOptions` when the option is chosen. |
272
- | `text` | `string` | | The text the option is filtered by, and the text of its tag. Falls back to `value`. |
273
- | `id` | `string` | | The id of the option element, referenced by the input through `aria-activedescendant`. Falls back to a generated id. |
274
- | `ref` _bindable_ | `HTMLLIElement` | | The DOM reference of the option element. |
275
- | `disabled` | `boolean` | | Takes the option out of reach: it is shown, but the cursor steps over it. |
276
- | `ListViewItemProps<'li'>` without `as`, `value`, `onAction`, `checkmark` | | | |
273
+ | Name | Type | Default | Description |
274
+ | ------------------------------------------------------------------------ | ----------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
275
+ | `value` | `string` | | The value added to `selectedOptions` when the option is chosen. |
276
+ | `text` | `string` | | The text the option is filtered by, and the text of its tag. Falls back to `value`. |
277
+ | `id` | `string` | | The id of the option element, referenced by the input through `aria-activedescendant`. Falls back to a generated id. |
278
+ | `ref` _bindable_ | `HTMLLIElement` &#124; `null` | | The DOM reference of the option element. |
279
+ | `disabled` | `boolean` | | Takes the option out of reach: it is shown, but the cursor steps over it. |
280
+ | `ListViewItemProps<'li'>` without `as`, `value`, `onAction`, `checkmark` | | | |
277
281
 
278
282
  <!-- /props:TagPickerOptionProps -->
279
283
 
@@ -282,11 +286,13 @@ A tag that is wider than the control, or than its own `max-width`, shortens its
282
286
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
283
287
  <!-- props:TagPickerOptionGroupProps -->
284
288
 
285
- | Name | Type | Default | Description |
286
- | ----------------------------------------------------- | ------------------ | ------- | --------------------------------------- |
287
- | `label` | `string` | | The label of the group. |
288
- | `ref` _bindable_ | `HTMLUListElement` | | The DOM reference of the group element. |
289
- | `children` | `Snippet` | | The options of the group. |
290
- | `HTMLAttributes<HTMLUListElement>` without `children` | | | |
289
+ | Name | Type | Default | Description |
290
+ | ----------------------------------------------------- | -------------------------------- | ------- | ------------------------------------------------ |
291
+ | `label` | `string` | | The label of the group. |
292
+ | `ref` _bindable_ | `HTMLUListElement` &#124; `null` | | The DOM reference of the group element. |
293
+ | `children` | `Snippet` | | The options of the group. |
294
+ | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
295
+ | `wrapperRef` _bindable_ | `HTMLLIElement` &#124; `null` | | The DOM reference of the wrapper element. |
296
+ | `HTMLAttributes<HTMLUListElement>` without `children` | | | |
291
297
 
292
298
  <!-- /props:TagPickerOptionGroupProps -->
@@ -5,12 +5,25 @@
5
5
  const FALLBACK_ID = $props.id();
6
6
  const LABEL_ID = `${PREFIX}-tagpicker-group-${FALLBACK_ID}-label`;
7
7
 
8
- let { label, ref = $bindable(), class: classes, children, ...attributes }: TagPickerOptionGroupProps = $props();
8
+ let {
9
+ label,
10
+ ref = $bindable(null),
11
+ class: classes,
12
+ children,
13
+ wrapperAttributes,
14
+ wrapperRef = $bindable(null),
15
+ ...attributes
16
+ }: TagPickerOptionGroupProps = $props();
9
17
  </script>
10
18
 
11
- <li class="fs-tagpicker-group" role="presentation">
19
+ <li
20
+ {...wrapperAttributes}
21
+ class={['fs-tagpicker-group', wrapperAttributes?.class]}
22
+ role="presentation"
23
+ bind:this={wrapperRef}
24
+ >
12
25
  <span class="fs-tagpicker-group-label" id={LABEL_ID}>{label}</span>
13
- <ul bind:this={ref} class={classes} role="group" aria-labelledby={LABEL_ID} {...attributes}>
26
+ <ul {...attributes} class={classes} role="group" aria-labelledby={LABEL_ID} bind:this={ref}>
14
27
  {@render children?.()}
15
28
  </ul>
16
29
  </li>
@@ -18,7 +31,7 @@
18
31
  <style>
19
32
  .fs-tagpicker-group {
20
33
  list-style: none;
21
- /* A group left without an option on screen hides itself. */
34
+ /* A group left without an option on screen hides itself. F*/
22
35
  &:not(:has(:global(.fs-tagpicker-option))) {
23
36
  display: none;
24
37
  }
@@ -1,4 +1,4 @@
1
1
  import type { TagPickerOptionGroupProps } from './types.ts';
2
- declare const OptionGroup: import("svelte").Component<TagPickerOptionGroupProps, {}, "ref">;
2
+ declare const OptionGroup: import("svelte").Component<TagPickerOptionGroupProps, {}, "ref" | "wrapperRef">;
3
3
  type OptionGroup = ReturnType<typeof OptionGroup>;
4
4
  export default OptionGroup;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { onMount } from 'svelte';
2
3
  import { PREFIX } from '../../internal/constants.js';
3
4
  import ListViewItem from '../list-view/list-view-item.svelte';
4
5
  import { getTagPickerContext } from './tag-picker.js';
@@ -9,7 +10,7 @@
9
10
 
10
11
  let {
11
12
  disabled,
12
- ref = $bindable(),
13
+ ref = $bindable(null),
13
14
  id = ID,
14
15
  value,
15
16
  text,
@@ -37,8 +38,18 @@
37
38
  if (!disabled) methods.chooseOption(e, id);
38
39
  }
39
40
 
40
- // The tag of the option keeps its text even when the option itself is not on screen.
41
- $effect(() => methods.setLabel(value, label));
41
+ // The tag of the option keeps its text even when the option itself is not on screen. It is
42
+ // reported as the option is created, ahead of the tags, so the server writes it too.
43
+ const withdraw = methods.registerLabel({
44
+ get value() {
45
+ return value;
46
+ },
47
+ get text() {
48
+ return label;
49
+ }
50
+ });
51
+
52
+ onMount(() => withdraw);
42
53
 
43
54
  // An option counts only while it is on screen: that is what makes the empty list detectable
44
55
  // and keeps keyboard navigation off options nobody can see.
@@ -56,6 +67,7 @@
56
67
 
57
68
  {#if isVisible}
58
69
  <ListViewItem
70
+ {...attributes}
59
71
  {id}
60
72
  role="option"
61
73
  {value}
@@ -63,7 +75,6 @@
63
75
  class={['fs-tagpicker-option', classes]}
64
76
  bind:ref
65
77
  {disabled}
66
- {...attributes}
67
78
  onclick={handleClick}
68
79
  >
69
80
  {@render children?.()}