@brightlocal/ui-components 2.17.1 → 2.19.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 (79) hide show
  1. package/README.md +83 -1
  2. package/component-meta.json +23 -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/blocks/sidebar.cjs +1 -1
  11. package/dist/blocks/sidebar.d.ts +2 -0
  12. package/dist/blocks/sidebar.d.ts.map +1 -1
  13. package/dist/blocks/sidebar.js +426 -403
  14. package/dist/card.cjs +1 -1
  15. package/dist/card.d.ts +22 -2
  16. package/dist/card.d.ts.map +1 -1
  17. package/dist/card.js +93 -72
  18. package/dist/chip.cjs +1 -1
  19. package/dist/chip.d.ts.map +1 -1
  20. package/dist/chip.js +1 -7
  21. package/dist/dialog.cjs +1 -1
  22. package/dist/dialog.d.ts +23 -3
  23. package/dist/dialog.d.ts.map +1 -1
  24. package/dist/dialog.js +44 -42
  25. package/dist/dropdown-menu.cjs +1 -1
  26. package/dist/dropdown-menu.d.ts +10 -0
  27. package/dist/dropdown-menu.d.ts.map +1 -1
  28. package/dist/dropdown-menu.js +30 -29
  29. package/dist/field.cjs +1 -1
  30. package/dist/field.d.ts +5 -1
  31. package/dist/field.d.ts.map +1 -1
  32. package/dist/field.js +9 -7
  33. package/dist/global-layout.cjs +1 -1
  34. package/dist/global-layout.d.ts.map +1 -1
  35. package/dist/global-layout.js +44 -42
  36. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  37. package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
  38. package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
  39. package/dist/hooks/use-prefers-reduced-motion.js +17 -11
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.js +38 -37
  42. package/dist/link.cjs +1 -1
  43. package/dist/link.d.ts +13 -2
  44. package/dist/link.d.ts.map +1 -1
  45. package/dist/link.js +110 -53
  46. package/dist/logo.cjs +1 -1
  47. package/dist/logo.d.ts.map +1 -1
  48. package/dist/logo.js +44 -37
  49. package/dist/map.cjs +1 -1
  50. package/dist/map.d.ts.map +1 -1
  51. package/dist/map.js +1 -1
  52. package/dist/progress.cjs +1 -1
  53. package/dist/progress.d.ts.map +1 -1
  54. package/dist/progress.js +26 -25
  55. package/dist/sheet.cjs +1 -1
  56. package/dist/sheet.d.ts +17 -2
  57. package/dist/sheet.d.ts.map +1 -1
  58. package/dist/sheet.js +29 -27
  59. package/dist/stepper.cjs +1 -1
  60. package/dist/stepper.d.ts +15 -13
  61. package/dist/stepper.d.ts.map +1 -1
  62. package/dist/stepper.js +84 -85
  63. package/package.json +3 -3
  64. package/src/blocks/input-list.tsx +8 -1
  65. package/src/blocks/sidebar.tsx +47 -7
  66. package/src/components/alert-dialog.tsx +38 -4
  67. package/src/components/card.tsx +56 -9
  68. package/src/components/chip.tsx +1 -4
  69. package/src/components/dialog.tsx +39 -6
  70. package/src/components/dropdown-menu.tsx +7 -1
  71. package/src/components/field.tsx +6 -0
  72. package/src/components/global-layout.tsx +3 -1
  73. package/src/components/link.tsx +103 -27
  74. package/src/components/logo.tsx +19 -25
  75. package/src/components/map.tsx +1 -2
  76. package/src/components/progress.tsx +12 -6
  77. package/src/components/sheet.tsx +30 -5
  78. package/src/components/stepper.tsx +93 -80
  79. package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/dist/sheet.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
3
  import * as s from "@radix-ui/react-dialog";
4
4
  import { cva as u } from "class-variance-authority";
@@ -75,21 +75,21 @@ const b = r.forwardRef(({ dataHook: t, ...e }, a) => /* @__PURE__ */ o(
75
75
  s.Trigger,
76
76
  {
77
77
  ref: a,
78
- "data-hook": t,
79
78
  "data-slot": "sheet-trigger",
79
+ ...t != null && { "data-hook": t },
80
80
  ...e
81
81
  }
82
82
  ));
83
83
  b.displayName = "SheetTrigger";
84
84
  const N = r.forwardRef(({ ...t }, e) => /* @__PURE__ */ o(s.Close, { ref: e, "data-slot": "sheet-close", ...t }));
85
85
  N.displayName = "SheetClose";
86
- function f({
86
+ function c({
87
87
  ...t
88
88
  }) {
89
89
  return /* @__PURE__ */ o(s.Portal, { "data-slot": "sheet-portal", ...t });
90
90
  }
91
- f.displayName = "SheetPortal";
92
- const c = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
91
+ c.displayName = "SheetPortal";
92
+ const m = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
93
93
  s.Overlay,
94
94
  {
95
95
  ref: a,
@@ -101,32 +101,32 @@ const c = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
101
101
  ...e
102
102
  }
103
103
  ));
104
- c.displayName = "SheetOverlay";
104
+ m.displayName = "SheetOverlay";
105
105
  const v = r.forwardRef(
106
106
  ({
107
107
  className: t,
108
108
  children: e,
109
109
  side: a,
110
- dataHook: l,
110
+ dataHook: d,
111
111
  trackingEl: n,
112
- trackingLabel: m,
112
+ trackingLabel: f,
113
113
  closeLabel: h,
114
114
  ...p
115
- }, g) => /* @__PURE__ */ d(f, { children: [
116
- /* @__PURE__ */ o(c, {}),
117
- /* @__PURE__ */ d(
115
+ }, g) => /* @__PURE__ */ l(c, { children: [
116
+ /* @__PURE__ */ o(m, {}),
117
+ /* @__PURE__ */ l(
118
118
  s.Content,
119
119
  {
120
120
  ref: g,
121
121
  className: i(y({ side: a }), t),
122
- "data-hook": l,
122
+ "data-hook": d,
123
123
  "data-slot": "sheet-content",
124
124
  "data-tracking-el": n,
125
- "data-tracking-label": m,
125
+ "data-tracking-label": f,
126
126
  ...p,
127
127
  children: [
128
128
  e,
129
- /* @__PURE__ */ d(s.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", children: [
129
+ /* @__PURE__ */ l(s.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", children: [
130
130
  /* @__PURE__ */ o(x, {}),
131
131
  /* @__PURE__ */ o("span", { className: "sr-only", children: h ?? "Close" })
132
132
  ] })
@@ -146,7 +146,7 @@ const w = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
146
146
  }
147
147
  ));
148
148
  w.displayName = "SheetHeader";
149
- const R = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
149
+ const k = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
150
150
  "div",
151
151
  {
152
152
  ref: a,
@@ -158,32 +158,34 @@ const R = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
158
158
  ...e
159
159
  }
160
160
  ));
161
- R.displayName = "SheetFooter";
162
- const k = r.forwardRef(({ className: t, icon: e, children: a, ...l }, n) => /* @__PURE__ */ d(
161
+ k.displayName = "SheetFooter";
162
+ const R = r.forwardRef(({ className: t, icon: e, children: a, dataHook: d, ...n }, f) => /* @__PURE__ */ l(
163
163
  s.Title,
164
164
  {
165
- ref: n,
165
+ ref: f,
166
166
  className: i(
167
167
  "text-foreground text-lg font-semibold",
168
168
  e && "flex items-center gap-2",
169
169
  t
170
170
  ),
171
+ "data-hook": d,
171
172
  "data-slot": "sheet-title",
172
- ...l,
173
+ ...n,
173
174
  children: [
174
175
  e && /* @__PURE__ */ o("span", { className: "shrink-0 [&_svg]:size-5", "data-slot": "sheet-title-icon", children: e }),
175
176
  a
176
177
  ]
177
178
  }
178
179
  ));
179
- k.displayName = "SheetTitle";
180
- const C = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
180
+ R.displayName = "SheetTitle";
181
+ const C = r.forwardRef(({ className: t, dataHook: e, ...a }, d) => /* @__PURE__ */ o(
181
182
  s.Description,
182
183
  {
183
- ref: a,
184
+ ref: d,
184
185
  className: i("text-muted-foreground text-sm", t),
186
+ "data-hook": e,
185
187
  "data-slot": "sheet-description",
186
- ...e
188
+ ...a
187
189
  }
188
190
  ));
189
191
  C.displayName = "SheetDescription";
@@ -192,10 +194,10 @@ export {
192
194
  N as SheetClose,
193
195
  v as SheetContent,
194
196
  C as SheetDescription,
195
- R as SheetFooter,
197
+ k as SheetFooter,
196
198
  w as SheetHeader,
197
- c as SheetOverlay,
198
- f as SheetPortal,
199
- k as SheetTitle,
199
+ m as SheetOverlay,
200
+ c as SheetPortal,
201
+ R as SheetTitle,
200
202
  b as SheetTrigger
201
203
  };
package/dist/stepper.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("react"),V=require("@radix-ui/react-slot"),_=require("class-variance-authority"),w=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils");function X(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const s=X(F),I=s.createContext(null);function k(){const e=s.useContext(I);if(!e)throw new Error("Stepper components must be used within <Stepper>");return e}const C=s.createContext(null);function z(){const e=s.useContext(C);if(!e)throw new Error("StepperItem sub-components must be used within <StepperItem>");return e}const R=s.forwardRef(({className:e,dataHook:a,steps:t,value:o,defaultValue:l,onValueChange:u,orientation:i="horizontal",labelPlacement:m="below",ariaLabel:g,trackingEl:p,trackingLabel:c,...n},f)=>{const y=i==="vertical"?"vertical":m==="inline"?"horizontal-inline":"horizontal-below",x=o!==void 0,[b,v]=s.useState(l??t[0]?.id??""),S=x?o:b,N=t.findIndex(h=>h.id===S),j=s.useCallback(h=>{x||v(h),u?.(h)},[x,u]),A=s.useMemo(()=>({activeId:S,activeIndex:N,setActiveStep:j,steps:t,orientation:i}),[S,N,j,t,i]);return r.jsx(I.Provider,{value:A,children:r.jsx("div",{ref:f,"aria-label":g??"Progress",className:d.cn("group/stepper flex data-[orientation=vertical]:flex-col",e),"data-hook":a,"data-layout":y,"data-orientation":i,"data-slot":"stepper","data-tracking-el":p,"data-tracking-label":c,role:"group",...n})})});R.displayName="Stepper";const T=s.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("ol",{ref:o,className:d.cn("flex w-full","group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=horizontal]/stepper:items-start","group-data-[orientation=vertical]/stepper:flex-col",e),"data-hook":a,"data-slot":"stepper-nav",...t}));T.displayName="StepperNav";const D=s.forwardRef(({className:e,stepId:a,completed:t=!1,error:o=!1,disabled:l=!1,loading:u=!1,dataHook:i,...m},g)=>{const{activeIndex:p,steps:c}=k(),n=c.findIndex(v=>v.id===a);if(n===-1)throw new Error(`StepperItem stepId "${a}" was not found in the Stepper "steps" prop. Each StepperItem's stepId must match a step id.`);const f=n===c.length-1,y=u&&!o&&n===p,x=o?"error":t||n<p?"completed":n===p?"active":"inactive",b=s.useMemo(()=>({stepId:a,index:n,state:x,isLast:f,isDisabled:l,isLoading:y}),[a,n,x,f,l,y]);return r.jsx(C.Provider,{value:b,children:r.jsx("li",{ref:g,className:d.cn("group/step","group-data-[layout=horizontal-below]/stepper:relative group-data-[layout=horizontal-below]/stepper:flex group-data-[layout=horizontal-below]/stepper:flex-1 group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center","group-data-[layout=horizontal-inline]/stepper:flex group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center",!f&&"group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:flex group-data-[layout=vertical]/stepper:flex-col group-data-[layout=vertical]/stepper:items-start",e),"data-disabled":l?"true":void 0,"data-hook":i,"data-loading":y?"true":void 0,"data-slot":"stepper-item","data-state":x,...m})})});D.displayName="StepperItem";const L=s.forwardRef(({asChild:e=!1,className:a,dataHook:t,...o},l)=>{const{setActiveStep:u}=k(),{stepId:i,state:m,isDisabled:g}=z(),p=e?V.Slot:"button";return r.jsx(p,{ref:l,"aria-current":m==="active"?"step":void 0,className:d.cn("group/trigger inline-flex outline-none","group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:gap-2","group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center group-data-[layout=horizontal-inline]/stepper:gap-3","group-data-[layout=vertical]/stepper:flex-row group-data-[layout=vertical]/stepper:items-center group-data-[layout=vertical]/stepper:gap-3","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",!e&&!g&&"cursor-pointer",a),"data-hook":t,"data-slot":"stepper-trigger",...o,...e?{}:{type:"button",disabled:g||o.disabled,onClick:c=>{o.onClick?.(c),c.defaultPrevented||u(i)}}})});L.displayName="StepperTrigger";const $=_.cva(["relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium","transition-colors duration-200 ease-out","after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-200 after:ease-out","group-hover/trigger:after:opacity-100","group-focus-visible/trigger:shadow-default","group-data-[disabled=true]/step:opacity-50"],{variants:{state:{active:"bg-primary text-primary-foreground",completed:"bg-primary text-primary-foreground",inactive:"bg-secondary text-secondary-foreground",error:"bg-destructive text-destructive-foreground"}},defaultVariants:{state:"inactive"}}),P=s.forwardRef(({asChild:e=!1,className:a,children:t,completedLabel:o="Completed",errorLabel:l="Error",loadingLabel:u="Loading",dataHook:i,...m},g)=>{const{state:p,index:c,isLoading:n}=z(),f=r.jsxs(r.Fragment,{children:[p==="completed"&&r.jsx("span",{className:"sr-only",children:o}),p==="error"&&r.jsx("span",{className:"sr-only",children:l}),n&&r.jsx("span",{className:"sr-only",children:u})]});return r.jsx("span",{ref:g,className:d.cn($({state:p}),a),"data-hook":i,"data-slot":"stepper-indicator","data-state":p,...m,children:e?r.jsxs(r.Fragment,{children:[t,f]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:d.cn("transition-opacity duration-200 ease-out",(p==="completed"||p==="error"||n)&&"opacity-0"),children:t??c+1}),p==="completed"&&!n&&r.jsx(w.Check,{className:"absolute",size:16}),p==="error"&&!n&&r.jsx(w.X,{className:"absolute",size:16}),n&&r.jsx(w.LoaderCircle,{className:"absolute animate-spin",size:16}),f]})})});P.displayName="StepperIndicator";const q=s.forwardRef(({className:e,dataHook:a,...t},o)=>{const{isLast:l}=z();return l?null:r.jsx("div",{ref:o,"aria-hidden":"true",className:d.cn("bg-border shrink-0 rounded-full transition-colors duration-200","group-data-[state=completed]/step:bg-primary","group-data-[disabled=true]/step:opacity-50","group-data-[layout=horizontal-below]/stepper:absolute group-data-[layout=horizontal-below]/stepper:top-[15px] group-data-[layout=horizontal-below]/stepper:right-[calc(-50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:left-[calc(50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:h-0.5","group-data-[layout=horizontal-inline]/stepper:mx-2 group-data-[layout=horizontal-inline]/stepper:h-0.5 group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:my-1 group-data-[layout=vertical]/stepper:ms-[15px] group-data-[layout=vertical]/stepper:h-8 group-data-[layout=vertical]/stepper:w-0.5",e),"data-hook":a,"data-slot":"stepper-separator",role:"presentation",...t})});q.displayName="StepperSeparator";const O=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("flex flex-col gap-0.5","group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:text-center","group-data-[layout=horizontal-inline]/stepper:items-start group-data-[layout=horizontal-inline]/stepper:text-left","group-data-[layout=vertical]/stepper:items-start group-data-[layout=vertical]/stepper:text-left",e),"data-slot":"stepper-content",...a}));O.displayName="StepperContent";const E=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-foreground text-sm font-semibold","group-data-[state=inactive]/step:text-muted-foreground","group-data-[disabled=true]/step:text-muted-foreground",e),"data-slot":"stepper-title",...a}));E.displayName="StepperTitle";const M=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-muted-foreground text-xs font-normal",e),"data-slot":"stepper-description",...a}));M.displayName="StepperDescription";exports.Stepper=R;exports.StepperContent=O;exports.StepperDescription=M;exports.StepperIndicator=P;exports.StepperItem=D;exports.StepperNav=T;exports.StepperSeparator=q;exports.StepperTitle=E;exports.StepperTrigger=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),F=require("react"),V=require("@radix-ui/react-slot"),_=require("class-variance-authority"),w=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils");function X(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const s=X(F),I=s.createContext(null);function k(){const e=s.useContext(I);if(!e)throw new Error("Stepper components must be used within <Stepper>");return e}const C=s.createContext(null);function z(){const e=s.useContext(C);if(!e)throw new Error("StepperItem sub-components must be used within <StepperItem>");return e}function $({className:e,dataHook:a,steps:t,value:o,defaultValue:l,onValueChange:u,orientation:i="horizontal",labelPlacement:m="below",ariaLabel:g,trackingEl:p,trackingLabel:c,...n},f){const y=i==="vertical"?"vertical":m==="inline"?"horizontal-inline":"horizontal-below",x=o!==void 0,[b,v]=s.useState(l??t[0]?.id??""),S=x?o:b,N=t.findIndex(h=>h.id===S),j=s.useCallback(h=>{x||v(h),u?.(h)},[x,u]),A=s.useMemo(()=>({activeId:S,activeIndex:N,setActiveStep:j,steps:t,orientation:i}),[S,N,j,t,i]);return r.jsx(I.Provider,{value:A,children:r.jsx("div",{ref:f,"aria-label":g??"Progress",className:d.cn("group/stepper flex data-[orientation=vertical]:flex-col",e),"data-hook":a,"data-layout":y,"data-orientation":i,"data-slot":"stepper","data-tracking-el":p,"data-tracking-label":c,role:"group",...n})})}const R=s.forwardRef($);R.displayName="Stepper";const T=s.forwardRef(({className:e,dataHook:a,...t},o)=>r.jsx("ol",{ref:o,className:d.cn("flex w-full","group-data-[orientation=horizontal]/stepper:flex-row group-data-[orientation=horizontal]/stepper:items-start","group-data-[orientation=vertical]/stepper:flex-col",e),"data-hook":a,"data-slot":"stepper-nav",...t}));T.displayName="StepperNav";const D=s.forwardRef(({className:e,stepId:a,completed:t=!1,error:o=!1,disabled:l=!1,loading:u=!1,dataHook:i,...m},g)=>{const{activeIndex:p,steps:c}=k(),n=c.findIndex(v=>v.id===a);if(n===-1)throw new Error(`StepperItem stepId "${a}" was not found in the Stepper "steps" prop. Each StepperItem's stepId must match a step id.`);const f=n===c.length-1,y=u&&!o&&n===p,x=o?"error":t||n<p?"completed":n===p?"active":"inactive",b=s.useMemo(()=>({stepId:a,index:n,state:x,isLast:f,isDisabled:l,isLoading:y}),[a,n,x,f,l,y]);return r.jsx(C.Provider,{value:b,children:r.jsx("li",{ref:g,className:d.cn("group/step","group-data-[layout=horizontal-below]/stepper:relative group-data-[layout=horizontal-below]/stepper:flex group-data-[layout=horizontal-below]/stepper:flex-1 group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center","group-data-[layout=horizontal-inline]/stepper:flex group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center",!f&&"group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:flex group-data-[layout=vertical]/stepper:flex-col group-data-[layout=vertical]/stepper:items-start",e),"data-disabled":l?"true":void 0,"data-hook":i,"data-loading":y?"true":void 0,"data-slot":"stepper-item","data-state":x,...m})})});D.displayName="StepperItem";const L=s.forwardRef(({asChild:e=!1,className:a,dataHook:t,...o},l)=>{const{setActiveStep:u}=k(),{stepId:i,state:m,isDisabled:g}=z(),p=e?V.Slot:"button";return r.jsx(p,{ref:l,"aria-current":m==="active"?"step":void 0,className:d.cn("group/trigger inline-flex outline-none","group-data-[layout=horizontal-below]/stepper:flex-col group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:gap-2","group-data-[layout=horizontal-inline]/stepper:flex-row group-data-[layout=horizontal-inline]/stepper:items-center group-data-[layout=horizontal-inline]/stepper:gap-3","group-data-[layout=vertical]/stepper:flex-row group-data-[layout=vertical]/stepper:items-center group-data-[layout=vertical]/stepper:gap-3","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",!e&&!g&&"cursor-pointer",a),"data-hook":t,"data-slot":"stepper-trigger",...o,...e?{}:{type:"button",disabled:g||o.disabled,onClick:c=>{o.onClick?.(c),c.defaultPrevented||u(i)}}})});L.displayName="StepperTrigger";const B=_.cva(["relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium","transition-colors duration-200 ease-out","after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-200 after:ease-out","group-hover/trigger:after:opacity-100","group-focus-visible/trigger:shadow-default","group-data-[disabled=true]/step:opacity-50"],{variants:{state:{active:"bg-primary text-primary-foreground",completed:"bg-primary text-primary-foreground",inactive:"bg-secondary text-secondary-foreground",error:"bg-destructive text-destructive-foreground"}},defaultVariants:{state:"inactive"}}),P=s.forwardRef(({asChild:e=!1,className:a,children:t,completedLabel:o="Completed",errorLabel:l="Error",loadingLabel:u="Loading",dataHook:i,...m},g)=>{const{state:p,index:c,isLoading:n}=z(),f=r.jsxs(r.Fragment,{children:[p==="completed"&&r.jsx("span",{className:"sr-only",children:o}),p==="error"&&r.jsx("span",{className:"sr-only",children:l}),n&&r.jsx("span",{className:"sr-only",children:u})]});return r.jsx("span",{ref:g,className:d.cn(B({state:p}),a),"data-hook":i,"data-slot":"stepper-indicator","data-state":p,...m,children:e?r.jsxs(r.Fragment,{children:[t,f]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:d.cn("transition-opacity duration-200 ease-out",(p==="completed"||p==="error"||n)&&"opacity-0"),children:t??c+1}),p==="completed"&&!n&&r.jsx(w.Check,{className:"absolute",size:16}),p==="error"&&!n&&r.jsx(w.X,{className:"absolute",size:16}),n&&r.jsx(w.LoaderCircle,{className:"absolute animate-spin",size:16}),f]})})});P.displayName="StepperIndicator";const q=s.forwardRef(({className:e,dataHook:a,...t},o)=>{const{isLast:l}=z();return l?null:r.jsx("div",{ref:o,"aria-hidden":"true",className:d.cn("bg-border shrink-0 rounded-full transition-colors duration-200","group-data-[state=completed]/step:bg-primary","group-data-[disabled=true]/step:opacity-50","group-data-[layout=horizontal-below]/stepper:absolute group-data-[layout=horizontal-below]/stepper:top-[15px] group-data-[layout=horizontal-below]/stepper:right-[calc(-50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:left-[calc(50%+1.5rem)] group-data-[layout=horizontal-below]/stepper:h-0.5","group-data-[layout=horizontal-inline]/stepper:mx-2 group-data-[layout=horizontal-inline]/stepper:h-0.5 group-data-[layout=horizontal-inline]/stepper:flex-1","group-data-[layout=vertical]/stepper:my-1 group-data-[layout=vertical]/stepper:ms-[15px] group-data-[layout=vertical]/stepper:h-8 group-data-[layout=vertical]/stepper:w-0.5",e),"data-hook":a,"data-slot":"stepper-separator",role:"presentation",...t})});q.displayName="StepperSeparator";const O=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("flex flex-col gap-0.5","group-data-[layout=horizontal-below]/stepper:items-center group-data-[layout=horizontal-below]/stepper:text-center","group-data-[layout=horizontal-inline]/stepper:items-start group-data-[layout=horizontal-inline]/stepper:text-left","group-data-[layout=vertical]/stepper:items-start group-data-[layout=vertical]/stepper:text-left",e),"data-slot":"stepper-content",...a}));O.displayName="StepperContent";const E=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-foreground text-sm font-semibold","group-data-[state=inactive]/step:text-muted-foreground","group-data-[disabled=true]/step:text-muted-foreground",e),"data-slot":"stepper-title",...a}));E.displayName="StepperTitle";const M=s.forwardRef(({className:e,...a},t)=>r.jsx("span",{ref:t,className:d.cn("text-muted-foreground text-xs font-normal",e),"data-slot":"stepper-description",...a}));M.displayName="StepperDescription";exports.Stepper=R;exports.StepperContent=O;exports.StepperDescription=M;exports.StepperIndicator=P;exports.StepperItem=D;exports.StepperNav=T;exports.StepperSeparator=q;exports.StepperTitle=E;exports.StepperTrigger=L;
package/dist/stepper.d.ts CHANGED
@@ -17,26 +17,31 @@ type StepperItemState = "active" | "completed" | "inactive" | "error";
17
17
  /**
18
18
  * A single step descriptor. Consumers may attach any extra fields they need
19
19
  * (e.g. `title`, `href`); only `id` is required for ordering and state.
20
+ * Generic over the step-id type for type-safe `id` values.
21
+ * @typeParam TStepId - The type of step ids, defaults to `string`
20
22
  */
21
- interface StepperStep {
23
+ interface StepperStep<TStepId extends string = string> {
22
24
  /** Stable, unique identifier for the step. */
23
- id: string;
25
+ id: TStepId;
24
26
  [key: string]: unknown;
25
27
  }
26
28
  /**
27
29
  * Props for the Stepper root component.
30
+ * Generic over the step-id type for type-safe `value`, `steps[].id` and
31
+ * `onValueChange`.
32
+ * @typeParam TStepId - The type of step ids, defaults to `string`
28
33
  */
29
- interface StepperProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> {
34
+ interface StepperProps<TStepId extends string = string> extends Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> {
30
35
  /** Data hook for automated testing (required). */
31
36
  dataHook: string;
32
37
  /** Ordered list of steps. Defines step order, total count and id → index resolution. */
33
- steps: StepperStep[];
38
+ steps: StepperStep<TStepId>[];
34
39
  /** Controlled active step id. */
35
- value?: string;
40
+ value?: TStepId;
36
41
  /** Active step id for uncontrolled usage. Defaults to the first step. */
37
- defaultValue?: string;
42
+ defaultValue?: TStepId;
38
43
  /** Called with the new active step id when the active step changes. */
39
- onValueChange?: (id: string) => void;
44
+ onValueChange?: (id: TStepId) => void;
40
45
  /**
41
46
  * Layout orientation.
42
47
  * @default "horizontal"
@@ -57,12 +62,9 @@ interface StepperProps extends Omit<React.ComponentPropsWithoutRef<"div">, "onCh
57
62
  /** Tracking label for analytics context. */
58
63
  trackingLabel?: string;
59
64
  }
60
- /**
61
- * Guides users through a multi-step process, showing progress and the current step.
62
- * Tracks the active step (controlled or uncontrolled) and shares it with its
63
- * sub-components via context.
64
- */
65
- declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLDivElement>>;
65
+ declare const Stepper: (<TStepId extends string = string>(props: StepperProps<TStepId> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null) & {
66
+ displayName?: string;
67
+ };
66
68
  /**
67
69
  * Props for the StepperNav component.
68
70
  */
@@ -1 +1 @@
1
- {"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../src/components/stepper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;GAEG;AACH,KAAK,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAEpD;;;;GAIG;AACH,KAAK,qBAAqB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD;;;GAGG;AACH,KAAK,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAEtE;;;GA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ime";
1
+ import { jsx as r, jsxs as S, Fragment as z } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
3
  import { Slot as D } from "@radix-ui/react-slot";
4
4
  import { cva as P } from "class-variance-authority";
@@ -22,61 +22,60 @@ function N() {
22
22
  );
23
23
  return t;
24
24
  }
25
- const M = o.forwardRef(
26
- ({
27
- className: t,
28
- dataHook: a,
29
- steps: e,
30
- value: p,
31
- defaultValue: i,
32
- onValueChange: c,
33
- orientation: n = "horizontal",
34
- labelPlacement: g = "below",
35
- ariaLabel: f,
36
- trackingEl: l,
37
- trackingLabel: u,
38
- ...s
39
- }, m) => {
40
- const h = n === "vertical" ? "vertical" : g === "inline" ? "horizontal-inline" : "horizontal-below", y = p !== void 0, [b, v] = o.useState(
41
- i ?? e[0]?.id ?? ""
42
- ), w = y ? p : b, I = e.findIndex((x) => x.id === w), k = o.useCallback(
43
- (x) => {
44
- y || v(x), c?.(x);
45
- },
46
- [y, c]
47
- ), E = o.useMemo(
48
- () => ({
49
- activeId: w,
50
- activeIndex: I,
51
- setActiveStep: k,
52
- steps: e,
53
- orientation: n
54
- }),
55
- [w, I, k, e, n]
56
- );
57
- return /* @__PURE__ */ r(C.Provider, { value: E, children: /* @__PURE__ */ r(
58
- "div",
59
- {
60
- ref: m,
61
- "aria-label": f ?? "Progress",
62
- className: d(
63
- "group/stepper flex data-[orientation=vertical]:flex-col",
64
- t
65
- ),
66
- "data-hook": a,
67
- "data-layout": h,
68
- "data-orientation": n,
69
- "data-slot": "stepper",
70
- "data-tracking-el": l,
71
- "data-tracking-label": u,
72
- role: "group",
73
- ...s
74
- }
75
- ) });
76
- }
77
- );
78
- M.displayName = "Stepper";
79
- const V = o.forwardRef(
25
+ function M({
26
+ className: t,
27
+ dataHook: a,
28
+ steps: e,
29
+ value: p,
30
+ defaultValue: i,
31
+ onValueChange: c,
32
+ orientation: n = "horizontal",
33
+ labelPlacement: g = "below",
34
+ ariaLabel: f,
35
+ trackingEl: l,
36
+ trackingLabel: u,
37
+ ...s
38
+ }, m) {
39
+ const h = n === "vertical" ? "vertical" : g === "inline" ? "horizontal-inline" : "horizontal-below", y = p !== void 0, [b, v] = o.useState(
40
+ i ?? e[0]?.id ?? ""
41
+ ), w = y ? p : b, I = e.findIndex((x) => x.id === w), k = o.useCallback(
42
+ (x) => {
43
+ y || v(x), c?.(x);
44
+ },
45
+ [y, c]
46
+ ), E = o.useMemo(
47
+ () => ({
48
+ activeId: w,
49
+ activeIndex: I,
50
+ setActiveStep: k,
51
+ steps: e,
52
+ orientation: n
53
+ }),
54
+ [w, I, k, e, n]
55
+ );
56
+ return /* @__PURE__ */ r(C.Provider, { value: E, children: /* @__PURE__ */ r(
57
+ "div",
58
+ {
59
+ ref: m,
60
+ "aria-label": f ?? "Progress",
61
+ className: d(
62
+ "group/stepper flex data-[orientation=vertical]:flex-col",
63
+ t
64
+ ),
65
+ "data-hook": a,
66
+ "data-layout": h,
67
+ "data-orientation": n,
68
+ "data-slot": "stepper",
69
+ "data-tracking-el": l,
70
+ "data-tracking-label": u,
71
+ role: "group",
72
+ ...s
73
+ }
74
+ ) });
75
+ }
76
+ const V = o.forwardRef(M);
77
+ V.displayName = "Stepper";
78
+ const F = o.forwardRef(
80
79
  ({ className: t, dataHook: a, ...e }, p) => /* @__PURE__ */ r(
81
80
  "ol",
82
81
  {
@@ -95,8 +94,8 @@ const V = o.forwardRef(
95
94
  }
96
95
  )
97
96
  );
98
- V.displayName = "StepperNav";
99
- const F = o.forwardRef(
97
+ F.displayName = "StepperNav";
98
+ const X = o.forwardRef(
100
99
  ({
101
100
  className: t,
102
101
  stepId: a,
@@ -152,8 +151,8 @@ const F = o.forwardRef(
152
151
  ) });
153
152
  }
154
153
  );
155
- F.displayName = "StepperItem";
156
- const X = o.forwardRef(
154
+ X.displayName = "StepperItem";
155
+ const $ = o.forwardRef(
157
156
  ({ asChild: t = !1, className: a, dataHook: e, ...p }, i) => {
158
157
  const { setActiveStep: c } = R(), { stepId: n, state: g, isDisabled: f } = N();
159
158
  return /* @__PURE__ */ r(
@@ -189,8 +188,8 @@ const X = o.forwardRef(
189
188
  );
190
189
  }
191
190
  );
192
- X.displayName = "StepperTrigger";
193
- const $ = P(
191
+ $.displayName = "StepperTrigger";
192
+ const q = P(
194
193
  [
195
194
  "relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",
196
195
  "transition-colors duration-200 ease-out",
@@ -218,7 +217,7 @@ const $ = P(
218
217
  state: "inactive"
219
218
  }
220
219
  }
221
- ), q = o.forwardRef(
220
+ ), B = o.forwardRef(
222
221
  ({
223
222
  asChild: t = !1,
224
223
  className: a,
@@ -229,7 +228,7 @@ const $ = P(
229
228
  dataHook: n,
230
229
  ...g
231
230
  }, f) => {
232
- const { state: l, index: u, isLoading: s } = N(), m = /* @__PURE__ */ z(S, { children: [
231
+ const { state: l, index: u, isLoading: s } = N(), m = /* @__PURE__ */ S(z, { children: [
233
232
  l === "completed" && /* @__PURE__ */ r("span", { className: "sr-only", children: p }),
234
233
  l === "error" && /* @__PURE__ */ r("span", { className: "sr-only", children: i }),
235
234
  s && /* @__PURE__ */ r("span", { className: "sr-only", children: c })
@@ -238,15 +237,15 @@ const $ = P(
238
237
  "span",
239
238
  {
240
239
  ref: f,
241
- className: d($({ state: l }), a),
240
+ className: d(q({ state: l }), a),
242
241
  "data-hook": n,
243
242
  "data-slot": "stepper-indicator",
244
243
  "data-state": l,
245
244
  ...g,
246
- children: t ? /* @__PURE__ */ z(S, { children: [
245
+ children: t ? /* @__PURE__ */ S(z, { children: [
247
246
  e,
248
247
  m
249
- ] }) : /* @__PURE__ */ z(S, { children: [
248
+ ] }) : /* @__PURE__ */ S(z, { children: [
250
249
  /* @__PURE__ */ r(
251
250
  "span",
252
251
  {
@@ -266,8 +265,8 @@ const $ = P(
266
265
  );
267
266
  }
268
267
  );
269
- q.displayName = "StepperIndicator";
270
- const B = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
268
+ B.displayName = "StepperIndicator";
269
+ const G = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
271
270
  const { isLast: i } = N();
272
271
  return i ? null : /* @__PURE__ */ r(
273
272
  "div",
@@ -296,8 +295,8 @@ const B = o.forwardRef(({ className: t, dataHook: a, ...e }, p) => {
296
295
  }
297
296
  );
298
297
  });
299
- B.displayName = "StepperSeparator";
300
- const G = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
298
+ G.displayName = "StepperSeparator";
299
+ const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
301
300
  "span",
302
301
  {
303
302
  ref: e,
@@ -312,8 +311,8 @@ const G = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
312
311
  ...a
313
312
  }
314
313
  ));
315
- G.displayName = "StepperContent";
316
- const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
314
+ H.displayName = "StepperContent";
315
+ const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
317
316
  "span",
318
317
  {
319
318
  ref: e,
@@ -327,8 +326,8 @@ const H = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
327
326
  ...a
328
327
  }
329
328
  ));
330
- H.displayName = "StepperTitle";
331
- const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
329
+ J.displayName = "StepperTitle";
330
+ const K = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
332
331
  "span",
333
332
  {
334
333
  ref: e,
@@ -337,15 +336,15 @@ const J = o.forwardRef(({ className: t, ...a }, e) => /* @__PURE__ */ r(
337
336
  ...a
338
337
  }
339
338
  ));
340
- J.displayName = "StepperDescription";
339
+ K.displayName = "StepperDescription";
341
340
  export {
342
- M as Stepper,
343
- G as StepperContent,
344
- J as StepperDescription,
345
- q as StepperIndicator,
346
- F as StepperItem,
347
- V as StepperNav,
348
- B as StepperSeparator,
349
- H as StepperTitle,
350
- X as StepperTrigger
341
+ V as Stepper,
342
+ H as StepperContent,
343
+ K as StepperDescription,
344
+ B as StepperIndicator,
345
+ X as StepperItem,
346
+ F as StepperNav,
347
+ G as StepperSeparator,
348
+ J as StepperTitle,
349
+ $ as StepperTrigger
351
350
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.17.1",
3
+ "version": "2.19.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -195,8 +195,8 @@
195
195
  "sonner": "^2.0.7",
196
196
  "tailwind-merge": "^3.4.0",
197
197
  "vaul": "^1.1.2",
198
- "@brightlocal/illustrations": "0.5.0",
199
- "@brightlocal/icons": "2.3.1"
198
+ "@brightlocal/icons": "2.3.1",
199
+ "@brightlocal/illustrations": "0.5.0"
200
200
  },
201
201
  "size-limit": [
202
202
  {
@@ -5,6 +5,7 @@ import { motion, AnimatePresence } from "framer-motion";
5
5
  import { X } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
+ import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
8
9
  import { Button, type ButtonProps } from "../components/button";
9
10
  import { Input } from "../components/input";
10
11
  import { Item, ItemContent, ItemTitle, ItemActions } from "../components/list";
@@ -250,6 +251,12 @@ function InputListItems({
250
251
  }: InputListItemsProps) {
251
252
  const { value, removeItem, stableKeys } = useInputListContext();
252
253
 
254
+ // Resolves the reduced-motion preference from the OS, or an override (e.g. the
255
+ // Storybook "Reduce Motion" toolbar) when one is present. When reduced motion
256
+ // is requested, items mount at their final state (`initial={false}`) instead
257
+ // of flashing in.
258
+ const shouldReduceMotion = usePrefersReducedMotion();
259
+
253
260
  if (loading) {
254
261
  return (
255
262
  <ul
@@ -284,7 +291,7 @@ function InputListItems({
284
291
  scale: { duration: 0.12 },
285
292
  },
286
293
  }}
287
- initial={{ opacity: 0, scale: 0.8 }}
294
+ initial={shouldReduceMotion ? false : { opacity: 0, scale: 0.8 }}
288
295
  transition={{
289
296
  opacity: { duration: 0.15 },
290
297
  scale: { duration: 0.15 },