@craftzbay/ui 0.11.3 → 1.0.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 (166) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  3. package/dist-lib/components/ui/Accordion.js +42 -67
  4. package/dist-lib/components/ui/Accordion.js.map +1 -1
  5. package/dist-lib/components/ui/Alert.js +71 -77
  6. package/dist-lib/components/ui/Alert.js.map +1 -1
  7. package/dist-lib/components/ui/Avatar.js +67 -92
  8. package/dist-lib/components/ui/Avatar.js.map +1 -1
  9. package/dist-lib/components/ui/Badge.js +119 -74
  10. package/dist-lib/components/ui/Badge.js.map +1 -1
  11. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  12. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  13. package/dist-lib/components/ui/Button.js +129 -131
  14. package/dist-lib/components/ui/Button.js.map +1 -1
  15. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  16. package/dist-lib/components/ui/Calendar.js +99 -136
  17. package/dist-lib/components/ui/Calendar.js.map +1 -1
  18. package/dist-lib/components/ui/Card.js +88 -94
  19. package/dist-lib/components/ui/Card.js.map +1 -1
  20. package/dist-lib/components/ui/Carousel.js +125 -170
  21. package/dist-lib/components/ui/Carousel.js.map +1 -1
  22. package/dist-lib/components/ui/Chart.d.ts +3 -3
  23. package/dist-lib/components/ui/Chart.js +435 -464
  24. package/dist-lib/components/ui/Chart.js.map +1 -1
  25. package/dist-lib/components/ui/Checkbox.js +60 -69
  26. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  27. package/dist-lib/components/ui/Combobox.js +179 -192
  28. package/dist-lib/components/ui/Combobox.js.map +1 -1
  29. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  30. package/dist-lib/components/ui/CommandPalette.js +106 -167
  31. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  32. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  33. package/dist-lib/components/ui/ContextMenu.js +89 -154
  34. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  35. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  36. package/dist-lib/components/ui/DataGrid.js +99 -96
  37. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  38. package/dist-lib/components/ui/DatePicker.js +151 -188
  39. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  41. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  42. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  43. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  44. package/dist-lib/components/ui/Dialog.js +108 -156
  45. package/dist-lib/components/ui/Dialog.js.map +1 -1
  46. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  47. package/dist-lib/components/ui/Drawer.js +90 -124
  48. package/dist-lib/components/ui/Drawer.js.map +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  50. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  51. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  52. package/dist-lib/components/ui/EmptyState.js +31 -44
  53. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  54. package/dist-lib/components/ui/ErrorState.js +57 -67
  55. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  56. package/dist-lib/components/ui/FileUpload.js +113 -107
  57. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  58. package/dist-lib/components/ui/Form.d.ts +6 -4
  59. package/dist-lib/components/ui/Form.js +117 -122
  60. package/dist-lib/components/ui/Form.js.map +1 -1
  61. package/dist-lib/components/ui/Icon.d.ts +1 -1
  62. package/dist-lib/components/ui/Icon.js +30 -29
  63. package/dist-lib/components/ui/Icon.js.map +1 -1
  64. package/dist-lib/components/ui/IconButton.js +61 -63
  65. package/dist-lib/components/ui/IconButton.js.map +1 -1
  66. package/dist-lib/components/ui/Input.js +133 -156
  67. package/dist-lib/components/ui/Input.js.map +1 -1
  68. package/dist-lib/components/ui/Kbd.js +14 -21
  69. package/dist-lib/components/ui/Kbd.js.map +1 -1
  70. package/dist-lib/components/ui/MultiSelect.js +176 -208
  71. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  72. package/dist-lib/components/ui/Pagination.js +152 -149
  73. package/dist-lib/components/ui/Pagination.js.map +1 -1
  74. package/dist-lib/components/ui/Popover.js +18 -33
  75. package/dist-lib/components/ui/Popover.js.map +1 -1
  76. package/dist-lib/components/ui/Progress.js +77 -99
  77. package/dist-lib/components/ui/Progress.js.map +1 -1
  78. package/dist-lib/components/ui/RadioGroup.js +51 -80
  79. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  80. package/dist-lib/components/ui/RelativeTime.js +22 -29
  81. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  82. package/dist-lib/components/ui/ScrollArea.js +39 -58
  83. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  84. package/dist-lib/components/ui/Select.js +108 -131
  85. package/dist-lib/components/ui/Select.js.map +1 -1
  86. package/dist-lib/components/ui/Separator.js +18 -24
  87. package/dist-lib/components/ui/Separator.js.map +1 -1
  88. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  89. package/dist-lib/components/ui/Sheet.js +77 -129
  90. package/dist-lib/components/ui/Sheet.js.map +1 -1
  91. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  92. package/dist-lib/components/ui/Sidebar.js +168 -207
  93. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  94. package/dist-lib/components/ui/Skeleton.js +17 -27
  95. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  96. package/dist-lib/components/ui/Slider.js +45 -62
  97. package/dist-lib/components/ui/Slider.js.map +1 -1
  98. package/dist-lib/components/ui/Snackbar.js +75 -55
  99. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  100. package/dist-lib/components/ui/Spinner.js +45 -52
  101. package/dist-lib/components/ui/Spinner.js.map +1 -1
  102. package/dist-lib/components/ui/Stepper.js +56 -108
  103. package/dist-lib/components/ui/Stepper.js.map +1 -1
  104. package/dist-lib/components/ui/Switch.js +46 -79
  105. package/dist-lib/components/ui/Switch.js.map +1 -1
  106. package/dist-lib/components/ui/Table.js +108 -169
  107. package/dist-lib/components/ui/Table.js.map +1 -1
  108. package/dist-lib/components/ui/Tabs.js +57 -88
  109. package/dist-lib/components/ui/Tabs.js.map +1 -1
  110. package/dist-lib/components/ui/TagInput.js +76 -109
  111. package/dist-lib/components/ui/TagInput.js.map +1 -1
  112. package/dist-lib/components/ui/Textarea.js +74 -86
  113. package/dist-lib/components/ui/Textarea.js.map +1 -1
  114. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  115. package/dist-lib/components/ui/Timeline.js +61 -49
  116. package/dist-lib/components/ui/Timeline.js.map +1 -1
  117. package/dist-lib/components/ui/Toast.d.ts +1 -1
  118. package/dist-lib/components/ui/Toast.js +136 -150
  119. package/dist-lib/components/ui/Toast.js.map +1 -1
  120. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  121. package/dist-lib/components/ui/Tooltip.js +35 -56
  122. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  123. package/dist-lib/components/ui/TopNav.js +46 -66
  124. package/dist-lib/components/ui/TopNav.js.map +1 -1
  125. package/dist-lib/components/ui/Tree.js +134 -168
  126. package/dist-lib/components/ui/Tree.js.map +1 -1
  127. package/dist-lib/hooks/use-debounce.js +24 -33
  128. package/dist-lib/hooks/use-debounce.js.map +1 -1
  129. package/dist-lib/hooks/use-delayed-loading.js +20 -18
  130. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  131. package/dist-lib/hooks/use-field-ids.js +14 -16
  132. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  133. package/dist-lib/hooks/use-media-query.js +15 -19
  134. package/dist-lib/hooks/use-media-query.js.map +1 -1
  135. package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
  136. package/dist-lib/hooks/use-modifier-key.js +19 -16
  137. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  138. package/dist-lib/hooks/use-strings.js +10 -10
  139. package/dist-lib/hooks/use-strings.js.map +1 -1
  140. package/dist-lib/hooks/use-toast.js +73 -62
  141. package/dist-lib/hooks/use-toast.js.map +1 -1
  142. package/dist-lib/icon.js +2 -6
  143. package/dist-lib/icons/index.d.ts +1 -1
  144. package/dist-lib/icons/index.js +166 -163
  145. package/dist-lib/icons/index.js.map +1 -1
  146. package/dist-lib/illustrations/index.d.ts +7 -7
  147. package/dist-lib/illustrations/index.js +255 -106
  148. package/dist-lib/illustrations/index.js.map +1 -1
  149. package/dist-lib/index.js +69 -291
  150. package/dist-lib/lib/cva.js +2 -0
  151. package/dist-lib/lib/format.js +71 -87
  152. package/dist-lib/lib/format.js.map +1 -1
  153. package/dist-lib/lib/return-focus.js +11 -11
  154. package/dist-lib/lib/return-focus.js.map +1 -1
  155. package/dist-lib/lib/strings.js +167 -135
  156. package/dist-lib/lib/strings.js.map +1 -1
  157. package/dist-lib/lib/strings.mn.js +150 -113
  158. package/dist-lib/lib/strings.mn.js.map +1 -1
  159. package/dist-lib/lib/utils.js +9 -9
  160. package/dist-lib/lib/utils.js.map +1 -1
  161. package/dist-lib/styles.css +3 -1
  162. package/package.json +53 -53
  163. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  164. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  165. package/dist-lib/icon.js.map +0 -1
  166. package/dist-lib/index.js.map +0 -1
@@ -1,111 +1,78 @@
1
1
  "use client";
2
- import { jsxs as f, jsx as o } from "react/jsx-runtime";
3
- import { forwardRef as q, useState as k, useCallback as A } from "react";
4
- import { X as G } from "../../icons/index.js";
5
- import { cn as m } from "../../lib/utils.js";
6
- import { useStrings as J } from "../../hooks/use-strings.js";
7
- import { formatString as L } from "../../lib/strings.js";
8
- import { useFieldIds as O } from "../../hooks/use-field-ids.js";
9
- const P = q(function({
10
- value: s,
11
- defaultValue: B = [],
12
- onChange: i,
13
- label: a,
14
- hideLabel: E,
15
- description: l,
16
- placeholder: D,
17
- max: g,
18
- disabled: p,
19
- error: c,
20
- separators: S = ["Enter", ","],
21
- id: b,
22
- "aria-describedby": T,
23
- "aria-label": j,
24
- className: F
25
- }, K) {
26
- const [$, z] = k(B), [n, d] = k(""), r = s ?? $, h = J(), x = D ?? h.tagInput.placeholder, u = !!c, v = u && c !== !0, { fieldId: y, helperId: H, errorId: M, describedBy: R } = O(b, {
27
- hasHelper: !!l,
28
- hasError: v,
29
- extra: T
30
- }), w = A(
31
- (e) => {
32
- s === void 0 && z(e), i == null || i(e);
33
- },
34
- [i, s]
35
- ), I = (e) => {
36
- const t = e.trim();
37
- !t || r.includes(t) || g !== void 0 && r.length >= g || w([...r, t]);
38
- }, N = (e) => w(r.filter((t, _) => _ !== e)), X = (e) => {
39
- S.includes(e.key) ? (e.preventDefault(), I(n), d("")) : e.key === "Backspace" && !n && r.length && N(r.length - 1);
40
- };
41
- return /* @__PURE__ */ f("div", { ref: K, className: m("flex flex-col gap-1.5", F), children: [
42
- a && /* @__PURE__ */ o(
43
- "label",
44
- {
45
- htmlFor: y,
46
- className: m("text-foreground text-sm font-medium", E && "sr-only"),
47
- children: a
48
- }
49
- ),
50
- /* @__PURE__ */ f(
51
- "div",
52
- {
53
- className: m(
54
- // Cap growth at ~3 chip rows and scroll inside — an unbounded field
55
- // pushes the surrounding layout around as tags are added.
56
- "bg-card flex max-h-24 min-h-9 w-full flex-wrap items-center gap-1.5 overflow-y-auto rounded-md border px-2 py-1.5",
57
- "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
58
- "focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2",
59
- u ? "border-danger focus-within:border-danger focus-within:ring-danger" : "border-border-input focus-within:border-accent focus-within:ring-ring",
60
- p && "pointer-events-none opacity-50"
61
- ),
62
- children: [
63
- r.map((e, t) => /* @__PURE__ */ f(
64
- "span",
65
- {
66
- className: "bg-background-muted inline-flex items-center gap-1 rounded-sm px-2 py-0.5 text-xs",
67
- children: [
68
- e,
69
- /* @__PURE__ */ o(
70
- "button",
71
- {
72
- type: "button",
73
- onClick: () => N(t),
74
- className: "text-foreground-muted hover:bg-background-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative rounded-sm p-0.5 outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1",
75
- "aria-label": L(h.tagInput.remove, { tag: e }),
76
- children: /* @__PURE__ */ o(G, { className: "size-3", "aria-hidden": !0 })
77
- }
78
- )
79
- ]
80
- },
81
- `${e}-${t}`
82
- )),
83
- /* @__PURE__ */ o(
84
- "input",
85
- {
86
- id: y,
87
- value: n,
88
- disabled: p,
89
- onChange: (e) => d(e.target.value),
90
- onKeyDown: X,
91
- onBlur: () => {
92
- n && (I(n), d(""));
93
- },
94
- placeholder: r.length === 0 ? x : void 0,
95
- "aria-label": j ?? (a || b ? void 0 : x),
96
- "aria-invalid": u || void 0,
97
- "aria-describedby": R,
98
- className: "placeholder:text-foreground-subtle min-w-[8ch] flex-1 bg-transparent text-lg outline-none md:text-sm"
99
- }
100
- )
101
- ]
102
- }
103
- ),
104
- v ? /* @__PURE__ */ o("p", { id: M, className: "text-danger-text text-xs", children: c }) : l ? /* @__PURE__ */ o("p", { id: H, className: "text-foreground-subtle text-xs", children: l }) : null
105
- ] });
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { formatString as t } from "../../lib/strings.js";
4
+ import { useFieldIds as n } from "../../hooks/use-field-ids.js";
5
+ import { useStrings as r } from "../../hooks/use-strings.js";
6
+ import { X as i } from "../../icons/index.js";
7
+ import { forwardRef as a, useCallback as o, useState as s } from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ //#region src/components/ui/TagInput.tsx
10
+ var u = a(function({ value: a, defaultValue: u = [], onChange: d, label: f, hideLabel: p, description: m, placeholder: h, max: g, disabled: _, error: v, separators: y = ["Enter", ","], id: b, "aria-describedby": x, "aria-label": S, className: C }, w) {
11
+ let [T, E] = s(u), [D, O] = s(""), k = a ?? T, A = r(), j = h ?? A.tagInput.placeholder, M = !!v, N = M && v !== !0, { fieldId: P, helperId: F, errorId: I, describedBy: L } = n(b, {
12
+ hasHelper: !!m,
13
+ hasError: N,
14
+ extra: x
15
+ }), R = o((e) => {
16
+ a === void 0 && E(e), d?.(e);
17
+ }, [d, a]), z = (e) => {
18
+ let t = e.trim();
19
+ !t || k.includes(t) || g !== void 0 && k.length >= g || R([...k, t]);
20
+ }, B = (e) => R(k.filter((t, n) => n !== e));
21
+ return /* @__PURE__ */ l("div", {
22
+ ref: w,
23
+ className: e("flex flex-col gap-1.5", C),
24
+ children: [
25
+ f && /* @__PURE__ */ c("label", {
26
+ htmlFor: P,
27
+ className: e("text-foreground text-sm font-medium", p && "sr-only"),
28
+ children: f
29
+ }),
30
+ /* @__PURE__ */ l("div", {
31
+ className: e("bg-card flex max-h-24 min-h-9 w-full flex-wrap items-center gap-1.5 overflow-y-auto rounded-md border px-2 py-1.5", "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]", "focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2", M ? "border-danger focus-within:border-danger focus-within:ring-danger" : "border-border-input focus-within:border-accent focus-within:ring-ring", _ && "pointer-events-none opacity-50"),
32
+ children: [k.map((e, n) => /* @__PURE__ */ l("span", {
33
+ className: "bg-background-muted inline-flex items-center gap-1 rounded-sm px-2 py-0.5 text-xs",
34
+ children: [e, /* @__PURE__ */ c("button", {
35
+ type: "button",
36
+ onClick: () => B(n),
37
+ className: "text-foreground-muted hover:bg-background-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative rounded-sm p-0.5 outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1",
38
+ "aria-label": t(A.tagInput.remove, { tag: e }),
39
+ children: /* @__PURE__ */ c(i, {
40
+ className: "size-3",
41
+ "aria-hidden": !0
42
+ })
43
+ })]
44
+ }, `${e}-${n}`)), /* @__PURE__ */ c("input", {
45
+ id: P,
46
+ value: D,
47
+ disabled: _,
48
+ onChange: (e) => O(e.target.value),
49
+ onKeyDown: (e) => {
50
+ y.includes(e.key) ? (e.preventDefault(), z(D), O("")) : e.key === "Backspace" && !D && k.length && B(k.length - 1);
51
+ },
52
+ onBlur: () => {
53
+ D && (z(D), O(""));
54
+ },
55
+ placeholder: k.length === 0 ? j : void 0,
56
+ "aria-label": S ?? (f || b ? void 0 : j),
57
+ "aria-invalid": M || void 0,
58
+ "aria-describedby": L,
59
+ className: "placeholder:text-foreground-subtle min-w-[8ch] flex-1 bg-transparent text-lg outline-none md:text-sm"
60
+ })]
61
+ }),
62
+ N ? /* @__PURE__ */ c("p", {
63
+ id: I,
64
+ className: "text-danger-text text-xs",
65
+ children: v
66
+ }) : m ? /* @__PURE__ */ c("p", {
67
+ id: F,
68
+ className: "text-foreground-subtle text-xs",
69
+ children: m
70
+ }) : null
71
+ ]
72
+ });
106
73
  });
107
- P.displayName = "TagInput";
108
- export {
109
- P as TagInput
110
- };
111
- //# sourceMappingURL=TagInput.js.map
74
+ u.displayName = "TagInput";
75
+ //#endregion
76
+ export { u as TagInput };
77
+
78
+ //# sourceMappingURL=TagInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TagInput.js","sources":["../../../src/components/ui/TagInput.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useCallback, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { X } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface TagInputProps {\n /** Controlled list of tags. */\n value?: string[];\n /** Default tags when uncontrolled. */\n defaultValue?: string[];\n /** Called when the tag list changes. */\n onChange?: (tags: string[]) => void;\n /** Visible label rendered above the field. */\n label?: ReactNode;\n /** Visually conceal the label while keeping it for screen readers. */\n hideLabel?: boolean;\n /** Hint below the field. Hidden while `error` is set. */\n description?: ReactNode;\n /** Placeholder shown inside the inline input. */\n placeholder?: string;\n /** Maximum number of tags. */\n max?: number;\n /** Disable the editor. */\n disabled?: boolean;\n /**\n * Validation state. `true` only paints the danger border; a ReactNode also\n * renders the message below the field and wires `aria-describedby`.\n */\n error?: boolean | ReactNode;\n /** Treat these characters as separators (default: Enter + comma). */\n separators?: string[];\n /** Consumer-supplied id for the inline input. */\n id?: string;\n /** Extra ids to append to `aria-describedby`. */\n 'aria-describedby'?: string;\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * Chip-based multi-value input. Press Enter or comma to add. Backspace on an\n * empty input removes the last tag.\n */\nexport const TagInput = forwardRef<HTMLDivElement, TagInputProps>(function TagInput(\n {\n value,\n defaultValue = [],\n onChange,\n label,\n hideLabel,\n description,\n placeholder: placeholderProp,\n max,\n disabled,\n error,\n separators = ['Enter', ','],\n id,\n 'aria-describedby': ariaDescribedby,\n 'aria-label': ariaLabel,\n className,\n },\n ref,\n) {\n const [internal, setInternal] = useState<string[]>(defaultValue);\n const [draft, setDraft] = useState('');\n const tags = value ?? internal;\n\n const strings = useStrings();\n const placeholder = placeholderProp ?? strings.tagInput.placeholder;\n const isError = Boolean(error);\n const hasErrorMessage = isError && error !== true;\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(description),\n hasError: hasErrorMessage,\n extra: ariaDescribedby,\n });\n\n const update = useCallback(\n (next: string[]) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n },\n [onChange, value],\n );\n\n const commit = (raw: string) => {\n const t = raw.trim();\n if (!t || tags.includes(t) || (max !== undefined && tags.length >= max)) return;\n update([...tags, t]);\n };\n\n const remove = (idx: number) => update(tags.filter((_, i) => i !== idx));\n\n const onKey = (e: KeyboardEvent<HTMLInputElement>) => {\n if (separators.includes(e.key)) {\n e.preventDefault();\n commit(draft);\n setDraft('');\n } else if (e.key === 'Backspace' && !draft && tags.length) {\n remove(tags.length - 1);\n }\n };\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn('text-foreground text-sm font-medium', hideLabel && 'sr-only')}\n >\n {label}\n </label>\n )}\n <div\n className={cn(\n // Cap growth at ~3 chip rows and scroll inside — an unbounded field\n // pushes the surrounding layout around as tags are added.\n 'bg-card flex max-h-24 min-h-9 w-full flex-wrap items-center gap-1.5 overflow-y-auto rounded-md border px-2 py-1.5',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2',\n isError\n ? 'border-danger focus-within:border-danger focus-within:ring-danger'\n : 'border-border-input focus-within:border-accent focus-within:ring-ring',\n disabled && 'pointer-events-none opacity-50',\n )}\n >\n {tags.map((t, i) => (\n <span\n key={`${t}-${i}`}\n className=\"bg-background-muted inline-flex items-center gap-1 rounded-sm px-2 py-0.5 text-xs\"\n >\n {t}\n <button\n type=\"button\"\n onClick={() => remove(i)}\n // 16px glyph box + halo → ≥24px hit area (WCAG 2.5.8) without growing the chip.\n className=\"text-foreground-muted hover:bg-background-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative rounded-sm p-0.5 outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1\"\n aria-label={formatString(strings.tagInput.remove, { tag: t })}\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n </span>\n ))}\n <input\n id={fieldId}\n value={draft}\n disabled={disabled}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={onKey}\n onBlur={() => {\n if (draft) {\n commit(draft);\n setDraft('');\n }\n }}\n placeholder={tags.length === 0 ? placeholder : undefined}\n // Unlabelled field: fall back to the placeholder. A consumer `id`\n // implies an external <label htmlFor>.\n aria-label={ariaLabel ?? (label || id ? undefined : placeholder)}\n aria-invalid={isError || undefined}\n aria-describedby={describedBy}\n className=\"placeholder:text-foreground-subtle min-w-[8ch] flex-1 bg-transparent text-lg outline-none md:text-sm\"\n />\n </div>\n {hasErrorMessage ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : description ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {description}\n </p>\n ) : null}\n </div>\n );\n});\nTagInput.displayName = 'TagInput';\n"],"names":["TagInput","forwardRef","value","defaultValue","onChange","label","hideLabel","description","placeholderProp","max","disabled","error","separators","id","ariaDescribedby","ariaLabel","className","ref","internal","setInternal","useState","draft","setDraft","tags","strings","useStrings","placeholder","isError","hasErrorMessage","fieldId","helperId","errorId","describedBy","useFieldIds","update","useCallback","next","commit","raw","remove","idx","_","i","onKey","cn","jsx","jsxs","t","formatString","X"],"mappings":";;;;;;;;AA+CO,MAAMA,IAAWC,EAA0C,SAChE;AAAA,EACE,OAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAaC;AAAA,EACb,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC,IAAa,CAAC,SAAS,GAAG;AAAA,EAC1B,IAAAC;AAAA,EACA,oBAAoBC;AAAA,EACpB,cAAcC;AAAA,EACd,WAAAC;AACF,GACAC,GACA;AACA,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAmBjB,CAAY,GACzD,CAACkB,GAAOC,CAAQ,IAAIF,EAAS,EAAE,GAC/BG,IAAOrB,KAASgB,GAEhBM,IAAUC,EAAA,GACVC,IAAclB,KAAmBgB,EAAQ,SAAS,aAClDG,IAAU,EAAQhB,GAClBiB,IAAkBD,KAAWhB,MAAU,IACvC,EAAE,SAAAkB,GAAS,UAAAC,GAAU,SAAAC,GAAS,aAAAC,EAAA,IAAgBC,EAAYpB,GAAI;AAAA,IAClE,WAAW,EAAQN;AAAA,IACnB,UAAUqB;AA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AA;AAAA,gBAAAC;AAAA,gBACD,gBAAAF;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAS,MAAMN,EAAOG,CAAC;AAAA,oBAEvB,WAAU;AAAA,oBACV,cAAYM,EAAaxB,EAAQ,SAAS,QAAQ,EAAE,KAAKuB,GAAG;AAAA,oBAE5D,UAAA,gBAAAF,EAACI,GAAA,EAAE,WAAU,UAAS,eAAW,GAAA,CAAC;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACpC;AAAA,YAAA;AAAA,YAZK,GAAGF,CAAC,IAAIL,CAAC;AAAA,UAAA,CAcjB;AAAA,UACD,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAIhB;AAAA,cACJ,OAAOR;AAAA,cACP,UAAAX;AAAA,cACA,UAAU,CAAC,MAAMY,EAAS,EAAE,OAAO,KAAK;AAAA,cACxC,WAAWqB;AAAA,cACX,QAAQ,MAAM;AACZ,gBAAItB,MACFgB,EAAOhB,CAAK,GACZC,EAAS,EAAE;AAAA,cAEf;AAAA,cACA,aAAaC,EAAK,WAAW,IAAIG,IAAc;AAAA,cAG/C,cAAYX,MAAcV,KAASQ,IAAK,SAAYa;AAAA,cACpD,gBAAcC,KAAW;AAAA,cACzB,oBAAkBK;AAAA,cAClB,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEDJ,IACC,gBAAAiB,EAAC,KAAA,EAAE,IAAId,GAAS,WAAU,4BACvB,UAAApB,EAAA,CACH,IACEJ,sBACD,KAAA,EAAE,IAAIuB,GAAU,WAAU,kCACxB,aACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;AACD9B,EAAS,cAAc;"}
1
+ {"version":3,"file":"TagInput.js","names":[],"sources":["../../../src/components/ui/TagInput.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useCallback, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { X } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { formatString } from '@/lib/strings';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface TagInputProps {\n /** Controlled list of tags. */\n value?: string[];\n /** Default tags when uncontrolled. */\n defaultValue?: string[];\n /** Called when the tag list changes. */\n onChange?: (tags: string[]) => void;\n /** Visible label rendered above the field. */\n label?: ReactNode;\n /** Visually conceal the label while keeping it for screen readers. */\n hideLabel?: boolean;\n /** Hint below the field. Hidden while `error` is set. */\n description?: ReactNode;\n /** Placeholder shown inside the inline input. */\n placeholder?: string;\n /** Maximum number of tags. */\n max?: number;\n /** Disable the editor. */\n disabled?: boolean;\n /**\n * Validation state. `true` only paints the danger border; a ReactNode also\n * renders the message below the field and wires `aria-describedby`.\n */\n error?: boolean | ReactNode;\n /** Treat these characters as separators (default: Enter + comma). */\n separators?: string[];\n /** Consumer-supplied id for the inline input. */\n id?: string;\n /** Extra ids to append to `aria-describedby`. */\n 'aria-describedby'?: string;\n 'aria-label'?: string;\n className?: string;\n}\n\n/**\n * Chip-based multi-value input. Press Enter or comma to add. Backspace on an\n * empty input removes the last tag.\n */\nexport const TagInput = forwardRef<HTMLDivElement, TagInputProps>(function TagInput(\n {\n value,\n defaultValue = [],\n onChange,\n label,\n hideLabel,\n description,\n placeholder: placeholderProp,\n max,\n disabled,\n error,\n separators = ['Enter', ','],\n id,\n 'aria-describedby': ariaDescribedby,\n 'aria-label': ariaLabel,\n className,\n },\n ref,\n) {\n const [internal, setInternal] = useState<string[]>(defaultValue);\n const [draft, setDraft] = useState('');\n const tags = value ?? internal;\n\n const strings = useStrings();\n const placeholder = placeholderProp ?? strings.tagInput.placeholder;\n const isError = Boolean(error);\n const hasErrorMessage = isError && error !== true;\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(description),\n hasError: hasErrorMessage,\n extra: ariaDescribedby,\n });\n\n const update = useCallback(\n (next: string[]) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n },\n [onChange, value],\n );\n\n const commit = (raw: string) => {\n const t = raw.trim();\n if (!t || tags.includes(t) || (max !== undefined && tags.length >= max)) return;\n update([...tags, t]);\n };\n\n const remove = (idx: number) => update(tags.filter((_, i) => i !== idx));\n\n const onKey = (e: KeyboardEvent<HTMLInputElement>) => {\n if (separators.includes(e.key)) {\n e.preventDefault();\n commit(draft);\n setDraft('');\n } else if (e.key === 'Backspace' && !draft && tags.length) {\n remove(tags.length - 1);\n }\n };\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn('text-foreground text-sm font-medium', hideLabel && 'sr-only')}\n >\n {label}\n </label>\n )}\n <div\n className={cn(\n // Cap growth at ~3 chip rows and scroll inside — an unbounded field\n // pushes the surrounding layout around as tags are added.\n 'bg-card flex max-h-24 min-h-9 w-full flex-wrap items-center gap-1.5 overflow-y-auto rounded-md border px-2 py-1.5',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'focus-within:ring-offset-background focus-within:ring-2 focus-within:ring-offset-2',\n isError\n ? 'border-danger focus-within:border-danger focus-within:ring-danger'\n : 'border-border-input focus-within:border-accent focus-within:ring-ring',\n disabled && 'pointer-events-none opacity-50',\n )}\n >\n {tags.map((t, i) => (\n <span\n key={`${t}-${i}`}\n className=\"bg-background-muted inline-flex items-center gap-1 rounded-sm px-2 py-0.5 text-xs\"\n >\n {t}\n <button\n type=\"button\"\n onClick={() => remove(i)}\n // 16px glyph box + halo → ≥24px hit area (WCAG 2.5.8) without growing the chip.\n className=\"text-foreground-muted hover:bg-background-subtle hover:text-foreground focus-visible:ring-ring focus-visible:ring-offset-background relative rounded-sm p-0.5 outline-none before:absolute before:-inset-1.5 before:content-[''] focus-visible:ring-2 focus-visible:ring-offset-1\"\n aria-label={formatString(strings.tagInput.remove, { tag: t })}\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n </span>\n ))}\n <input\n id={fieldId}\n value={draft}\n disabled={disabled}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={onKey}\n onBlur={() => {\n if (draft) {\n commit(draft);\n setDraft('');\n }\n }}\n placeholder={tags.length === 0 ? placeholder : undefined}\n // Unlabelled field: fall back to the placeholder. A consumer `id`\n // implies an external <label htmlFor>.\n aria-label={ariaLabel ?? (label || id ? undefined : placeholder)}\n aria-invalid={isError || undefined}\n aria-describedby={describedBy}\n className=\"placeholder:text-foreground-subtle min-w-[8ch] flex-1 bg-transparent text-lg outline-none md:text-sm\"\n />\n </div>\n {hasErrorMessage ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : description ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {description}\n </p>\n ) : null}\n </div>\n );\n});\nTagInput.displayName = 'TagInput';\n"],"mappings":";;;;;;;;;AA+CA,IAAa,IAAW,EAA0C,SAChE,EACE,UACA,kBAAe,CAAC,GAChB,aACA,UACA,cACA,gBACA,aAAa,GACb,QACA,aACA,UACA,gBAAa,CAAC,SAAS,GAAG,GAC1B,OACA,oBAAoB,GACpB,cAAc,GACd,gBAEF,GACA;CACA,IAAM,CAAC,GAAU,KAAe,EAAmB,CAAY,GACzD,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,IAAO,KAAS,GAEhB,IAAU,EAAW,GACrB,IAAc,KAAmB,EAAQ,SAAS,aAClD,IAAU,EAAQ,GAClB,IAAkB,KAAW,MAAU,IACvC,EAAE,YAAS,aAAU,YAAS,mBAAgB,EAAY,GAAI;EAClE,WAAW,EAAQ;EACnB,UAAU;EACV,OAAO;CACT,CAAC,GAEK,IAAS,GACZ,MAAmB;EAElB,AADI,MAAU,KAAA,KAAW,EAAY,CAAI,GACzC,IAAW,CAAI;CACjB,GACA,CAAC,GAAU,CAAK,CAClB,GAEM,KAAU,MAAgB;EAC9B,IAAM,IAAI,EAAI,KAAK;EACf,CAAC,KAAK,EAAK,SAAS,CAAC,KAAM,MAAQ,KAA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IACC,kBAAC,KAAD;IAAG,IAAI;IAAS,WAAU;IACvB,UAAA;GACA,CAAA,IACD,IACF,kBAAC,KAAD;IAAG,IAAI;IAAU,WAAU;IACxB,UAAA;GACA,CAAA,IACD;EACD;;AAET,CAAC;AACD,EAAS,cAAc"}
@@ -1,88 +1,76 @@
1
1
  "use client";
2
- import { jsxs as Y, jsx as n } from "react/jsx-runtime";
3
- import { forwardRef as $, useRef as q, useCallback as A, useEffect as H } from "react";
4
- import { cn as b } from "../../lib/utils.js";
5
- import { useFieldIds as D } from "../../hooks/use-field-ids.js";
6
- const G = $(function({
7
- className: N,
8
- label: p,
9
- helperText: a,
10
- error: i,
11
- autoResize: r,
12
- minRows: d = 3,
13
- maxRows: m = 12,
14
- hideLabel: E,
15
- id: T,
16
- onChange: l,
17
- value: g,
18
- defaultValue: x,
19
- "aria-describedby": j,
20
- "aria-invalid": c,
21
- ...k
22
- }, s) {
23
- const w = !!i || c === !0 || c === "true", { fieldId: h, helperId: I, errorId: M, describedBy: O } = D(T, {
24
- hasHelper: !!a,
25
- hasError: !!i,
26
- extra: j
27
- }), f = q(null), W = (e) => {
28
- f.current = e, typeof s == "function" ? s(e) : s && (s.current = e);
29
- }, o = A(() => {
30
- const e = f.current;
31
- if (!e || !r) return;
32
- const t = getComputedStyle(e), v = parseFloat(t.lineHeight) || 20, y = (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0), u = (parseFloat(t.borderTopWidth) || 0) + (parseFloat(t.borderBottomWidth) || 0), S = v * d + y + u, F = v * m + y + u;
33
- e.style.height = "auto";
34
- const B = e.scrollHeight + u;
35
- e.style.height = `${Math.min(Math.max(B, S), F)}px`, e.style.overflowY = B > F ? "auto" : "hidden";
36
- }, [r, d, m]);
37
- return H(() => {
38
- r && o();
39
- }, [r, o, g, x]), H(() => {
40
- const e = f.current;
41
- if (!r || !e || typeof ResizeObserver > "u") return;
42
- const t = new ResizeObserver(() => o());
43
- return t.observe(e), () => t.disconnect();
44
- }, [r, o]), /* @__PURE__ */ Y("div", { className: b("flex flex-col gap-1.5", N), children: [
45
- p && /* @__PURE__ */ n(
46
- "label",
47
- {
48
- htmlFor: h,
49
- className: b("text-foreground text-sm font-medium", E && "sr-only"),
50
- children: p
51
- }
52
- ),
53
- /* @__PURE__ */ n(
54
- "textarea",
55
- {
56
- ref: W,
57
- id: h,
58
- rows: d,
59
- value: g,
60
- defaultValue: x,
61
- onChange: (e) => {
62
- l == null || l(e), r && o();
63
- },
64
- "aria-invalid": w ? !0 : c,
65
- "aria-describedby": O,
66
- className: b(
67
- "bg-card text-foreground rounded-md border px-3 py-2 text-lg md:text-sm",
68
- "placeholder:text-foreground-subtle",
69
- "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
70
- "outline-none",
71
- "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2",
72
- "focus-visible:ring-offset-background",
73
- "disabled:cursor-not-allowed disabled:opacity-50",
74
- "border-border-input focus-visible:border-accent",
75
- "aria-invalid:border-danger aria-invalid:focus-visible:border-danger aria-invalid:focus-visible:ring-danger",
76
- r ? "resize-none" : "min-h-20 resize-y"
77
- ),
78
- ...k
79
- }
80
- ),
81
- i ? /* @__PURE__ */ n("p", { id: M, className: "text-danger-text text-xs", children: i }) : a ? /* @__PURE__ */ n("p", { id: I, className: "text-foreground-subtle text-xs", children: a }) : null
82
- ] });
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { useFieldIds as t } from "../../hooks/use-field-ids.js";
4
+ import { forwardRef as n, useCallback as r, useEffect as i, useRef as a } from "react";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ //#region src/components/ui/Textarea.tsx
7
+ var c = n(function({ className: n, label: c, helperText: l, error: u, autoResize: d, minRows: f = 3, maxRows: p = 12, hideLabel: m, id: h, onChange: g, value: _, defaultValue: v, "aria-describedby": y, "aria-invalid": b, ...x }, S) {
8
+ let C = !!u || b === !0 || b === "true", { fieldId: w, helperId: T, errorId: E, describedBy: D } = t(h, {
9
+ hasHelper: !!l,
10
+ hasError: !!u,
11
+ extra: y
12
+ }), O = a(null), k = (e) => {
13
+ O.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
14
+ }, A = r(() => {
15
+ let e = O.current;
16
+ if (!e || !d) return;
17
+ let t = getComputedStyle(e), n = parseFloat(t.lineHeight) || 20, r = (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0), i = (parseFloat(t.borderTopWidth) || 0) + (parseFloat(t.borderBottomWidth) || 0), a = n * f + r + i, o = n * p + r + i;
18
+ e.style.height = "auto";
19
+ let s = e.scrollHeight + i;
20
+ e.style.height = `${Math.min(Math.max(s, a), o)}px`, e.style.overflowY = s > o ? "auto" : "hidden";
21
+ }, [
22
+ d,
23
+ f,
24
+ p
25
+ ]);
26
+ return i(() => {
27
+ d && A();
28
+ }, [
29
+ d,
30
+ A,
31
+ _,
32
+ v
33
+ ]), i(() => {
34
+ let e = O.current;
35
+ if (!d || !e || typeof ResizeObserver > "u") return;
36
+ let t = new ResizeObserver(() => A());
37
+ return t.observe(e), () => t.disconnect();
38
+ }, [d, A]), /* @__PURE__ */ s("div", {
39
+ className: e("flex flex-col gap-1.5", n),
40
+ children: [
41
+ c && /* @__PURE__ */ o("label", {
42
+ htmlFor: w,
43
+ className: e("text-foreground text-sm font-medium", m && "sr-only"),
44
+ children: c
45
+ }),
46
+ /* @__PURE__ */ o("textarea", {
47
+ ref: k,
48
+ id: w,
49
+ rows: f,
50
+ value: _,
51
+ defaultValue: v,
52
+ onChange: (e) => {
53
+ g?.(e), d && A();
54
+ },
55
+ "aria-invalid": C ? !0 : b,
56
+ "aria-describedby": D,
57
+ className: e("bg-card text-foreground rounded-md border px-3 py-2 text-lg md:text-sm", "placeholder:text-foreground-subtle", "transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]", "outline-none", "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2", "focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50", "border-border-input focus-visible:border-accent", "aria-invalid:border-danger aria-invalid:focus-visible:border-danger aria-invalid:focus-visible:ring-danger", d ? "resize-none" : "min-h-20 resize-y"),
58
+ ...x
59
+ }),
60
+ u ? /* @__PURE__ */ o("p", {
61
+ id: E,
62
+ className: "text-danger-text text-xs",
63
+ children: u
64
+ }) : l ? /* @__PURE__ */ o("p", {
65
+ id: T,
66
+ className: "text-foreground-subtle text-xs",
67
+ children: l
68
+ }) : null
69
+ ]
70
+ });
83
71
  });
84
- G.displayName = "Textarea";
85
- export {
86
- G as Textarea
87
- };
88
- //# sourceMappingURL=Textarea.js.map
72
+ c.displayName = "Textarea";
73
+ //#endregion
74
+ export { c as Textarea };
75
+
76
+ //# sourceMappingURL=Textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../src/components/ui/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n type TextareaHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cn } from '@/lib/utils';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Visible label above the field. */\n label?: ReactNode;\n /** Hint below the field. Hidden when `error` is set. */\n helperText?: ReactNode;\n /** Validation message. Sets `aria-invalid`. */\n error?: ReactNode;\n /** Grow vertically as content is added. */\n autoResize?: boolean;\n /** Minimum rows when `autoResize`. Defaults to 3. */\n minRows?: number;\n /** Maximum rows before scrolling when `autoResize`. Defaults to 12. */\n maxRows?: number;\n /** Visually hide the label while keeping it accessible. */\n hideLabel?: boolean;\n}\n\n/**\n * Multi-line text input. With `autoResize`, height tracks content from\n * `minRows` to `maxRows`. Without it, behaves like a native `<textarea>`.\n *\n * @example Comment box\n * <Textarea label=\"Note\" autoResize minRows={3} maxRows={10} />\n *\n * @example With error\n * <Textarea label=\"Description\"\n * error={errors.description?.message}\n * {...register('description')} />\n *\n * @do Default to `autoResize` for multi-line free-form input.\n * @dont Add `resize-none` without auto-resize — users will be stuck with a\n * 3-line box for long content.\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n className,\n label,\n helperText,\n error,\n autoResize,\n minRows = 3,\n maxRows = 12,\n hideLabel,\n id,\n onChange,\n value,\n defaultValue,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n ref,\n) {\n const isError = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(helperText),\n hasError: Boolean(error),\n extra: ariaDescribedby,\n });\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n\n // Stash a ref locally and forward to the consumer.\n const setRef = (node: HTMLTextAreaElement | null) => {\n innerRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n };\n\n const recompute = useCallback(() => {\n const el = innerRef.current;\n if (!el || !autoResize) return;\n const cs = getComputedStyle(el);\n const lineHeight = parseFloat(cs.lineHeight) || 20;\n // scrollHeight includes padding but not borders; the element is border-box.\n const padding = (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);\n const border = (parseFloat(cs.borderTopWidth) || 0) + (parseFloat(cs.borderBottomWidth) || 0);\n const minH = lineHeight * minRows + padding + border;\n const maxH = lineHeight * maxRows + padding + border;\n el.style.height = 'auto';\n const content = el.scrollHeight + border;\n el.style.height = `${Math.min(Math.max(content, minH), maxH)}px`;\n el.style.overflowY = content > maxH ? 'auto' : 'hidden';\n }, [autoResize, minRows, maxRows]);\n\n useEffect(() => {\n if (autoResize) recompute();\n }, [autoResize, recompute, value, defaultValue]);\n\n // Width changes re-wrap the text, so recompute on resize too.\n useEffect(() => {\n const el = innerRef.current;\n if (!autoResize || !el || typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(() => recompute());\n ro.observe(el);\n return () => ro.disconnect();\n }, [autoResize, recompute]);\n\n return (\n <div className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn('text-foreground text-sm font-medium', hideLabel && 'sr-only')}\n >\n {label}\n </label>\n )}\n <textarea\n ref={setRef}\n id={fieldId}\n rows={minRows}\n value={value}\n defaultValue={defaultValue}\n onChange={(e) => {\n onChange?.(e);\n if (autoResize) recompute();\n }}\n aria-invalid={isError ? true : ariaInvalid}\n aria-describedby={describedBy}\n className={cn(\n 'bg-card text-foreground rounded-md border px-3 py-2 text-lg md:text-sm',\n 'placeholder:text-foreground-subtle',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2',\n 'focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'border-border-input focus-visible:border-accent',\n 'aria-invalid:border-danger aria-invalid:focus-visible:border-danger aria-invalid:focus-visible:ring-danger',\n autoResize ? 'resize-none' : 'min-h-20 resize-y',\n )}\n {...props}\n />\n {error ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : helperText ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {helperText}\n </p>\n ) : null}\n </div>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"names":["Textarea","forwardRef","className","label","helperText","error","autoResize","minRows","maxRows","hideLabel","id","onChange","value","defaultValue","ariaDescribedby","ariaInvalid","props","ref","isError","fieldId","helperId","errorId","describedBy","useFieldIds","innerRef","useRef","setRef","node","recompute","useCallback","el","cs","lineHeight","padding","border","minH","maxH","content","useEffect","ro","cn","jsx"],"mappings":";;;;;AA8CO,MAAMA,IAAWC,EAA+C,SACrE;AAAA,EACE,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC,IAAU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;AAAA,EAAA,GACN;AAEJ,CAAC;AAEDpB,EAAS,cAAc;"}
1
+ {"version":3,"file":"Textarea.js","names":[],"sources":["../../../src/components/ui/Textarea.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n type TextareaHTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cn } from '@/lib/utils';\nimport { useFieldIds } from '@/hooks/use-field-ids';\n\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Visible label above the field. */\n label?: ReactNode;\n /** Hint below the field. Hidden when `error` is set. */\n helperText?: ReactNode;\n /** Validation message. Sets `aria-invalid`. */\n error?: ReactNode;\n /** Grow vertically as content is added. */\n autoResize?: boolean;\n /** Minimum rows when `autoResize`. Defaults to 3. */\n minRows?: number;\n /** Maximum rows before scrolling when `autoResize`. Defaults to 12. */\n maxRows?: number;\n /** Visually hide the label while keeping it accessible. */\n hideLabel?: boolean;\n}\n\n/**\n * Multi-line text input. With `autoResize`, height tracks content from\n * `minRows` to `maxRows`. Without it, behaves like a native `<textarea>`.\n *\n * @example Comment box\n * <Textarea label=\"Note\" autoResize minRows={3} maxRows={10} />\n *\n * @example With error\n * <Textarea label=\"Description\"\n * error={errors.description?.message}\n * {...register('description')} />\n *\n * @do Default to `autoResize` for multi-line free-form input.\n * @dont Add `resize-none` without auto-resize — users will be stuck with a\n * 3-line box for long content.\n */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n className,\n label,\n helperText,\n error,\n autoResize,\n minRows = 3,\n maxRows = 12,\n hideLabel,\n id,\n onChange,\n value,\n defaultValue,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n ref,\n) {\n const isError = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const { fieldId, helperId, errorId, describedBy } = useFieldIds(id, {\n hasHelper: Boolean(helperText),\n hasError: Boolean(error),\n extra: ariaDescribedby,\n });\n const innerRef = useRef<HTMLTextAreaElement | null>(null);\n\n // Stash a ref locally and forward to the consumer.\n const setRef = (node: HTMLTextAreaElement | null) => {\n innerRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n };\n\n const recompute = useCallback(() => {\n const el = innerRef.current;\n if (!el || !autoResize) return;\n const cs = getComputedStyle(el);\n const lineHeight = parseFloat(cs.lineHeight) || 20;\n // scrollHeight includes padding but not borders; the element is border-box.\n const padding = (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);\n const border = (parseFloat(cs.borderTopWidth) || 0) + (parseFloat(cs.borderBottomWidth) || 0);\n const minH = lineHeight * minRows + padding + border;\n const maxH = lineHeight * maxRows + padding + border;\n el.style.height = 'auto';\n const content = el.scrollHeight + border;\n el.style.height = `${Math.min(Math.max(content, minH), maxH)}px`;\n el.style.overflowY = content > maxH ? 'auto' : 'hidden';\n }, [autoResize, minRows, maxRows]);\n\n useEffect(() => {\n if (autoResize) recompute();\n }, [autoResize, recompute, value, defaultValue]);\n\n // Width changes re-wrap the text, so recompute on resize too.\n useEffect(() => {\n const el = innerRef.current;\n if (!autoResize || !el || typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(() => recompute());\n ro.observe(el);\n return () => ro.disconnect();\n }, [autoResize, recompute]);\n\n return (\n <div className={cn('flex flex-col gap-1.5', className)}>\n {label && (\n <label\n htmlFor={fieldId}\n className={cn('text-foreground text-sm font-medium', hideLabel && 'sr-only')}\n >\n {label}\n </label>\n )}\n <textarea\n ref={setRef}\n id={fieldId}\n rows={minRows}\n value={value}\n defaultValue={defaultValue}\n onChange={(e) => {\n onChange?.(e);\n if (autoResize) recompute();\n }}\n aria-invalid={isError ? true : ariaInvalid}\n aria-describedby={describedBy}\n className={cn(\n 'bg-card text-foreground rounded-md border px-3 py-2 text-lg md:text-sm',\n 'placeholder:text-foreground-subtle',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2',\n 'focus-visible:ring-offset-background',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'border-border-input focus-visible:border-accent',\n 'aria-invalid:border-danger aria-invalid:focus-visible:border-danger aria-invalid:focus-visible:ring-danger',\n autoResize ? 'resize-none' : 'min-h-20 resize-y',\n )}\n {...props}\n />\n {error ? (\n <p id={errorId} className=\"text-danger-text text-xs\">\n {error}\n </p>\n ) : helperText ? (\n <p id={helperId} className=\"text-foreground-subtle text-xs\">\n {helperText}\n </p>\n ) : null}\n </div>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"mappings":";;;;;;AA8CA,IAAa,IAAW,EAA+C,SACrE,EACE,cACA,UACA,eACA,UACA,eACA,aAAU,GACV,aAAU,IACV,cACA,OACA,aACA,UACA,iBACA,oBAAoB,GACpB,gBAAgB,GAChB,GAAG,KAEL,GACA;CACA,IAAM,IAAU,EAAQ,KAAU,MAAgB,MAAQ,MAAgB,QACpE,EAAE,YAAS,aAAU,YAAS,mBAAgB,EAAY,GAAI;EAClE,WAAW,EAAQ;EACnB,UAAU,EAAQ;EAClB,OAAO;CACT,CAAC,GACK,IAAW,EAAmC,IAAI,GAGlD,KAAU,MAAqC;EAEnD,AADA,EAAS,UAAU,GACf,OAAO,KAAQ,aAAY,EAAI,CAAI,IAC9B,MAAK,EAA4D,UAAU;CACtF,GAEM,IAAY,QAAkB;EAClC,IAAM,IAAK,EAAS;EACpB,IAAI,CAAC,KAAM,CAAC,GAAY;EACxB,IAAM,IAAK,iBAAiB,CAAE,GACxB,IAAa,WAAW,EAAG,UAAU,KAAK,IAE1C,KAAW,WAAW,EAAG,UAAU,KAAK,MAAM,WAAW,EAAG,aAAa,KAAK,IAC9E,KAAU,WAAW,EAAG,cAAc,KAAK,MAAM,WAAW,EAAG,iBAAiB,KAAK,IACrF,IAAO,IAAa,IAAU,IAAU,GACxC,IAAO,IA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HTMLTimeElement> {
13
13
  dateTime?: string;
14
14
  children: ReactNode;
15
15
  }
16
- export declare function TimelineTime({ className, children, dateTime, ...props }: TimelineTimeProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function TimelineTime({ className, children, dateTime, ...props }: TimelineTimeProps): import("react").JSX.Element;
17
17
  export declare namespace TimelineTime {
18
18
  var displayName: string;
19
19
  }
20
20
  export declare function TimelineTitle({ className, children, }: {
21
21
  className?: string;
22
22
  children: ReactNode;
23
- }): import("react/jsx-runtime").JSX.Element;
23
+ }): import("react").JSX.Element;
24
24
  export declare namespace TimelineTitle {
25
25
  var displayName: string;
26
26
  }
27
27
  export declare function TimelineDescription({ className, children, }: {
28
28
  className?: string;
29
29
  children: ReactNode;
30
- }): import("react/jsx-runtime").JSX.Element;
30
+ }): import("react").JSX.Element;
31
31
  export declare namespace TimelineDescription {
32
32
  var displayName: string;
33
33
  }
@@ -1,56 +1,68 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
3
- import { forwardRef as s } from "react";
4
- import { cn as l } from "../../lib/utils.js";
5
- const c = s(function({ className: i, children: r, ...n }, m) {
6
- return /* @__PURE__ */ t("ol", { ref: m, className: l("relative flex flex-col gap-6", i), ...n, children: r });
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { forwardRef as t } from "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region src/components/ui/Timeline.tsx
6
+ var i = t(function({ className: t, children: r, ...i }, a) {
7
+ return /* @__PURE__ */ n("ol", {
8
+ ref: a,
9
+ className: e("relative flex flex-col gap-6", t),
10
+ ...i,
11
+ children: r
12
+ });
7
13
  });
8
- c.displayName = "Timeline";
9
- const u = s(function({ bullet: i, isLast: r, className: n, children: m, ...o }, d) {
10
- return /* @__PURE__ */ a("li", { ref: d, className: l("relative flex gap-4 pb-1", n), ...o, children: [
11
- /* @__PURE__ */ a("div", { className: "relative flex shrink-0 flex-col items-center", children: [
12
- /* @__PURE__ */ t("div", { className: "border-border bg-card text-foreground-muted flex size-6 items-center justify-center rounded-full border", children: i ?? /* @__PURE__ */ t("span", { className: "bg-accent size-2 rounded-full", "aria-hidden": !0 }) }),
13
- !r && /* @__PURE__ */ t("span", { className: "bg-border mt-1 w-px flex-1", "aria-hidden": !0 })
14
- ] }),
15
- /* @__PURE__ */ t("div", { className: "min-w-0 flex-1 pb-4", children: m })
16
- ] });
14
+ i.displayName = "Timeline";
15
+ var a = t(function({ bullet: t, isLast: i, className: a, children: o, ...s }, c) {
16
+ return /* @__PURE__ */ r("li", {
17
+ ref: c,
18
+ className: e("relative flex gap-4 pb-1", a),
19
+ ...s,
20
+ children: [/* @__PURE__ */ r("div", {
21
+ className: "relative flex shrink-0 flex-col items-center",
22
+ children: [/* @__PURE__ */ n("div", {
23
+ className: "border-border bg-card text-foreground-muted flex size-6 items-center justify-center rounded-full border",
24
+ children: t ?? /* @__PURE__ */ n("span", {
25
+ className: "bg-accent size-2 rounded-full",
26
+ "aria-hidden": !0
27
+ })
28
+ }), !i && /* @__PURE__ */ n("span", {
29
+ className: "bg-border mt-1 w-px flex-1",
30
+ "aria-hidden": !0
31
+ })]
32
+ }), /* @__PURE__ */ n("div", {
33
+ className: "min-w-0 flex-1 pb-4",
34
+ children: o
35
+ })]
36
+ });
17
37
  });
18
- u.displayName = "TimelineItem";
19
- function f(e) {
20
- if (!(!e || Number.isNaN(Date.parse(e))))
21
- return e;
38
+ a.displayName = "TimelineItem";
39
+ function o(e) {
40
+ if (e && !Number.isNaN(Date.parse(e))) return e;
22
41
  }
23
- function p({ className: e, children: i, dateTime: r, ...n }) {
24
- return /* @__PURE__ */ t(
25
- "time",
26
- {
27
- dateTime: f(r ?? (typeof i == "string" ? i : void 0)),
28
- className: l("text-foreground-subtle block text-xs", e),
29
- ...n,
30
- children: i
31
- }
32
- );
42
+ function s({ className: t, children: r, dateTime: i, ...a }) {
43
+ return /* @__PURE__ */ n("time", {
44
+ dateTime: o(i ?? (typeof r == "string" ? r : void 0)),
45
+ className: e("text-foreground-subtle block text-xs", t),
46
+ ...a,
47
+ children: r
48
+ });
33
49
  }
34
- p.displayName = "TimelineTime";
35
- function x({
36
- className: e,
37
- children: i
38
- }) {
39
- return /* @__PURE__ */ t("p", { className: l("text-sm font-medium", e), children: i });
50
+ s.displayName = "TimelineTime";
51
+ function c({ className: t, children: r }) {
52
+ return /* @__PURE__ */ n("p", {
53
+ className: e("text-sm font-medium", t),
54
+ children: r
55
+ });
40
56
  }
41
- x.displayName = "TimelineTitle";
42
- function N({
43
- className: e,
44
- children: i
45
- }) {
46
- return /* @__PURE__ */ t("p", { className: l("text-foreground-muted mt-0.5 text-sm", e), children: i });
57
+ c.displayName = "TimelineTitle";
58
+ function l({ className: t, children: r }) {
59
+ return /* @__PURE__ */ n("p", {
60
+ className: e("text-foreground-muted mt-0.5 text-sm", t),
61
+ children: r
62
+ });
47
63
  }
48
- N.displayName = "TimelineDescription";
49
- export {
50
- c as Timeline,
51
- N as TimelineDescription,
52
- u as TimelineItem,
53
- p as TimelineTime,
54
- x as TimelineTitle
55
- };
56
- //# sourceMappingURL=Timeline.js.map
64
+ l.displayName = "TimelineDescription";
65
+ //#endregion
66
+ export { i as Timeline, l as TimelineDescription, a as TimelineItem, s as TimelineTime, c as TimelineTitle };
67
+
68
+ //# sourceMappingURL=Timeline.js.map