fluentui-svelte 0.1.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 (283) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -0
  3. package/dist/components/auto-suggest-box/auto-suggest-box.d.ts +2 -0
  4. package/dist/components/auto-suggest-box/auto-suggest-box.js +2 -0
  5. package/dist/components/auto-suggest-box/auto-suggest-box.svelte +457 -0
  6. package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +4 -0
  7. package/dist/components/auto-suggest-box/docs/llms.md +73 -0
  8. package/dist/components/auto-suggest-box/option.svelte +82 -0
  9. package/dist/components/auto-suggest-box/option.svelte.d.ts +4 -0
  10. package/dist/components/auto-suggest-box/types.d.ts +140 -0
  11. package/dist/components/auto-suggest-box/types.js +1 -0
  12. package/dist/components/avatar/avatar.svelte +269 -0
  13. package/dist/components/avatar/avatar.svelte.d.ts +20 -0
  14. package/dist/components/avatar/docs/llms.md +92 -0
  15. package/dist/components/avatar/type.d.ts +63 -0
  16. package/dist/components/avatar/type.js +1 -0
  17. package/dist/components/badge/badge-icon.svelte +103 -0
  18. package/dist/components/badge/badge-icon.svelte.d.ts +25 -0
  19. package/dist/components/badge/badge.svelte +163 -0
  20. package/dist/components/badge/badge.svelte.d.ts +20 -0
  21. package/dist/components/badge/docs/llms.md +133 -0
  22. package/dist/components/badge/types.d.ts +70 -0
  23. package/dist/components/badge/types.js +1 -0
  24. package/dist/components/badge/utils.svelte.d.ts +16 -0
  25. package/dist/components/badge/utils.svelte.js +35 -0
  26. package/dist/components/button/button.svelte +203 -0
  27. package/dist/components/button/button.svelte.d.ts +38 -0
  28. package/dist/components/button/docs/llms.md +102 -0
  29. package/dist/components/button/split-button.svelte +66 -0
  30. package/dist/components/button/split-button.svelte.d.ts +4 -0
  31. package/dist/components/button/types.d.ts +84 -0
  32. package/dist/components/button/types.js +1 -0
  33. package/dist/components/calendar-date-picker/calendar-date-picker.svelte +119 -0
  34. package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +4 -0
  35. package/dist/components/calendar-date-picker/docs/llms.md +33 -0
  36. package/dist/components/calendar-date-picker/types.d.ts +36 -0
  37. package/dist/components/calendar-date-picker/types.js +1 -0
  38. package/dist/components/calendar-view/calendar-view-controls.svelte +115 -0
  39. package/dist/components/calendar-view/calendar-view-controls.svelte.d.ts +3 -0
  40. package/dist/components/calendar-view/calendar-view-days.svelte +210 -0
  41. package/dist/components/calendar-view/calendar-view-days.svelte.d.ts +3 -0
  42. package/dist/components/calendar-view/calendar-view-grid.d.ts +38 -0
  43. package/dist/components/calendar-view/calendar-view-grid.js +140 -0
  44. package/dist/components/calendar-view/calendar-view-header.svelte +66 -0
  45. package/dist/components/calendar-view/calendar-view-header.svelte.d.ts +18 -0
  46. package/dist/components/calendar-view/calendar-view-item.svelte +181 -0
  47. package/dist/components/calendar-view/calendar-view-item.svelte.d.ts +4 -0
  48. package/dist/components/calendar-view/calendar-view-months.svelte +165 -0
  49. package/dist/components/calendar-view/calendar-view-months.svelte.d.ts +3 -0
  50. package/dist/components/calendar-view/calendar-view-years.svelte +161 -0
  51. package/dist/components/calendar-view/calendar-view-years.svelte.d.ts +3 -0
  52. package/dist/components/calendar-view/calendar-view.svelte +451 -0
  53. package/dist/components/calendar-view/calendar-view.svelte.d.ts +9 -0
  54. package/dist/components/calendar-view/calendar-view.svelte.js +196 -0
  55. package/dist/components/calendar-view/docs/llms.md +121 -0
  56. package/dist/components/calendar-view/index.d.ts +1 -0
  57. package/dist/components/calendar-view/index.js +1 -0
  58. package/dist/components/calendar-view/types.d.ts +174 -0
  59. package/dist/components/calendar-view/types.js +1 -0
  60. package/dist/components/checkbox/checkbox.svelte +171 -0
  61. package/dist/components/checkbox/checkbox.svelte.d.ts +40 -0
  62. package/dist/components/checkbox/docs/llms.md +78 -0
  63. package/dist/components/checkbox/types.d.ts +50 -0
  64. package/dist/components/checkbox/types.js +1 -0
  65. package/dist/components/date-picker/date-picker.svelte +381 -0
  66. package/dist/components/date-picker/date-picker.svelte.d.ts +4 -0
  67. package/dist/components/date-picker/docs/llms.md +52 -0
  68. package/dist/components/date-picker/index.d.ts +1 -0
  69. package/dist/components/date-picker/index.js +1 -0
  70. package/dist/components/date-picker/types.d.ts +74 -0
  71. package/dist/components/date-picker/types.js +1 -0
  72. package/dist/components/dialog/dialog-actions.svelte +37 -0
  73. package/dist/components/dialog/dialog-actions.svelte.d.ts +4 -0
  74. package/dist/components/dialog/dialog-content.svelte +17 -0
  75. package/dist/components/dialog/dialog-content.svelte.d.ts +4 -0
  76. package/dist/components/dialog/dialog-surface.svelte +95 -0
  77. package/dist/components/dialog/dialog-surface.svelte.d.ts +4 -0
  78. package/dist/components/dialog/dialog-title.svelte +33 -0
  79. package/dist/components/dialog/dialog-title.svelte.d.ts +25 -0
  80. package/dist/components/dialog/dialog-trigger.svelte +23 -0
  81. package/dist/components/dialog/dialog-trigger.svelte.d.ts +4 -0
  82. package/dist/components/dialog/dialog.svelte +64 -0
  83. package/dist/components/dialog/dialog.svelte.d.ts +7 -0
  84. package/dist/components/dialog/dialog.svelte.js +2 -0
  85. package/dist/components/dialog/docs/llms.md +131 -0
  86. package/dist/components/dialog/types.d.ts +92 -0
  87. package/dist/components/dialog/types.js +1 -0
  88. package/dist/components/divider/divider.svelte +120 -0
  89. package/dist/components/divider/divider.svelte.d.ts +39 -0
  90. package/dist/components/divider/docs/llms.md +83 -0
  91. package/dist/components/divider/types.d.ts +32 -0
  92. package/dist/components/divider/types.js +1 -0
  93. package/dist/components/dropdown/docs/llms.md +70 -0
  94. package/dist/components/dropdown/dropdown-context.d.ts +2 -0
  95. package/dist/components/dropdown/dropdown-context.js +2 -0
  96. package/dist/components/dropdown/dropdown-option.svelte +31 -0
  97. package/dist/components/dropdown/dropdown-option.svelte.d.ts +4 -0
  98. package/dist/components/dropdown/dropdown.svelte +309 -0
  99. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  100. package/dist/components/dropdown/types.d.ts +82 -0
  101. package/dist/components/dropdown/types.js +1 -0
  102. package/dist/components/dropdown-select/docs/llms.md +72 -0
  103. package/dist/components/dropdown-select/dropdown-select-option.svelte +87 -0
  104. package/dist/components/dropdown-select/dropdown-select-option.svelte.d.ts +4 -0
  105. package/dist/components/dropdown-select/dropdown-select.svelte +165 -0
  106. package/dist/components/dropdown-select/dropdown-select.svelte.d.ts +4 -0
  107. package/dist/components/dropdown-select/dropdown-select.svelte.js +48 -0
  108. package/dist/components/dropdown-select/index.d.ts +2 -0
  109. package/dist/components/dropdown-select/index.js +2 -0
  110. package/dist/components/dropdown-select/types.d.ts +46 -0
  111. package/dist/components/dropdown-select/types.js +1 -0
  112. package/dist/components/expander/docs/llms.md +88 -0
  113. package/dist/components/expander/expander.svelte +249 -0
  114. package/dist/components/expander/expander.svelte.d.ts +21 -0
  115. package/dist/components/expander/types.d.ts +47 -0
  116. package/dist/components/expander/types.js +1 -0
  117. package/dist/components/flyout/docs/llms.md +31 -0
  118. package/dist/components/flyout/flyout.svelte +148 -0
  119. package/dist/components/flyout/flyout.svelte.d.ts +19 -0
  120. package/dist/components/flyout/types.d.ts +36 -0
  121. package/dist/components/flyout/types.js +1 -0
  122. package/dist/components/hyperlink/docs/llms.md +33 -0
  123. package/dist/components/hyperlink/hyperlink.svelte +66 -0
  124. package/dist/components/hyperlink/hyperlink.svelte.d.ts +16 -0
  125. package/dist/components/hyperlink/types.d.ts +14 -0
  126. package/dist/components/hyperlink/types.js +1 -0
  127. package/dist/components/info-bar/docs/llms.md +81 -0
  128. package/dist/components/info-bar/info-bar.svelte +140 -0
  129. package/dist/components/info-bar/info-bar.svelte.d.ts +19 -0
  130. package/dist/components/info-bar/types.d.ts +27 -0
  131. package/dist/components/info-bar/types.js +1 -0
  132. package/dist/components/label/docs/llms.md +67 -0
  133. package/dist/components/label/label.svelte +95 -0
  134. package/dist/components/label/label.svelte.d.ts +4 -0
  135. package/dist/components/label/types.d.ts +32 -0
  136. package/dist/components/label/types.js +1 -0
  137. package/dist/components/list-view/docs/llms.md +110 -0
  138. package/dist/components/list-view/list-view-item.svelte +168 -0
  139. package/dist/components/list-view/list-view-item.svelte.d.ts +25 -0
  140. package/dist/components/list-view/list-view.svelte +137 -0
  141. package/dist/components/list-view/list-view.svelte.d.ts +25 -0
  142. package/dist/components/list-view/types.d.ts +95 -0
  143. package/dist/components/list-view/types.js +1 -0
  144. package/dist/components/list-view/utils.d.ts +6 -0
  145. package/dist/components/list-view/utils.js +12 -0
  146. package/dist/components/menu/context-menu-trigger.svelte +84 -0
  147. package/dist/components/menu/context-menu-trigger.svelte.d.ts +9 -0
  148. package/dist/components/menu/docs/llms.md +169 -0
  149. package/dist/components/menu/menu-divider.svelte +9 -0
  150. package/dist/components/menu/menu-divider.svelte.d.ts +26 -0
  151. package/dist/components/menu/menu-group.svelte +31 -0
  152. package/dist/components/menu/menu-group.svelte.d.ts +4 -0
  153. package/dist/components/menu/menu-item-checkbox.svelte +143 -0
  154. package/dist/components/menu/menu-item-checkbox.svelte.d.ts +15 -0
  155. package/dist/components/menu/menu-item-radio.svelte +147 -0
  156. package/dist/components/menu/menu-item-radio.svelte.d.ts +15 -0
  157. package/dist/components/menu/menu-item-switch.svelte +194 -0
  158. package/dist/components/menu/menu-item-switch.svelte.d.ts +15 -0
  159. package/dist/components/menu/menu-item.svelte +124 -0
  160. package/dist/components/menu/menu-item.svelte.d.ts +18 -0
  161. package/dist/components/menu/menu-list.svelte +38 -0
  162. package/dist/components/menu/menu-list.svelte.d.ts +5 -0
  163. package/dist/components/menu/menu-popover.svelte +125 -0
  164. package/dist/components/menu/menu-popover.svelte.d.ts +12 -0
  165. package/dist/components/menu/menu-trigger.svelte +121 -0
  166. package/dist/components/menu/menu-trigger.svelte.d.ts +4 -0
  167. package/dist/components/menu/menu.svelte +124 -0
  168. package/dist/components/menu/menu.svelte.d.ts +4 -0
  169. package/dist/components/menu/menu.svelte.js +77 -0
  170. package/dist/components/menu/types.d.ts +127 -0
  171. package/dist/components/menu/types.js +1 -0
  172. package/dist/components/number-box/docs/llms.md +37 -0
  173. package/dist/components/number-box/number-box.svelte +115 -0
  174. package/dist/components/number-box/number-box.svelte.d.ts +15 -0
  175. package/dist/components/number-box/types.d.ts +16 -0
  176. package/dist/components/number-box/types.js +1 -0
  177. package/dist/components/persona/docs/llms.md +107 -0
  178. package/dist/components/persona/persona.svelte +79 -0
  179. package/dist/components/persona/persona.svelte.d.ts +4 -0
  180. package/dist/components/persona/types.d.ts +42 -0
  181. package/dist/components/persona/types.js +1 -0
  182. package/dist/components/progress-bar/docs/llms.md +67 -0
  183. package/dist/components/progress-bar/progress-bar.svelte +167 -0
  184. package/dist/components/progress-bar/progress-bar.svelte.d.ts +15 -0
  185. package/dist/components/progress-bar/types.d.ts +39 -0
  186. package/dist/components/progress-bar/types.js +1 -0
  187. package/dist/components/progress-ring/docs/llms.md +76 -0
  188. package/dist/components/progress-ring/progress-ring.svelte +145 -0
  189. package/dist/components/progress-ring/progress-ring.svelte.d.ts +15 -0
  190. package/dist/components/progress-ring/types.d.ts +42 -0
  191. package/dist/components/progress-ring/types.js +1 -0
  192. package/dist/components/radio-button/docs/llms.md +64 -0
  193. package/dist/components/radio-button/radio-button.svelte +129 -0
  194. package/dist/components/radio-button/radio-button.svelte.d.ts +19 -0
  195. package/dist/components/radio-button/types.d.ts +24 -0
  196. package/dist/components/radio-button/types.js +1 -0
  197. package/dist/components/skeleton/docs/llms.md +67 -0
  198. package/dist/components/skeleton/skeleton.svelte +106 -0
  199. package/dist/components/skeleton/skeleton.svelte.d.ts +39 -0
  200. package/dist/components/skeleton/types.d.ts +24 -0
  201. package/dist/components/skeleton/types.js +1 -0
  202. package/dist/components/slider/docs/llms.md +75 -0
  203. package/dist/components/slider/slider.svelte +486 -0
  204. package/dist/components/slider/slider.svelte.d.ts +19 -0
  205. package/dist/components/slider/types.d.ts +102 -0
  206. package/dist/components/slider/types.js +1 -0
  207. package/dist/components/text-box/docs/llms.md +86 -0
  208. package/dist/components/text-box/text-box-button.svelte +65 -0
  209. package/dist/components/text-box/text-box-button.svelte.d.ts +9 -0
  210. package/dist/components/text-box/text-box.svelte +299 -0
  211. package/dist/components/text-box/text-box.svelte.d.ts +16 -0
  212. package/dist/components/text-box/types.d.ts +60 -0
  213. package/dist/components/text-box/types.js +1 -0
  214. package/dist/components/textarea/docs/llms.md +55 -0
  215. package/dist/components/textarea/textarea.svelte +151 -0
  216. package/dist/components/textarea/textarea.svelte.d.ts +17 -0
  217. package/dist/components/textarea/types.d.ts +33 -0
  218. package/dist/components/textarea/types.js +1 -0
  219. package/dist/components/time-picker/docs/llms.md +47 -0
  220. package/dist/components/time-picker/index.d.ts +1 -0
  221. package/dist/components/time-picker/index.js +1 -0
  222. package/dist/components/time-picker/time-picker.svelte +336 -0
  223. package/dist/components/time-picker/time-picker.svelte.d.ts +4 -0
  224. package/dist/components/time-picker/types.d.ts +54 -0
  225. package/dist/components/time-picker/types.js +1 -0
  226. package/dist/components/toggle-switch/docs/llms.md +39 -0
  227. package/dist/components/toggle-switch/toggle-switch.svelte +151 -0
  228. package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +17 -0
  229. package/dist/components/toggle-switch/types.d.ts +20 -0
  230. package/dist/components/toggle-switch/types.js +1 -0
  231. package/dist/components/tooltip/docs/llms.md +74 -0
  232. package/dist/components/tooltip/tooltip.svelte +246 -0
  233. package/dist/components/tooltip/tooltip.svelte.d.ts +18 -0
  234. package/dist/components/tooltip/types.d.ts +67 -0
  235. package/dist/components/tooltip/types.js +1 -0
  236. package/dist/components/tree-view/docs/llms.md +117 -0
  237. package/dist/components/tree-view/tree-view-item-content.svelte +158 -0
  238. package/dist/components/tree-view/tree-view-item-content.svelte.d.ts +4 -0
  239. package/dist/components/tree-view/tree-view-item.svelte +197 -0
  240. package/dist/components/tree-view/tree-view-item.svelte.d.ts +4 -0
  241. package/dist/components/tree-view/tree-view.svelte +220 -0
  242. package/dist/components/tree-view/tree-view.svelte.d.ts +4 -0
  243. package/dist/components/tree-view/tree-view.svelte.js +111 -0
  244. package/dist/components/tree-view/types.d.ts +185 -0
  245. package/dist/components/tree-view/types.js +1 -0
  246. package/dist/css/class-darkmode.css +186 -0
  247. package/dist/css/media-darkmode.css +189 -0
  248. package/dist/css/reset.css +53 -0
  249. package/dist/css/theme.css +276 -0
  250. package/dist/css/typography.css +67 -0
  251. package/dist/css/utils.d.ts +1 -0
  252. package/dist/css/utils.js +153 -0
  253. package/dist/index.d.ts +63 -0
  254. package/dist/index.js +129 -0
  255. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +449 -0
  256. package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +22 -0
  257. package/dist/internal/components/render-soc/render-soc.svelte +29 -0
  258. package/dist/internal/components/render-soc/render-soc.svelte.d.ts +30 -0
  259. package/dist/internal/constants.d.ts +26 -0
  260. package/dist/internal/constants.js +4036 -0
  261. package/dist/internal/context.d.ts +14 -0
  262. package/dist/internal/context.js +13 -0
  263. package/dist/internal/dom-utils.svelte.d.ts +6 -0
  264. package/dist/internal/dom-utils.svelte.js +46 -0
  265. package/dist/internal/floating-ui/floating.svelte.d.ts +15 -0
  266. package/dist/internal/floating-ui/floating.svelte.js +26 -0
  267. package/dist/internal/floating-ui/utils.d.ts +3 -0
  268. package/dist/internal/floating-ui/utils.js +30 -0
  269. package/dist/internal/index.d.ts +9 -0
  270. package/dist/internal/index.js +9 -0
  271. package/dist/internal/polyfills/expander.svelte.d.ts +21 -0
  272. package/dist/internal/polyfills/expander.svelte.js +96 -0
  273. package/dist/internal/transitions.d.ts +32 -0
  274. package/dist/internal/transitions.js +37 -0
  275. package/dist/internal/utils.d.ts +22 -0
  276. package/dist/internal/utils.js +63 -0
  277. package/dist/providers/fluentui-svelte/fluentui-svelte.d.ts +19 -0
  278. package/dist/providers/fluentui-svelte/fluentui-svelte.js +11 -0
  279. package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +68 -0
  280. package/dist/providers/fluentui-svelte/fluentui-svelte.svelte.d.ts +9 -0
  281. package/dist/types/index.d.ts +117 -0
  282. package/dist/types/index.js +1 -0
  283. package/package.json +142 -0
@@ -0,0 +1,107 @@
1
+ # Persona
2
+
3
+ A Persona is a visual representation of a person that combines an avatar, presence status, and up to three lines of descriptive text.
4
+
5
+ ## Usage
6
+
7
+ ```svelte
8
+ <script>
9
+ import { Persona } from 'fluentui-svelte';
10
+ </script>
11
+
12
+ <Persona
13
+ name="John Doe"
14
+ primaryText="Software Engineer"
15
+ secondaryText="Intranet"
16
+ tertiaryText="Team A"
17
+ presence={{ status: 'available' }}
18
+ avatar={{ color: 'colorful' }}
19
+ />
20
+ ```
21
+
22
+ ## Component API
23
+
24
+ ### Text Align
25
+
26
+ A Persona supports three text alignments, with 'left' as the default position.
27
+
28
+ ```svelte
29
+ <Persona name="Alex Johnson" avatar={{ initials: 'AJ' }} secondaryText="Available" />
30
+ <Persona name="Alex Johnson" avatar={{ initials: 'AJ' }} secondaryText="Available" textAlign="center" />
31
+ <Persona name="Alex Johnson" avatar={{ initials: 'AJ' }} secondaryText="Available" textAlign="right" />
32
+ ```
33
+
34
+ ### Text Position
35
+
36
+ A Persona supports four text positions: 'top', 'bottom', 'left', and 'right'. The default position is 'right'.
37
+
38
+ ```svelte
39
+ <Persona name="Alex Johnson" avatar={{ initials: 'AJ' }} secondaryText="Available" />
40
+ <Persona
41
+ name="Alex Johnson"
42
+ avatar={{ initials: 'AJ' }}
43
+ secondaryText="Available"
44
+ textPosition="bottom"
45
+ textAlign="center"
46
+ />
47
+ <Persona name="Alex Johnson" avatar={{ initials: 'AJ' }} secondaryText="Available" textPosition="left" />
48
+ <Persona
49
+ name="Alex Johnson"
50
+ avatar={{ initials: 'AJ' }}
51
+ secondaryText="Available"
52
+ textPosition="top"
53
+ textAlign="center"
54
+ />
55
+ ```
56
+
57
+ ### Size
58
+
59
+ A Persona supports custom sizes, with a default of 42px. You can set the size using the size prop. This applies to both the avatar or presence-only display and all text.
60
+
61
+ ```svelte
62
+ <Persona name="John Doe" size={24} />
63
+ <Persona name="John Doe" size={32} />
64
+ <Persona name="John Doe" size={56} />
65
+ ```
66
+
67
+ ### Avatar
68
+
69
+ A Persona wraps an avatar inside it, which can be customized with all the props available to the Avatar component.
70
+
71
+ ```svelte
72
+ <Persona name="John Doe" avatar={{ color: 'attention' }} />
73
+ <Persona name="John Doe" avatar={{ color: 'colorful', idForColor: '' }} />
74
+ <Persona name="John Doe" avatar={{ image: { src: 'https://placehold.co/96x96/jpeg', alt: 'Placeholder Image' } }} />
75
+ ```
76
+
77
+ ### Presence
78
+
79
+ A Persona can display presence information, such as online status or availability. This is controlled through the presence prop, which accepts an object with a status key.
80
+
81
+ ```svelte
82
+ <Persona name="John Doe" presence={{ status: 'available' }} />
83
+ <Persona name="John Doe" presence={{ status: 'away' }} />
84
+ <Persona name="John Doe" presence={{ status: 'busy' }} />
85
+ <Persona name="John Doe" presence={{ status: 'do-not-disturb' }} />
86
+ <Persona name="John Doe" presence={{ status: 'offline' }} />
87
+ <Persona name="John Doe" presence={{ status: 'out-of-office' }} />
88
+ <Persona name="John Doe" presence={{ status: 'blocked' }} />
89
+ <Persona name="John Doe" presence={{ status: 'unknown' }} />
90
+ ```
91
+
92
+ ## Component Props
93
+
94
+ | Name | Type | Description |
95
+ | --------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
+ | `name` | `string` | The full name of the person. |
97
+ | `primaryText` | `string` | Main text, usually the person's role or title. |
98
+ | `secondaryText` | `string` | Secondary text, for example location or status. |
99
+ | `tertiaryText` | `string` | Tertiary text, for example team or department. |
100
+ | `size` | `number` | Size in pixels for the avatar and text. |
101
+ | `textAlign` | `string` | Alignment of the text. Possible values are 'left', 'center', and 'right'. |
102
+ | `textPosition` | `string` | Position of the text relative to the avatar. Possible values are 'top', 'bottom', 'left', and 'right'. |
103
+ | `avatarAlign` | `string` | Cross-axis alignment of the avatar relative to the text. Possible values are 'start', 'center', and 'end'. |
104
+ | `avatar` | `object` | Avatar props object. See the Avatar component for details. |
105
+ | `presence` | `object` | Presence object, for example { status: 'available' }. Status values are 'available', 'away', 'busy', 'do-not-disturb', 'offline', 'out-of-office', 'blocked', and 'unknown'. |
106
+ | `presenceOnly` | `boolean` | Shows only the presence indicator, with no avatar or text. |
107
+ | `element` | `HTMLDivElement` | The DOM reference of the persona root element. |
@@ -0,0 +1,79 @@
1
+ <script lang="ts">
2
+ import { Avatar, BadgeIcon } from '../../index.js';
3
+ import type { PersonaProps } from './types.js';
4
+
5
+ let {
6
+ name,
7
+ size = 42,
8
+ primaryText,
9
+ tertiaryText,
10
+ secondaryText,
11
+ textAlign = 'left',
12
+ textPosition: dir = 'right',
13
+ avatarAlign = 'center',
14
+ element = $bindable(),
15
+ avatar,
16
+ presence,
17
+ presenceOnly,
18
+ ...attributes
19
+ }: PersonaProps = $props();
20
+
21
+ const position = {
22
+ top: 'column-reverse',
23
+ bottom: 'column',
24
+ left: 'row-reverse',
25
+ right: 'row'
26
+ };
27
+ </script>
28
+
29
+ <div
30
+ bind:this={element}
31
+ class="persona"
32
+ style="--p-size: {size}px; --avatar-align: {avatarAlign}; flex-direction: {position[dir]}; text-align: {textAlign};"
33
+ {...attributes}
34
+ >
35
+ {#if presenceOnly && presence?.status}
36
+ <BadgeIcon {size} icon={presence?.icon || undefined} status={presence.status} outOfOffice={presence?.outOfOffice} />
37
+ {:else}
38
+ <Avatar {name} {size} {...avatar} badge={presence} />
39
+ {/if}
40
+ <div class="persona-data">
41
+ <p class="persona-name">{name}</p>
42
+ {#if primaryText}
43
+ <p>{primaryText}</p>
44
+ {/if}
45
+ {#if secondaryText}
46
+ <p>{secondaryText}</p>
47
+ {/if}
48
+ {#if tertiaryText}
49
+ <p>{tertiaryText}</p>
50
+ {/if}
51
+ </div>
52
+ </div>
53
+
54
+ <style>
55
+ .persona {
56
+ display: flex;
57
+ align-items: var(--avatar-align);
58
+ gap: 0.8rem;
59
+ min-width: max-content;
60
+ & .persona-data {
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 0.2rem;
64
+ text-align: var(--p-align);
65
+ line-height: 1em;
66
+ & .persona-name {
67
+ font-size: calc(var(--p-size) / 3.2);
68
+ font-weight: 500;
69
+ color: var(--fs-text-primary);
70
+ line-height: 1em;
71
+ }
72
+ & p {
73
+ font-size: calc(var(--p-size) / 4.2);
74
+ color: var(--fs-text-secondary);
75
+ line-height: 1em;
76
+ }
77
+ }
78
+ }
79
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { PersonaProps } from './types.ts';
2
+ declare const Persona: import("svelte").Component<PersonaProps, {}, "element">;
3
+ type Persona = ReturnType<typeof Persona>;
4
+ export default Persona;
@@ -0,0 +1,42 @@
1
+ import type { AvatarProps } from '../avatar/type.ts';
2
+ /** @propsmith PersonaProps */
3
+ export type PersonaProps = {
4
+ /** The name of the person or entity represented by this Persona. It is also used by the avatar for its initials. */
5
+ name: string;
6
+ /** The size of the avatar in pixels. The text scales with it.
7
+ * @default 42
8
+ */
9
+ size?: number;
10
+ /** Text to display below the name. */
11
+ primaryText?: string;
12
+ /** Text to display below the primary text. */
13
+ secondaryText?: string;
14
+ /** Text to display below the secondary text. */
15
+ tertiaryText?: string;
16
+ /** How the text block is aligned.
17
+ * @default 'left'
18
+ */
19
+ textAlign?: 'left' | 'center' | 'right';
20
+ /** Where the text block sits relative to the avatar.
21
+ * @default 'right'
22
+ */
23
+ textPosition?: 'top' | 'bottom' | 'left' | 'right';
24
+ /** Renders the presence badge on its own, without the avatar behind it. */
25
+ presenceOnly?: boolean;
26
+ /** How the avatar is aligned against the text block.
27
+ * @default 'center'
28
+ */
29
+ avatarAlign?: 'start' | 'center' | 'end';
30
+ /** The DOM reference of the persona element.
31
+ * @bindable
32
+ */
33
+ element?: HTMLDivElement;
34
+ /** The props to spread on the avatar.
35
+ * @type AvatarProps
36
+ */
37
+ avatar?: AvatarProps;
38
+ /** The presence badge to display as a status indicator.
39
+ * @type BadgePresence
40
+ */
41
+ presence?: AvatarProps['badge'];
42
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,67 @@
1
+ # Progress Bar
2
+
3
+ A progress bar is a horizontal indicator that communicates the progress of an operation. Set `value` for determinate progress, or omit it for an indeterminate animation when the duration is unknown.
4
+
5
+ ## Usage
6
+
7
+ ```svelte
8
+ <script>
9
+ import { ProgressBar } from 'fluentui-svelte';
10
+ </script>
11
+
12
+ <ProgressBar value={50} />
13
+ ```
14
+
15
+ ## Component API
16
+
17
+ A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props section below.
18
+
19
+ ## Examples
20
+
21
+ ### Value
22
+
23
+ The value prop sets the current progress value of the bar. It should be a number between 0 and 100.
24
+
25
+ ```svelte
26
+ <ProgressBar value={30} />
27
+ <ProgressBar value={50} />
28
+ <ProgressBar value={70} />
29
+ ```
30
+
31
+ ### Indeterminate
32
+
33
+ If you do not set the value prop, the progress bar enters an indeterminate state, meaning it does not have a specific value. This is useful for operations where the duration is unknown.
34
+
35
+ ```svelte
36
+ <ProgressBar indeterminate />
37
+ ```
38
+
39
+ ### Hide Rail
40
+
41
+ The hideRail prop can be used to hide the progress bar rail.
42
+
43
+ ```svelte
44
+ <ProgressBar value={50} hideRail />
45
+ ```
46
+
47
+ ### Status
48
+
49
+ The status prop allows you to set the status of the progress bar to 'paused' or 'error'. This changes the color of the progress bar to indicate different states.
50
+
51
+ ```svelte
52
+ <ProgressBar value={50} status="paused" />
53
+ <ProgressBar value={50} status="error" />
54
+ ```
55
+
56
+ ## Component Props
57
+
58
+ | Name | Type | Description |
59
+ | ----------------------- | ------------------------------ | --------------------------------------------------------- |
60
+ | `value` | bindable `number \| undefined` | The current progress value of the bar, between 0 and 100. |
61
+ | `indeterminate` | `boolean` | If true, the progress bar enters an indeterminate state. |
62
+ | `hideRail` | `boolean` | If true, the progress bar rail is hidden. |
63
+ | `status` | `'paused' \| 'error'` | The current status of the progress bar. |
64
+ | `element` | bindable `SVGElement` | The DOM reference of the progress bar element. |
65
+ | `railElement` | bindable `SVGRectElement` | The DOM reference of the rail element. |
66
+ | `trackElement` | bindable `SVGRectElement` | The DOM reference of the track element. |
67
+ | `secondaryTrackElement` | bindable `SVGRectElement` | The DOM reference of the secondary track element. |
@@ -0,0 +1,167 @@
1
+ <script lang="ts">
2
+ import type { ProgressBarProps } from './types.js';
3
+
4
+ let {
5
+ status,
6
+ class: classes,
7
+ hideRail,
8
+ 'aria-label': ariaLabel,
9
+ min = 0,
10
+ max = 100,
11
+ value = $bindable(),
12
+ ref = $bindable(),
13
+ railElement = $bindable(),
14
+ trackElement = $bindable(),
15
+ secondaryTrackElement = $bindable(),
16
+ ...attributes
17
+ }: ProgressBarProps = $props();
18
+
19
+ let checkValue = $derived(typeof value === 'number' ? Math.max(min, Math.min(max, value)) : undefined);
20
+ </script>
21
+
22
+ <!-- @component
23
+ A progress bar component that displays a horizontal progress indicator.
24
+ - Usage:
25
+ ```tsx
26
+ <script>
27
+ import { ProgressBar } from 'fluentui-svelte';
28
+ </script>
29
+
30
+ <ProgressBar value={50} />
31
+ ```
32
+ -->
33
+ <svg
34
+ class={['fs-progress-bar', status && `status-${status}`, classes, typeof value !== 'number' && 'indeterminate']}
35
+ role="progressbar"
36
+ aria-label={ariaLabel ??
37
+ (typeof value !== 'number' ? (!status ? 'Loading' : `Status: ${status}`) : `Progress: ${checkValue}%`)}
38
+ width="100%"
39
+ height="3"
40
+ aria-valuemin={min}
41
+ aria-valuemax={max}
42
+ aria-valuenow={checkValue}
43
+ bind:this={ref}
44
+ {...attributes}
45
+ >
46
+ {#if !hideRail}
47
+ <rect bind:this={railElement} height="1" rx="0.5" y="1" width="100%" class="progress-bar-rail" />
48
+ {/if}
49
+ {#if typeof value !== 'number'}
50
+ <rect bind:this={secondaryTrackElement} height="3" ry="3" class="progress-bar-track progress-bar-secondary" />
51
+ {/if}
52
+ <rect
53
+ bind:this={trackElement}
54
+ width={typeof value === 'number' ? `${checkValue}%` : undefined}
55
+ height="3"
56
+ rx="1.5"
57
+ class="progress-bar-track"
58
+ />
59
+ </svg>
60
+
61
+ <style>
62
+ .fs-progress-bar {
63
+ display: flex;
64
+ align-items: center;
65
+ width: 100%;
66
+ height: 3px;
67
+ & .progress-bar-track {
68
+ height: 3px;
69
+ transition: width var(--fs-slow-duration) var(--fs-point-to-point);
70
+ fill: var(--fs-accent-fill-default);
71
+ }
72
+ & .progress-bar-rail {
73
+ fill: var(--fs-control-stroke-default);
74
+ width: 100%;
75
+ height: 1px;
76
+ }
77
+ &.indeterminate {
78
+ & .progress-bar-track {
79
+ animation-timing-function: ease-in-out;
80
+ &:nth-last-child(2) {
81
+ width: 30%;
82
+ animation: 2.5s infinite indeterminate-1;
83
+ }
84
+ &:last-child {
85
+ width: 50%;
86
+ animation: 2.5s infinite indeterminate-2;
87
+ }
88
+ }
89
+ }
90
+ &.status-paused {
91
+ .progress-bar-track {
92
+ fill: var(--fs-system-caution);
93
+ }
94
+ }
95
+ &.status-error {
96
+ .progress-bar-track {
97
+ fill: var(--fs-system-critical);
98
+ }
99
+ }
100
+ &.status-error.indeterminate,
101
+ &.status-paused.indeterminate {
102
+ .progress-bar-track {
103
+ animation: none;
104
+ width: 100%;
105
+ }
106
+ }
107
+ }
108
+ @keyframes indeterminate-1 {
109
+ 0% {
110
+ opacity: 1;
111
+ transform: translateX(-100%);
112
+ }
113
+ 75% {
114
+ opacity: 1;
115
+ transform: translateX(120%);
116
+ }
117
+ 76% {
118
+ opacity: 0;
119
+ }
120
+ 100% {
121
+ opacity: 0;
122
+ transform: translateX(180%);
123
+ }
124
+ }
125
+ @keyframes indeterminate-2 {
126
+ 0% {
127
+ opacity: 0;
128
+ transform: translateX(-100%);
129
+ }
130
+ 37.49% {
131
+ opacity: 0;
132
+ }
133
+ 37.5% {
134
+ opacity: 1;
135
+ transform: translateX(-50%);
136
+ }
137
+ 100% {
138
+ transform: translateX(120%);
139
+ opacity: 1;
140
+ }
141
+ }
142
+ @keyframes fs-pulse {
143
+ 0% {
144
+ opacity: 1;
145
+ }
146
+ 50% {
147
+ opacity: 0;
148
+ }
149
+ 100% {
150
+ opacity: 1;
151
+ }
152
+ }
153
+
154
+ /*
155
+ * Reduced motion swaps the spin for a pulse instead of shortening it — a 0ms spin is simply
156
+ * invisible.
157
+ */
158
+ :global(:root[data-fs-reduced-motion='true']) {
159
+ & .progress-bar-secondary {
160
+ display: none;
161
+ }
162
+ & .fs-progress-bar.indeterminate .progress-bar-track {
163
+ animation: fs-pulse 3s infinite linear;
164
+ stroke-dasharray: 0px;
165
+ }
166
+ }
167
+ </style>
@@ -0,0 +1,15 @@
1
+ import type { ProgressBarProps } from './types.ts';
2
+ /**
3
+ * A progress bar component that displays a horizontal progress indicator.
4
+ * - Usage:
5
+ * ```tsx
6
+ * <script>
7
+ * import { ProgressBar } from 'fluentui-svelte';
8
+ * </script>
9
+ *
10
+ * <ProgressBar value={50} />
11
+ * ```
12
+ */
13
+ declare const ProgressBar: import("svelte").Component<ProgressBarProps, {}, "ref" | "value" | "railElement" | "trackElement" | "secondaryTrackElement">;
14
+ type ProgressBar = ReturnType<typeof ProgressBar>;
15
+ export default ProgressBar;
@@ -0,0 +1,39 @@
1
+ import type { SVGAttributes } from 'svelte/elements';
2
+ import type { ProgressStatus } from '../../types/index.js';
3
+ /** @propsmith ProgressBarProps */
4
+ export type ProgressBarProps = {
5
+ /** The current value of the progress bar. Leave it unset for an indeterminate bar.
6
+ * @bindable
7
+ */
8
+ value?: number | null;
9
+ /** The class to apply to the progress bar. */
10
+ class?: string;
11
+ /** The DOM reference of the progress bar element.
12
+ * @bindable
13
+ */
14
+ ref?: SVGElement;
15
+ /** The minimum value of the progress bar.
16
+ * @default 0
17
+ */
18
+ min?: number;
19
+ /** The maximum value of the progress bar.
20
+ * @default 100
21
+ */
22
+ max?: number;
23
+ /** Whether to hide the rail element. */
24
+ hideRail?: boolean;
25
+ /** The DOM reference of the rail element.
26
+ * @bindable
27
+ */
28
+ railElement?: SVGRectElement;
29
+ /** The DOM reference of the secondary track element, used while indeterminate.
30
+ * @bindable
31
+ */
32
+ secondaryTrackElement?: SVGRectElement;
33
+ /** The DOM reference of the track element.
34
+ * @bindable
35
+ */
36
+ trackElement?: SVGRectElement;
37
+ /** The current status of the progress bar, which recolors the track. */
38
+ status?: ProgressStatus;
39
+ } & SVGAttributes<SVGElement>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ # Progress Ring
2
+
3
+ A circular progress indicator that shows determinate or indeterminate progress, with paused and error states.
4
+
5
+ ## Usage
6
+
7
+ ```svelte
8
+ <script>
9
+ import { ProgressRing } from 'fluentui-svelte';
10
+ </script>
11
+
12
+ <ProgressRing value={50} />
13
+ ```
14
+
15
+ ## Component API
16
+
17
+ A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props table below.
18
+
19
+ ## Examples
20
+
21
+ ### Value
22
+
23
+ The value prop determines the percentage of the progress ring that is filled. It should be a number between 0 and 100.
24
+
25
+ ```svelte
26
+ <ProgressRing value={0} />
27
+ <ProgressRing value={25} />
28
+ <ProgressRing value={50} />
29
+ <ProgressRing value={75} />
30
+ <ProgressRing value={100} />
31
+ ```
32
+
33
+ ### Indeterminate
34
+
35
+ The indeterminate prop allows the progress ring to display an indeterminate state, which is useful when the progress cannot be determined.
36
+
37
+ ```svelte
38
+ <ProgressRing indeterminate />
39
+ <ProgressRing indeterminate status="paused" />
40
+ <ProgressRing indeterminate status="error" />
41
+ ```
42
+
43
+ ### Hide Rail
44
+
45
+ The hideRail prop allows the progress ring to hide the rail, which is a background track for the progress indicator.
46
+
47
+ ```svelte
48
+ <ProgressRing value={50} hideRail />
49
+ <ProgressRing value={75} hideRail />
50
+ <ProgressRing value={100} hideRail />
51
+ ```
52
+
53
+ ### Status
54
+
55
+ The status prop allows you to set the status of the progress ring for visual feedback. It accepts values such as 'paused' or 'error'.
56
+
57
+ ```svelte
58
+ <ProgressRing value={40} />
59
+ <ProgressRing value={50} status="paused" />
60
+ <ProgressRing value={75} status="error" />
61
+ ```
62
+
63
+ ## Component Props
64
+
65
+ | Name | Type | Description |
66
+ | --------------- | --------------------- | ----------------------------------------------------------------- |
67
+ | `value` | `number` | The percentage of the progress ring that is filled. |
68
+ | `min` | `number` | The minimum value of the progress ring. Default is 0. |
69
+ | `max` | `number` | The maximum value of the progress ring. Default is 100. |
70
+ | `size` | `number` | The size of the progress ring in pixels. Default is 32. |
71
+ | `indeterminate` | `boolean` | If true, the progress ring displays an indeterminate state. |
72
+ | `hideRail` | `boolean` | If true, the progress ring hides the rail. |
73
+ | `status` | `'paused' \| 'error'` | The status of the progress ring, for example 'paused' or 'error'. |
74
+ | `ref` | `SVGElement` | The DOM reference to the SVG element. |
75
+ | `railElement` | `SVGCircleElement` | The DOM reference to the rail element. |
76
+ | `trackElement` | `SVGCircleElement` | The DOM reference to the track element. |