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
@@ -45,6 +45,40 @@ The Dialog is composed of several components that work together through a shared
45
45
 
46
46
  ## Examples
47
47
 
48
+ ### Position
49
+
50
+ Set `position` on `Dialog` to combine `top`, `middle`, or `bottom` with `start`, `center`, or `end`, for example `top-end` or `bottom-start`. The default is `middle-center`.
51
+
52
+ Start and end follow the text direction, so `top-start` sits on the right in RTL. All positions keep a 1rem gap from viewport edges and work with modal, non-modal, and alert dialogs. Changing `position` moves an open dialog without closing it.
53
+
54
+ ```svelte
55
+ <Dialog position="top-end">
56
+ <DialogTrigger>Open Dialog</DialogTrigger>
57
+ <DialogSurface>
58
+ <DialogTitle>Dialog Title</DialogTitle>
59
+ <DialogContent>Dialog body content.</DialogContent>
60
+ </DialogSurface>
61
+ </Dialog>
62
+ ```
63
+
64
+ ### Entrance and Exit Motion
65
+
66
+ `animation` selects `fade`, `zoom`, `slide`, or `bounce` for both directions. The default is `zoom`. Zoom enters from 88% scale and exits to 90%; slide travels 16px, from above for top positions and below otherwise. Bounce uses a small scale overshoot with Fluent's strong-invoke curve.
67
+
68
+ `duration` defaults to `normal`. Theme names are `fast`, `normal`, `slow`, `slower`, `very-slow`, and `extra-slow`, matching `--fs-<name>-duration`. A CSS custom property name such as `--fs-fast-duration` is also accepted. Numbers are milliseconds; `0` disables motion.
69
+
70
+ ```svelte
71
+ <Dialog animation="slide" duration={200} position="bottom-end">
72
+ <DialogTrigger>Open Dialog</DialogTrigger>
73
+ <DialogSurface>
74
+ <DialogTitle>Dialog Title</DialogTitle>
75
+ <DialogContent>Dialog body content.</DialogContent>
76
+ </DialogSurface>
77
+ </Dialog>
78
+ ```
79
+
80
+ Motion is implemented with CSS `@starting-style` and discrete `display`/`overlay` transitions. Calling `closeDialog()` updates `open` and releases native modal focus immediately; CSS keeps the surface and backdrop painted until the exit ends. Browsers without these CSS features open and close immediately. The OS reduced-motion preference and FluentUISvelte's app preference disable motion, including numeric durations; an explicit app preference takes priority over the OS.
81
+
48
82
  ### With Actions
49
83
 
50
84
  Add a `DialogActions` region to render action buttons in the dialog footer. Use `bind:this` on the `Dialog` to call `closeDialog()` programmatically.
@@ -83,12 +117,15 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
83
117
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
84
118
  <!-- props:DialogProps -->
85
119
 
86
- | Name | Type | Default | Description |
87
- | ----------------- | ----------------------------------------------- | --------- | ------------------------------------------------- |
88
- | `type` | `'modal'` &#124; `'non-modal'` &#124; `'alert'` | `'modal'` | How the dialog behaves once open. |
89
- | `open` _bindable_ | `boolean` | | Controls the open state of the dialog. |
90
- | `onOpenChange` | `(open: boolean) => void` | | Called whenever the dialog opens or closes. |
91
- | `children` | `Snippet` | | The parts of the dialog: a trigger and a surface. |
120
+ | Name | Type | Default | Description |
121
+ | ----------------- | -------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------- |
122
+ | `type` | `'modal'` &#124; `'non-modal'` &#124; `'alert'` | `'modal'` | How the dialog behaves once open. |
123
+ | `position` | [`DialogPosition`](https://fluentui-svelte.dev/docs/types/#dialogposition) | `'middle-center'` | Where the dialog sits in the viewport. Start and end follow the text direction. |
124
+ | `animation` | `'fade'` &#124; `'zoom'` &#124; `'slide'` &#124; `'bounce'` | `'zoom'` | The entrance and exit animation. Bounce uses a subtle overshoot. |
125
+ | `duration` | [`DialogDuration`](https://fluentui-svelte.dev/docs/types/#dialogduration) | `'normal'` | Duration in milliseconds, a theme duration name, or a CSS custom property name. Use 0 for no motion. |
126
+ | `open` _bindable_ | `boolean` &#124; `null` | | Controls the open state of the dialog. |
127
+ | `onOpenChange` | `(open: boolean) => void` | | Called whenever the dialog opens or closes. |
128
+ | `children` | `Snippet` | | The parts of the dialog: a trigger and a surface. |
92
129
 
93
130
  <!-- /props:DialogProps -->
94
131
 
@@ -97,10 +134,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
97
134
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
98
135
  <!-- props:DialogTriggerProps -->
99
136
 
100
- | Name | Type | Default | Description |
101
- | ----------------------- | ------------------- | ------- | ----------------------------------------- |
102
- | `ref` | `HTMLButtonElement` | | The DOM reference of the trigger element. |
103
- | `ButtonProps<'button'>` | | | |
137
+ | Name | Type | Default | Description |
138
+ | ----------------------- | --------------------------------- | ------- | ----------------------------------------- |
139
+ | `ref` _bindable_ | `HTMLButtonElement` &#124; `null` | | The DOM reference of the trigger element. |
140
+ | `ButtonProps<'button'>` | | | |
104
141
 
105
142
  <!-- /props:DialogTriggerProps -->
106
143
 
@@ -109,10 +146,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
109
146
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
110
147
  <!-- props:DialogSurfaceProps -->
111
148
 
112
- | Name | Type | Default | Description |
113
- | ----------------------------- | ------------------- | ------- | ---------------------------------------- |
114
- | `ref` _bindable_ | `HTMLDialogElement` | | The DOM reference of the dialog element. |
115
- | Element Attributes (`dialog`) | | | |
149
+ | Name | Type | Default | Description |
150
+ | ----------------------------- | --------------------------------- | ------- | ---------------------------------------- |
151
+ | `ref` _bindable_ | `HTMLDialogElement` &#124; `null` | | The DOM reference of the dialog element. |
152
+ | Element Attributes (`dialog`) | | | |
116
153
 
117
154
  <!-- /props:DialogSurfaceProps -->
118
155
 
@@ -134,10 +171,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
134
171
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
135
172
  <!-- props:DialogContentProps -->
136
173
 
137
- | Name | Type | Default | Description |
138
- | -------------------------- | ---------------- | ------- | ----------------------------------------- |
139
- | `ref` | `HTMLDivElement` | | The DOM reference of the content element. |
140
- | Element Attributes (`div`) | | | |
174
+ | Name | Type | Default | Description |
175
+ | -------------------------- | ------------------------------ | ------- | ----------------------------------------- |
176
+ | `ref` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the content element. |
177
+ | Element Attributes (`div`) | | | |
141
178
 
142
179
  <!-- /props:DialogContentProps -->
143
180
 
@@ -148,7 +185,7 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
148
185
 
149
186
  | Name | Type | Default | Description |
150
187
  | -------------------------- | ------------------------------------------ | ------- | ----------------------------------------------------------- |
151
- | `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the actions element. |
188
+ | `ref` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the actions element. |
152
189
  | `fluid` | `boolean` | | Stretches every action to share the available width evenly. |
153
190
  | `position` | `'start'` &#124; `'center'` &#124; `'end'` | `'end'` | Where the actions sit along the main axis. |
154
191
  | Element Attributes (`div`) | | | |
@@ -4,6 +4,9 @@ import type { HTMLAttributes } from 'svelte/elements';
4
4
  import type { ButtonProps } from '../button/types.ts';
5
5
  import type { PolymorphicProps, XDirection } from '../../types/index.js';
6
6
  export type DialogType = 'modal' | 'non-modal' | 'alert';
7
+ export type DialogAnimation = 'fade' | 'zoom' | 'slide' | 'bounce';
8
+ export type DialogDuration = number | 'fast' | 'normal' | 'slow' | 'slower' | 'very-slow' | 'extra-slow' | `--${string}`;
9
+ export type DialogPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
7
10
  export type DialogTitleTag = 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
8
11
  /** @propsmith DialogProps */
9
12
  export type DialogProps = {
@@ -17,10 +20,22 @@ export type DialogProps = {
17
20
  * @default 'modal'
18
21
  */
19
22
  type?: DialogType;
23
+ /** Where the dialog sits in the viewport. Start and end follow the text direction.
24
+ * @default 'middle-center'
25
+ */
26
+ position?: DialogPosition;
27
+ /** The entrance and exit animation. Bounce uses a subtle overshoot.
28
+ * @default 'zoom'
29
+ */
30
+ animation?: DialogAnimation;
31
+ /** Duration in milliseconds, a theme duration name, or a CSS custom property name. Use 0 for no motion.
32
+ * @default 'normal'
33
+ */
34
+ duration?: DialogDuration;
20
35
  /** Controls the open state of the dialog.
21
36
  * @bindable
22
37
  */
23
- open?: boolean;
38
+ open?: boolean | null;
24
39
  /** Called whenever the dialog opens or closes. */
25
40
  onOpenChange?: (open: boolean) => void;
26
41
  /** The parts of the dialog: a trigger and a surface. */
@@ -31,24 +46,28 @@ export type DialogSurfaceProps = {
31
46
  /** The DOM reference of the dialog element.
32
47
  * @bindable
33
48
  */
34
- ref?: HTMLDialogElement;
49
+ ref?: HTMLDialogElement | null;
35
50
  } & HTMLAttributes<HTMLDialogElement>;
36
51
  /** @propsmith DialogTriggerProps */
37
52
  export type DialogTriggerProps = {
38
- /** The DOM reference of the trigger element. */
39
- ref?: HTMLButtonElement;
53
+ /** The DOM reference of the trigger element.
54
+ * @bindable
55
+ */
56
+ ref?: HTMLButtonElement | null;
40
57
  } & ButtonProps<'button'>;
41
58
  /** @propsmith DialogContentProps */
42
59
  export type DialogContentProps = {
43
- /** The DOM reference of the content element. */
44
- ref?: HTMLDivElement;
60
+ /** The DOM reference of the content element.
61
+ * @bindable
62
+ */
63
+ ref?: HTMLDivElement | null;
45
64
  } & HTMLAttributes<HTMLDivElement>;
46
65
  /** @propsmith DialogActionsProps */
47
66
  export type DialogActionsProps = {
48
67
  /** The DOM reference of the actions element.
49
68
  * @bindable
50
69
  */
51
- ref?: HTMLDivElement;
70
+ ref?: HTMLDivElement | null;
52
71
  /** Stretches every action to share the available width evenly. */
53
72
  fluid?: boolean;
54
73
  /** Where the actions sit along the main axis.
@@ -71,7 +90,7 @@ export type DialogTitleProps<T extends DialogTitleTag> = {
71
90
  * @type HTMLDivElement | HTMLHeadingElement
72
91
  * @bindable
73
92
  */
74
- ref?: DialogTitleRefType[T];
93
+ ref?: DialogTitleRefType[T] | null;
75
94
  /** The HTML element to render the title as.
76
95
  * @type DialogTitleTag
77
96
  * @default 'h3'
@@ -80,9 +99,12 @@ export type DialogTitleProps<T extends DialogTitleTag> = {
80
99
  } & PolymorphicProps<T>;
81
100
  export type DialogContext = FSContext<{
82
101
  type: DialogType;
102
+ position: DialogPosition;
103
+ animation: DialogAnimation;
104
+ duration: DialogDuration;
83
105
  }, {
84
106
  dialogRef: HTMLDialogElement | undefined;
85
- readonly open: boolean | undefined;
107
+ readonly open: boolean | null | undefined;
86
108
  /** Set by `DialogTitle`, to allow the surface pointing `aria-labelledby` at it. */
87
109
  titleId: string | undefined;
88
110
  }, null, {
@@ -0,0 +1,2 @@
1
+ import type { DialogTitleTag } from './types.ts';
2
+ export declare const TITLE_TAG: DialogTitleTag[];
@@ -0,0 +1 @@
1
+ export const TITLE_TAG = ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -3,12 +3,14 @@
3
3
 
4
4
  let {
5
5
  as = 'div' as Tag,
6
- ref = $bindable(),
6
+ ref = $bindable(null),
7
7
  vertical,
8
8
  alignContent = 'center',
9
9
  appearance = 'default',
10
10
  inset,
11
11
  children,
12
+ class: classes,
13
+ style,
12
14
  ...attributes
13
15
  }: DividerProps<Tag> = $props();
14
16
  </script>
@@ -30,12 +32,12 @@
30
32
  -->
31
33
  <svelte:element
32
34
  this={as}
35
+ {...attributes}
33
36
  bind:this={ref}
34
37
  role="separator"
35
- class={['fs-divider', appearance, `align-${alignContent}`, { inset, vertical }]}
36
- style=" --divider-margin: {children ? (vertical ? '0.5rem' : '0.75rem') : '0'}"
38
+ class={['fs-divider', appearance, `align-${alignContent}`, { inset, vertical }, classes]}
39
+ style="{style ?? ''}; --divider-margin: {children ? (vertical ? '0.5rem' : '0.75rem') : '0'}"
37
40
  aria-orientation={vertical ? 'vertical' : 'horizontal'}
38
- {...attributes}
39
41
  >
40
42
  {@render children?.()}
41
43
  </svelte:element>
@@ -10,7 +10,7 @@ export type DividerProps<Tag extends DividerGenerics = 'div'> = {
10
10
  * @type HTMLDivElement | HTMLHRElement | HTMLSpanElement
11
11
  * @bindable
12
12
  */
13
- ref?: DividerElement[Tag];
13
+ ref?: DividerElement[Tag] | null;
14
14
  /** Renders the divider vertically instead of horizontally. */
15
15
  vertical?: boolean;
16
16
  /** Where the content of the divider sits along the line.
@@ -9,7 +9,7 @@ The Dropdown lets users select one or more options from a list of `DropdownOptio
9
9
  import { Dropdown, DropdownOption } from 'fluentui-svelte';
10
10
  </script>
11
11
 
12
- <Dropdown>
12
+ <Dropdown aria-label="Choose an option">
13
13
  <DropdownOption value="A" text="Option A">Option A</DropdownOption>
14
14
  <DropdownOption value="B" text="Option B">Option B</DropdownOption>
15
15
  </Dropdown>
@@ -22,13 +22,13 @@ The Dropdown lets users select one or more options from a list of `DropdownOptio
22
22
  Options can render any content, such as a `Persona`. Pass a `text` prop so the closed dropdown can still display the selection.
23
23
 
24
24
  ```svelte
25
- <Dropdown>
25
+ <Dropdown aria-label="Choose an option">
26
26
  <DropdownOption value="John Doe" text="John Doe">
27
27
  <Persona
28
28
  name="John Doe"
29
29
  primaryText="Software Engineer"
30
30
  presence={{ status: 'available' }}
31
- avatar={{ color: 'colorful', idForColor: '' }}
31
+ avatarProps={{ color: 'colorful', idForColor: '' }}
32
32
  />
33
33
  </DropdownOption>
34
34
  <DropdownOption value="B" text="Option B">Option B</DropdownOption>
@@ -41,38 +41,40 @@ Options can render any content, such as a `Persona`. Pass a `text` prop so the c
41
41
  Set the `multiple` prop to allow selecting more than one option.
42
42
 
43
43
  ```svelte
44
- <Dropdown multiple>
44
+ <Dropdown multiple aria-label="Choose options">
45
45
  <DropdownOption value="A" text="Option A">Option A</DropdownOption>
46
46
  <DropdownOption value="B" text="Option B">Option B</DropdownOption>
47
47
  <DropdownOption value="C" text="Option C">Option C</DropdownOption>
48
48
  </Dropdown>
49
49
  ```
50
50
 
51
+ 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.
52
+
51
53
  ## Component Props
52
54
 
53
55
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
54
56
  <!-- props:DropdownProps -->
55
57
 
56
- | Name | Type | Default | Description |
57
- | ---------------------------------------------------- | -------------------------- | -------------------- | ----------------------------------------------------------------------- |
58
- | `value` _bindable_ | `string` &#124; `string[]` | `multiple ? [] : ''` | The selected value. An array of values when `multiple` is set. |
59
- | `multiple` | `boolean` | | Allows more than one option to be selected at a time. |
60
- | `placeholder` | `string` | `'Select an option'` | The text shown by the trigger while no option is selected. |
61
- | `disabled` | `boolean` | | Disables the user interaction. |
62
- | `name` | `string` &#124; `null` | `id` | The name submitted with the form. Falls back to the id of the dropdown. |
63
- | `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the dropdown element. |
64
- | `onclick` | `(e: MouseEvent) => void` | | Called when the dropdown is clicked. |
65
- | `wrapperProps` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
66
- | `buttonRef` _bindable_ | `HTMLButtonElement` | | The DOM reference of the button that opens the dropdown. |
67
- | `buttonProps` | `HTMLButtonAttributes` | | The attributes to spread on the button that opens the dropdown. |
68
- | `inputRef` | `HTMLInputElement` | | The DOM reference of the hidden input holding the value. |
69
- | `flyoutRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the flyout element. |
70
- | `flyoutProps` | `FlyoutProps` | | The props to spread on the flyout. |
71
- | `flyoutMaxHeight` | `string` | | The maximum height of the flyout, as a CSS length. |
72
- | `listboxRef` _bindable_ | `HTMLUListElement` | | The DOM reference of the listbox element. |
73
- | `listboxProps` | `ListViewProps` | | The props to spread on the listbox rendered inside the flyout. |
74
- | `DropdownMultipleValue` &#124; `DropdownSingleValue` | | | |
75
- | `HTMLInputAttributes` without `value`, `onclick` | | | |
58
+ | Name | Type | Default | Description |
59
+ | ---------------------------------------------------- | --------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------- |
60
+ | `value` _bindable_ | `string` &#124; `string[]` | `multiple ? [] : ''` | The selected value. An array of values when `multiple` is set. |
61
+ | `multiple` | `boolean` | | Allows more than one option to be selected at a time. |
62
+ | `placeholder` | `string` | `'Select an option'` | The text shown by the trigger while no option is selected. |
63
+ | `disabled` | `boolean` | | Disables the user interaction. |
64
+ | `name` | `string` &#124; `null` | | The name the value is submitted under. Without one, the form leaves the value out, as with any field. |
65
+ | `wrapperRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the wrapper element. |
66
+ | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
67
+ | `ref` _bindable_ | `HTMLSelectElement` &#124; `null` | | The DOM reference of the native select that holds the value. The other attributes of the dropdown are applied to it. |
68
+ | `buttonRef` _bindable_ | `HTMLButtonElement` &#124; `null` | | The DOM reference of the button that opens the dropdown. |
69
+ | `buttonAttributes` | `HTMLButtonAttributes` | | The attributes to spread on the button that opens the dropdown. |
70
+ | `flyoutRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the flyout element. |
71
+ | `flyoutProps` | `FlyoutProps` | | The props to spread on the flyout. |
72
+ | `flyoutMaxHeight` | `string` | | The maximum height of the flyout, as a CSS length. |
73
+ | `listboxRef` _bindable_ | `HTMLUListElement` &#124; `null` | | The DOM reference of the listbox element. |
74
+ | `listboxProps` | `ListViewProps` | | The props to spread on the listbox rendered inside the flyout. |
75
+ | `children` | `Snippet` | | The `DropdownOption` elements of the list. |
76
+ | `DropdownMultipleValue` &#124; `DropdownSingleValue` | | | |
77
+ | `NativeFieldAttributes<HTMLSelectAttributes>` | | | |
76
78
 
77
79
  <!-- /props:DropdownProps -->
78
80
 
@@ -81,9 +83,9 @@ Set the `multiple` prop to allow selecting more than one option.
81
83
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
82
84
  <!-- props:DropdownOptionProps -->
83
85
 
84
- | Name | Type | Default | Description |
85
- | ------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
86
- | `text` | `string` | | The text shown by the dropdown once the option is selected. Falls back to the rendered children. |
87
- | `ListViewItemProps<'li'>` | | | |
86
+ | Name | Type | Default | Description |
87
+ | ------------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | `text` | `string` | | The text shown by the dropdown once the option is selected. Falls back to the rendered children, which the server cannot read: pass it when rendering on the server. |
89
+ | `ListViewItemProps<'li'>` | | | |
88
90
 
89
91
  <!-- /props:DropdownOptionProps -->
@@ -8,17 +8,29 @@
8
8
  const FALLBACK_ID = $props.id();
9
9
  const ID = `${PREFIX}-dropdown-option-${FALLBACK_ID}`;
10
10
 
11
- let { value, text, disabled, id = ID, ref = $bindable(), children }: DropdownOptionProps = $props();
11
+ let { value, text, disabled, id = ID, ref = $bindable(null), children }: DropdownOptionProps = $props();
12
12
 
13
13
  const context = getDropdownContext();
14
14
 
15
15
  if (!context) throw new Error('DropdownOption must be used within a Dropdown');
16
16
 
17
- // Report the option's label so the trigger can show text instead of the raw value.
17
+ /** The rendered content, which stands in for a missing `text` once there is a page to read it from. */
18
+ let rendered = $state<string>();
19
+
20
+ // Report the option's label and the trigger can show text instead of the raw value. It is reported
21
+ // as the option is created, ahead of the trigger, so the server writes it too.
22
+ const withdraw = context.methods?.registerOption({
23
+ get value() {
24
+ return value;
25
+ },
26
+ get text() {
27
+ return text ?? rendered;
28
+ }
29
+ });
30
+
18
31
  onMount(() => {
19
- if (value == null) return;
20
- const label = text ?? (ref?.textContent?.trim() || String(value));
21
- context.methods?.registerOption(String(value), label);
32
+ rendered = ref?.textContent?.trim() || undefined;
33
+ return withdraw;
22
34
  });
23
35
  </script>
24
36