@cellarnode/auth 0.13.1 → 0.13.2
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.
|
@@ -2,8 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { OTPInput } from "input-otp";
|
|
3
3
|
export type InputOTPProps = React.ComponentProps<typeof OTPInput> & {
|
|
4
4
|
containerClassName?: string;
|
|
5
|
+
"data-invalid"?: boolean;
|
|
6
|
+
"data-shaking"?: boolean;
|
|
5
7
|
};
|
|
6
|
-
export declare function InputOTP({ containerClassName, ...props }: InputOTPProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function InputOTP({ containerClassName, "data-invalid": dataInvalid, "data-shaking": dataShaking, ...props }: InputOTPProps): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export declare function InputOTPGroup({ className, style, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<"div"> & {
|
|
9
11
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp-slots.d.ts","sourceRoot":"","sources":["../../src/react/input-otp-slots.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AAItD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,GAAG;IAClE,kBAAkB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"input-otp-slots.d.ts","sourceRoot":"","sources":["../../src/react/input-otp-slots.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AAItD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,GAAG;IAClE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AA8DF,wBAAgB,QAAQ,CAAC,EACvB,kBAAkB,EAClB,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,WAAW,EAC3B,GAAG,KAAK,EACT,EAAE,aAAa,2CAkCf;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAS7B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,kDAuEjD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CA8B7B"}
|
|
@@ -21,6 +21,19 @@ const OTP_STYLES = `
|
|
|
21
21
|
[data-slot="input-otp-group"] > [data-slot="input-otp-slot"] {
|
|
22
22
|
border-left-width: 0;
|
|
23
23
|
}
|
|
24
|
+
[data-slot="input-otp-slot"] {
|
|
25
|
+
width: var(--input-otp-slot-width, 52px);
|
|
26
|
+
}
|
|
27
|
+
[data-slot="input-otp-root"] > [data-input-otp-container] {
|
|
28
|
+
--input-otp-slot-width: min(
|
|
29
|
+
52px,
|
|
30
|
+
calc(
|
|
31
|
+
(100cqw - var(--input-otp-separator-budget)) /
|
|
32
|
+
var(--input-otp-slot-count)
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
--input-otp-separator-width: 24px;
|
|
36
|
+
}
|
|
24
37
|
[data-slot="input-otp-group"] > [data-slot="input-otp-slot"]:first-child {
|
|
25
38
|
border-left-width: 2px;
|
|
26
39
|
border-top-left-radius: 12px;
|
|
@@ -39,19 +52,25 @@ const OTP_STYLES = `
|
|
|
39
52
|
[data-slot="input-otp-group"] > [data-slot="input-otp-slot"][data-active]:first-child {
|
|
40
53
|
margin-left: 0;
|
|
41
54
|
}
|
|
42
|
-
[data-slot="input-otp"][data-invalid] [data-slot="input-otp-slot"] {
|
|
43
|
-
border-color: var(--destructive, #ef4444);
|
|
55
|
+
[data-slot="input-otp-root"][data-invalid] [data-slot="input-otp-slot"] {
|
|
56
|
+
border-color: var(--destructive, #ef4444) !important;
|
|
44
57
|
}
|
|
45
|
-
[data-slot="input-otp"][data-invalid] [data-slot="input-otp-slot"][data-active] {
|
|
58
|
+
[data-slot="input-otp-root"][data-invalid] [data-slot="input-otp-slot"][data-active] {
|
|
46
59
|
border-color: var(--destructive, #ef4444) !important;
|
|
47
60
|
box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive, #ef4444) 20%, transparent), 0 1px 2px 0 rgba(0,0,0,0.05);
|
|
48
61
|
}
|
|
49
|
-
[data-slot="input-otp"][data-shaking] {
|
|
62
|
+
[data-slot="input-otp-root"][data-shaking] {
|
|
50
63
|
animation: otpShake 0.4s ease;
|
|
51
64
|
}
|
|
52
65
|
`;
|
|
53
|
-
export function InputOTP({ containerClassName, ...props }) {
|
|
54
|
-
|
|
66
|
+
export function InputOTP({ containerClassName, "data-invalid": dataInvalid, "data-shaking": dataShaking, ...props }) {
|
|
67
|
+
const separatorCount = countOtpSeparators(props.children);
|
|
68
|
+
const containerStyle = {
|
|
69
|
+
containerType: "inline-size",
|
|
70
|
+
"--input-otp-slot-count": props.maxLength ?? 6,
|
|
71
|
+
"--input-otp-separator-budget": `${separatorCount * 24}px`,
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: OTP_STYLES }), _jsx("div", { "data-slot": "input-otp-root", "data-invalid": dataInvalid ? true : undefined, "data-shaking": dataShaking ? true : undefined, className: "w-full", style: containerStyle, children: _jsx(OTPInput, { "data-slot": "input-otp", "data-invalid": dataInvalid ? true : undefined, "data-shaking": dataShaking ? true : undefined, containerClassName: clsx("flex w-full items-center has-disabled:opacity-50", containerClassName), ...props }) })] }));
|
|
55
74
|
}
|
|
56
75
|
export function InputOTPGroup({ className, style, ...props }) {
|
|
57
76
|
return (_jsx("div", { "data-slot": "input-otp-group", style: { display: "flex", alignItems: "center", ...style }, className: className, ...props }));
|
|
@@ -67,7 +86,6 @@ export function InputOTPSlot({ index, className, ...props }) {
|
|
|
67
86
|
display: "flex",
|
|
68
87
|
alignItems: "center",
|
|
69
88
|
justifyContent: "center",
|
|
70
|
-
width: "52px",
|
|
71
89
|
height: "60px",
|
|
72
90
|
fontSize: "24px",
|
|
73
91
|
fontWeight: 600,
|
|
@@ -103,13 +121,34 @@ export function InputOTPSlot({ index, className, ...props }) {
|
|
|
103
121
|
} }) }))] }));
|
|
104
122
|
}
|
|
105
123
|
export function InputOTPSeparator({ style, ...props }) {
|
|
106
|
-
return (
|
|
124
|
+
return (_jsxs("div", { "data-slot": "input-otp-separator", style: {
|
|
107
125
|
display: "flex",
|
|
108
126
|
alignItems: "center",
|
|
109
127
|
justifyContent: "center",
|
|
110
|
-
width: "24px",
|
|
128
|
+
width: "var(--input-otp-separator-width, 24px)",
|
|
111
129
|
color: "var(--muted-foreground, #94a3b8)",
|
|
112
130
|
...style,
|
|
113
|
-
}, ...props, children: _jsx(
|
|
131
|
+
}, ...props, children: [_jsx("hr", { style: {
|
|
132
|
+
position: "absolute",
|
|
133
|
+
width: "1px",
|
|
134
|
+
height: "1px",
|
|
135
|
+
padding: 0,
|
|
136
|
+
margin: "-1px",
|
|
137
|
+
overflow: "hidden",
|
|
138
|
+
clip: "rect(0, 0, 0, 0)",
|
|
139
|
+
whiteSpace: "nowrap",
|
|
140
|
+
border: 0,
|
|
141
|
+
} }), _jsx(Minus, { style: { width: "20px", height: "20px" } })] }));
|
|
142
|
+
}
|
|
143
|
+
function countOtpSeparators(children) {
|
|
144
|
+
return React.Children.toArray(children).reduce((count, child) => {
|
|
145
|
+
if (!React.isValidElement(child)) {
|
|
146
|
+
return count;
|
|
147
|
+
}
|
|
148
|
+
if (child.type === InputOTPSeparator) {
|
|
149
|
+
return count + 1;
|
|
150
|
+
}
|
|
151
|
+
return count + countOtpSeparators(child.props.children);
|
|
152
|
+
}, 0);
|
|
114
153
|
}
|
|
115
154
|
//# sourceMappingURL=input-otp-slots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp-slots.js","sourceRoot":"","sources":["../../src/react/input-otp-slots.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"input-otp-slots.js","sourceRoot":"","sources":["../../src/react/input-otp-slots.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAQrC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DlB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,EACvB,kBAAkB,EAClB,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,WAAW,EAC3B,GAAG,KAAK,EACM;IACd,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,cAAc,GAAG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,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cellarnode/auth",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "Shared OTP-based authentication — token store, API client, React UI components for CellarNode dashboards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|
|
38
38
|
"prepublishOnly": "npm run build",
|
|
39
|
-
"check-exports": "npx publint && npx @arethetypeswrong/cli --pack .",
|
|
39
|
+
"check-exports": "npx publint && npx @arethetypeswrong/cli --pack . --profile esm-only",
|
|
40
40
|
"test": "vitest run",
|
|
41
41
|
"test:watch": "vitest",
|
|
42
42
|
"typecheck": "tsc --noEmit"
|