@forgedevstack/bear 1.1.8 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.cjs +1 -1
- package/dist/components/AlertDialog/AlertDialog.const.d.ts +2 -2
- package/dist/components/AlertDialog/AlertDialog.const.js +4 -4
- package/dist/components/AlertDialog/AlertDialog.js +76 -62
- package/dist/components/BearLogo/BearLogo.d.ts +2 -7
- package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
- package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
- package/dist/components/BearLogo/index.d.ts +1 -2
- package/dist/components/Biometric/Biometric.cjs +1 -0
- package/dist/components/Biometric/Biometric.d.ts +3 -0
- package/dist/components/Biometric/Biometric.js +123 -0
- package/dist/components/Biometric/Biometric.types.d.ts +35 -0
- package/dist/components/Biometric/BiometricIcon.cjs +1 -0
- package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
- package/dist/components/Biometric/BiometricIcon.js +45 -0
- package/dist/components/Biometric/index.d.ts +3 -0
- package/dist/components/Biometric/useBiometric.cjs +1 -0
- package/dist/components/Biometric/useBiometric.d.ts +2 -0
- package/dist/components/Biometric/useBiometric.js +21 -0
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/CloseButton/CloseButton.cjs +1 -0
- package/dist/components/CloseButton/CloseButton.d.ts +4 -0
- package/dist/components/CloseButton/CloseButton.js +60 -0
- package/dist/components/CloseButton/CloseButton.types.d.ts +15 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +12 -11
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
- package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +48 -44
- package/dist/components/Icon/icons/commerce.cjs +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +25 -0
- package/dist/components/Icon/icons/commerce.js +124 -0
- package/dist/components/Icon/icons/device.cjs +1 -0
- package/dist/components/Icon/icons/device.d.ts +27 -0
- package/dist/components/Icon/icons/device.js +122 -0
- package/dist/components/Icon/icons/file.cjs +1 -0
- package/dist/components/Icon/icons/file.d.ts +25 -0
- package/dist/components/Icon/icons/file.js +120 -0
- package/dist/components/Icon/icons/social.cjs +1 -0
- package/dist/components/Icon/icons/social.d.ts +24 -0
- package/dist/components/Icon/icons/social.js +89 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +93 -56
- package/dist/components/Icon/index.js +38 -26
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +153 -101
- package/dist/components/Input/Input.types.d.ts +8 -2
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Overlay/Overlay.cjs +1 -0
- package/dist/components/Overlay/Overlay.d.ts +4 -0
- package/dist/components/Overlay/Overlay.js +38 -0
- package/dist/components/Overlay/Overlay.types.d.ts +23 -0
- package/dist/components/Overlay/index.d.ts +2 -0
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +76 -76
- package/dist/components/Portal/Portal.cjs +1 -0
- package/dist/components/Portal/Portal.d.ts +11 -0
- package/dist/components/Portal/Portal.js +12 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +41 -38
- package/dist/components/Tabs/TabList.cjs +1 -0
- package/dist/components/Tabs/TabList.d.ts +3 -0
- package/dist/components/Tabs/TabList.js +69 -0
- package/dist/components/Tabs/TabPanel.cjs +1 -0
- package/dist/components/Tabs/TabPanel.d.ts +3 -0
- package/dist/components/Tabs/TabPanel.js +13 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -27
- package/dist/components/Tabs/Tabs.js +42 -61
- package/dist/components/Tabs/Tabs.types.d.ts +4 -0
- package/dist/components/Tabs/index.d.ts +3 -1
- package/dist/components/ThemeIcon/ThemeIcon.cjs +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.d.ts +4 -0
- package/dist/components/ThemeIcon/ThemeIcon.js +54 -0
- package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +22 -0
- package/dist/components/ThemeIcon/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.cjs +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +22 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +15 -2
- package/dist/components/index.js +329 -312
- package/dist/hooks/bearStyled.cjs +1 -1
- package/dist/hooks/bearStyled.d.ts +31 -9
- package/dist/hooks/bearStyled.js +17 -12
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +9 -1
- package/dist/hooks/useResponsive.cjs +1 -1
- package/dist/hooks/useResponsive.d.ts +2 -17
- package/dist/hooks/useResponsive.js +47 -41
- package/dist/index.cjs +1 -1
- package/dist/index.js +408 -391
- package/dist/styles/_effects.css +9 -0
- package/dist/styles.css +1 -1
- package/dist/types/theme.types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ function App() {
|
|
|
76
76
|
|
|
77
77
|
### Form Components
|
|
78
78
|
|
|
79
|
-
- `Input` - Text input
|
|
79
|
+
- `Input` / `TextField` - Text input with optional `InputProps.startAdornment` / `endAdornment` for start/end slots
|
|
80
80
|
- `Select` / `MultiSelect` - Dropdown selection components
|
|
81
81
|
- `Checkbox` - Checkbox input
|
|
82
82
|
- `Radio` / `RadioGroup` - Radio button inputs
|
|
@@ -116,7 +116,7 @@ function App() {
|
|
|
116
116
|
- `DataTable` - Advanced data table with sorting, filtering, and pagination
|
|
117
117
|
- `Carousel` - Image/content carousel
|
|
118
118
|
- `Accordion` - Collapsible content sections
|
|
119
|
-
- `Tabs` - Tabbed interface
|
|
119
|
+
- `Tabs` / `TabList` / `Tab` / `TabPanel` - Tabbed interface; `TabList` supports `maxVisibleTabs` (overflow dropdown) and `wrap` (auto-break)
|
|
120
120
|
- `List` - List component with various item types
|
|
121
121
|
- `Avatar` / `AvatarGroup` - User avatar display
|
|
122
122
|
- `Chip` - Compact element for input, attribute, or action
|
|
@@ -286,7 +286,7 @@ const buttonProps: ButtonProps = {
|
|
|
286
286
|
|
|
287
287
|
## How Bear Compares
|
|
288
288
|
|
|
289
|
-
| Feature | Bear UI |
|
|
289
|
+
| Feature | Bear UI | Material UI | Ant Design | Chakra UI |
|
|
290
290
|
|---------|---------|-----|------------|-----------|
|
|
291
291
|
| **Tailwind CSS native** | Yes | No | No | Partial (v3) |
|
|
292
292
|
| **Bundle (tree-shaken)** | ~18 kB | ~80 kB | ~120 kB | ~45 kB |
|
|
@@ -297,7 +297,7 @@ const buttonProps: ButtonProps = {
|
|
|
297
297
|
| **Modular CSS** | `@BearInclude` PostCSS | N/A | N/A | N/A |
|
|
298
298
|
| **React 18 / 19** | Yes | Yes | Yes | Yes |
|
|
299
299
|
| **Zero runtime CSS-in-JS** | Yes | No (Emotion) | No (Less) | No (Emotion) |
|
|
300
|
-
| **Built-in i18n** | Portal (en/es) |
|
|
300
|
+
| **Built-in i18n** | Portal (en/es) | X (add-on) | ConfigProvider | N/A |
|
|
301
301
|
|
|
302
302
|
## Contributing
|
|
303
303
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("react"),B=require("react-dom"),a=require("../../utils/cn.cjs"),v=require("../Button/Button.cjs"),x=require("../Typography/Typography.cjs"),o=require("./AlertDialog.const.cjs"),N=p=>{const{isOpen:d,onClose:i,onConfirm:D,title:L,description:u,confirmText:S="Confirm",cancelText:T="Cancel",confirmVariant:C="danger",loading:n=!1,loadingText:R,closeOnBackdrop:I=!1,closeOnEscape:m=!0,icon:c,className:O,testId:j}=p,A=r.useId(),_=`bear-alert-title-${A}`,y=`bear-alert-desc-${A}`,l=r.useRef(null),E=r.useRef(null),b=r.useCallback(e=>{m&&e.key==="Escape"&&!n&&i()},[m,i,n]),f=r.useCallback(e=>{if(e.key!=="Tab"||!l.current)return;const s=l.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');if(s.length===0)return;const g=s[0],h=s[s.length-1];e.shiftKey&&document.activeElement===g?(e.preventDefault(),h.focus()):!e.shiftKey&&document.activeElement===h&&(e.preventDefault(),g.focus())},[]);if(r.useEffect(()=>(d&&(E.current=document.activeElement,document.addEventListener("keydown",b),document.addEventListener("keydown",f),document.body.style.overflow="hidden",requestAnimationFrame(()=>{var e;return(e=l.current)==null?void 0:e.focus()})),()=>{var e;document.removeEventListener("keydown",b),document.removeEventListener("keydown",f),document.body.style.overflow="",(e=E.current)==null||e.focus()}),[d,b,f]),!d)return null;const k=t.jsxs("div",{className:"Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4","data-testid":j,children:[t.jsx("div",{className:a.cn("Bear-AlertDialog__backdrop",o.ALERT_DIALOG_BACKDROP_CLASSES),onClick:I&&!n?i:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:l,role:"alertdialog","aria-modal":"true","aria-labelledby":_,"aria-describedby":u?y:void 0,tabIndex:-1,className:a.cn("Bear-AlertDialog__container",o.ALERT_DIALOG_CONTAINER_CLASSES,"bear-p-6",O),children:[c&&t.jsx("div",{className:"Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center",children:c}),t.jsx(x.Typography,{variant:"h6",id:_,className:a.cn("Bear-AlertDialog__title",o.ALERT_DIALOG_TITLE_CLASSES,c&&"bear-text-center"),children:L}),u&&t.jsx(x.Typography,{variant:"body2",id:y,className:a.cn("Bear-AlertDialog__description",o.ALERT_DIALOG_DESCRIPTION_CLASSES,c&&"bear-text-center"),children:u}),t.jsxs("div",{className:a.cn("Bear-AlertDialog__footer",o.ALERT_DIALOG_FOOTER_CLASSES),children:[t.jsx(v.Button,{variant:"ghost",onClick:i,disabled:n,children:T}),t.jsx(v.Button,{variant:C,onClick:D,loading:n,loadingText:R,children:S})]})]})]});return B.createPortal(k,document.body)};exports.AlertDialog=N;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in",a="bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in",r="bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white",b="bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2",t="bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";exports.ALERT_DIALOG_BACKDROP_CLASSES=e;exports.ALERT_DIALOG_CONTAINER_CLASSES=a;exports.ALERT_DIALOG_DESCRIPTION_CLASSES=b;exports.ALERT_DIALOG_FOOTER_CLASSES=t;exports.ALERT_DIALOG_TITLE_CLASSES=r;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const ALERT_DIALOG_BACKDROP_CLASSES = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity";
|
|
2
|
-
export declare const ALERT_DIALOG_CONTAINER_CLASSES = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all
|
|
1
|
+
export declare const ALERT_DIALOG_BACKDROP_CLASSES = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in";
|
|
2
|
+
export declare const ALERT_DIALOG_CONTAINER_CLASSES = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in";
|
|
3
3
|
export declare const ALERT_DIALOG_TITLE_CLASSES = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white";
|
|
4
4
|
export declare const ALERT_DIALOG_DESCRIPTION_CLASSES = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2";
|
|
5
5
|
export declare const ALERT_DIALOG_FOOTER_CLASSES = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a = "bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity animate-fade-in", e = "bear-relative bear-w-full bear-max-w-md bear-bg-white dark:bear-bg-zinc-900 bear-rounded-xl bear-shadow-2xl bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-transform bear-transition-all animate-alert-dialog-in", r = "bear-text-lg bear-font-semibold bear-text-gray-900 dark:bear-text-white", b = "bear-text-sm bear-text-gray-600 dark:bear-text-gray-400 bear-mt-2", t = "bear-flex bear-items-center bear-justify-end bear-gap-3 bear-pt-6";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
a as ALERT_DIALOG_BACKDROP_CLASSES,
|
|
4
|
+
e as ALERT_DIALOG_CONTAINER_CLASSES,
|
|
5
5
|
b as ALERT_DIALOG_DESCRIPTION_CLASSES,
|
|
6
6
|
t as ALERT_DIALOG_FOOTER_CLASSES,
|
|
7
|
-
|
|
7
|
+
r as ALERT_DIALOG_TITLE_CLASSES
|
|
8
8
|
};
|
|
@@ -1,96 +1,110 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useId as w, useRef as y, useCallback as h, useEffect as G } from "react";
|
|
3
|
+
import { createPortal as j } from "react-dom";
|
|
4
4
|
import { cn as a } from "../../utils/cn.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Typography as
|
|
7
|
-
import { ALERT_DIALOG_BACKDROP_CLASSES as
|
|
8
|
-
const
|
|
5
|
+
import { Button as L } from "../Button/Button.js";
|
|
6
|
+
import { Typography as g } from "../Typography/Typography.js";
|
|
7
|
+
import { ALERT_DIALOG_BACKDROP_CLASSES as F, ALERT_DIALOG_TITLE_CLASSES as K, ALERT_DIALOG_DESCRIPTION_CLASSES as P, ALERT_DIALOG_FOOTER_CLASSES as q, ALERT_DIALOG_CONTAINER_CLASSES as $ } from "./AlertDialog.const.js";
|
|
8
|
+
const W = (C) => {
|
|
9
9
|
const {
|
|
10
|
-
isOpen:
|
|
11
|
-
onClose:
|
|
12
|
-
onConfirm:
|
|
13
|
-
title:
|
|
14
|
-
description:
|
|
15
|
-
confirmText:
|
|
16
|
-
cancelText:
|
|
17
|
-
confirmVariant:
|
|
10
|
+
isOpen: c,
|
|
11
|
+
onClose: n,
|
|
12
|
+
onConfirm: D,
|
|
13
|
+
title: S,
|
|
14
|
+
description: d,
|
|
15
|
+
confirmText: T = "Confirm",
|
|
16
|
+
cancelText: x = "Cancel",
|
|
17
|
+
confirmVariant: I = "danger",
|
|
18
18
|
loading: r = !1,
|
|
19
|
-
loadingText:
|
|
20
|
-
closeOnBackdrop:
|
|
21
|
-
closeOnEscape:
|
|
22
|
-
icon:
|
|
23
|
-
className:
|
|
24
|
-
testId:
|
|
25
|
-
} = _,
|
|
26
|
-
(
|
|
27
|
-
|
|
19
|
+
loadingText: O,
|
|
20
|
+
closeOnBackdrop: k = !1,
|
|
21
|
+
closeOnEscape: f = !0,
|
|
22
|
+
icon: o,
|
|
23
|
+
className: R,
|
|
24
|
+
testId: N
|
|
25
|
+
} = C, b = w(), A = `bear-alert-title-${b}`, _ = `bear-alert-desc-${b}`, i = y(null), E = y(null), s = h(
|
|
26
|
+
(e) => {
|
|
27
|
+
f && e.key === "Escape" && !r && n();
|
|
28
28
|
},
|
|
29
|
-
[
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
[f, n, r]
|
|
30
|
+
), u = h((e) => {
|
|
31
|
+
if (e.key !== "Tab" || !i.current) return;
|
|
32
|
+
const l = i.current.querySelectorAll(
|
|
33
|
+
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
34
|
+
);
|
|
35
|
+
if (l.length === 0) return;
|
|
36
|
+
const p = l[0], v = l[l.length - 1];
|
|
37
|
+
e.shiftKey && document.activeElement === p ? (e.preventDefault(), v.focus()) : !e.shiftKey && document.activeElement === v && (e.preventDefault(), p.focus());
|
|
38
|
+
}, []);
|
|
39
|
+
if (G(() => (c && (E.current = document.activeElement, document.addEventListener("keydown", s), document.addEventListener("keydown", u), document.body.style.overflow = "hidden", requestAnimationFrame(() => {
|
|
40
|
+
var e;
|
|
41
|
+
return (e = i.current) == null ? void 0 : e.focus();
|
|
42
|
+
})), () => {
|
|
43
|
+
var e;
|
|
44
|
+
document.removeEventListener("keydown", s), document.removeEventListener("keydown", u), document.body.style.overflow = "", (e = E.current) == null || e.focus();
|
|
45
|
+
}), [c, s, u]), !c) return null;
|
|
46
|
+
const B = /* @__PURE__ */ m(
|
|
35
47
|
"div",
|
|
36
48
|
{
|
|
37
49
|
className: "Bear-AlertDialog bear-fixed bear-inset-0 bear-z-50 bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
38
|
-
"data-testid":
|
|
50
|
+
"data-testid": N,
|
|
39
51
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ t(
|
|
41
53
|
"div",
|
|
42
54
|
{
|
|
43
|
-
className: a("Bear-AlertDialog__backdrop",
|
|
44
|
-
onClick:
|
|
55
|
+
className: a("Bear-AlertDialog__backdrop", F),
|
|
56
|
+
onClick: k && !r ? n : void 0,
|
|
45
57
|
"aria-hidden": "true"
|
|
46
58
|
}
|
|
47
59
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ m(
|
|
49
61
|
"div",
|
|
50
62
|
{
|
|
63
|
+
ref: i,
|
|
51
64
|
role: "alertdialog",
|
|
52
65
|
"aria-modal": "true",
|
|
53
|
-
"aria-labelledby":
|
|
54
|
-
"aria-describedby":
|
|
55
|
-
|
|
66
|
+
"aria-labelledby": A,
|
|
67
|
+
"aria-describedby": d ? _ : void 0,
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
className: a("Bear-AlertDialog__container", $, "bear-p-6", R),
|
|
56
70
|
children: [
|
|
57
|
-
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
71
|
+
o && /* @__PURE__ */ t("div", { className: "Bear-AlertDialog__icon bear-mb-4 bear-flex bear-justify-center", children: o }),
|
|
72
|
+
/* @__PURE__ */ t(
|
|
73
|
+
g,
|
|
60
74
|
{
|
|
61
75
|
variant: "h6",
|
|
62
|
-
id:
|
|
63
|
-
className: a("Bear-AlertDialog__title",
|
|
64
|
-
children:
|
|
76
|
+
id: A,
|
|
77
|
+
className: a("Bear-AlertDialog__title", K, o && "bear-text-center"),
|
|
78
|
+
children: S
|
|
65
79
|
}
|
|
66
80
|
),
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
d && /* @__PURE__ */ t(
|
|
82
|
+
g,
|
|
69
83
|
{
|
|
70
84
|
variant: "body2",
|
|
71
|
-
id:
|
|
72
|
-
className: a("Bear-AlertDialog__description",
|
|
73
|
-
children:
|
|
85
|
+
id: _,
|
|
86
|
+
className: a("Bear-AlertDialog__description", P, o && "bear-text-center"),
|
|
87
|
+
children: d
|
|
74
88
|
}
|
|
75
89
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
90
|
+
/* @__PURE__ */ m("div", { className: a("Bear-AlertDialog__footer", q), children: [
|
|
91
|
+
/* @__PURE__ */ t(
|
|
92
|
+
L,
|
|
79
93
|
{
|
|
80
94
|
variant: "ghost",
|
|
81
|
-
onClick:
|
|
95
|
+
onClick: n,
|
|
82
96
|
disabled: r,
|
|
83
|
-
children:
|
|
97
|
+
children: x
|
|
84
98
|
}
|
|
85
99
|
),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
L,
|
|
88
102
|
{
|
|
89
|
-
variant:
|
|
90
|
-
onClick:
|
|
103
|
+
variant: I,
|
|
104
|
+
onClick: D,
|
|
91
105
|
loading: r,
|
|
92
|
-
loadingText:
|
|
93
|
-
children:
|
|
106
|
+
loadingText: O,
|
|
107
|
+
children: T
|
|
94
108
|
}
|
|
95
109
|
)
|
|
96
110
|
] })
|
|
@@ -100,8 +114,8 @@ const z = (_) => {
|
|
|
100
114
|
]
|
|
101
115
|
}
|
|
102
116
|
);
|
|
103
|
-
return
|
|
117
|
+
return j(B, document.body);
|
|
104
118
|
};
|
|
105
119
|
export {
|
|
106
|
-
|
|
120
|
+
W as AlertDialog
|
|
107
121
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
|
|
3
|
-
/** Logo size in pixels */
|
|
4
|
-
size?: number;
|
|
5
|
-
/** Whether to show animated sparkle */
|
|
6
|
-
animated?: boolean;
|
|
7
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BearLogoProps } from './BearLogo.types';
|
|
8
3
|
/**
|
|
9
4
|
* BearLogo - Lotso-inspired pink teddy bear logo from Toy Story
|
|
10
5
|
* Full body sitting teddy bear with characteristic angry eyebrows
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SVGAttributes } from 'react';
|
|
2
|
+
export interface BearLogoProps extends SVGAttributes<SVGElement> {
|
|
3
|
+
/** Logo size in pixels */
|
|
4
|
+
size?: number;
|
|
5
|
+
/** Whether to show animated sparkle */
|
|
6
|
+
animated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface EmberLogoProps {
|
|
9
|
+
/** Logo size in pixels */
|
|
10
|
+
size?: number;
|
|
11
|
+
/** Additional class names */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Whether to animate the logo */
|
|
14
|
+
animated?: boolean;
|
|
15
|
+
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
/** Logo size in pixels */
|
|
4
|
-
size?: number;
|
|
5
|
-
/** Additional class names */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Whether to animate the logo */
|
|
8
|
-
animated?: boolean;
|
|
9
|
-
}
|
|
2
|
+
import { EmberLogoProps } from './BearLogo.types';
|
|
10
3
|
/**
|
|
11
4
|
* Ember Logo Component
|
|
12
5
|
* A stylized flame representing warmth, energy, and the forge
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),N=require("react"),n=require("../../utils/cn.cjs"),q=require("./BiometricIcon.cjs"),z=require("./useBiometric.cjs"),M={sm:48,md:72,lg:96,xl:128},_={sm:80,md:120,lg:160,xl:200},g={idle:"bear-text-gray-500 dark:bear-text-gray-400",scanning:"bear-text-bear-500 dark:bear-text-bear-400",success:"bear-text-green-500 dark:bear-text-green-400",error:"bear-text-red-500 dark:bear-text-red-400"},i={idle:"var(--bear-border-default)",scanning:"var(--bear-primary-500, #ec4899)",success:"var(--bear-success-500, #22c55e)",error:"var(--bear-danger-500, #ef4444)"},w=({type:b="fingerprint",size:l="md",status:o,label:m,successLabel:p="Verified",errorLabel:x="Try again",scanningLabel:f="Scanning...",onScan:a,onSuccess:y,onError:v,disabled:s=!1,animated:t=!0,className:j,testId:B})=>{const{status:k,scan:u}=z.useBiometric({onSuccess:y,onError:v}),e=o??k,C=M[l],d=_[l],c=e==="scanning"?f:e==="success"?p:e==="error"?x:m,h=N.useCallback(()=>{s||e==="scanning"||(a==null||a(),o===void 0&&u())},[s,e,a,o,u]);return r.jsxs("div",{className:n.cn("Bear-Biometric bear-flex bear-flex-col bear-items-center bear-gap-3",j),"data-testid":B,"data-status":e,"data-type":b,children:[r.jsxs("button",{type:"button",disabled:s||e==="scanning",onClick:h,className:n.cn("Bear-Biometric__trigger bear-relative bear-flex bear-items-center bear-justify-center bear-rounded-full bear-border-0 bear-cursor-pointer bear-outline-none","bear-transition-all bear-duration-300","focus-visible:bear-ring-2 focus-visible:bear-ring-bear-500 focus-visible:bear-ring-offset-2",g[e],s&&"bear-opacity-40 bear-cursor-not-allowed"),style:{width:d,height:d,backgroundColor:"var(--bear-bg-secondary)"},"aria-label":c??"Authenticate",children:[t&&e==="scanning"&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"bear-absolute bear-inset-0 bear-rounded-full bear-animate-ping bear-opacity-20",style:{backgroundColor:i[e]}}),r.jsx("span",{className:"bear-absolute bear-inset-2 bear-rounded-full bear-animate-ping bear-opacity-10",style:{backgroundColor:i[e],animationDelay:"0.3s"}})]}),r.jsx("span",{className:n.cn("bear-absolute bear-inset-0 bear-rounded-full bear-border-2 bear-transition-colors bear-duration-300",e==="scanning"&&t&&"bear-animate-spin"),style:{borderColor:i[e],borderStyle:e==="scanning"?"dashed":"solid",animationDuration:e==="scanning"?"3s":void 0}}),t&&e==="success"&&r.jsx("span",{className:"bear-absolute bear-inset-0 bear-rounded-full bear-opacity-10",style:{backgroundColor:i.success}}),r.jsx(q.BiometricIcon,{type:b,size:C,status:e,animated:t})]}),c&&r.jsx("span",{className:n.cn("Bear-Biometric__label bear-text-sm bear-font-medium bear-transition-colors bear-duration-300",g[e]),children:c})]})};exports.Biometric=w;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs as c, Fragment as _, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as j } from "react";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
|
+
import { BiometricIcon as M } from "./BiometricIcon.js";
|
|
5
|
+
import { useBiometric as w } from "./useBiometric.js";
|
|
6
|
+
const D = { sm: 48, md: 72, lg: 96, xl: 128 }, A = { sm: 80, md: 120, lg: 160, xl: 200 }, g = {
|
|
7
|
+
idle: "bear-text-gray-500 dark:bear-text-gray-400",
|
|
8
|
+
scanning: "bear-text-bear-500 dark:bear-text-bear-400",
|
|
9
|
+
success: "bear-text-green-500 dark:bear-text-green-400",
|
|
10
|
+
error: "bear-text-red-500 dark:bear-text-red-400"
|
|
11
|
+
}, i = {
|
|
12
|
+
idle: "var(--bear-border-default)",
|
|
13
|
+
scanning: "var(--bear-primary-500, #ec4899)",
|
|
14
|
+
success: "var(--bear-success-500, #22c55e)",
|
|
15
|
+
error: "var(--bear-danger-500, #ef4444)"
|
|
16
|
+
}, q = ({
|
|
17
|
+
type: l = "fingerprint",
|
|
18
|
+
size: u = "md",
|
|
19
|
+
status: o,
|
|
20
|
+
label: p,
|
|
21
|
+
successLabel: f = "Verified",
|
|
22
|
+
errorLabel: y = "Try again",
|
|
23
|
+
scanningLabel: x = "Scanning...",
|
|
24
|
+
onScan: a,
|
|
25
|
+
onSuccess: v,
|
|
26
|
+
onError: k,
|
|
27
|
+
disabled: s = !1,
|
|
28
|
+
animated: t = !0,
|
|
29
|
+
className: C,
|
|
30
|
+
testId: h
|
|
31
|
+
}) => {
|
|
32
|
+
const { status: B, scan: d } = w({
|
|
33
|
+
onSuccess: v,
|
|
34
|
+
onError: k
|
|
35
|
+
}), e = o ?? B, N = D[u], m = A[u], b = e === "scanning" ? x : e === "success" ? f : e === "error" ? y : p, z = j(() => {
|
|
36
|
+
s || e === "scanning" || (a == null || a(), o === void 0 && d());
|
|
37
|
+
}, [s, e, a, o, d]);
|
|
38
|
+
return /* @__PURE__ */ c(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: n("Bear-Biometric bear-flex bear-flex-col bear-items-center bear-gap-3", C),
|
|
42
|
+
"data-testid": h,
|
|
43
|
+
"data-status": e,
|
|
44
|
+
"data-type": l,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ c(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
disabled: s || e === "scanning",
|
|
51
|
+
onClick: z,
|
|
52
|
+
className: n(
|
|
53
|
+
"Bear-Biometric__trigger bear-relative bear-flex bear-items-center bear-justify-center bear-rounded-full bear-border-0 bear-cursor-pointer bear-outline-none",
|
|
54
|
+
"bear-transition-all bear-duration-300",
|
|
55
|
+
"focus-visible:bear-ring-2 focus-visible:bear-ring-bear-500 focus-visible:bear-ring-offset-2",
|
|
56
|
+
g[e],
|
|
57
|
+
s && "bear-opacity-40 bear-cursor-not-allowed"
|
|
58
|
+
),
|
|
59
|
+
style: {
|
|
60
|
+
width: m,
|
|
61
|
+
height: m,
|
|
62
|
+
backgroundColor: "var(--bear-bg-secondary)"
|
|
63
|
+
},
|
|
64
|
+
"aria-label": b ?? "Authenticate",
|
|
65
|
+
children: [
|
|
66
|
+
t && e === "scanning" && /* @__PURE__ */ c(_, { children: [
|
|
67
|
+
/* @__PURE__ */ r(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
className: "bear-absolute bear-inset-0 bear-rounded-full bear-animate-ping bear-opacity-20",
|
|
71
|
+
style: { backgroundColor: i[e] }
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ r(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: "bear-absolute bear-inset-2 bear-rounded-full bear-animate-ping bear-opacity-10",
|
|
78
|
+
style: { backgroundColor: i[e], animationDelay: "0.3s" }
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ r(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: n(
|
|
86
|
+
"bear-absolute bear-inset-0 bear-rounded-full bear-border-2 bear-transition-colors bear-duration-300",
|
|
87
|
+
e === "scanning" && t && "bear-animate-spin"
|
|
88
|
+
),
|
|
89
|
+
style: {
|
|
90
|
+
borderColor: i[e],
|
|
91
|
+
borderStyle: e === "scanning" ? "dashed" : "solid",
|
|
92
|
+
animationDuration: e === "scanning" ? "3s" : void 0
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
t && e === "success" && /* @__PURE__ */ r(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: "bear-absolute bear-inset-0 bear-rounded-full bear-opacity-10",
|
|
100
|
+
style: { backgroundColor: i.success }
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ r(M, { type: l, size: N, status: e, animated: t })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
b && /* @__PURE__ */ r(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: n(
|
|
111
|
+
"Bear-Biometric__label bear-text-sm bear-font-medium bear-transition-colors bear-duration-300",
|
|
112
|
+
g[e]
|
|
113
|
+
),
|
|
114
|
+
children: b
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
q as Biometric
|
|
123
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type BiometricType = 'fingerprint' | 'face' | 'iris';
|
|
2
|
+
export type BiometricStatus = 'idle' | 'scanning' | 'success' | 'error';
|
|
3
|
+
export interface BiometricProps {
|
|
4
|
+
type?: BiometricType;
|
|
5
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
status?: BiometricStatus;
|
|
7
|
+
label?: string;
|
|
8
|
+
successLabel?: string;
|
|
9
|
+
errorLabel?: string;
|
|
10
|
+
scanningLabel?: string;
|
|
11
|
+
onScan?: () => void;
|
|
12
|
+
onSuccess?: () => void;
|
|
13
|
+
onError?: () => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
animated?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
testId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface BiometricIconProps {
|
|
20
|
+
type: BiometricType;
|
|
21
|
+
size: number;
|
|
22
|
+
status: BiometricStatus;
|
|
23
|
+
animated: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UseBiometricOptions {
|
|
26
|
+
scanDuration?: number;
|
|
27
|
+
successDuration?: number;
|
|
28
|
+
onSuccess?: () => void;
|
|
29
|
+
onError?: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface UseBiometricReturn {
|
|
32
|
+
status: BiometricStatus;
|
|
33
|
+
scan: () => void;
|
|
34
|
+
reset: () => void;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("../../utils/cn.cjs");require("react");const i=({size:o})=>r.jsxs("svg",{width:o,height:o,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M32 8C20.954 8 12 16.954 12 28v8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.3"}),r.jsx("path",{d:"M52 28v8c0 11.046-8.954 20-20 20",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.3"}),r.jsx("path",{d:"M18 24c0-7.732 6.268-14 14-14s14 6.268 14 14",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.5"}),r.jsx("path",{d:"M18 24v12c0 7.732 6.268 14 14 14",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.5"}),r.jsx("path",{d:"M46 24v12c0 4.418-2.239 8.313-5.644 10.607",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.5"}),r.jsx("path",{d:"M24 22c0-4.418 3.582-8 8-8s8 3.582 8 8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),r.jsx("path",{d:"M24 22v14c0 4.418 3.582 8 8 8s8-3.582 8-8V22",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),r.jsx("path",{d:"M28 22c0-2.209 1.791-4 4-4s4 1.791 4 4v14c0 2.209-1.791 4-4 4s-4-1.791-4-4V22z",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),r.jsx("path",{d:"M32 22v14",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),a=({size:o})=>r.jsxs("svg",{width:o,height:o,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 20V12h8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M52 20V12h-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M12 44v8h8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M52 44v8h-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("circle",{cx:"24",cy:"28",r:"2.5",fill:"currentColor"}),r.jsx("circle",{cx:"40",cy:"28",r:"2.5",fill:"currentColor"}),r.jsx("path",{d:"M26 40c1.5 2 3.5 3 6 3s4.5-1 6-3",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}),r.jsx("path",{d:"M28 34h8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",opacity:"0.5"})]}),d=({size:o})=>r.jsxs("svg",{width:o,height:o,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("ellipse",{cx:"32",cy:"32",rx:"24",ry:"14",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.4"}),r.jsx("circle",{cx:"32",cy:"32",r:"10",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.7"}),r.jsx("circle",{cx:"32",cy:"32",r:"5",fill:"currentColor",opacity:"0.9"}),r.jsx("circle",{cx:"34",cy:"30",r:"1.5",fill:"var(--bear-bg-primary, #fff)"}),r.jsx("path",{d:"M8 32c6-12 16-18 24-18s18 6 24 18",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.3"}),r.jsx("path",{d:"M8 32c6 12 16 18 24 18s18-6 24-18",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.3"})]}),k={fingerprint:i,face:a,iris:d},p=({type:o,size:t,status:e,animated:s})=>{const c=k[o];return r.jsx("div",{className:n.cn("Bear-Biometric__icon bear-relative bear-flex bear-items-center bear-justify-center",s&&e==="scanning"&&"bear-animate-pulse"),children:r.jsx(c,{size:t})})};exports.BiometricIcon=p;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as s } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
4
|
+
const a = ({ size: o }) => /* @__PURE__ */ t("svg", { width: o, height: o, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
5
|
+
/* @__PURE__ */ r("path", { d: "M32 8C20.954 8 12 16.954 12 28v8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.3" }),
|
|
6
|
+
/* @__PURE__ */ r("path", { d: "M52 28v8c0 11.046-8.954 20-20 20", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.3" }),
|
|
7
|
+
/* @__PURE__ */ r("path", { d: "M18 24c0-7.732 6.268-14 14-14s14 6.268 14 14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.5" }),
|
|
8
|
+
/* @__PURE__ */ r("path", { d: "M18 24v12c0 7.732 6.268 14 14 14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.5" }),
|
|
9
|
+
/* @__PURE__ */ r("path", { d: "M46 24v12c0 4.418-2.239 8.313-5.644 10.607", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.5" }),
|
|
10
|
+
/* @__PURE__ */ r("path", { d: "M24 22c0-4.418 3.582-8 8-8s8 3.582 8 8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.7" }),
|
|
11
|
+
/* @__PURE__ */ r("path", { d: "M24 22v14c0 4.418 3.582 8 8 8s8-3.582 8-8V22", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.7" }),
|
|
12
|
+
/* @__PURE__ */ r("path", { d: "M28 22c0-2.209 1.791-4 4-4s4 1.791 4 4v14c0 2.209-1.791 4-4 4s-4-1.791-4-4V22z", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
13
|
+
/* @__PURE__ */ r("path", { d: "M32 22v14", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" })
|
|
14
|
+
] }), d = ({ size: o }) => /* @__PURE__ */ t("svg", { width: o, height: o, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
15
|
+
/* @__PURE__ */ r("path", { d: "M12 20V12h8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
16
|
+
/* @__PURE__ */ r("path", { d: "M52 20V12h-8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
17
|
+
/* @__PURE__ */ r("path", { d: "M12 44v8h8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
18
|
+
/* @__PURE__ */ r("path", { d: "M52 44v8h-8", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
19
|
+
/* @__PURE__ */ r("circle", { cx: "24", cy: "28", r: "2.5", fill: "currentColor" }),
|
|
20
|
+
/* @__PURE__ */ r("circle", { cx: "40", cy: "28", r: "2.5", fill: "currentColor" }),
|
|
21
|
+
/* @__PURE__ */ r("path", { d: "M26 40c1.5 2 3.5 3 6 3s4.5-1 6-3", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
22
|
+
/* @__PURE__ */ r("path", { d: "M28 34h8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", opacity: "0.5" })
|
|
23
|
+
] }), p = ({ size: o }) => /* @__PURE__ */ t("svg", { width: o, height: o, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
24
|
+
/* @__PURE__ */ r("ellipse", { cx: "32", cy: "32", rx: "24", ry: "14", stroke: "currentColor", strokeWidth: "2.5", opacity: "0.4" }),
|
|
25
|
+
/* @__PURE__ */ r("circle", { cx: "32", cy: "32", r: "10", stroke: "currentColor", strokeWidth: "2.5", opacity: "0.7" }),
|
|
26
|
+
/* @__PURE__ */ r("circle", { cx: "32", cy: "32", r: "5", fill: "currentColor", opacity: "0.9" }),
|
|
27
|
+
/* @__PURE__ */ r("circle", { cx: "34", cy: "30", r: "1.5", fill: "var(--bear-bg-primary, #fff)" }),
|
|
28
|
+
/* @__PURE__ */ r("path", { d: "M8 32c6-12 16-18 24-18s18 6 24 18", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.3" }),
|
|
29
|
+
/* @__PURE__ */ r("path", { d: "M8 32c6 12 16 18 24 18s18-6 24-18", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.3" })
|
|
30
|
+
] }), k = { fingerprint: a, face: d, iris: p }, C = ({ type: o, size: e, status: c, animated: n }) => {
|
|
31
|
+
const i = k[o];
|
|
32
|
+
return /* @__PURE__ */ r(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: s(
|
|
36
|
+
"Bear-Biometric__icon bear-relative bear-flex bear-items-center bear-justify-center",
|
|
37
|
+
n && c === "scanning" && "bear-animate-pulse"
|
|
38
|
+
),
|
|
39
|
+
children: /* @__PURE__ */ r(i, { size: e })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
C as BiometricIcon
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),d=(o={})=>{const{scanDuration:a=2e3,successDuration:r=1500,onSuccess:c,onError:u}=o,[i,e]=s.useState("idle"),t=s.useRef(),n=s.useCallback(()=>{t.current&&clearTimeout(t.current)},[]),l=s.useCallback(()=>{n(),e("idle")},[n]),m=s.useCallback(()=>{i!=="scanning"&&(n(),e("scanning"),t.current=setTimeout(()=>{Math.random()>.2?(e("success"),c==null||c(),t.current=setTimeout(()=>e("idle"),r)):(e("error"),u==null||u(),t.current=setTimeout(()=>e("idle"),r))},a))},[i,n,a,r,c,u]);return{status:i,scan:m,reset:l}};exports.useBiometric=d;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState as f, useRef as d, useCallback as i } from "react";
|
|
2
|
+
const S = (a = {}) => {
|
|
3
|
+
const {
|
|
4
|
+
scanDuration: o = 2e3,
|
|
5
|
+
successDuration: r = 1500,
|
|
6
|
+
onSuccess: s,
|
|
7
|
+
onError: c
|
|
8
|
+
} = a, [u, e] = f("idle"), t = d(), n = i(() => {
|
|
9
|
+
t.current && clearTimeout(t.current);
|
|
10
|
+
}, []), l = i(() => {
|
|
11
|
+
n(), e("idle");
|
|
12
|
+
}, [n]), m = i(() => {
|
|
13
|
+
u !== "scanning" && (n(), e("scanning"), t.current = setTimeout(() => {
|
|
14
|
+
Math.random() > 0.2 ? (e("success"), s == null || s(), t.current = setTimeout(() => e("idle"), r)) : (e("error"), c == null || c(), t.current = setTimeout(() => e("idle"), r));
|
|
15
|
+
}, o));
|
|
16
|
+
}, [u, n, o, r, s, c]);
|
|
17
|
+
return { status: u, scan: m, reset: l };
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
S as useBiometric
|
|
21
|
+
};
|