fluentui-svelte 0.5.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 (259) 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 +17 -2
  63. package/dist/components/dialog/dialog-content.svelte +2 -2
  64. package/dist/components/dialog/dialog-content.svelte.d.ts +1 -1
  65. package/dist/components/dialog/dialog-surface.svelte +130 -8
  66. package/dist/components/dialog/dialog-title.svelte +23 -6
  67. package/dist/components/dialog/dialog-trigger.svelte +8 -2
  68. package/dist/components/dialog/dialog-trigger.svelte.d.ts +1 -1
  69. package/dist/components/dialog/dialog.svelte +22 -11
  70. package/dist/components/dialog/docs/llms.md +56 -19
  71. package/dist/components/dialog/types.d.ts +31 -9
  72. package/dist/components/dialog/utils.d.ts +2 -0
  73. package/dist/components/dialog/utils.js +1 -0
  74. package/dist/components/divider/divider.svelte +6 -4
  75. package/dist/components/divider/types.d.ts +1 -1
  76. package/dist/components/dropdown/docs/llms.md +30 -28
  77. package/dist/components/dropdown/dropdown-option.svelte +17 -5
  78. package/dist/components/dropdown/dropdown.svelte +182 -84
  79. package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
  80. package/dist/components/dropdown/types.d.ts +26 -20
  81. package/dist/components/dropdown-select/docs/llms.md +24 -22
  82. package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
  83. package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
  84. package/dist/components/dropdown-select/types.d.ts +4 -4
  85. package/dist/components/expander/docs/llms.md +3 -3
  86. package/dist/components/expander/expander.svelte +13 -8
  87. package/dist/components/expander/types.d.ts +5 -5
  88. package/dist/components/flyout/docs/llms.md +1 -1
  89. package/dist/components/flyout/flyout.svelte +17 -6
  90. package/dist/components/flyout/types.d.ts +1 -1
  91. package/dist/components/hyperlink/docs/llms.md +6 -6
  92. package/dist/components/hyperlink/hyperlink.svelte +13 -4
  93. package/dist/components/hyperlink/types.d.ts +1 -1
  94. package/dist/components/info-bar/docs/llms.md +11 -10
  95. package/dist/components/info-bar/info-bar.svelte +3 -2
  96. package/dist/components/info-bar/types.d.ts +4 -0
  97. package/dist/components/label/docs/llms.md +75 -22
  98. package/dist/components/label/label-context.d.ts +14 -0
  99. package/dist/components/label/label-context.js +10 -0
  100. package/dist/components/label/label.svelte +153 -30
  101. package/dist/components/label/label.svelte.d.ts +1 -1
  102. package/dist/components/label/types.d.ts +48 -4
  103. package/dist/components/list-view/docs/llms.md +103 -33
  104. package/dist/components/list-view/list-view-item-branch.svelte +257 -0
  105. package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
  106. package/dist/components/list-view/list-view-item.svelte +164 -46
  107. package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
  108. package/dist/components/list-view/list-view.svelte +73 -25
  109. package/dist/components/list-view/types.d.ts +71 -8
  110. package/dist/components/list-view/utils.d.ts +10 -0
  111. package/dist/components/list-view/utils.js +17 -1
  112. package/dist/components/menu/docs/llms.md +98 -15
  113. package/dist/components/menu/menu-command-bar-item.svelte +61 -0
  114. package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
  115. package/dist/components/menu/menu-command-bar.svelte +218 -0
  116. package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
  117. package/dist/components/menu/menu-group.svelte +6 -3
  118. package/dist/components/menu/menu-item-checkbox.svelte +5 -4
  119. package/dist/components/menu/menu-item-radio.svelte +5 -4
  120. package/dist/components/menu/menu-item-switch.svelte +5 -4
  121. package/dist/components/menu/menu-item.svelte +5 -5
  122. package/dist/components/menu/menu-item.svelte.d.ts +2 -3
  123. package/dist/components/menu/menu-list.svelte +10 -1
  124. package/dist/components/menu/menu-popover.svelte +9 -5
  125. package/dist/components/menu/menu-trigger.svelte +2 -1
  126. package/dist/components/menu/menu.svelte.js +1 -0
  127. package/dist/components/menu/types.d.ts +62 -7
  128. package/dist/components/number-box/docs/llms.md +6 -4
  129. package/dist/components/number-box/number-box.svelte +35 -29
  130. package/dist/components/number-box/number-box.svelte.d.ts +1 -1
  131. package/dist/components/number-box/types.d.ts +1 -1
  132. package/dist/components/persona/docs/llms.md +29 -25
  133. package/dist/components/persona/persona.svelte +8 -6
  134. package/dist/components/persona/types.d.ts +4 -3
  135. package/dist/components/progress-bar/docs/llms.md +13 -13
  136. package/dist/components/progress-bar/progress-bar.svelte +6 -6
  137. package/dist/components/progress-bar/types.d.ts +4 -4
  138. package/dist/components/progress-ring/docs/llms.md +14 -14
  139. package/dist/components/progress-ring/progress-ring.svelte +5 -5
  140. package/dist/components/progress-ring/types.d.ts +3 -3
  141. package/dist/components/radio-button/docs/llms.md +11 -8
  142. package/dist/components/radio-button/radio-button.svelte +38 -12
  143. package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
  144. package/dist/components/radio-button/types.d.ts +11 -8
  145. package/dist/components/rating/docs/llms.md +111 -0
  146. package/dist/components/rating/rating.svelte +247 -0
  147. package/dist/components/rating/rating.svelte.d.ts +19 -0
  148. package/dist/components/rating/types.d.ts +44 -0
  149. package/dist/components/rating/types.js +1 -0
  150. package/dist/components/side-nav/docs/llms.md +110 -0
  151. package/dist/components/side-nav/side-nav-branch.svelte +43 -0
  152. package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
  153. package/dist/components/side-nav/side-nav-item.svelte +75 -0
  154. package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
  155. package/dist/components/side-nav/side-nav-list.svelte +32 -0
  156. package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
  157. package/dist/components/side-nav/side-nav.d.ts +2 -0
  158. package/dist/components/side-nav/side-nav.js +2 -0
  159. package/dist/components/side-nav/side-nav.svelte +355 -0
  160. package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
  161. package/dist/components/side-nav/types.d.ts +149 -0
  162. package/dist/components/side-nav/types.js +1 -0
  163. package/dist/components/skeleton/docs/llms.md +1 -1
  164. package/dist/components/skeleton/skeleton.svelte +2 -2
  165. package/dist/components/skeleton/types.d.ts +1 -1
  166. package/dist/components/slider/docs/llms.md +31 -28
  167. package/dist/components/slider/slider.svelte +126 -61
  168. package/dist/components/slider/slider.svelte.d.ts +1 -3
  169. package/dist/components/slider/types.d.ts +21 -14
  170. package/dist/components/tab-view/docs/llms.md +7 -7
  171. package/dist/components/tab-view/tab-view-tab.svelte +16 -14
  172. package/dist/components/tab-view/tab-view.svelte +16 -9
  173. package/dist/components/tab-view/types.d.ts +6 -6
  174. package/dist/components/table/docs/llms.md +38 -33
  175. package/dist/components/table/table-body.svelte +2 -2
  176. package/dist/components/table/table-cell-actions.svelte +8 -2
  177. package/dist/components/table/table-cell-layout.svelte +2 -2
  178. package/dist/components/table/table-cell.svelte +2 -2
  179. package/dist/components/table/table-header-cell.svelte +2 -2
  180. package/dist/components/table/table-header.svelte +2 -2
  181. package/dist/components/table/table-row.svelte +2 -2
  182. package/dist/components/table/table-selection-cell.svelte +6 -6
  183. package/dist/components/table/table.svelte +2 -2
  184. package/dist/components/table/types.d.ts +11 -11
  185. package/dist/components/tag/docs/llms.md +383 -0
  186. package/dist/components/tag/tag-group.d.ts +2 -0
  187. package/dist/components/tag/tag-group.js +2 -0
  188. package/dist/components/tag/tag-group.svelte +117 -0
  189. package/dist/components/tag/tag-group.svelte.d.ts +20 -0
  190. package/dist/components/tag/tag.svelte +459 -0
  191. package/dist/components/tag/tag.svelte.d.ts +19 -0
  192. package/dist/components/tag/types.d.ts +137 -0
  193. package/dist/components/tag/types.js +1 -0
  194. package/dist/components/tag-picker/docs/llms.md +298 -0
  195. package/dist/components/tag-picker/option-group.svelte +51 -0
  196. package/dist/components/tag-picker/option-group.svelte.d.ts +4 -0
  197. package/dist/components/tag-picker/option.svelte +82 -0
  198. package/dist/components/tag-picker/option.svelte.d.ts +4 -0
  199. package/dist/components/tag-picker/tag-picker.d.ts +2 -0
  200. package/dist/components/tag-picker/tag-picker.js +2 -0
  201. package/dist/components/tag-picker/tag-picker.svelte +716 -0
  202. package/dist/components/tag-picker/tag-picker.svelte.d.ts +21 -0
  203. package/dist/components/tag-picker/types.d.ts +142 -0
  204. package/dist/components/tag-picker/types.js +1 -0
  205. package/dist/components/text-box/docs/llms.md +31 -4
  206. package/dist/components/text-box/text-box-button.svelte +3 -3
  207. package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
  208. package/dist/components/text-box/text-box.svelte +41 -14
  209. package/dist/components/text-box/types.d.ts +5 -5
  210. package/dist/components/textarea/docs/llms.md +4 -3
  211. package/dist/components/textarea/textarea.svelte +14 -6
  212. package/dist/components/textarea/types.d.ts +2 -4
  213. package/dist/components/time-picker/docs/llms.md +18 -15
  214. package/dist/components/time-picker/time-picker.svelte +133 -33
  215. package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
  216. package/dist/components/time-picker/types.d.ts +23 -13
  217. package/dist/components/title-bar/docs/llms.md +382 -0
  218. package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
  219. package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
  220. package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
  221. package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
  222. package/dist/components/title-bar/title-bar.d.ts +3 -0
  223. package/dist/components/title-bar/title-bar.js +4 -0
  224. package/dist/components/title-bar/title-bar.svelte +224 -0
  225. package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
  226. package/dist/components/title-bar/types.d.ts +165 -0
  227. package/dist/components/title-bar/types.js +1 -0
  228. package/dist/components/toggle-switch/docs/llms.md +11 -9
  229. package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
  230. package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
  231. package/dist/components/toggle-switch/types.d.ts +12 -10
  232. package/dist/components/tooltip/docs/llms.md +1 -1
  233. package/dist/components/tooltip/tooltip.svelte +5 -4
  234. package/dist/components/tooltip/types.d.ts +1 -1
  235. package/dist/components/top-nav/docs/llms.md +1 -1
  236. package/dist/components/top-nav/top-nav-item.svelte +2 -2
  237. package/dist/components/top-nav/top-nav.svelte +2 -2
  238. package/dist/components/top-nav/types.d.ts +2 -2
  239. package/dist/components/tree-view/docs/llms.md +11 -11
  240. package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
  241. package/dist/components/tree-view/tree-view-item.svelte +13 -5
  242. package/dist/components/tree-view/tree-view.svelte +20 -5
  243. package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
  244. package/dist/components/tree-view/tree-view.svelte.js +31 -3
  245. package/dist/components/tree-view/types.d.ts +7 -3
  246. package/dist/index.d.ts +25 -0
  247. package/dist/index.js +32 -0
  248. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
  249. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
  250. package/dist/internal/constants.d.ts +0 -4
  251. package/dist/internal/constants.js +0 -4002
  252. package/dist/internal/index.d.ts +1 -0
  253. package/dist/internal/index.js +1 -0
  254. package/dist/internal/native-field.svelte.d.ts +44 -0
  255. package/dist/internal/native-field.svelte.js +85 -0
  256. package/dist/internal/utils.d.ts +16 -2
  257. package/dist/internal/utils.js +25 -3
  258. package/dist/types/index.d.ts +3 -3
  259. package/package.json +51 -37
@@ -19,15 +19,15 @@ export type DropdownSelectProps = {
19
19
  /** The DOM reference of the select element.
20
20
  * @bindable
21
21
  */
22
- ref?: HTMLSelectElement;
22
+ ref?: HTMLSelectElement | null;
23
23
  /** The DOM reference of the wrapper element.
24
24
  * @bindable
25
25
  */
26
- wrapperRef?: HTMLDivElement;
26
+ wrapperRef?: HTMLDivElement | null;
27
27
  /** The attributes to spread on the wrapper element.
28
28
  * @type HTMLAttributes
29
29
  */
30
- wrapperProps?: HTMLAttributes<HTMLDivElement>;
30
+ wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
31
31
  } & HTMLSelectAttributes;
32
32
  /** @propsmith DropdownSelectOptionProps */
33
33
  export type DropdownSelectOptionProps = {
@@ -40,7 +40,7 @@ export type DropdownSelectOptionProps = {
40
40
  /** The DOM reference of the option element.
41
41
  * @bindable
42
42
  */
43
- ref?: HTMLElement;
43
+ ref?: HTMLElement | null;
44
44
  /** The content of the option, used when no `text` is given. */
45
45
  children?: Snippet;
46
46
  } & HTMLOptionAttributes;
@@ -86,10 +86,10 @@ You can easily add an icon to an expander's header using the `Icon` prop. You ca
86
86
  | `disabled` | `boolean` | `false` | Disables the user interaction. |
87
87
  | `animation` | `{ duration: number; easing: string; }` | | The animation configuration. Reduced motion is always honoured over this. |
88
88
  | `expanded` _bindable_ | `boolean` | `false` | Control the opening state of the expander. |
89
- | `ref` _bindable_ | `HTMLDetailsElement` | | The DOM reference of the expander element. |
89
+ | `ref` _bindable_ | `HTMLDetailsElement` &#124; `null` | | The DOM reference of the expander element. |
90
90
  | `Icon` | `Snippet` &#124; `Component` | | The icon to display before the label. |
91
- | `summaryRef` _bindable_ | `HTMLElement` | | The DOM reference of the summary element. |
92
- | `summaryProps` | `HTMLAttributes` | | The props to spread on the summary element. |
91
+ | `summaryRef` _bindable_ | `HTMLElement` &#124; `null` | | The DOM reference of the summary element. |
92
+ | `summaryAttributes` | `HTMLAttributes<HTMLElement>` | | The HTML attributes to spread on the summary element. |
93
93
  | Element Attributes (`details`) | | | |
94
94
 
95
95
  <!-- /props:ExpanderProps -->
@@ -13,12 +13,12 @@
13
13
  direction = 'down',
14
14
  animation,
15
15
  justify = false,
16
- ref = $bindable(),
16
+ ref = $bindable(null),
17
17
  expanded = $bindable(false),
18
18
  children,
19
19
  Icon,
20
- summaryRef = $bindable(),
21
- summaryProps,
20
+ summaryRef = $bindable(null),
21
+ summaryAttributes,
22
22
  ...attributes
23
23
  }: ExpanderProps = $props();
24
24
 
@@ -66,17 +66,22 @@ improve the user experience.
66
66
  ```
67
67
  -->
68
68
  <details
69
+ {...attributes}
69
70
  bind:this={ref}
70
71
  bind:open={expanded}
71
72
  use:expander
72
- class={['fs-expander', direction, { disabled, justify }]}
73
- {...attributes}
73
+ class={['fs-expander', direction, { disabled, justify }, attributes?.class]}
74
74
  >
75
75
  <summary
76
- class="fs-summary"
77
- onclick={(e) => invokeHandlers(e, [disabled], [supportInterpolation && (() => e.preventDefault()), handleClick])}
76
+ {...summaryAttributes}
77
+ class={['fs-summary', summaryAttributes?.class]}
78
+ onclick={(e) =>
79
+ invokeHandlers(
80
+ e,
81
+ [disabled],
82
+ [supportInterpolation && (() => e.preventDefault()), handleClick, summaryAttributes?.onclick]
83
+ )}
78
84
  bind:this={summaryRef}
79
- {...summaryProps}
80
85
  >
81
86
  <span class="row">
82
87
  {#if Icon}
@@ -31,7 +31,7 @@ export type ExpanderProps = {
31
31
  /** The DOM reference of the expander element.
32
32
  * @bindable
33
33
  */
34
- ref?: HTMLDetailsElement;
34
+ ref?: HTMLDetailsElement | null;
35
35
  /** The icon to display before the label.
36
36
  * @type Snippet | Component
37
37
  */
@@ -39,9 +39,9 @@ export type ExpanderProps = {
39
39
  /** The DOM reference of the summary element.
40
40
  * @bindable
41
41
  */
42
- summaryRef?: HTMLElement;
43
- /** The props to spread on the summary element.
44
- * @type HTMLAttributes
42
+ summaryRef?: HTMLElement | null;
43
+ /** The HTML attributes to spread on the summary element.
44
+ * @type HTMLAttributes<HTMLElement>
45
45
  */
46
- summaryProps?: HTMLAttributes<HTMLElement>;
46
+ summaryAttributes?: HTMLAttributes<HTMLElement>;
47
47
  } & HTMLDetailsAttributes;
@@ -23,7 +23,7 @@ The Flyout.
23
23
 
24
24
  | Name | Type | Default | Description |
25
25
  | -------------------------- | ------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------- |
26
- | `ref` _bindable_ | `HTMLElement` | | The DOM reference of the flyout element. |
26
+ | `ref` _bindable_ | `HTMLElement` &#124; `null` | | The DOM reference of the flyout element. |
27
27
  | `children` | `Snippet` | | The content of the flyout. |
28
28
  | `floating` | `boolean` | `false` | Positions the flyout with floating-ui instead of leaving it in the normal flow. |
29
29
  | `reference` | `HTMLElement` | | The element the flyout is positioned against when `floating` is set. |
@@ -1,11 +1,10 @@
1
1
  <script lang="ts">
2
- import { onMount } from 'svelte';
3
2
  import { computePosition, offset, autoPlacement, hide, autoUpdate, type Placement } from '@floating-ui/dom';
4
3
  import { roundByDPR } from '../../internal/index.js';
5
4
  import type { FlyoutProps } from './types.js';
6
5
 
7
6
  let {
8
- ref = $bindable(),
7
+ ref = $bindable(null),
9
8
  children,
10
9
  floating = false,
11
10
  reference,
@@ -14,6 +13,7 @@
14
13
  placementConfig,
15
14
  roundCorners = 'all',
16
15
  offset: offsetValue = 8,
16
+ hidden,
17
17
  class: classes,
18
18
  ...attributes
19
19
  }: FlyoutProps = $props();
@@ -37,9 +37,12 @@
37
37
  return 'round-all';
38
38
  }
39
39
 
40
- onMount(() => {
41
- if (floating && reference && ref) {
40
+ // A hidden flyout stays in the page unplaced, and is placed again once it shows.
41
+ $effect(() => {
42
+ if (floating && reference && ref && !hidden) {
42
43
  const middleware = [offset(offsetValue), autoPlacement(placementConfig), hide()];
44
+ // A position that arrives once the flyout is hidden or gone is dropped.
45
+ let placing = true;
43
46
  const update = async () => {
44
47
  if (!reference || !ref) return;
45
48
 
@@ -53,6 +56,8 @@
53
56
  middleware
54
57
  });
55
58
 
59
+ if (!placing || !ref) return;
60
+
56
61
  Object.assign(ref.style, {
57
62
  transform: `translate(${roundByDPR(x)}px, ${roundByDPR(y)}px)`,
58
63
  visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
@@ -64,7 +69,10 @@
64
69
  }
65
70
  };
66
71
  const cleanup = autoUpdate(reference, ref, update);
67
- return () => cleanup();
72
+ return () => {
73
+ placing = false;
74
+ cleanup();
75
+ };
68
76
  }
69
77
  });
70
78
  </script>
@@ -85,7 +93,7 @@ A contextual popup that displays a set of actions or options. It appears when us
85
93
  </Flyout>
86
94
  ```
87
95
  -->
88
- <div class={['fs-flyout', roundClass, classes, { floating }]} bind:this={ref} {...attributes}>
96
+ <div {...attributes} {hidden} class={['fs-flyout', roundClass, classes, { floating }]} bind:this={ref}>
89
97
  {@render children?.()}
90
98
  </div>
91
99
 
@@ -100,6 +108,9 @@ A contextual popup that displays a set of actions or options. It appears when us
100
108
  border: 1px solid var(--fs-control-surface-stroke-flyout);
101
109
  background-clip: padding-box;
102
110
  color: var(--fs-text-primary);
111
+ &[hidden] {
112
+ display: none;
113
+ }
103
114
  &.floating {
104
115
  position: absolute;
105
116
  top: 0;
@@ -6,7 +6,7 @@ export type FlyoutProps = {
6
6
  /** The DOM reference of the flyout element.
7
7
  * @bindable
8
8
  */
9
- ref?: HTMLElement;
9
+ ref?: HTMLElement | null;
10
10
  /** The content of the flyout. */
11
11
  children?: Snippet;
12
12
  /** Positions the flyout with floating-ui instead of leaving it in the normal flow.
@@ -27,11 +27,11 @@ Disables the hyperlink and prevents navigation.
27
27
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
28
28
  <!-- props:HyperlinkProps -->
29
29
 
30
- | Name | Type | Default | Description |
31
- | ------------------------ | ------------------- | ------- | ---------------------------------------- |
32
- | `href` | `string` | `'#'` | The URL the hyperlink points to. |
33
- | `disabled` | `boolean` | | Disables the user interaction. |
34
- | `ref` _bindable_ | `HTMLAnchorElement` | | The DOM reference of the anchor element. |
35
- | Element Attributes (`a`) | | | |
30
+ | Name | Type | Default | Description |
31
+ | ------------------------ | --------------------------------- | ------- | ---------------------------------------- |
32
+ | `href` | `string` | `'#'` | The URL the hyperlink points to. |
33
+ | `disabled` | `boolean` | | Disables the user interaction. |
34
+ | `ref` _bindable_ | `HTMLAnchorElement` &#124; `null` | | The DOM reference of the anchor element. |
35
+ | Element Attributes (`a`) | | | |
36
36
 
37
37
  <!-- /props:HyperlinkProps -->
@@ -1,7 +1,16 @@
1
1
  <script lang="ts">
2
+ import { invokeHandlers } from '../../internal/index.js';
2
3
  import type { HyperlinkProps } from './types.js';
3
4
 
4
- let { href = '#', disabled, class: classes, children, ref = $bindable(), ...attributes }: HyperlinkProps = $props();
5
+ let {
6
+ href = '#',
7
+ disabled,
8
+ onclick,
9
+ class: classes,
10
+ children,
11
+ ref = $bindable(null),
12
+ ...attributes
13
+ }: HyperlinkProps = $props();
5
14
  </script>
6
15
 
7
16
  <!--
@@ -19,14 +28,14 @@ F
19
28
  ```
20
29
  -->
21
30
  <a
31
+ {...attributes}
22
32
  // eslint-disable-next-line svelte/no-navigation-without-resolve
23
33
  {href}
24
34
  class={['fs-hyperlink', classes, { disabled }]}
25
- tabindex={disabled ? -1 : undefined}
35
+ tabindex={disabled ? -1 : attributes.tabindex}
26
36
  aria-disabled={disabled || undefined}
27
- onclick={disabled ? (e) => e?.preventDefault() : undefined}
37
+ onclick={(e) => invokeHandlers(e, disabled, [onclick])}
28
38
  bind:this={ref}
29
- {...attributes}
30
39
  >
31
40
  {#if children}
32
41
  {@render children()}
@@ -10,5 +10,5 @@ export type HyperlinkProps = {
10
10
  /** The DOM reference of the anchor element.
11
11
  * @bindable
12
12
  */
13
- ref?: HTMLAnchorElement;
13
+ ref?: HTMLAnchorElement | null;
14
14
  } & HTMLAnchorAttributes;
@@ -73,15 +73,16 @@ The hideCloseButton prop allows you to hide the close button in the InfoBar.
73
73
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
74
74
  <!-- props:InfoBarProps -->
75
75
 
76
- | Name | Type | Default | Description |
77
- | -------------------------- | ---------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------- |
78
- | `status` | `'information'` &#124; `'attention'` &#124; `'warning'` &#124; `'critical'` &#124; `'success'` | `'information'` | The severity of the message, which picks the icon and the colors. |
79
- | `style` | `'inline'` &#124; `'multiline'` | `'inline'` | Lays the message out on a single line, or stacked below the title. |
80
- | `title` | `string` | | The title of the InfoBar. |
81
- | `icon` | `Snippet` &#124; `Component` | | Custom icon, rendered instead of the one the `status` would pick on its own. |
82
- | `iconSize` | `number` | `20` | The size of the icon in pixels. |
83
- | `hideCloseButton` | `boolean` | | Removes the button that dismisses the InfoBar. |
84
- | `children` | `Snippet` | | The message of the InfoBar. |
85
- | Element Attributes (`div`) | | | |
76
+ | Name | Type | Default | Description |
77
+ | -------------------------- | ---------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------- |
78
+ | `status` | `'information'` &#124; `'attention'` &#124; `'warning'` &#124; `'critical'` &#124; `'success'` | `'information'` | The severity of the message, which picks the icon and the colors. |
79
+ | `style` | `'inline'` &#124; `'multiline'` | `'inline'` | Lays the message out on a single line, or stacked below the title. |
80
+ | `title` | `string` | | The title of the InfoBar. |
81
+ | `headingLevel` | `1` &#124; `2` &#124; `3` &#124; `4` &#124; `5` &#124; `6` | `3` | The level of the heading that holds the title, to fit the headings of the page around it. |
82
+ | `icon` | `Snippet` &#124; `Component` | | Custom icon, rendered instead of the one the `status` would pick on its own. |
83
+ | `iconSize` | `number` | `20` | The size of the icon in pixels. |
84
+ | `hideCloseButton` | `boolean` | | Removes the button that dismisses the InfoBar. |
85
+ | `children` | `Snippet` | | The message of the InfoBar. |
86
+ | Element Attributes (`div`) | | | |
86
87
 
87
88
  <!-- /props:InfoBarProps -->
@@ -12,6 +12,7 @@
12
12
  let {
13
13
  status = 'information',
14
14
  title,
15
+ headingLevel = 3,
15
16
  icon: Icon,
16
17
  style = 'inline',
17
18
  hideCloseButton,
@@ -55,7 +56,7 @@
55
56
  {/if}
56
57
  </div>
57
58
  <div class="content">
58
- {#if title}<h3>{title}</h3>{/if}
59
+ {#if title}<svelte:element this={`h${headingLevel}`} class="title">{title}</svelte:element>{/if}
59
60
  {@render children?.()}
60
61
  </div>
61
62
  {#if !hideCloseButton}
@@ -120,7 +121,7 @@
120
121
  align-items: center;
121
122
  gap: 0.5rem;
122
123
  width: 100%;
123
- & h3 {
124
+ & .title {
124
125
  font-weight: semibold;
125
126
  font-size: var(--fs-body-font-size);
126
127
  line-height: var(--fs-body-line-height);
@@ -12,6 +12,10 @@ export type InfoBarProps = {
12
12
  style?: 'inline' | 'multiline';
13
13
  /** The title of the InfoBar. */
14
14
  title?: string;
15
+ /** The level of the heading that holds the title, to fit the headings of the page around it.
16
+ * @default 3
17
+ */
18
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
15
19
  /** Custom icon, rendered instead of the one the `status` would pick on its own.
16
20
  * @type Snippet | Component
17
21
  */
@@ -6,12 +6,14 @@ A Label provides an accessible caption for a form control. It supports different
6
6
 
7
7
  ```svelte
8
8
  <script>
9
- import { Label } from 'fluentui-svelte';
9
+ import { Label, TextBox } from 'fluentui-svelte';
10
10
  </script>
11
11
 
12
- <Label label="Email" />
12
+ <Label label="Email"><TextBox /></Label>
13
13
  ```
14
14
 
15
+ The root is a `div` by default; `as="span"` selects a span. The text label and the field are siblings. Label is for the first field inside it, which takes the id of the label when it has none of its own; pass `for` to point the label at another field. Inside a Label, the own text of a Checkbox, RadioButton or ToggleSwitch is not rendered: the Label names the control. `size` and `weight` style only the label text. `class`, other label attributes and `ref` apply to the label; use `wrapperAttributes` and `wrapperRef` for the root.
16
+
15
17
  ## Examples
16
18
 
17
19
  ### Size
@@ -19,9 +21,9 @@ A Label provides an accessible caption for a form control. It supports different
19
21
  Use the `size` prop to control the label text size.
20
22
 
21
23
  ```svelte
22
- <Label size="small" label="Small" />
23
- <Label size="medium" label="Medium" />
24
- <Label size="large" label="Large" />
24
+ <Label size="small" label="Small"><TextBox /></Label>
25
+ <Label size="medium" label="Medium"><TextBox /></Label>
26
+ <Label size="large" label="Large"><TextBox /></Label>
25
27
  ```
26
28
 
27
29
  ### Weight
@@ -29,8 +31,8 @@ Use the `size` prop to control the label text size.
29
31
  Use the `weight` prop to switch between a regular and a semibold label.
30
32
 
31
33
  ```svelte
32
- <Label weight="regular" label="Regular" />
33
- <Label weight="semibold" label="Semibold" />
34
+ <Label weight="regular" label="Regular"><TextBox /></Label>
35
+ <Label weight="semibold" label="Semibold"><TextBox /></Label>
34
36
  ```
35
37
 
36
38
  ### Label Position
@@ -38,10 +40,10 @@ Use the `weight` prop to switch between a regular and a semibold label.
38
40
  Use the `labelPosition` prop to place the label text relative to the wrapped control.
39
41
 
40
42
  ```svelte
41
- <Label labelPosition="before" label="Before" />
42
- <Label labelPosition="after" label="After" />
43
- <Label labelPosition="above" label="Above" />
44
- <Label labelPosition="below" label="Below" />
43
+ <Label labelPosition="before" label="Before"><TextBox /></Label>
44
+ <Label labelPosition="after" label="After"><TextBox /></Label>
45
+ <Label labelPosition="above" label="Above"><TextBox /></Label>
46
+ <Label labelPosition="below" label="Below"><TextBox /></Label>
45
47
  ```
46
48
 
47
49
  ### Required
@@ -49,23 +51,74 @@ Use the `labelPosition` prop to place the label text relative to the wrapped con
49
51
  Pass a `required` object to mark the label as required and render a required indicator.
50
52
 
51
53
  ```svelte
52
- <Label label="Email" required={{ message: 'Required field' }} />
54
+ <Label label="Email" required={{ message: 'Required field' }}><TextBox required /></Label>
55
+ ```
56
+
57
+ ### Tooltip
58
+
59
+ Pass `tooltipContent`, as text, a snippet or a component, to show more about the field in a tooltip from a badge after the label text. The badge is a button named after the label; `tooltipBadge` replaces its info icon, and `tooltipButtonAttributes` its `aria-label`. Keep links and buttons out of the tooltip.
60
+
61
+ ```svelte
62
+ <Label
63
+ label="Bank"
64
+ labelPosition="above"
65
+ required={{ message: 'Required field' }}
66
+ tooltipContent="The bank that holds the account the payments come from."
67
+ >
68
+ <Dropdown placeholder="Bank Name">
69
+ <DropdownOption value="pichincha">Banco Pichincha</DropdownOption>
70
+ <DropdownOption value="guayaquil">Banco Guayaquil</DropdownOption>
71
+ </Dropdown>
72
+ </Label>
73
+ <Label
74
+ label="IBAN"
75
+ labelPosition="above"
76
+ tooltipBadge={QuestionCircleRegular}
77
+ tooltipContent="The international number of the account, as your bank prints it."
78
+ >
79
+ <TextBox placeholder="EC00 0000 0000 0000" />
80
+ </Label>
53
81
  ```
54
82
 
83
+ ### Other form controls
84
+
85
+ ```svelte
86
+ <Label label="Accept terms"><Checkbox /></Label>
87
+ <Label label="Email updates"><ToggleSwitch /></Label>
88
+ <Label label="Standard plan"><RadioButton name="plan" value="standard" /></Label>
89
+ <Label label="Country">
90
+ <Dropdown><DropdownOption value="bo">Bolivia</DropdownOption></Dropdown>
91
+ </Label>
92
+ ```
93
+
94
+ Label renders its text and field as siblings, and is for the first field inside it, which takes the id of the label when it has none of its own. Pass for to point the label at another field. HTML attributes, class and ref apply to the label text element; wrapperAttributes and wrapperRef apply to the container. Size and weight affect only the label text.
95
+
96
+ A control inside Label needs no id or for. The own text of a Checkbox, RadioButton or ToggleSwitch inside it is not rendered: the Label names the control. A native `<label for>` outside a Label names a picker (Dropdown, TagPicker, DatePicker, TimePicker, CalendarDatePicker) only once the page hydrates, because the picker reads it from the page: when rendering on the server, use Label or pass `aria-labelledby`. A field with an id of its own keeps it: when the text comes before the field (`labelPosition` `'before'` or `'above'`, the default), pass that id to `for` too, or the label the server writes points at no field until the page hydrates.
97
+
55
98
  ## Component Props
56
99
 
57
100
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
58
101
  <!-- props:LabelProps -->
59
102
 
60
- | Name | Type | Default | Description |
61
- | ---------------------------- | ------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------- |
62
- | `label` | `string` | `'Label Element'` | The text of the label. Falls back to the rendered children. |
63
- | `size` | `'small'` &#124; `'medium'` &#124; `'large'` | `'medium'` | The size of the label text. |
64
- | `weight` | `'regular'` &#124; `'semibold'` | `'regular'` | The weight of the label text. |
65
- | `labelPosition` | `'before'` &#124; `'after'` &#124; `'above'` &#124; `'below'` | `'after'` | Where the label sits relative to the field it describes. |
66
- | `required` | `{ abbr?: string; message: string; }` | | Marks the field as required, and describes why through the given message. |
67
- | `disabled` | `boolean` | | Renders the label as disabled, to match the field it describes. |
68
- | `ref` _bindable_ | `HTMLLabelElement` | | The DOM reference of the label element. |
69
- | Element Attributes (`label`) | | | |
103
+ | Name | Type | Default | Description |
104
+ | ----------------------------------- | ------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
+ | `as` | `'div'` &#124; `'span'` | `'div'` | The element used to wrap the label and its field. |
106
+ | `children` | `Snippet` | | The field described by the label, rendered beside the label text. |
107
+ | `wrapperRef` _bindable_ | `HTMLDivElement` &#124; `HTMLSpanElement` | | The DOM reference of the wrapper element. |
108
+ | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
109
+ | `label` | `string` | `'Label Element'` | The text of the label. |
110
+ | `size` | `'small'` &#124; `'medium'` &#124; `'large'` | `'medium'` | The size of the label text. |
111
+ | `weight` | `'regular'` &#124; `'semibold'` | `'regular'` | The weight of the label text. |
112
+ | `labelPosition` | `'before'` &#124; `'after'` &#124; `'above'` &#124; `'below'` | `'after'` | Where the label sits relative to the field it describes. |
113
+ | `required` | `{ abbr?: string; message: string; }` | | Marks the field as required, and describes why through the given message. |
114
+ | `disabled` | `boolean` | | Renders the label as disabled, to match the field it describes. |
115
+ | `ref` _bindable_ | `HTMLLabelElement` &#124; `null` | | The DOM reference of the label element. |
116
+ | `id` | `string` | `Generated` | The id of the label element. A control inside the label is named after it, including a picker whose visible control stands in for its native field. |
117
+ | `for` | `string` | `The field inside` | The id of the field the label is for. Without it, the label is for the first field inside it, which takes a generated id when it has none of its own. With `labelPosition` `before` or `above` and a field that has an id of its own, pass that id here, so the server renders the association too. |
118
+ | `tooltipContent` | `string` &#124; `Snippet` &#124; `Component` | | More about the field, in a tooltip shown from a badge after the label text, on hover and on focus. People cannot move into a tooltip, so keep links and buttons out of it. |
119
+ | `tooltipBadge` | `Snippet` &#124; `Component` | `InfoRegular` | What the badge that shows the tooltip displays. Only rendered with `tooltipContent`. |
120
+ | `tooltipProps` | `TooltipProps` | | The props to spread on the tooltip. |
121
+ | `tooltipButtonAttributes` | `HTMLButtonAttributes` | | The attributes to spread on the button of the badge. Its name is the label text followed by its `aria-label`. |
122
+ | `HTMLLabelAttributes` without `for` | | | |
70
123
 
71
124
  <!-- /props:LabelProps -->
@@ -0,0 +1,14 @@
1
+ export type LabelContext = {
2
+ /** The id of the label text, which names a visible control that stands in for a native field. */
3
+ readonly labelId: string;
4
+ /** The id the label is for: a field with no id of its own takes it. */
5
+ readonly fieldId: string;
6
+ /** Makes a field, through the id it reports, the one the label is for. Only the first field to ask gets it. */
7
+ claim: (id: () => string | null | undefined) => boolean;
8
+ };
9
+ export declare const getLabelContext: () => LabelContext | null, setLabelContext: (context: LabelContext) => void;
10
+ /**
11
+ * The Label a field is inside, when the field is the first one there to claim it: the label is then
12
+ * for that field. Outside a Label, and for any later field, it is `null`, and the field works on its own.
13
+ */
14
+ export declare function claimLabel(id: () => string | null | undefined): Omit<LabelContext, 'claim'> | null;
@@ -0,0 +1,10 @@
1
+ import { createFSContext } from '../../internal/index.js';
2
+ export const [getLabelContext, setLabelContext] = createFSContext();
3
+ /**
4
+ * The Label a field is inside, when the field is the first one there to claim it: the label is then
5
+ * for that field. Outside a Label, and for any later field, it is `null`, and the field works on its own.
6
+ */
7
+ export function claimLabel(id) {
8
+ const label = getLabelContext();
9
+ return label?.claim(id) ? label : null;
10
+ }