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
@@ -2,7 +2,7 @@
2
2
  import ChevronRightRegular from 'fluentui-icons-svelte/ChevronRightRegular.svelte';
3
3
  import type { BreadcrumbDividerProps } from './types.js';
4
4
 
5
- let { ref = $bindable(), class: classes, children, ...attributes }: BreadcrumbDividerProps = $props();
5
+ let { ref = $bindable(null), class: classes, children, ...attributes }: BreadcrumbDividerProps = $props();
6
6
  </script>
7
7
 
8
8
  <!--
@@ -16,7 +16,7 @@
16
16
  <BreadcrumbDivider />
17
17
  ```
18
18
  -->
19
- <li bind:this={ref} aria-hidden="true" class={['fs-breadcrumb-divider', classes]} {...attributes}>
19
+ <li {...attributes} bind:this={ref} aria-hidden="true" class={['fs-breadcrumb-divider', classes]}>
20
20
  {#if children}
21
21
  {@render children()}
22
22
  {:else}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { BreadcrumbItemProps } from './types.js';
3
3
 
4
- let { ref = $bindable(), class: classes, children, ...attributes }: BreadcrumbItemProps = $props();
4
+ let { ref = $bindable(null), class: classes, children, ...attributes }: BreadcrumbItemProps = $props();
5
5
  </script>
6
6
 
7
7
  <!--
@@ -17,7 +17,7 @@
17
17
  </BreadcrumbItem>
18
18
  ```
19
19
  -->
20
- <li bind:this={ref} class={['fs-breadcrumb-item', classes]} {...attributes}>
20
+ <li {...attributes} bind:this={ref} class={['fs-breadcrumb-item', classes]}>
21
21
  {@render children?.()}
22
22
  </li>
23
23
 
@@ -6,9 +6,9 @@
6
6
  const TABSPOT_ITEMS = '.fs-breadcrumb-button';
7
7
 
8
8
  let {
9
- ref = $bindable(),
10
- listRef = $bindable(),
11
- listProps,
9
+ ref = $bindable(null),
10
+ listRef = $bindable(null),
11
+ listAttributes,
12
12
  size = 'medium',
13
13
  focusMode = 'tab',
14
14
  'aria-label': ariaLabel,
@@ -50,13 +50,18 @@
50
50
  ```
51
51
  -->
52
52
  <nav
53
+ {...attributes}
53
54
  bind:this={ref}
54
55
  aria-label={ariaLabelledby ? undefined : (ariaLabel ?? 'Breadcrumb')}
55
56
  aria-labelledby={ariaLabelledby}
56
57
  class={['fs-breadcrumb', size, classes]}
57
- {...attributes}
58
58
  >
59
- <ol bind:this={listRef} class="fs-breadcrumb-list" {...tabspotAttributes} {...listProps}>
59
+ <ol
60
+ {...listAttributes}
61
+ bind:this={listRef}
62
+ class={['fs-breadcrumb-list', listAttributes?.class]}
63
+ {...tabspotAttributes}
64
+ >
60
65
  {@render children?.()}
61
66
  </ol>
62
67
  </nav>
@@ -133,9 +133,9 @@ The label on the menu button is yours to write, and it is worth writing: a trigg
133
133
 
134
134
  | Name | Type | Default | Description |
135
135
  | -------------------- | -------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
136
- | `ref` _bindable_ | `HTMLElement` | | The DOM reference of the `nav`. |
137
- | `listRef` _bindable_ | `HTMLOListElement` | | The DOM reference of the list. |
138
- | `listProps` | `HTMLOlAttributes` | | The props to spread on the list element. |
136
+ | `ref` _bindable_ | `HTMLElement` &#124; `null` | | The DOM reference of the `nav`. |
137
+ | `listRef` _bindable_ | `HTMLOListElement` &#124; `null` | | The DOM reference of the list. |
138
+ | `listAttributes` | `HTMLOlAttributes` | | The attributes to spread on the list element. |
139
139
  | `size` | `'small'` &#124; `'medium'` &#124; `'large'` | `'medium'` | The size of every step and divider of the trail. |
140
140
  | `focusMode` | `'tab'` &#124; `'arrow'` | `'tab'` | How the focus walks the trail: `tab` leaves every step its own tab stop, `arrow` gives the trail a single one and moves between steps with the arrow keys. |
141
141
  | Element Attributes | | | |
@@ -147,10 +147,10 @@ The label on the menu button is yours to write, and it is worth writing: a trigg
147
147
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
148
148
  <!-- props:BreadcrumbItemProps -->
149
149
 
150
- | Name | Type | Default | Description |
151
- | ------------------------- | --------------- | ------- | ------------------------------ |
152
- | `ref` _bindable_ | `HTMLLIElement` | | The DOM reference of the item. |
153
- | Element Attributes (`li`) | | | |
150
+ | Name | Type | Default | Description |
151
+ | ------------------------- | ----------------------------- | ------- | ------------------------------ |
152
+ | `ref` _bindable_ | `HTMLLIElement` &#124; `null` | | The DOM reference of the item. |
153
+ | Element Attributes (`li`) | | | |
154
154
 
155
155
  <!-- /props:BreadcrumbItemProps -->
156
156
 
@@ -177,10 +177,10 @@ The label on the menu button is yours to write, and it is worth writing: a trigg
177
177
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
178
178
  <!-- props:BreadcrumbDividerProps -->
179
179
 
180
- | Name | Type | Default | Description |
181
- | ------------------------- | --------------- | ------- | --------------------------------- |
182
- | `ref` _bindable_ | `HTMLLIElement` | | The DOM reference of the divider. |
183
- | Element Attributes (`li`) | | | |
180
+ | Name | Type | Default | Description |
181
+ | ------------------------- | ----------------------------- | ------- | --------------------------------- |
182
+ | `ref` _bindable_ | `HTMLLIElement` &#124; `null` | | The DOM reference of the divider. |
183
+ | Element Attributes (`li`) | | | |
184
184
 
185
185
  <!-- /props:BreadcrumbDividerProps -->
186
186
 
@@ -13,15 +13,15 @@ export type BreadcrumbProps = {
13
13
  /** The DOM reference of the `nav`.
14
14
  * @bindable
15
15
  */
16
- ref?: HTMLElement;
16
+ ref?: HTMLElement | null;
17
17
  /** The DOM reference of the list.
18
18
  * @bindable
19
19
  */
20
- listRef?: HTMLOListElement;
21
- /** The props to spread on the list element.
20
+ listRef?: HTMLOListElement | null;
21
+ /** The attributes to spread on the list element.
22
22
  * @type HTMLOlAttributes
23
23
  */
24
- listProps?: HTMLOlAttributes;
24
+ listAttributes?: HTMLOlAttributes;
25
25
  /** The size of every step and divider of the trail.
26
26
  * @default 'medium'
27
27
  */
@@ -37,7 +37,7 @@ export type BreadcrumbItemProps = {
37
37
  /** The DOM reference of the item.
38
38
  * @bindable
39
39
  */
40
- ref?: HTMLLIElement;
40
+ ref?: HTMLLIElement | null;
41
41
  } & HTMLAttributes<HTMLLIElement>;
42
42
  /** @propsmith BreadcrumbButtonProps */
43
43
  export type BreadcrumbButtonProps<T extends BreadcrumbItemGenerics = 'button'> = {
@@ -45,7 +45,7 @@ export type BreadcrumbButtonProps<T extends BreadcrumbItemGenerics = 'button'> =
45
45
  * @type BreadcrumbItemElementDOMType[T]
46
46
  * @bindable
47
47
  */
48
- ref?: BreadcrumbItemElementDOMType[T];
48
+ ref?: BreadcrumbItemElementDOMType[T] | null;
49
49
  /** The DOM element to render. A step that goes somewhere is an anchor and takes `href`.
50
50
  * @type 'button' | 'a'
51
51
  * @default 'button'
@@ -76,5 +76,5 @@ export type BreadcrumbDividerProps = {
76
76
  /** The DOM reference of the divider.
77
77
  * @bindable
78
78
  */
79
- ref?: HTMLLIElement;
79
+ ref?: HTMLLIElement | null;
80
80
  } & HTMLAttributes<HTMLLIElement>;
@@ -9,7 +9,7 @@
9
9
  class: classes,
10
10
  shape = 'rounded',
11
11
  disabled,
12
- ref = $bindable(),
12
+ ref = $bindable(null),
13
13
  onclick,
14
14
  onkeydown,
15
15
  isMenuButton,
@@ -49,6 +49,7 @@
49
49
  -->
50
50
  <svelte:element
51
51
  this={_as}
52
+ {...attributes}
52
53
  bind:this={ref}
53
54
  disabled={disabled && as !== 'div' ? true : undefined}
54
55
  aria-disabled={disabled && as !== 'div' ? true : undefined}
@@ -56,7 +57,6 @@
56
57
  tabindex={_tabIndex ?? (as !== 'div' && (disabledFocusable || disabled) ? -1 : undefined)}
57
58
  onclick={(e: MouseEvent) => invokeHandlers(e, [as === 'div', disabled], [onclick])}
58
59
  onkeydown={(e: KeyboardEvent) => invokeHandlers(e, [as === 'div', disabled], [onkeydown])}
59
- {...attributes}
60
60
  >
61
61
  {#if isMenuButton && indicatorPosition === 'before'}
62
62
  {#if indicatorIcon}
@@ -79,12 +79,12 @@ A split button is a special type of button that combines a standard button with
79
79
  import { SplitButton } from 'fluentui-svelte';
80
80
  </script>
81
81
 
82
- <SplitButton />
83
- <SplitButton appearance="standard" />
84
- <SplitButton appearance="subtle" />
85
- <SplitButton shape="circular" />
86
- <SplitButton shape="circular" appearance="standard" />
87
- <SplitButton shape="circular" appearance="subtle" />
82
+ <SplitButton menuTriggerProps={{ 'aria-label': 'More options' }} />
83
+ <SplitButton appearance="standard" menuTriggerProps={{ 'aria-label': 'More options' }} />
84
+ <SplitButton appearance="subtle" menuTriggerProps={{ 'aria-label': 'More options' }} />
85
+ <SplitButton shape="circular" menuTriggerProps={{ 'aria-label': 'More options' }} />
86
+ <SplitButton shape="circular" appearance="standard" menuTriggerProps={{ 'aria-label': 'More options' }} />
87
+ <SplitButton shape="circular" appearance="subtle" menuTriggerProps={{ 'aria-label': 'More options' }} />
88
88
  ```
89
89
 
90
90
  ### Adding a Menu
@@ -96,16 +96,16 @@ To add a menu to the split button, please refer to the Menu documentation for de
96
96
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
97
97
  <!-- props:SplitButtonProps -->
98
98
 
99
- | Name | Type | Default | Description |
100
- | ----------------------------- | ------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------- |
101
- | `appearance` | `'accent'` &#124; `'standard'` &#124; `'subtle'` | `'accent'` | Both buttons can have their content and borders styled for greater emphasis or to be subtle. |
102
- | `shape` | `'circular'` &#124; `'rounded'` &#124; `'square'` | `'rounded'` | Both buttons can be rounded, circular, or square. |
103
- | `disabled` | `boolean` | `false` | Disables the user interaction on both buttons. |
104
- | `primaryButtonProps` | `ButtonProps` | | The props to spread on the primary button. |
105
- | `menuTriggerProps` | `ButtonProps` | | The props to spread on the button that opens the menu. |
106
- | `wrapperRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the element wrapping both buttons. |
107
- | `primaryButtonRef` _bindable_ | `HTMLButtonElement` | | The DOM reference of the primary button. |
108
- | `menuTriggerRef` _bindable_ | `HTMLButtonElement` | | The DOM reference of the button that opens the menu. |
109
- | HTML Attributes | | | |
99
+ | Name | Type | Default | Description |
100
+ | ----------------------------- | ------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------- |
101
+ | `appearance` | `'accent'` &#124; `'standard'` &#124; `'subtle'` | `'accent'` | Both buttons can have their content and borders styled for greater emphasis or to be subtle. |
102
+ | `shape` | `'circular'` &#124; `'rounded'` &#124; `'square'` | `'rounded'` | Both buttons can be rounded, circular, or square. |
103
+ | `disabled` | `boolean` | `false` | Disables the user interaction on both buttons. |
104
+ | `primaryButtonProps` | `ButtonProps` | | The props to spread on the primary button. |
105
+ | `menuTriggerProps` | `ButtonProps` | | The props to spread on the button that opens the menu. It shows only an arrow, so give it an `aria-label`. |
106
+ | `wrapperRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the element wrapping both buttons. |
107
+ | `primaryButtonRef` _bindable_ | `HTMLButtonElement` &#124; `null` | | The DOM reference of the primary button. |
108
+ | `menuTriggerRef` _bindable_ | `HTMLButtonElement` &#124; `null` | | The DOM reference of the button that opens the menu. |
109
+ | HTML Attributes | | | |
110
110
 
111
111
  <!-- /props:SplitButtonProps -->
@@ -8,18 +8,18 @@
8
8
  appearance = 'accent',
9
9
  shape = 'rounded',
10
10
  disabled = false,
11
- wrapperRef = $bindable(),
11
+ wrapperRef = $bindable(null),
12
12
  primaryButtonProps,
13
13
  menuTriggerProps,
14
- primaryButtonRef = $bindable(),
15
- menuTriggerRef = $bindable(),
14
+ primaryButtonRef = $bindable(null),
15
+ menuTriggerRef = $bindable(null),
16
16
  children,
17
17
  ...attributes
18
18
  }: SplitButtonProps = $props();
19
19
  </script>
20
20
 
21
- <div class={['fs-split-button', classes]} role="group" bind:this={wrapperRef} {...attributes}>
22
- <Button as="button" {appearance} {shape} {disabled} bind:ref={primaryButtonRef} {...primaryButtonProps}>
21
+ <div {...attributes} class={['fs-split-button', classes]} role="group" bind:this={wrapperRef}>
22
+ <Button {...primaryButtonProps} as="button" {appearance} {shape} {disabled} bind:ref={primaryButtonRef}>
23
23
  {#if children}
24
24
  {@render children()}
25
25
  {:else}
@@ -27,13 +27,13 @@
27
27
  {/if}
28
28
  </Button>
29
29
  <Button
30
+ {...menuTriggerProps}
30
31
  as="button"
31
- class="menu-button"
32
+ class={['menu-button', menuTriggerProps?.class]}
32
33
  {appearance}
33
34
  {shape}
34
35
  {disabled}
35
36
  bind:ref={menuTriggerRef}
36
- {...menuTriggerProps}
37
37
  >
38
38
  <ChevronDownFilled class="indicator" />
39
39
  </Button>
@@ -7,7 +7,7 @@ export type ButtonProps<T extends ButtonGenerics = 'button'> = {
7
7
  * @type ButtonElementDOMType[T]
8
8
  * @bindable
9
9
  */
10
- ref?: ButtonElementDOMType[T];
10
+ ref?: ButtonElementDOMType[T] | null;
11
11
  /** The DOM element to render.
12
12
  * @type 'button' | 'a' | 'div'
13
13
  * @default 'button'
@@ -69,20 +69,20 @@ export type SplitButtonProps = {
69
69
  * @type ButtonProps
70
70
  */
71
71
  primaryButtonProps: ButtonProps<'button'>;
72
- /** The props to spread on the button that opens the menu.
72
+ /** The props to spread on the button that opens the menu. It shows only an arrow, so give it an `aria-label`.
73
73
  * @type ButtonProps
74
74
  */
75
75
  menuTriggerProps: ButtonProps<'button'>;
76
76
  /** The DOM reference of the element wrapping both buttons.
77
77
  * @bindable
78
78
  */
79
- wrapperRef?: HTMLDivElement;
79
+ wrapperRef?: HTMLDivElement | null;
80
80
  /** The DOM reference of the primary button.
81
81
  * @bindable
82
82
  */
83
- primaryButtonRef?: HTMLButtonElement;
83
+ primaryButtonRef?: HTMLButtonElement | null;
84
84
  /** The DOM reference of the button that opens the menu.
85
85
  * @bindable
86
86
  */
87
- menuTriggerRef?: HTMLButtonElement;
87
+ menuTriggerRef?: HTMLButtonElement | null;
88
88
  } & PolymorphicProps<'div'>;
@@ -1,13 +1,23 @@
1
1
  <script lang="ts">
2
+ import { claimLabel } from '../label/label-context.js';
2
3
  import { Button, CalendarView } from '../../index.js';
3
4
  import { CalendarLtrRegular } from 'fluentui-icons-svelte';
4
5
  import type { CalendarDatePickerProps } from './types.js';
5
6
  import { onMount, tick } from 'svelte';
6
7
  import { on } from 'svelte/events';
8
+ import { dispatchFieldEvents, invokeHandlers, NativeField } from '../../internal/index.js';
7
9
  import { PREFIX } from '../../internal/constants.js';
8
10
  import { flip, hide, offset, shift } from '@floating-ui/dom';
9
11
 
12
+ /** The Label the field is inside, when the label is for it. */
13
+ const labelContext = claimLabel(() => id);
14
+
10
15
  let {
16
+ wrapperAttributes,
17
+ disabled,
18
+ readonly,
19
+ onfocus,
20
+ onblur,
11
21
  value = $bindable(null),
12
22
  locale = 'en-US',
13
23
  format = {
@@ -17,14 +27,19 @@
17
27
  },
18
28
  calendarPosition: _positionConfig,
19
29
  blackoutDates,
20
- ref = $bindable(),
30
+ wrapperRef = $bindable(null),
21
31
  headers,
22
32
  maxDate,
23
33
  minDate,
34
+ today,
24
35
  weekStart,
25
36
  onChange,
26
- triggerRef = $bindable(),
27
- popupRef = $bindable(),
37
+ id = labelContext?.fieldId,
38
+ name = id,
39
+ ref = $bindable(null),
40
+ buttonRef = $bindable(null),
41
+ buttonProps,
42
+ popupRef = $bindable(null),
28
43
  popupLabel = 'Choose a date',
29
44
  ...attributes
30
45
  }: CalendarDatePickerProps = $props();
@@ -34,10 +49,34 @@
34
49
 
35
50
  let open = $state(false);
36
51
 
52
+ const native = new NativeField(
53
+ () => ref,
54
+ () => buttonRef,
55
+ labelContext
56
+ );
57
+
37
58
  /** Closing always hands the focus back to the trigger button. */
38
59
  function closePopup() {
39
60
  open = false;
40
- triggerRef?.focus();
61
+ buttonRef?.focus();
62
+ }
63
+
64
+ /** A label activates the native input it belongs to, which hands the activation to the button. */
65
+ function openFromField() {
66
+ buttonRef?.focus();
67
+ open = !readonly;
68
+ }
69
+
70
+ const pad = (n: number, length = 2) => String(n).padStart(length, '0');
71
+
72
+ /** The native input holds the calendar day as `YYYY-MM-DD`, read in local time... no UTC offset shifts it. */
73
+ function toFieldValue(date: Date | null | undefined) {
74
+ return date ? `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` : '';
75
+ }
76
+
77
+ function fromFieldValue(text: string) {
78
+ const [year, month, day] = text.split('-').map(Number);
79
+ return text ? new Date(year, month - 1, day) : null;
41
80
  }
42
81
 
43
82
  let positionConfig = $derived({
@@ -48,7 +87,7 @@
48
87
 
49
88
  onMount(() => {
50
89
  const off = on(document, 'click', (event: MouseEvent) => {
51
- if (ref && !ref.contains(event.target as Node)) {
90
+ if (wrapperRef && !wrapperRef.contains(event.target as Node)) {
52
91
  open = false;
53
92
  }
54
93
  });
@@ -76,14 +115,21 @@
76
115
  });
77
116
  </script>
78
117
 
79
- <div class="fs-calendar-date-picker" bind:this={ref} {...attributes}>
118
+ <div {...wrapperAttributes} class={['fs-calendar-date-picker', wrapperAttributes?.class]} bind:this={wrapperRef}>
80
119
  <Button
120
+ {...buttonProps}
121
+ {...native.aria(attributes, buttonProps, 'button')}
81
122
  appearance="standard"
123
+ type="button"
124
+ class={['fs-calendar-date-picker-button', buttonProps?.class]}
125
+ disabled={disabled ?? false}
82
126
  aria-haspopup="dialog"
83
127
  aria-expanded={open}
84
128
  aria-controls={open ? POPUP_ID : undefined}
85
- bind:ref={triggerRef}
86
- onclick={() => (open = !open)}
129
+ bind:ref={buttonRef}
130
+ onclick={(e) => invokeHandlers(e, [], [() => (open = !readonly && !open), buttonProps?.onclick])}
131
+ onfocus={(e) => invokeHandlers(e, [], [onfocus, buttonProps?.onfocus])}
132
+ onblur={(e) => invokeHandlers(e, [], [onblur, buttonProps?.onblur])}
87
133
  >
88
134
  {#if value}
89
135
  {value.toLocaleDateString(locale, format)}
@@ -92,6 +138,27 @@
92
138
  {/if}
93
139
  <CalendarLtrRegular width="1rem" />
94
140
  </Button>
141
+ <!-- The field of the form: submitted, validated and reset like any date input, behind the
142
+ button and out of the tab order, since the button is what people use. See `NativeField`. -->
143
+ <input
144
+ {...attributes}
145
+ {id}
146
+ {name}
147
+ class="native-field"
148
+ aria-hidden={native.reported ? undefined : 'true'}
149
+ type="date"
150
+ tabindex={-1}
151
+ {disabled}
152
+ {readonly}
153
+ bind:value={
154
+ () => toFieldValue(value),
155
+ (text) => {
156
+ if (text !== toFieldValue(value)) value = fromFieldValue(text);
157
+ }
158
+ }
159
+ bind:this={ref}
160
+ onclick={openFromField}
161
+ />
95
162
  {#if open}
96
163
  <CalendarView
97
164
  bind:value
@@ -101,12 +168,16 @@
101
168
  aria-modal="true"
102
169
  aria-label={popupLabel}
103
170
  tabindex={-1}
104
- floating={{ ref, positionConfig }}
105
- onChange={onChange as any}
171
+ floating={{ ref: wrapperRef, positionConfig }}
172
+ onChange={(event, date) => {
173
+ onChange?.(event, date as Date | null);
174
+ dispatchFieldEvents(ref);
175
+ }}
106
176
  {blackoutDates}
107
177
  {headers}
108
178
  {maxDate}
109
179
  {minDate}
180
+ {today}
110
181
  {weekStart}
111
182
  />
112
183
  {/if}
@@ -115,5 +186,22 @@
115
186
  <style>
116
187
  .fs-calendar-date-picker {
117
188
  position: relative;
189
+ inline-size: fit-content;
190
+ & .native-field {
191
+ position: absolute;
192
+ inset: 0;
193
+ inline-size: 100%;
194
+ block-size: 100%;
195
+ margin: 0;
196
+ box-sizing: border-box;
197
+ opacity: 0;
198
+ pointer-events: none;
199
+ }
200
+ &:has(> .native-field:is(:user-invalid, [aria-invalid='true'])) :global(.fs-calendar-date-picker-button) {
201
+ color: var(--fs-system-critical);
202
+ &::after {
203
+ background: var(--fs-system-critical);
204
+ }
205
+ }
118
206
  }
119
207
  </style>
@@ -1,4 +1,4 @@
1
1
  import type { CalendarDatePickerProps } from './types.js';
2
- declare const CalendarDatePicker: import("svelte").Component<CalendarDatePickerProps, {}, "ref" | "value" | "triggerRef" | "popupRef">;
2
+ declare const CalendarDatePicker: import("svelte").Component<CalendarDatePickerProps, {}, "ref" | "value" | "wrapperRef" | "buttonRef" | "popupRef">;
3
3
  type CalendarDatePicker = ReturnType<typeof CalendarDatePicker>;
4
4
  export default CalendarDatePicker;
@@ -18,26 +18,31 @@ A button trigger paired with a CalendarView popup for selecting a single date.
18
18
 
19
19
  The `CalendarDatePicker` combines a button trigger with a `CalendarView` popup. Clicking the trigger opens the calendar, and selecting a day updates the bound `value` and closes the popup. Because it builds on `CalendarView`, calendar props such as `blackoutDates`, `minDate`, `maxDate`, `weekStart` and `headers` are forwarded straight to the popup calendar.
20
20
 
21
+ 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.
22
+
21
23
  ## Component Props
22
24
 
23
25
  <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
24
26
  <!-- props:CalendarDatePickerProps -->
25
27
 
26
- | Name | Type | Default | Description |
27
- | ------------------------------------------------------------------------------------------------ | --------------------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
28
- | `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the picker element. |
29
- | `value` _bindable_ | `Date` &#124; `null` | `null` | The selected date. |
30
- | `format` | `Intl.DateTimeFormatOptions` | `{ year: 'numeric', month: 'numeric', day: 'numeric' }` | The options used to format the date rendered on the trigger. |
31
- | `calendarPosition` | `Partial<ComputePositionConfig>` | | The floating UI configuration object of the calendar popup. Keys left out keep their default. |
32
- | `onChange` | `(event: Event, value: Date` &#124; `null) => void` | | Called whenever the selected date changes. |
33
- | `popupLabel` | `string` | `'Choose a date'` | The accessible name of the calendar popup, which is announced as a dialog. |
34
- | `triggerRef` _bindable_ | `HTMLButtonElement` | | The DOM reference of the trigger button. |
35
- | `popupRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the calendar popup. |
36
- | `locale`, `blackoutDates`, `headers`, `minDate`, `maxDate`, `weekStart` from `CalendarViewProps` | | | |
37
- | Element Attributes (`div`) | | | |
28
+ | Name | Type | Default | Description |
29
+ | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30
+ | `wrapperRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the wrapper element. |
31
+ | `value` _bindable_ | `Date` &#124; `null` | `null` | The selected date. |
32
+ | `format` | `Intl.DateTimeFormatOptions` | `{ year: 'numeric', month: 'numeric', day: 'numeric' }` | The options used to format the date rendered on the trigger. When rendering on the server, give it the `timeZone` of the visitor: the calendar picks dates at the visitor's midnight, and the server would format them in its own time zone. |
33
+ | `calendarPosition` | `Partial<ComputePositionConfig>` | | The floating UI configuration object of the calendar popup. Keys left out keep their default. |
34
+ | `onChange` | `(event: Event, value: Date` &#124; `null) => void` | | Called whenever the selected date changes. |
35
+ | `popupLabel` | `string` | `'Choose a date'` | The accessible name of the calendar popup, which is announced as a dialog. |
36
+ | `ref` _bindable_ | `HTMLInputElement` &#124; `null` | | The DOM reference of the native date input that holds the value, as `YYYY-MM-DD`. The other attributes of the picker are applied to it. |
37
+ | `buttonRef` _bindable_ | `HTMLButtonElement` &#124; `null` | | The DOM reference of the button that opens the calendar. |
38
+ | `buttonProps` | `ButtonProps` | | The props to spread on the `Button` that opens the calendar. |
39
+ | `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
40
+ | `popupRef` _bindable_ | `HTMLDivElement` &#124; `null` | | The DOM reference of the calendar popup. |
41
+ | `locale`, `blackoutDates`, `headers`, `minDate`, `maxDate`, `today`, `weekStart` from `CalendarViewProps` | | | |
42
+ | `NativeFieldAttributes<HTMLInputAttributes>` | | | |
38
43
 
39
44
  <!-- /props:CalendarDatePickerProps -->
40
45
 
41
46
  `locale`, `blackoutDates`, `headers`, `minDate`, `maxDate` and `weekStart` are forwarded
42
- straight to the underlying `CalendarView`. All `div` HTML attributes are forwarded to the
43
- root element.
47
+ straight to the underlying `CalendarView`. Button HTML attributes, including `id`, `class` and ARIA attributes, are forwarded to the
48
+ trigger. Use `wrapperAttributes` and `wrapperRef` for the root element.
@@ -1,18 +1,20 @@
1
- import type { HTMLAttributes } from 'svelte/elements';
1
+ import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
2
2
  import type { ComputePositionConfig } from '@floating-ui/dom';
3
3
  import type { CalendarViewProps } from '../calendar-view/types.js';
4
+ import type { ButtonProps } from '../button/types.js';
5
+ import type { NativeFieldAttributes } from '../../internal/index.js';
4
6
  /** @propsmith CalendarDatePickerProps */
5
7
  export type CalendarDatePickerProps = {
6
- /** The DOM reference of the picker element.
8
+ /** The DOM reference of the wrapper element.
7
9
  * @bindable
8
10
  */
9
- ref?: HTMLDivElement;
11
+ wrapperRef?: HTMLDivElement | null;
10
12
  /** The selected date.
11
13
  * @default null
12
14
  * @bindable
13
15
  */
14
16
  value?: Date | null;
15
- /** The options used to format the date rendered on the trigger.
17
+ /** The options used to format the date rendered on the trigger. When rendering on the server, give it the `timeZone` of the visitor: the calendar picks dates at the visitor's midnight, and the server would format them in its own time zone.
16
18
  * @default { year: 'numeric', month: 'numeric', day: 'numeric' }
17
19
  */
18
20
  format?: Intl.DateTimeFormatOptions;
@@ -25,12 +27,24 @@ export type CalendarDatePickerProps = {
25
27
  * @default 'Choose a date'
26
28
  */
27
29
  popupLabel?: string;
28
- /** The DOM reference of the trigger button.
30
+ /** The DOM reference of the native date input that holds the value, as `YYYY-MM-DD`. The other attributes of the picker are applied to it.
29
31
  * @bindable
30
32
  */
31
- triggerRef?: HTMLButtonElement;
33
+ ref?: HTMLInputElement | null;
34
+ /** The DOM reference of the button that opens the calendar.
35
+ * @bindable
36
+ */
37
+ buttonRef?: HTMLButtonElement | null;
38
+ /** The props to spread on the `Button` that opens the calendar.
39
+ * @type ButtonProps
40
+ */
41
+ buttonProps?: Omit<ButtonProps<'button'>, 'as' | 'ref' | 'children'>;
42
+ /** The attributes to spread on the wrapper element.
43
+ * @type HTMLAttributes
44
+ */
45
+ wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
32
46
  /** The DOM reference of the calendar popup.
33
47
  * @bindable
34
48
  */
35
- popupRef?: HTMLDivElement;
36
- } & Pick<CalendarViewProps, 'locale' | 'blackoutDates' | 'headers' | 'minDate' | 'maxDate' | 'weekStart'> & HTMLAttributes<HTMLDivElement>;
49
+ popupRef?: HTMLDivElement | null;
50
+ } & Pick<CalendarViewProps, 'locale' | 'blackoutDates' | 'headers' | 'minDate' | 'maxDate' | 'today' | 'weekStart'> & NativeFieldAttributes<HTMLInputAttributes>;
@@ -3,6 +3,7 @@
3
3
  import { circOut } from 'svelte/easing';
4
4
  import {
5
5
  compareDates,
6
+ dateKey,
6
7
  getCalendarDays,
7
8
  getCalendarViewContext,
8
9
  getMonthLocale,
@@ -172,13 +173,13 @@
172
173
  {selected}
173
174
  rangePosition={bandRange ? rangePositionOf(day, bandRange) : undefined}
174
175
  outOfRange={!inMonth}
175
- current={compareDates(day, new Date(), 'day')}
176
+ current={compareDates(day, CalendarContext.config.today, 'day')}
176
177
  disabled={isDisabled(day)}
177
178
  blackout={isBlackout(day)}
178
179
  buttonAttributes={{
179
180
  tabindex: inMonth ? 0 : -1,
180
181
  'aria-label': dayLabel(day),
181
- 'data-date': day.getTime(),
182
+ 'data-date': dateKey(day),
182
183
  onclick: (e: MouseEvent) => {
183
184
  selectDay(e, day);
184
185
  }