@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
@@ -1,6 +1,8 @@
1
- import type { ComponentPropsWithoutRef, ReactNode } from "react";
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
2
  import type { ClassNames } from "../../utils/class-names.js";
3
3
  export type TimelineFeedTone = "neutral" | "accent" | "success" | "warning" | "danger";
4
+ /** Where an item stands in a process: finished, in progress, failed or not reached yet. */
5
+ export type TimelineStatus = "done" | "current" | "error" | "pending";
4
6
  export interface TimelineFeedItem {
5
7
  id: string;
6
8
  title: ReactNode;
@@ -9,9 +11,15 @@ export interface TimelineFeedItem {
9
11
  time?: string;
10
12
  /** Machine-readable value for the `<time>` element. */
11
13
  dateTime?: string;
12
- /** Icon inside the marker; without it the marker is a dot. */
14
+ /** Icon inside the marker; without it the marker is a dot (a check or cross for `done` and `error`). */
13
15
  icon?: ReactNode;
16
+ /** Marker colour. Without it the tone follows `status`, or is neutral. */
14
17
  tone?: TimelineFeedTone;
18
+ /**
19
+ * Process state. `done` and `error` get a check or cross and a spoken state, `current` sets
20
+ * `aria-current="step"` and rings the marker, `pending` dims the item. Independent of `tone`.
21
+ */
22
+ status?: TimelineStatus;
15
23
  /** Person or system that did it. */
16
24
  actor?: string;
17
25
  /** Extra content under the text: attachments, chips, actions. */
@@ -21,9 +29,28 @@ export interface TimelineFeedItem {
21
29
  }
22
30
  export type TimelinePart = "root" | "list" | "item" | "group" | "rail" | "marker" | "connector" | "content" | "header" | "title" | "time" | "actor" | "description";
23
31
  export interface TimelineProps extends Omit<ComponentPropsWithoutRef<"ol">, "children"> {
24
- items: TimelineFeedItem[];
32
+ /** Data-driven entries. Rendered before `children`. */
33
+ items?: TimelineFeedItem[];
34
+ /**
35
+ * Composed entries: `Timeline.Item` (or your own component that renders one) as children.
36
+ * A wrapper keeps its position, but only an element whose props carry `group` can open a group heading.
37
+ */
38
+ children?: ReactNode;
25
39
  /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
26
40
  classNames?: ClassNames<TimelinePart>;
27
41
  }
28
- /** Vertical activity feed: marker rail on the left, grouped by day, newest first by convention. */
29
- export declare function Timeline({ items, className, classNames, ...props }: TimelineProps): import("react").JSX.Element;
42
+ export interface TimelineItemProps extends Omit<TimelineFeedItem, "id">, Omit<ComponentPropsWithoutRef<"li">, "title" | "children"> {
43
+ /** Kept so a `TimelineFeedItem` can be spread as is; React uses it as the key. */
44
+ id?: string;
45
+ }
46
+ /** One entry of a composed `Timeline`. Extra content goes in `children`. */
47
+ export declare function TimelineItem({ title, description, time, dateTime, icon, tone, status, actor, group, children, className, ...props }: TimelineItemProps): import("react").JSX.Element;
48
+ /**
49
+ * Vertical activity feed: marker rail on the left, grouped by day, newest first by convention.
50
+ * Pass `items`, or compose `Timeline.Item` children (or both: items come first). Items can carry
51
+ * a `status` (done, current, error, pending) for a process rather than a log.
52
+ */
53
+ export declare function Timeline({ items, children, className, classNames, ...props }: TimelineProps): import("react").JSX.Element;
54
+ export declare namespace Timeline {
55
+ var Item: typeof TimelineItem;
56
+ }
@@ -1,4 +1,13 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ Children,
5
+ createContext,
6
+ isValidElement,
7
+ useContext
8
+ } from "react";
9
+ import { useUiStrings } from "../../i18n/index.js";
10
+ import { Check, X } from "../../icons/index.js";
2
11
  import { cn } from "../../utils/cn.js";
3
12
  const markerClasses = {
4
13
  neutral: "bg-surface-2 text-ink-2",
@@ -7,101 +16,156 @@ const markerClasses = {
7
16
  warning: "bg-warning-soft text-warning",
8
17
  danger: "bg-danger-soft text-danger"
9
18
  };
10
- function Timeline({ items, className, classNames, ...props }) {
11
- return /* @__PURE__ */ jsx("div", { className: cn("@container/timeline min-w-0", classNames?.root, className), children: /* @__PURE__ */ jsx("ol", { ...props, className: cn("m-0 flex list-none flex-col p-0", classNames?.list), children: items.map((item, index) => {
12
- const previous = items[index - 1];
13
- const last = index === items.length - 1;
14
- const tone = item.tone ?? "neutral";
15
- return /* @__PURE__ */ jsxs("li", { className: cn("flex min-w-0 flex-col", classNames?.item), children: [
16
- item.group && item.group !== previous?.group ? /* @__PURE__ */ jsx(
17
- "h4",
18
- {
19
- className: cn(
20
- "pb-density-sm text-ink-3 text-overline uppercase",
21
- classNames?.group
22
- ),
23
- children: item.group
24
- }
25
- ) : null,
26
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-density", children: [
27
- /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 flex-col items-center", classNames?.rail), children: [
28
- /* @__PURE__ */ jsx(
29
- "span",
19
+ const statusTone = {
20
+ done: "success",
21
+ current: "accent",
22
+ error: "danger",
23
+ pending: "neutral"
24
+ };
25
+ const TimelineClasses = createContext(void 0);
26
+ const TimelinePositionContext = createContext({ last: true, showGroup: true });
27
+ function TimelineItem({
28
+ title,
29
+ description,
30
+ time,
31
+ dateTime,
32
+ icon,
33
+ tone,
34
+ status,
35
+ actor,
36
+ group,
37
+ children,
38
+ className,
39
+ ...props
40
+ }) {
41
+ const classNames = useContext(TimelineClasses);
42
+ const { last, showGroup } = useContext(TimelinePositionContext);
43
+ const strings = useUiStrings();
44
+ const resolvedTone = tone ?? (status ? statusTone[status] : "neutral");
45
+ const glyph = icon ?? (status === "done" ? /* @__PURE__ */ jsx(Check, {}) : status === "error" ? /* @__PURE__ */ jsx(X, {}) : status === "pending" ? null : /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-current" }));
46
+ const stateText = status === "done" ? strings.stepDone : status === "error" ? strings.stepError : null;
47
+ return /* @__PURE__ */ jsxs(
48
+ "li",
49
+ {
50
+ "aria-current": status === "current" ? "step" : void 0,
51
+ "data-status": status,
52
+ ...props,
53
+ className: cn("flex min-w-0 flex-col", classNames?.item, className),
54
+ children: [
55
+ group && showGroup ? /* @__PURE__ */ jsx("h4", { className: cn("pb-density-sm text-ink-3 text-overline uppercase", classNames?.group), children: group }) : null,
56
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-density", children: [
57
+ /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 flex-col items-center", classNames?.rail), children: [
58
+ /* @__PURE__ */ jsx(
59
+ "span",
60
+ {
61
+ "aria-hidden": "true",
62
+ className: cn(
63
+ "flex size-7 shrink-0 items-center justify-center rounded-badge [&_svg]:size-3.5",
64
+ markerClasses[resolvedTone],
65
+ status === "current" && "ring-2 ring-accent/40",
66
+ status === "pending" && "border border-line-strong border-dashed bg-transparent",
67
+ classNames?.marker
68
+ ),
69
+ children: glyph ?? /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-current opacity-40" })
70
+ }
71
+ ),
72
+ last ? null : /* @__PURE__ */ jsx(
73
+ "span",
74
+ {
75
+ "aria-hidden": "true",
76
+ className: cn(
77
+ "w-px flex-1",
78
+ status === "done" ? "bg-success/50" : "bg-divider",
79
+ classNames?.connector
80
+ )
81
+ }
82
+ )
83
+ ] }),
84
+ /* @__PURE__ */ jsxs(
85
+ "div",
30
86
  {
31
- "aria-hidden": "true",
32
87
  className: cn(
33
- "flex size-7 shrink-0 items-center justify-center rounded-badge [&_svg]:size-3.5",
34
- markerClasses[tone],
35
- classNames?.marker
88
+ "flex min-w-0 flex-1 flex-col gap-1",
89
+ last ? "pb-0" : "pb-density-lg",
90
+ status === "pending" && "text-ink-3",
91
+ classNames?.content
36
92
  ),
37
- children: item.icon ?? /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-current" })
38
- }
39
- ),
40
- last ? null : /* @__PURE__ */ jsx(
41
- "span",
42
- {
43
- "aria-hidden": "true",
44
- className: cn("w-px flex-1 bg-divider", classNames?.connector)
93
+ children: [
94
+ /* @__PURE__ */ jsxs(
95
+ "div",
96
+ {
97
+ className: cn(
98
+ "flex min-w-0 flex-wrap items-baseline gap-x-density-sm",
99
+ classNames?.header
100
+ ),
101
+ children: [
102
+ /* @__PURE__ */ jsxs(
103
+ "span",
104
+ {
105
+ className: cn(
106
+ "min-w-0 break-words text-row-title",
107
+ status === "pending" ? "text-ink-3" : "text-ink",
108
+ classNames?.title
109
+ ),
110
+ children: [
111
+ title,
112
+ stateText ? /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
113
+ ", ",
114
+ stateText
115
+ ] }) : null
116
+ ]
117
+ }
118
+ ),
119
+ time ? /* @__PURE__ */ jsx(
120
+ "time",
121
+ {
122
+ dateTime,
123
+ className: cn("shrink-0 text-ink-3 text-meta", classNames?.time),
124
+ children: time
125
+ }
126
+ ) : null
127
+ ]
128
+ }
129
+ ),
130
+ actor ? /* @__PURE__ */ jsx("span", { className: cn("text-ink-3 text-meta", classNames?.actor), children: actor }) : null,
131
+ description ? /* @__PURE__ */ jsx("p", { className: cn("m-0 break-words text-body text-ink-2", classNames?.description), children: description }) : null,
132
+ children
133
+ ]
45
134
  }
46
135
  )
47
- ] }),
48
- /* @__PURE__ */ jsxs(
49
- "div",
50
- {
51
- className: cn(
52
- "flex min-w-0 flex-1 flex-col gap-1",
53
- last ? "pb-0" : "pb-density-lg",
54
- classNames?.content
55
- ),
56
- children: [
57
- /* @__PURE__ */ jsxs(
58
- "div",
59
- {
60
- className: cn(
61
- "flex min-w-0 flex-wrap items-baseline gap-x-density-sm",
62
- classNames?.header
63
- ),
64
- children: [
65
- /* @__PURE__ */ jsx(
66
- "span",
67
- {
68
- className: cn(
69
- "min-w-0 break-words text-row-title text-ink",
70
- classNames?.title
71
- ),
72
- children: item.title
73
- }
74
- ),
75
- item.time ? /* @__PURE__ */ jsx(
76
- "time",
77
- {
78
- dateTime: item.dateTime,
79
- className: cn("shrink-0 text-ink-3 text-meta", classNames?.time),
80
- children: item.time
81
- }
82
- ) : null
83
- ]
84
- }
85
- ),
86
- item.actor ? /* @__PURE__ */ jsx("span", { className: cn("text-ink-3 text-meta", classNames?.actor), children: item.actor }) : null,
87
- item.description ? /* @__PURE__ */ jsx(
88
- "p",
89
- {
90
- className: cn(
91
- "m-0 break-words text-body text-ink-2",
92
- classNames?.description
93
- ),
94
- children: item.description
95
- }
96
- ) : null,
97
- item.children
98
- ]
99
- }
100
- )
101
- ] })
102
- ] }, item.id);
103
- }) }) });
136
+ ] })
137
+ ]
138
+ }
139
+ );
140
+ }
141
+ function groupOf(node) {
142
+ if (!isValidElement(node)) return void 0;
143
+ const group = node.props.group;
144
+ return typeof group === "string" ? group : void 0;
145
+ }
146
+ function Timeline({ items = [], children, className, classNames, ...props }) {
147
+ const entries = [
148
+ ...items.map(({ id, ...item }) => /* @__PURE__ */ jsx(TimelineItem, { ...item }, id)),
149
+ ...Children.toArray(children).filter(isValidElement)
150
+ ];
151
+ return /* @__PURE__ */ jsx("div", { className: cn("@container/timeline min-w-0", classNames?.root, className), children: /* @__PURE__ */ jsx(TimelineClasses.Provider, { value: classNames, children: /* @__PURE__ */ jsx("ol", { ...props, className: cn("m-0 flex list-none flex-col p-0", classNames?.list), children: entries.map((entry, index) => {
152
+ const group = groupOf(entry);
153
+ const previous = groupOf(entries[index - 1]);
154
+ return /* @__PURE__ */ jsx(
155
+ TimelinePositionContext.Provider,
156
+ {
157
+ value: {
158
+ last: index === entries.length - 1,
159
+ showGroup: group !== void 0 && group !== previous
160
+ },
161
+ children: entry
162
+ },
163
+ entry.key ?? index
164
+ );
165
+ }) }) }) });
104
166
  }
167
+ Timeline.Item = TimelineItem;
105
168
  export {
106
- Timeline
169
+ Timeline,
170
+ TimelineItem
107
171
  };
@@ -0,0 +1,54 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ export interface ChipGroupOption {
4
+ value: string;
5
+ label: ReactNode;
6
+ /** Small count after the label. */
7
+ count?: ReactNode;
8
+ /** Decorative glyph before the label (replaced by a check while selected in a multiple group). */
9
+ icon?: ReactNode;
10
+ disabled?: boolean;
11
+ }
12
+ export type ChipGroupPart = "root" | "chip" | "label" | "count" | "check";
13
+ interface ChipGroupCommon {
14
+ options: readonly ChipGroupOption[];
15
+ disabled?: boolean | undefined;
16
+ /** Form field name: a hidden input per selected value. */
17
+ name?: string | undefined;
18
+ /** Marks the group invalid (also set by `Field` through `aria-invalid`). */
19
+ invalid?: boolean | undefined;
20
+ /** Set by `Field`; the group is named from the field's label. */
21
+ id?: string | undefined;
22
+ "aria-label"?: string | undefined;
23
+ "aria-labelledby"?: string | undefined;
24
+ "aria-describedby"?: string | undefined;
25
+ "aria-invalid"?: boolean | "true" | "false" | undefined;
26
+ className?: string | undefined;
27
+ /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root. */
28
+ classNames?: ClassNames<ChipGroupPart>;
29
+ }
30
+ export interface ChipGroupMultipleProps extends ChipGroupCommon {
31
+ /** Any number of chips can be on. This is the default. */
32
+ type?: "multiple";
33
+ value?: string[] | undefined;
34
+ defaultValue?: string[] | undefined;
35
+ onValueChange?: ((value: string[]) => void) | undefined;
36
+ }
37
+ export interface ChipGroupSingleProps extends ChipGroupCommon {
38
+ /** At most one chip is on. */
39
+ type: "single";
40
+ value?: string | undefined;
41
+ defaultValue?: string | undefined;
42
+ onValueChange?: ((value: string) => void) | undefined;
43
+ /** Lets the pressed chip be pressed again to clear the choice (`""`). Off by default: a filter keeps one on. */
44
+ allowDeselect?: boolean | undefined;
45
+ }
46
+ export type ChipGroupProps = ChipGroupMultipleProps | ChipGroupSingleProps;
47
+ /**
48
+ * A set of chips that act as toggle buttons (`aria-pressed`) in a `fieldset` (a named group): pick several
49
+ * (`type="multiple"`, default) or one (`type="single"`). Arrow keys, Home and End move between
50
+ * chips and Space or Enter toggles; the group works inside `Field` (named from its label,
51
+ * described by its hint and error) and submits one hidden input per selected value when named.
52
+ */
53
+ export declare function ChipGroup(props: ChipGroupProps): import("react").JSX.Element;
54
+ export {};
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef, useState } from "react";
4
+ import { Check } from "../../icons/index.js";
5
+ import { cn } from "../../utils/cn.js";
6
+ import { useComposedRefs } from "../../utils/compose.js";
7
+ import { useRovingFocus } from "../../utils/roving-focus.js";
8
+ import { useControllableState } from "../../utils/use-controllable-state.js";
9
+ function ChipGroup(props) {
10
+ const {
11
+ options,
12
+ disabled,
13
+ name,
14
+ invalid,
15
+ id,
16
+ className,
17
+ classNames,
18
+ "aria-label": ariaLabel,
19
+ "aria-labelledby": ariaLabelledBy,
20
+ "aria-describedby": ariaDescribedBy,
21
+ "aria-invalid": ariaInvalid
22
+ } = props;
23
+ const single = props.type === "single";
24
+ const generated = useId();
25
+ const baseId = id ?? generated;
26
+ const [multiValue, setMultiValue] = useControllableState({
27
+ prop: props.type === "single" ? void 0 : props.value,
28
+ defaultProp: (props.type === "single" ? void 0 : props.defaultValue) ?? [],
29
+ onChange: props.type === "single" ? void 0 : props.onValueChange
30
+ });
31
+ const [singleValue, setSingleValue] = useControllableState({
32
+ prop: props.type === "single" ? props.value : void 0,
33
+ defaultProp: (props.type === "single" ? props.defaultValue : void 0) ?? "",
34
+ onChange: props.type === "single" ? props.onValueChange : void 0
35
+ });
36
+ const selected = single ? singleValue ? [singleValue] : [] : multiValue;
37
+ const toggle = (value) => {
38
+ if (props.type === "single") {
39
+ if (singleValue === value) {
40
+ if (props.allowDeselect) setSingleValue("");
41
+ } else setSingleValue(value);
42
+ return;
43
+ }
44
+ setMultiValue(
45
+ multiValue.includes(value) ? multiValue.filter((v) => v !== value) : [...multiValue, value]
46
+ );
47
+ };
48
+ const roving = useRovingFocus({
49
+ activeId: selected.find((v) => options.some((o) => o.value === v && !o.disabled)) ?? null
50
+ });
51
+ const { ref: rovingRef, onFocus: rovingOnFocus, tabIndex } = roving.rootProps;
52
+ const localRef = useRef(null);
53
+ const composedRef = useComposedRefs(rovingRef, localRef);
54
+ const [fieldLabel, setFieldLabel] = useState();
55
+ useEffect(() => {
56
+ if (ariaLabel || ariaLabelledBy || !id) return;
57
+ const label = Array.from(
58
+ localRef.current?.ownerDocument.querySelectorAll("label[for]") ?? []
59
+ ).find((candidate) => candidate.htmlFor === id);
60
+ setFieldLabel(label?.textContent?.trim() || void 0);
61
+ }, [id, ariaLabel, ariaLabelledBy]);
62
+ const isInvalid = invalid || ariaInvalid === true || ariaInvalid === "true";
63
+ return /* @__PURE__ */ jsxs(
64
+ "fieldset",
65
+ {
66
+ ref: composedRef,
67
+ id: baseId,
68
+ tabIndex,
69
+ "aria-label": ariaLabel ?? (ariaLabelledBy ? void 0 : fieldLabel),
70
+ "aria-labelledby": ariaLabelledBy,
71
+ "aria-describedby": ariaDescribedBy,
72
+ "data-type": single ? "single" : "multiple",
73
+ "data-invalid": isInvalid ? "" : void 0,
74
+ "data-disabled": disabled ? "" : void 0,
75
+ onFocus: rovingOnFocus,
76
+ className: cn(
77
+ "group/chips m-0 flex min-w-0 flex-wrap gap-1.5 border-0 p-0 outline-none",
78
+ classNames?.root,
79
+ className
80
+ ),
81
+ children: [
82
+ options.map((option) => {
83
+ const pressed = selected.includes(option.value);
84
+ const off = disabled || option.disabled;
85
+ const item = roving.getItemProps(option.value, { disabled: off });
86
+ return /* @__PURE__ */ jsxs(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ "aria-pressed": pressed,
91
+ disabled: off,
92
+ ...item,
93
+ onClick: () => toggle(option.value),
94
+ className: cn(
95
+ "inline-flex min-h-7 cursor-pointer items-center gap-1.5 rounded-badge border-control bg-surface-control px-3 font-medium text-fs-130 text-ink-2 hover:bg-surface-2 focus-visible:focus-ring disabled:cursor-not-allowed disabled:opacity-50 aria-pressed:border-accent aria-pressed:bg-accent-soft aria-pressed:text-accent-ink group-data-[invalid]/chips:border-danger in-data-[density=touch]:min-h-11 [&_svg]:size-3",
96
+ classNames?.chip
97
+ ),
98
+ children: [
99
+ pressed && !single ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: classNames?.check }) : option.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "inline-flex shrink-0", children: option.icon }) : null,
100
+ /* @__PURE__ */ jsx("span", { className: cn("min-w-0", classNames?.label), children: option.label }),
101
+ option.count !== void 0 ? /* @__PURE__ */ jsx("span", { className: cn("text-count tabular-nums", classNames?.count), children: option.count }) : null
102
+ ]
103
+ },
104
+ option.value
105
+ );
106
+ }),
107
+ name ? selected.map((value) => /* @__PURE__ */ jsx("input", { type: "hidden", name, value }, value)) : null
108
+ ]
109
+ }
110
+ );
111
+ }
112
+ export {
113
+ ChipGroup
114
+ };
@@ -0,0 +1 @@
1
+ export { ChipGroup, type ChipGroupMultipleProps, type ChipGroupOption, type ChipGroupPart, type ChipGroupProps, type ChipGroupSingleProps, } from "./chip-group.js";
@@ -0,0 +1,6 @@
1
+ import {
2
+ ChipGroup
3
+ } from "./chip-group.js";
4
+ export {
5
+ ChipGroup
6
+ };
@@ -0,0 +1,60 @@
1
+ import { type ComponentProps } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ import { type Material } from "../../utils/material.js";
4
+ import { type ListboxGroup, type ListboxOption } from "../internal/listbox.js";
5
+ export type ComboboxOption = ListboxOption;
6
+ export type ComboboxGroup = ListboxGroup<ComboboxOption>;
7
+ export type ComboboxPart = "root" | "input" | "clear" | "content" | "option" | "group" | "status";
8
+ export interface ComboboxProps extends Omit<ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "type" | "role" | "size"> {
9
+ /** Options, optionally nested in labelled groups. For async search, pass the current results. */
10
+ options: readonly (ComboboxOption | ComboboxGroup)[];
11
+ /** Selected option value (controlled). `""` means nothing is selected. */
12
+ value?: string;
13
+ defaultValue?: string;
14
+ onValueChange?: (value: string, option: ComboboxOption | null) => void;
15
+ /**
16
+ * Called on every keystroke with the text typed, and with `""` when the search resets. Debounce
17
+ * in the caller before fetching; the component never delays or cancels requests.
18
+ */
19
+ onSearchChange?: (query: string) => void;
20
+ /**
21
+ * Local filtering. `true` (default) matches label, description and keywords ignoring case and
22
+ * accents; `false` shows `options` as given (server-side search); a function decides per option.
23
+ */
24
+ filter?: boolean | ((option: ComboboxOption, query: string) => boolean);
25
+ /** Most options rendered at once. Default 50. */
26
+ maxVisible?: number;
27
+ /** Shows the loading status, e.g. while an async search is in flight. */
28
+ loading?: boolean;
29
+ loadingText?: string;
30
+ /** Shown when nothing matches. Defaults to the localized "No results". */
31
+ emptyText?: string;
32
+ /** Shows a button that clears the selection. Default `true`. */
33
+ clearable?: boolean;
34
+ clearLabel?: string;
35
+ /** Label to show for `value` while it is not (yet) among `options`, e.g. after an async search moved on. */
36
+ valueLabel?: string;
37
+ /** Submits the value (not the typed text) with a surrounding `<form>` through a hidden input. */
38
+ name?: string;
39
+ invalid?: boolean;
40
+ /**
41
+ * `required` always sets `aria-required`. The native attribute, which blocks form submission
42
+ * with the browser's own bubble before your validation can render, is added only when this is
43
+ * `true`. Default `false`.
44
+ */
45
+ nativeRequired?: boolean;
46
+ size?: "sm" | "md";
47
+ /** Portal target for the popup. Defaults to `document.body`; pass an element to keep a scoped `data-style`. */
48
+ container?: HTMLElement | null;
49
+ /** Popup surface material; see `PopoverContent`. */
50
+ material?: Material;
51
+ /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
52
+ classNames?: ClassNames<ComboboxPart>;
53
+ }
54
+ /**
55
+ * Searchable single select (WAI-ARIA combobox with a listbox popup). The input shows the typed
56
+ * text while editing and the selected label otherwise; focus never leaves the input and the
57
+ * highlighted option is announced through `aria-activedescendant`. Works with local options or
58
+ * with results the caller loads from `onSearchChange`.
59
+ */
60
+ export declare function Combobox({ options, value: valueProp, defaultValue, onValueChange, onSearchChange, filter, maxVisible, loading, loadingText, emptyText, clearable, clearLabel, valueLabel, name, invalid, required, nativeRequired, size, container, material, disabled, className, classNames, ref, id, onFocus, onClick, onBlur, onKeyDown, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-invalid": ariaInvalid, ...props }: ComboboxProps): import("react").JSX.Element;