@spfx-fast/sharepoint-ui 0.4.3 → 0.5.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 (282) hide show
  1. package/QUICKSTART.md +13 -128
  2. package/README.md +19 -26
  3. package/components.json +240 -5834
  4. package/dist/accordion.d.ts +11 -0
  5. package/dist/accordion.js +4 -0
  6. package/dist/alert.d.ts +3 -0
  7. package/dist/alert.js +4 -0
  8. package/dist/attachment-list.d.ts +15 -0
  9. package/dist/attachment-list.js +14 -0
  10. package/dist/avatar-group.d.ts +12 -0
  11. package/dist/avatar-group.js +7 -0
  12. package/dist/avatar.d.ts +6 -0
  13. package/dist/avatar.js +5 -0
  14. package/dist/badge.d.ts +3 -0
  15. package/dist/badge.js +4 -0
  16. package/dist/breadcrumb.d.ts +10 -0
  17. package/dist/breadcrumb.js +9 -0
  18. package/dist/button-group.d.ts +6 -0
  19. package/dist/button-group.js +4 -0
  20. package/dist/button.d.ts +3 -0
  21. package/dist/button.js +4 -0
  22. package/dist/card.d.ts +3 -0
  23. package/dist/card.js +4 -0
  24. package/dist/carousel.d.ts +11 -0
  25. package/dist/carousel.js +6 -0
  26. package/dist/checkbox.d.ts +3 -0
  27. package/dist/checkbox.js +4 -0
  28. package/dist/combobox.d.ts +9 -0
  29. package/dist/combobox.js +6 -0
  30. package/dist/command-bar.d.ts +6 -0
  31. package/dist/command-bar.js +4 -0
  32. package/dist/copy-button.d.ts +7 -0
  33. package/dist/copy-button.js +19 -0
  34. package/dist/data-grid.d.ts +25 -0
  35. package/dist/data-grid.js +39 -0
  36. package/dist/date-range-picker.d.ts +12 -0
  37. package/dist/date-range-picker.js +4 -0
  38. package/dist/dialog.d.ts +9 -0
  39. package/dist/dialog.js +21 -0
  40. package/dist/divider.d.ts +3 -0
  41. package/dist/divider.js +4 -0
  42. package/dist/drawer.d.ts +6 -0
  43. package/dist/drawer.js +5 -0
  44. package/dist/empty-state.d.ts +7 -0
  45. package/dist/empty-state.js +5 -0
  46. package/dist/field.d.ts +15 -0
  47. package/dist/field.js +11 -0
  48. package/dist/file-dropzone.d.ts +15 -0
  49. package/dist/file-dropzone.js +21 -0
  50. package/dist/filter-bar.d.ts +9 -0
  51. package/dist/filter-bar.js +9 -0
  52. package/dist/image.d.ts +5 -0
  53. package/dist/image.js +4 -0
  54. package/dist/index.d.ts +68 -78
  55. package/dist/index.js +60 -68
  56. package/dist/input.d.ts +3 -0
  57. package/dist/input.js +4 -0
  58. package/dist/label.d.ts +3 -0
  59. package/dist/label.js +4 -0
  60. package/dist/link.d.ts +3 -0
  61. package/dist/link.js +9 -0
  62. package/dist/list-view.d.ts +29 -0
  63. package/dist/list-view.js +14 -0
  64. package/dist/list.d.ts +6 -0
  65. package/dist/list.js +5 -0
  66. package/dist/lookup-picker.d.ts +12 -0
  67. package/dist/lookup-picker.js +4 -0
  68. package/dist/menu.d.ts +6 -0
  69. package/dist/menu.js +4 -0
  70. package/dist/nav.d.ts +12 -0
  71. package/dist/nav.js +4 -0
  72. package/dist/pagination.d.ts +11 -0
  73. package/dist/pagination.js +5 -0
  74. package/dist/person-picker.d.ts +13 -0
  75. package/dist/person-picker.js +4 -0
  76. package/dist/persona.d.ts +7 -0
  77. package/dist/persona.js +5 -0
  78. package/dist/popover.d.ts +6 -0
  79. package/dist/popover.js +4 -0
  80. package/dist/progress-bar.d.ts +5 -0
  81. package/dist/progress-bar.js +5 -0
  82. package/dist/radio-group.d.ts +6 -0
  83. package/dist/radio-group.js +4 -0
  84. package/dist/radio.d.ts +3 -0
  85. package/dist/radio.js +4 -0
  86. package/dist/rating.d.ts +8 -0
  87. package/dist/rating.js +5 -0
  88. package/dist/react.d.ts +1 -4715
  89. package/dist/react.js +1 -7097
  90. package/dist/select.d.ts +3 -0
  91. package/dist/select.js +4 -0
  92. package/dist/sharepoint-field.d.ts +18 -0
  93. package/dist/sharepoint-field.js +54 -0
  94. package/dist/skeleton.d.ts +6 -0
  95. package/dist/skeleton.js +9 -0
  96. package/dist/spinner.d.ts +5 -0
  97. package/dist/spinner.js +4 -0
  98. package/dist/swatch-picker.d.ts +17 -0
  99. package/dist/swatch-picker.js +11 -0
  100. package/dist/switch.d.ts +3 -0
  101. package/dist/switch.js +4 -0
  102. package/dist/table.d.ts +6 -0
  103. package/dist/table.js +4 -0
  104. package/dist/tabs.d.ts +14 -0
  105. package/dist/tabs.js +30 -0
  106. package/dist/tag-group.d.ts +6 -0
  107. package/dist/tag-group.js +4 -0
  108. package/dist/tag-picker.d.ts +12 -0
  109. package/dist/tag-picker.js +4 -0
  110. package/dist/tag.d.ts +7 -0
  111. package/dist/tag.js +5 -0
  112. package/dist/text.d.ts +5 -0
  113. package/dist/text.js +4 -0
  114. package/dist/textarea.d.ts +3 -0
  115. package/dist/textarea.js +4 -0
  116. package/dist/theme.d.ts +15 -175
  117. package/dist/theme.js +36 -239
  118. package/dist/toast.d.ts +9 -0
  119. package/dist/toast.js +12 -0
  120. package/dist/tree.d.ts +13 -0
  121. package/dist/tree.js +9 -0
  122. package/dist/view-card.d.ts +8 -0
  123. package/dist/view-card.js +4 -0
  124. package/dist/view-switcher.d.ts +13 -0
  125. package/dist/view-switcher.js +7 -0
  126. package/dist/virtual-list.d.ts +11 -0
  127. package/dist/virtual-list.js +25 -0
  128. package/measurements.json +365 -0
  129. package/package.json +14 -46
  130. package/src/theme.css +125 -0
  131. package/AGENTS.md +0 -231
  132. package/dist/appearance.d.ts +0 -6
  133. package/dist/appearance.js +0 -217
  134. package/dist/elements/accordion.d.ts +0 -9
  135. package/dist/elements/accordion.js +0 -338
  136. package/dist/elements/alert.d.ts +0 -2
  137. package/dist/elements/alert.js +0 -86
  138. package/dist/elements/avatar-group-primitives.d.ts +0 -3
  139. package/dist/elements/avatar-group-primitives.js +0 -189
  140. package/dist/elements/avatar-group.d.ts +0 -2
  141. package/dist/elements/avatar-group.js +0 -110
  142. package/dist/elements/avatar.d.ts +0 -4
  143. package/dist/elements/avatar.js +0 -251
  144. package/dist/elements/badge.d.ts +0 -8
  145. package/dist/elements/badge.js +0 -182
  146. package/dist/elements/breadcrumb.d.ts +0 -4
  147. package/dist/elements/breadcrumb.js +0 -233
  148. package/dist/elements/button-group.d.ts +0 -1
  149. package/dist/elements/button-group.js +0 -20
  150. package/dist/elements/button-variants.d.ts +0 -6
  151. package/dist/elements/button-variants.js +0 -339
  152. package/dist/elements/button.d.ts +0 -5
  153. package/dist/elements/button.js +0 -233
  154. package/dist/elements/card-primitives.d.ts +0 -3
  155. package/dist/elements/card-primitives.js +0 -83
  156. package/dist/elements/card.d.ts +0 -5
  157. package/dist/elements/card.js +0 -213
  158. package/dist/elements/carousel.d.ts +0 -92
  159. package/dist/elements/carousel.js +0 -1115
  160. package/dist/elements/color-picker.d.ts +0 -24
  161. package/dist/elements/color-picker.js +0 -1004
  162. package/dist/elements/combobox.d.ts +0 -1
  163. package/dist/elements/combobox.js +0 -1012
  164. package/dist/elements/data-grid-model.d.ts +0 -120
  165. package/dist/elements/data-grid-model.js +0 -294
  166. package/dist/elements/data-grid.d.ts +0 -30
  167. package/dist/elements/data-grid.js +0 -1576
  168. package/dist/elements/date-picker.d.ts +0 -1
  169. package/dist/elements/date-picker.js +0 -486
  170. package/dist/elements/dialog.d.ts +0 -23
  171. package/dist/elements/dialog.js +0 -409
  172. package/dist/elements/divider.d.ts +0 -2
  173. package/dist/elements/divider.js +0 -66
  174. package/dist/elements/drawer.d.ts +0 -3
  175. package/dist/elements/drawer.js +0 -308
  176. package/dist/elements/field-composition.d.ts +0 -26
  177. package/dist/elements/field-composition.js +0 -133
  178. package/dist/elements/field.d.ts +0 -1
  179. package/dist/elements/field.js +0 -67
  180. package/dist/elements/file-upload.d.ts +0 -6
  181. package/dist/elements/file-upload.js +0 -211
  182. package/dist/elements/floating-position.d.ts +0 -36
  183. package/dist/elements/floating-position.js +0 -92
  184. package/dist/elements/image.d.ts +0 -28
  185. package/dist/elements/image.js +0 -38
  186. package/dist/elements/info.d.ts +0 -9
  187. package/dist/elements/info.js +0 -102
  188. package/dist/elements/input.d.ts +0 -5
  189. package/dist/elements/input.js +0 -255
  190. package/dist/elements/label.d.ts +0 -15
  191. package/dist/elements/label.js +0 -56
  192. package/dist/elements/link.d.ts +0 -1
  193. package/dist/elements/link.js +0 -92
  194. package/dist/elements/list.d.ts +0 -19
  195. package/dist/elements/list.js +0 -297
  196. package/dist/elements/menu.d.ts +0 -33
  197. package/dist/elements/menu.js +0 -1103
  198. package/dist/elements/message-bar.d.ts +0 -10
  199. package/dist/elements/message-bar.js +0 -327
  200. package/dist/elements/nav.d.ts +0 -32
  201. package/dist/elements/nav.js +0 -794
  202. package/dist/elements/overflow.d.ts +0 -10
  203. package/dist/elements/overflow.js +0 -218
  204. package/dist/elements/persona.d.ts +0 -3
  205. package/dist/elements/persona.js +0 -125
  206. package/dist/elements/popover.d.ts +0 -77
  207. package/dist/elements/popover.js +0 -840
  208. package/dist/elements/progress-bar.d.ts +0 -4
  209. package/dist/elements/progress-bar.js +0 -82
  210. package/dist/elements/radio-group.d.ts +0 -1
  211. package/dist/elements/radio-group.js +0 -303
  212. package/dist/elements/rating-display.d.ts +0 -2
  213. package/dist/elements/rating-display.js +0 -125
  214. package/dist/elements/rating.d.ts +0 -2
  215. package/dist/elements/rating.js +0 -206
  216. package/dist/elements/rich-text-editor.d.ts +0 -32
  217. package/dist/elements/rich-text-editor.js +0 -1367
  218. package/dist/elements/search.d.ts +0 -3
  219. package/dist/elements/search.js +0 -200
  220. package/dist/elements/select.d.ts +0 -6
  221. package/dist/elements/select.js +0 -291
  222. package/dist/elements/shared.d.ts +0 -22
  223. package/dist/elements/shared.js +0 -409
  224. package/dist/elements/sharepoint-field-basic-controls.d.ts +0 -1
  225. package/dist/elements/sharepoint-field-basic-controls.js +0 -14
  226. package/dist/elements/sharepoint-fields.d.ts +0 -29
  227. package/dist/elements/sharepoint-fields.js +0 -460
  228. package/dist/elements/skeleton.d.ts +0 -6
  229. package/dist/elements/skeleton.js +0 -91
  230. package/dist/elements/slider.d.ts +0 -1
  231. package/dist/elements/slider.js +0 -248
  232. package/dist/elements/spin-button.d.ts +0 -7
  233. package/dist/elements/spin-button.js +0 -499
  234. package/dist/elements/spinner.d.ts +0 -4
  235. package/dist/elements/spinner.js +0 -124
  236. package/dist/elements/swatch-picker.d.ts +0 -5
  237. package/dist/elements/swatch-picker.js +0 -363
  238. package/dist/elements/table.d.ts +0 -21
  239. package/dist/elements/table.js +0 -261
  240. package/dist/elements/tabs.d.ts +0 -1
  241. package/dist/elements/tabs.js +0 -276
  242. package/dist/elements/tag-picker.d.ts +0 -29
  243. package/dist/elements/tag-picker.js +0 -715
  244. package/dist/elements/tags.d.ts +0 -21
  245. package/dist/elements/tags.js +0 -421
  246. package/dist/elements/teaching-popover.d.ts +0 -32
  247. package/dist/elements/teaching-popover.js +0 -412
  248. package/dist/elements/text.d.ts +0 -9
  249. package/dist/elements/text.js +0 -75
  250. package/dist/elements/textarea.d.ts +0 -1
  251. package/dist/elements/textarea.js +0 -182
  252. package/dist/elements/toast.d.ts +0 -25
  253. package/dist/elements/toast.js +0 -337
  254. package/dist/elements/toaster.d.ts +0 -6
  255. package/dist/elements/toaster.js +0 -357
  256. package/dist/elements/toggle.d.ts +0 -2
  257. package/dist/elements/toggle.js +0 -246
  258. package/dist/elements/toolbar.d.ts +0 -12
  259. package/dist/elements/toolbar.js +0 -381
  260. package/dist/elements/tooltip.d.ts +0 -76
  261. package/dist/elements/tooltip.js +0 -527
  262. package/dist/elements/tree-model.d.ts +0 -19
  263. package/dist/elements/tree-model.js +0 -34
  264. package/dist/elements/tree.d.ts +0 -5
  265. package/dist/elements/tree.js +0 -273
  266. package/dist/elements/view-card.d.ts +0 -2
  267. package/dist/elements/view-card.js +0 -78
  268. package/dist/elements/virtual-list.d.ts +0 -41
  269. package/dist/elements/virtual-list.js +0 -369
  270. package/dist/elements.d.ts +0 -73
  271. package/dist/elements.js +0 -210
  272. package/dist/sharepoint-fields.d.ts +0 -135
  273. package/dist/sharepoint-fields.js +0 -402
  274. package/dist/virtualizer-hooks.d.ts +0 -80
  275. package/dist/virtualizer-hooks.js +0 -253
  276. package/scripts/generate-token-index.mjs +0 -43
  277. package/scripts/sync-component-catalog-signatures.mjs +0 -55
  278. package/scripts/validate-component-catalog.mjs +0 -44
  279. package/skills/sharepoint-ui/SKILL.md +0 -12
  280. package/skills/sharepoint-ui/references/choosing-components.md +0 -20
  281. package/skills/sharepoint-ui/references/sharepoint-patterns.md +0 -17
  282. package/tokens.json +0 -3777
@@ -0,0 +1,3 @@
1
+ import { type ReactElement, type SelectHTMLAttributes } from "react";
2
+ export type SelectProps = SelectHTMLAttributes<HTMLSelectElement>;
3
+ export declare function Select({ className, ...props }: SelectProps): ReactElement;
package/dist/select.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function Select({ className = "", ...props }) {
3
+ return createElement("select", { ...props, className: `spui-select ${className}`.trim() });
4
+ }
@@ -0,0 +1,18 @@
1
+ import { type HTMLAttributes, type ReactElement } from "react";
2
+ import { type LookupOption } from "./lookup-picker.js";
3
+ import { type PersonOption } from "./person-picker.js";
4
+ export type SharePointFieldType = "text" | "multiline" | "number" | "date" | "boolean" | "choice" | "person" | "lookup";
5
+ export type SharePointFieldProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
6
+ name: string;
7
+ label: string;
8
+ type: SharePointFieldType;
9
+ value?: string | boolean;
10
+ defaultValue?: string | boolean;
11
+ required?: boolean;
12
+ hint?: string;
13
+ choices?: readonly string[];
14
+ people?: readonly PersonOption[];
15
+ lookups?: readonly LookupOption[];
16
+ onValueChange?: (value: string | boolean) => void;
17
+ };
18
+ export declare function SharePointField({ name, label, type, value, defaultValue, required, hint, choices, people, lookups, onValueChange, className, ...props }: SharePointFieldProps): ReactElement;
@@ -0,0 +1,54 @@
1
+ import { createElement, useId } from "react";
2
+ import { Checkbox } from "./checkbox.js";
3
+ import { Field } from "./field.js";
4
+ import { Input } from "./input.js";
5
+ import { LookupPicker } from "./lookup-picker.js";
6
+ import { PersonPicker } from "./person-picker.js";
7
+ import { Select } from "./select.js";
8
+ import { TextArea } from "./textarea.js";
9
+ export function SharePointField({ name, label, type, value, defaultValue, required, hint, choices = [], people = [], lookups = [], onValueChange, className = "", ...props }) {
10
+ const id = useId();
11
+ const onStringChange = (event) => onValueChange?.(event.currentTarget.value);
12
+ const control = type === "boolean"
13
+ ? createElement(Checkbox, {
14
+ name, required,
15
+ checked: value === undefined ? undefined : Boolean(value),
16
+ defaultChecked: value === undefined ? Boolean(defaultValue) : undefined,
17
+ onChange: event => onValueChange?.(event.currentTarget.checked),
18
+ })
19
+ : type === "choice"
20
+ ? createElement(Select, {
21
+ name, required, onChange: onStringChange,
22
+ value: value === undefined ? undefined : typeof value === "string" ? value : "",
23
+ defaultValue: value === undefined ? typeof defaultValue === "string" ? defaultValue : "" : undefined,
24
+ }, createElement("option", { value: "" }, "Choose an option"), choices.map(choice => createElement("option", { key: choice, value: choice }, choice)))
25
+ : type === "person"
26
+ ? createElement(PersonPicker, {
27
+ id, name, label, options: people, required, onChange: onStringChange,
28
+ value: typeof value === "string" ? value : undefined,
29
+ defaultValue: typeof value === "string" ? undefined : typeof defaultValue === "string" ? defaultValue : undefined,
30
+ "aria-describedby": hint ? `${id}-hint` : undefined,
31
+ })
32
+ : type === "lookup"
33
+ ? createElement(LookupPicker, {
34
+ id, name, label, options: lookups, required, onChange: onStringChange,
35
+ value: typeof value === "string" ? value : undefined,
36
+ defaultValue: typeof value === "string" ? undefined : typeof defaultValue === "string" ? defaultValue : undefined,
37
+ "aria-describedby": hint ? `${id}-hint` : undefined,
38
+ })
39
+ : type === "multiline"
40
+ ? createElement(TextArea, {
41
+ name, required, onChange: onStringChange,
42
+ value: value === undefined ? undefined : typeof value === "string" ? value : "",
43
+ defaultValue: value === undefined ? typeof defaultValue === "string" ? defaultValue : "" : undefined,
44
+ })
45
+ : createElement(Input, {
46
+ name, type: type === "number" || type === "date" ? type : "text",
47
+ required, onChange: onStringChange,
48
+ value: value === undefined ? undefined : typeof value === "string" ? value : "",
49
+ defaultValue: value === undefined ? typeof defaultValue === "string" ? defaultValue : "" : undefined,
50
+ });
51
+ return createElement("div", { ...props, className: `spui-sharepoint-field ${className}`.trim() }, type === "person" || type === "lookup"
52
+ ? control
53
+ : createElement(Field, { id, label, hint, required, children: control }), (type === "person" || type === "lookup") && hint && createElement("span", { id: `${id}-hint`, className: "spui-hint" }, hint));
54
+ }
@@ -0,0 +1,6 @@
1
+ import { type CSSProperties, type HTMLAttributes, type ReactElement } from "react";
2
+ export type SkeletonProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
3
+ width?: CSSProperties["width"];
4
+ height?: CSSProperties["height"];
5
+ };
6
+ export declare function Skeleton({ width, height, className, style, ...props }: SkeletonProps): ReactElement;
@@ -0,0 +1,9 @@
1
+ import { createElement } from "react";
2
+ export function Skeleton({ width = "100%", height = "1em", className = "", style, ...props }) {
3
+ return createElement("span", {
4
+ ...props,
5
+ "aria-hidden": true,
6
+ className: `spui-skeleton ${className}`.trim(),
7
+ style: { ...style, width, height },
8
+ });
9
+ }
@@ -0,0 +1,5 @@
1
+ import { type HTMLAttributes, type ReactElement } from "react";
2
+ export type SpinnerProps = Omit<HTMLAttributes<HTMLSpanElement>, "children" | "aria-label"> & {
3
+ label: string;
4
+ };
5
+ export declare function Spinner({ label, className, ...props }: SpinnerProps): ReactElement;
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function Spinner({ label, className = "", ...props }) {
3
+ return createElement("span", { ...props, role: "status", "aria-label": label, className: `spui-spinner ${className}`.trim() }, createElement("span", { "aria-hidden": true }));
4
+ }
@@ -0,0 +1,17 @@
1
+ import { type ChangeEventHandler, type FieldsetHTMLAttributes, type ReactElement } from "react";
2
+ export type SwatchOption = {
3
+ value: string;
4
+ label: string;
5
+ color?: string;
6
+ src?: string;
7
+ disabled?: boolean;
8
+ };
9
+ export type SwatchPickerProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "name"> & {
10
+ name: string;
11
+ label: string;
12
+ options: readonly SwatchOption[];
13
+ value?: string;
14
+ defaultValue?: string;
15
+ onChange?: ChangeEventHandler<HTMLInputElement>;
16
+ };
17
+ export declare function SwatchPicker({ name, label, options, value, defaultValue, onChange, className, ...props }: SwatchPickerProps): ReactElement;
@@ -0,0 +1,11 @@
1
+ import { createElement, useId } from "react";
2
+ export function SwatchPicker({ name, label, options, value, defaultValue, onChange, className = "", ...props }) {
3
+ const id = useId();
4
+ return createElement("fieldset", { ...props, className: `spui-swatch-picker ${className}`.trim() }, createElement("legend", null, label), options.map((option, index) => createElement("label", { key: option.value, htmlFor: `${id}-${index}`, className: "spui-swatch-option" }, createElement("input", {
5
+ id: `${id}-${index}`, type: "radio", name, value: option.value, disabled: option.disabled,
6
+ checked: value === undefined ? undefined : value === option.value,
7
+ defaultChecked: value === undefined && defaultValue === option.value,
8
+ onChange,
9
+ }), option.src ? createElement("img", { src: option.src, alt: "", "aria-hidden": true, className: "spui-swatch-dot" })
10
+ : createElement("span", { "aria-hidden": true, className: "spui-swatch-dot", style: { backgroundColor: option.color } }), createElement("span", { className: "spui-swatch-label" }, option.label))));
11
+ }
@@ -0,0 +1,3 @@
1
+ import { type InputHTMLAttributes, type ReactElement } from "react";
2
+ export type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type">;
3
+ export declare function Switch({ className, role, ...props }: SwitchProps): ReactElement;
package/dist/switch.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function Switch({ className = "", role = "switch", ...props }) {
3
+ return createElement("input", { ...props, type: "checkbox", role, className: `spui-switch ${className}`.trim() });
4
+ }
@@ -0,0 +1,6 @@
1
+ import { type ReactElement, type ReactNode, type TableHTMLAttributes } from "react";
2
+ export type TableProps = Omit<TableHTMLAttributes<HTMLTableElement>, "children"> & {
3
+ caption: string;
4
+ children?: ReactNode;
5
+ };
6
+ export declare function Table({ caption, children, className, ...props }: TableProps): ReactElement;
package/dist/table.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function Table({ caption, children, className = "", ...props }) {
3
+ return createElement("table", { ...props, className: `spui-table ${className}`.trim() }, createElement("caption", null, caption), children);
4
+ }
package/dist/tabs.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
+ export type TabItem = {
3
+ id: string;
4
+ label: ReactNode;
5
+ content: ReactNode;
6
+ };
7
+ export type TabsProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
8
+ label: string;
9
+ items: readonly TabItem[];
10
+ value?: string;
11
+ defaultValue?: string;
12
+ onValueChange?: (value: string) => void;
13
+ };
14
+ export declare function Tabs({ label, items, value, defaultValue, onValueChange, className, ...props }: TabsProps): ReactElement;
package/dist/tabs.js ADDED
@@ -0,0 +1,30 @@
1
+ import { createElement, useId, useState } from "react";
2
+ export function Tabs({ label, items, value, defaultValue, onValueChange, className = "", ...props }) {
3
+ const baseId = useId();
4
+ const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id ?? "");
5
+ const selected = value ?? internalValue;
6
+ const select = (next) => {
7
+ if (value === undefined)
8
+ setInternalValue(next);
9
+ onValueChange?.(next);
10
+ };
11
+ const moveFocus = (event) => {
12
+ if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key) || !items.length)
13
+ return;
14
+ event.preventDefault();
15
+ const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
16
+ const current = [...event.currentTarget.querySelectorAll("[role=tab]")].indexOf(event.target);
17
+ const next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1
18
+ : (current + (event.key === "ArrowRight" !== rtl ? 1 : -1) + items.length) % items.length;
19
+ event.currentTarget.querySelectorAll("[role=tab]")[next]?.focus();
20
+ select(items[next].id);
21
+ };
22
+ const activeIndex = Math.max(0, items.findIndex(item => item.id === selected));
23
+ return createElement("div", { ...props, className: `spui-tabs ${className}`.trim() }, createElement("div", { role: "tablist", "aria-label": label, onKeyDown: moveFocus }, items.map((item, index) => createElement("button", {
24
+ key: item.id, id: `${baseId}-tab-${index}`, type: "button", role: "tab",
25
+ "aria-selected": index === activeIndex, "aria-controls": `${baseId}-panel-${index}`,
26
+ tabIndex: index === activeIndex ? 0 : -1, onClick: () => select(item.id),
27
+ }, item.label))), items.map((item, index) => index === activeIndex && createElement("div", {
28
+ key: item.id, id: `${baseId}-panel-${index}`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${baseId}-tab-${index}`,
29
+ }, item.content)));
30
+ }
@@ -0,0 +1,6 @@
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
+ export type TagGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "aria-label"> & {
3
+ label: string;
4
+ children?: ReactNode;
5
+ };
6
+ export declare function TagGroup({ label, className, children, ...props }: TagGroupProps): ReactElement;
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function TagGroup({ label, className = "", children, ...props }) {
3
+ return createElement("div", { ...props, role: "group", "aria-label": label, className: `spui-tag-group ${className}`.trim() }, children);
4
+ }
@@ -0,0 +1,12 @@
1
+ import { type ReactElement, type SelectHTMLAttributes } from "react";
2
+ export type TagPickerOption = {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ };
7
+ export type TagPickerProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, "children" | "id" | "multiple"> & {
8
+ id: string;
9
+ label: string;
10
+ options: readonly TagPickerOption[];
11
+ };
12
+ export declare function TagPicker({ id, label, options, className, size, ...props }: TagPickerProps): ReactElement;
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function TagPicker({ id, label, options, className = "", size = 4, ...props }) {
3
+ return createElement("div", { className: "spui-field" }, createElement("label", { htmlFor: id }, label), createElement("select", { ...props, id, multiple: true, size, className: `spui-select spui-tag-picker ${className}`.trim() }, options.map(option => createElement("option", { key: option.value, value: option.value, disabled: option.disabled }, option.label))));
4
+ }
package/dist/tag.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
+ export type TagProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
3
+ children?: ReactNode;
4
+ onRemove?: () => void;
5
+ removeLabel?: string;
6
+ };
7
+ export declare function Tag({ className, children, onRemove, removeLabel, ...props }: TagProps): ReactElement;
package/dist/tag.js ADDED
@@ -0,0 +1,5 @@
1
+ import { createElement } from "react";
2
+ export function Tag({ className = "", children, onRemove, removeLabel, ...props }) {
3
+ const label = removeLabel ?? (typeof children === "string" ? `Remove ${children}` : "Remove tag");
4
+ return createElement("span", { ...props, className: `spui-tag ${className}`.trim() }, children, onRemove && createElement("button", { type: "button", className: "spui-tag-remove", "aria-label": label, onClick: onRemove }, "Remove"));
5
+ }
package/dist/text.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { type HTMLAttributes, type ReactElement } from "react";
2
+ export type TextProps = HTMLAttributes<HTMLElement> & {
3
+ as?: "p" | "span" | "strong" | "small" | "div";
4
+ };
5
+ export declare function Text({ as, className, ...props }: TextProps): ReactElement;
package/dist/text.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function Text({ as = "p", className = "", ...props }) {
3
+ return createElement(as, { ...props, className: `spui-text ${className}`.trim() });
4
+ }
@@ -0,0 +1,3 @@
1
+ import { type ReactElement, type TextareaHTMLAttributes } from "react";
2
+ export type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement>;
3
+ export declare function TextArea({ className, ...props }: TextAreaProps): ReactElement;
@@ -0,0 +1,4 @@
1
+ import { createElement } from "react";
2
+ export function TextArea({ className = "", ...props }) {
3
+ return createElement("textarea", { ...props, className: `spui-textarea ${className}`.trim() });
4
+ }
package/dist/theme.d.ts CHANGED
@@ -1,177 +1,17 @@
1
- import { type SharePointUIAppearance, type SharePointUIBaseAppearance, type SharePointUIDensity, type SharePointUIStyleTokens } from "./appearance.js";
2
- /** SPFx theme data is copied through without a lossy, hand-maintained token allowlist. */
1
+ import { type ReactNode } from "react";
3
2
  export type SharePointTheme = {
4
- palette?: Record<string, string | undefined>;
5
- semanticColors?: Record<string, string | undefined>;
6
- /** Raw Fluent v8 theme tokens exposed as `--spui-effects-*`, `--spui-spacing-*`, and `--spui-fonts-*-*` variables. */
7
- effects?: Record<string, string | undefined>;
8
- spacing?: Record<string, string | undefined>;
9
- fonts?: Record<string, Record<string, string | number | undefined> | undefined>;
10
- defaultFontStyle?: Record<string, string | number | undefined>;
11
- isInverted?: boolean;
3
+ accent: string;
4
+ accentText: string;
5
+ background: string;
6
+ border: string;
7
+ radius: string;
8
+ surface: string;
9
+ text: string;
10
+ muted: string;
12
11
  };
13
- export type FluentThemeTokens = Record<string, string | number | undefined>;
14
- /** Semantic theme values are translated to the library's shared design tokens. */
15
- export type SharePointUIDesignTheme = {
16
- /** Raw named SharePoint palette values, exposed as `--spui-palette-*` CSS variables. `themePrimary` also seeds the accent when no explicit accent is set. */
17
- palette?: Record<string, string>;
18
- /** Any Fluent v9 theme values, exposed under their native CSS variable names and composable with the other design-pack groups. */
19
- fluentTokens?: FluentThemeTokens;
20
- /** Brand seed for an accent scale and softly tinted surfaces. Hex values also get an AA-aware on-accent foreground; other CSS colors can set colors.accentForeground explicitly. */
21
- brandColor?: string;
22
- /** App- or component-specific CSS custom properties, merged after semantic roles and before direct provider tokens. */
23
- customProperties?: Record<`--${string}`, string | number>;
24
- colors?: {
25
- accent?: string;
26
- accentHover?: string;
27
- accentPressed?: string;
28
- accentSubtle?: string;
29
- accentSubtleHover?: string;
30
- accentSubtlePressed?: string;
31
- accentForeground?: string;
32
- secondaryHover?: string;
33
- foreground?: string;
34
- foregroundMuted?: string;
35
- foregroundTertiary?: string;
36
- foregroundSubtle?: string;
37
- foregroundDisabled?: string;
38
- canvas?: string;
39
- surface?: string;
40
- surfaceHover?: string;
41
- surfaceAlt?: string;
42
- surfaceSecondary?: string;
43
- surfaceSubtle?: string;
44
- surfaceRaised?: string;
45
- surfaceSunken?: string;
46
- border?: string;
47
- borderSubtle?: string;
48
- borderStrong?: string;
49
- borderFocus?: string;
50
- borderDisabled?: string;
51
- selectedBackground?: string;
52
- selectedBackgroundHover?: string;
53
- selectedForeground?: string;
54
- selectedBorder?: string;
55
- link?: string;
56
- linkVisited?: string;
57
- overlay?: string;
58
- info?: string;
59
- infoSurface?: string;
60
- success?: string;
61
- successSurface?: string;
62
- warning?: string;
63
- warningSurface?: string;
64
- danger?: string;
65
- dangerSurface?: string;
66
- focus?: string;
67
- focusRing?: string;
68
- };
69
- typography?: {
70
- fontFamily?: string;
71
- fontFamilyMono?: string;
72
- fontSize?: string;
73
- fontSizeSmall?: string;
74
- fontSizeLarge?: string;
75
- fontSizeHeading?: string;
76
- fontWeight?: string | number;
77
- fontWeightStrong?: string | number;
78
- lineHeight?: string;
79
- lineHeightHeading?: string;
80
- /** Fluent-compatible type ramp; values flow to the same CSS variables used by the component styles. */
81
- fontSize100?: string;
82
- fontSize200?: string;
83
- fontSize300?: string;
84
- fontSize400?: string;
85
- fontSize500?: string;
86
- fontSize600?: string;
87
- fontSize700?: string;
88
- fontSize800?: string;
89
- fontSize900?: string;
90
- fontSize1000?: string;
91
- fontSize1100?: string;
92
- fontSize1200?: string;
93
- lineHeight100?: string;
94
- lineHeight200?: string;
95
- lineHeight300?: string;
96
- lineHeight400?: string;
97
- lineHeight500?: string;
98
- lineHeight600?: string;
99
- lineHeight700?: string;
100
- lineHeight800?: string;
101
- lineHeight900?: string;
102
- lineHeight1000?: string;
103
- lineHeight1100?: string;
104
- lineHeight1200?: string;
105
- fontWeightRegular?: string | number;
106
- fontWeightMedium?: string | number;
107
- fontWeightSemibold?: string | number;
108
- fontWeightBold?: string | number;
109
- letterSpacing?: string;
110
- };
111
- spacing?: {
112
- controlHeight?: string;
113
- controlGap?: string;
114
- controlPaddingInline?: string;
115
- controlPaddingBlock?: string;
116
- cardPadding?: string;
117
- fieldGap?: string;
118
- sectionGap?: string;
119
- listGap?: string;
120
- touchTargetMin?: string;
121
- };
122
- shape?: {
123
- controlRadius?: string;
124
- inputRadius?: string;
125
- cardRadius?: string;
126
- surfaceRadius?: string;
127
- pillRadius?: string;
128
- focusRingWidth?: string;
129
- };
130
- elevation?: {
131
- cardShadow?: string;
132
- controlShadow?: string;
133
- popoverShadow?: string;
134
- overlayShadow?: string;
135
- focusShadow?: string;
136
- };
137
- /** Material controls tune theme-derived translucent surfaces without replacing their brand or neutral colors. */
138
- materials?: {
139
- glassBlur?: string;
140
- glassSaturation?: string;
141
- glassSurfaceOpacity?: string;
142
- glassCanvasOpacity?: string;
143
- glassBorderOpacity?: string;
144
- };
145
- motion?: {
146
- durationFast?: string;
147
- durationNormal?: string;
148
- durationSlow?: string;
149
- easingStandard?: string;
150
- easingEmphasized?: string;
151
- };
152
- /** Shared stacking order for menus, floating pickers, and notifications. Browser top-layer surfaces remain above these layers. */
153
- layers?: {
154
- dropdown?: string | number;
155
- popover?: string | number;
156
- toast?: string | number;
157
- };
158
- };
159
- export type SharePointThemeColorPreset = {
160
- name: string;
161
- value: string;
162
- color: string;
163
- label: string;
164
- };
165
- /** Build named swatches from the current SharePoint palette; custom tenant keys are preserved. */
166
- export declare function getSharePointThemeColorPresets(palette?: Readonly<Record<string, string | undefined>>, labelForKey?: (key: string) => string): SharePointThemeColorPreset[];
167
- /** Compose reusable theme packs left-to-right; later packs override earlier values within each group. */
168
- export declare function composeSharePointUIDesignThemes(...themes: Array<SharePointUIDesignTheme | undefined>): SharePointUIDesignTheme;
169
- export declare function getSharePointUIDesignTokens(theme?: SharePointUIDesignTheme): Record<string, string>;
170
- export type SharePointUIThemeOptions = {
171
- appearance?: SharePointUIAppearance;
172
- baseAppearance?: SharePointUIBaseAppearance;
173
- density?: SharePointUIDensity;
174
- theme?: SharePointUIDesignTheme;
175
- tokens?: Partial<SharePointUIStyleTokens>;
176
- };
177
- export declare function applySharePointTheme(target: HTMLElement, theme?: SharePointTheme, fluentTokens?: FluentThemeTokens, options?: SharePointUIThemeOptions): void;
12
+ export declare function createSharePointTheme(overrides?: Partial<SharePointTheme>): SharePointTheme;
13
+ export declare function SharePointThemeProvider({ children, theme, }: {
14
+ children: ReactNode;
15
+ theme?: Partial<SharePointTheme>;
16
+ }): import("react").FunctionComponentElement<import("react").ProviderProps<SharePointTheme>>;
17
+ export declare function useSharePointTheme(): SharePointTheme;