@brightlocal/ui-components 0.2.0 → 0.3.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 (78) hide show
  1. package/dist/alert.cjs +1 -1
  2. package/dist/alert.d.ts +10 -1
  3. package/dist/alert.d.ts.map +1 -1
  4. package/dist/alert.js +6 -2
  5. package/dist/card.cjs +1 -1
  6. package/dist/card.d.ts +6 -2
  7. package/dist/card.d.ts.map +1 -1
  8. package/dist/card.js +89 -73
  9. package/dist/centred-layout.cjs +1 -1
  10. package/dist/centred-layout.d.ts +49 -25
  11. package/dist/centred-layout.d.ts.map +1 -1
  12. package/dist/centred-layout.js +57 -32
  13. package/dist/checkbox.d.ts.map +1 -1
  14. package/dist/chip.cjs +1 -0
  15. package/dist/chip.d.ts +61 -0
  16. package/dist/chip.d.ts.map +1 -0
  17. package/dist/chip.js +165 -0
  18. package/dist/combobox.cjs +1 -1
  19. package/dist/combobox.d.ts.map +1 -1
  20. package/dist/combobox.js +5 -2
  21. package/dist/date-picker.cjs +1 -1
  22. package/dist/date-picker.d.ts +89 -52
  23. package/dist/date-picker.d.ts.map +1 -1
  24. package/dist/date-picker.js +228 -210
  25. package/dist/dropdown-menu.d.ts.map +1 -1
  26. package/dist/header.cjs +1 -0
  27. package/dist/header.d.ts +42 -0
  28. package/dist/header.d.ts.map +1 -0
  29. package/dist/header.js +22 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +426 -396
  34. package/dist/input-chip.cjs +1 -0
  35. package/dist/input-chip.d.ts +117 -0
  36. package/dist/input-chip.d.ts.map +1 -0
  37. package/dist/input-chip.js +284 -0
  38. package/dist/input-group.d.ts.map +1 -1
  39. package/dist/input-otp.cjs +1 -1
  40. package/dist/input-otp.d.ts +43 -36
  41. package/dist/input-otp.d.ts.map +1 -1
  42. package/dist/input-otp.js +140 -119
  43. package/dist/input-password.cjs +1 -1
  44. package/dist/input-password.d.ts +147 -19
  45. package/dist/input-password.d.ts.map +1 -1
  46. package/dist/input-password.js +197 -92
  47. package/dist/input.cjs +1 -1
  48. package/dist/input.js +1 -1
  49. package/dist/progress.cjs +1 -1
  50. package/dist/progress.d.ts +10 -0
  51. package/dist/progress.d.ts.map +1 -1
  52. package/dist/progress.js +45 -36
  53. package/dist/select.d.ts.map +1 -1
  54. package/dist/slider.cjs +1 -1
  55. package/dist/slider.d.ts +31 -3
  56. package/dist/slider.d.ts.map +1 -1
  57. package/dist/slider.js +53 -43
  58. package/dist/textarea.d.ts.map +1 -1
  59. package/package.json +23 -24
  60. package/src/components/alert.tsx +10 -1
  61. package/src/components/card.tsx +66 -38
  62. package/src/components/centred-layout.tsx +115 -38
  63. package/src/components/checkbox.tsx +2 -2
  64. package/src/components/chip.tsx +249 -0
  65. package/src/components/combobox.tsx +17 -13
  66. package/src/components/date-picker.tsx +410 -266
  67. package/src/components/dropdown-menu.tsx +6 -1
  68. package/src/components/header.tsx +69 -0
  69. package/src/components/input-chip.tsx +548 -0
  70. package/src/components/input-group.tsx +4 -1
  71. package/src/components/input-otp.tsx +159 -91
  72. package/src/components/input-password.tsx +469 -129
  73. package/src/components/input.tsx +1 -1
  74. package/src/components/progress.tsx +21 -2
  75. package/src/components/select.tsx +1 -3
  76. package/src/components/slider.tsx +85 -15
  77. package/src/components/textarea.tsx +4 -1
  78. package/src/index.ts +3 -0
@@ -1,101 +1,206 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { EyeOff as E, Eye as R } from "@brightlocal/icons";
4
- import { Progress as T } from "@brightlocal/ui-components/progress";
5
- import { cn as V } from "@brightlocal/ui-components/lib/utils";
6
- import { InputGroup as z, InputGroupInput as C, InputGroupAddon as O, InputGroupButton as $ } from "@brightlocal/ui-components/input-group";
7
- const j = {
8
- meter: { label: "Meter", value: 0, color: "bg-muted" },
9
- weak: { label: "Weak", value: 25, color: "bg-red-500" },
10
- ok: { label: "Ok", value: 50, color: "bg-orange-500" },
1
+ import { jsx as o, jsxs as R } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { EyeOff as T, Eye as H } from "@brightlocal/icons";
4
+ import { Progress as F } from "@brightlocal/ui-components/progress";
5
+ import { cn as P } from "@brightlocal/ui-components/lib/utils";
6
+ import { InputGroup as j, InputGroupInput as M, InputGroupAddon as O, InputGroupButton as L } from "@brightlocal/ui-components/input-group";
7
+ const Z = {
8
+ meter: { label: "Meter", value: 0, color: "bg-green-500" },
9
+ weak: { label: "Weak", value: 25, color: "bg-green-500" },
10
+ ok: { label: "Ok", value: 50, color: "bg-green-500" },
11
11
  good: { label: "Good", value: 75, color: "bg-green-500" },
12
- great: { label: "Great", value: 100, color: "bg-green-600" }
12
+ great: { label: "Great", value: 100, color: "bg-green-500" }
13
13
  };
14
- function W(t) {
15
- if (!t || t.length === 0)
14
+ function _(e) {
15
+ if (!e || e.length === 0)
16
16
  return "meter";
17
- let e = 0;
18
- return t.length >= 8 && (e += 1), t.length >= 12 && (e += 1), /[a-z]/.test(t) && (e += 1), /[A-Z]/.test(t) && (e += 1), /[0-9]/.test(t) && (e += 1), /[^a-zA-Z0-9]/.test(t) && (e += 1), e <= 2 ? "weak" : e <= 3 ? "ok" : e <= 4 ? "good" : "great";
17
+ if (e.length < 12)
18
+ return "weak";
19
+ let t = 0;
20
+ return e.length >= 16 && (t += 1), /[a-z]/.test(e) && (t += 1), /[A-Z]/.test(e) && (t += 1), /[0-9]/.test(e) && (t += 1), /[^a-zA-Z0-9]/.test(e) && (t += 1), t <= 1 ? "ok" : t <= 3 ? "good" : "great";
19
21
  }
20
- const Z = o.forwardRef(
22
+ const V = a.createContext(null);
23
+ function v() {
24
+ const e = a.useContext(V);
25
+ if (!e)
26
+ throw new Error(
27
+ "InputPassword compound components must be used within InputPasswordRoot"
28
+ );
29
+ return e;
30
+ }
31
+ function B({
32
+ children: e,
33
+ dataHook: t,
34
+ trackingEl: n,
35
+ trackingLabel: i,
36
+ disabled: l,
37
+ value: s,
38
+ onChange: r,
39
+ onStrengthChange: c,
40
+ strengthLevels: h,
41
+ calculateStrength: u,
42
+ error: d,
43
+ id: b,
44
+ className: I
45
+ }) {
46
+ const [p, m] = a.useState(!1), [k, w] = a.useState(""), [N, A] = a.useState("meter"), $ = a.useId(), x = b || $, f = s !== void 0 ? s : k, S = h ?? Z, y = u ?? _, C = a.useCallback(
47
+ (g) => {
48
+ s === void 0 && w(g), r?.(g);
49
+ },
50
+ [s, r]
51
+ ), E = a.useCallback(() => {
52
+ m((g) => !g);
53
+ }, []);
54
+ a.useEffect(() => {
55
+ const g = setTimeout(() => {
56
+ const G = y(f);
57
+ A(G), c?.(G);
58
+ }, 180);
59
+ return () => clearTimeout(g);
60
+ }, [f, y, c]);
61
+ const z = a.useMemo(
62
+ () => ({
63
+ showPassword: p,
64
+ setShowPassword: m,
65
+ toggleVisibility: E,
66
+ password: f,
67
+ setPassword: C,
68
+ strength: N,
69
+ strengthLevels: S,
70
+ disabled: l,
71
+ dataHook: t,
72
+ trackingEl: n,
73
+ trackingLabel: i,
74
+ inputId: x,
75
+ error: d
76
+ }),
77
+ [
78
+ p,
79
+ E,
80
+ f,
81
+ C,
82
+ N,
83
+ S,
84
+ l,
85
+ t,
86
+ n,
87
+ i,
88
+ x,
89
+ d
90
+ ]
91
+ );
92
+ return /* @__PURE__ */ o(V.Provider, { value: z, children: /* @__PURE__ */ o("div", { className: P("w-full", I), children: e }) });
93
+ }
94
+ B.displayName = "InputPasswordRoot";
95
+ const D = a.forwardRef(({ className: e, groupClassName: t, onChange: n, ...i }, l) => {
96
+ const {
97
+ showPassword: s,
98
+ toggleVisibility: r,
99
+ password: c,
100
+ setPassword: h,
101
+ disabled: u,
102
+ dataHook: d,
103
+ trackingEl: b,
104
+ trackingLabel: I,
105
+ inputId: p,
106
+ error: m
107
+ } = v();
108
+ return /* @__PURE__ */ R(j, { className: t, dataHook: d, error: m, children: [
109
+ /* @__PURE__ */ o(
110
+ M,
111
+ {
112
+ ref: l,
113
+ className: e,
114
+ disabled: u,
115
+ id: p,
116
+ trackingEl: b,
117
+ trackingLabel: I,
118
+ type: s ? "text" : "password",
119
+ value: c,
120
+ onChange: (w) => {
121
+ h(w.target.value), n?.(w);
122
+ },
123
+ ...i
124
+ }
125
+ ),
126
+ /* @__PURE__ */ o(O, { align: "inline-end", children: /* @__PURE__ */ o(
127
+ L,
128
+ {
129
+ "aria-label": s ? "Hide password" : "Show password",
130
+ "data-hook": `${d}-toggle`,
131
+ disabled: u,
132
+ size: "icon",
133
+ variant: "ghost",
134
+ onClick: r,
135
+ children: s ? /* @__PURE__ */ o(T, { className: "h-4 w-4" }) : /* @__PURE__ */ o(H, { className: "h-4 w-4" })
136
+ }
137
+ ) })
138
+ ] });
139
+ });
140
+ D.displayName = "InputPasswordField";
141
+ const U = a.forwardRef(
21
142
  ({
22
- className: t,
23
- showStrength: e = !0,
24
- onStrengthChange: c,
25
- dataHook: n,
26
- trackingEl: h,
27
- trackingLabel: f,
28
- onChange: p,
29
- value: l,
30
- id: b,
31
- error: w,
32
- ...u
33
- }, v) => {
34
- const [a, I] = o.useState(!1), [S, x] = o.useState("meter"), [N, P] = o.useState(""), G = o.useId(), y = b || G, g = l !== void 0 ? String(l) : N;
35
- o.useEffect(() => {
36
- const s = setTimeout(() => {
37
- const m = W(g);
38
- x(m), c?.(m);
39
- }, 180);
40
- return () => clearTimeout(s);
41
- }, [g, c]);
42
- const k = (s) => {
43
- P(s.target.value), p?.(s);
44
- }, A = () => {
45
- I((s) => !s);
46
- }, d = j[S];
47
- return /* @__PURE__ */ i("div", { className: "w-full", children: [
48
- /* @__PURE__ */ i(z, { className: t, dataHook: n, error: w, children: [
49
- /* @__PURE__ */ r(
50
- C,
51
- {
52
- ref: v,
53
- id: y,
54
- trackingEl: h,
55
- trackingLabel: f,
56
- type: a ? "text" : "password",
57
- value: l,
58
- onChange: k,
59
- ...u
60
- }
61
- ),
62
- /* @__PURE__ */ r(O, { align: "inline-end", children: /* @__PURE__ */ r(
63
- $,
64
- {
65
- "aria-label": a ? "Hide password" : "Show password",
66
- "data-hook": n ? `${n}-toggle` : void 0,
67
- disabled: u.disabled,
68
- size: "icon",
69
- variant: "ghost",
70
- onClick: A,
71
- children: a ? /* @__PURE__ */ r(E, { className: "h-4 w-4" }) : /* @__PURE__ */ r(R, { className: "h-4 w-4" })
72
- }
73
- ) })
74
- ] }),
75
- e && /* @__PURE__ */ r("div", { className: "mt-1 space-y-2", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
76
- /* @__PURE__ */ r(
77
- T,
78
- {
79
- className: V("h-2 flex-1"),
80
- dataHook: n ? `${n}-strength-progress` : "password-strength-progress",
81
- value: d.value
82
- }
83
- ),
84
- /* @__PURE__ */ r(
85
- "span",
86
- {
87
- className: "text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap",
88
- "data-hook": n ? `${n}-strength-label` : void 0,
89
- children: d.label
90
- }
91
- )
92
- ] }) })
93
- ] });
143
+ className: e,
144
+ showLabel: t = "Show password",
145
+ hideLabel: n = "Hide password",
146
+ size: i = "icon",
147
+ variant: l = "ghost",
148
+ ...s
149
+ }, r) => {
150
+ const { showPassword: c, toggleVisibility: h, disabled: u, dataHook: d } = v();
151
+ return /* @__PURE__ */ o(
152
+ L,
153
+ {
154
+ ref: r,
155
+ "aria-label": c ? n : t,
156
+ className: e,
157
+ "data-hook": `${d}-toggle`,
158
+ disabled: u,
159
+ size: i,
160
+ variant: l,
161
+ onClick: h,
162
+ ...s,
163
+ children: c ? /* @__PURE__ */ o(T, { className: "h-4 w-4" }) : /* @__PURE__ */ o(H, { className: "h-4 w-4" })
164
+ }
165
+ );
94
166
  }
95
167
  );
96
- Z.displayName = "InputPassword";
168
+ U.displayName = "InputPasswordToggle";
169
+ function W({
170
+ className: e,
171
+ showLabel: t = !0
172
+ }) {
173
+ const { strength: n, strengthLevels: i, dataHook: l, disabled: s } = v(), r = i[n] ?? {
174
+ label: n,
175
+ value: 0,
176
+ color: "bg-muted"
177
+ };
178
+ return /* @__PURE__ */ o("div", { className: P("mt-1 space-y-2", e), children: /* @__PURE__ */ R("div", { className: P("flex items-center gap-2", s && "opacity-50"), children: [
179
+ /* @__PURE__ */ o(
180
+ F,
181
+ {
182
+ className: "h-2 flex-1",
183
+ dataHook: `${l}-strength-progress`,
184
+ indicatorClassName: r.color,
185
+ value: r.value
186
+ }
187
+ ),
188
+ t && /* @__PURE__ */ o(
189
+ "span",
190
+ {
191
+ className: "text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap",
192
+ "data-hook": `${l}-strength-label`,
193
+ children: r.label
194
+ }
195
+ )
196
+ ] }) });
197
+ }
198
+ W.displayName = "InputPasswordStrength";
97
199
  export {
98
- Z as InputPassword,
99
- j as PASSWORD_STRENGTH,
100
- W as calculatePasswordStrength
200
+ Z as DEFAULT_STRENGTH_LEVELS,
201
+ D as InputPasswordField,
202
+ B as InputPasswordRoot,
203
+ W as InputPasswordStrength,
204
+ U as InputPasswordToggle,
205
+ _ as calculatePasswordStrength
101
206
  };
package/dist/input.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),o=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-all","text-sm font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3 pb-[1px] leading-5","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:d,trackingLabel:c,...i},u)=>{const n=l||i["aria-invalid"]===!0||i["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":n?"true":void 0,className:v.cn(o({hasIcon:r,hasSecondaryIcon:t}),n&&"border-red-600/40 dark:border-red-400/60 focus-visible:border-destructive focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":d,"data-tracking-label":c,...i})});s.displayName="Input";exports.Input=s;exports.inputVariants=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),o=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-all","text-sm font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3 pb-[1px] leading-5","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:d,trackingLabel:c,...i},u)=>{const n=l||i["aria-invalid"]===!0||i["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":n?"true":void 0,className:v.cn(o({hasIcon:r,hasSecondaryIcon:t}),n&&"focus-visible:border-destructive focus-visible:shadow-destructive border-red-600/40 dark:border-red-400/60",e),"data-hook":a,"data-slot":"input","data-tracking-el":d,"data-tracking-label":c,...i})});s.displayName="Input";exports.Input=s;exports.inputVariants=o;
package/dist/input.js CHANGED
@@ -61,7 +61,7 @@ const p = f(
61
61
  "aria-invalid": a ? "true" : void 0,
62
62
  className: b(
63
63
  p({ hasIcon: o, hasSecondaryIcon: i }),
64
- a && "border-red-600/40 dark:border-red-400/60 focus-visible:border-destructive focus-visible:shadow-destructive",
64
+ a && "focus-visible:border-destructive focus-visible:shadow-destructive border-red-600/40 dark:border-red-400/60",
65
65
  r
66
66
  ),
67
67
  "data-hook": t,
package/dist/progress.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),j=require("react"),P=require("@radix-ui/react-progress"),h=require("framer-motion"),v=require("@brightlocal/ui-components/lib/utils");function u(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const c=u(j),d=u(P),f=c.forwardRef(({className:e,value:t,dataHook:r,trackingEl:a,trackingLabel:g,ariaLabel:m="Progress",label:o,...p},b)=>{const i=c.useId(),n=!!o,l=s.jsx(d.Root,{ref:b,"aria-label":n?void 0:m,"aria-labelledby":n?i:void 0,className:v.cn("relative h-2 w-full overflow-hidden rounded-full","bg-primary/20",e),"data-hook":r,"data-slot":"progress","data-tracking-el":a,"data-tracking-label":g,...p,children:s.jsx(d.Indicator,{asChild:!0,children:s.jsx(h.motion.div,{animate:{transform:`translateX(-${100-(t||0)}%)`},className:"h-full w-full flex-1 bg-green-400","data-slot":"progress-indicator",initial:!1,transition:{type:"spring",stiffness:80,damping:20,mass:1}})})});return o?s.jsxs("div",{className:"flex w-full items-center gap-2","data-slot":"progress-wrapper",children:[s.jsx("span",{className:"text-foreground text-sm leading-normal font-medium","data-slot":"progress-label",id:i,children:o}),l]}):l});f.displayName="Progress";exports.Progress=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),v=require("@radix-ui/react-progress"),x=require("framer-motion"),n=require("@brightlocal/ui-components/lib/utils");function g(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=g(h),f=g(v),m=u.forwardRef(({className:e,value:t,dataHook:r,trackingEl:a,trackingLabel:p,ariaLabel:b="Progress",label:o,indicatorClassName:j,disabled:l,...y},P)=>{const c=u.useId(),i=!!o,d=s.jsx(f.Root,{ref:P,"aria-label":i?void 0:b,"aria-labelledby":i?c:void 0,className:n.cn("relative h-2 w-full overflow-hidden rounded-full","bg-primary/20",!i&&l&&"opacity-50",e),"data-hook":r,"data-slot":"progress","data-tracking-el":a,"data-tracking-label":p,...y,children:s.jsx(f.Indicator,{asChild:!0,children:s.jsx(x.motion.div,{animate:{transform:`translateX(-${100-(t||0)}%)`},className:n.cn("h-full w-full flex-1 bg-green-400",j),"data-slot":"progress-indicator",initial:!1,transition:{type:"spring",stiffness:80,damping:20,mass:1}})})});return o?s.jsxs("div",{className:n.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[s.jsx("span",{className:"text-foreground text-sm leading-normal font-medium","data-slot":"progress-label",id:c,children:o}),d]}):d});m.displayName="Progress";exports.Progress=m;
@@ -25,6 +25,16 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
25
25
  * Optional visible label text displayed above the progress bar
26
26
  */
27
27
  label?: string;
28
+ /**
29
+ * Custom class name for the indicator (progress fill)
30
+ * Use this to customize the color, e.g., "bg-red-500"
31
+ */
32
+ indicatorClassName?: string;
33
+ /**
34
+ * Whether the progress is in a disabled state
35
+ * When disabled, the component renders with 50% opacity
36
+ */
37
+ disabled?: boolean;
28
38
  }
29
39
  /**
30
40
  * Progress component for displaying loading states and task completion.
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAK9D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGA2Eb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAK9D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGAoFb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
package/dist/progress.js CHANGED
@@ -1,42 +1,48 @@
1
- import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import * as i from "@radix-ui/react-progress";
4
- import { motion as h } from "framer-motion";
5
- import { cn as b } from "@brightlocal/ui-components/lib/utils";
6
- const v = o.forwardRef(
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import * as n from "@radix-ui/react-progress";
4
+ import { motion as x } from "framer-motion";
5
+ import { cn as e } from "@brightlocal/ui-components/lib/utils";
6
+ const w = l.forwardRef(
7
7
  ({
8
- className: l,
9
- value: n,
10
- dataHook: d,
11
- trackingEl: m,
12
- trackingLabel: f,
13
- ariaLabel: p = "Progress",
8
+ className: d,
9
+ value: m,
10
+ dataHook: f,
11
+ trackingEl: p,
12
+ trackingLabel: c,
13
+ ariaLabel: g = "Progress",
14
14
  label: a,
15
- ...c
16
- }, g) => {
17
- const s = o.useId(), e = !!a, t = /* @__PURE__ */ r(
18
- i.Root,
15
+ indicatorClassName: u,
16
+ disabled: t,
17
+ ...h
18
+ }, b) => {
19
+ const o = l.useId(), s = !!a, i = /* @__PURE__ */ r(
20
+ n.Root,
19
21
  {
20
- ref: g,
21
- "aria-label": e ? void 0 : p,
22
- "aria-labelledby": e ? s : void 0,
23
- className: b(
22
+ ref: b,
23
+ "aria-label": s ? void 0 : g,
24
+ "aria-labelledby": s ? o : void 0,
25
+ className: e(
24
26
  "relative h-2 w-full overflow-hidden rounded-full",
25
27
  "bg-primary/20",
26
- l
28
+ !s && t && "opacity-50",
29
+ d
27
30
  ),
28
- "data-hook": d,
31
+ "data-hook": f,
29
32
  "data-slot": "progress",
30
- "data-tracking-el": m,
31
- "data-tracking-label": f,
32
- ...c,
33
- children: /* @__PURE__ */ r(i.Indicator, { asChild: !0, children: /* @__PURE__ */ r(
34
- h.div,
33
+ "data-tracking-el": p,
34
+ "data-tracking-label": c,
35
+ ...h,
36
+ children: /* @__PURE__ */ r(n.Indicator, { asChild: !0, children: /* @__PURE__ */ r(
37
+ x.div,
35
38
  {
36
39
  animate: {
37
- transform: `translateX(-${100 - (n || 0)}%)`
40
+ transform: `translateX(-${100 - (m || 0)}%)`
38
41
  },
39
- className: "h-full w-full flex-1 bg-green-400",
42
+ className: e(
43
+ "h-full w-full flex-1 bg-green-400",
44
+ u
45
+ ),
40
46
  "data-slot": "progress-indicator",
41
47
  initial: !1,
42
48
  transition: {
@@ -49,10 +55,13 @@ const v = o.forwardRef(
49
55
  ) })
50
56
  }
51
57
  );
52
- return a ? /* @__PURE__ */ u(
58
+ return a ? /* @__PURE__ */ v(
53
59
  "div",
54
60
  {
55
- className: "flex w-full items-center gap-2",
61
+ className: e(
62
+ "flex w-full items-center gap-2",
63
+ t && "opacity-50"
64
+ ),
56
65
  "data-slot": "progress-wrapper",
57
66
  children: [
58
67
  /* @__PURE__ */ r(
@@ -60,17 +69,17 @@ const v = o.forwardRef(
60
69
  {
61
70
  className: "text-foreground text-sm leading-normal font-medium",
62
71
  "data-slot": "progress-label",
63
- id: s,
72
+ id: o,
64
73
  children: a
65
74
  }
66
75
  ),
67
- t
76
+ i
68
77
  ]
69
78
  }
70
- ) : t;
79
+ ) : i;
71
80
  }
72
81
  );
73
- v.displayName = "Progress";
82
+ w.displayName = "Progress";
74
83
  export {
75
- v as Progress
84
+ w as Progress
76
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAW1D,UAAU,WAAY,SAAQ,KAAK,CAAC,cAAc,CAChD,OAAO,eAAe,CAAC,IAAI,CAC5B;IACC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAMD;;;;GAIG;AACH,iBAAS,MAAM,CAAC,EACd,KAAK,EACL,WAAW,EACX,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,WAAW,2CAkEb;kBA1EQ,MAAM;;;AA8Ef;;GAEG;AACH,iBAAS,WAAW,CAClB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAG1D;kBAJQ,WAAW;;;AAQpB;;GAEG;AACH,iBAAS,WAAW,CAClB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAG1D;kBAJQ,WAAW;;;AA+CpB,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3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AAC,2CAa7D;kBAhBQ,oBAAoB;;;AAoB7B;;GAEG;AACH,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,2CAa/D;kBAhBQ,sBAAsB;;;AAoB/B,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,WAAW,GACZ,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/slider.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),w=require("@radix-ui/react-slider"),s=require("@brightlocal/ui-components/lib/utils");function u(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const d=u(p),n=u(w),b=d.forwardRef(({className:t,dataHook:a,defaultValue:e,max:r=100,min:l=0,thumbLabels:f,trackingEl:g,trackingLabel:h,value:i,...m},v)=>{const y=d.useMemo(()=>Array.isArray(i)?i:Array.isArray(e)?e:[l,r],[i,e,l,r]);return o.jsxs(n.Root,{ref:v,className:s.cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),"data-hook":a,"data-slot":"slider","data-tracking-el":g,"data-tracking-label":h,defaultValue:e,max:r,min:l,value:i,...m,children:[o.jsx(n.Track,{className:s.cn("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),"data-slot":"slider-track",children:o.jsx(n.Range,{className:s.cn("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"),"data-slot":"slider-range"})}),Array.from({length:y.length},(j,c)=>o.jsx(n.Thumb,{"aria-label":f?.[c]??"Slider",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50","data-slot":"slider-thumb"},c))]})});b.displayName="Slider";exports.Slider=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),_=require("react"),j=require("@radix-ui/react-slider"),b=require("@brightlocal/ui-components/lib/utils");function g(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return i.default=t,Object.freeze(i)}const h=g(_),f=g(j),A=["Slider"],N=["Minimum value","Maximum value"],m=h.forwardRef(({className:t,dataHook:i,defaultValue:e,max:a=100,min:s=0,mode:o="single",thumbLabels:c,trackingEl:v,trackingLabel:p,value:r,...y},S)=>{const n=h.useMemo(()=>Array.isArray(r)?r.length:Array.isArray(e)?e.length:o==="range"?2:1,[r,e,o]),w=h.useMemo(()=>{if(e!==void 0)return e;if(r===void 0)return o==="range"?[s,a]:[s]},[e,r,o,s,a]),k=d=>{const l=c?.[d];return l||((n>1?N:A)[d]??`Slider thumb ${d+1}`)};return process.env.NODE_ENV==="development"&&(r!==void 0&&e!==void 0&&console.warn('[Slider] Component is being used with both "value" and "defaultValue" props. This is likely a mistake. Use "value" with "onValueChange" for controlled mode, or "defaultValue" for uncontrolled mode, but not both.'),c&&c.length!==n&&console.warn(`[Slider] "thumbLabels" array length (${c.length}) doesn't match the number of thumbs (${n}). For ${o==="range"?"range":"single"} mode, provide ${n} label(s).`)),u.jsxs(f.Root,{ref:S,className:b.cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),"data-hook":i,"data-mode":o,"data-slot":"slider","data-tracking-el":v,"data-tracking-label":p,defaultValue:w,max:a,min:s,value:r,...y,children:[u.jsx(f.Track,{className:b.cn("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),"data-slot":"slider-track",children:u.jsx(f.Range,{className:b.cn("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"),"data-slot":"slider-range"})}),Array.from({length:n},(d,l)=>u.jsx(f.Thumb,{"aria-label":k(l),className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50","data-slot":"slider-thumb"},l))]})});m.displayName="Slider";exports.Slider=m;
package/dist/slider.d.ts CHANGED
@@ -8,10 +8,18 @@ export interface SliderProps extends React.ComponentProps<typeof SliderPrimitive
8
8
  * Data hook for automated testing (required)
9
9
  */
10
10
  dataHook: string;
11
+ /**
12
+ * Slider mode - single value or range (two thumbs).
13
+ * - "single": One thumb, selects a single value (default)
14
+ * - "range": Two thumbs, selects a min/max range
15
+ * @default "single"
16
+ */
17
+ mode?: "single" | "range";
11
18
  /**
12
19
  * Accessible labels for the slider thumb(s).
13
- * For range sliders with multiple thumbs, provide an array of labels.
14
- * @default ["Slider"]
20
+ * - For single mode: provide one label (e.g., ["Volume"])
21
+ * - For range mode: provide two labels (e.g., ["Minimum price", "Maximum price"])
22
+ * @default ["Slider"] for single, ["Minimum value", "Maximum value"] for range
15
23
  */
16
24
  thumbLabels?: string[];
17
25
  /**
@@ -25,8 +33,28 @@ export interface SliderProps extends React.ComponentProps<typeof SliderPrimitive
25
33
  }
26
34
  /**
27
35
  * Slider component for selecting numeric values within a range.
28
- * Supports single value selection and range selection (two thumbs).
36
+ * Supports single value selection (default) and range selection (two thumbs).
29
37
  * Built on Radix UI Slider primitive with full keyboard accessibility.
38
+ *
39
+ * @example Single value slider (controlled)
40
+ * ```tsx
41
+ * <Slider
42
+ * dataHook="volume-slider"
43
+ * value={[50]}
44
+ * onValueChange={(value) => setValue(value)}
45
+ * thumbLabels={["Volume"]}
46
+ * />
47
+ * ```
48
+ *
49
+ * @example Range slider (uncontrolled)
50
+ * ```tsx
51
+ * <Slider
52
+ * dataHook="price-range"
53
+ * mode="range"
54
+ * defaultValue={[20, 80]}
55
+ * thumbLabels={["Minimum price", "Maximum price"]}
56
+ * />
57
+ * ```
30
58
  */
31
59
  declare const Slider: React.ForwardRefExoticComponent<Omit<SliderProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
32
60
  export { Slider };
@@ -1 +1 @@
1
- {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/components/slider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,IAAI,CAC5B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,QAAA,MAAM,MAAM,kGAsEX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/components/slider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,IAAI,CAC5B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,MAAM,kGA6GX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,CAAC"}