jcicl 1.1.5 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Button/Button.d.ts +1 -0
- package/Button/Button.js +73 -70
- package/DesktopStepper/DesktopStepper.d.ts +24 -0
- package/DesktopStepper/DesktopStepper.js +204 -0
- package/DesktopStepper/index.d.ts +1 -0
- package/DesktopStepper/index.js +5 -0
- package/FieldGroup/FieldGroup.js +15 -12
- package/FieldVisibilityWrapper/FieldVisibilityWrapper.d.ts +11 -0
- package/FieldVisibilityWrapper/FieldVisibilityWrapper.js +48 -0
- package/FieldVisibilityWrapper/index.d.ts +1 -0
- package/FieldVisibilityWrapper/index.js +4 -0
- package/FormContext/createFormContext.js +91 -72
- package/FormContext/types.d.ts +8 -0
- package/FormFields/FormFields.d.ts +2 -2
- package/FormFields/FormFields.js +18 -18
- package/FormInput/FormInput.d.ts +4 -0
- package/FormInput/FormInput.js +39 -14
- package/LabeledCheckbox/LabeledCheckbox.js +4 -4
- package/LabeledCurrencyInput/LabeledCurrencyInput.js +33 -33
- package/LabeledInput/LabeledInput.d.ts +2 -0
- package/LabeledInput/LabeledInput.js +16 -14
- package/LabeledRadio/LabeledRadio.js +12 -12
- package/Nav/Nav.js +174 -151
- package/SelectableItemCard/SelectableItemCard.d.ts +9 -0
- package/SelectableItemCard/SelectableItemCard.js +24 -0
- package/SelectableItemCard/index.d.ts +1 -0
- package/SelectableItemCard/index.js +4 -0
- package/Stepper/Stepper.js +184 -226
- package/Table/Table.js +236 -234
- package/Tabs/Tabs.d.ts +42 -0
- package/Tabs/Tabs.js +121 -0
- package/Tabs/index.d.ts +1 -0
- package/Tabs/index.js +4 -0
- package/api.d.ts +16 -5
- package/api.js +42 -28
- package/assets/style.css +1 -1
- package/assets/tailwind.css +2 -2
- package/constants.js +1 -1
- package/formatters.d.ts +1 -0
- package/formatters.js +30 -17
- package/index.d.ts +2 -0
- package/index.js +64 -62
- package/package.json +1 -1
- package/problemDetails.d.ts +20 -0
- package/problemDetails.js +19 -0
- package/utils.d.ts +2 -2
- package/utils.js +35 -29
- package/validators.d.ts +8 -0
- package/validators.js +19 -9
package/Button/Button.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ButtonProps extends Omit<MuiButtonProps, 'variant' | 'size' | '
|
|
|
11
11
|
textColor?: string;
|
|
12
12
|
customShadow1?: string;
|
|
13
13
|
customShadow2?: string;
|
|
14
|
+
borderColor?: string;
|
|
14
15
|
textToCopy?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare const Button: React.FC<ButtonProps & {
|
package/Button/Button.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { B as
|
|
4
|
-
import { i as
|
|
5
|
-
import { c as
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k } from "react";
|
|
3
|
+
import { B as _ } from "../.chunks/Button.js";
|
|
4
|
+
import { i as N } from "../.chunks/emotion-styled.browser.esm.js";
|
|
5
|
+
import { c as w } from "../.chunks/emotion-react.browser.esm.js";
|
|
6
6
|
import { cn as b } from "../cn.js";
|
|
7
|
-
import
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { useThemeColors as
|
|
10
|
-
import { logger as
|
|
7
|
+
import t from "../theme.js";
|
|
8
|
+
import { Tooltip as j } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { useThemeColors as S } from "../ThemeContext.js";
|
|
10
|
+
import { logger as T } from "../logger.js";
|
|
11
11
|
import { s as x } from "../.chunks/DefaultPropsProvider.js";
|
|
12
12
|
import { B as p } from "../.chunks/ButtonBase.js";
|
|
13
|
-
import { C
|
|
14
|
-
const
|
|
13
|
+
import { C } from "../.chunks/check.js";
|
|
14
|
+
const F = [
|
|
15
15
|
"active",
|
|
16
16
|
"customBackgroundColor",
|
|
17
17
|
"customHoverColor",
|
|
18
18
|
"customTextColor",
|
|
19
19
|
"customShadow1",
|
|
20
|
-
"customShadow2"
|
|
21
|
-
|
|
20
|
+
"customShadow2",
|
|
21
|
+
"borderColor"
|
|
22
|
+
], c = x(_, { shouldForwardProp: (o) => !F.includes(o) })`
|
|
22
23
|
text-transform: none;
|
|
23
24
|
&:disabled {
|
|
24
25
|
opacity: 0.5;
|
|
25
|
-
color: ${
|
|
26
|
+
color: ${t.colors.black};
|
|
26
27
|
display: flex;
|
|
27
28
|
justify-content: center;
|
|
28
29
|
align-items: center;
|
|
@@ -33,11 +34,11 @@ const C = [
|
|
|
33
34
|
align-items: center !important;
|
|
34
35
|
gap: 0.5rem;
|
|
35
36
|
}
|
|
36
|
-
`,
|
|
37
|
-
shouldForwardProp: (
|
|
37
|
+
`, I = `!bg-[${t.colors.green}] !h-10 !border-2 !border-transparent !text-white transition-all duration-[313ms] ease-in !rounded-[32px] !font-normal !py-3 !px-8 !text-base shadow-[0px_0px_2px_1px_rgba(100,100,100,0.63)] hover:!bg-[${t.colors.darkGreen}] hover:shadow-[0px_0px_2px_1px_rgba(0,0,0,0.63)] focus-visible:!bg-[${t.colors.darkGreen}] focus-visible:shadow-[0px_0px_2px_1px_rgba(0,0,0,0.63)] disabled:!bg-[${t.colors.darkGreen}]`, g = `!bg-[${t.colors.gold}] !h-10 !border-2 !border-transparent !text-[${t.colors.midnight}] transition-all duration-[313ms] ease-in !rounded-[32px] !font-normal !py-3 !px-8 !text-base shadow-[0px_0px_2px_1px_rgba(100,100,100,0.63)] hover:!bg-[${t.colors.goldHover}] focus-visible:!bg-[${t.colors.goldHover}] disabled:!bg-[${t.colors.goldHover}]`, G = "!h-10 !border-2 !border-[var(--btn-border)] transition-all duration-[313ms] ease-in !rounded-[32px] !font-normal !py-3 !px-8 !text-base !bg-[var(--btn-bg)] hover:!bg-[var(--btn-hover)] focus-visible:!bg-[var(--btn-hover)] disabled:!bg-[var(--btn-hover)] !text-[var(--btn-text)] !shadow-[var(--btn-shadow)] hover:!shadow-[var(--btn-shadow-hover)] focus-visible:!shadow-[var(--btn-shadow-hover)]", H = x(p, {
|
|
38
|
+
shouldForwardProp: (o) => typeof o == "string" && N(o)
|
|
38
39
|
})(
|
|
39
|
-
({ size:
|
|
40
|
-
...
|
|
40
|
+
({ size: o, color: r, highlightColor: s, hoverColor: i }) => ({
|
|
41
|
+
...w`
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
43
44
|
justify-content: center;
|
|
@@ -49,28 +50,28 @@ const C = [
|
|
|
49
50
|
svg {
|
|
50
51
|
filter: drop-shadow(0 0 6px ${s}) drop-shadow(0 0 6px ${s})
|
|
51
52
|
drop-shadow(0 0 6px ${s}) drop-shadow(0 0 6px ${s});
|
|
52
|
-
fill: ${i ||
|
|
53
|
+
fill: ${i || r};
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
svg {
|
|
57
58
|
transition: 313ms all ease-in-out;
|
|
58
|
-
fill: ${
|
|
59
|
-
width: ${
|
|
60
|
-
height: ${
|
|
59
|
+
fill: ${r};
|
|
60
|
+
width: ${o}px;
|
|
61
|
+
height: ${o}px;
|
|
61
62
|
}
|
|
62
63
|
`
|
|
63
64
|
})
|
|
64
|
-
),
|
|
65
|
-
({ backgroundColor:
|
|
66
|
-
...
|
|
65
|
+
), z = x(p)(
|
|
66
|
+
({ backgroundColor: o, borderColor: r }) => ({
|
|
67
|
+
...w`
|
|
67
68
|
height: 28px;
|
|
68
69
|
border-radius: 20px;
|
|
69
70
|
border-width: 2px;
|
|
70
71
|
border-style: solid;
|
|
71
|
-
border-color: ${
|
|
72
|
-
background: ${
|
|
73
|
-
color: ${
|
|
72
|
+
border-color: ${r}aa ${r} ${r} ${r}aa;
|
|
73
|
+
background: ${o};
|
|
74
|
+
color: ${r};
|
|
74
75
|
padding: 10px;
|
|
75
76
|
font-size: 0.9rem !important;
|
|
76
77
|
font-weight: 500;
|
|
@@ -86,7 +87,7 @@ const C = [
|
|
|
86
87
|
height: 15px;
|
|
87
88
|
margin-left: 5px;
|
|
88
89
|
margin-right: -8px;
|
|
89
|
-
stroke: ${
|
|
90
|
+
stroke: ${r};
|
|
90
91
|
transition: all 313ms ease;
|
|
91
92
|
}
|
|
92
93
|
|
|
@@ -97,79 +98,81 @@ const C = [
|
|
|
97
98
|
}
|
|
98
99
|
`
|
|
99
100
|
})
|
|
100
|
-
),
|
|
101
|
-
variant:
|
|
102
|
-
size:
|
|
101
|
+
), Y = ({
|
|
102
|
+
variant: o = 1,
|
|
103
|
+
size: r = 50,
|
|
103
104
|
color: s,
|
|
104
105
|
highlightColor: i,
|
|
105
|
-
hoverColor:
|
|
106
|
+
hoverColor: l,
|
|
106
107
|
backgroundColor: m,
|
|
107
|
-
textColor:
|
|
108
|
-
customShadow1:
|
|
108
|
+
textColor: d,
|
|
109
|
+
customShadow1: v,
|
|
109
110
|
customShadow2: y,
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
borderColor: u,
|
|
112
|
+
children: n,
|
|
113
|
+
textToCopy: $,
|
|
112
114
|
active: B,
|
|
113
|
-
...
|
|
115
|
+
...a
|
|
114
116
|
}) => {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
+
const f = S();
|
|
118
|
+
return o === "custom" ? /* @__PURE__ */ e(
|
|
117
119
|
"div",
|
|
118
120
|
{
|
|
119
121
|
style: {
|
|
120
|
-
"--btn-bg": m ||
|
|
121
|
-
"--btn-hover":
|
|
122
|
-
"--btn-text":
|
|
123
|
-
"--btn-shadow":
|
|
124
|
-
"--btn-shadow-hover": y ||
|
|
122
|
+
"--btn-bg": m || t.colors.green,
|
|
123
|
+
"--btn-hover": l || t.colors.darkGreen,
|
|
124
|
+
"--btn-text": d || t.colors.white,
|
|
125
|
+
"--btn-shadow": v || t.boxShadows.gray63,
|
|
126
|
+
"--btn-shadow-hover": y || t.boxShadows.black63,
|
|
127
|
+
"--btn-border": u || "transparent",
|
|
125
128
|
display: "contents"
|
|
126
129
|
},
|
|
127
|
-
children: /* @__PURE__ */ e(
|
|
130
|
+
children: /* @__PURE__ */ e(c, { className: b("jcCustomButton", G), ...a, children: n })
|
|
128
131
|
}
|
|
129
|
-
) :
|
|
130
|
-
|
|
132
|
+
) : o === "unstyled" ? /* @__PURE__ */ e(p, { className: "block", ...a, children: n }) : o === "copy" ? /* @__PURE__ */ e(A, { textToCopy: $, muiProps: a, children: n }) : o === 2 ? /* @__PURE__ */ e(c, { className: g, ...a, children: /* @__PURE__ */ e("span", { children: n }) }) : o === "icon" ? (s = s || t.colors.green, i = i || t.colors.dandelion, l = l || t.colors.green, /* @__PURE__ */ e(H, { className: "jcIconButton", ...{ size: r, color: s, highlightColor: i, hoverColor: l }, ...a, children: n })) : o === "filter" ? /* @__PURE__ */ e(
|
|
133
|
+
c,
|
|
131
134
|
{
|
|
132
135
|
className: b(
|
|
133
136
|
"jcFilterButton",
|
|
134
137
|
"!box-border !h-[28px] !rounded-[18px] !flex !items-center !justify-center !border-2 transition-all duration-[108ms] ease-in !font-medium",
|
|
135
|
-
B ?
|
|
138
|
+
B ? `!bg-black !border-transparent !text-white hover:!bg-[${t.colors.charcoal}]` : `!bg-white !border-black !text-black hover:!bg-[${t.colors.gray2}]`
|
|
136
139
|
),
|
|
137
|
-
...
|
|
138
|
-
children:
|
|
140
|
+
...a,
|
|
141
|
+
children: n
|
|
139
142
|
}
|
|
140
|
-
) :
|
|
141
|
-
|
|
143
|
+
) : o === "form" ? /* @__PURE__ */ e(c, { className: b("jcFormButton", g, "!w-[447px] !self-center"), ...a, children: /* @__PURE__ */ e("span", { children: n }) }) : o === "pill" ? /* @__PURE__ */ e(
|
|
144
|
+
z,
|
|
142
145
|
{
|
|
143
|
-
backgroundColor: m ||
|
|
144
|
-
borderColor:
|
|
145
|
-
...
|
|
146
|
-
children: /* @__PURE__ */ e("span", { children:
|
|
146
|
+
backgroundColor: m || f.themeIconBackgroundB,
|
|
147
|
+
borderColor: d || f.themeIconBackgroundA,
|
|
148
|
+
...a,
|
|
149
|
+
children: /* @__PURE__ */ e("span", { children: n })
|
|
147
150
|
}
|
|
148
|
-
) : /* @__PURE__ */ e(
|
|
149
|
-
},
|
|
150
|
-
const [i,
|
|
151
|
-
return /* @__PURE__ */
|
|
151
|
+
) : /* @__PURE__ */ e(c, { className: I, ...a, children: /* @__PURE__ */ e("span", { children: n }) });
|
|
152
|
+
}, A = ({ textToCopy: o, muiProps: r, children: s }) => {
|
|
153
|
+
const [i, l] = k(!1);
|
|
154
|
+
return /* @__PURE__ */ h("div", { className: "flex", onClick: async () => {
|
|
152
155
|
try {
|
|
153
|
-
await navigator.clipboard.writeText(
|
|
154
|
-
} catch (
|
|
155
|
-
|
|
156
|
+
await navigator.clipboard.writeText(o || String(s)), l(!0), setTimeout(() => l(!1), 1100);
|
|
157
|
+
} catch (d) {
|
|
158
|
+
T.error("Failed to copy text: ", d);
|
|
156
159
|
}
|
|
157
160
|
}, children: [
|
|
158
|
-
/* @__PURE__ */ e(
|
|
161
|
+
/* @__PURE__ */ e(j, { title: "Copy to clipboard", children: /* @__PURE__ */ e(
|
|
159
162
|
p,
|
|
160
163
|
{
|
|
161
164
|
className: "block [font-family:inherit] [font-size:inherit] [font-weight:inherit]",
|
|
162
|
-
...
|
|
165
|
+
...r,
|
|
163
166
|
children: s
|
|
164
167
|
}
|
|
165
168
|
) }),
|
|
166
|
-
i && /* @__PURE__ */
|
|
167
|
-
/* @__PURE__ */ e(
|
|
169
|
+
i && /* @__PURE__ */ h("span", { className: `inline ml-2 text-sm text-[${t.colors.gray}] content-center`, children: [
|
|
170
|
+
/* @__PURE__ */ e(C, { size: 12, className: "inline align-middle !h-[14px] !w-[14px] m-0" }),
|
|
168
171
|
" Copied"
|
|
169
172
|
] })
|
|
170
173
|
] });
|
|
171
174
|
};
|
|
172
175
|
export {
|
|
173
|
-
|
|
174
|
-
|
|
176
|
+
Y as Button,
|
|
177
|
+
Y as default
|
|
175
178
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export type StepProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Step: React.FC<PropsWithChildren<StepProps>>;
|
|
8
|
+
/** Imperative handle for driving the stepper from a parent (e.g. jumping to a step with errors). */
|
|
9
|
+
export type DesktopStepperHandle = {
|
|
10
|
+
/** Animate to the given step index (clamped to the valid range). */
|
|
11
|
+
goToStep: (index: number) => void;
|
|
12
|
+
};
|
|
13
|
+
export type DesktopStepperProps = {
|
|
14
|
+
onNext?: (step?: number) => boolean;
|
|
15
|
+
onFinish: () => Promise<void>;
|
|
16
|
+
onBack?: () => void;
|
|
17
|
+
/** If true, the stepper will maintain the height of the tallest step. */
|
|
18
|
+
staticHeight?: boolean;
|
|
19
|
+
/** Optional imperative handle exposing `goToStep` for programmatic navigation. */
|
|
20
|
+
ref?: React.Ref<DesktopStepperHandle>;
|
|
21
|
+
children: React.ReactElement<StepProps>[];
|
|
22
|
+
};
|
|
23
|
+
declare const DesktopStepper: ({ onNext, onBack, onFinish, staticHeight, ref, children, }: PropsWithChildren<DesktopStepperProps>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default DesktopStepper;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { jsx as t, jsxs as p, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useRef as N, Children as le, isValidElement as se, useLayoutEffect as oe, useEffect as ie, useCallback as J, useImperativeHandle as ne, Fragment as ce } from "react";
|
|
3
|
+
import { flushSync as C } from "react-dom";
|
|
4
|
+
import { cn as s } from "../cn.js";
|
|
5
|
+
import { Button as K } from "../Button/Button.js";
|
|
6
|
+
import { Flex as T } from "../Flex/Flex.js";
|
|
7
|
+
import { SlideOut as ae, SlideIn as ue, SlideInReverse as P, SlideOutReverse as de } from "../animation/Slide/Slide.js";
|
|
8
|
+
import { useThemeColors as O } from "../ThemeContext.js";
|
|
9
|
+
import x from "../theme.js";
|
|
10
|
+
import { useIsMobile as U } from "../utils.js";
|
|
11
|
+
import { C as me } from "../.chunks/check.js";
|
|
12
|
+
const Me = ({ title: i, children: n, className: o }) => /* @__PURE__ */ t("div", { title: i, className: s("p-2.5 w-full", o), children: n }), pe = ({ label: i, number: n, completed: o, active: c }) => {
|
|
13
|
+
const h = O(), R = U(), e = {
|
|
14
|
+
"--item-circle-transition-delay": c ? "0.3s" : "0s",
|
|
15
|
+
"--item-circle-border": h.themeColor,
|
|
16
|
+
"--item-circle-bg": c || o ? h.themeColor : "transparent",
|
|
17
|
+
"--item-circle-color": c || o ? x.colors.white : h.themeColor,
|
|
18
|
+
"--label-color": h.themeColor,
|
|
19
|
+
"--label-opacity": c ? 1 : 0.7
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ t("div", { style: e, className: s("stepperTitleItem font-medium justify-center items-center"), children: /* @__PURE__ */ p(T, { column: !0, alignItems: "center", gap: "4px", children: [
|
|
22
|
+
/* @__PURE__ */ t("div", { className: s("itemCircle", "justify-center flex box-border items-center select-none transition-all duration-300 delay-(--item-circle-transition-delay) ease-in-out w-[35px] h-[35px] mx-[8px] rounded-full border-[2px] border-(--item-circle-border) bg-(--item-circle-bg) text-(--item-circle-color)"), children: o ? /* @__PURE__ */ t(me, { size: 18, strokeWidth: 3 }) : n }),
|
|
23
|
+
/* @__PURE__ */ t("div", { className: s("label", "text-(--label-color) text-center opacity-(--label-opacity) transition-[all_0.5s_ease]", R && "px-[5px]"), children: i })
|
|
24
|
+
] }) });
|
|
25
|
+
}, he = ({ activated: i }) => {
|
|
26
|
+
const n = O(), o = {
|
|
27
|
+
"--title-slider-active-color": n.themeColor,
|
|
28
|
+
"--title-slider-active-percent": i ? "50%" : "49%",
|
|
29
|
+
"--title-slider-inactive-color": n.themeLightA,
|
|
30
|
+
"--title-slider-position": i ? "left bottom" : "right bottom"
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ t("div", { className: s("flex-1 h-[3px] rounded-[2px] self-start mt-[16px] bg-[linear-gradient(to_right,var(--title-slider-active-color)_var(--title-slider-active-percent),var(--title-slider-inactive-color)_50%)] bg-size-[200%_100%] bg-[position:var(--title-slider-position)] transition-background-position duration-500 ease-in-out"), style: o });
|
|
33
|
+
}, fe = "relative w-full h-full flex items-center justify-between flex-col gap-[15px] m-0 bg-transparent overflow-hidden", Q = "absolute top-0 w-full h-full", be = "relative w-full [&_.jcSlideContainer]:justify-items-center", Ce = "will-change-[height] transition-[height] duration-500 ease-[cubic-bezier(0.2,0,0,1)]", Ee = ({
|
|
34
|
+
onNext: i = () => !0,
|
|
35
|
+
onBack: n,
|
|
36
|
+
onFinish: o,
|
|
37
|
+
staticHeight: c = !1,
|
|
38
|
+
ref: h,
|
|
39
|
+
children: R
|
|
40
|
+
}) => {
|
|
41
|
+
const [e, w] = y(0), [v, f] = y("forward"), [z, I] = y(null), [B, k] = y(!1), [_, A] = y(!1), D = N(null), L = N([]), M = N(null), g = N(0), d = O(), H = U(), a = le.toArray(R).filter(
|
|
42
|
+
(l) => se(l)
|
|
43
|
+
), E = a.map((l) => l.props.title || ""), X = E.some((l) => l !== ""), u = a.length, Y = {
|
|
44
|
+
"--progress-bar-bg": d.themeLightA,
|
|
45
|
+
"--progress-bar-border": d.themeColor,
|
|
46
|
+
"--progress-bar-color": d.themeColor
|
|
47
|
+
};
|
|
48
|
+
oe(() => {
|
|
49
|
+
if (c) {
|
|
50
|
+
const $ = L.current, V = () => {
|
|
51
|
+
let m = 0;
|
|
52
|
+
$.forEach((S) => {
|
|
53
|
+
if (S) {
|
|
54
|
+
const F = S.getBoundingClientRect().height;
|
|
55
|
+
F > m && (m = F);
|
|
56
|
+
}
|
|
57
|
+
}), I(m ? Math.ceil(m) : null);
|
|
58
|
+
};
|
|
59
|
+
if (V(), typeof ResizeObserver > "u") return;
|
|
60
|
+
const q = [];
|
|
61
|
+
return $.forEach((m) => {
|
|
62
|
+
if (m) {
|
|
63
|
+
const S = new ResizeObserver(V);
|
|
64
|
+
S.observe(m), q.push(S);
|
|
65
|
+
}
|
|
66
|
+
}), () => q.forEach((m) => m.disconnect());
|
|
67
|
+
}
|
|
68
|
+
const l = D.current;
|
|
69
|
+
if (!l) return;
|
|
70
|
+
const r = () => {
|
|
71
|
+
I(Math.ceil(l.getBoundingClientRect().height));
|
|
72
|
+
};
|
|
73
|
+
if (r(), typeof ResizeObserver > "u") return;
|
|
74
|
+
const b = new ResizeObserver(r);
|
|
75
|
+
return b.observe(l), () => b.disconnect();
|
|
76
|
+
}, [e, u, c]), ie(() => () => clearTimeout(M.current ?? void 0), []);
|
|
77
|
+
const j = J(() => {
|
|
78
|
+
A(!0), clearTimeout(M.current ?? void 0), M.current = setTimeout(() => {
|
|
79
|
+
A(!1);
|
|
80
|
+
}, 550);
|
|
81
|
+
}, []), Z = async () => {
|
|
82
|
+
if (e === u - 1) {
|
|
83
|
+
k(!0);
|
|
84
|
+
try {
|
|
85
|
+
await (o == null ? void 0 : o());
|
|
86
|
+
} finally {
|
|
87
|
+
k(!1);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
if (!(i == null ? void 0 : i(e))) {
|
|
91
|
+
k(!1);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
j(), g.current = e, C(() => f("none")), C(() => f("forward")), w((r) => r + 1);
|
|
95
|
+
}
|
|
96
|
+
}, ee = () => {
|
|
97
|
+
j(), g.current = e, C(() => f("none")), C(() => f("reverse")), w((l) => l - 1), n == null || n();
|
|
98
|
+
}, W = J(
|
|
99
|
+
(l) => {
|
|
100
|
+
const r = Math.max(0, Math.min(l, u - 1));
|
|
101
|
+
if (r === e) return;
|
|
102
|
+
j(), g.current = e;
|
|
103
|
+
const b = r > e ? "forward" : "reverse";
|
|
104
|
+
C(() => f("none")), C(() => f(b)), w(r);
|
|
105
|
+
},
|
|
106
|
+
[e, u, j]
|
|
107
|
+
);
|
|
108
|
+
ne(h, () => ({ goToStep: W }), [W]);
|
|
109
|
+
const te = () => /* @__PURE__ */ t(
|
|
110
|
+
K,
|
|
111
|
+
{
|
|
112
|
+
variant: "custom",
|
|
113
|
+
onClick: Z,
|
|
114
|
+
backgroundColor: e === u - 1 ? x.colors.gold : d.themeColor,
|
|
115
|
+
hoverColor: e === u - 1 ? x.colors.goldHover : d.themeDark,
|
|
116
|
+
textColor: e === u - 1 ? x.colors.black : x.colors.white,
|
|
117
|
+
disabled: B,
|
|
118
|
+
children: e === u - 1 ? B ? "Submitting..." : "Submit" : "Next"
|
|
119
|
+
}
|
|
120
|
+
), re = () => /* @__PURE__ */ t(
|
|
121
|
+
K,
|
|
122
|
+
{
|
|
123
|
+
variant: "custom",
|
|
124
|
+
onClick: ee,
|
|
125
|
+
backgroundColor: d.themeLight,
|
|
126
|
+
borderColor: d.themeColor,
|
|
127
|
+
hoverColor: d.themeMediumB,
|
|
128
|
+
textColor: d.themeColor,
|
|
129
|
+
children: "Back"
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
return /* @__PURE__ */ p(T, { column: !0, justifyContent: "center", gap: "10px", className: s("jcStep"), children: [
|
|
133
|
+
/* @__PURE__ */ t(T, { justifyContent: "space-between", width: "90%", className: s("jcDesktopStepHeader", "self-center"), children: E.map((l, r) => /* @__PURE__ */ p(ce, { children: [
|
|
134
|
+
/* @__PURE__ */ t(
|
|
135
|
+
pe,
|
|
136
|
+
{
|
|
137
|
+
label: l,
|
|
138
|
+
number: r + 1,
|
|
139
|
+
completed: r < e,
|
|
140
|
+
active: r === e
|
|
141
|
+
},
|
|
142
|
+
r
|
|
143
|
+
),
|
|
144
|
+
r < E.length - 1 && (H !== X || !H) && /* @__PURE__ */ t(he, { activated: r < e })
|
|
145
|
+
] }, r)) }),
|
|
146
|
+
/* @__PURE__ */ p("div", { className: s("jcStep", fe), style: Y, children: [
|
|
147
|
+
/* @__PURE__ */ p(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: s(be, _ && Ce),
|
|
151
|
+
style: {
|
|
152
|
+
height: c || z != null && _ ? `${z}px` : "auto"
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
c ? /* @__PURE__ */ t(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
"aria-hidden": "true",
|
|
159
|
+
className: "jcStepperMeasure pointer-events-none absolute left-0 top-0 invisible w-full",
|
|
160
|
+
children: a.map((l, r) => /* @__PURE__ */ t(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
ref: (b) => {
|
|
164
|
+
L.current[r] = b;
|
|
165
|
+
},
|
|
166
|
+
className: "w-full",
|
|
167
|
+
children: l
|
|
168
|
+
},
|
|
169
|
+
r
|
|
170
|
+
))
|
|
171
|
+
}
|
|
172
|
+
) : /* @__PURE__ */ t(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
ref: D,
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
className: "jcStepperMeasure pointer-events-none absolute left-0 top-0 invisible w-full",
|
|
178
|
+
children: a[e] ?? null
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
e === 0 && v === "forward" && /* @__PURE__ */ t("div", { className: s("jcSlideContainer"), children: a[e] ?? null }),
|
|
182
|
+
e !== 0 && v === "forward" && /* @__PURE__ */ p(G, { children: [
|
|
183
|
+
/* @__PURE__ */ t("div", { className: s("jcSlideOutContainer", Q), children: /* @__PURE__ */ t(ae, { className: "jcSlideContainer", children: a[g.current] ?? null }) }),
|
|
184
|
+
/* @__PURE__ */ t(ue, { className: "jcSlideContainer", children: a[e] ?? null })
|
|
185
|
+
] }),
|
|
186
|
+
e === u - 1 && v === "reverse" && /* @__PURE__ */ t(P, { className: "jcSlideContainer", children: a[e] ?? null }),
|
|
187
|
+
e !== u - 1 && v === "reverse" && /* @__PURE__ */ p(G, { children: [
|
|
188
|
+
/* @__PURE__ */ t("div", { className: s("jcSlideOutContainer", Q), children: /* @__PURE__ */ t(de, { className: "jcSlideContainer", children: a[g.current] ?? null }) }),
|
|
189
|
+
/* @__PURE__ */ t(P, { className: "jcSlideContainer", children: a[e] ?? null })
|
|
190
|
+
] })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ p(T, { gap: "10px", className: "self-end mb-[5px] mr-[5px]", children: [
|
|
195
|
+
e !== 0 && re(),
|
|
196
|
+
te()
|
|
197
|
+
] })
|
|
198
|
+
] })
|
|
199
|
+
] });
|
|
200
|
+
};
|
|
201
|
+
export {
|
|
202
|
+
Me as Step,
|
|
203
|
+
Ee as default
|
|
204
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, Step, type DesktopStepperProps, type DesktopStepperHandle, type StepProps, } from './DesktopStepper';
|
package/FieldGroup/FieldGroup.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { use as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
context:
|
|
6
|
-
...
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { use as f } from "react";
|
|
3
|
+
import s from "../FormFields/FormFields.js";
|
|
4
|
+
function c({
|
|
5
|
+
context: t,
|
|
6
|
+
...e
|
|
7
7
|
}) {
|
|
8
|
-
const { onFormInputChange:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const { onFormInputChange: n, formData: m, fieldErrors: o } = f(t), a = o ? e.fields.map(
|
|
9
|
+
(r) => o[r.key] ? { ...r, error: !0, helperText: o[r.key] } : r
|
|
10
|
+
) : e.fields;
|
|
11
|
+
return /* @__PURE__ */ u(
|
|
12
|
+
s,
|
|
11
13
|
{
|
|
12
|
-
...
|
|
13
|
-
|
|
14
|
+
...e,
|
|
15
|
+
fields: a,
|
|
16
|
+
onChange: n,
|
|
14
17
|
formDefaults: m
|
|
15
18
|
}
|
|
16
19
|
);
|
|
17
20
|
}
|
|
18
21
|
export {
|
|
19
|
-
|
|
22
|
+
c as default
|
|
20
23
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type FieldVisibilityWrapperProps = {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** Optional duration for the transition in milliseconds */
|
|
5
|
+
duration?: number;
|
|
6
|
+
/** Optional gap between child elements */
|
|
7
|
+
gap?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const FieldVisibilityWrapper: ({ visible, duration, gap, children, className }: FieldVisibilityWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default FieldVisibilityWrapper;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as E, useState as r, useLayoutEffect as H } from "react";
|
|
3
|
+
import { cn as N } from "../cn.js";
|
|
4
|
+
const $ = ({ visible: t, duration: u, gap: p, children: g, className: h }) => {
|
|
5
|
+
const s = E(null), [i, x] = r(), [n, w] = r(null), [y, o] = r(!1), [b, v] = r(t);
|
|
6
|
+
b !== t && (v(t), o(!0)), H(() => {
|
|
7
|
+
var f;
|
|
8
|
+
const e = s.current;
|
|
9
|
+
if (!e) return;
|
|
10
|
+
const d = (f = e.parentElement) == null ? void 0 : f.parentElement;
|
|
11
|
+
if (d) {
|
|
12
|
+
const a = getComputedStyle(d);
|
|
13
|
+
w(a.gap);
|
|
14
|
+
}
|
|
15
|
+
const l = () => {
|
|
16
|
+
const a = Math.ceil(e.getBoundingClientRect().height);
|
|
17
|
+
x(a);
|
|
18
|
+
};
|
|
19
|
+
if (l(), typeof ResizeObserver > "u") return;
|
|
20
|
+
const c = new ResizeObserver(l);
|
|
21
|
+
return c.observe(e), () => c.disconnect();
|
|
22
|
+
}, [p, n]);
|
|
23
|
+
const R = u ?? (i ? i ** (1 / 4) * 125 : 300), z = {
|
|
24
|
+
"--field-wrapper-max-height": t ? `${i}px` : "0px",
|
|
25
|
+
"--field-wrapper-margin-top": t ? "0px" : `-${n ?? "0px"}`,
|
|
26
|
+
"--field-wrapper-duration": `${R}ms`,
|
|
27
|
+
"--field-wrapper-gap": p ?? n ?? "0px"
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ m(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: N(
|
|
33
|
+
"jcFieldVisibilityWrapper",
|
|
34
|
+
"overflow-hidden max-h-(--field-wrapper-max-height) mt-(--field-wrapper-margin-top) ",
|
|
35
|
+
y && "transition-[max-height,margin-top] duration-(--field-wrapper-duration) ease-[cubic-bezier(0.2,0,0,1)]",
|
|
36
|
+
h
|
|
37
|
+
),
|
|
38
|
+
style: z,
|
|
39
|
+
onTransitionEnd: (e) => {
|
|
40
|
+
e.target === e.currentTarget && e.propertyName === "max-height" && o(!1);
|
|
41
|
+
},
|
|
42
|
+
children: /* @__PURE__ */ m("div", { ref: s, className: "grid pb-0.5 gap-(--field-wrapper-gap)", children: g })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
$ as default
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type FieldVisibilityWrapperProps } from './FieldVisibilityWrapper';
|