@forjio/auth-ui 0.5.0 → 0.7.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.
- package/dist/AuthForm.cjs +38 -30
- package/dist/AuthForm.cjs.map +1 -1
- package/dist/AuthForm.d.cts +2 -2
- package/dist/AuthForm.d.ts +2 -2
- package/dist/AuthForm.js +38 -30
- package/dist/AuthForm.js.map +1 -1
- package/dist/ForgotPasswordForm.cjs +11 -6
- package/dist/ForgotPasswordForm.cjs.map +1 -1
- package/dist/ForgotPasswordForm.d.cts +2 -2
- package/dist/ForgotPasswordForm.d.ts +2 -2
- package/dist/ForgotPasswordForm.js +11 -6
- package/dist/ForgotPasswordForm.js.map +1 -1
- package/dist/ResetPasswordForm.cjs +8 -5
- package/dist/ResetPasswordForm.cjs.map +1 -1
- package/dist/ResetPasswordForm.d.cts +2 -2
- package/dist/ResetPasswordForm.d.ts +2 -2
- package/dist/ResetPasswordForm.js +8 -5
- package/dist/ResetPasswordForm.js.map +1 -1
- package/dist/components/ui/button.cjs +84 -0
- package/dist/components/ui/button.cjs.map +1 -0
- package/dist/components/ui/button.d.cts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +49 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/input.cjs +58 -0
- package/dist/components/ui/input.cjs.map +1 -0
- package/dist/components/ui/input.d.cts +5 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +24 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.cjs +56 -0
- package/dist/components/ui/label.cjs.map +1 -0
- package/dist/components/ui/label.d.cts +8 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/lib/utils.cjs +33 -0
- package/dist/lib/utils.cjs.map +1 -0
- package/dist/lib/utils.d.cts +9 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/useTurnstileTheme.cjs +44 -0
- package/dist/useTurnstileTheme.cjs.map +1 -0
- package/dist/useTurnstileTheme.d.cts +3 -0
- package/dist/useTurnstileTheme.d.ts +3 -0
- package/dist/useTurnstileTheme.js +20 -0
- package/dist/useTurnstileTheme.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
const Input = React.forwardRef(
|
|
5
|
+
({ className, type, ...props }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"input",
|
|
8
|
+
{
|
|
9
|
+
type,
|
|
10
|
+
className: cn(
|
|
11
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
Input.displayName = "Input";
|
|
21
|
+
export {
|
|
22
|
+
Input
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/input.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n 'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className\n )}\n ref={ref}\n {...props}\n />\n );\n }\n);\nInput.displayName = 'Input';\n\nexport { Input };\n"],"mappings":"AAOM;AAPN,YAAY,WAAW;AAEvB,SAAS,UAAU;AAEnB,MAAM,QAAQ,MAAM;AAAA,EAClB,CAAC,EAAE,WAAW,MAAM,GAAG,MAAM,GAAG,QAAQ;AACtC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var label_exports = {};
|
|
31
|
+
__export(label_exports, {
|
|
32
|
+
Label: () => Label
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(label_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var React = __toESM(require("react"), 1);
|
|
37
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
38
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
+
var import_utils = require("../../lib/utils");
|
|
40
|
+
const labelVariants = (0, import_class_variance_authority.cva)(
|
|
41
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
42
|
+
);
|
|
43
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
44
|
+
LabelPrimitive.Root,
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
className: (0, import_utils.cn)(labelVariants(), className),
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
));
|
|
51
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
Label
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=label.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/label.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../lib/utils';\n\nconst labelVariants = cva(\n 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBE;AAfF,YAAuB;AACvB,qBAAgC;AAChC,sCAAuC;AAEvC,mBAAmB;AAEnB,MAAM,oBAAgB;AAAA,EACpB;AACF;AAEA,MAAM,QAAQ,MAAM,WAIlB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,eAAe;AAAA,EAAf;AAAA,IACC;AAAA,IACA,eAAW,iBAAG,cAAc,GAAG,SAAS;AAAA,IACvC,GAAG;AAAA;AACN,CACD;AACD,MAAM,cAAc,eAAe,KAAK;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
7
|
+
|
|
8
|
+
export { Label };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
7
|
+
|
|
8
|
+
export { Label };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../../lib/utils";
|
|
7
|
+
const labelVariants = cva(
|
|
8
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
9
|
+
);
|
|
10
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
11
|
+
LabelPrimitive.Root,
|
|
12
|
+
{
|
|
13
|
+
ref,
|
|
14
|
+
className: cn(labelVariants(), className),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
));
|
|
18
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
19
|
+
export {
|
|
20
|
+
Label
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/label.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../lib/utils';\n\nconst labelVariants = cva(\n 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n"],"mappings":";AAiBE;AAfF,YAAY,WAAW;AACvB,YAAY,oBAAoB;AAChC,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAEnB,MAAM,gBAAgB;AAAA,EACpB;AACF;AAEA,MAAM,QAAQ,MAAM,WAIlB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,eAAe;AAAA,EAAf;AAAA,IACC;AAAA,IACA,WAAW,GAAG,cAAc,GAAG,SAAS;AAAA,IACvC,GAAG;AAAA;AACN,CACD;AACD,MAAM,cAAc,eAAe,KAAK;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
cn: () => cn
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
var import_clsx = require("clsx");
|
|
25
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
26
|
+
function cn(...inputs) {
|
|
27
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
cn
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Merge Tailwind class names with conflict resolution.\n * The shadcn/ui standard helper — every `components/ui/*` file imports this.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsC;AACtC,4BAAwB;AAMjB,SAAS,MAAM,QAA8B;AAClD,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * Merge Tailwind class names with conflict resolution.\n * The shadcn/ui standard helper — every `components/ui/*` file imports this.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n"],"mappings":"AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAMjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useTurnstileTheme_exports = {};
|
|
20
|
+
__export(useTurnstileTheme_exports, {
|
|
21
|
+
useTurnstileTheme: () => useTurnstileTheme
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useTurnstileTheme_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
function useTurnstileTheme() {
|
|
26
|
+
const [theme, setTheme] = (0, import_react.useState)("light");
|
|
27
|
+
(0, import_react.useEffect)(() => {
|
|
28
|
+
try {
|
|
29
|
+
const bg = getComputedStyle(document.body).backgroundColor;
|
|
30
|
+
const m = bg.match(/\d+/g);
|
|
31
|
+
if (m && m.length >= 3) {
|
|
32
|
+
const lum = 0.299 * Number(m[0]) + 0.587 * Number(m[1]) + 0.114 * Number(m[2]);
|
|
33
|
+
setTheme(lum < 128 ? "dark" : "light");
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
return theme;
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
useTurnstileTheme
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=useTurnstileTheme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useTurnstileTheme.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n// Match the Turnstile widget to the PRODUCT's actual theme by reading the\n// rendered page-background luminance on mount, instead of Turnstile's\n// `'auto'` (which follows the visitor's OS, not the product — so a\n// fixed-light product like huudis showed a dark widget for dark-OS users).\n// Reading the real background works for forced-light, forced-dark, AND\n// OS-adaptive products alike, with zero per-product configuration.\nexport function useTurnstileTheme(): 'light' | 'dark' {\n const [theme, setTheme] = useState<'light' | 'dark'>('light');\n useEffect(() => {\n try {\n const bg = getComputedStyle(document.body).backgroundColor;\n const m = bg.match(/\\d+/g);\n if (m && m.length >= 3) {\n const lum = 0.299 * Number(m[0]) + 0.587 * Number(m[1]) + 0.114 * Number(m[2]);\n setTheme(lum < 128 ? 'dark' : 'light');\n }\n } catch {\n /* no DOM (SSR) — keep the light default until mount */\n }\n }, []);\n return theme;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAQ7B,SAAS,oBAAsC;AACpD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAA2B,OAAO;AAC5D,8BAAU,MAAM;AACd,QAAI;AACF,YAAM,KAAK,iBAAiB,SAAS,IAAI,EAAE;AAC3C,YAAM,IAAI,GAAG,MAAM,MAAM;AACzB,UAAI,KAAK,EAAE,UAAU,GAAG;AACtB,cAAM,MAAM,QAAQ,OAAO,EAAE,CAAC,CAAC,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC;AAC7E,iBAAS,MAAM,MAAM,SAAS,OAAO;AAAA,MACvC;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
function useTurnstileTheme() {
|
|
3
|
+
const [theme, setTheme] = useState("light");
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
try {
|
|
6
|
+
const bg = getComputedStyle(document.body).backgroundColor;
|
|
7
|
+
const m = bg.match(/\d+/g);
|
|
8
|
+
if (m && m.length >= 3) {
|
|
9
|
+
const lum = 0.299 * Number(m[0]) + 0.587 * Number(m[1]) + 0.114 * Number(m[2]);
|
|
10
|
+
setTheme(lum < 128 ? "dark" : "light");
|
|
11
|
+
}
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
return theme;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useTurnstileTheme
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useTurnstileTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/useTurnstileTheme.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n// Match the Turnstile widget to the PRODUCT's actual theme by reading the\n// rendered page-background luminance on mount, instead of Turnstile's\n// `'auto'` (which follows the visitor's OS, not the product — so a\n// fixed-light product like huudis showed a dark widget for dark-OS users).\n// Reading the real background works for forced-light, forced-dark, AND\n// OS-adaptive products alike, with zero per-product configuration.\nexport function useTurnstileTheme(): 'light' | 'dark' {\n const [theme, setTheme] = useState<'light' | 'dark'>('light');\n useEffect(() => {\n try {\n const bg = getComputedStyle(document.body).backgroundColor;\n const m = bg.match(/\\d+/g);\n if (m && m.length >= 3) {\n const lum = 0.299 * Number(m[0]) + 0.587 * Number(m[1]) + 0.114 * Number(m[2]);\n setTheme(lum < 128 ? 'dark' : 'light');\n }\n } catch {\n /* no DOM (SSR) — keep the light default until mount */\n }\n }, []);\n return theme;\n}\n"],"mappings":"AAAA,SAAS,WAAW,gBAAgB;AAQ7B,SAAS,oBAAsC;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,OAAO;AAC5D,YAAU,MAAM;AACd,QAAI;AACF,YAAM,KAAK,iBAAiB,SAAS,IAAI,EAAE;AAC3C,YAAM,IAAI,GAAG,MAAM,MAAM;AACzB,UAAI,KAAK,EAAE,UAAU,GAAG;AACtB,cAAM,MAAM,QAAQ,OAAO,EAAE,CAAC,CAAC,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC;AAC7E,iBAAS,MAAM,MAAM,SAAS,OAAO;AAAA,MACvC;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forjio/auth-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Shared auth forms (login, signup, forgot-password, reset-password) for the Forjio family of SaaS products. Sister package to @forjio/website-ui and @forjio/portal-ui.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
"huudis"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@marsidev/react-turnstile": "^1.5.3"
|
|
59
|
+
"@marsidev/react-turnstile": "^1.5.3",
|
|
60
|
+
"@radix-ui/react-label": "^2.1.0",
|
|
61
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
62
|
+
"class-variance-authority": "^0.7.0",
|
|
63
|
+
"clsx": "^2.1.1",
|
|
64
|
+
"tailwind-merge": "^2.5.0"
|
|
60
65
|
}
|
|
61
66
|
}
|