@digiform/wizard 0.2.10 → 0.2.11
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/core/src/types/api.js +12 -0
- package/core/src/types/form-config.js +60 -0
- package/core/src/types/form-wizard-config-schema.js +113 -0
- package/core/src/types/guards.js +19 -0
- package/core/src/types/validation.js +61 -0
- package/core/src/utils/apiBodyUtils.js +95 -0
- package/features/api-integration.d.ts +2 -0
- package/features/api-integration.js +17 -0
- package/features/dialog-system.d.ts +2 -0
- package/features/dialog-system.js +9 -0
- package/features/form-runtime.d.ts +2 -0
- package/features/form-runtime.js +63 -0
- package/features/state-management.d.ts +2 -0
- package/features/state-management.js +21 -0
- package/features/trigger-action-system.d.ts +2 -0
- package/features/trigger-action-system.js +12 -0
- package/features/validation-system.d.ts +2 -0
- package/features/validation-system.js +23 -0
- package/index.js +108 -17470
- package/package.json +35 -30
- package/styles.css +1 -1
- package/ui/src/component-registry/renderComponent.js +11 -0
- package/ui/src/components/FormLayout/FormLayout.js +135 -0
- package/ui/src/components/FormLayout/FormLayout.module.css.js +20 -0
- package/ui/src/components/GridLayout/GridLayout.js +62 -0
- package/ui/src/components/GridLayout/GridLayout.module.css.js +16 -0
- package/ui/src/components/GridLayoutColumn/GridLayoutColumn.js +37 -0
- package/ui/src/components/GridLayoutColumn/GridLayoutColumn.module.css.js +10 -0
- package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js +108 -0
- package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.module.css.js +20 -0
- package/ui/src/components/ProgressLoaderBar/useProgressAnimation.js +31 -0
- package/ui/src/components/ValidationCode/ValidationCode.js +198 -0
- package/ui/src/components/ValidationCode/ValidationCode.module.css.js +20 -0
- package/ui/src/components/alert/alert.js +30 -0
- package/ui/src/components/alert/alert.module.css.js +14 -0
- package/ui/src/components/badge/badge.js +20 -0
- package/ui/src/components/badge/badge.module.css.js +12 -0
- package/ui/src/components/box/box.js +8 -0
- package/ui/src/components/box/box.module.css.js +8 -0
- package/ui/src/components/button/button.js +25 -0
- package/ui/src/components/button/button.module.css.js +18 -0
- package/ui/src/components/card/card.js +106 -0
- package/ui/src/components/card/card.module.css.js +44 -0
- package/ui/src/components/checkbox/checkbox.js +20 -0
- package/ui/src/components/checkbox/checkbox.module.css.js +10 -0
- package/ui/src/components/dialog/dialog.js +67 -0
- package/ui/src/components/dialog/dialog.module.css.js +20 -0
- package/ui/src/components/form-header-base/form-header-base.js +59 -0
- package/ui/src/components/form-header-base/form-header-base.module.css.js +14 -0
- package/ui/src/components/input/input.js +20 -0
- package/ui/src/components/input/input.module.css.js +8 -0
- package/ui/src/components/radio-group/radio-group.js +30 -0
- package/ui/src/components/radio-group/radio-group.module.css.js +14 -0
- package/ui/src/components/select/select.js +115 -0
- package/ui/src/components/select/select.module.css.js +32 -0
- package/ui/src/components/sheet/sheet.js +71 -0
- package/ui/src/components/sheet/sheet.module.css.js +46 -0
- package/ui/src/components/textarea/textarea.js +19 -0
- package/ui/src/components/textarea/textarea.module.css.js +8 -0
- package/ui/src/design-system/components/FormFieldWrapper.js +16 -0
- package/ui/src/lib/assets/icons/Check.js +26 -0
- package/ui/src/lib/assets/icons/ChevronRight.js +26 -0
- package/ui/src/lib/error-boundaries/BaseErrorBoundary.js +155 -0
- package/ui/src/lib/error-boundaries/ComponentErrorBoundary.js +153 -0
- package/ui/src/lib/error-boundaries/FormWizardErrorBoundary.js +107 -0
- package/ui/src/lib/logger.js +106 -0
- package/ui/src/lib/providers/FormEditingContext.js +21 -0
- package/ui/src/lib/queryClient.js +26 -0
- package/ui/src/lib/types/guards.js +11 -0
- package/ui/src/lib/utils/componentUtils.js +38 -0
- package/ui/src/lib/utils/templateDialogResolver.js +85 -0
- package/ui/src/lib/utils/templateUtils.js +52 -0
- package/ui/src/theme/ThemeProvider.js +15 -0
- package/wizard/src/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.js +370 -0
- package/wizard/src/features/api-integration/services/ActionExecutor.js +339 -0
- package/wizard/src/features/api-integration/services/ApiCallExecutor.js +6 -0
- package/wizard/src/features/api-integration/services/ApiCallService.js +309 -0
- package/wizard/src/features/api-integration/services/DialogExecutor.js +6 -0
- package/wizard/src/features/api-integration/services/GenericTriggerService.js +284 -0
- package/wizard/src/features/api-integration/services/NavigationExecutor.js +6 -0
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +115 -0
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.module.css.js +29 -0
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +64 -0
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.module.css.js +22 -0
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +149 -0
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.module.css.js +40 -0
- package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.js +107 -0
- package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.module.css.js +10 -0
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +107 -0
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +16 -0
- package/wizard/src/features/form-runtime/components/FormField.js +405 -0
- package/wizard/src/features/form-runtime/components/FormFooter.js +209 -0
- package/wizard/src/features/form-runtime/components/FormHeader.js +29 -0
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +279 -0
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.module.css.js +20 -0
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +167 -0
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.module.css.js +12 -0
- package/wizard/src/features/form-runtime/components/ProgressLoaderRuntime.js +88 -0
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +61 -0
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.module.css.js +34 -0
- package/wizard/src/features/form-runtime/components/displayValue/displayValue.js +21 -0
- package/wizard/src/features/form-runtime/components/displayValue/displayValue.module.css.js +10 -0
- package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.js +28 -0
- package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.module.css.js +8 -0
- package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js +56 -0
- package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.module.css.js +8 -0
- package/wizard/src/features/form-runtime/config/configResolver.js +38 -0
- package/wizard/src/features/form-runtime/config/templateConfig.js +156 -0
- package/wizard/src/features/form-runtime/config/templateLoader.js +265 -0
- package/wizard/src/features/form-runtime/config/templateUtils.js +14 -0
- package/wizard/src/features/form-runtime/context/LoaderContext.js +36 -0
- package/wizard/src/features/form-runtime/hooks/useApiActions.js +60 -0
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +102 -0
- package/wizard/src/features/form-runtime/hooks/useComponentVisibility.js +18 -0
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +61 -0
- package/wizard/src/features/form-runtime/hooks/useFormContext.js +13 -0
- package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +40 -0
- package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +39 -0
- package/wizard/src/features/form-runtime/utils/componentDisplayValue.js +22 -0
- package/wizard/src/features/form-runtime/utils/errorUtils.js +93 -0
- package/wizard/src/features/form-runtime/utils/fieldHelpers.js +17 -0
- package/wizard/src/features/form-runtime/utils/formDataBuilder.js +10 -0
- package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +52 -0
- package/wizard/src/features/form-runtime/utils/logger.js +111 -0
- package/wizard/src/features/form-runtime/utils/validation.js +100 -0
- package/wizard/src/features/form-runtime/utils/validationUX.js +58 -0
- package/wizard/src/features/form-runtime/utils/visibilityUtils.js +77 -0
- package/wizard/src/features/state-management/machines/actions/componentActions.js +215 -0
- package/wizard/src/features/state-management/machines/actions/navigationActions.js +122 -0
- package/wizard/src/features/state-management/machines/actions/saveActions.js +101 -0
- package/wizard/src/features/state-management/machines/componentTriggerEngine.js +598 -0
- package/wizard/src/features/state-management/machines/formMachine.js +1565 -0
- package/wizard/src/features/state-management/machines/guards/navigationGuards.js +59 -0
- package/wizard/src/features/state-management/machines/guards/saveGuards.js +21 -0
- package/wizard/src/features/state-management/machines/guards/triggerGuards.js +11 -0
- package/wizard/src/features/state-management/machines/helpers/triggerHelpers.js +12 -0
- package/wizard/src/features/state-management/machines/performance.js +56 -0
- package/wizard/src/features/state-management/machines/useFormMachine.js +412 -0
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +46 -0
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +30 -0
- package/wizard/src/features/trigger-action-system/components/ActionManager.js +108 -0
- package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.js +10 -0
- package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.module.css.js +8 -0
- package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +376 -0
- package/wizard/src/features/validation-system/components/ValidationDebugger.js +69 -0
- package/wizard/src/features/validation-system/validation/ActionValidation.js +234 -0
- package/wizard/src/features/validation-system/validation/SchemaBuilder.js +239 -0
- package/wizard/src/features/validation-system/validation/ValidationCache.js +76 -0
- package/wizard/src/features/validation-system/validation/ValidationEngine.js +97 -0
- package/wizard/src/features/validation-system/validation/ValidationExecutor.js +138 -0
- package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +17 -0
- package/wizard/src/features/validation-system/validation/validationService.js +74 -0
- package/wizard/src/renderer/wizardRenderer.js +123 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { CheckCircle as A, AlertCircle as B, RefreshCw as E } from "lucide-react";
|
|
4
|
+
import * as r from "react";
|
|
5
|
+
import { clsx as I } from "clsx";
|
|
6
|
+
import { useProgressAnimation as T } from "./useProgressAnimation.js";
|
|
7
|
+
import a from "./ProgressLoaderBar.module.css.js";
|
|
8
|
+
const k = {
|
|
9
|
+
slow: 2,
|
|
10
|
+
normal: 1,
|
|
11
|
+
fast: 0.5
|
|
12
|
+
}, C = r.forwardRef(
|
|
13
|
+
({
|
|
14
|
+
label: t,
|
|
15
|
+
showPercentage: m = !1,
|
|
16
|
+
mode: i = "determinate",
|
|
17
|
+
value: o = 0,
|
|
18
|
+
duration: g = 3e3,
|
|
19
|
+
size: j = "md",
|
|
20
|
+
variant: D = "default",
|
|
21
|
+
barColor: U,
|
|
22
|
+
trackColor: h,
|
|
23
|
+
status: e = "loading",
|
|
24
|
+
completionConfig: u,
|
|
25
|
+
errorConfig: n,
|
|
26
|
+
onComplete: d,
|
|
27
|
+
onError: p,
|
|
28
|
+
onRetry: y,
|
|
29
|
+
animationSpeed: N = "normal",
|
|
30
|
+
className: b,
|
|
31
|
+
...M
|
|
32
|
+
}, v) => {
|
|
33
|
+
const P = r.useMemo(() => g * k[N], [g, N]), [w, x] = r.useState(o), L = r.useCallback((R) => {
|
|
34
|
+
x(R);
|
|
35
|
+
}, []), c = o > 0;
|
|
36
|
+
T(
|
|
37
|
+
c ? o : 100,
|
|
38
|
+
P,
|
|
39
|
+
L,
|
|
40
|
+
!c && e === "loading"
|
|
41
|
+
), r.useEffect(() => {
|
|
42
|
+
c && x(o);
|
|
43
|
+
}, [o, c]), r.useEffect(() => {
|
|
44
|
+
e === "complete" && d && d();
|
|
45
|
+
}, [e, d]), r.useEffect(() => {
|
|
46
|
+
e === "error" && p && p();
|
|
47
|
+
}, [e, p]);
|
|
48
|
+
const f = Math.round(w);
|
|
49
|
+
return /* @__PURE__ */ s(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: I(a.wrapper, b),
|
|
53
|
+
role: "progressbar",
|
|
54
|
+
"aria-label": M["aria-label"] || t || "Progress",
|
|
55
|
+
"aria-valuenow": i === "determinate" ? f : void 0,
|
|
56
|
+
"aria-valuemin": 0,
|
|
57
|
+
"aria-valuemax": 100,
|
|
58
|
+
"aria-valuetext": i === "determinate" ? `${f}% complete` : "Loading, please wait",
|
|
59
|
+
"aria-busy": e === "loading",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ l(
|
|
62
|
+
"progress",
|
|
63
|
+
{
|
|
64
|
+
ref: v,
|
|
65
|
+
className: a.progress,
|
|
66
|
+
value: w,
|
|
67
|
+
max: 100,
|
|
68
|
+
style: {
|
|
69
|
+
...h && { backgroundColor: h }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
(t || m) && /* @__PURE__ */ s("label", { className: a.progressLabel, children: [
|
|
74
|
+
t,
|
|
75
|
+
t && m && i === "determinate" && " - ",
|
|
76
|
+
m && i === "determinate" && `${f}%`
|
|
77
|
+
] }),
|
|
78
|
+
e === "complete" && u?.showMessage?.enabled && /* @__PURE__ */ s("div", { className: a.completionMessage, children: [
|
|
79
|
+
/* @__PURE__ */ l(A, { className: "h-4 w-4" }),
|
|
80
|
+
/* @__PURE__ */ l("span", { children: u.showMessage.text })
|
|
81
|
+
] }),
|
|
82
|
+
e === "error" && n?.showErrorMessage && /* @__PURE__ */ s("div", { className: a.errorMessage, children: [
|
|
83
|
+
/* @__PURE__ */ s("div", { className: a.errorContent, children: [
|
|
84
|
+
/* @__PURE__ */ l(B, { className: "h-4 w-4" }),
|
|
85
|
+
/* @__PURE__ */ l("span", { children: n.errorText })
|
|
86
|
+
] }),
|
|
87
|
+
n.allowRetry && /* @__PURE__ */ s(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
onClick: y,
|
|
92
|
+
className: a.retryButton,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ l(E, { className: "h-3 w-3" }),
|
|
95
|
+
n.retryButtonText
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
C.displayName = "ProgressLoaderBar";
|
|
106
|
+
export {
|
|
107
|
+
C as ProgressLoaderBar
|
|
108
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e = "fb-wrapper_nDU5Q", r = "fb-progress_jf4Xd", s = "fb-progressLabel_3nfSJ", o = "fb-completionMessage_OyQ9C", t = "fb-errorMessage_B8dGO", n = "fb-errorContent_2TAc5", p = "fb-retryButton_0HfjY", a = {
|
|
3
|
+
wrapper: e,
|
|
4
|
+
progress: r,
|
|
5
|
+
progressLabel: s,
|
|
6
|
+
completionMessage: o,
|
|
7
|
+
errorMessage: t,
|
|
8
|
+
errorContent: n,
|
|
9
|
+
retryButton: p
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
o as completionMessage,
|
|
13
|
+
a as default,
|
|
14
|
+
n as errorContent,
|
|
15
|
+
t as errorMessage,
|
|
16
|
+
r as progress,
|
|
17
|
+
s as progressLabel,
|
|
18
|
+
p as retryButton,
|
|
19
|
+
e as wrapper
|
|
20
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as p, useEffect as c } from "react";
|
|
3
|
+
function T(e, r, m, s = !0) {
|
|
4
|
+
const n = p({
|
|
5
|
+
displayProgress: 0,
|
|
6
|
+
animationFrame: null,
|
|
7
|
+
lastUpdateTime: 0,
|
|
8
|
+
startTime: 0
|
|
9
|
+
});
|
|
10
|
+
c(() => {
|
|
11
|
+
if (!s) {
|
|
12
|
+
n.current.animationFrame && (cancelAnimationFrame(n.current.animationFrame), n.current.animationFrame = null);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const a = n.current;
|
|
16
|
+
a.lastUpdateTime === 0 && (a.startTime = performance.now(), a.lastUpdateTime = a.startTime);
|
|
17
|
+
const o = (l) => {
|
|
18
|
+
const t = n.current, u = (l - t.startTime) / r * 100, i = Math.min(u, e);
|
|
19
|
+
t.displayProgress = i, t.lastUpdateTime = l, m(i), i < e ? t.animationFrame = requestAnimationFrame(o) : t.animationFrame = null;
|
|
20
|
+
};
|
|
21
|
+
return a.animationFrame = requestAnimationFrame(o), () => {
|
|
22
|
+
a.animationFrame && (cancelAnimationFrame(a.animationFrame), a.animationFrame = null);
|
|
23
|
+
};
|
|
24
|
+
}, [e, r, m, s]), c(() => {
|
|
25
|
+
const a = n.current;
|
|
26
|
+
(Math.abs(e - a.displayProgress) > 10 || e < a.displayProgress) && (a.startTime = performance.now(), a.lastUpdateTime = a.startTime, a.displayProgress = 0);
|
|
27
|
+
}, [e]);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
T as useProgressAnimation
|
|
31
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as F, jsx as a, Fragment as te } from "react/jsx-runtime";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { clsx as ne } from "clsx";
|
|
5
|
+
import S from "./ValidationCode.module.css.js";
|
|
6
|
+
const ce = "^[0-9]+$";
|
|
7
|
+
function re(v) {
|
|
8
|
+
const C = n.useRef();
|
|
9
|
+
return n.useEffect(() => {
|
|
10
|
+
C.current = v;
|
|
11
|
+
}), C.current;
|
|
12
|
+
}
|
|
13
|
+
function X(v) {
|
|
14
|
+
return /* @__PURE__ */ F("div", { className: ne(S.vcSlot, v.isActive && S.vcSlotActive), children: [
|
|
15
|
+
v.hasFakeCaret && /* @__PURE__ */ a(se, {}),
|
|
16
|
+
v.char !== null && /* @__PURE__ */ a("div", { children: v.char })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
function se() {
|
|
20
|
+
return /* @__PURE__ */ a("div", { className: S.vcCaret, children: /* @__PURE__ */ a("div", {}) });
|
|
21
|
+
}
|
|
22
|
+
const le = n.forwardRef(
|
|
23
|
+
({
|
|
24
|
+
value: v,
|
|
25
|
+
onChange: C,
|
|
26
|
+
maxLength: c,
|
|
27
|
+
onComplete: H,
|
|
28
|
+
...u
|
|
29
|
+
}, Y) => {
|
|
30
|
+
const [q, J] = n.useState(
|
|
31
|
+
typeof u.defaultValue == "string" ? u.defaultValue : ""
|
|
32
|
+
), p = n.useMemo(
|
|
33
|
+
() => new RegExp(ce),
|
|
34
|
+
[]
|
|
35
|
+
), r = v ?? q, g = re(r), E = n.useCallback(
|
|
36
|
+
(e) => {
|
|
37
|
+
C?.(e), J(e);
|
|
38
|
+
},
|
|
39
|
+
[C]
|
|
40
|
+
), s = n.useRef(null), G = n.useRef(null), k = n.useRef({
|
|
41
|
+
value: r,
|
|
42
|
+
onChange: E,
|
|
43
|
+
isIOS: typeof window < "u" && window?.CSS?.supports?.("-webkit-touch-callout", "none")
|
|
44
|
+
}), I = n.useRef({
|
|
45
|
+
prev: [
|
|
46
|
+
s.current?.selectionStart,
|
|
47
|
+
s.current?.selectionEnd,
|
|
48
|
+
s.current?.selectionDirection
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
n.useImperativeHandle(
|
|
52
|
+
Y,
|
|
53
|
+
() => s.current,
|
|
54
|
+
[]
|
|
55
|
+
), n.useEffect(() => {
|
|
56
|
+
const e = s.current, t = G.current;
|
|
57
|
+
if (!e || !t && e == null)
|
|
58
|
+
return;
|
|
59
|
+
k.current.value !== e.value && k.current.onChange(e.value), I.current.prev = [
|
|
60
|
+
e.selectionStart,
|
|
61
|
+
e.selectionEnd,
|
|
62
|
+
e.selectionDirection
|
|
63
|
+
];
|
|
64
|
+
function d() {
|
|
65
|
+
if (document.activeElement !== e) {
|
|
66
|
+
_(null), V(null);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!e)
|
|
70
|
+
return;
|
|
71
|
+
const l = e.selectionStart, w = e.selectionEnd, T = e.selectionDirection, M = e.maxLength, i = e.value, f = I.current.prev;
|
|
72
|
+
let o = -1, h = -1, R;
|
|
73
|
+
if (i.length !== 0 && l !== null && w !== null) {
|
|
74
|
+
const L = l === w, x = l === i.length && i.length < M;
|
|
75
|
+
if (L && !x) {
|
|
76
|
+
const m = l;
|
|
77
|
+
if (m === 0)
|
|
78
|
+
o = 0, h = 1, R = "forward";
|
|
79
|
+
else if (m === M)
|
|
80
|
+
o = m - 1, h = m, R = "backward";
|
|
81
|
+
else if (M > 1 && i.length > 1) {
|
|
82
|
+
let N = 0;
|
|
83
|
+
if (f[0] !== null && f[1] != null) {
|
|
84
|
+
R = m < f?.[1] ? "backward" : "forward";
|
|
85
|
+
const ee = f[0] === f[1] && f[0] < M;
|
|
86
|
+
R === "backward" && !ee && (N = -1);
|
|
87
|
+
}
|
|
88
|
+
o = N + m, h = N + m + 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
o !== -1 && h !== -1 && o !== h && s.current.setSelectionRange(
|
|
92
|
+
o,
|
|
93
|
+
h,
|
|
94
|
+
R ?? void 0
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
const U = o !== -1 ? o : l, z = h !== -1 ? h : w, Z = R ?? T;
|
|
98
|
+
_(U), V(z), I.current.prev = [U, z, Z];
|
|
99
|
+
}
|
|
100
|
+
document.addEventListener("selectionchange", d, {
|
|
101
|
+
capture: !0
|
|
102
|
+
}), d();
|
|
103
|
+
}, []);
|
|
104
|
+
const [P, $] = n.useState(!1), [y, A] = n.useState(!1), [b, _] = n.useState(null), [D, V] = n.useState(null);
|
|
105
|
+
n.useEffect(() => {
|
|
106
|
+
g !== void 0 && r !== g && g.length < c && r.length === c && H?.(r);
|
|
107
|
+
}, [c, H, g, r]);
|
|
108
|
+
const K = n.useCallback(
|
|
109
|
+
(e) => {
|
|
110
|
+
const t = e.currentTarget.value.slice(0, c);
|
|
111
|
+
if (t.length > 0 && p && !p.test(t)) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
typeof g == "string" && t.length < g.length && document.dispatchEvent(new Event("selectionchange")), E(t);
|
|
116
|
+
},
|
|
117
|
+
[c, E, g, p]
|
|
118
|
+
), Q = n.useCallback(() => {
|
|
119
|
+
if (s.current) {
|
|
120
|
+
const e = Math.min(s.current.value.length, c - 1), t = s.current.value.length;
|
|
121
|
+
s.current?.setSelectionRange(e, t), _(e), V(t);
|
|
122
|
+
}
|
|
123
|
+
A(!0);
|
|
124
|
+
}, [c]), W = n.useCallback(
|
|
125
|
+
(e) => {
|
|
126
|
+
const t = s.current;
|
|
127
|
+
if (!k.current.isIOS || !e.clipboardData || !t)
|
|
128
|
+
return;
|
|
129
|
+
const d = e.clipboardData.getData("text/plain");
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
const l = s.current?.selectionStart ?? void 0, w = s.current?.selectionEnd ?? void 0, i = (l !== w ? r.slice(0, l) + d + r.slice(w) : r.slice(0, l) + d + r.slice(l)).slice(0, c);
|
|
132
|
+
if (i.length > 0 && p && !p.test(i))
|
|
133
|
+
return;
|
|
134
|
+
t.value = i, E(i);
|
|
135
|
+
const f = Math.min(i.length, c - 1), o = i.length;
|
|
136
|
+
t.setSelectionRange(f, o), _(f), V(o);
|
|
137
|
+
},
|
|
138
|
+
[c, E, p, r]
|
|
139
|
+
), O = n.useMemo(() => ({
|
|
140
|
+
slots: Array.from({ length: c }).map((e, t) => {
|
|
141
|
+
const d = y && b !== null && D !== null && (b === D && t === b || t >= b && t < D), l = r[t] !== void 0 ? r[t] : null;
|
|
142
|
+
return {
|
|
143
|
+
char: l,
|
|
144
|
+
isActive: d,
|
|
145
|
+
hasFakeCaret: d && l === null
|
|
146
|
+
};
|
|
147
|
+
}),
|
|
148
|
+
isFocused: y,
|
|
149
|
+
isHovering: !u.disabled && P
|
|
150
|
+
}), [
|
|
151
|
+
y,
|
|
152
|
+
P,
|
|
153
|
+
c,
|
|
154
|
+
D,
|
|
155
|
+
b,
|
|
156
|
+
u.disabled,
|
|
157
|
+
r
|
|
158
|
+
]), j = c >= 6, B = j ? Math.ceil(c / 2) : c;
|
|
159
|
+
return /* @__PURE__ */ F("div", { ref: G, className: S.vcContainer, children: [
|
|
160
|
+
/* @__PURE__ */ a("div", { className: S.vcGroup, children: O.slots.slice(0, B).map((e, t) => /* @__PURE__ */ a(X, { ...e }, `${e.char}-${t}`)) }),
|
|
161
|
+
j && /* @__PURE__ */ F(te, { children: [
|
|
162
|
+
/* @__PURE__ */ a("div", { className: S.vcDash, children: "-" }),
|
|
163
|
+
/* @__PURE__ */ a("div", { className: S.vcGroup, children: O.slots.slice(B).map((e, t) => /* @__PURE__ */ a(X, { ...e }, `${e.char}-${t}`)) })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ a("div", { className: S.vcInput, children: /* @__PURE__ */ a(
|
|
166
|
+
"input",
|
|
167
|
+
{
|
|
168
|
+
...u,
|
|
169
|
+
inputMode: "numeric",
|
|
170
|
+
pattern: p?.source,
|
|
171
|
+
maxLength: c,
|
|
172
|
+
value: r,
|
|
173
|
+
ref: s,
|
|
174
|
+
onPaste: (e) => {
|
|
175
|
+
W(e), u.onPaste?.(e);
|
|
176
|
+
},
|
|
177
|
+
onChange: K,
|
|
178
|
+
onMouseOver: (e) => {
|
|
179
|
+
$(!0), u.onMouseOver?.(e);
|
|
180
|
+
},
|
|
181
|
+
onMouseLeave: (e) => {
|
|
182
|
+
$(!1), u.onMouseLeave?.(e);
|
|
183
|
+
},
|
|
184
|
+
onFocus: (e) => {
|
|
185
|
+
Q(), u.onFocus?.(e);
|
|
186
|
+
},
|
|
187
|
+
onBlur: (e) => {
|
|
188
|
+
A(!1), u.onBlur?.(e);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
) })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
le.displayName = "ValidationCode";
|
|
196
|
+
export {
|
|
197
|
+
le as ValidationCode
|
|
198
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const c = "fb-vcContainer_oHl8H", t = "fb-vcInput_Nb8NL", v = "fb-vcGroup_5z3tY", o = "fb-vcDash_R8D18", n = "fb-vcSlot_AZfrj", s = "fb-vcSlotActive_1Zqta", e = "fb-vcCaret_pQ-uD", a = {
|
|
3
|
+
vcContainer: c,
|
|
4
|
+
vcInput: t,
|
|
5
|
+
vcGroup: v,
|
|
6
|
+
vcDash: o,
|
|
7
|
+
vcSlot: n,
|
|
8
|
+
vcSlotActive: s,
|
|
9
|
+
vcCaret: e
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
a as default,
|
|
13
|
+
e as vcCaret,
|
|
14
|
+
c as vcContainer,
|
|
15
|
+
o as vcDash,
|
|
16
|
+
v as vcGroup,
|
|
17
|
+
t as vcInput,
|
|
18
|
+
n as vcSlot,
|
|
19
|
+
s as vcSlotActive
|
|
20
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { clsx as i } from "clsx";
|
|
5
|
+
import a from "./alert.module.css.js";
|
|
6
|
+
const m = s.forwardRef(
|
|
7
|
+
({ className: e, variant: r, ...t }, o) => /* @__PURE__ */ l(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
ref: o,
|
|
11
|
+
role: "alert",
|
|
12
|
+
className: i(
|
|
13
|
+
a.alert,
|
|
14
|
+
a[`variant-${r ?? "default"}`],
|
|
15
|
+
e
|
|
16
|
+
),
|
|
17
|
+
...t
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
m.displayName = "Alert";
|
|
22
|
+
const c = s.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ l("h5", { ref: t, className: i(a.alertTitle, e), ...r }));
|
|
23
|
+
c.displayName = "AlertTitle";
|
|
24
|
+
const f = s.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ l("div", { ref: t, className: i(a.alertDescription, e), ...r }));
|
|
25
|
+
f.displayName = "AlertDescription";
|
|
26
|
+
export {
|
|
27
|
+
m as Alert,
|
|
28
|
+
f as AlertDescription,
|
|
29
|
+
c as AlertTitle
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const t = "fb-alert_5UcaT", e = "fb-alertTitle_-KE5o", a = "fb-alertDescription_cg7Ke", r = {
|
|
3
|
+
alert: t,
|
|
4
|
+
"variant-default": "fb-variant-default_yhEpY",
|
|
5
|
+
"variant-destructive": "fb-variant-destructive_rafp5",
|
|
6
|
+
alertTitle: e,
|
|
7
|
+
alertDescription: a
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
t as alert,
|
|
11
|
+
a as alertDescription,
|
|
12
|
+
e as alertTitle,
|
|
13
|
+
r as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as i } from "clsx";
|
|
4
|
+
import r from "./badge.module.css.js";
|
|
5
|
+
function l({ className: t, variant: e, ...o }) {
|
|
6
|
+
return /* @__PURE__ */ a(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
className: i(
|
|
10
|
+
r.badge,
|
|
11
|
+
r[`variant-${e ?? "default"}`],
|
|
12
|
+
t
|
|
13
|
+
),
|
|
14
|
+
...o
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
l as Badge
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const a = "fb-badge_Q1h-y", t = {
|
|
3
|
+
badge: a,
|
|
4
|
+
"variant-default": "fb-variant-default_7HL-r",
|
|
5
|
+
"variant-secondary": "fb-variant-secondary_knrZF",
|
|
6
|
+
"variant-destructive": "fb-variant-destructive_YUruN",
|
|
7
|
+
"variant-outline": "fb-variant-outline_EHC5j"
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
a as badge,
|
|
11
|
+
t as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as e } from "clsx";
|
|
4
|
+
import m from "./box.module.css.js";
|
|
5
|
+
const n = ({ className: o, children: r, ...t }) => /* @__PURE__ */ s("div", { className: e(m.boxContainer, o), ...t, children: r });
|
|
6
|
+
export {
|
|
7
|
+
n as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import { Slot as i } from "@radix-ui/react-slot";
|
|
4
|
+
import * as l from "react";
|
|
5
|
+
import { clsx as n } from "clsx";
|
|
6
|
+
import t from "./button.module.css.js";
|
|
7
|
+
const p = l.forwardRef(
|
|
8
|
+
({ className: o, variant: r, size: m, asChild: e = !1, ...s }, a) => /* @__PURE__ */ f(
|
|
9
|
+
e ? i : "button",
|
|
10
|
+
{
|
|
11
|
+
className: n(
|
|
12
|
+
t.button,
|
|
13
|
+
t[`variant-${r ?? "default"}`],
|
|
14
|
+
t[`size-${m ?? "default"}`],
|
|
15
|
+
o
|
|
16
|
+
),
|
|
17
|
+
ref: a,
|
|
18
|
+
...s
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
p.displayName = "Button";
|
|
23
|
+
export {
|
|
24
|
+
p as Button
|
|
25
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const t = "fb-button_MJLDl", a = {
|
|
3
|
+
button: t,
|
|
4
|
+
"variant-default": "fb-variant-default_KLx8b",
|
|
5
|
+
"variant-destructive": "fb-variant-destructive_vQKZ2",
|
|
6
|
+
"variant-outline": "fb-variant-outline_1Mb0E",
|
|
7
|
+
"variant-secondary": "fb-variant-secondary_-bohS",
|
|
8
|
+
"variant-ghost": "fb-variant-ghost_qml-f",
|
|
9
|
+
"variant-link": "fb-variant-link_aNj3r",
|
|
10
|
+
"size-default": "fb-size-default_9qKVU",
|
|
11
|
+
"size-sm": "fb-size-sm_MvjvS",
|
|
12
|
+
"size-lg": "fb-size-lg_v6n8j",
|
|
13
|
+
"size-icon": "fb-size-icon_MYsET"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
t as button,
|
|
17
|
+
a as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c, jsxs as o } from "react/jsx-runtime";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { clsx as t } from "clsx";
|
|
5
|
+
import a from "./card.module.css.js";
|
|
6
|
+
const m = s.createContext({
|
|
7
|
+
variant: "default"
|
|
8
|
+
}), N = s.forwardRef(({ className: e, ...r }, d) => /* @__PURE__ */ c("div", { ref: d, className: t(a.cardHeader, e), ...r }));
|
|
9
|
+
N.displayName = "CardHeader";
|
|
10
|
+
const v = s.forwardRef(({ className: e, ...r }, d) => /* @__PURE__ */ c("h3", { ref: d, className: t(a.cardTitle, e), ...r }));
|
|
11
|
+
v.displayName = "CardTitle";
|
|
12
|
+
const h = s.forwardRef(({ className: e, ...r }, d) => /* @__PURE__ */ c(
|
|
13
|
+
"p",
|
|
14
|
+
{
|
|
15
|
+
ref: d,
|
|
16
|
+
className: t(a.cardDescription, e),
|
|
17
|
+
...r
|
|
18
|
+
}
|
|
19
|
+
));
|
|
20
|
+
h.displayName = "CardDescription";
|
|
21
|
+
const y = s.forwardRef(({ className: e, ...r }, d) => /* @__PURE__ */ c("div", { ref: d, className: t(a.cardContent, e), ...r }));
|
|
22
|
+
y.displayName = "CardContent";
|
|
23
|
+
function x({
|
|
24
|
+
className: e,
|
|
25
|
+
...r
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ c("div", { className: t(a.cardFooter, e), ...r });
|
|
28
|
+
}
|
|
29
|
+
function H({
|
|
30
|
+
title: e,
|
|
31
|
+
description: r,
|
|
32
|
+
badge: d,
|
|
33
|
+
meta: i,
|
|
34
|
+
action: n,
|
|
35
|
+
className: p
|
|
36
|
+
}) {
|
|
37
|
+
const { variant: u } = s.useContext(m);
|
|
38
|
+
return /* @__PURE__ */ o(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: t(
|
|
42
|
+
a.cardHeaderStructured,
|
|
43
|
+
u === "compact" && a.cardHeaderStructuredCompact,
|
|
44
|
+
p
|
|
45
|
+
),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ o("div", { className: a.cardHeaderLeft, children: [
|
|
48
|
+
/* @__PURE__ */ o("div", { className: a.cardTitleRow, children: [
|
|
49
|
+
/* @__PURE__ */ c("span", { className: a.cardTitleText, children: e }),
|
|
50
|
+
d
|
|
51
|
+
] }),
|
|
52
|
+
r && /* @__PURE__ */ c("p", { className: a.cardDescriptionText, children: r }),
|
|
53
|
+
i && i.length > 0 && /* @__PURE__ */ c("div", { className: a.cardMeta, children: i.map((l, f) => /* @__PURE__ */ o("span", { className: a.cardMetaItem, children: [
|
|
54
|
+
l.icon,
|
|
55
|
+
l.label
|
|
56
|
+
] }, f)) })
|
|
57
|
+
] }),
|
|
58
|
+
n && /* @__PURE__ */ c("div", { className: a.cardHeaderRight, children: n })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function R({ children: e, flush: r, className: d }) {
|
|
64
|
+
return /* @__PURE__ */ c(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: t(
|
|
68
|
+
r ? a.cardBodyFlush : a.cardBody,
|
|
69
|
+
d
|
|
70
|
+
),
|
|
71
|
+
children: e
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function D() {
|
|
76
|
+
return /* @__PURE__ */ c("div", { className: a.cardDivider });
|
|
77
|
+
}
|
|
78
|
+
const C = s.forwardRef(
|
|
79
|
+
({ className: e, variant: r = "default", ...d }, i) => /* @__PURE__ */ c(m.Provider, { value: { variant: r }, children: /* @__PURE__ */ c(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: i,
|
|
83
|
+
className: t(
|
|
84
|
+
a.card,
|
|
85
|
+
r === "compact" && a.cardCompact,
|
|
86
|
+
e
|
|
87
|
+
),
|
|
88
|
+
...d
|
|
89
|
+
}
|
|
90
|
+
) })
|
|
91
|
+
);
|
|
92
|
+
C.displayName = "Card";
|
|
93
|
+
const F = Object.assign(C, {
|
|
94
|
+
Header: H,
|
|
95
|
+
Body: R,
|
|
96
|
+
Footer: x,
|
|
97
|
+
Divider: D
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
F as Card,
|
|
101
|
+
y as CardContent,
|
|
102
|
+
h as CardDescription,
|
|
103
|
+
x as CardFooter,
|
|
104
|
+
N as CardHeader,
|
|
105
|
+
v as CardTitle
|
|
106
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const c = "fb-card_Ry9d9", r = "fb-cardCompact_wGBoD", d = "fb-cardHeader_exSCY", t = "fb-cardHeaderStructured_UBow4", a = "fb-cardHeaderStructuredCompact_jH94z", e = "fb-cardHeaderLeft_PnQMU", o = "fb-cardTitleRow_XU5Go", i = "fb-cardTitleText_imcqj", n = "fb-cardDescriptionText_oCoiA", s = "fb-cardMeta_Ch80f", f = "fb-cardMetaItem_ggGU8", b = "fb-cardHeaderRight_rEXk0", _ = "fb-cardBody_lIAav", u = "fb-cardBodyFlush_tfGIm", H = "fb-cardFooter_BAcjS", l = "fb-cardDivider_-i-Kq", T = "fb-cardTitle_mLAib", p = "fb-cardDescription_iLv2K", m = "fb-cardContent_HJ92K", C = {
|
|
3
|
+
card: c,
|
|
4
|
+
cardCompact: r,
|
|
5
|
+
cardHeader: d,
|
|
6
|
+
cardHeaderStructured: t,
|
|
7
|
+
cardHeaderStructuredCompact: a,
|
|
8
|
+
cardHeaderLeft: e,
|
|
9
|
+
cardTitleRow: o,
|
|
10
|
+
cardTitleText: i,
|
|
11
|
+
cardDescriptionText: n,
|
|
12
|
+
cardMeta: s,
|
|
13
|
+
cardMetaItem: f,
|
|
14
|
+
cardHeaderRight: b,
|
|
15
|
+
cardBody: _,
|
|
16
|
+
cardBodyFlush: u,
|
|
17
|
+
cardFooter: H,
|
|
18
|
+
cardDivider: l,
|
|
19
|
+
cardTitle: T,
|
|
20
|
+
cardDescription: p,
|
|
21
|
+
cardContent: m
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
c as card,
|
|
25
|
+
_ as cardBody,
|
|
26
|
+
u as cardBodyFlush,
|
|
27
|
+
r as cardCompact,
|
|
28
|
+
m as cardContent,
|
|
29
|
+
p as cardDescription,
|
|
30
|
+
n as cardDescriptionText,
|
|
31
|
+
l as cardDivider,
|
|
32
|
+
H as cardFooter,
|
|
33
|
+
d as cardHeader,
|
|
34
|
+
e as cardHeaderLeft,
|
|
35
|
+
b as cardHeaderRight,
|
|
36
|
+
t as cardHeaderStructured,
|
|
37
|
+
a as cardHeaderStructuredCompact,
|
|
38
|
+
s as cardMeta,
|
|
39
|
+
f as cardMetaItem,
|
|
40
|
+
T as cardTitle,
|
|
41
|
+
o as cardTitleRow,
|
|
42
|
+
i as cardTitleText,
|
|
43
|
+
C as default
|
|
44
|
+
};
|