@brightlocal/ui-components 1.1.1 → 1.2.1

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 (122) hide show
  1. package/AI_USAGE.md +390 -0
  2. package/README.md +45 -10
  3. package/component-meta.json +1488 -0
  4. package/dist/blocks/input-list.cjs +2 -0
  5. package/dist/blocks/input-list.d.ts +93 -0
  6. package/dist/blocks/input-list.d.ts.map +1 -0
  7. package/dist/blocks/input-list.js +215 -0
  8. package/dist/blocks/sidebar.d.ts.map +1 -1
  9. package/dist/breadcrumb.cjs +1 -1
  10. package/dist/breadcrumb.d.ts.map +1 -1
  11. package/dist/breadcrumb.js +17 -14
  12. package/dist/button.cjs +1 -1
  13. package/dist/button.d.ts.map +1 -1
  14. package/dist/button.js +9 -8
  15. package/dist/calendar.cjs +1 -1
  16. package/dist/calendar.js +1 -1
  17. package/dist/card.cjs +1 -1
  18. package/dist/card.d.ts.map +1 -1
  19. package/dist/card.js +20 -16
  20. package/dist/centred-layout.cjs +1 -1
  21. package/dist/centred-layout.js +1 -1
  22. package/dist/checkbox.cjs +1 -1
  23. package/dist/checkbox.d.ts.map +1 -1
  24. package/dist/checkbox.js +8 -10
  25. package/dist/combobox.cjs +1 -1
  26. package/dist/combobox.d.ts +12 -1
  27. package/dist/combobox.d.ts.map +1 -1
  28. package/dist/combobox.js +87 -79
  29. package/dist/command.cjs +1 -1
  30. package/dist/command.d.ts.map +1 -1
  31. package/dist/command.js +60 -50
  32. package/dist/date-picker.cjs +1 -1
  33. package/dist/date-picker.d.ts.map +1 -1
  34. package/dist/date-picker.js +66 -57
  35. package/dist/field.cjs +1 -1
  36. package/dist/field.d.ts.map +1 -1
  37. package/dist/field.js +2 -2
  38. package/dist/header.cjs +1 -1
  39. package/dist/header.d.ts +4 -0
  40. package/dist/header.d.ts.map +1 -1
  41. package/dist/header.js +33 -13
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +281 -268
  46. package/dist/input-chip.cjs +1 -1
  47. package/dist/input-chip.js +2 -2
  48. package/dist/input-group.cjs +1 -1
  49. package/dist/input-group.js +17 -17
  50. package/dist/input-otp.cjs +1 -1
  51. package/dist/input-otp.d.ts.map +1 -1
  52. package/dist/input-otp.js +20 -20
  53. package/dist/input-password.cjs +1 -1
  54. package/dist/input-password.d.ts.map +1 -1
  55. package/dist/input-password.js +33 -25
  56. package/dist/input.cjs +1 -1
  57. package/dist/input.js +15 -15
  58. package/dist/label.d.ts.map +1 -1
  59. package/dist/link.cjs +1 -1
  60. package/dist/link.d.ts.map +1 -1
  61. package/dist/link.js +24 -25
  62. package/dist/list.cjs +1 -0
  63. package/dist/list.d.ts +104 -0
  64. package/dist/list.d.ts.map +1 -0
  65. package/dist/list.js +145 -0
  66. package/dist/navigation-menu.cjs +1 -1
  67. package/dist/navigation-menu.d.ts.map +1 -1
  68. package/dist/navigation-menu.js +6 -5
  69. package/dist/radio-group.cjs +1 -1
  70. package/dist/radio-group.js +20 -20
  71. package/dist/select.cjs +1 -1
  72. package/dist/select.js +1 -1
  73. package/dist/sheet.d.ts.map +1 -1
  74. package/dist/sonner.cjs +1 -1
  75. package/dist/sonner.d.ts +10 -4
  76. package/dist/sonner.d.ts.map +1 -1
  77. package/dist/sonner.js +69 -56
  78. package/dist/split-layout.cjs +1 -1
  79. package/dist/split-layout.d.ts +66 -15
  80. package/dist/split-layout.d.ts.map +1 -1
  81. package/dist/split-layout.js +100 -96
  82. package/dist/switch.cjs +1 -1
  83. package/dist/switch.d.ts.map +1 -1
  84. package/dist/switch.js +2 -2
  85. package/dist/textarea.cjs +1 -1
  86. package/dist/textarea.js +1 -1
  87. package/dist/tooltip.cjs +1 -1
  88. package/dist/tooltip.d.ts.map +1 -1
  89. package/dist/tooltip.js +40 -38
  90. package/package.json +5 -1
  91. package/src/blocks/input-list.tsx +366 -0
  92. package/src/blocks/sidebar.tsx +7 -7
  93. package/src/components/breadcrumb.tsx +4 -1
  94. package/src/components/button.tsx +1 -0
  95. package/src/components/calendar.tsx +1 -1
  96. package/src/components/card.tsx +8 -4
  97. package/src/components/centred-layout.tsx +1 -1
  98. package/src/components/checkbox.tsx +2 -4
  99. package/src/components/combobox.tsx +21 -2
  100. package/src/components/command.tsx +25 -9
  101. package/src/components/date-picker.tsx +15 -5
  102. package/src/components/dropdown-menu.tsx +3 -3
  103. package/src/components/field.tsx +5 -3
  104. package/src/components/header.tsx +28 -2
  105. package/src/components/input-chip.tsx +2 -2
  106. package/src/components/input-group.tsx +4 -4
  107. package/src/components/input-otp.tsx +7 -3
  108. package/src/components/input-password.tsx +8 -2
  109. package/src/components/input.tsx +1 -1
  110. package/src/components/label.tsx +1 -4
  111. package/src/components/link.tsx +3 -4
  112. package/src/components/list.tsx +290 -0
  113. package/src/components/navigation-menu.tsx +1 -0
  114. package/src/components/radio-group.tsx +2 -2
  115. package/src/components/select.tsx +3 -3
  116. package/src/components/sheet.tsx +2 -2
  117. package/src/components/sonner.tsx +65 -38
  118. package/src/components/split-layout.tsx +200 -79
  119. package/src/components/switch.tsx +6 -4
  120. package/src/components/textarea.tsx +1 -1
  121. package/src/components/tooltip.tsx +4 -2
  122. package/src/index.ts +2 -0
package/dist/tooltip.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),T=require("react"),m=require("@radix-ui/react-tooltip"),j=require("@brightlocal/ui-components/lib/utils");function a(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const l=a(T),i=a(m);function x({delayDuration:t=0,skipDelayDuration:e=0,...o}){return r.jsx(i.Provider,{"data-slot":"tooltip-provider",delayDuration:t,skipDelayDuration:e,...o})}function y({...t}){return r.jsx(i.Root,{"data-slot":"tooltip",...t})}const s=l.forwardRef(({...t},e)=>r.jsx(i.Trigger,{ref:e,"data-slot":"tooltip-trigger",...t}));s.displayName="TooltipTrigger";const c=l.forwardRef(({className:t,sideOffset:e=0,dataHook:o,trackingEl:n,trackingLabel:d,hideArrow:p=!1,children:u,...g},f)=>r.jsx(i.Portal,{children:r.jsxs(i.Content,{ref:f,className:j.cn("bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal",t),"data-hook":o,"data-slot":"tooltip-content","data-tracking-el":n,"data-tracking-label":d,sideOffset:e,...g,children:[u,!p&&r.jsx(i.Arrow,{className:"fill-secondary",height:5.5,width:10})]})}));c.displayName="TooltipContent";exports.Tooltip=y;exports.TooltipContent=c;exports.TooltipProvider=x;exports.TooltipTrigger=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),T=require("react"),x=require("@radix-ui/react-tooltip"),m=require("@brightlocal/ui-components/lib/utils");function l(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return o.default=t,Object.freeze(o)}const n=l(T),a=l(x);function y({delayDuration:t=0,skipDelayDuration:o=0,...e}){return r.jsx(a.Provider,{"data-slot":"tooltip-provider",delayDuration:t,skipDelayDuration:o,...e})}function j({...t}){return r.jsx(a.Root,{"data-slot":"tooltip",...t})}const s=n.forwardRef(({...t},o)=>r.jsx(a.Trigger,{ref:o,"data-slot":"tooltip-trigger",...t}));s.displayName="TooltipTrigger";const d=n.forwardRef(({className:t,sideOffset:o=0,dataHook:e,trackingEl:i,trackingLabel:p,hideArrow:c=!1,children:u,...g},f)=>r.jsx(a.Portal,{children:r.jsxs(a.Content,{ref:f,className:m.cn("bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal","data-[side=bottom]:[&_[data-slot=tooltip-arrow]]:translate-y-px data-[side=left]:[&_[data-slot=tooltip-arrow]]:-translate-x-px data-[side=right]:[&_[data-slot=tooltip-arrow]]:translate-x-px data-[side=top]:[&_[data-slot=tooltip-arrow]]:-translate-y-px",t),"data-hook":e,"data-slot":"tooltip-content","data-tracking-el":i,"data-tracking-label":p,sideOffset:o,...g,children:[u,!c&&r.jsx(a.Arrow,{className:"fill-secondary","data-slot":"tooltip-arrow",height:7,width:14})]})}));d.displayName="TooltipContent";exports.Tooltip=j;exports.TooltipContent=d;exports.TooltipProvider=y;exports.TooltipTrigger=s;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAI5D,UAAU,oBAAqB,SAAQ,KAAK,CAAC,cAAc,CACzD,OAAO,gBAAgB,CAAC,QAAQ,CACjC;IACC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,iBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAStB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAEpD;AAED,QAAA,MAAM,cAAc,sKAWlB,CAAC;AAIH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CACxD,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,yGA4CnB,CAAC;AAIF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AACpE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAI5D,UAAU,oBAAqB,SAAQ,KAAK,CAAC,cAAc,CACzD,OAAO,gBAAgB,CAAC,QAAQ,CACjC;IACC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,eAAe,CAAC,EACvB,aAAiB,EACjB,iBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAStB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,OAAO,CAAC,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAEpD;AAED,QAAA,MAAM,cAAc,sKAWlB,CAAC;AAIH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CACxD,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,QAAA,MAAM,cAAc,yGA8CnB,CAAC;AAIF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AACpE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC"}
package/dist/tooltip.js CHANGED
@@ -1,78 +1,80 @@
1
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import * as t from "@radix-ui/react-tooltip";
3
+ import * as o from "@radix-ui/react-tooltip";
4
4
  import { cn as f } from "@brightlocal/ui-components/lib/utils";
5
- function h({
6
- delayDuration: o = 0,
7
- skipDelayDuration: r = 0,
8
- ...a
5
+ function u({
6
+ delayDuration: t = 0,
7
+ skipDelayDuration: a = 0,
8
+ ...e
9
9
  }) {
10
- return /* @__PURE__ */ e(
11
- t.Provider,
10
+ return /* @__PURE__ */ r(
11
+ o.Provider,
12
12
  {
13
13
  "data-slot": "tooltip-provider",
14
- delayDuration: o,
15
- skipDelayDuration: r,
16
- ...a
14
+ delayDuration: t,
15
+ skipDelayDuration: a,
16
+ ...e
17
17
  }
18
18
  );
19
19
  }
20
20
  function y({
21
- ...o
21
+ ...t
22
22
  }) {
23
- return /* @__PURE__ */ e(t.Root, { "data-slot": "tooltip", ...o });
23
+ return /* @__PURE__ */ r(o.Root, { "data-slot": "tooltip", ...t });
24
24
  }
25
- const g = i.forwardRef(({ ...o }, r) => /* @__PURE__ */ e(
26
- t.Trigger,
25
+ const g = i.forwardRef(({ ...t }, a) => /* @__PURE__ */ r(
26
+ o.Trigger,
27
27
  {
28
- ref: r,
28
+ ref: a,
29
29
  "data-slot": "tooltip-trigger",
30
- ...o
30
+ ...t
31
31
  }
32
32
  ));
33
33
  g.displayName = "TooltipTrigger";
34
- const T = i.forwardRef(
34
+ const x = i.forwardRef(
35
35
  ({
36
- className: o,
37
- sideOffset: r = 0,
38
- dataHook: a,
39
- trackingEl: n,
40
- trackingLabel: l,
41
- hideArrow: d = !1,
36
+ className: t,
37
+ sideOffset: a = 0,
38
+ dataHook: e,
39
+ trackingEl: l,
40
+ trackingLabel: d,
41
+ hideArrow: n = !1,
42
42
  children: s,
43
43
  ...p
44
- }, c) => /* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ m(
45
- t.Content,
44
+ }, c) => /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ m(
45
+ o.Content,
46
46
  {
47
47
  ref: c,
48
48
  className: f(
49
49
  "bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
50
- o
50
+ "data-[side=bottom]:[&_[data-slot=tooltip-arrow]]:translate-y-px data-[side=left]:[&_[data-slot=tooltip-arrow]]:-translate-x-px data-[side=right]:[&_[data-slot=tooltip-arrow]]:translate-x-px data-[side=top]:[&_[data-slot=tooltip-arrow]]:-translate-y-px",
51
+ t
51
52
  ),
52
- "data-hook": a,
53
+ "data-hook": e,
53
54
  "data-slot": "tooltip-content",
54
- "data-tracking-el": n,
55
- "data-tracking-label": l,
56
- sideOffset: r,
55
+ "data-tracking-el": l,
56
+ "data-tracking-label": d,
57
+ sideOffset: a,
57
58
  ...p,
58
59
  children: [
59
60
  s,
60
- !d && /* @__PURE__ */ e(
61
- t.Arrow,
61
+ !n && /* @__PURE__ */ r(
62
+ o.Arrow,
62
63
  {
63
64
  className: "fill-secondary",
64
- height: 5.5,
65
- width: 10
65
+ "data-slot": "tooltip-arrow",
66
+ height: 7,
67
+ width: 14
66
68
  }
67
69
  )
68
70
  ]
69
71
  }
70
72
  ) })
71
73
  );
72
- T.displayName = "TooltipContent";
74
+ x.displayName = "TooltipContent";
73
75
  export {
74
76
  y as Tooltip,
75
- T as TooltipContent,
76
- h as TooltipProvider,
77
+ x as TooltipContent,
78
+ u as TooltipProvider,
77
79
  g as TooltipTrigger
78
80
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -14,6 +14,8 @@
14
14
  "src",
15
15
  "tailwind.css",
16
16
  "README.md",
17
+ "AI_USAGE.md",
18
+ "component-meta.json",
17
19
  "LICENSE",
18
20
  "package.json"
19
21
  ],
@@ -184,6 +186,8 @@
184
186
  "build": "pnpm run clean && vite build",
185
187
  "size": "size-limit",
186
188
  "analyze": "vite-bundle-visualizer",
189
+ "sync-meta": "node scripts/sync-component-meta.mjs",
190
+ "sync-meta:check": "node scripts/sync-component-meta.mjs --check",
187
191
  "build:changelog": "node scripts/generate-changelog.js",
188
192
  "rel:patch": "node scripts/changeset-create.mjs patch",
189
193
  "rel:minor": "node scripts/changeset-create.mjs minor",
@@ -0,0 +1,366 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { X } from "@brightlocal/icons";
5
+
6
+ import { cn } from "@brightlocal/ui-components/lib/utils";
7
+ import { Button } from "../components/button";
8
+ import { FieldDescription, FieldError } from "../components/field";
9
+ import { Input } from "../components/input";
10
+ import { Item, ItemContent, ItemTitle, ItemActions } from "../components/list";
11
+
12
+ /* -------------------------------------------------------------------------------------------------
13
+ * InputList
14
+ * -----------------------------------------------------------------------------------------------*/
15
+
16
+ /**
17
+ * Props for the InputList block component.
18
+ * Manages a list of text items with add-input, per-row remove controls, and validation states.
19
+ */
20
+ export interface InputListProps {
21
+ /**
22
+ * The current list of item strings (controlled).
23
+ */
24
+ value: string[];
25
+ /**
26
+ * Called when the list of items changes.
27
+ */
28
+ onValueChange: (value: string[]) => void;
29
+ /**
30
+ * Maximum number of items allowed.
31
+ * When reached, the input and add button are disabled and a count indicator is shown.
32
+ */
33
+ maxItems?: number;
34
+ /**
35
+ * Placeholder text for the text input.
36
+ * @default "Add item"
37
+ */
38
+ placeholder?: string;
39
+ /**
40
+ * Label for the add button.
41
+ * @default "Add"
42
+ */
43
+ addButtonLabel?: string;
44
+ /**
45
+ * Number of skeleton rows to render in the loading state.
46
+ * @default 3
47
+ */
48
+ skeletonCount?: number;
49
+ /**
50
+ * Fully disables the component — input and all remove buttons become non-interactive.
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Shows skeleton placeholder rows instead of the item list.
55
+ */
56
+ loading?: boolean;
57
+ /**
58
+ * Applies an error style to the input.
59
+ */
60
+ error?: boolean;
61
+ /**
62
+ * Optional validation message shown below the input when `error` is true.
63
+ */
64
+ errorMessage?: string;
65
+ /**
66
+ * Optional description text shown below the input.
67
+ */
68
+ description?: string;
69
+ /**
70
+ * Data hook for automated testing (required).
71
+ */
72
+ dataHook: string;
73
+ /**
74
+ * Tracking element identifier for analytics.
75
+ */
76
+ trackingEl?: string;
77
+ /**
78
+ * Tracking label for analytics context.
79
+ */
80
+ trackingLabel?: string;
81
+ /**
82
+ * Additional CSS classes applied to the root element.
83
+ */
84
+ className?: string;
85
+ }
86
+
87
+ /**
88
+ * InputList block — a managed list of text items with an add-input and per-row remove controls.
89
+ *
90
+ * Supports a maximum item limit with count indicator,
91
+ * multi-line paste (each line becomes a separate item), loading skeletons, disabled state,
92
+ * and input error/validation state.
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * <InputList
97
+ * value={keywords}
98
+ * onValueChange={setKeywords}
99
+ * maxItems={10}
100
+ * dataHook="keywords"
101
+ * />
102
+ * ```
103
+ */
104
+ function InputList({
105
+ value,
106
+ onValueChange,
107
+ maxItems,
108
+ placeholder = "Add item",
109
+ addButtonLabel = "Add",
110
+ skeletonCount = 3,
111
+ disabled = false,
112
+ loading = false,
113
+ error = false,
114
+ errorMessage,
115
+ description,
116
+ dataHook,
117
+ trackingEl,
118
+ trackingLabel,
119
+ className,
120
+ }: InputListProps) {
121
+ const [inputValue, setInputValue] = React.useState("");
122
+ const [removingIndices, setRemovingIndices] = React.useState<Set<number>>(
123
+ () => new Set()
124
+ );
125
+ const [addingIndices, setAddingIndices] = React.useState<Set<number>>(
126
+ () => new Set()
127
+ );
128
+
129
+ // Expand newly added items after initial collapsed paint (triggers CSS transition)
130
+ React.useEffect(() => {
131
+ if (addingIndices.size === 0) return;
132
+ const frame = requestAnimationFrame(() => {
133
+ setAddingIndices(new Set());
134
+ });
135
+ return () => cancelAnimationFrame(frame);
136
+ }, [addingIndices]);
137
+ const valueRef = React.useRef(value);
138
+ React.useEffect(() => {
139
+ valueRef.current = value;
140
+ }, [value]);
141
+ const timersRef = React.useRef(new Set<ReturnType<typeof setTimeout>>());
142
+ React.useEffect(() => {
143
+ const timers = timersRef.current;
144
+ return () => {
145
+ timers.forEach(clearTimeout);
146
+ timers.clear();
147
+ };
148
+ }, []);
149
+
150
+ // Stable keys so remaining items don't remount (and re-animate) on removal
151
+ const nextIdRef = React.useRef(value.length);
152
+ const [stableKeys, setStableKeys] = React.useState<number[]>(() =>
153
+ value.map((_, i) => i)
154
+ );
155
+ React.useEffect(() => {
156
+ setStableKeys((prev) => {
157
+ if (prev.length !== value.length) {
158
+ return value.map(() => nextIdRef.current++);
159
+ }
160
+ return prev;
161
+ });
162
+ }, [value]);
163
+
164
+ const atLimit = maxItems !== undefined && value.length >= maxItems;
165
+ const inputDisabled = disabled || atLimit || loading;
166
+ const buttonDisabled = disabled || atLimit || loading;
167
+
168
+ const addItems = React.useCallback(
169
+ (items: string[]) => {
170
+ const trimmed = items.map((s) => s.trim()).filter(Boolean);
171
+ if (!trimmed.length) return;
172
+ const available =
173
+ maxItems !== undefined ? maxItems - value.length : Infinity;
174
+ const toAdd = trimmed.slice(0, available);
175
+ if (toAdd.length) {
176
+ const prefersReducedMotion = window.matchMedia(
177
+ "(prefers-reduced-motion: reduce)"
178
+ ).matches;
179
+ if (!prefersReducedMotion) {
180
+ const startIndex = value.length;
181
+ setAddingIndices(new Set(toAdd.map((_, i) => startIndex + i)));
182
+ }
183
+ setStableKeys((prev) => [
184
+ ...prev,
185
+ ...toAdd.map(() => nextIdRef.current++),
186
+ ]);
187
+ onValueChange([...value, ...toAdd]);
188
+ setInputValue("");
189
+ }
190
+ },
191
+ [value, maxItems, onValueChange]
192
+ );
193
+
194
+ const removeItem = React.useCallback(
195
+ (index: number) => {
196
+ const prefersReducedMotion = window.matchMedia(
197
+ "(prefers-reduced-motion: reduce)"
198
+ ).matches;
199
+
200
+ if (prefersReducedMotion) {
201
+ setStableKeys((prev) => prev.filter((_, i) => i !== index));
202
+ onValueChange(valueRef.current.filter((_, i) => i !== index));
203
+ return;
204
+ }
205
+
206
+ setRemovingIndices((prev) => new Set(prev).add(index));
207
+ const timer = setTimeout(() => {
208
+ timersRef.current.delete(timer);
209
+ setRemovingIndices((prev) => {
210
+ const next = new Set(prev);
211
+ next.delete(index);
212
+ return next;
213
+ });
214
+ setStableKeys((prev) => prev.filter((_, i) => i !== index));
215
+ onValueChange(valueRef.current.filter((_, i) => i !== index));
216
+ }, 200);
217
+ timersRef.current.add(timer);
218
+ },
219
+ [onValueChange]
220
+ );
221
+
222
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
223
+ if (e.key === "Enter") {
224
+ e.preventDefault();
225
+ addItems([inputValue]);
226
+ }
227
+ };
228
+
229
+ const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {
230
+ const pasted = e.clipboardData.getData("text");
231
+ const lines = pasted.split("\n");
232
+ if (lines.length > 1) {
233
+ e.preventDefault();
234
+ addItems(lines);
235
+ }
236
+ };
237
+
238
+ return (
239
+ <div
240
+ className={cn("flex flex-col gap-4", className)}
241
+ data-hook={dataHook}
242
+ data-slot="input-list"
243
+ data-tracking-el={trackingEl}
244
+ data-tracking-label={trackingLabel}
245
+ >
246
+ {/* Item list or loading skeleton */}
247
+ {loading ? (
248
+ <ul className="flex flex-col gap-2" data-slot="input-list-skeleton">
249
+ {Array.from({ length: skeletonCount }).map((_, i) => (
250
+ <Item key={i} variant="loading" />
251
+ ))}
252
+ </ul>
253
+ ) : value.length > 0 ? (
254
+ <ul
255
+ className="flex flex-col"
256
+ data-hook={`${dataHook}-list`}
257
+ data-slot="list"
258
+ >
259
+ {value.map((item, index) => {
260
+ const isRemoving = removingIndices.has(index);
261
+ const isAdding = addingIndices.has(index);
262
+ const isCollapsed = isAdding || isRemoving;
263
+ return (
264
+ <li
265
+ key={stableKeys[index]}
266
+ className={cn(
267
+ "grid transition-[grid-template-rows,opacity,margin-bottom] ease-out",
268
+ isCollapsed
269
+ ? "mb-0 grid-rows-[0fr] opacity-0"
270
+ : "mb-2 grid-rows-[1fr] opacity-100 last:mb-0",
271
+ isRemoving ? "duration-200" : "duration-300"
272
+ )}
273
+ data-hook={`${dataHook}-item-${index}`}
274
+ data-slot="item"
275
+ >
276
+ <div className="overflow-hidden">
277
+ <div className="bg-card flex items-center gap-4 rounded-lg py-2 pr-2 pl-4">
278
+ <ItemContent>
279
+ <ItemTitle>{item}</ItemTitle>
280
+ </ItemContent>
281
+ <ItemActions>
282
+ <button
283
+ aria-label={`Remove ${item}`}
284
+ className={cn(
285
+ "inline-flex size-9 cursor-pointer items-center justify-center rounded-full",
286
+ "text-muted-foreground",
287
+ "focus-visible:shadow-default outline-none",
288
+ "transition-colors duration-150 ease-in-out",
289
+ "disabled:pointer-events-none disabled:opacity-50"
290
+ )}
291
+ data-hook={`${dataHook}-remove-${index}`}
292
+ disabled={disabled || isRemoving}
293
+ type="button"
294
+ onClick={() => removeItem(index)}
295
+ >
296
+ <X />
297
+ </button>
298
+ </ItemActions>
299
+ </div>
300
+ </div>
301
+ </li>
302
+ );
303
+ })}
304
+ </ul>
305
+ ) : null}
306
+
307
+ {/* Input row */}
308
+ <div className="flex flex-col gap-2" data-slot="input-list-input-area">
309
+ <div className="flex gap-2">
310
+ <Input
311
+ className="flex-1"
312
+ dataHook={`${dataHook}-input`}
313
+ disabled={inputDisabled}
314
+ error={error}
315
+ placeholder={placeholder}
316
+ value={inputValue}
317
+ onChange={(e) => setInputValue(e.target.value)}
318
+ onKeyDown={handleKeyDown}
319
+ onPaste={handlePaste}
320
+ />
321
+ <Button
322
+ dataHook={`${dataHook}-add`}
323
+ disabled={buttonDisabled}
324
+ onClick={() => addItems([inputValue])}
325
+ >
326
+ {addButtonLabel}
327
+ </Button>
328
+ </div>
329
+
330
+ {/* Description */}
331
+ {description && (
332
+ <FieldDescription
333
+ data-slot="input-list-description"
334
+ dataHook={`${dataHook}-description`}
335
+ >
336
+ {description}
337
+ </FieldDescription>
338
+ )}
339
+
340
+ {/* Count indicator — always shown when maxItems is set */}
341
+ {maxItems !== undefined && (
342
+ <FieldDescription
343
+ data-slot="input-list-count"
344
+ dataHook={`${dataHook}-count`}
345
+ >
346
+ {value.length}/{maxItems}
347
+ </FieldDescription>
348
+ )}
349
+
350
+ {/* Error message */}
351
+ {error && errorMessage && (
352
+ <FieldError
353
+ data-slot="input-list-error"
354
+ dataHook={`${dataHook}-error`}
355
+ >
356
+ {errorMessage}
357
+ </FieldError>
358
+ )}
359
+ </div>
360
+ </div>
361
+ );
362
+ }
363
+
364
+ InputList.displayName = "InputList";
365
+
366
+ export { InputList };
@@ -739,8 +739,8 @@ const sidebarGroupLabelVariants = cva(
739
739
  */
740
740
  interface SidebarGroupLabelProps
741
741
  extends
742
- React.ComponentProps<"div">,
743
- VariantProps<typeof sidebarGroupLabelVariants> {
742
+ React.ComponentProps<"div">,
743
+ VariantProps<typeof sidebarGroupLabelVariants> {
744
744
  /** Data hook for automated testing */
745
745
  dataHook?: string;
746
746
  /**
@@ -1043,8 +1043,8 @@ const sidebarMenuButtonVariants = cva(
1043
1043
  */
1044
1044
  interface SidebarMenuButtonProps
1045
1045
  extends
1046
- React.ComponentProps<"button">,
1047
- VariantProps<typeof sidebarMenuButtonVariants> {
1046
+ React.ComponentProps<"button">,
1047
+ VariantProps<typeof sidebarMenuButtonVariants> {
1048
1048
  /** Data hook for automated testing */
1049
1049
  dataHook?: string;
1050
1050
  /**
@@ -1170,7 +1170,7 @@ const SidebarMenuAction = React.forwardRef<
1170
1170
  "peer-data-[size=tree]/menu-button:top-1.5",
1171
1171
  "group-data-[collapsible=icon]:hidden",
1172
1172
  showOnHover &&
1173
- "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
1173
+ "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
1174
1174
  className
1175
1175
  )}
1176
1176
  data-slot="sidebar-menu-action"
@@ -1282,8 +1282,8 @@ const sidebarMenuSubVariants = cva(
1282
1282
  */
1283
1283
  interface SidebarMenuSubProps
1284
1284
  extends
1285
- React.ComponentProps<"ul">,
1286
- VariantProps<typeof sidebarMenuSubVariants> {
1285
+ React.ComponentProps<"ul">,
1286
+ VariantProps<typeof sidebarMenuSubVariants> {
1287
1287
  /** Data hook for automated testing */
1288
1288
  dataHook?: string;
1289
1289
  /**
@@ -101,7 +101,10 @@ const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(
101
101
  return (
102
102
  <Comp
103
103
  ref={ref}
104
- className={cn("hover:text-foreground transition-colors", className)}
104
+ className={cn(
105
+ "hover:text-foreground focus-visible:shadow-default rounded-sm transition-colors outline-none",
106
+ className
107
+ )}
105
108
  data-slot="breadcrumb-link"
106
109
  {...props}
107
110
  />
@@ -72,6 +72,7 @@ const ButtonVariants = cva(
72
72
  "hover:bg-destructive/90",
73
73
  "dark:hover:bg-red-400/90",
74
74
  "text-destructive-foreground",
75
+ "dark:text-red-950",
75
76
  "focus-visible:shadow-destructive",
76
77
  ],
77
78
  outline: [
@@ -117,7 +117,7 @@ function Calendar({
117
117
  <DayPicker
118
118
  captionLayout={captionLayout}
119
119
  className={cn(
120
- "bg-background border-border group/calendar relative rounded-lg border p-3 shadow-sm",
120
+ "bg-background border-border group/calendar relative w-fit rounded-lg border p-3 shadow-sm",
121
121
  className
122
122
  )}
123
123
  classNames={{
@@ -19,7 +19,7 @@ const cardVariants = cva(
19
19
  "flex-col",
20
20
  "gap-8",
21
21
  "rounded-xl",
22
- "py-8",
22
+ "py-section-md",
23
23
  "transition-colors",
24
24
  "w-full",
25
25
  ],
@@ -150,7 +150,7 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
150
150
  ref={ref}
151
151
  className={cn(
152
152
  "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
153
- !flush && "px-8",
153
+ !flush && "px-section-md",
154
154
  className
155
155
  )}
156
156
  data-slot="card-header"
@@ -221,7 +221,7 @@ const CardContent = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
221
221
  return (
222
222
  <div
223
223
  ref={ref}
224
- className={cn(!flush && "px-8", className)}
224
+ className={cn(!flush && "px-section-md", className)}
225
225
  data-slot="card-content"
226
226
  {...props}
227
227
  />
@@ -239,7 +239,11 @@ const CardFooter = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
239
239
  return (
240
240
  <div
241
241
  ref={ref}
242
- className={cn("flex items-center", !flush && "px-8", className)}
242
+ className={cn(
243
+ "flex items-center",
244
+ !flush && "px-section-md",
245
+ className
246
+ )}
243
247
  data-slot="card-footer"
244
248
  {...props}
245
249
  />
@@ -63,7 +63,7 @@ const CentredLayout = React.forwardRef<HTMLDivElement, CentredLayoutProps>(
63
63
  ref={ref}
64
64
  className={cn(
65
65
  // Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
66
- "bg-background p-section flex min-h-screen w-full flex-col items-center justify-center gap-4",
66
+ "bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4",
67
67
  className
68
68
  )}
69
69
  data-hook={dataHook}
@@ -22,10 +22,8 @@ const checkboxVariants = cva(
22
22
  variants: {
23
23
  error: {
24
24
  true: [
25
- // Error state - red-600 border with 40% opacity (light) / red-400 with 60% opacity (dark)
26
- "border-red-600/40 dark:border-red-400/60",
27
- // Error focus state - solid red border with destructive shadow
28
- "focus-visible:border-destructive focus-visible:shadow-destructive",
25
+ "border-destructive-40",
26
+ "focus-visible:border-destructive-40 focus-visible:shadow-destructive",
29
27
  ],
30
28
  },
31
29
  },