@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.
- package/dist/alert.d.ts +2 -2
- package/dist/blocks/sidebar.d.ts +6 -6
- package/dist/button.d.ts +2 -2
- package/dist/carousel.d.ts +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +11 -7
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +144 -133
- package/dist/date-picker.d.ts +2 -2
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +11 -4
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +113 -80
- package/dist/index.cjs +1 -1
- package/dist/index.js +253 -255
- package/dist/input-group.d.ts +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -20
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +91 -132
- package/dist/input-password.d.ts +1 -1
- package/dist/label.d.ts +2 -3
- package/dist/label.d.ts.map +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +3 -19
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +92 -120
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -19
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +1 -21
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +31 -100
- package/package.json +2 -2
- package/src/components/combobox.tsx +22 -2
- package/src/components/field.tsx +47 -7
- package/src/components/input-otp.tsx +9 -89
- package/src/components/label.tsx +2 -2
- package/src/components/radio-group.tsx +65 -129
- package/src/components/select.tsx +3 -2
- package/src/components/switch.tsx +29 -140
- package/dist/link.figma.d.ts +0 -2
- package/dist/link.figma.d.ts.map +0 -1
- package/dist/switch.figma.d.ts +0 -2
- package/dist/switch.figma.d.ts.map +0 -1
- package/dist/toggle.figma.d.ts +0 -2
- package/dist/toggle.figma.d.ts.map +0 -1
- package/src/components/link.figma.tsx +0 -71
- package/src/components/switch.figma.tsx +0 -111
- package/src/components/toggle.figma.tsx +0 -75
package/dist/input-otp.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
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;
|
package/dist/input-otp.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
57
|
-
export type { InputOTPProps, InputOTPGroupProps, InputOTPSlotProps, InputOTPSeparatorProps,
|
|
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
|
package/dist/input-otp.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AA4BnB,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;AAMD,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;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
|
|
1
|
+
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { OTPInput as
|
|
4
|
-
import { REGEXP_ONLY_CHARS as
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
14
|
+
const l = s.forwardRef(
|
|
16
15
|
({
|
|
17
16
|
dataHook: t,
|
|
18
|
-
trackingEl:
|
|
19
|
-
trackingLabel:
|
|
20
|
-
containerClassName:
|
|
21
|
-
error:
|
|
17
|
+
trackingEl: o,
|
|
18
|
+
trackingLabel: i,
|
|
19
|
+
containerClassName: r,
|
|
20
|
+
error: n,
|
|
22
21
|
disabled: u,
|
|
23
|
-
children:
|
|
22
|
+
children: a,
|
|
24
23
|
...d
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
() => ({ error:
|
|
28
|
-
[
|
|
24
|
+
}, I) => {
|
|
25
|
+
const m = s.useMemo(
|
|
26
|
+
() => ({ error: n, disabled: u }),
|
|
27
|
+
[n, u]
|
|
29
28
|
);
|
|
30
|
-
return /* @__PURE__ */ e(
|
|
31
|
-
|
|
29
|
+
return /* @__PURE__ */ e(g.Provider, { value: m, children: /* @__PURE__ */ e(
|
|
30
|
+
T,
|
|
32
31
|
{
|
|
33
|
-
ref:
|
|
34
|
-
"aria-invalid":
|
|
32
|
+
ref: I,
|
|
33
|
+
"aria-invalid": n ? "true" : void 0,
|
|
35
34
|
className: "disabled:cursor-not-allowed",
|
|
36
|
-
containerClassName:
|
|
35
|
+
containerClassName: h(
|
|
37
36
|
"group flex items-center gap-2 has-disabled:opacity-50 w-fit",
|
|
38
|
-
|
|
37
|
+
r
|
|
39
38
|
),
|
|
40
39
|
"data-hook": t,
|
|
41
40
|
"data-slot": "input-otp",
|
|
42
|
-
"data-tracking-el":
|
|
43
|
-
"data-tracking-label":
|
|
41
|
+
"data-tracking-el": o,
|
|
42
|
+
"data-tracking-label": i,
|
|
44
43
|
disabled: u,
|
|
45
44
|
...d,
|
|
46
|
-
children:
|
|
45
|
+
children: a
|
|
47
46
|
}
|
|
48
47
|
) });
|
|
49
48
|
}
|
|
50
49
|
);
|
|
51
|
-
|
|
52
|
-
function
|
|
50
|
+
l.displayName = "InputOTP";
|
|
51
|
+
function p({ className: t, ...o }) {
|
|
53
52
|
return /* @__PURE__ */ e(
|
|
54
53
|
"div",
|
|
55
54
|
{
|
|
56
|
-
className:
|
|
55
|
+
className: h("flex items-center rounded-md shadow-xs", t),
|
|
57
56
|
"data-slot": "input-otp-group",
|
|
58
|
-
...
|
|
57
|
+
...o
|
|
59
58
|
}
|
|
60
59
|
);
|
|
61
60
|
}
|
|
62
|
-
function
|
|
63
|
-
const { error:
|
|
64
|
-
|
|
65
|
-
), { char: u, hasFakeCaret:
|
|
66
|
-
return /* @__PURE__ */
|
|
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:
|
|
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
|
-
|
|
80
|
-
|
|
78
|
+
r && "border-destructive",
|
|
79
|
+
r && d && "shadow-destructive",
|
|
81
80
|
// Dark mode
|
|
82
81
|
"dark:bg-input/30",
|
|
83
|
-
|
|
82
|
+
o
|
|
84
83
|
),
|
|
85
84
|
"data-active": d,
|
|
86
|
-
"data-error":
|
|
85
|
+
"data-error": r,
|
|
87
86
|
"data-slot": "input-otp-slot",
|
|
88
|
-
...
|
|
87
|
+
...i,
|
|
89
88
|
children: [
|
|
90
89
|
u,
|
|
91
|
-
|
|
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
|
|
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
|
-
|
|
100
|
-
|
|
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:
|
|
101
|
+
ref: i,
|
|
141
102
|
inputMode: "numeric",
|
|
142
103
|
maxLength: t,
|
|
143
|
-
pasteTransformer: (
|
|
144
|
-
pattern:
|
|
145
|
-
...
|
|
146
|
-
children: /* @__PURE__ */ e(
|
|
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
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
110
|
+
w.displayName = "InputOTPDigitsOnly";
|
|
111
|
+
const y = s.forwardRef(({ maxLength: t = 4, ...o }, i) => /* @__PURE__ */ e(
|
|
112
|
+
l,
|
|
152
113
|
{
|
|
153
|
-
ref:
|
|
114
|
+
ref: i,
|
|
154
115
|
containerClassName: "gap-2",
|
|
155
116
|
maxLength: t,
|
|
156
|
-
...
|
|
157
|
-
children: Array.from({ length: t }, (
|
|
158
|
-
|
|
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:
|
|
122
|
+
index: n
|
|
162
123
|
},
|
|
163
|
-
|
|
124
|
+
n
|
|
164
125
|
))
|
|
165
126
|
}
|
|
166
127
|
));
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
({ maxLength: t = 6, ...
|
|
170
|
-
const
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */ e(
|
|
173
|
-
/* @__PURE__ */ e(
|
|
174
|
-
/* @__PURE__ */ e(
|
|
175
|
-
|
|
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:
|
|
138
|
+
index: a + r
|
|
178
139
|
},
|
|
179
|
-
|
|
140
|
+
a + r
|
|
180
141
|
)) })
|
|
181
142
|
] });
|
|
182
143
|
}
|
|
183
144
|
);
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
return /* @__PURE__ */ e(
|
|
188
|
-
const d =
|
|
189
|
-
return /* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */ e(
|
|
192
|
-
] },
|
|
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
|
-
|
|
156
|
+
_.displayName = "InputOTPWithSeparator";
|
|
196
157
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
S as
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
};
|
package/dist/input-password.d.ts
CHANGED
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.
|
|
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<
|
|
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
|
package/dist/label.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,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"}
|
package/dist/radio-group.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/dist/radio-group.d.ts
CHANGED
|
@@ -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?: "
|
|
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
|
-
|
|
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;
|
|
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;AAMlE,QAAA,MAAM,kBAAkB;;8EAYtB,CAAC;AA6DH;;;;;;GAMG;AACH,KAAK,iBAAiB,GAClB,SAAS,GACT,KAAK,GACL,iBAAiB,GACjB,mBAAmB,CAAC;AAOxB;;GAEG;AACH,UAAU,eACR,SACE,KAAK,CAAC,wBAAwB,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,EAC/D,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,KAAK,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CACvD,OAAO,mBAAmB,CAAC,IAAI,CAChC,CAAC;AAUF,QAAA,MAAM,UAAU,wFA+Cf,CAAC;AAKF,QAAA,MAAM,cAAc,yKA8ClB,CAAC;AAKH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,iBAAiB,EAAE,CAAC;AAC9D,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC"}
|