@brightlocal/ui-components 2.17.1 → 2.18.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 (61) hide show
  1. package/README.md +83 -1
  2. package/component-meta.json +20 -7
  3. package/dist/alert-dialog.cjs +1 -1
  4. package/dist/alert-dialog.d.ts +23 -2
  5. package/dist/alert-dialog.d.ts.map +1 -1
  6. package/dist/alert-dialog.js +21 -19
  7. package/dist/blocks/input-list.cjs +2 -2
  8. package/dist/blocks/input-list.d.ts.map +1 -1
  9. package/dist/blocks/input-list.js +64 -63
  10. package/dist/card.cjs +1 -1
  11. package/dist/card.d.ts +22 -2
  12. package/dist/card.d.ts.map +1 -1
  13. package/dist/card.js +93 -72
  14. package/dist/chip.cjs +1 -1
  15. package/dist/chip.d.ts.map +1 -1
  16. package/dist/chip.js +1 -7
  17. package/dist/dialog.cjs +1 -1
  18. package/dist/dialog.d.ts +23 -3
  19. package/dist/dialog.d.ts.map +1 -1
  20. package/dist/dialog.js +44 -42
  21. package/dist/dropdown-menu.cjs +1 -1
  22. package/dist/dropdown-menu.d.ts +10 -0
  23. package/dist/dropdown-menu.d.ts.map +1 -1
  24. package/dist/dropdown-menu.js +30 -29
  25. package/dist/field.cjs +1 -1
  26. package/dist/field.d.ts +5 -1
  27. package/dist/field.d.ts.map +1 -1
  28. package/dist/field.js +9 -7
  29. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  30. package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
  31. package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
  32. package/dist/hooks/use-prefers-reduced-motion.js +17 -11
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +38 -37
  35. package/dist/link.cjs +1 -1
  36. package/dist/link.d.ts +13 -2
  37. package/dist/link.d.ts.map +1 -1
  38. package/dist/link.js +110 -53
  39. package/dist/map.cjs +1 -1
  40. package/dist/map.d.ts.map +1 -1
  41. package/dist/map.js +1 -1
  42. package/dist/progress.cjs +1 -1
  43. package/dist/progress.d.ts.map +1 -1
  44. package/dist/progress.js +26 -25
  45. package/dist/sheet.cjs +1 -1
  46. package/dist/sheet.d.ts +17 -2
  47. package/dist/sheet.d.ts.map +1 -1
  48. package/dist/sheet.js +29 -27
  49. package/package.json +3 -3
  50. package/src/blocks/input-list.tsx +8 -1
  51. package/src/components/alert-dialog.tsx +38 -4
  52. package/src/components/card.tsx +56 -9
  53. package/src/components/chip.tsx +1 -4
  54. package/src/components/dialog.tsx +39 -6
  55. package/src/components/dropdown-menu.tsx +7 -1
  56. package/src/components/field.tsx +6 -0
  57. package/src/components/link.tsx +103 -27
  58. package/src/components/map.tsx +1 -2
  59. package/src/components/progress.tsx +12 -6
  60. package/src/components/sheet.tsx +30 -5
  61. package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/README.md CHANGED
@@ -41,7 +41,7 @@ This package includes 65 components and 3 blocks built on Radix UI primitives an
41
41
  ### Navigation Components
42
42
 
43
43
  - **Breadcrumb** - Hierarchical navigation trail
44
- - **Link** - Styled anchor links
44
+ - **Link** - Styled anchor links with inline and button-styled variants
45
45
  - **NavigationMenu** - Complex navigation menus
46
46
  - **Menubar** - Application menu bars
47
47
  - **Pagination** - Page navigation controls
@@ -152,6 +152,88 @@ function MyComponent() {
152
152
  - Automatically updates on window resize
153
153
  - Uses `window.matchMedia` for efficient media query listening
154
154
 
155
+ ### usePrefersReducedMotion
156
+
157
+ A React hook that returns `true` when reduced motion should be applied. It
158
+ resolves from a layered source: an optional override (via
159
+ `ReducedMotionOverrideContext`) takes precedence; with no override it follows
160
+ the OS/browser `prefers-reduced-motion: reduce` setting and updates in real
161
+ time. Consuming code only ever sees the final boolean and can't tell which layer
162
+ produced it.
163
+
164
+ ```tsx
165
+ import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
166
+
167
+ function MyComponent() {
168
+ const prefersReducedMotion = usePrefersReducedMotion();
169
+
170
+ return (
171
+ <div className={prefersReducedMotion ? "" : "animate-fade-in"}>
172
+ Content
173
+ </div>
174
+ );
175
+ }
176
+ ```
177
+
178
+ **Features:**
179
+
180
+ - Returns `boolean` (SSR-safe — defaults to `false` on the server)
181
+ - Override-first resolution with OS fallback — the same hook works in production
182
+ and under test
183
+ - Follows OS preference changes in real time (`useSyncExternalStore` +
184
+ `window.matchMedia`)
185
+ - Use it to gate any animation — framer-motion, CSS classes, or SVG
186
+
187
+ **Can I use this in external repositories?** Yes — it ships with the package
188
+ and works in any React app, no provider or extra setup required.
189
+
190
+ > **One hook for all animations.** Use `usePrefersReducedMotion` everywhere,
191
+ > including inside framer-motion `motion.*` trees. Do **not** reach for
192
+ > framer-motion's own
193
+ > [`useReducedMotion()`](https://www.framer.com/motion/use-reduced-motion/): it
194
+ > reads only the OS media query (captured once at mount) and ignores
195
+ > `<MotionConfig>`, so it can't be driven by an override.
196
+
197
+ #### Overriding the value (testing / Storybook)
198
+
199
+ `ReducedMotionOverrideContext` lets tools force the resolved value without
200
+ changing OS settings — `true`/`false` override the OS, `null` (the default)
201
+ defers to it. The Storybook "Motion" toolbar uses this to switch between
202
+ _Follow system_, _Reduced motion_, and _Full motion_.
203
+
204
+ ```tsx
205
+ import { ReducedMotionOverrideContext } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
206
+
207
+ // Force reduced motion for everything below (e.g. snapshot tests)
208
+ <ReducedMotionOverrideContext.Provider value={true}>
209
+ <MyAnimatedTree />
210
+ </ReducedMotionOverrideContext.Provider>;
211
+ ```
212
+
213
+ > Note: framer-motion's `motion.*` elements read reduced motion from
214
+ > `<MotionConfig reducedMotion="…">`, not from this context. To drive both in one
215
+ > place (as our Storybook decorator does), set both.
216
+
217
+ #### CSS animations and `data-motion`
218
+
219
+ The hook governs JS-driven animation. CSS keyframe animations (the Radix
220
+ overlays, accordion, loading spinners, etc.) are handled by a **global rule in
221
+ the tokens preset** instead — no per-component setup. By default it follows the
222
+ OS `prefers-reduced-motion` preference: every transition and animation collapses
223
+ to near-instant and looping animations (decorative pulses, spinners) stop, so
224
+ elements render at their final, at-rest state.
225
+
226
+ To force a state without changing OS settings, set `data-motion` on any root
227
+ element — it cascades to descendants, including portaled overlays when set on
228
+ `<html>`:
229
+
230
+ ```tsx
231
+ <html data-motion="reduce"> {/* force reduced motion */}
232
+ <html data-motion="full"> {/* force full motion, overriding the OS */}
233
+ ```
234
+
235
+ Omit the attribute to defer to the OS preference (the default).
236
+
155
237
  ## Utilities
156
238
 
157
239
  ### cn (Class Name Utility)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.17.1",
3
+ "version": "2.18.0",
4
4
  "description": "Machine-readable registry of all components in the BrightLocal Design System",
5
5
  "components": [
6
6
  {
@@ -421,6 +421,11 @@
421
421
  "density": [
422
422
  "default",
423
423
  "condensed"
424
+ ],
425
+ "align": [
426
+ "left",
427
+ "center",
428
+ "right"
424
429
  ]
425
430
  },
426
431
  "props": [
@@ -1346,26 +1351,34 @@
1346
1351
  ],
1347
1352
  "compound": false,
1348
1353
  "dataHookRequired": true,
1349
- "variants": {},
1354
+ "variants": {
1355
+ "variant": [
1356
+ "inline",
1357
+ "filled",
1358
+ "outline",
1359
+ "ghost"
1360
+ ]
1361
+ },
1350
1362
  "props": [
1363
+ "variant",
1351
1364
  "external",
1352
1365
  "showExternalIcon",
1353
1366
  "asChild"
1354
1367
  ],
1355
- "description": "Styled hyperlink with external link support",
1368
+ "description": "Styled hyperlink with inline and button-styled variants and external link support",
1356
1369
  "whenToUse": [
1357
- "Inline text links within paragraphs or sentences",
1370
+ "Inline text links within paragraphs or sentences (inline variant)",
1358
1371
  "Navigation to internal or external URLs",
1372
+ "Button-styled navigation or inline actions that need a button appearance (filled, outline, ghost variants)",
1359
1373
  "Links inside i18n <Trans> blocks — use Link as a component in the components map"
1360
1374
  ],
1361
1375
  "doNotUseFor": [
1362
- "actions that don't navigate (use Button)",
1363
- "button-styled navigation (use Button with asChild wrapping a router link)"
1376
+ "actions that don't navigate (submit, delete, toggle) — use Button"
1364
1377
  ],
1365
1378
  "alternatives": [
1366
1379
  {
1367
1380
  "component": "Button",
1368
- "rule": "Use Button for actions (submit, delete, open). For button-styled navigation, use Button asChild wrapping your router's Link component"
1381
+ "rule": "Use Button for actions (submit, delete, open). Use a button-styled Link (variant filled/outline/ghost) for navigation that needs a button appearance"
1369
1382
  }
1370
1383
  ]
1371
1384
  },
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),N=require("react"),b=require("@radix-ui/react-alert-dialog"),i=require("@brightlocal/ui-components/lib/utils"),c=require("@brightlocal/ui-components/button");function g(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const o=g(N),r=g(b);function f({dataHook:t,trackingEl:e,trackingLabel:a,...s}){return l.jsx(r.Root,{"data-hook":t,"data-slot":"alert-dialog","data-tracking-el":e,"data-tracking-label":a,...s})}f.displayName="AlertDialog";const m=o.forwardRef((t,e)=>l.jsx(r.Trigger,{ref:e,"data-slot":"alert-dialog-trigger",...t}));m.displayName="AlertDialogTrigger";function n({...t}){return l.jsx(r.Portal,{...t})}n.displayName="AlertDialogPortal";const d=o.forwardRef(({className:t,...e},a)=>l.jsx(r.Overlay,{ref:a,className:i.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),"data-slot":"alert-dialog-overlay",...e}));d.displayName="AlertDialogOverlay";const D=o.forwardRef(({className:t,...e},a)=>l.jsxs(n,{children:[l.jsx(d,{}),l.jsx(r.Content,{ref:a,className:i.cn("border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),"data-slot":"alert-dialog-content",...e})]}));D.displayName="AlertDialogContent";const u=o.forwardRef(({className:t,...e},a)=>l.jsx("div",{ref:a,className:i.cn("flex flex-col gap-2 text-center sm:text-left",t),"data-slot":"alert-dialog-header",...e}));u.displayName="AlertDialogHeader";const A=o.forwardRef(({className:t,...e},a)=>l.jsx("div",{ref:a,className:i.cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),"data-slot":"alert-dialog-footer",...e}));A.displayName="AlertDialogFooter";const p=o.forwardRef(({className:t,...e},a)=>l.jsx(r.Title,{ref:a,className:i.cn("text-lg font-semibold",t),"data-slot":"alert-dialog-title",...e}));p.displayName="AlertDialogTitle";const x=o.forwardRef(({className:t,...e},a)=>l.jsx(r.Description,{ref:a,className:i.cn("text-muted-foreground text-sm",t),"data-slot":"alert-dialog-description",...e}));x.displayName="AlertDialogDescription";const y=o.forwardRef(({className:t,...e},a)=>l.jsx(r.Action,{ref:a,className:i.cn(c.ButtonVariants(),t),"data-slot":"alert-dialog-action",...e}));y.displayName="AlertDialogAction";const j=o.forwardRef(({className:t,...e},a)=>l.jsx(r.Cancel,{ref:a,className:i.cn(c.ButtonVariants({variant:"outline"}),t),"data-slot":"alert-dialog-cancel",...e}));j.displayName="AlertDialogCancel";exports.AlertDialog=f;exports.AlertDialogAction=y;exports.AlertDialogCancel=j;exports.AlertDialogContent=D;exports.AlertDialogDescription=x;exports.AlertDialogFooter=A;exports.AlertDialogHeader=u;exports.AlertDialogOverlay=d;exports.AlertDialogPortal=n;exports.AlertDialogTitle=p;exports.AlertDialogTrigger=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),N=require("react"),b=require("@radix-ui/react-alert-dialog"),s=require("@brightlocal/ui-components/lib/utils"),c=require("@brightlocal/ui-components/button");function g(t){const a=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(a,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const o=g(N),r=g(b);function f({dataHook:t,trackingEl:a,trackingLabel:e,...i}){return l.jsx(r.Root,{"data-hook":t,"data-slot":"alert-dialog","data-tracking-el":a,"data-tracking-label":e,...i})}f.displayName="AlertDialog";const m=o.forwardRef((t,a)=>l.jsx(r.Trigger,{ref:a,"data-slot":"alert-dialog-trigger",...t}));m.displayName="AlertDialogTrigger";function n({...t}){return l.jsx(r.Portal,{...t})}n.displayName="AlertDialogPortal";const d=o.forwardRef(({className:t,...a},e)=>l.jsx(r.Overlay,{ref:e,className:s.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),"data-slot":"alert-dialog-overlay",...a}));d.displayName="AlertDialogOverlay";const D=o.forwardRef(({className:t,...a},e)=>l.jsxs(n,{children:[l.jsx(d,{}),l.jsx(r.Content,{ref:e,className:s.cn("border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),"data-slot":"alert-dialog-content",...a})]}));D.displayName="AlertDialogContent";const u=o.forwardRef(({className:t,...a},e)=>l.jsx("div",{ref:e,className:s.cn("flex flex-col gap-2 text-center sm:text-left",t),"data-slot":"alert-dialog-header",...a}));u.displayName="AlertDialogHeader";const A=o.forwardRef(({className:t,...a},e)=>l.jsx("div",{ref:e,className:s.cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),"data-slot":"alert-dialog-footer",...a}));A.displayName="AlertDialogFooter";const p=o.forwardRef(({className:t,dataHook:a,...e},i)=>l.jsx(r.Title,{ref:i,className:s.cn("text-lg font-semibold",t),"data-hook":a,"data-slot":"alert-dialog-title",...e}));p.displayName="AlertDialogTitle";const x=o.forwardRef(({className:t,dataHook:a,...e},i)=>l.jsx(r.Description,{ref:i,className:s.cn("text-muted-foreground text-sm",t),"data-hook":a,"data-slot":"alert-dialog-description",...e}));x.displayName="AlertDialogDescription";const y=o.forwardRef(({className:t,...a},e)=>l.jsx(r.Action,{ref:e,className:s.cn(c.ButtonVariants(),t),"data-slot":"alert-dialog-action",...a}));y.displayName="AlertDialogAction";const j=o.forwardRef(({className:t,...a},e)=>l.jsx(r.Cancel,{ref:e,className:s.cn(c.ButtonVariants({variant:"outline"}),t),"data-slot":"alert-dialog-cancel",...a}));j.displayName="AlertDialogCancel";exports.AlertDialog=f;exports.AlertDialogAction=y;exports.AlertDialogCancel=j;exports.AlertDialogContent=D;exports.AlertDialogDescription=x;exports.AlertDialogFooter=A;exports.AlertDialogHeader=u;exports.AlertDialogOverlay=d;exports.AlertDialogPortal=n;exports.AlertDialogTitle=p;exports.AlertDialogTrigger=m;
@@ -27,9 +27,30 @@ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDial
27
27
  declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
28
28
  declare const AlertDialogHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
29
29
  declare const AlertDialogFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
- declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
31
- declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
30
+ /**
31
+ * Props for the AlertDialogTitle component
32
+ */
33
+ interface AlertDialogTitleProps extends React.ComponentProps<typeof AlertDialogPrimitive.Title> {
34
+ /**
35
+ * Data hook for automated testing
36
+ * @example "alert-dialog-title"
37
+ */
38
+ dataHook?: string;
39
+ }
40
+ declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
41
+ /**
42
+ * Props for the AlertDialogDescription component
43
+ */
44
+ interface AlertDialogDescriptionProps extends React.ComponentProps<typeof AlertDialogPrimitive.Description> {
45
+ /**
46
+ * Data hook for automated testing
47
+ * @example "alert-dialog-description"
48
+ */
49
+ dataHook?: string;
50
+ }
51
+ declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
32
52
  declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
33
53
  declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
34
54
  export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
55
+ export type { AlertDialogDescriptionProps, AlertDialogProps, AlertDialogTitleProps, };
35
56
  //# sourceMappingURL=alert-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../src/components/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAKrE,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CACrD,OAAO,oBAAoB,CAAC,IAAI,CACjC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAS,WAAW,CAAC,EACnB,QAAQ,EACR,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAUlB;kBAfQ,WAAW;;;AAmBpB,QAAA,MAAM,kBAAkB,8KAStB,CAAC;AAIH,iBAAS,iBAAiB,CAAC,EACzB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,2CAE1D;kBAJQ,iBAAiB;;;AAQ1B,QAAA,MAAM,kBAAkB,wKAatB,CAAC;AAIH,QAAA,MAAM,kBAAkB,wKAgBtB,CAAC;AAIH,QAAA,MAAM,iBAAiB,mKAUrB,CAAC;AAIH,QAAA,MAAM,iBAAiB,mKAarB,CAAC;AAIH,QAAA,MAAM,gBAAgB,8KAUpB,CAAC;AAIH,QAAA,MAAM,sBAAsB,wLAU1B,CAAC;AAIH,QAAA,MAAM,iBAAiB,6KAUrB,CAAC;AAIH,QAAA,MAAM,iBAAiB,6KAUrB,CAAC;AAIH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iB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,CAAC,WAAW,CACxC;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,sBAAsB,uHAW1B,CAAC;AAIH,QAAA,MAAM,iBAAiB,6KAUrB,CAAC;AAIH,QAAA,MAAM,iBAAiB,6KAUrB,CAAC;AAIH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC;AAEF,YAAY,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
@@ -2,12 +2,12 @@ import { jsx as l, jsxs as c } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
3
  import * as r from "@radix-ui/react-alert-dialog";
4
4
  import { cn as i } from "@brightlocal/ui-components/lib/utils";
5
- import { ButtonVariants as d } from "@brightlocal/ui-components/button";
5
+ import { ButtonVariants as s } from "@brightlocal/ui-components/button";
6
6
  function m({
7
7
  dataHook: a,
8
8
  trackingEl: t,
9
9
  trackingLabel: e,
10
- ...g
10
+ ...d
11
11
  }) {
12
12
  return /* @__PURE__ */ l(
13
13
  r.Root,
@@ -16,7 +16,7 @@ function m({
16
16
  "data-slot": "alert-dialog",
17
17
  "data-tracking-el": t,
18
18
  "data-tracking-label": e,
19
- ...g
19
+ ...d
20
20
  }
21
21
  );
22
22
  }
@@ -30,13 +30,13 @@ const f = o.forwardRef((a, t) => /* @__PURE__ */ l(
30
30
  }
31
31
  ));
32
32
  f.displayName = "AlertDialogTrigger";
33
- function s({
33
+ function n({
34
34
  ...a
35
35
  }) {
36
36
  return /* @__PURE__ */ l(r.Portal, { ...a });
37
37
  }
38
- s.displayName = "AlertDialogPortal";
39
- const n = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
38
+ n.displayName = "AlertDialogPortal";
39
+ const g = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
40
40
  r.Overlay,
41
41
  {
42
42
  ref: e,
@@ -48,9 +48,9 @@ const n = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
48
48
  ...t
49
49
  }
50
50
  ));
51
- n.displayName = "AlertDialogOverlay";
52
- const p = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ c(s, { children: [
53
- /* @__PURE__ */ l(n, {}),
51
+ g.displayName = "AlertDialogOverlay";
52
+ const p = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ c(n, { children: [
53
+ /* @__PURE__ */ l(g, {}),
54
54
  /* @__PURE__ */ l(
55
55
  r.Content,
56
56
  {
@@ -88,23 +88,25 @@ const D = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
88
88
  }
89
89
  ));
90
90
  D.displayName = "AlertDialogFooter";
91
- const N = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
91
+ const N = o.forwardRef(({ className: a, dataHook: t, ...e }, d) => /* @__PURE__ */ l(
92
92
  r.Title,
93
93
  {
94
- ref: e,
94
+ ref: d,
95
95
  className: i("text-lg font-semibold", a),
96
+ "data-hook": t,
96
97
  "data-slot": "alert-dialog-title",
97
- ...t
98
+ ...e
98
99
  }
99
100
  ));
100
101
  N.displayName = "AlertDialogTitle";
101
- const u = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
102
+ const u = o.forwardRef(({ className: a, dataHook: t, ...e }, d) => /* @__PURE__ */ l(
102
103
  r.Description,
103
104
  {
104
- ref: e,
105
+ ref: d,
105
106
  className: i("text-muted-foreground text-sm", a),
107
+ "data-hook": t,
106
108
  "data-slot": "alert-dialog-description",
107
- ...t
109
+ ...e
108
110
  }
109
111
  ));
110
112
  u.displayName = "AlertDialogDescription";
@@ -112,7 +114,7 @@ const x = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
112
114
  r.Action,
113
115
  {
114
116
  ref: e,
115
- className: i(d(), a),
117
+ className: i(s(), a),
116
118
  "data-slot": "alert-dialog-action",
117
119
  ...t
118
120
  }
@@ -122,7 +124,7 @@ const y = o.forwardRef(({ className: a, ...t }, e) => /* @__PURE__ */ l(
122
124
  r.Cancel,
123
125
  {
124
126
  ref: e,
125
- className: i(d({ variant: "outline" }), a),
127
+ className: i(s({ variant: "outline" }), a),
126
128
  "data-slot": "alert-dialog-cancel",
127
129
  ...t
128
130
  }
@@ -136,8 +138,8 @@ export {
136
138
  u as AlertDialogDescription,
137
139
  D as AlertDialogFooter,
138
140
  A as AlertDialogHeader,
139
- n as AlertDialogOverlay,
140
- s as AlertDialogPortal,
141
+ g as AlertDialogOverlay,
142
+ n as AlertDialogPortal,
141
143
  N as AlertDialogTitle,
142
144
  f as AlertDialogTrigger
143
145
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),_=require("react"),k=require("framer-motion"),K=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),O=require("../button.cjs"),$=require("../input.cjs"),g=require("../list.cjs");function B(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const a=B(_),w=a.createContext(null);function y(){const t=a.useContext(w);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function A({value:t,onValueChange:i,children:r,className:o,dataHook:u,trackingEl:l,trackingLabel:I}){const[p,m]=a.useState(""),c=a.useRef(t.length),e=a.useRef(t.length),[j,h]=a.useState(()=>t.map((f,s)=>s)),[N,q]=a.useState(0);a.useEffect(()=>{const f=c.current;c.current=t.length,t.length>f&&m(""),h(s=>s.length===t.length?s:t.length>s.length?[...s,...Array.from({length:t.length-s.length},()=>e.current++)]:s.slice(0,t.length))},[t,N]);const b=a.useCallback(f=>{const s=f.map(d=>d.trim()).filter(Boolean);s.length&&(h(d=>[...d,...s.map(()=>e.current++)]),i([...t,...s]),q(d=>d+1))},[t,i]),L=a.useCallback(f=>{h(s=>s.filter((d,S)=>S!==f)),i(t.filter((s,d)=>d!==f))},[t,i]),P=a.useMemo(()=>({value:t,inputValue:p,setInputValue:m,addItems:b,removeItem:L,stableKeys:j}),[t,p,b,L,j]);return n.jsx(w.Provider,{value:P,children:n.jsx("div",{className:x.cn("flex flex-col gap-4",o),"data-hook":u,"data-slot":"input-list","data-tracking-el":l,"data-tracking-label":I,children:r})})}A.displayName="InputList";function C({dataHook:t="input-list",loading:i=!1,skeletonCount:r=5,disabled:o=!1,removeAriaLabel:u,className:l}){const{value:I,removeItem:p,stableKeys:m}=y();return i?n.jsx("ul",{className:x.cn("flex flex-col gap-2",l),"data-slot":"input-list-skeleton",children:Array.from({length:r}).map((c,e)=>n.jsx(g.Item,{variant:"loading"},e))}):n.jsx("ul",{className:x.cn("flex flex-col gap-2",l),"data-hook":`${t}-list`,"data-slot":"list",children:n.jsx(k.AnimatePresence,{initial:!1,mode:"popLayout",children:I.map((c,e)=>n.jsx(k.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${e}`,exit:{opacity:0,scale:.8,transition:{opacity:{duration:.15},scale:{duration:.12}}},initial:{opacity:0,scale:.8},transition:{opacity:{duration:.15},scale:{duration:.15},layout:{type:"spring",stiffness:500,damping:35}},children:n.jsx(g.Item,{asChild:!0,variant:"filled",children:n.jsxs("div",{children:[n.jsx(g.ItemContent,{children:n.jsx(g.ItemTitle,{children:c})}),n.jsx(g.ItemActions,{children:n.jsx("button",{"aria-label":u?u.replace("{item}",c):`Remove ${c}`,className:x.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${t}-remove-${e}`,disabled:o,type:"button",onClick:()=>p(e),children:n.jsx(K.X,{})})})]})})},m[e]))})})}C.displayName="InputListItems";const R=a.forwardRef(({dataHook:t,error:i=!1,className:r,...o},u)=>{const{inputValue:l,setInputValue:I,addItems:p}=y(),m=e=>{e.key==="Enter"&&(e.preventDefault(),p([l])),o.onKeyDown?.(e)},c=e=>{const h=e.clipboardData.getData("text").split(`
2
- `);h.length>1&&(e.preventDefault(),p(h)),o.onPaste?.(e)};return n.jsx($.Input,{ref:u,...o,className:x.cn("flex-1",r),dataHook:t,error:i,value:l,onChange:e=>{I(e.target.value),o.onChange?.(e)},onKeyDown:m,onPaste:c})});R.displayName="InputListInput";const D=a.forwardRef(({dataHook:t,children:i,...r},o)=>{const{inputValue:u,addItems:l}=y();return n.jsx(O.Button,{ref:o,...r,dataHook:t,onClick:()=>l([u]),children:i})});D.displayName="InputListAddButton";exports.InputList=A;exports.InputListAddButton=D;exports.InputListInput=R;exports.InputListItems=C;exports.useInputListContext=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),M=require("react"),R=require("framer-motion"),_=require("@brightlocal/icons"),y=require("@brightlocal/ui-components/lib/utils"),K=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),O=require("../button.cjs"),$=require("../input.cjs"),x=require("../list.cjs");function B(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const a=B(M),k=a.createContext(null);function j(){const t=a.useContext(k);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function w({value:t,onValueChange:i,children:r,className:o,dataHook:c,trackingEl:u,trackingLabel:g}){const[p,m]=a.useState(""),h=a.useRef(t.length),e=a.useRef(t.length),[l,I]=a.useState(()=>t.map((f,s)=>s)),[q,D]=a.useState(0);a.useEffect(()=>{const f=h.current;h.current=t.length,t.length>f&&m(""),I(s=>s.length===t.length?s:t.length>s.length?[...s,...Array.from({length:t.length-s.length},()=>e.current++)]:s.slice(0,t.length))},[t,q]);const b=a.useCallback(f=>{const s=f.map(d=>d.trim()).filter(Boolean);s.length&&(I(d=>[...d,...s.map(()=>e.current++)]),i([...t,...s]),D(d=>d+1))},[t,i]),L=a.useCallback(f=>{I(s=>s.filter((d,S)=>S!==f)),i(t.filter((s,d)=>d!==f))},[t,i]),N=a.useMemo(()=>({value:t,inputValue:p,setInputValue:m,addItems:b,removeItem:L,stableKeys:l}),[t,p,b,L,l]);return n.jsx(k.Provider,{value:N,children:n.jsx("div",{className:y.cn("flex flex-col gap-4",o),"data-hook":c,"data-slot":"input-list","data-tracking-el":u,"data-tracking-label":g,children:r})})}w.displayName="InputList";function A({dataHook:t="input-list",loading:i=!1,skeletonCount:r=5,disabled:o=!1,removeAriaLabel:c,className:u}){const{value:g,removeItem:p,stableKeys:m}=j(),h=K.usePrefersReducedMotion();return i?n.jsx("ul",{className:y.cn("flex flex-col gap-2",u),"data-slot":"input-list-skeleton",children:Array.from({length:r}).map((e,l)=>n.jsx(x.Item,{variant:"loading"},l))}):n.jsx("ul",{className:y.cn("flex flex-col gap-2",u),"data-hook":`${t}-list`,"data-slot":"list",children:n.jsx(R.AnimatePresence,{initial:!1,mode:"popLayout",children:g.map((e,l)=>n.jsx(R.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${l}`,exit:{opacity:0,scale:.8,transition:{opacity:{duration:.15},scale:{duration:.12}}},initial:h?!1:{opacity:0,scale:.8},transition:{opacity:{duration:.15},scale:{duration:.15},layout:{type:"spring",stiffness:500,damping:35}},children:n.jsx(x.Item,{asChild:!0,variant:"filled",children:n.jsxs("div",{children:[n.jsx(x.ItemContent,{children:n.jsx(x.ItemTitle,{children:e})}),n.jsx(x.ItemActions,{children:n.jsx("button",{"aria-label":c?c.replace("{item}",e):`Remove ${e}`,className:y.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${t}-remove-${l}`,disabled:o,type:"button",onClick:()=>p(l),children:n.jsx(_.X,{})})})]})})},m[l]))})})}A.displayName="InputListItems";const C=a.forwardRef(({dataHook:t,error:i=!1,className:r,...o},c)=>{const{inputValue:u,setInputValue:g,addItems:p}=j(),m=e=>{e.key==="Enter"&&(e.preventDefault(),p([u])),o.onKeyDown?.(e)},h=e=>{const I=e.clipboardData.getData("text").split(`
2
+ `);I.length>1&&(e.preventDefault(),p(I)),o.onPaste?.(e)};return n.jsx($.Input,{ref:c,...o,className:y.cn("flex-1",r),dataHook:t,error:i,value:u,onChange:e=>{g(e.target.value),o.onChange?.(e)},onKeyDown:m,onPaste:h})});C.displayName="InputListInput";const P=a.forwardRef(({dataHook:t,children:i,...r},o)=>{const{inputValue:c,addItems:u}=j();return n.jsx(O.Button,{ref:o,...r,dataHook:t,onClick:()=>u([c]),children:i})});P.displayName="InputListAddButton";exports.InputList=w;exports.InputListAddButton=P;exports.InputListInput=C;exports.InputListItems=A;exports.useInputListContext=j;
@@ -1 +1 @@
1
- {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQhE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,EAAE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;GAQG;AACH,QAAA,MAAM,kBAAkB,gHAgBtB,CAAC;AAOH,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,CAAC"}
@@ -1,80 +1,81 @@
1
1
  import { jsx as o, jsxs as D } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { AnimatePresence as K, motion as $ } from "framer-motion";
4
- import { X as P } from "@brightlocal/icons";
5
- import { cn as g } from "@brightlocal/ui-components/lib/utils";
6
- import { Button as B } from "../button.js";
7
- import { Input as S } from "../input.js";
8
- import { Item as k, ItemContent as V, ItemTitle as _, ItemActions as j } from "../list.js";
9
- const w = s.createContext(
3
+ import { AnimatePresence as K, motion as P } from "framer-motion";
4
+ import { X as $ } from "@brightlocal/icons";
5
+ import { cn as y } from "@brightlocal/ui-components/lib/utils";
6
+ import { usePrefersReducedMotion as B } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
7
+ import { Button as S } from "../button.js";
8
+ import { Input as V } from "../input.js";
9
+ import { Item as k, ItemContent as _, ItemTitle as j, ItemActions as E } from "../list.js";
10
+ const R = s.createContext(
10
11
  null
11
12
  );
12
13
  function x() {
13
- const t = s.useContext(w);
14
+ const t = s.useContext(R);
14
15
  if (!t)
15
16
  throw new Error("InputList components must be used within an <InputList>");
16
17
  return t;
17
18
  }
18
- function E({
19
+ function M({
19
20
  value: t,
20
21
  onValueChange: i,
21
22
  children: d,
22
23
  className: a,
23
24
  dataHook: c,
24
25
  trackingEl: l,
25
- trackingLabel: I
26
+ trackingLabel: g
26
27
  }) {
27
- const [p, f] = s.useState(""), r = s.useRef(t.length), e = s.useRef(t.length), [y, h] = s.useState(
28
- () => t.map((m, n) => n)
29
- ), [A, C] = s.useState(0);
28
+ const [m, f] = s.useState(""), h = s.useRef(t.length), e = s.useRef(t.length), [r, I] = s.useState(
29
+ () => t.map((p, n) => n)
30
+ ), [w, A] = s.useState(0);
30
31
  s.useEffect(() => {
31
- const m = r.current;
32
- r.current = t.length, t.length > m && f(""), h((n) => n.length === t.length ? n : t.length > n.length ? [
32
+ const p = h.current;
33
+ h.current = t.length, t.length > p && f(""), I((n) => n.length === t.length ? n : t.length > n.length ? [
33
34
  ...n,
34
35
  ...Array.from(
35
36
  { length: t.length - n.length },
36
37
  () => e.current++
37
38
  )
38
39
  ] : n.slice(0, t.length));
39
- }, [t, A]);
40
+ }, [t, w]);
40
41
  const L = s.useCallback(
41
- (m) => {
42
- const n = m.map((u) => u.trim()).filter(Boolean);
43
- n.length && (h((u) => [
42
+ (p) => {
43
+ const n = p.map((u) => u.trim()).filter(Boolean);
44
+ n.length && (I((u) => [
44
45
  ...u,
45
46
  ...n.map(() => e.current++)
46
- ]), i([...t, ...n]), C((u) => u + 1));
47
+ ]), i([...t, ...n]), A((u) => u + 1));
47
48
  },
48
49
  [t, i]
49
50
  ), b = s.useCallback(
50
- (m) => {
51
- h((n) => n.filter((u, R) => R !== m)), i(t.filter((n, u) => u !== m));
51
+ (p) => {
52
+ I((n) => n.filter((u, N) => N !== p)), i(t.filter((n, u) => u !== p));
52
53
  },
53
54
  [t, i]
54
- ), N = s.useMemo(
55
+ ), C = s.useMemo(
55
56
  () => ({
56
57
  value: t,
57
- inputValue: p,
58
+ inputValue: m,
58
59
  setInputValue: f,
59
60
  addItems: L,
60
61
  removeItem: b,
61
- stableKeys: y
62
+ stableKeys: r
62
63
  }),
63
- [t, p, L, b, y]
64
+ [t, m, L, b, r]
64
65
  );
65
- return /* @__PURE__ */ o(w.Provider, { value: N, children: /* @__PURE__ */ o(
66
+ return /* @__PURE__ */ o(R.Provider, { value: C, children: /* @__PURE__ */ o(
66
67
  "div",
67
68
  {
68
- className: g("flex flex-col gap-4", a),
69
+ className: y("flex flex-col gap-4", a),
69
70
  "data-hook": c,
70
71
  "data-slot": "input-list",
71
72
  "data-tracking-el": l,
72
- "data-tracking-label": I,
73
+ "data-tracking-label": g,
73
74
  children: d
74
75
  }
75
76
  ) });
76
77
  }
77
- E.displayName = "InputList";
78
+ M.displayName = "InputList";
78
79
  function z({
79
80
  dataHook: t = "input-list",
80
81
  loading: i = !1,
@@ -83,26 +84,26 @@ function z({
83
84
  removeAriaLabel: c,
84
85
  className: l
85
86
  }) {
86
- const { value: I, removeItem: p, stableKeys: f } = x();
87
+ const { value: g, removeItem: m, stableKeys: f } = x(), h = B();
87
88
  return i ? /* @__PURE__ */ o(
88
89
  "ul",
89
90
  {
90
- className: g("flex flex-col gap-2", l),
91
+ className: y("flex flex-col gap-2", l),
91
92
  "data-slot": "input-list-skeleton",
92
- children: Array.from({ length: d }).map((r, e) => /* @__PURE__ */ o(k, { variant: "loading" }, e))
93
+ children: Array.from({ length: d }).map((e, r) => /* @__PURE__ */ o(k, { variant: "loading" }, r))
93
94
  }
94
95
  ) : /* @__PURE__ */ o(
95
96
  "ul",
96
97
  {
97
- className: g("flex flex-col gap-2", l),
98
+ className: y("flex flex-col gap-2", l),
98
99
  "data-hook": `${t}-list`,
99
100
  "data-slot": "list",
100
- children: /* @__PURE__ */ o(K, { initial: !1, mode: "popLayout", children: I.map((r, e) => /* @__PURE__ */ o(
101
- $.li,
101
+ children: /* @__PURE__ */ o(K, { initial: !1, mode: "popLayout", children: g.map((e, r) => /* @__PURE__ */ o(
102
+ P.li,
102
103
  {
103
104
  layout: !0,
104
105
  animate: { opacity: 1, scale: 1 },
105
- "data-hook": `${t}-item-${e}`,
106
+ "data-hook": `${t}-item-${r}`,
106
107
  exit: {
107
108
  opacity: 0,
108
109
  scale: 0.8,
@@ -111,7 +112,7 @@ function z({
111
112
  scale: { duration: 0.12 }
112
113
  }
113
114
  },
114
- initial: { opacity: 0, scale: 0.8 },
115
+ initial: h ? !1 : { opacity: 0, scale: 0.8 },
115
116
  transition: {
116
117
  opacity: { duration: 0.15 },
117
118
  scale: { duration: 0.15 },
@@ -122,65 +123,65 @@ function z({
122
123
  }
123
124
  },
124
125
  children: /* @__PURE__ */ o(k, { asChild: !0, variant: "filled", children: /* @__PURE__ */ D("div", { children: [
125
- /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(_, { children: r }) }),
126
- /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(
126
+ /* @__PURE__ */ o(_, { children: /* @__PURE__ */ o(j, { children: e }) }),
127
+ /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(
127
128
  "button",
128
129
  {
129
- "aria-label": c ? c.replace("{item}", r) : `Remove ${r}`,
130
- className: g(
130
+ "aria-label": c ? c.replace("{item}", e) : `Remove ${e}`,
131
+ className: y(
131
132
  "inline-flex size-9 cursor-pointer items-center justify-center rounded-full",
132
133
  "text-muted-foreground",
133
134
  "focus-visible:shadow-default outline-none",
134
135
  "transition-colors duration-150 ease-in-out",
135
136
  "disabled:pointer-events-none disabled:opacity-50"
136
137
  ),
137
- "data-hook": `${t}-remove-${e}`,
138
+ "data-hook": `${t}-remove-${r}`,
138
139
  disabled: a,
139
140
  type: "button",
140
- onClick: () => p(e),
141
- children: /* @__PURE__ */ o(P, {})
141
+ onClick: () => m(r),
142
+ children: /* @__PURE__ */ o($, {})
142
143
  }
143
144
  ) })
144
145
  ] }) })
145
146
  },
146
- f[e]
147
+ f[r]
147
148
  )) })
148
149
  }
149
150
  );
150
151
  }
151
152
  z.displayName = "InputListItems";
152
- const M = s.forwardRef(
153
+ const T = s.forwardRef(
153
154
  ({ dataHook: t, error: i = !1, className: d, ...a }, c) => {
154
- const { inputValue: l, setInputValue: I, addItems: p } = x(), f = (e) => {
155
- e.key === "Enter" && (e.preventDefault(), p([l])), a.onKeyDown?.(e);
156
- }, r = (e) => {
157
- const h = e.clipboardData.getData("text").split(`
155
+ const { inputValue: l, setInputValue: g, addItems: m } = x(), f = (e) => {
156
+ e.key === "Enter" && (e.preventDefault(), m([l])), a.onKeyDown?.(e);
157
+ }, h = (e) => {
158
+ const I = e.clipboardData.getData("text").split(`
158
159
  `);
159
- h.length > 1 && (e.preventDefault(), p(h)), a.onPaste?.(e);
160
+ I.length > 1 && (e.preventDefault(), m(I)), a.onPaste?.(e);
160
161
  };
161
162
  return /* @__PURE__ */ o(
162
- S,
163
+ V,
163
164
  {
164
165
  ref: c,
165
166
  ...a,
166
- className: g("flex-1", d),
167
+ className: y("flex-1", d),
167
168
  dataHook: t,
168
169
  error: i,
169
170
  value: l,
170
171
  onChange: (e) => {
171
- I(e.target.value), a.onChange?.(e);
172
+ g(e.target.value), a.onChange?.(e);
172
173
  },
173
174
  onKeyDown: f,
174
- onPaste: r
175
+ onPaste: h
175
176
  }
176
177
  );
177
178
  }
178
179
  );
179
- M.displayName = "InputListInput";
180
- const T = s.forwardRef(({ dataHook: t, children: i, ...d }, a) => {
180
+ T.displayName = "InputListInput";
181
+ const X = s.forwardRef(({ dataHook: t, children: i, ...d }, a) => {
181
182
  const { inputValue: c, addItems: l } = x();
182
183
  return /* @__PURE__ */ o(
183
- B,
184
+ S,
184
185
  {
185
186
  ref: a,
186
187
  ...d,
@@ -190,11 +191,11 @@ const T = s.forwardRef(({ dataHook: t, children: i, ...d }, a) => {
190
191
  }
191
192
  );
192
193
  });
193
- T.displayName = "InputListAddButton";
194
+ X.displayName = "InputListAddButton";
194
195
  export {
195
- E as InputList,
196
- T as InputListAddButton,
197
- M as InputListInput,
196
+ M as InputList,
197
+ X as InputListAddButton,
198
+ T as InputListInput,
198
199
  z as InputListItems,
199
200
  x as useInputListContext
200
201
  };