@jcsoftdev/ui 0.3.0 → 0.4.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 (268) hide show
  1. package/CHANGELOG.md +103 -1
  2. package/README.md +55 -2
  3. package/bin/ui-theme.mjs +13 -2
  4. package/dist/atoms/checkbox/checkbox.js +3 -1
  5. package/dist/atoms/chip/chip.d.ts +11 -3
  6. package/dist/atoms/chip/chip.js +8 -1
  7. package/dist/atoms/chip/index.d.ts +1 -1
  8. package/dist/atoms/chip/index.js +2 -0
  9. package/dist/atoms/due-chip/due-chip.d.ts +31 -0
  10. package/dist/atoms/due-chip/due-chip.js +41 -0
  11. package/dist/atoms/due-chip/index.d.ts +2 -0
  12. package/dist/atoms/due-chip/index.js +6 -0
  13. package/dist/atoms/due-chip/model.d.ts +25 -0
  14. package/dist/atoms/due-chip/model.js +44 -0
  15. package/dist/atoms/icon-button/icon-button.d.ts +22 -0
  16. package/dist/atoms/icon-button/icon-button.js +38 -0
  17. package/dist/atoms/icon-button/index.d.ts +1 -0
  18. package/dist/atoms/icon-button/index.js +8 -0
  19. package/dist/atoms/index.d.ts +5 -0
  20. package/dist/atoms/index.js +5 -0
  21. package/dist/atoms/internal/hit-area.d.ts +6 -0
  22. package/dist/atoms/internal/hit-area.js +4 -0
  23. package/dist/atoms/kbd/index.d.ts +1 -0
  24. package/dist/atoms/kbd/index.js +4 -0
  25. package/dist/atoms/kbd/kbd.d.ts +7 -0
  26. package/dist/atoms/kbd/kbd.js +17 -0
  27. package/dist/atoms/radio-group/radio-group.js +6 -2
  28. package/dist/atoms/seal/index.d.ts +1 -0
  29. package/dist/atoms/seal/index.js +4 -0
  30. package/dist/atoms/seal/seal.d.ts +30 -0
  31. package/dist/atoms/seal/seal.js +71 -0
  32. package/dist/atoms/spinner/index.d.ts +1 -0
  33. package/dist/atoms/spinner/index.js +5 -0
  34. package/dist/atoms/spinner/spinner.d.ts +19 -0
  35. package/dist/atoms/spinner/spinner.js +31 -0
  36. package/dist/atoms/switch/switch.js +3 -1
  37. package/dist/calendar/date-calendar/date-calendar.d.ts +32 -0
  38. package/dist/calendar/date-calendar/date-calendar.js +189 -0
  39. package/dist/calendar/date-calendar/index.d.ts +1 -0
  40. package/dist/calendar/date-calendar/index.js +6 -0
  41. package/dist/calendar/index.d.ts +1 -0
  42. package/dist/calendar/index.js +1 -0
  43. package/dist/calendar/internal/date-utils.d.ts +26 -0
  44. package/dist/calendar/internal/date-utils.js +95 -1
  45. package/dist/containers/aside/aside.d.ts +14 -0
  46. package/dist/containers/aside/aside.js +25 -0
  47. package/dist/containers/aside/index.d.ts +1 -0
  48. package/dist/containers/aside/index.js +5 -0
  49. package/dist/containers/banner/banner.d.ts +4 -1
  50. package/dist/containers/banner/banner.js +9 -1
  51. package/dist/containers/description-list/description-list.d.ts +29 -6
  52. package/dist/containers/description-list/description-list.js +47 -6
  53. package/dist/containers/feed/feed.d.ts +23 -0
  54. package/dist/containers/feed/feed.js +77 -0
  55. package/dist/containers/feed/index.d.ts +2 -0
  56. package/dist/containers/feed/index.js +10 -0
  57. package/dist/containers/feed/model.d.ts +19 -0
  58. package/dist/containers/feed/model.js +38 -0
  59. package/dist/containers/index.d.ts +6 -0
  60. package/dist/containers/index.js +6 -0
  61. package/dist/containers/kpi/kpi.d.ts +50 -8
  62. package/dist/containers/kpi/kpi.js +91 -39
  63. package/dist/containers/list-detail/index.d.ts +1 -0
  64. package/dist/containers/list-detail/index.js +20 -0
  65. package/dist/containers/list-detail/list-detail.d.ts +55 -0
  66. package/dist/containers/list-detail/list-detail.js +221 -0
  67. package/dist/containers/note/index.d.ts +1 -0
  68. package/dist/containers/note/index.js +4 -0
  69. package/dist/containers/note/note.d.ts +13 -0
  70. package/dist/containers/note/note.js +27 -0
  71. package/dist/containers/section/index.d.ts +1 -0
  72. package/dist/containers/section/index.js +6 -0
  73. package/dist/containers/section/section.d.ts +68 -0
  74. package/dist/containers/section/section.js +198 -0
  75. package/dist/containers/shortcuts/index.d.ts +1 -0
  76. package/dist/containers/shortcuts/index.js +8 -0
  77. package/dist/containers/shortcuts/shortcuts.d.ts +18 -0
  78. package/dist/containers/shortcuts/shortcuts.js +50 -0
  79. package/dist/containers/table/selection.d.ts +9 -0
  80. package/dist/containers/table/selection.js +20 -0
  81. package/dist/containers/table/table.d.ts +66 -4
  82. package/dist/containers/table/table.js +128 -7
  83. package/dist/containers/timeline/index.d.ts +1 -1
  84. package/dist/containers/timeline/index.js +4 -2
  85. package/dist/containers/timeline/timeline.d.ts +32 -5
  86. package/dist/containers/timeline/timeline.js +154 -90
  87. package/dist/forms/chip-group/chip-group.d.ts +54 -0
  88. package/dist/forms/chip-group/chip-group.js +114 -0
  89. package/dist/forms/chip-group/index.d.ts +1 -0
  90. package/dist/forms/chip-group/index.js +6 -0
  91. package/dist/forms/combobox/combobox.d.ts +60 -0
  92. package/dist/forms/combobox/combobox.js +281 -0
  93. package/dist/forms/combobox/index.d.ts +1 -0
  94. package/dist/forms/combobox/index.js +6 -0
  95. package/dist/forms/date-picker/date-picker.d.ts +40 -0
  96. package/dist/forms/date-picker/date-picker.js +183 -0
  97. package/dist/forms/date-picker/date-time-picker.d.ts +43 -0
  98. package/dist/forms/date-picker/date-time-picker.js +121 -0
  99. package/dist/forms/date-picker/index.d.ts +2 -0
  100. package/dist/forms/date-picker/index.js +10 -0
  101. package/dist/forms/date-picker/model.d.ts +35 -0
  102. package/dist/forms/date-picker/model.js +83 -0
  103. package/dist/forms/dropzone/dropzone.d.ts +30 -2
  104. package/dist/forms/dropzone/dropzone.js +153 -23
  105. package/dist/forms/field/field.d.ts +16 -10
  106. package/dist/forms/field/field.js +41 -5
  107. package/dist/forms/index.d.ts +4 -0
  108. package/dist/forms/index.js +4 -0
  109. package/dist/forms/input/index.d.ts +1 -1
  110. package/dist/forms/input/index.js +4 -1
  111. package/dist/forms/input/input.d.ts +21 -5
  112. package/dist/forms/input/input.js +74 -9
  113. package/dist/forms/input-icon/input-icon.d.ts +1 -1
  114. package/dist/forms/internal/listbox-items.d.ts +18 -0
  115. package/dist/forms/internal/listbox-items.js +88 -0
  116. package/dist/forms/internal/listbox.d.ts +44 -0
  117. package/dist/forms/internal/listbox.js +74 -0
  118. package/dist/forms/number-stepper/model.d.ts +16 -0
  119. package/dist/forms/number-stepper/model.js +23 -0
  120. package/dist/forms/number-stepper/number-stepper.d.ts +36 -6
  121. package/dist/forms/number-stepper/number-stepper.js +86 -37
  122. package/dist/forms/select-menu/index.d.ts +1 -0
  123. package/dist/forms/select-menu/index.js +6 -0
  124. package/dist/forms/select-menu/select-menu.d.ts +35 -0
  125. package/dist/forms/select-menu/select-menu.js +230 -0
  126. package/dist/i18n/strings.d.ts +89 -0
  127. package/dist/i18n/strings.js +54 -2
  128. package/dist/i18n/ui-strings-provider.d.ts +1 -1
  129. package/dist/i18n/ui-strings-provider.js +6 -2
  130. package/dist/navigation/index.d.ts +1 -0
  131. package/dist/navigation/index.js +1 -0
  132. package/dist/navigation/stepper/index.d.ts +1 -1
  133. package/dist/navigation/stepper/index.js +3 -1
  134. package/dist/navigation/stepper/stepper.d.ts +8 -0
  135. package/dist/navigation/stepper/stepper.js +68 -45
  136. package/dist/navigation/tabs/index.d.ts +1 -0
  137. package/dist/navigation/tabs/index.js +6 -0
  138. package/dist/navigation/tabs/tabs-nav.d.ts +37 -0
  139. package/dist/navigation/tabs/tabs-nav.js +57 -0
  140. package/dist/navigation/wizard/index.d.ts +1 -0
  141. package/dist/navigation/wizard/index.js +6 -0
  142. package/dist/navigation/wizard/model.d.ts +33 -0
  143. package/dist/navigation/wizard/model.js +34 -0
  144. package/dist/navigation/wizard/wizard.d.ts +45 -0
  145. package/dist/navigation/wizard/wizard.js +169 -0
  146. package/dist/overlays/alert-dialog/alert-dialog.d.ts +103 -0
  147. package/dist/overlays/alert-dialog/alert-dialog.js +342 -0
  148. package/dist/overlays/alert-dialog/index.d.ts +1 -0
  149. package/dist/overlays/alert-dialog/index.js +26 -0
  150. package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +17 -1
  151. package/dist/overlays/dropdown-menu/dropdown-menu.js +12 -4
  152. package/dist/overlays/dropdown-menu/index.d.ts +1 -1
  153. package/dist/overlays/dropdown-menu/index.js +8 -2
  154. package/dist/overlays/index.d.ts +2 -0
  155. package/dist/overlays/index.js +2 -0
  156. package/dist/overlays/testing/index.d.ts +5 -0
  157. package/dist/overlays/testing/index.js +4 -0
  158. package/dist/overlays/toaster/index.d.ts +2 -1
  159. package/dist/overlays/toaster/index.js +4 -2
  160. package/dist/overlays/toaster/toast-store.d.ts +6 -2
  161. package/dist/overlays/toaster/toast.d.ts +3 -0
  162. package/dist/overlays/toaster/toast.js +3 -0
  163. package/dist/overlays/toaster/toaster.d.ts +3 -0
  164. package/dist/overlays/toaster/toaster.js +36 -3
  165. package/dist/overlays/tooltip/index.d.ts +1 -0
  166. package/dist/overlays/tooltip/index.js +4 -0
  167. package/dist/overlays/tooltip/model.d.ts +10 -0
  168. package/dist/overlays/tooltip/model.js +13 -0
  169. package/dist/overlays/tooltip/tooltip.d.ts +41 -0
  170. package/dist/overlays/tooltip/tooltip.js +116 -0
  171. package/dist/primitives/use-dismissable-layer.js +1 -1
  172. package/dist/states/error-state/error-state.d.ts +6 -1
  173. package/dist/states/error-state/error-state.js +13 -9
  174. package/dist/states/skeleton/skeleton.d.ts +8 -2
  175. package/dist/states/skeleton/skeleton.js +44 -2
  176. package/package.json +2 -2
  177. package/scripts/build-theme.mjs +12 -1
  178. package/src/atoms/checkbox/checkbox.tsx +3 -1
  179. package/src/atoms/chip/chip.tsx +18 -3
  180. package/src/atoms/chip/index.ts +2 -0
  181. package/src/atoms/due-chip/due-chip.tsx +75 -0
  182. package/src/atoms/due-chip/index.ts +2 -0
  183. package/src/atoms/due-chip/model.ts +67 -0
  184. package/src/atoms/icon-button/icon-button.tsx +58 -0
  185. package/src/atoms/icon-button/index.ts +6 -0
  186. package/src/atoms/index.ts +5 -0
  187. package/src/atoms/internal/hit-area.ts +7 -0
  188. package/src/atoms/kbd/index.ts +1 -0
  189. package/src/atoms/kbd/kbd.tsx +20 -0
  190. package/src/atoms/radio-group/radio-group.tsx +8 -2
  191. package/src/atoms/seal/index.ts +1 -0
  192. package/src/atoms/seal/seal.tsx +107 -0
  193. package/src/atoms/spinner/index.ts +1 -0
  194. package/src/atoms/spinner/spinner.tsx +49 -0
  195. package/src/atoms/switch/switch.tsx +3 -1
  196. package/src/calendar/date-calendar/date-calendar.tsx +230 -0
  197. package/src/calendar/date-calendar/index.ts +5 -0
  198. package/src/calendar/index.ts +1 -0
  199. package/src/calendar/internal/date-utils.ts +115 -0
  200. package/src/containers/aside/aside.tsx +40 -0
  201. package/src/containers/aside/index.ts +1 -0
  202. package/src/containers/banner/banner.tsx +18 -1
  203. package/src/containers/description-list/description-list.tsx +85 -9
  204. package/src/containers/feed/feed.tsx +99 -0
  205. package/src/containers/feed/index.ts +8 -0
  206. package/src/containers/feed/model.ts +54 -0
  207. package/src/containers/index.ts +6 -0
  208. package/src/containers/kpi/kpi.tsx +161 -62
  209. package/src/containers/list-detail/index.ts +15 -0
  210. package/src/containers/list-detail/list-detail.tsx +293 -0
  211. package/src/containers/note/index.ts +1 -0
  212. package/src/containers/note/note.tsx +38 -0
  213. package/src/containers/section/index.ts +11 -0
  214. package/src/containers/section/section.tsx +281 -0
  215. package/src/containers/shortcuts/index.ts +6 -0
  216. package/src/containers/shortcuts/shortcuts.tsx +92 -0
  217. package/src/containers/table/selection.ts +26 -0
  218. package/src/containers/table/table.tsx +215 -13
  219. package/src/containers/timeline/index.ts +3 -0
  220. package/src/containers/timeline/timeline.tsx +204 -93
  221. package/src/forms/chip-group/chip-group.tsx +184 -0
  222. package/src/forms/chip-group/index.ts +8 -0
  223. package/src/forms/combobox/combobox.tsx +359 -0
  224. package/src/forms/combobox/index.ts +7 -0
  225. package/src/forms/date-picker/date-picker.tsx +239 -0
  226. package/src/forms/date-picker/date-time-picker.tsx +178 -0
  227. package/src/forms/date-picker/index.ts +10 -0
  228. package/src/forms/date-picker/model.ts +108 -0
  229. package/src/forms/dropzone/dropzone.tsx +217 -35
  230. package/src/forms/field/field.tsx +72 -7
  231. package/src/forms/index.ts +4 -0
  232. package/src/forms/input/index.ts +8 -1
  233. package/src/forms/input/input.tsx +97 -12
  234. package/src/forms/input-icon/input-icon.tsx +1 -1
  235. package/src/forms/internal/listbox-items.tsx +103 -0
  236. package/src/forms/internal/listbox.ts +124 -0
  237. package/src/forms/number-stepper/model.ts +35 -0
  238. package/src/forms/number-stepper/number-stepper.tsx +132 -42
  239. package/src/forms/select-menu/index.ts +7 -0
  240. package/src/forms/select-menu/select-menu.tsx +280 -0
  241. package/src/i18n/strings.ts +89 -0
  242. package/src/i18n/ui-strings-provider.tsx +15 -4
  243. package/src/navigation/index.ts +1 -0
  244. package/src/navigation/stepper/index.ts +7 -1
  245. package/src/navigation/stepper/stepper.tsx +41 -5
  246. package/src/navigation/tabs/index.ts +7 -0
  247. package/src/navigation/tabs/tabs-nav.tsx +131 -0
  248. package/src/navigation/wizard/index.ts +7 -0
  249. package/src/navigation/wizard/model.ts +61 -0
  250. package/src/navigation/wizard/wizard.tsx +222 -0
  251. package/src/overlays/alert-dialog/alert-dialog.tsx +486 -0
  252. package/src/overlays/alert-dialog/index.ts +19 -0
  253. package/src/overlays/dropdown-menu/dropdown-menu.tsx +29 -4
  254. package/src/overlays/dropdown-menu/index.ts +3 -0
  255. package/src/overlays/index.ts +2 -0
  256. package/src/overlays/testing/index.ts +5 -0
  257. package/src/overlays/toaster/index.ts +2 -0
  258. package/src/overlays/toaster/toast-store.ts +6 -2
  259. package/src/overlays/toaster/toast.ts +6 -0
  260. package/src/overlays/toaster/toaster.tsx +44 -2
  261. package/src/overlays/tooltip/index.ts +1 -0
  262. package/src/overlays/tooltip/model.ts +18 -0
  263. package/src/overlays/tooltip/tooltip.tsx +166 -0
  264. package/src/primitives/use-dismissable-layer.ts +7 -2
  265. package/src/states/error-state/error-state.tsx +19 -8
  266. package/src/states/skeleton/skeleton.tsx +68 -2
  267. package/styles/tailwind.css +33 -30
  268. package/styles/theme.css +33 -30
@@ -20,6 +20,8 @@ function RadioGroup({ options, className, classNames, ...props }) {
20
20
  ...props,
21
21
  children: options.map((option) => {
22
22
  const id = `${baseId}-${option.value}`;
23
+ const labelId = `${id}-label`;
24
+ const descriptionId = `${id}-description`;
23
25
  return /* @__PURE__ */ jsxs(
24
26
  "label",
25
27
  {
@@ -35,6 +37,8 @@ function RadioGroup({ options, className, classNames, ...props }) {
35
37
  id,
36
38
  value: option.value,
37
39
  disabled: option.disabled,
40
+ "aria-labelledby": labelId,
41
+ "aria-describedby": option.description ? descriptionId : void 0,
38
42
  className: cn(
39
43
  "mt-0.5 grid size-4 shrink-0 place-items-center rounded-pill border-[1.5px] border-line-strong data-[state=checked]:border-accent",
40
44
  classNames?.radio
@@ -52,8 +56,8 @@ function RadioGroup({ options, className, classNames, ...props }) {
52
56
  {
53
57
  className: cn("flex min-w-0 flex-col [overflow-wrap:anywhere]", classNames?.text),
54
58
  children: [
55
- /* @__PURE__ */ jsx("b", { className: cn("font-semibold text-fs-130", classNames?.label), children: option.label }),
56
- option.description ? /* @__PURE__ */ jsx("span", { className: cn("text-ink-3", classNames?.description), children: option.description }) : null
59
+ /* @__PURE__ */ jsx("b", { id: labelId, className: cn("font-semibold text-fs-130", classNames?.label), children: option.label }),
60
+ option.description ? /* @__PURE__ */ jsx("span", { id: descriptionId, className: cn("text-ink-3", classNames?.description), children: option.description }) : null
57
61
  ]
58
62
  }
59
63
  )
@@ -0,0 +1 @@
1
+ export { Seal, type SealPart, type SealProps, type SealTone } from "./seal.js";
@@ -0,0 +1,4 @@
1
+ import { Seal } from "./seal.js";
2
+ export {
3
+ Seal
4
+ };
@@ -0,0 +1,30 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ export type SealBuiltinTone = "accent" | "success" | "warning" | "danger" | "neutral" | "institutional";
4
+ /** A built-in tone, or the name of a tone declared in `tonePalettes`. */
5
+ export type SealTone = SealBuiltinTone | (string & {});
6
+ export type SealPart = "root" | "icon" | "title" | "body";
7
+ export interface SealProps extends Omit<ComponentPropsWithoutRef<"div">, "title"> {
8
+ /** Heading of the stamp, set in small caps-style capitals. */
9
+ title?: ReactNode;
10
+ /** Decorative glyph before the title (`aria-hidden`). */
11
+ icon?: ReactNode;
12
+ /**
13
+ * Frame and title colour. `institutional` is the strong neutral (ink frame) for official
14
+ * seals that must not read as a status; any other name resolves through `tonePalettes`.
15
+ */
16
+ tone?: SealTone;
17
+ /**
18
+ * Accessible name. Set it and the seal becomes a labelled `group`; without it the seal is
19
+ * plain text content the reader encounters in order.
20
+ */
21
+ label?: string;
22
+ /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root. */
23
+ classNames?: ClassNames<SealPart>;
24
+ }
25
+ /**
26
+ * An official-looking stamp: a heavy tone-colored frame with a title and the lines that vouch
27
+ * for a document (issuer, code, date). Children are the lines, usually `<p>`. Purely
28
+ * typographic, so it prints and scales with the text.
29
+ */
30
+ export declare function Seal({ title, icon, tone, label, className, classNames, children, ...props }: SealProps): import("react").JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { customToneStyle, isCustomTone } from "../../utils/tone.js";
4
+ const toneClasses = {
5
+ accent: { frame: "border-accent-ink", title: "text-accent-ink" },
6
+ success: { frame: "border-success", title: "text-success" },
7
+ warning: { frame: "border-warning", title: "text-warning" },
8
+ danger: { frame: "border-danger", title: "text-danger" },
9
+ neutral: { frame: "border-line-strong", title: "text-ink-2" },
10
+ institutional: { frame: "border-ink", title: "text-ink" }
11
+ };
12
+ const builtinTones = new Set(Object.keys(toneClasses));
13
+ function Seal({
14
+ title,
15
+ icon,
16
+ tone = "accent",
17
+ label,
18
+ className,
19
+ classNames,
20
+ children,
21
+ ...props
22
+ }) {
23
+ const custom = isCustomTone(tone, builtinTones);
24
+ const classes = custom ? { frame: "border-(--tone-c)", title: "text-(--tone-c-ink)" } : toneClasses[tone] ?? toneClasses.accent;
25
+ return (
26
+ // biome-ignore lint/a11y/useAriaPropsSupportedByRole: the role is `group` exactly when `label` is set
27
+ /* @__PURE__ */ jsxs(
28
+ "div",
29
+ {
30
+ role: label ? "group" : void 0,
31
+ "aria-label": label,
32
+ "data-tone": tone,
33
+ ...props,
34
+ style: customToneStyle(tone, builtinTones, props.style),
35
+ className: cn(
36
+ "flex min-w-0 flex-col gap-0.5 rounded-card border-2 p-4 text-ink text-meta",
37
+ classes.frame,
38
+ classNames?.root,
39
+ className
40
+ ),
41
+ children: [
42
+ title !== void 0 || icon !== void 0 ? /* @__PURE__ */ jsxs(
43
+ "div",
44
+ {
45
+ className: cn(
46
+ "flex items-center gap-1.5 font-semibold uppercase tracking-wide",
47
+ classes.title,
48
+ classNames?.title
49
+ ),
50
+ children: [
51
+ icon !== void 0 ? /* @__PURE__ */ jsx(
52
+ "span",
53
+ {
54
+ "aria-hidden": "true",
55
+ className: cn("inline-flex shrink-0 [&_svg]:size-4", classNames?.icon),
56
+ children: icon
57
+ }
58
+ ) : null,
59
+ title
60
+ ]
61
+ }
62
+ ) : null,
63
+ /* @__PURE__ */ jsx("div", { className: cn("min-w-0 [&_p]:m-0 [overflow-wrap:anywhere]", classNames?.body), children })
64
+ ]
65
+ }
66
+ )
67
+ );
68
+ }
69
+ export {
70
+ Seal
71
+ };
@@ -0,0 +1 @@
1
+ export { Spinner, type SpinnerProps, type SpinnerSize, spinnerSizeClasses } from "./spinner.js";
@@ -0,0 +1,5 @@
1
+ import { Spinner, spinnerSizeClasses } from "./spinner.js";
2
+ export {
3
+ Spinner,
4
+ spinnerSizeClasses
5
+ };
@@ -0,0 +1,19 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export type SpinnerSize = "xs" | "sm" | "md" | "lg";
3
+ /** Class map behind each named `size`; exported like `buttonSizeClasses`. */
4
+ export declare const spinnerSizeClasses: Readonly<Record<SpinnerSize, string>>;
5
+ export interface SpinnerProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
6
+ /** Named size, or a pixel size for one-offs. Defaults to `sm`. */
7
+ size?: SpinnerSize | number;
8
+ /**
9
+ * Accessible name announced through `role="status"`. Defaults to the localized `loading` UI
10
+ * string. `false` marks the spinner decorative (`aria-hidden`), for use next to its own text.
11
+ */
12
+ label?: string | false;
13
+ }
14
+ /**
15
+ * Indeterminate activity indicator drawn with the current text color. It spins only when the user
16
+ * has not asked for reduced motion; otherwise it stays a static ring and the label still says
17
+ * that work is in progress.
18
+ */
19
+ export declare function Spinner({ size, label, className, style, ...props }: SpinnerProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useUiStrings } from "../../i18n/index.js";
3
+ import { cn } from "../../utils/cn.js";
4
+ const spinnerSizeClasses = {
5
+ xs: "size-3",
6
+ sm: "size-4",
7
+ md: "size-5",
8
+ lg: "size-7"
9
+ };
10
+ function Spinner({ size = "sm", label, className, style, ...props }) {
11
+ const strings = useUiStrings();
12
+ const named = typeof size === "string";
13
+ const a11y = label === false ? { "aria-hidden": true } : { role: "status", "aria-label": label ?? strings.loading };
14
+ return /* @__PURE__ */ jsx(
15
+ "span",
16
+ {
17
+ ...a11y,
18
+ ...props,
19
+ style: named ? style : { width: size, height: size, ...style },
20
+ className: cn(
21
+ "inline-block shrink-0 rounded-full border-2 border-current border-t-transparent motion-safe:animate-spin",
22
+ named && spinnerSizeClasses[size],
23
+ className
24
+ )
25
+ }
26
+ );
27
+ }
28
+ export {
29
+ Spinner,
30
+ spinnerSizeClasses
31
+ };
@@ -5,6 +5,7 @@ import { cn } from "../../utils/cn.js";
5
5
  import { composeHandlers, useComposedRefs } from "../../utils/compose.js";
6
6
  import { BubbleInput, useFormBubble, useFormReset } from "../../utils/form-bubble.js";
7
7
  import { useControllableState } from "../../utils/use-controllable-state.js";
8
+ import { touchHitArea } from "../internal/hit-area.js";
8
9
  function Switch({
9
10
  className,
10
11
  classNames,
@@ -46,7 +47,8 @@ function Switch({
46
47
  ...props,
47
48
  ref: composedRef,
48
49
  className: cn(
49
- "group inline-flex size-10 shrink-0 items-center justify-center in-data-[density=touch]:size-11",
50
+ touchHitArea,
51
+ "group inline-flex size-10 shrink-0 items-center justify-center",
50
52
  classNames?.root,
51
53
  className
52
54
  ),
@@ -0,0 +1,32 @@
1
+ import type { ClassNames } from "../../utils/class-names.js";
2
+ import { type WeekStart } from "../internal/date-utils.js";
3
+ export type DateCalendarPart = "root" | "header" | "title" | "nav" | "grid" | "weekday" | "day";
4
+ export interface DateCalendarProps {
5
+ /** Selected date, "YYYY-MM-DD". */
6
+ value?: string;
7
+ /** Called with the "YYYY-MM-DD" date the person picks. */
8
+ onSelect: (date: string) => void;
9
+ /** Earliest selectable date, "YYYY-MM-DD". */
10
+ min?: string;
11
+ /** Latest selectable date, "YYYY-MM-DD". */
12
+ max?: string;
13
+ /** Extra dates that cannot be picked (holidays, taken days). */
14
+ isDateDisabled?: (date: string) => boolean;
15
+ /** BCP 47 locale for labels. Defaults to the `locale` UI string. */
16
+ locale?: string;
17
+ /** First day of the week, 0 (Sunday) to 6. Defaults from the locale: Monday for es-PE. */
18
+ weekStartsOn?: WeekStart;
19
+ /** "YYYY-MM-DD" treated as today. Defaults to the viewer's local date. */
20
+ today?: string;
21
+ /** Moves focus into the grid on mount (when it opens inside a popover). */
22
+ autoFocus?: boolean;
23
+ className?: string;
24
+ /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
25
+ classNames?: ClassNames<DateCalendarPart>;
26
+ }
27
+ /**
28
+ * Month grid for picking one date (WAI-ARIA date picker grid). Dates are "YYYY-MM-DD" strings
29
+ * handled in UTC, so a day never shifts with the time zone. Arrows move by day and week,
30
+ * Home/End to the week edges, PageUp/PageDown by month (Shift: year); Enter or Space picks.
31
+ */
32
+ export declare function DateCalendar({ value, onSelect, min, max, isDateDisabled, locale: localeProp, weekStartsOn: weekStartProp, today: todayProp, autoFocus, className, classNames, }: DateCalendarProps): import("react").JSX.Element;
@@ -0,0 +1,189 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
4
+ import { useUiStrings } from "../../i18n/index.js";
5
+ import { ChevronLeft, ChevronRight } from "../../icons/index.js";
6
+ import { cn } from "../../utils/cn.js";
7
+ import {
8
+ addDays,
9
+ addMonths,
10
+ clampDate,
11
+ formatFullDate,
12
+ formatMonthTitle,
13
+ isIsoDate,
14
+ monthWeeks,
15
+ startOfWeek,
16
+ todayIso,
17
+ weekdayNames,
18
+ weekStartFor
19
+ } from "../internal/date-utils.js";
20
+ const KEY_STEPS = {
21
+ ArrowLeft: -1,
22
+ ArrowRight: 1,
23
+ ArrowUp: -7,
24
+ ArrowDown: 7
25
+ };
26
+ const NAV = "inline-flex size-8 min-h-(--touch-target) min-w-(--touch-target) items-center justify-center rounded-event text-ink-2 outline-none hover:bg-surface-2 focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-40";
27
+ function DateCalendar({
28
+ value,
29
+ onSelect,
30
+ min,
31
+ max,
32
+ isDateDisabled,
33
+ locale: localeProp,
34
+ weekStartsOn: weekStartProp,
35
+ today: todayProp,
36
+ autoFocus = false,
37
+ className,
38
+ classNames
39
+ }) {
40
+ const strings = useUiStrings();
41
+ const locale = localeProp || strings.locale;
42
+ const weekStartsOn = weekStartProp ?? weekStartFor(locale);
43
+ const titleId = useId();
44
+ const gridRef = useRef(null);
45
+ const moveFocus = useRef(autoFocus);
46
+ const [today] = useState(() => todayProp ?? todayIso());
47
+ const [focused, setFocused] = useState(
48
+ () => clampDate(value && isIsoDate(value) ? value : today, min, max)
49
+ );
50
+ const weeks = useMemo(() => monthWeeks(focused, weekStartsOn), [focused, weekStartsOn]);
51
+ const names = useMemo(() => weekdayNames(locale, weekStartsOn), [locale, weekStartsOn]);
52
+ const month = focused.slice(0, 7);
53
+ const disabled = (date) => Boolean(min && date < min || max && date > max || isDateDisabled?.(date));
54
+ useEffect(() => {
55
+ if (!moveFocus.current) return;
56
+ gridRef.current?.querySelector(`[data-date="${focused}"]`)?.focus();
57
+ }, [focused]);
58
+ const goTo = (date, focusDay) => {
59
+ moveFocus.current = focusDay;
60
+ setFocused(clampDate(date, min, max));
61
+ };
62
+ const onKeyDown = (event) => {
63
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
64
+ const step = KEY_STEPS[event.key];
65
+ let next;
66
+ if (step !== void 0) next = addDays(focused, step);
67
+ else if (event.key === "Home") next = startOfWeek(focused, weekStartsOn);
68
+ else if (event.key === "End") next = addDays(startOfWeek(focused, weekStartsOn), 6);
69
+ else if (event.key === "PageUp" || event.key === "PageDown") {
70
+ next = addMonths(focused, (event.key === "PageUp" ? -1 : 1) * (event.shiftKey ? 12 : 1));
71
+ }
72
+ if (next === void 0) return;
73
+ event.preventDefault();
74
+ goTo(next, true);
75
+ };
76
+ const monthStart = `${month}-01`;
77
+ const prevDisabled = Boolean(min && addDays(monthStart, -1) < min);
78
+ const nextDisabled = Boolean(max && addMonths(monthStart, 1) > max);
79
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex w-fit flex-col gap-2", classNames?.root, className), children: [
80
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-2", classNames?.header), children: [
81
+ /* @__PURE__ */ jsx(
82
+ "button",
83
+ {
84
+ type: "button",
85
+ "aria-label": strings.previousMonth,
86
+ disabled: prevDisabled,
87
+ onClick: () => goTo(addMonths(focused, -1), false),
88
+ className: cn(NAV, classNames?.nav),
89
+ children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "size-4" })
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsx(
93
+ "div",
94
+ {
95
+ id: titleId,
96
+ "aria-live": "polite",
97
+ className: cn("font-semibold text-body text-ink", classNames?.title),
98
+ children: formatMonthTitle(focused, locale)
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx(
102
+ "button",
103
+ {
104
+ type: "button",
105
+ "aria-label": strings.nextMonth,
106
+ disabled: nextDisabled,
107
+ onClick: () => goTo(addMonths(focused, 1), false),
108
+ className: cn(NAV, classNames?.nav),
109
+ children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "size-4" })
110
+ }
111
+ )
112
+ ] }),
113
+ /* @__PURE__ */ jsxs(
114
+ "table",
115
+ {
116
+ ref: gridRef,
117
+ role: "grid",
118
+ "aria-labelledby": titleId,
119
+ onKeyDown,
120
+ className: cn("border-collapse", classNames?.grid),
121
+ children: [
122
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: names.map((name) => /* @__PURE__ */ jsx(
123
+ "th",
124
+ {
125
+ scope: "col",
126
+ "aria-label": name.long,
127
+ className: cn(
128
+ "size-9 p-0 text-center font-semibold text-ink-3 text-meta uppercase",
129
+ classNames?.weekday
130
+ ),
131
+ children: name.narrow
132
+ },
133
+ name.long
134
+ )) }) }),
135
+ /* @__PURE__ */ jsx("tbody", { children: weeks.map((week) => /* @__PURE__ */ jsx("tr", { children: week.map((date) => {
136
+ const selected = date === value;
137
+ const isDisabled = disabled(date);
138
+ const outside = !date.startsWith(month);
139
+ return (
140
+ // biome-ignore lint/a11y/useFocusableInteractive: the button inside the cell takes focus.
141
+ /* @__PURE__ */ jsx(
142
+ "td",
143
+ {
144
+ role: "gridcell",
145
+ "aria-selected": selected,
146
+ className: "p-0",
147
+ children: /* @__PURE__ */ jsx(
148
+ "button",
149
+ {
150
+ type: "button",
151
+ "data-date": date,
152
+ tabIndex: date === focused ? 0 : -1,
153
+ "aria-label": formatFullDate(date, locale),
154
+ "aria-current": date === today ? "date" : void 0,
155
+ "aria-disabled": isDisabled || void 0,
156
+ "data-selected": selected ? "" : void 0,
157
+ "data-outside": outside ? "" : void 0,
158
+ onFocus: () => {
159
+ moveFocus.current = true;
160
+ setFocused(date);
161
+ },
162
+ onClick: () => {
163
+ if (!isDisabled) onSelect(date);
164
+ },
165
+ className: cn(
166
+ "flex size-9 min-h-(--touch-target) min-w-(--touch-target) items-center justify-center rounded-event text-body tabular-nums outline-none focus-visible:focus-ring",
167
+ outside ? "text-ink-3" : "text-ink",
168
+ date === today && !selected && "font-bold text-accent-ink",
169
+ !isDisabled && !selected && "hover:bg-surface-2",
170
+ selected && "bg-accent font-bold text-on-accent",
171
+ isDisabled && "cursor-not-allowed text-ink-3 line-through opacity-50",
172
+ classNames?.day
173
+ ),
174
+ children: Number(date.slice(8))
175
+ }
176
+ )
177
+ },
178
+ date
179
+ )
180
+ );
181
+ }) }, week[0])) })
182
+ ]
183
+ }
184
+ )
185
+ ] });
186
+ }
187
+ export {
188
+ DateCalendar
189
+ };
@@ -0,0 +1 @@
1
+ export { DateCalendar, type DateCalendarPart, type DateCalendarProps, } from "./date-calendar.js";
@@ -0,0 +1,6 @@
1
+ import {
2
+ DateCalendar
3
+ } from "./date-calendar.js";
4
+ export {
5
+ DateCalendar
6
+ };
@@ -1,3 +1,4 @@
1
+ export * from "./date-calendar/index.js";
1
2
  export * from "./day-chip/index.js";
2
3
  export * from "./event-block/index.js";
3
4
  export * from "./month-view/index.js";
@@ -1,3 +1,4 @@
1
+ export * from "./date-calendar/index.js";
1
2
  export * from "./day-chip/index.js";
2
3
  export * from "./event-block/index.js";
3
4
  export * from "./month-view/index.js";
@@ -16,3 +16,29 @@ export declare function formatWeekdayAndDay(value: string, locale?: string): str
16
16
  export declare function formatMonthShort(value: string, locale?: string): string;
17
17
  /** Localized hour label for an hour of the day (0-23). */
18
18
  export declare function formatHour(hour: number, locale?: string): string;
19
+ /** True for a real calendar date written "YYYY-MM-DD" (rejects "2026-02-30"). */
20
+ export declare function isIsoDate(value: string): boolean;
21
+ /** Builds "YYYY-MM-DD" from numeric parts; no time zone is involved. */
22
+ export declare function toIsoDate(year: number, month: number, day: number): string;
23
+ /** Same day of the month `amount` months away, or the last day when the month is shorter. */
24
+ export declare function addMonths(value: string, amount: number): string;
25
+ /** The viewer's calendar date today, read from local fields (never from the UTC date). */
26
+ export declare function todayIso(now?: Date): string;
27
+ /** `value` pulled inside `[min, max]`. ISO dates compare correctly as strings. */
28
+ export declare function clampDate(value: string, min?: string, max?: string): string;
29
+ /**
30
+ * First day of the week for a BCP 47 locale: Sunday (0) where that is the convention of the
31
+ * region (en-US, es-MX, pt-BR, ...), Monday (1) everywhere else, including es-PE and en-GB.
32
+ */
33
+ export declare function weekStartFor(locale: string): WeekStart;
34
+ /** "September 2026" with only the first letter capitalised ("Setiembre de 2026"). */
35
+ export declare function formatMonthTitle(value: string, locale?: string): string;
36
+ /** Full date for a screen reader, e.g. "Monday, September 7, 2026". */
37
+ export declare function formatFullDate(value: string, locale?: string): string;
38
+ /** Weekday names in column order starting at `weekStartsOn`. */
39
+ export declare function weekdayNames(locale: string | undefined, weekStartsOn: WeekStart): {
40
+ narrow: string;
41
+ long: string;
42
+ }[];
43
+ /** Six full weeks of "YYYY-MM-DD" covering the month of `value`, so the grid keeps its height. */
44
+ export declare function monthWeeks(value: string, weekStartsOn: WeekStart): string[][];
@@ -52,15 +52,109 @@ function formatHour(hour, locale) {
52
52
  timeZone: "UTC"
53
53
  }).format(new Date(Date.UTC(1970, 0, 1, hour)));
54
54
  }
55
+ const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
56
+ function isIsoDate(value) {
57
+ const match = ISO_DATE.exec(value);
58
+ if (!match) return false;
59
+ const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
60
+ const date = new Date(Date.UTC(year, month - 1, day));
61
+ return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
62
+ }
63
+ function toIsoDate(year, month, day) {
64
+ return `${String(year).padStart(4, "0")}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
65
+ }
66
+ function addMonths(value, amount) {
67
+ const date = parseDate(value);
68
+ const target = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + amount, 1));
69
+ const last = new Date(
70
+ Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)
71
+ ).getUTCDate();
72
+ return toIsoDate(
73
+ target.getUTCFullYear(),
74
+ target.getUTCMonth() + 1,
75
+ Math.min(date.getUTCDate(), last)
76
+ );
77
+ }
78
+ function todayIso(now = /* @__PURE__ */ new Date()) {
79
+ return toIsoDate(now.getFullYear(), now.getMonth() + 1, now.getDate());
80
+ }
81
+ function clampDate(value, min, max) {
82
+ if (min && value < min) return min;
83
+ if (max && value > max) return max;
84
+ return value;
85
+ }
86
+ const SUNDAY_REGIONS = /* @__PURE__ */ new Set([
87
+ "US",
88
+ "CA",
89
+ "MX",
90
+ "BR",
91
+ "JP",
92
+ "KR",
93
+ "IL",
94
+ "IN",
95
+ "PH",
96
+ "TW",
97
+ "HK",
98
+ "ZA",
99
+ "CO",
100
+ "VE",
101
+ "SA"
102
+ ]);
103
+ function weekStartFor(locale) {
104
+ const region = /[-_]([A-Za-z]{2})(?:[-_]|$)/.exec(locale)?.[1]?.toUpperCase();
105
+ if (region) return SUNDAY_REGIONS.has(region) ? 0 : 1;
106
+ return locale.toLowerCase().startsWith("en") || locale.toLowerCase().startsWith("ja") ? 0 : 1;
107
+ }
108
+ function formatMonthTitle(value, locale) {
109
+ const raw = format(value, locale, { month: "long", year: "numeric" });
110
+ return raw.charAt(0).toLocaleUpperCase(locale) + raw.slice(1);
111
+ }
112
+ function formatFullDate(value, locale) {
113
+ return format(value, locale, { dateStyle: "full" });
114
+ }
115
+ function weekdayNames(locale, weekStartsOn) {
116
+ return Array.from({ length: 7 }, (_, index) => {
117
+ const day = addDays("2024-01-07", weekStartsOn + index);
118
+ return {
119
+ narrow: format(day, locale, { weekday: "narrow" }),
120
+ long: format(day, locale, { weekday: "long" })
121
+ };
122
+ });
123
+ }
124
+ function monthWeeks(value, weekStartsOn) {
125
+ const date = parseDate(value);
126
+ let cursor = startOfWeek(
127
+ formatDate(new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1))),
128
+ weekStartsOn
129
+ );
130
+ return Array.from(
131
+ { length: 6 },
132
+ () => Array.from({ length: 7 }, () => {
133
+ const day = cursor;
134
+ cursor = addDays(cursor, 1);
135
+ return day;
136
+ })
137
+ );
138
+ }
55
139
  export {
56
140
  addDays,
141
+ addMonths,
142
+ clampDate,
57
143
  formatDate,
144
+ formatFullDate,
58
145
  formatHour,
59
146
  formatMonthShort,
147
+ formatMonthTitle,
60
148
  formatWeekday,
61
149
  formatWeekdayAndDay,
150
+ isIsoDate,
62
151
  minutesSinceMidnight,
63
152
  monthGrid,
153
+ monthWeeks,
64
154
  parseDate,
65
- startOfWeek
155
+ startOfWeek,
156
+ toIsoDate,
157
+ todayIso,
158
+ weekStartFor,
159
+ weekdayNames
66
160
  };
@@ -0,0 +1,14 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ export type AsideProps = ComponentPropsWithoutRef<"aside">;
3
+ /**
4
+ * Complementary column content (`<aside>`), named "Related information" unless given an
5
+ * `aria-label`. The column's width, surface and gutter belong to the page layout; the aside and
6
+ * its parts render flush to it.
7
+ */
8
+ export declare function Aside({ className, "aria-label": ariaLabel, ...props }: AsideProps): import("react").JSX.Element;
9
+ export interface AsideHeaderProps extends Omit<ComponentPropsWithoutRef<"div">, "title"> {
10
+ title: ReactNode;
11
+ /** End slot, usually a link. */
12
+ action?: ReactNode;
13
+ }
14
+ export declare function AsideHeader({ title, action, className, ...props }: AsideHeaderProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useUiStrings } from "../../i18n/index.js";
4
+ import { cn } from "../../utils/cn.js";
5
+ function Aside({ className, "aria-label": ariaLabel, ...props }) {
6
+ const strings = useUiStrings();
7
+ return /* @__PURE__ */ jsx(
8
+ "aside",
9
+ {
10
+ "aria-label": ariaLabel ?? strings.aside,
11
+ className: cn("flex min-w-0 flex-col", className),
12
+ ...props
13
+ }
14
+ );
15
+ }
16
+ function AsideHeader({ title, action, className, ...props }) {
17
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-2 pt-4 pb-2", className), ...props, children: [
18
+ /* @__PURE__ */ jsx("h2", { className: "m-0 min-w-0 font-semibold text-fs-120 text-ink-3 tracking-wide", children: title }),
19
+ action !== void 0 ? /* @__PURE__ */ jsx("div", { className: "shrink-0 text-fs-120 text-ink-3 [&_a]:hover:text-ink", children: action }) : null
20
+ ] });
21
+ }
22
+ export {
23
+ Aside,
24
+ AsideHeader
25
+ };
@@ -0,0 +1 @@
1
+ export { Aside, AsideHeader, type AsideHeaderProps, type AsideProps } from "./aside.js";
@@ -0,0 +1,5 @@
1
+ import { Aside, AsideHeader } from "./aside.js";
2
+ export {
3
+ Aside,
4
+ AsideHeader
5
+ };