@brightlocal/ui-components 0.5.0 → 1.0.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 (52) hide show
  1. package/dist/alert.d.ts +2 -2
  2. package/dist/blocks/sidebar.d.ts +6 -6
  3. package/dist/button.d.ts +2 -2
  4. package/dist/carousel.d.ts +1 -1
  5. package/dist/combobox.cjs +1 -1
  6. package/dist/combobox.d.ts +11 -7
  7. package/dist/combobox.d.ts.map +1 -1
  8. package/dist/combobox.js +144 -133
  9. package/dist/date-picker.d.ts +2 -2
  10. package/dist/field.cjs +1 -1
  11. package/dist/field.d.ts +11 -4
  12. package/dist/field.d.ts.map +1 -1
  13. package/dist/field.js +113 -80
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.js +253 -255
  16. package/dist/input-group.d.ts +1 -1
  17. package/dist/input-otp.cjs +1 -1
  18. package/dist/input-otp.d.ts +3 -20
  19. package/dist/input-otp.d.ts.map +1 -1
  20. package/dist/input-otp.js +91 -132
  21. package/dist/input-password.d.ts +1 -1
  22. package/dist/label.d.ts +2 -3
  23. package/dist/label.d.ts.map +1 -1
  24. package/dist/radio-group.cjs +1 -1
  25. package/dist/radio-group.d.ts +3 -19
  26. package/dist/radio-group.d.ts.map +1 -1
  27. package/dist/radio-group.js +92 -120
  28. package/dist/resizable.d.ts +1 -1
  29. package/dist/select.cjs +1 -1
  30. package/dist/select.d.ts.map +1 -1
  31. package/dist/select.js +19 -19
  32. package/dist/switch.cjs +1 -1
  33. package/dist/switch.d.ts +1 -21
  34. package/dist/switch.d.ts.map +1 -1
  35. package/dist/switch.js +31 -100
  36. package/package.json +2 -2
  37. package/src/components/combobox.tsx +22 -2
  38. package/src/components/field.tsx +47 -7
  39. package/src/components/input-otp.tsx +9 -89
  40. package/src/components/label.tsx +2 -2
  41. package/src/components/radio-group.tsx +65 -129
  42. package/src/components/select.tsx +3 -2
  43. package/src/components/switch.tsx +29 -140
  44. package/dist/link.figma.d.ts +0 -2
  45. package/dist/link.figma.d.ts.map +0 -1
  46. package/dist/switch.figma.d.ts +0 -2
  47. package/dist/switch.figma.d.ts.map +0 -1
  48. package/dist/toggle.figma.d.ts +0 -2
  49. package/dist/toggle.figma.d.ts.map +0 -1
  50. package/src/components/link.figma.tsx +0 -71
  51. package/src/components/switch.figma.tsx +0 -111
  52. package/src/components/toggle.figma.tsx +0 -75
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("react"),l=require("input-otp"),N=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),v=require("@brightlocal/ui-components/label");function w(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const i=w(_),T=i.createContext(null);function R(){const t=i.useContext(T);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const P=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:r,containerClassName:o,error:a,disabled:c,children:s,...u},f)=>{const O=i.useMemo(()=>({error:a,disabled:c}),[a,c]);return e.jsx(T.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:f,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",o),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":r,disabled:c,...u,children:s})})});P.displayName="InputOTP";function m({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...r}){const{error:o}=R(),a=i.useContext(l.OTPInputContext),{char:c,hasFakeCaret:s,isActive:u}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-sm font-normal transition-[border-color,box-shadow] outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",o&&"border-destructive",o&&u&&"shadow-destructive","dark:bg-input/30",n),"data-active":u,"data-error":o,"data-slot":"input-otp-slot",...r,children:[c,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function I({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(N.Minus,{})})}function j({dataHook:t,className:n,...r}){return e.jsx(v.Label,{className:x.cn("mb-2",n),"data-hook":t,"data-slot":"input-otp-label",...r})}const p=i.forwardRef(({label:t,id:n,dataHook:r,"aria-label":o,children:a,...c},s)=>{const u=i.useId(),f=n||u,O=o||(t?void 0:"One-time password");return e.jsxs("div",{className:"w-fit","data-slot":"input-otp-field",children:[t&&e.jsx(j,{dataHook:r?`${r}-label`:void 0,htmlFor:f,children:t}),e.jsx(P,{ref:s,"aria-label":O,dataHook:r,id:t?f:void 0,...c,children:a})]})});p.displayName="InputOTPField";const b=i.forwardRef(({maxLength:t=6,...n},r)=>e.jsx(p,{ref:r,inputMode:"numeric",maxLength:t,pasteTransformer:o=>o.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(m,{children:Array.from({length:t},(o,a)=>e.jsx(d,{index:a},a))})}));b.displayName="InputOTPDigitsOnly";const g=i.forwardRef(({maxLength:t=4,...n},r)=>e.jsx(p,{ref:r,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(o,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));g.displayName="InputOTPWithSpacing";const S=i.forwardRef(({maxLength:t=6,...n},r)=>{const o=Math.ceil(t/2),a=t-o;return e.jsxs(p,{ref:r,maxLength:t,...n,children:[e.jsx(m,{children:Array.from({length:o},(c,s)=>e.jsx(d,{index:s},s))}),e.jsx(I,{}),e.jsx(m,{children:Array.from({length:a},(c,s)=>e.jsx(d,{index:s+o},s+o))})]})});S.displayName="InputOTPSimple";const y=i.forwardRef(({maxLength:t=6,...n},r)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:r,maxLength:t,...n,children:Array.from({length:a},(c,s)=>{const u=s*2,O=Math.min(u+2,t)-u;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(I,{}),e.jsx(m,{children:Array.from({length:O},(G,h)=>e.jsx(d,{index:u+h},u+h))})]},s)})})});y.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=P;exports.InputOTPDigitsOnly=b;exports.InputOTPField=p;exports.InputOTPGroup=m;exports.InputOTPLabel=j;exports.InputOTPSeparator=I;exports.InputOTPSimple=S;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=y;exports.InputOTPWithSpacing=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("react"),l=require("input-otp"),_=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function y(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=y(S),g=i.createContext(null);function N(){const t=i.useContext(g);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const p=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:o,containerClassName:r,error:a,disabled:c,children:s,...u},P)=>{const O=i.useMemo(()=>({error:a,disabled:c}),[a,c]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:P,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",r),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":o,disabled:c,...u,children:s})})});p.displayName="InputOTP";function f({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...o}){const{error:r}=N(),a=i.useContext(l.OTPInputContext),{char:c,hasFakeCaret:s,isActive:u}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-sm font-normal transition-[border-color,box-shadow] outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",r&&"border-destructive",r&&u&&"shadow-destructive","dark:bg-input/30",n),"data-active":u,"data-error":r,"data-slot":"input-otp-slot",...o,children:[c,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function m({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(_.Minus,{})})}const h=i.forwardRef(({maxLength:t=6,...n},o)=>e.jsx(p,{ref:o,inputMode:"numeric",maxLength:t,pasteTransformer:r=>r.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(f,{children:Array.from({length:t},(r,a)=>e.jsx(d,{index:a},a))})}));h.displayName="InputOTPDigitsOnly";const T=i.forwardRef(({maxLength:t=4,...n},o)=>e.jsx(p,{ref:o,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(r,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));T.displayName="InputOTPWithSpacing";const j=i.forwardRef(({maxLength:t=6,...n},o)=>{const r=Math.ceil(t/2),a=t-r;return e.jsxs(p,{ref:o,maxLength:t,...n,children:[e.jsx(f,{children:Array.from({length:r},(c,s)=>e.jsx(d,{index:s},s))}),e.jsx(m,{}),e.jsx(f,{children:Array.from({length:a},(c,s)=>e.jsx(d,{index:s+r},s+r))})]})});j.displayName="InputOTPSimple";const b=i.forwardRef(({maxLength:t=6,...n},o)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:o,maxLength:t,...n,children:Array.from({length:a},(c,s)=>{const u=s*2,O=Math.min(u+2,t)-u;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(m,{}),e.jsx(f,{children:Array.from({length:O},(v,I)=>e.jsx(d,{index:u+I},u+I))})]},s)})})});b.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=p;exports.InputOTPDigitsOnly=h;exports.InputOTPGroup=f;exports.InputOTPSeparator=m;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
@@ -1,5 +1,4 @@
1
1
  import { OTPInput, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';
2
- import { Label } from '../label';
3
2
  import * as React from "react";
4
3
  interface InputOTPProps extends Omit<React.ComponentProps<typeof OTPInput>, "render"> {
5
4
  /** Custom class for the container element */
@@ -25,23 +24,7 @@ interface InputOTPSlotProps extends React.ComponentProps<"div"> {
25
24
  declare function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps): import("react/jsx-runtime").JSX.Element;
26
25
  type InputOTPSeparatorProps = React.ComponentProps<"div">;
27
26
  declare function InputOTPSeparator({ ...props }: InputOTPSeparatorProps): import("react/jsx-runtime").JSX.Element;
28
- interface InputOTPLabelProps extends React.ComponentProps<typeof Label> {
29
- /** Data hook for automated testing */
30
- dataHook?: string;
31
- }
32
- declare function InputOTPLabel({ dataHook, className, ...props }: InputOTPLabelProps): import("react/jsx-runtime").JSX.Element;
33
- interface InputOTPFieldProps extends Omit<InputOTPProps, "children"> {
34
- /** Label text */
35
- label?: string;
36
- /** Custom ID for the input */
37
- id?: string;
38
- /** Accessible label when no visible label is provided */
39
- "aria-label"?: string;
40
- /** Children components */
41
- children: React.ReactNode;
42
- }
43
- declare const InputOTPField: React.ForwardRefExoticComponent<Omit<InputOTPFieldProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
44
- interface InputOTPVariantProps extends Omit<InputOTPFieldProps, "children" | "maxLength"> {
27
+ interface InputOTPVariantProps extends Omit<InputOTPProps, "children" | "maxLength"> {
45
28
  /** Number of OTP digits */
46
29
  maxLength?: number;
47
30
  }
@@ -53,6 +36,6 @@ declare const InputOTPWithSpacing: React.ForwardRefExoticComponent<Omit<InputOTP
53
36
  declare const InputOTPSimple: React.ForwardRefExoticComponent<Omit<InputOTPVariantProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
54
37
  /** OTP input with separators between each pair of digits */
55
38
  declare const InputOTPWithSeparator: React.ForwardRefExoticComponent<Omit<InputOTPVariantProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
56
- export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, InputOTPLabel, InputOTPField, InputOTPDigitsOnly, InputOTPWithSpacing, InputOTPSimple, InputOTPWithSeparator, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS, };
57
- export type { InputOTPProps, InputOTPGroupProps, InputOTPSlotProps, InputOTPSeparatorProps, InputOTPLabelProps, InputOTPFieldProps, InputOTPVariantProps, };
39
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, InputOTPDigitsOnly, InputOTPWithSpacing, InputOTPSimple, InputOTPWithSeparator, REGEXP_ONLY_DIGITS, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS_AND_CHARS, };
40
+ export type { InputOTPProps, InputOTPGroupProps, InputOTPSlotProps, InputOTPSeparatorProps, InputOTPVariantProps, };
58
41
  //# sourceMappingURL=input-otp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../src/components/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAGR,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,WAAW,CAAC;AAInB,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAyBzD,UAAU,aAAc,SAAQ,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EACrC,QAAQ,CACT;IACC,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0BAA0B;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,QAAQ,qGAyCb,CAAC;AAQF,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEtD,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAQjE;AAM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IAC7D,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAsCtE;AAMD,KAAK,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE1D,iBAAS,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CAM9D;AAMD,UAAU,oBAAqB,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,WAAW,CAAC;IAClF,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8CAA8C;AAC9C,QAAA,MAAM,kBAAkB,4GAsBtB,CAAC;AAIH,2CAA2C;AAC3C,QAAA,MAAM,mBAAmB,4GAoBvB,CAAC;AAIH,gDAAgD;AAChD,QAAA,MAAM,cAAc,4GAwBnB,CAAC;AAIF,4DAA4D;AAC5D,QAAA,MAAM,qBAAqB,4GA2BzB,CAAC;AAQH,OAAO,EAEL,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EAErB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,GAC7B,CAAC;AAEF,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,CAAC"}
package/dist/input-otp.js CHANGED
@@ -1,72 +1,71 @@
1
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as f } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { OTPInput as v, REGEXP_ONLY_DIGITS as b, OTPInputContext as x } from "input-otp";
4
- import { REGEXP_ONLY_CHARS as W, REGEXP_ONLY_DIGITS as X, REGEXP_ONLY_DIGITS_AND_CHARS as Y } from "input-otp";
3
+ import { OTPInput as T, REGEXP_ONLY_DIGITS as x, OTPInputContext as v } from "input-otp";
4
+ import { REGEXP_ONLY_CHARS as M, REGEXP_ONLY_DIGITS as z, REGEXP_ONLY_DIGITS_AND_CHARS as j } from "input-otp";
5
5
  import { Minus as N } from "@brightlocal/icons";
6
- import { cn as I } from "@brightlocal/ui-components/lib/utils";
7
- import { Label as w } from "@brightlocal/ui-components/label";
8
- const P = s.createContext(null);
9
- function y() {
10
- const t = s.useContext(P);
6
+ import { cn as h } from "@brightlocal/ui-components/lib/utils";
7
+ const g = s.createContext(null);
8
+ function b() {
9
+ const t = s.useContext(g);
11
10
  if (!t)
12
11
  throw new Error("InputOTP components must be used within an <InputOTP>");
13
12
  return t;
14
13
  }
15
- const T = s.forwardRef(
14
+ const l = s.forwardRef(
16
15
  ({
17
16
  dataHook: t,
18
- trackingEl: r,
19
- trackingLabel: n,
20
- containerClassName: o,
21
- error: a,
17
+ trackingEl: o,
18
+ trackingLabel: i,
19
+ containerClassName: r,
20
+ error: n,
22
21
  disabled: u,
23
- children: i,
22
+ children: a,
24
23
  ...d
25
- }, l) => {
26
- const c = s.useMemo(
27
- () => ({ error: a, disabled: u }),
28
- [a, u]
24
+ }, I) => {
25
+ const m = s.useMemo(
26
+ () => ({ error: n, disabled: u }),
27
+ [n, u]
29
28
  );
30
- return /* @__PURE__ */ e(P.Provider, { value: c, children: /* @__PURE__ */ e(
31
- v,
29
+ return /* @__PURE__ */ e(g.Provider, { value: m, children: /* @__PURE__ */ e(
30
+ T,
32
31
  {
33
- ref: l,
34
- "aria-invalid": a ? "true" : void 0,
32
+ ref: I,
33
+ "aria-invalid": n ? "true" : void 0,
35
34
  className: "disabled:cursor-not-allowed",
36
- containerClassName: I(
35
+ containerClassName: h(
37
36
  "group flex items-center gap-2 has-disabled:opacity-50 w-fit",
38
- o
37
+ r
39
38
  ),
40
39
  "data-hook": t,
41
40
  "data-slot": "input-otp",
42
- "data-tracking-el": r,
43
- "data-tracking-label": n,
41
+ "data-tracking-el": o,
42
+ "data-tracking-label": i,
44
43
  disabled: u,
45
44
  ...d,
46
- children: i
45
+ children: a
47
46
  }
48
47
  ) });
49
48
  }
50
49
  );
51
- T.displayName = "InputOTP";
52
- function f({ className: t, ...r }) {
50
+ l.displayName = "InputOTP";
51
+ function p({ className: t, ...o }) {
53
52
  return /* @__PURE__ */ e(
54
53
  "div",
55
54
  {
56
- className: I("flex items-center rounded-md shadow-xs", t),
55
+ className: h("flex items-center rounded-md shadow-xs", t),
57
56
  "data-slot": "input-otp-group",
58
- ...r
57
+ ...o
59
58
  }
60
59
  );
61
60
  }
62
- function p({ index: t, className: r, ...n }) {
63
- const { error: o } = y(), a = s.useContext(
64
- x
65
- ), { char: u, hasFakeCaret: i, isActive: d } = a?.slots[t] ?? {};
66
- return /* @__PURE__ */ h(
61
+ function c({ index: t, className: o, ...i }) {
62
+ const { error: r } = b(), n = s.useContext(
63
+ v
64
+ ), { char: u, hasFakeCaret: a, isActive: d } = n?.slots[t] ?? {};
65
+ return /* @__PURE__ */ f(
67
66
  "div",
68
67
  {
69
- className: I(
68
+ className: h(
70
69
  // Base styles
71
70
  "relative flex h-9 w-9 items-center justify-center",
72
71
  "border-input bg-background border-y border-r",
@@ -76,135 +75,95 @@ function p({ index: t, className: r, ...n }) {
76
75
  "data-[active=true]:border-ring data-[active=true]:z-10",
77
76
  "data-[active=true]:shadow-default",
78
77
  // Error state
79
- o && "border-destructive",
80
- o && d && "shadow-destructive",
78
+ r && "border-destructive",
79
+ r && d && "shadow-destructive",
81
80
  // Dark mode
82
81
  "dark:bg-input/30",
83
- r
82
+ o
84
83
  ),
85
84
  "data-active": d,
86
- "data-error": o,
85
+ "data-error": r,
87
86
  "data-slot": "input-otp-slot",
88
- ...n,
87
+ ...i,
89
88
  children: [
90
89
  u,
91
- i && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
90
+ a && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
92
91
  ]
93
92
  }
94
93
  );
95
94
  }
96
- function g({ ...t }) {
95
+ function P({ ...t }) {
97
96
  return /* @__PURE__ */ e("div", { "data-slot": "input-otp-separator", role: "separator", ...t, children: /* @__PURE__ */ e(N, {}) });
98
97
  }
99
- function S({ dataHook: t, className: r, ...n }) {
100
- return /* @__PURE__ */ e(
101
- w,
102
- {
103
- className: I("mb-2", r),
104
- "data-hook": t,
105
- "data-slot": "input-otp-label",
106
- ...n
107
- }
108
- );
109
- }
110
- const m = s.forwardRef(
111
- ({ label: t, id: r, dataHook: n, "aria-label": o, children: a, ...u }, i) => {
112
- const d = s.useId(), l = r || d, c = o || (t ? void 0 : "One-time password");
113
- return /* @__PURE__ */ h("div", { className: "w-fit", "data-slot": "input-otp-field", children: [
114
- t && /* @__PURE__ */ e(
115
- S,
116
- {
117
- dataHook: n ? `${n}-label` : void 0,
118
- htmlFor: l,
119
- children: t
120
- }
121
- ),
122
- /* @__PURE__ */ e(
123
- T,
124
- {
125
- ref: i,
126
- "aria-label": c,
127
- dataHook: n,
128
- id: t ? l : void 0,
129
- ...u,
130
- children: a
131
- }
132
- )
133
- ] });
134
- }
135
- );
136
- m.displayName = "InputOTPField";
137
- const _ = s.forwardRef(({ maxLength: t = 6, ...r }, n) => /* @__PURE__ */ e(
138
- m,
98
+ const w = s.forwardRef(({ maxLength: t = 6, ...o }, i) => /* @__PURE__ */ e(
99
+ l,
139
100
  {
140
- ref: n,
101
+ ref: i,
141
102
  inputMode: "numeric",
142
103
  maxLength: t,
143
- pasteTransformer: (o) => o.replace(/\D+/g, "").slice(0, t),
144
- pattern: b,
145
- ...r,
146
- children: /* @__PURE__ */ e(f, { children: Array.from({ length: t }, (o, a) => /* @__PURE__ */ e(p, { index: a }, a)) })
104
+ pasteTransformer: (r) => r.replace(/\D+/g, "").slice(0, t),
105
+ pattern: x,
106
+ ...o,
107
+ children: /* @__PURE__ */ e(p, { children: Array.from({ length: t }, (r, n) => /* @__PURE__ */ e(c, { index: n }, n)) })
147
108
  }
148
109
  ));
149
- _.displayName = "InputOTPDigitsOnly";
150
- const R = s.forwardRef(({ maxLength: t = 4, ...r }, n) => /* @__PURE__ */ e(
151
- m,
110
+ w.displayName = "InputOTPDigitsOnly";
111
+ const y = s.forwardRef(({ maxLength: t = 4, ...o }, i) => /* @__PURE__ */ e(
112
+ l,
152
113
  {
153
- ref: n,
114
+ ref: i,
154
115
  containerClassName: "gap-2",
155
116
  maxLength: t,
156
- ...r,
157
- children: Array.from({ length: t }, (o, a) => /* @__PURE__ */ e(
158
- p,
117
+ ...o,
118
+ children: Array.from({ length: t }, (r, n) => /* @__PURE__ */ e(
119
+ c,
159
120
  {
160
121
  className: "rounded-md border-l shadow-xs",
161
- index: a
122
+ index: n
162
123
  },
163
- a
124
+ n
164
125
  ))
165
126
  }
166
127
  ));
167
- R.displayName = "InputOTPWithSpacing";
168
- const C = s.forwardRef(
169
- ({ maxLength: t = 6, ...r }, n) => {
170
- const o = Math.ceil(t / 2), a = t - o;
171
- return /* @__PURE__ */ h(m, { ref: n, maxLength: t, ...r, children: [
172
- /* @__PURE__ */ e(f, { children: Array.from({ length: o }, (u, i) => /* @__PURE__ */ e(p, { index: i }, i)) }),
173
- /* @__PURE__ */ e(g, {}),
174
- /* @__PURE__ */ e(f, { children: Array.from({ length: a }, (u, i) => /* @__PURE__ */ e(
175
- p,
128
+ y.displayName = "InputOTPWithSpacing";
129
+ const S = s.forwardRef(
130
+ ({ maxLength: t = 6, ...o }, i) => {
131
+ const r = Math.ceil(t / 2), n = t - r;
132
+ return /* @__PURE__ */ f(l, { ref: i, maxLength: t, ...o, children: [
133
+ /* @__PURE__ */ e(p, { children: Array.from({ length: r }, (u, a) => /* @__PURE__ */ e(c, { index: a }, a)) }),
134
+ /* @__PURE__ */ e(P, {}),
135
+ /* @__PURE__ */ e(p, { children: Array.from({ length: n }, (u, a) => /* @__PURE__ */ e(
136
+ c,
176
137
  {
177
- index: i + o
138
+ index: a + r
178
139
  },
179
- i + o
140
+ a + r
180
141
  )) })
181
142
  ] });
182
143
  }
183
144
  );
184
- C.displayName = "InputOTPSimple";
185
- const A = s.forwardRef(({ maxLength: t = 6, ...r }, n) => {
186
- const a = Math.ceil(t / 2);
187
- return /* @__PURE__ */ e(m, { ref: n, maxLength: t, ...r, children: Array.from({ length: a }, (u, i) => {
188
- const d = i * 2, c = Math.min(d + 2, t) - d;
189
- return /* @__PURE__ */ h(s.Fragment, { children: [
190
- i > 0 && /* @__PURE__ */ e(g, {}),
191
- /* @__PURE__ */ e(f, { children: Array.from({ length: c }, (G, O) => /* @__PURE__ */ e(p, { index: d + O }, d + O)) })
192
- ] }, i);
145
+ S.displayName = "InputOTPSimple";
146
+ const _ = s.forwardRef(({ maxLength: t = 6, ...o }, i) => {
147
+ const n = Math.ceil(t / 2);
148
+ return /* @__PURE__ */ e(l, { ref: i, maxLength: t, ...o, children: Array.from({ length: n }, (u, a) => {
149
+ const d = a * 2, m = Math.min(d + 2, t) - d;
150
+ return /* @__PURE__ */ f(s.Fragment, { children: [
151
+ a > 0 && /* @__PURE__ */ e(P, {}),
152
+ /* @__PURE__ */ e(p, { children: Array.from({ length: m }, (C, O) => /* @__PURE__ */ e(c, { index: d + O }, d + O)) })
153
+ ] }, a);
193
154
  }) });
194
155
  });
195
- A.displayName = "InputOTPWithSeparator";
156
+ _.displayName = "InputOTPWithSeparator";
196
157
  export {
197
- T as InputOTP,
198
- _ as InputOTPDigitsOnly,
199
- m as InputOTPField,
200
- f as InputOTPGroup,
201
- S as InputOTPLabel,
202
- g as InputOTPSeparator,
203
- C as InputOTPSimple,
204
- p as InputOTPSlot,
205
- A as InputOTPWithSeparator,
206
- R as InputOTPWithSpacing,
207
- W as REGEXP_ONLY_CHARS,
208
- X as REGEXP_ONLY_DIGITS,
209
- Y as REGEXP_ONLY_DIGITS_AND_CHARS
158
+ l as InputOTP,
159
+ w as InputOTPDigitsOnly,
160
+ p as InputOTPGroup,
161
+ P as InputOTPSeparator,
162
+ S as InputOTPSimple,
163
+ c as InputOTPSlot,
164
+ _ as InputOTPWithSeparator,
165
+ y as InputOTPWithSpacing,
166
+ M as REGEXP_ONLY_CHARS,
167
+ z as REGEXP_ONLY_DIGITS,
168
+ j as REGEXP_ONLY_DIGITS_AND_CHARS
210
169
  };
@@ -1,4 +1,4 @@
1
- import { InputGroupInput, InputGroupButton } from '../input-group';
1
+ import { InputGroupInput, InputGroupButton } from '@brightlocal/ui-components/input-group';
2
2
  import * as React from "react";
3
3
  /**
4
4
  * Default password strength levels (industry standard)
package/dist/label.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as React from "react";
2
- import * as LabelPrimitive from "@radix-ui/react-label";
3
2
  declare const labelVariants: (props?: ({
4
3
  optional?: boolean | null | undefined;
5
4
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
- interface LabelProps extends React.ComponentProps<typeof LabelPrimitive.Root> {
5
+ interface LabelProps extends React.ComponentPropsWithoutRef<"label"> {
7
6
  /**
8
7
  * Data hook for automated testing
9
8
  * Used to identify component in tests and E2E automation
@@ -25,7 +24,7 @@ interface LabelProps extends React.ComponentProps<typeof LabelPrimitive.Root> {
25
24
  */
26
25
  optional?: boolean;
27
26
  }
28
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelProps, "ref"> & React.RefAttributes<HTMLLabelElement>>;
27
+ declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
29
28
  export { Label, labelVariants };
30
29
  export type { LabelProps };
31
30
  //# sourceMappingURL=label.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAIxD,QAAA,MAAM,aAAa;;8EAUlB,CAAC;AAEF,UAAU,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC;IAC3E;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,KAAK,kGAkCV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAEhC,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,aAAa;;8EAUlB,CAAC;AAEF,UAAU,UAAW,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,KAAK,qFAkCV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAEhC,YAAY,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),y=require("@radix-ui/react-radio-group"),w=require("@brightlocal/icons"),u=require("class-variance-authority"),p=require("@brightlocal/ui-components/lib/utils"),j=require("@brightlocal/ui-components/label");function m(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>r[a]})}}return t.default=r,Object.freeze(t)}const l=m(k),s=m(y),I=u.cva("grid",{variants:{variant:{default:["gap-3"],box:["gap-2"],boxIconVertical:["grid-flow-col auto-cols-fr gap-3"],boxIconHorizontal:["gap-2"]}},defaultVariants:{variant:"default"}}),V=u.cva("group relative flex cursor-pointer outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:["items-start gap-3"],box:["items-start gap-3 rounded-lg border border-border bg-background p-3","transition-colors","data-[state=checked]:border-primary data-[state=checked]:bg-primary/10","dark:data-[state=checked]:bg-alpha-10","focus-visible:outline-none"],boxIconVertical:["flex-col items-center gap-3 rounded-lg border border-border bg-background p-3","transition-colors","data-[state=checked]:border-primary data-[state=checked]:bg-primary/10","dark:data-[state=checked]:bg-alpha-10","focus-visible:outline-none focus-visible:shadow-default"],boxIconHorizontal:["flex-row items-start gap-3 rounded-lg border border-border bg-background p-3","transition-colors","data-[state=checked]:border-primary data-[state=checked]:bg-primary/10","dark:data-[state=checked]:bg-alpha-10","focus-visible:outline-none focus-visible:shadow-default"]}},defaultVariants:{variant:"default"}}),N=u.cva("relative aspect-square size-4 shrink-0 rounded-full border transition-[border-color,border-width,box-shadow,background-color]",{variants:{variant:{default:["border-ring bg-background shadow-xs","group-focus-visible:outline-none group-focus-visible:border-ring group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],box:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-4 group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5 dark:group-data-[state=checked]:border-primary"],boxIconVertical:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],boxIconHorizontal:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"]}},defaultVariants:{variant:"default"}}),R=u.cva("text-foreground flex flex-col gap-1.5 leading-none",{variants:{variant:{default:[],box:["text-left"],boxIconVertical:["items-center"],boxIconHorizontal:["text-left justify-center"]}},defaultVariants:{variant:"default"}}),x=l.createContext({variant:"default"}),v=l.forwardRef(({className:r,variant:t="default",dataHook:a,trackingEl:o,trackingLabel:n,error:c,...d},b)=>{const g=t||"default",i=c||d["aria-invalid"]===!0||d["aria-invalid"]==="true";return e.jsx(x.Provider,{value:{variant:g},children:e.jsx(s.Root,{ref:b,"aria-invalid":i?"true":void 0,className:p.cn(I({variant:t}),r),"data-hook":a,"data-slot":"radio-group","data-tracking-el":o,"data-tracking-label":n,...d})})});v.displayName=s.Root.displayName;const h=l.forwardRef(({className:r,variant:t,label:a,description:o,icon:n,children:c,...d},b)=>{const g=l.useContext(x),i=t??g.variant??"default",f=i==="boxIconVertical"||i==="boxIconHorizontal";return e.jsxs(s.Item,{ref:b,className:p.cn(V({variant:i}),r),"data-slot":"radio-group-item",...d,children:[f&&n&&e.jsx("div",{className:"relative flex shrink-0 items-center justify-center",children:n}),!f&&e.jsx("div",{className:N({variant:i}),children:e.jsx(s.Indicator,{className:"absolute inset-0 flex items-center justify-center","data-slot":"radio-group-indicator",children:e.jsx(w.Circle,{className:p.cn(i==="default"?"fill-primary text-primary":"fill-background text-background"),size:8})})}),(a||o||c)&&e.jsxs("div",{className:R({variant:i}),children:[a&&e.jsx(j.Label,{className:"my-[1px] cursor-pointer",children:a}),o&&e.jsx("p",{className:"text-muted-foreground text-sm",children:o}),c]})]})});h.displayName=s.Item.displayName;exports.RadioGroup=v;exports.RadioGroupItem=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),k=require("react"),w=require("@radix-ui/react-radio-group"),I=require("@brightlocal/icons"),b=require("class-variance-authority"),s=require("@brightlocal/ui-components/lib/utils");function p(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return a.default=e,Object.freeze(a)}const c=p(k),n=p(w),j=b.cva("grid",{variants:{variant:{default:["gap-3"],box:["gap-3"],boxIconVertical:["grid-flow-col auto-cols-fr gap-3"],boxIconHorizontal:["gap-3"]}},defaultVariants:{variant:"default"}}),R=b.cva("group relative flex cursor-pointer outline-none disabled:cursor-not-allowed disabled:opacity-50 after:absolute after:inset-0",{variants:{variant:{default:["items-center"],box:["items-center"],boxIconVertical:["items-center justify-center"],boxIconHorizontal:["items-center justify-center"]}},defaultVariants:{variant:"default"}}),V=b.cva("relative aspect-square size-4 shrink-0 rounded-full border transition-[border-color,border-width,box-shadow,background-color]",{variants:{variant:{default:["border-ring bg-background shadow-xs","group-focus-visible:outline-none group-focus-visible:border-ring group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],box:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-4 group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5 dark:group-data-[state=checked]:border-primary"],boxIconVertical:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],boxIconHorizontal:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"]}},defaultVariants:{variant:"default"}}),f=c.createContext({variant:"default"}),v=c.forwardRef(({className:e,variant:a="default",dataHook:r,trackingEl:o,trackingLabel:u,error:l,orientation:t,...d},x)=>{const h=a||"default",g=l||d["aria-invalid"]===!0||d["aria-invalid"]==="true",y=a==="boxIconVertical"?"horizontal":t;return i.jsx(f.Provider,{value:{variant:h,error:g},children:i.jsx(n.Root,{ref:x,"aria-invalid":g?"true":void 0,className:s.cn(j({variant:a}),e),"data-hook":r,"data-slot":"radio-group","data-tracking-el":o,"data-tracking-label":u,"data-variant":a,orientation:y,...d})})});v.displayName=n.Root.displayName;const m=c.forwardRef(({className:e,children:a,...r},o)=>{const{variant:u,error:l}=c.useContext(f),t=u??"default",d=t==="boxIconVertical"||t==="boxIconHorizontal";return i.jsxs(n.Item,{ref:o,className:s.cn(R({variant:t}),e),"data-slot":"radio-group-item",...r,children:[!d&&i.jsx("div",{className:s.cn(V({variant:t}),l&&["border-red-600/40 dark:border-red-400/60","group-focus-visible:border-destructive group-focus-visible:shadow-destructive"]),children:i.jsx(n.Indicator,{className:"absolute inset-0 flex items-center justify-center","data-slot":"radio-group-indicator",children:i.jsx(I.Circle,{className:s.cn(t==="default"?"fill-primary text-primary":"fill-background text-background"),size:8})})}),a]})});m.displayName=n.Item.displayName;exports.RadioGroup=v;exports.RadioGroupItem=m;
@@ -2,10 +2,7 @@ import { VariantProps } from 'class-variance-authority';
2
2
  import * as React from "react";
3
3
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
4
4
  declare const radioGroupVariants: (props?: ({
5
- variant?: "box" | "default" | "boxIconVertical" | "boxIconHorizontal" | null | undefined;
6
- } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
- declare const radioGroupItemVariants: (props?: ({
8
- variant?: "box" | "default" | "boxIconVertical" | "boxIconHorizontal" | null | undefined;
5
+ variant?: "default" | "box" | "boxIconVertical" | "boxIconHorizontal" | null | undefined;
9
6
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
10
7
  /**
11
8
  * Visual style variants for the radio group component.
@@ -39,22 +36,9 @@ interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGro
39
36
  /**
40
37
  * Props for the RadioGroupItem component.
41
38
  */
42
- interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, VariantProps<typeof radioGroupItemVariants> {
43
- /**
44
- * Label text displayed next to the radio button
45
- */
46
- label?: React.ReactNode;
47
- /**
48
- * Description text displayed below the label
49
- */
50
- description?: React.ReactNode;
51
- /**
52
- * Icon displayed for box icon variants
53
- */
54
- icon?: React.ReactNode;
55
- }
39
+ type RadioGroupItemProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>;
56
40
  declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
57
- declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
41
+ declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
58
42
  export { RadioGroup, RadioGroupItem, type RadioGroupVariant };
59
43
  export type { RadioGroupProps, RadioGroupItemProps };
60
44
  //# sourceMappingURL=radio-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/components/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOlE,QAAA,MAAM,kBAAkB;;8EAYtB,CAAC;AAEH,QAAA,MAAM,sBAAsB;;8EAiC3B,CAAC;AA6DF;;;;;;GAMG;AACH,KAAK,iBAAiB,GAClB,SAAS,GACT,KAAK,GACL,iBAAiB,GACjB,mBAAmB,CAAC;AAMxB;;GAEG;AACH,UAAU,eACR,SACE,KAAK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