@brightlocal/ui-components 0.1.4 → 0.2.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 (55) hide show
  1. package/README.md +2 -1
  2. package/dist/checkbox.cjs +1 -1
  3. package/dist/checkbox.d.ts.map +1 -1
  4. package/dist/checkbox.js +19 -19
  5. package/dist/combobox.cjs +1 -1
  6. package/dist/combobox.d.ts +75 -59
  7. package/dist/combobox.d.ts.map +1 -1
  8. package/dist/combobox.js +241 -191
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +354 -344
  11. package/dist/input-group.cjs +1 -1
  12. package/dist/input-group.d.ts +5 -0
  13. package/dist/input-group.d.ts.map +1 -1
  14. package/dist/input-group.js +47 -39
  15. package/dist/input-otp.cjs +1 -1
  16. package/dist/input-otp.d.ts +6 -0
  17. package/dist/input-otp.d.ts.map +1 -1
  18. package/dist/input-otp.js +79 -76
  19. package/dist/input-password.cjs +1 -1
  20. package/dist/input-password.d.ts +4 -0
  21. package/dist/input-password.d.ts.map +1 -1
  22. package/dist/input-password.js +32 -31
  23. package/dist/input.cjs +1 -1
  24. package/dist/input.d.ts +4 -0
  25. package/dist/input.d.ts.map +1 -1
  26. package/dist/input.js +26 -24
  27. package/dist/logo.cjs +1 -1
  28. package/dist/logo.js +13 -13
  29. package/dist/radio-group.cjs +1 -1
  30. package/dist/radio-group.d.ts +4 -0
  31. package/dist/radio-group.d.ts.map +1 -1
  32. package/dist/radio-group.js +49 -47
  33. package/dist/select.cjs +1 -1
  34. package/dist/select.d.ts +3 -1
  35. package/dist/select.d.ts.map +1 -1
  36. package/dist/select.js +57 -56
  37. package/dist/textarea.cjs +1 -1
  38. package/dist/textarea.d.ts +4 -0
  39. package/dist/textarea.d.ts.map +1 -1
  40. package/dist/textarea.js +19 -18
  41. package/dist/toggle.cjs +1 -1
  42. package/dist/toggle.d.ts.map +1 -1
  43. package/dist/toggle.js +17 -17
  44. package/package.json +1 -1
  45. package/src/components/checkbox.tsx +4 -5
  46. package/src/components/combobox.tsx +482 -294
  47. package/src/components/input-group.tsx +14 -2
  48. package/src/components/input-otp.tsx +16 -1
  49. package/src/components/input-password.tsx +6 -1
  50. package/src/components/input.tsx +11 -3
  51. package/src/components/logo.tsx +1 -1
  52. package/src/components/radio-group.tsx +11 -0
  53. package/src/components/select.tsx +7 -2
  54. package/src/components/textarea.tsx +12 -5
  55. package/src/components/toggle.tsx +13 -15
package/dist/select.js CHANGED
@@ -1,40 +1,40 @@
1
1
  import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import * as u from "react";
2
+ import * as m from "react";
3
3
  import * as r from "@radix-ui/react-select";
4
- import { CheckIcon as k, ChevronDownIcon as h, ChevronUpIcon as C } from "@brightlocal/icons";
4
+ import { CheckIcon as k, ChevronDownIcon as x, ChevronUpIcon as C } from "@brightlocal/icons";
5
5
  import { cva as T } from "class-variance-authority";
6
- import { cn as n } from "@brightlocal/ui-components/lib/utils";
6
+ import { cn as o } from "@brightlocal/ui-components/lib/utils";
7
7
  import { Label as _ } from "@brightlocal/ui-components/label";
8
8
  function j({
9
9
  label: t,
10
10
  description: a,
11
- optional: s,
11
+ optional: n,
12
12
  placeholder: i,
13
- children: o,
14
- "aria-label": d,
15
- ...m
13
+ children: d,
14
+ "aria-label": s,
15
+ ...u
16
16
  }) {
17
- const c = u.useId(), f = `${c}-label`, N = `${c}-description`, g = a, w = t || g, b = {
17
+ const c = m.useId(), f = `${c}-label`, g = `${c}-description`, b = a, w = t || b, v = {
18
18
  placeholder: i,
19
- "aria-required": s ? void 0 : !0,
20
- "aria-label": d
19
+ "aria-required": n ? void 0 : !0,
20
+ "aria-label": s
21
21
  }, I = {
22
- ...b,
22
+ ...v,
23
23
  id: c
24
- }, v = (l, z) => u.isValidElement(l) && l.type === x ? u.cloneElement(
24
+ }, h = (l, z) => m.isValidElement(l) && l.type === S ? m.cloneElement(
25
25
  l,
26
26
  z
27
27
  ) : l;
28
28
  return w ? /* @__PURE__ */ p("div", { className: "flex flex-col gap-2", children: [
29
- t && /* @__PURE__ */ e(_, { htmlFor: c, id: f, optional: s, children: t }),
30
- /* @__PURE__ */ e(r.Root, { "data-slot": "select", ...m, children: u.Children.map(
31
- o,
32
- (l) => v(l, I)
29
+ t && /* @__PURE__ */ e(_, { htmlFor: c, id: f, optional: n, children: t }),
30
+ /* @__PURE__ */ e(r.Root, { "data-slot": "select", ...u, children: m.Children.map(
31
+ d,
32
+ (l) => h(l, I)
33
33
  ) }),
34
- g && /* @__PURE__ */ e("p", { className: "text-muted-foreground text-sm", id: N, children: g })
35
- ] }) : /* @__PURE__ */ e(r.Root, { "data-slot": "select", ...m, children: u.Children.map(
36
- o,
37
- (l) => v(l, b)
34
+ b && /* @__PURE__ */ e("p", { className: "text-muted-foreground text-sm", id: g, children: b })
35
+ ] }) : /* @__PURE__ */ e(r.Root, { "data-slot": "select", ...u, children: m.Children.map(
36
+ d,
37
+ (l) => h(l, v)
38
38
  ) });
39
39
  }
40
40
  j.displayName = "Select";
@@ -72,39 +72,40 @@ const q = T([
72
72
  "[&_svg:not([class*='size-'])]:size-4",
73
73
  "[&_svg:not([class*='text-'])]:text-muted-foreground"
74
74
  ]);
75
- function x({
75
+ function S({
76
76
  className: t,
77
77
  children: a,
78
- placeholder: s,
78
+ placeholder: n,
79
79
  dataHook: i,
80
- ...o
80
+ error: d,
81
+ ...s
81
82
  }) {
82
- const d = o["aria-invalid"] === !0 || o["aria-invalid"] === "true", m = o["aria-required"] === !0 || o["aria-required"] === "true", c = o["aria-label"] || s || "Select an option", f = d ? "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive" : "";
83
+ const u = d || s["aria-invalid"] === !0 || s["aria-invalid"] === "true", c = s["aria-required"] === !0 || s["aria-required"] === "true", f = s["aria-label"] || n || "Select an option", g = u ? "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive" : "";
83
84
  return /* @__PURE__ */ p(
84
85
  r.Trigger,
85
86
  {
86
- ...o,
87
- "aria-invalid": d ? "true" : void 0,
88
- "aria-label": c,
89
- "aria-required": m ? "true" : void 0,
90
- className: n(q(), f, t),
87
+ ...s,
88
+ "aria-invalid": u ? "true" : void 0,
89
+ "aria-label": f,
90
+ "aria-required": c ? "true" : void 0,
91
+ className: o(q(), g, t),
91
92
  "data-hook": i,
92
93
  "data-slot": "select-trigger",
93
94
  children: [
94
95
  a,
95
- /* @__PURE__ */ e(r.Icon, { asChild: !0, children: /* @__PURE__ */ e(h, { className: "text-muted-foreground size-4" }) })
96
+ /* @__PURE__ */ e(r.Icon, { asChild: !0, children: /* @__PURE__ */ e(x, { className: "text-muted-foreground size-4" }) })
96
97
  ]
97
98
  }
98
99
  );
99
100
  }
100
- x.displayName = "SelectTrigger";
101
+ S.displayName = "SelectTrigger";
101
102
  function L({
102
103
  className: t,
103
104
  children: a,
104
- position: s = "popper",
105
+ position: n = "popper",
105
106
  ...i
106
107
  }) {
107
- const o = n(
108
+ const d = o(
108
109
  // Base appearance
109
110
  "relative z-50 overflow-hidden",
110
111
  "min-w-[8rem]",
@@ -121,7 +122,7 @@ function L({
121
122
  "data-[side=left]:slide-in-from-right-2",
122
123
  "data-[side=right]:slide-in-from-left-2",
123
124
  "data-[side=top]:slide-in-from-bottom-2"
124
- ), d = s === "popper" && n(
125
+ ), s = n === "popper" && o(
125
126
  "data-[side=bottom]:translate-y-1",
126
127
  "data-[side=left]:-translate-x-1",
127
128
  "data-[side=right]:translate-x-1",
@@ -130,23 +131,23 @@ function L({
130
131
  return /* @__PURE__ */ e(r.Portal, { children: /* @__PURE__ */ p(
131
132
  r.Content,
132
133
  {
133
- className: n(o, d, t),
134
+ className: o(d, s, t),
134
135
  "data-slot": "select-content",
135
- position: s,
136
+ position: n,
136
137
  ...i,
137
138
  children: [
138
- /* @__PURE__ */ e(S, {}),
139
+ /* @__PURE__ */ e(y, {}),
139
140
  /* @__PURE__ */ e(
140
141
  r.Viewport,
141
142
  {
142
- className: n(
143
+ className: o(
143
144
  "p-1",
144
- s === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
145
+ n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
145
146
  ),
146
147
  children: a
147
148
  }
148
149
  ),
149
- /* @__PURE__ */ e(y, {})
150
+ /* @__PURE__ */ e(N, {})
150
151
  ]
151
152
  }
152
153
  ) });
@@ -159,7 +160,7 @@ function D({
159
160
  return /* @__PURE__ */ e(
160
161
  r.Label,
161
162
  {
162
- className: n(
163
+ className: o(
163
164
  "text-muted-foreground px-2 py-1.5 text-xs font-medium",
164
165
  t
165
166
  ),
@@ -172,9 +173,9 @@ D.displayName = "SelectLabel";
172
173
  function P({
173
174
  className: t,
174
175
  children: a,
175
- ...s
176
+ ...n
176
177
  }) {
177
- const i = n(
178
+ const i = o(
178
179
  // Base layout
179
180
  "relative flex w-full cursor-default select-none items-center gap-2",
180
181
  "rounded py-1.5 pl-2 pr-8",
@@ -194,9 +195,9 @@ function P({
194
195
  return /* @__PURE__ */ p(
195
196
  r.Item,
196
197
  {
197
- className: n(i, t),
198
+ className: o(i, t),
198
199
  "data-slot": "select-item",
199
- ...s,
200
+ ...n,
200
201
  children: [
201
202
  /* @__PURE__ */ e("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ e(r.ItemIndicator, { children: /* @__PURE__ */ e(k, { className: "size-4" }) }) }),
202
203
  /* @__PURE__ */ e(r.ItemText, { children: a })
@@ -212,21 +213,21 @@ function R({
212
213
  return /* @__PURE__ */ e(
213
214
  r.Separator,
214
215
  {
215
- className: n("bg-border pointer-events-none -mx-1 my-1 h-px", t),
216
+ className: o("bg-border pointer-events-none -mx-1 my-1 h-px", t),
216
217
  "data-slot": "select-separator",
217
218
  ...a
218
219
  }
219
220
  );
220
221
  }
221
222
  R.displayName = "SelectSeparator";
222
- function S({
223
+ function y({
223
224
  className: t,
224
225
  ...a
225
226
  }) {
226
227
  return /* @__PURE__ */ e(
227
228
  r.ScrollUpButton,
228
229
  {
229
- className: n(
230
+ className: o(
230
231
  "flex cursor-default items-center justify-center py-1",
231
232
  t
232
233
  ),
@@ -236,34 +237,34 @@ function S({
236
237
  }
237
238
  );
238
239
  }
239
- S.displayName = "SelectScrollUpButton";
240
- function y({
240
+ y.displayName = "SelectScrollUpButton";
241
+ function N({
241
242
  className: t,
242
243
  ...a
243
244
  }) {
244
245
  return /* @__PURE__ */ e(
245
246
  r.ScrollDownButton,
246
247
  {
247
- className: n(
248
+ className: o(
248
249
  "flex cursor-default items-center justify-center py-1",
249
250
  t
250
251
  ),
251
252
  "data-slot": "select-scroll-down-button",
252
253
  ...a,
253
- children: /* @__PURE__ */ e(h, { className: "size-4" })
254
+ children: /* @__PURE__ */ e(x, { className: "size-4" })
254
255
  }
255
256
  );
256
257
  }
257
- y.displayName = "SelectScrollDownButton";
258
+ N.displayName = "SelectScrollDownButton";
258
259
  export {
259
260
  j as Select,
260
261
  L as SelectContent,
261
262
  B as SelectGroup,
262
263
  P as SelectItem,
263
264
  D as SelectLabel,
264
- y as SelectScrollDownButton,
265
- S as SelectScrollUpButton,
265
+ N as SelectScrollDownButton,
266
+ y as SelectScrollUpButton,
266
267
  R as SelectSeparator,
267
- x as SelectTrigger,
268
+ S as SelectTrigger,
268
269
  V as SelectValue
269
270
  };
package/dist/textarea.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),d=require("react"),u=require("class-variance-authority"),l=require("@brightlocal/ui-components/lib/utils");function b(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 f=b(d),g=u.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow]","text-sm leading-normal font-sans","text-foreground","px-3 py-2","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"]),i=f.forwardRef(({className:e,dataHook:r,trackingEl:t,trackingLabel:a,...o},n)=>{const s=o["aria-invalid"]===!0||o["aria-invalid"]==="true";return c.jsx("textarea",{ref:n,className:l.cn(g(),s&&"border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",e),"data-hook":r,"data-slot":"textarea","data-tracking-el":t,"data-tracking-label":a,...o})});i.displayName="Textarea";exports.Textarea=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),u=require("react"),l=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils");function f(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 g=f(u),v=l.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow]","text-sm leading-normal font-sans","text-foreground","px-3 py-2","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"]),n=g.forwardRef(({className:e,dataHook:r,error:t,trackingEl:a,trackingLabel:s,...o},c)=>{const i=t||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return d.jsx("textarea",{ref:c,"aria-invalid":i?"true":void 0,className:b.cn(v(),i&&"border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",e),"data-hook":r,"data-slot":"textarea","data-tracking-el":a,"data-tracking-label":s,...o})});n.displayName="Textarea";exports.Textarea=n;
@@ -8,6 +8,10 @@ interface TextareaProps extends Omit<React.ComponentProps<"textarea">, "dataHook
8
8
  * Optional id attribute for linking with label via htmlFor
9
9
  */
10
10
  id?: string;
11
+ /**
12
+ * Whether the textarea has an error state
13
+ */
14
+ error?: boolean;
11
15
  /**
12
16
  * Optional tracking prop for analytics tracking element identifier
13
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,UAAU,aAAc,SAAQ,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,EAChC,UAAU,GAAG,IAAI,CAClB;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,QAAQ,wGAuBb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyB/B,UAAU,aAAc,SAAQ,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,EAChC,UAAU,GAAG,IAAI,CAClB;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,QAAQ,wGA0Bb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
package/dist/textarea.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import * as n from "react";
3
- import { cva as l } from "class-variance-authority";
4
- import { cn as c } from "@brightlocal/ui-components/lib/utils";
5
- const u = l([
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { cva as c } from "class-variance-authority";
4
+ import { cn as u } from "@brightlocal/ui-components/lib/utils";
5
+ const b = c([
6
6
  // Layout & Size
7
7
  "flex w-full",
8
8
  // Appearance - Explicit background with isolation for contrast calculation
@@ -20,28 +20,29 @@ const u = l([
20
20
  "disabled:cursor-not-allowed disabled:opacity-50",
21
21
  // Pseudo-elements
22
22
  "placeholder:text-muted-foreground"
23
- ]), b = n.forwardRef(
24
- ({ className: e, dataHook: o, trackingEl: a, trackingLabel: t, ...r }, i) => {
25
- const d = r["aria-invalid"] === !0 || r["aria-invalid"] === "true";
26
- return /* @__PURE__ */ s(
23
+ ]), f = l.forwardRef(
24
+ ({ className: a, dataHook: o, error: t, trackingEl: i, trackingLabel: d, ...r }, s) => {
25
+ const e = t || r["aria-invalid"] === !0 || r["aria-invalid"] === "true";
26
+ return /* @__PURE__ */ n(
27
27
  "textarea",
28
28
  {
29
- ref: i,
30
- className: c(
31
- u(),
32
- d && "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",
33
- e
29
+ ref: s,
30
+ "aria-invalid": e ? "true" : void 0,
31
+ className: u(
32
+ b(),
33
+ e && "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",
34
+ a
34
35
  ),
35
36
  "data-hook": o,
36
37
  "data-slot": "textarea",
37
- "data-tracking-el": a,
38
- "data-tracking-label": t,
38
+ "data-tracking-el": i,
39
+ "data-tracking-label": d,
39
40
  ...r
40
41
  }
41
42
  );
42
43
  }
43
44
  );
44
- b.displayName = "Textarea";
45
+ f.displayName = "Textarea";
45
46
  export {
46
- b as Textarea
47
+ f as Textarea
47
48
  };
package/dist/toggle.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),f=require("react"),b=require("@radix-ui/react-toggle"),v=require("class-variance-authority"),m=require("@brightlocal/ui-components/lib/utils");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const p=n(f),h=n(b),i=v.cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=p.forwardRef(({className:e,variant:t,size:a,dataHook:r,trackingEl:s,trackingLabel:c,ariaLabel:l,...d},u)=>g.jsx(h.Root,{ref:u,"aria-label":l,className:m.cn(i({variant:t,size:a,className:e})),"data-hook":r,"data-slot":"toggle","data-tracking-el":s||`toggle-${t}`,"data-tracking-label":c,...d}));o.displayName="Toggle";exports.Toggle=o;exports.toggleVariants=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),f=require("react"),b=require("@radix-ui/react-toggle"),m=require("class-variance-authority"),p=require("@brightlocal/ui-components/lib/utils");function o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const v=o(f),h=o(b),r=m.cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),i=v.forwardRef(({className:e,variant:t,size:a,dataHook:n,trackingEl:s,trackingLabel:c,ariaLabel:l,...u},d)=>g.jsx(h.Root,{ref:d,"aria-label":l,className:p.cn(r({variant:t,size:a,className:e})),"data-hook":n,"data-slot":"toggle","data-tracking-el":s||`toggle-${t}`,"data-tracking-label":c,...u}));i.displayName="Toggle";exports.Toggle=i;exports.toggleVariants=r;
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/components/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EAoBnB,CAAC;AAEF,MAAM,WAAW,WACf,SACE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EACjD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,oGA8BX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/components/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,cAAc;;;8EAoBnB,CAAC;AAEF,MAAM,WAAW,WACf,SACE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,EACjD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,MAAM,oGA4BX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
package/dist/toggle.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import * as g from "react";
3
3
  import * as c from "@radix-ui/react-toggle";
4
- import { cva as u } from "class-variance-authority";
5
- import { cn as m } from "@brightlocal/ui-components/lib/utils";
6
- const f = u(
7
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
4
+ import { cva as m } from "class-variance-authority";
5
+ import { cn as f } from "@brightlocal/ui-components/lib/utils";
6
+ const u = m(
7
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out whitespace-nowrap",
8
8
  {
9
9
  variants: {
10
10
  variant: {
@@ -22,32 +22,32 @@ const f = u(
22
22
  size: "default"
23
23
  }
24
24
  }
25
- ), v = g.forwardRef(
25
+ ), p = g.forwardRef(
26
26
  ({
27
27
  className: t,
28
28
  variant: e,
29
29
  size: a,
30
- dataHook: r,
31
- trackingEl: o,
32
- trackingLabel: i,
33
- ariaLabel: n,
30
+ dataHook: o,
31
+ trackingEl: n,
32
+ trackingLabel: r,
33
+ ariaLabel: i,
34
34
  ...s
35
35
  }, d) => /* @__PURE__ */ l(
36
36
  c.Root,
37
37
  {
38
38
  ref: d,
39
- "aria-label": n,
40
- className: m(f({ variant: e, size: a, className: t })),
41
- "data-hook": r,
39
+ "aria-label": i,
40
+ className: f(u({ variant: e, size: a, className: t })),
41
+ "data-hook": o,
42
42
  "data-slot": "toggle",
43
- "data-tracking-el": o || `toggle-${e}`,
44
- "data-tracking-label": i,
43
+ "data-tracking-el": n || `toggle-${e}`,
44
+ "data-tracking-label": r,
45
45
  ...s
46
46
  }
47
47
  )
48
48
  );
49
- v.displayName = "Toggle";
49
+ p.displayName = "Toggle";
50
50
  export {
51
- v as Toggle,
52
- f as toggleVariants
51
+ p as Toggle,
52
+ u as toggleVariants
53
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -3,7 +3,6 @@ import * as React from "react";
3
3
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
4
4
  import { CheckIcon } from "@brightlocal/icons";
5
5
  import { cva, type VariantProps } from "class-variance-authority";
6
-
7
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
7
 
9
8
  const checkboxVariants = cva(
@@ -23,8 +22,8 @@ const checkboxVariants = cva(
23
22
  variants: {
24
23
  error: {
25
24
  true: [
26
- // Error state - red border with 40% opacity
27
- "border-destructive/40 dark:border-destructive/60",
25
+ // Error state - red-600 border with 40% opacity (light) / red-400 with 60% opacity (dark)
26
+ "border-red-600/40 dark:border-red-400/60",
28
27
  // Error focus state - solid red border with destructive shadow
29
28
  "focus-visible:border-destructive focus-visible:shadow-destructive",
30
29
  ],
@@ -38,8 +37,8 @@ const checkboxVariants = cva(
38
37
 
39
38
  export interface CheckboxProps
40
39
  extends
41
- Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, "disabled">,
42
- VariantProps<typeof checkboxVariants> {
40
+ Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, "disabled">,
41
+ VariantProps<typeof checkboxVariants> {
43
42
  /** Whether the checkbox is disabled */
44
43
  disabled?: boolean;
45
44
  /** Data hook for automated testing (REQUIRED) */