quirk-ui 0.1.206 → 0.1.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{FormField-CC54vtkW.js → FormField-CNsm6oUT.js} +86 -86
- package/dist/FormField-DKM8k1nK.cjs +1 -0
- package/dist/FormField.css +1 -1
- package/dist/core/components/Modal/index.cjs +1 -1
- package/dist/core/components/Modal/index.mjs +30 -30
- package/dist/index38.css +1 -1
- package/dist/next/blocks/FormBlock/FormField.cjs +1 -1
- package/dist/next/blocks/FormBlock/FormField.mjs +1 -1
- package/dist/next/blocks/FormBlock/index.cjs +1 -1
- package/dist/next/blocks/FormBlock/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/AccordionItem.css.d.ts +0 -13
- package/dist/CategoryFilters.css.d.ts +0 -31
- package/dist/FormField-CrjRuF3o.cjs +0 -1
- package/dist/FormField.css.d.ts +0 -29
- package/dist/HeroSubComponents.css.d.ts +0 -36
- package/dist/NavLink.css.d.ts +0 -95
- package/dist/index.css.d.ts +0 -1
- package/dist/index10.css.d.ts +0 -10
- package/dist/index11.css.d.ts +0 -26
- package/dist/index12.css.d.ts +0 -24
- package/dist/index13.css.d.ts +0 -38
- package/dist/index14.css.d.ts +0 -9
- package/dist/index15.css.d.ts +0 -10
- package/dist/index16.css.d.ts +0 -18
- package/dist/index17.css.d.ts +0 -38
- package/dist/index18.css.d.ts +0 -16
- package/dist/index19.css.d.ts +0 -14
- package/dist/index2.css.d.ts +0 -12
- package/dist/index20.css.d.ts +0 -17
- package/dist/index21.css.d.ts +0 -13
- package/dist/index22.css.d.ts +0 -25
- package/dist/index23.css.d.ts +0 -5
- package/dist/index24.css.d.ts +0 -19
- package/dist/index25.css.d.ts +0 -21
- package/dist/index26.css.d.ts +0 -16
- package/dist/index27.css.d.ts +0 -10
- package/dist/index28.css.d.ts +0 -18
- package/dist/index29.css.d.ts +0 -16
- package/dist/index3.css.d.ts +0 -10
- package/dist/index30.css.d.ts +0 -10
- package/dist/index31.css.d.ts +0 -19
- package/dist/index32.css.d.ts +0 -15
- package/dist/index33.css.d.ts +0 -22
- package/dist/index34.css.d.ts +0 -15
- package/dist/index35.css.d.ts +0 -14
- package/dist/index36.css.d.ts +0 -23
- package/dist/index37.css.d.ts +0 -14
- package/dist/index38.css.d.ts +0 -23
- package/dist/index39.css.d.ts +0 -21
- package/dist/index4.css.d.ts +0 -22
- package/dist/index40.css.d.ts +0 -20
- package/dist/index41.css.d.ts +0 -17
- package/dist/index42.css.d.ts +0 -14
- package/dist/index43.css.d.ts +0 -22
- package/dist/index44.css.d.ts +0 -8
- package/dist/index45.css.d.ts +0 -35
- package/dist/index46.css.d.ts +0 -13
- package/dist/index47.css.d.ts +0 -23
- package/dist/index48.css.d.ts +0 -12
- package/dist/index49.css.d.ts +0 -19
- package/dist/index5.css.d.ts +0 -20
- package/dist/index50.css.d.ts +0 -20
- package/dist/index51.css.d.ts +0 -20
- package/dist/index52.css.d.ts +0 -27
- package/dist/index53.css.d.ts +0 -17
- package/dist/index54.css.d.ts +0 -11
- package/dist/index55.css.d.ts +0 -12
- package/dist/index56.css.d.ts +0 -14
- package/dist/index57.css.d.ts +0 -20
- package/dist/index58.css.d.ts +0 -24
- package/dist/index59.css.d.ts +0 -13
- package/dist/index6.css.d.ts +0 -40
- package/dist/index60.css.d.ts +0 -12
- package/dist/index61.css.d.ts +0 -20
- package/dist/index62.css.d.ts +0 -20
- package/dist/index63.css.d.ts +0 -18
- package/dist/index64.css.d.ts +0 -22
- package/dist/index65.css.d.ts +0 -28
- package/dist/index66.css.d.ts +0 -26
- package/dist/index67.css.d.ts +0 -19
- package/dist/index7.css.d.ts +0 -32
- package/dist/index8.css.d.ts +0 -9
- package/dist/index9.css.d.ts +0 -7
- package/dist/styles.css.d.ts +0 -1
- package/dist/tokens.css.d.ts +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Input as
|
|
3
|
-
import { Textarea as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Input as q } from "./core/components/Input/index.mjs";
|
|
3
|
+
import { Textarea as v } from "./core/components/Textarea/index.mjs";
|
|
4
4
|
import { Select as m } from "./core/components/Select/index.mjs";
|
|
5
5
|
import { Checkbox as _ } from "./core/components/Checkbox/index.mjs";
|
|
6
|
-
import { Radio as
|
|
6
|
+
import { Radio as T } from "./core/components/Radio/index.mjs";
|
|
7
7
|
import { Fieldset as h } from "./core/components/Fieldset/index.mjs";
|
|
8
|
-
import { DatePicker as
|
|
9
|
-
import { Range as
|
|
10
|
-
import './FormField.css';const
|
|
11
|
-
formBlock:
|
|
12
|
-
container:
|
|
13
|
-
formInner:
|
|
14
|
-
maxWidthSm:
|
|
15
|
-
maxWidthMd:
|
|
16
|
-
maxWidthLg:
|
|
8
|
+
import { DatePicker as W } from "./core/components/DatePicker/index.mjs";
|
|
9
|
+
import { Range as k } from "./core/components/Range/index.mjs";
|
|
10
|
+
import './FormField.css';const w = "_formBlock_18qf1_1", L = "_container_18qf1_7", C = "_formInner_18qf1_20", F = "_maxWidthSm_18qf1_26", y = "_maxWidthMd_18qf1_29", B = "_maxWidthLg_18qf1_32", S = "_maxWidthFull_18qf1_35", H = "_heading_18qf1_41", G = "_eyebrow_18qf1_47", M = "_title_18qf1_51", $ = "_disclaimer_18qf1_55", I = "_progress_18qf1_61", D = "_progressHeader_18qf1_67", O = "_stepLabel_18qf1_73", V = "_stepCount_18qf1_79", P = "_stepDescription_18qf1_84", R = "_fields_18qf1_92", j = "_fieldFull_18qf1_99", N = "_fieldHalf_18qf1_103", z = "_fieldThird_18qf1_111", A = "_actions_18qf1_121", E = "_submitButton_18qf1_128", J = "_success_18qf1_134", K = "_errorBanner_18qf1_149", u = {
|
|
11
|
+
formBlock: w,
|
|
12
|
+
container: L,
|
|
13
|
+
formInner: C,
|
|
14
|
+
maxWidthSm: F,
|
|
15
|
+
maxWidthMd: y,
|
|
16
|
+
maxWidthLg: B,
|
|
17
17
|
maxWidthFull: S,
|
|
18
18
|
heading: H,
|
|
19
19
|
eyebrow: G,
|
|
@@ -34,35 +34,35 @@ import './FormField.css';const L = "_formBlock_1lllk_1", C = "_container_1lllk_7
|
|
|
34
34
|
errorBanner: K
|
|
35
35
|
};
|
|
36
36
|
function c(e) {
|
|
37
|
-
return (e ?? []).map((
|
|
38
|
-
label:
|
|
39
|
-
value:
|
|
40
|
-
disabled:
|
|
37
|
+
return (e ?? []).map((r) => ({
|
|
38
|
+
label: r.label,
|
|
39
|
+
value: r.value.current,
|
|
40
|
+
disabled: r.disabled
|
|
41
41
|
}));
|
|
42
42
|
}
|
|
43
43
|
function p(e) {
|
|
44
|
-
return (e ?? []).map((
|
|
45
|
-
label:
|
|
46
|
-
options:
|
|
47
|
-
label:
|
|
48
|
-
value:
|
|
49
|
-
disabled:
|
|
44
|
+
return (e ?? []).map((r) => ({
|
|
45
|
+
label: r.label,
|
|
46
|
+
options: r.options.map((n) => ({
|
|
47
|
+
label: n.label,
|
|
48
|
+
value: n.value.current,
|
|
49
|
+
disabled: n.disabled
|
|
50
50
|
}))
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
53
|
+
function ne({ field: e, value: r, error: n, onChange: o }) {
|
|
54
|
+
const a = e.name.current, b = {
|
|
55
55
|
full: u.fieldFull,
|
|
56
56
|
half: u.fieldHalf,
|
|
57
57
|
third: u.fieldThird
|
|
58
58
|
}[e.width ?? "full"], i = {
|
|
59
|
-
id:
|
|
60
|
-
name:
|
|
59
|
+
id: a,
|
|
60
|
+
name: a,
|
|
61
61
|
label: e.label,
|
|
62
62
|
required: e.required,
|
|
63
63
|
disabled: e.disabled,
|
|
64
64
|
helperText: e.helperText,
|
|
65
|
-
error:
|
|
65
|
+
error: n
|
|
66
66
|
}, d = () => {
|
|
67
67
|
switch (e.fieldType) {
|
|
68
68
|
// ── Text-based inputs ──────────────────────────────────────────────
|
|
@@ -71,67 +71,67 @@ function ae({ field: e, value: t, error: a, onChange: o }) {
|
|
|
71
71
|
case "phone":
|
|
72
72
|
case "number":
|
|
73
73
|
case "url":
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
|
|
74
|
+
return /* @__PURE__ */ s(
|
|
75
|
+
q,
|
|
76
76
|
{
|
|
77
77
|
...i,
|
|
78
78
|
type: e.fieldType === "phone" ? "tel" : e.fieldType,
|
|
79
79
|
placeholder: e.placeholder,
|
|
80
|
-
value:
|
|
80
|
+
value: r ?? "",
|
|
81
81
|
minLength: e.minLength,
|
|
82
82
|
maxLength: e.maxLength,
|
|
83
83
|
fullWidth: !0,
|
|
84
|
-
onChange: (
|
|
84
|
+
onChange: (t) => o(a, t.target.value)
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
// ── Textarea ───────────────────────────────────────────────────────
|
|
88
88
|
case "textarea":
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
return /* @__PURE__ */ s(
|
|
90
|
+
v,
|
|
91
91
|
{
|
|
92
92
|
...i,
|
|
93
93
|
placeholder: e.placeholder,
|
|
94
|
-
value:
|
|
94
|
+
value: r ?? "",
|
|
95
95
|
rows: e.rows ?? 4,
|
|
96
96
|
maxLength: e.maxLength,
|
|
97
97
|
showCharCount: e.showCharCount,
|
|
98
98
|
fullWidth: !0,
|
|
99
|
-
onChange: (
|
|
99
|
+
onChange: (t) => o(a, t.target.value)
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
// ── Select ─────────────────────────────────────────────────────────
|
|
103
103
|
case "select": {
|
|
104
|
-
const
|
|
105
|
-
return /* @__PURE__ */
|
|
104
|
+
const t = e.useOptionGroups ? p(e.optionGroups) : c(e.options);
|
|
105
|
+
return /* @__PURE__ */ s(
|
|
106
106
|
m,
|
|
107
107
|
{
|
|
108
108
|
...i,
|
|
109
109
|
placeholder: e.placeholder,
|
|
110
|
-
options:
|
|
111
|
-
value:
|
|
110
|
+
options: t,
|
|
111
|
+
value: r ?? "",
|
|
112
112
|
fullWidth: !0,
|
|
113
|
-
onChange: (
|
|
113
|
+
onChange: (l) => o(a, l.target.value)
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
// ── Multi-select ───────────────────────────────────────────────────
|
|
118
118
|
case "multiselect": {
|
|
119
|
-
const
|
|
120
|
-
return /* @__PURE__ */
|
|
119
|
+
const t = e.useOptionGroups ? p(e.optionGroups) : c(e.options);
|
|
120
|
+
return /* @__PURE__ */ s(
|
|
121
121
|
m,
|
|
122
122
|
{
|
|
123
123
|
...i,
|
|
124
124
|
multiple: !0,
|
|
125
|
-
options:
|
|
126
|
-
value:
|
|
125
|
+
options: t,
|
|
126
|
+
value: r ?? [],
|
|
127
127
|
showSelectedCount: !0,
|
|
128
|
-
onChange: (
|
|
128
|
+
onChange: (l) => o(a, l)
|
|
129
129
|
}
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
// ── Single checkbox ────────────────────────────────────────────────
|
|
133
133
|
case "checkbox":
|
|
134
|
-
return /* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ s(
|
|
135
135
|
_,
|
|
136
136
|
{
|
|
137
137
|
id: i.id,
|
|
@@ -139,96 +139,96 @@ function ae({ field: e, value: t, error: a, onChange: o }) {
|
|
|
139
139
|
label: e.label,
|
|
140
140
|
required: e.required,
|
|
141
141
|
disabled: e.disabled,
|
|
142
|
-
helperText:
|
|
143
|
-
error: !!
|
|
144
|
-
checked:
|
|
145
|
-
onChange: (
|
|
142
|
+
helperText: n ?? e.helperText,
|
|
143
|
+
error: !!n,
|
|
144
|
+
checked: r ?? !1,
|
|
145
|
+
onChange: (t) => o(a, t.target.checked)
|
|
146
146
|
}
|
|
147
147
|
);
|
|
148
148
|
// ── Checkbox group ─────────────────────────────────────────────────
|
|
149
149
|
case "checkboxGroup": {
|
|
150
|
-
const
|
|
151
|
-
return /* @__PURE__ */
|
|
150
|
+
const t = r ?? [];
|
|
151
|
+
return /* @__PURE__ */ s(h, { legend: e.label, error: !!n, helperText: n, children: c(e.options).map((l) => /* @__PURE__ */ s(
|
|
152
152
|
_,
|
|
153
153
|
{
|
|
154
|
-
id: `${
|
|
155
|
-
name: `${
|
|
156
|
-
label:
|
|
157
|
-
checked:
|
|
158
|
-
disabled:
|
|
154
|
+
id: `${a}-${l.value}`,
|
|
155
|
+
name: `${a}[]`,
|
|
156
|
+
label: l.label,
|
|
157
|
+
checked: t.includes(l.value),
|
|
158
|
+
disabled: l.disabled || e.disabled,
|
|
159
159
|
onChange: (x) => {
|
|
160
|
-
const
|
|
161
|
-
o(
|
|
160
|
+
const f = x.target.checked ? [...t, l.value] : t.filter((g) => g !== l.value);
|
|
161
|
+
o(a, f);
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
|
-
|
|
164
|
+
l.value
|
|
165
165
|
)) });
|
|
166
166
|
}
|
|
167
167
|
// ── Radio group ────────────────────────────────────────────────────
|
|
168
168
|
case "radio":
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
|
|
169
|
+
return /* @__PURE__ */ s(h, { legend: e.label, error: !!n, helperText: n, children: c(e.options).map((t) => /* @__PURE__ */ s(
|
|
170
|
+
T,
|
|
171
171
|
{
|
|
172
|
-
id: `${
|
|
173
|
-
name:
|
|
174
|
-
value:
|
|
175
|
-
label:
|
|
176
|
-
checked:
|
|
177
|
-
disabled:
|
|
172
|
+
id: `${a}-${t.value}`,
|
|
173
|
+
name: a,
|
|
174
|
+
value: t.value,
|
|
175
|
+
label: t.label,
|
|
176
|
+
checked: r === t.value,
|
|
177
|
+
disabled: t.disabled || e.disabled,
|
|
178
178
|
required: e.required,
|
|
179
|
-
onChange: () => o(
|
|
179
|
+
onChange: () => o(a, t.value)
|
|
180
180
|
},
|
|
181
|
-
|
|
181
|
+
t.value
|
|
182
182
|
)) });
|
|
183
183
|
// ── Date picker ────────────────────────────────────────────────────
|
|
184
184
|
case "date":
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
|
|
185
|
+
return /* @__PURE__ */ s(
|
|
186
|
+
W,
|
|
187
187
|
{
|
|
188
188
|
id: i.id,
|
|
189
189
|
name: i.name,
|
|
190
190
|
label: e.label,
|
|
191
191
|
required: e.required,
|
|
192
192
|
disabled: e.disabled,
|
|
193
|
-
helperText:
|
|
194
|
-
error: !!
|
|
195
|
-
value:
|
|
196
|
-
onChange: (
|
|
193
|
+
helperText: n ?? e.helperText,
|
|
194
|
+
error: !!n,
|
|
195
|
+
value: r ?? null,
|
|
196
|
+
onChange: (t) => o(a, t)
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
199
|
// ── Range ──────────────────────────────────────────────────────────
|
|
200
200
|
case "range":
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
-
|
|
201
|
+
return /* @__PURE__ */ s(
|
|
202
|
+
k,
|
|
203
203
|
{
|
|
204
204
|
...i,
|
|
205
|
-
value:
|
|
205
|
+
value: r ?? e.rangeMin ?? 0,
|
|
206
206
|
min: e.rangeMin ?? 0,
|
|
207
207
|
max: e.rangeMax ?? 100,
|
|
208
208
|
step: e.rangeStep ?? 1,
|
|
209
209
|
valuePrefix: e.rangeValuePrefix,
|
|
210
210
|
valueSuffix: e.rangeValueSuffix,
|
|
211
211
|
showValue: !0,
|
|
212
|
-
onChange: (
|
|
212
|
+
onChange: (t) => o(a, t)
|
|
213
213
|
}
|
|
214
214
|
);
|
|
215
215
|
// ── Hidden ─────────────────────────────────────────────────────────
|
|
216
216
|
case "hidden":
|
|
217
|
-
return /* @__PURE__ */
|
|
217
|
+
return /* @__PURE__ */ s(
|
|
218
218
|
"input",
|
|
219
219
|
{
|
|
220
220
|
type: "hidden",
|
|
221
|
-
name:
|
|
222
|
-
value:
|
|
221
|
+
name: a,
|
|
222
|
+
value: r ?? e.hiddenValue ?? ""
|
|
223
223
|
}
|
|
224
224
|
);
|
|
225
225
|
default:
|
|
226
226
|
return null;
|
|
227
227
|
}
|
|
228
228
|
};
|
|
229
|
-
return e.fieldType === "hidden" ? d() : /* @__PURE__ */
|
|
229
|
+
return e.fieldType === "hidden" ? d() : /* @__PURE__ */ s("div", { className: `${b}`, children: d() });
|
|
230
230
|
}
|
|
231
231
|
export {
|
|
232
|
-
|
|
232
|
+
ne as F,
|
|
233
233
|
u as s
|
|
234
234
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./FormField.css');const a=require("react/jsx-runtime"),f=require("./core/components/Input/index.cjs"),v=require("./core/components/Textarea/index.cjs"),_=require("./core/components/Select/index.cjs"),h=require("./core/components/Checkbox/index.cjs"),T=require("./core/components/Radio/index.cjs"),p=require("./core/components/Fieldset/index.cjs"),k=require("./core/components/DatePicker/index.cjs"),W=require("./core/components/Range/index.cjs"),F="_formBlock_18qf1_1",j="_container_18qf1_7",C="_formInner_18qf1_20",w="_maxWidthSm_18qf1_26",L="_maxWidthMd_18qf1_29",y="_maxWidthLg_18qf1_32",S="_maxWidthFull_18qf1_35",B="_heading_18qf1_41",$="_eyebrow_18qf1_47",H="_title_18qf1_51",G="_disclaimer_18qf1_55",I="_progress_18qf1_61",M="_progressHeader_18qf1_67",D="_stepLabel_18qf1_73",O="_stepCount_18qf1_79",P="_stepDescription_18qf1_84",R="_fields_18qf1_92",V="_fieldFull_18qf1_99",N="_fieldHalf_18qf1_103",z="_fieldThird_18qf1_111",A="_actions_18qf1_121",E="_submitButton_18qf1_128",J="_success_18qf1_134",K="_errorBanner_18qf1_149",u={formBlock:F,container:j,formInner:C,maxWidthSm:w,maxWidthMd:L,maxWidthLg:y,maxWidthFull:S,heading:B,eyebrow:$,title:H,disclaimer:G,progress:I,progressHeader:M,stepLabel:D,stepCount:O,stepDescription:P,fields:R,fieldFull:V,fieldHalf:N,fieldThird:z,actions:A,submitButton:E,success:J,errorBanner:K};function i(e){return(e??[]).map(n=>({label:n.label,value:n.value.current,disabled:n.disabled}))}function m(e){return(e??[]).map(n=>({label:n.label,options:n.options.map(s=>({label:s.label,value:s.value.current,disabled:s.disabled}))}))}function Q({field:e,value:n,error:s,onChange:l}){const r=e.name.current,x={full:u.fieldFull,half:u.fieldHalf,third:u.fieldThird}[e.width??"full"],c={id:r,name:r,label:e.label,required:e.required,disabled:e.disabled,helperText:e.helperText,error:s},d=()=>{switch(e.fieldType){case"text":case"email":case"phone":case"number":case"url":return a.jsx(f.Input,{...c,type:e.fieldType==="phone"?"tel":e.fieldType,placeholder:e.placeholder,value:n??"",minLength:e.minLength,maxLength:e.maxLength,fullWidth:!0,onChange:t=>l(r,t.target.value)});case"textarea":return a.jsx(v.Textarea,{...c,placeholder:e.placeholder,value:n??"",rows:e.rows??4,maxLength:e.maxLength,showCharCount:e.showCharCount,fullWidth:!0,onChange:t=>l(r,t.target.value)});case"select":{const t=e.useOptionGroups?m(e.optionGroups):i(e.options);return a.jsx(_.Select,{...c,placeholder:e.placeholder,options:t,value:n??"",fullWidth:!0,onChange:o=>l(r,o.target.value)})}case"multiselect":{const t=e.useOptionGroups?m(e.optionGroups):i(e.options);return a.jsx(_.Select,{...c,multiple:!0,options:t,value:n??[],showSelectedCount:!0,onChange:o=>l(r,o)})}case"checkbox":return a.jsx(h.Checkbox,{id:c.id,name:c.name,label:e.label,required:e.required,disabled:e.disabled,helperText:s??e.helperText,error:!!s,checked:n??!1,onChange:t=>l(r,t.target.checked)});case"checkboxGroup":{const t=n??[];return a.jsx(p.Fieldset,{legend:e.label,error:!!s,helperText:s,children:i(e.options).map(o=>a.jsx(h.Checkbox,{id:`${r}-${o.value}`,name:`${r}[]`,label:o.label,checked:t.includes(o.value),disabled:o.disabled||e.disabled,onChange:b=>{const q=b.target.checked?[...t,o.value]:t.filter(g=>g!==o.value);l(r,q)}},o.value))})}case"radio":return a.jsx(p.Fieldset,{legend:e.label,error:!!s,helperText:s,children:i(e.options).map(t=>a.jsx(T.Radio,{id:`${r}-${t.value}`,name:r,value:t.value,label:t.label,checked:n===t.value,disabled:t.disabled||e.disabled,required:e.required,onChange:()=>l(r,t.value)},t.value))});case"date":return a.jsx(k.DatePicker,{id:c.id,name:c.name,label:e.label,required:e.required,disabled:e.disabled,helperText:s??e.helperText,error:!!s,value:n??null,onChange:t=>l(r,t)});case"range":return a.jsx(W.Range,{...c,value:n??e.rangeMin??0,min:e.rangeMin??0,max:e.rangeMax??100,step:e.rangeStep??1,valuePrefix:e.rangeValuePrefix,valueSuffix:e.rangeValueSuffix,showValue:!0,onChange:t=>l(r,t)});case"hidden":return a.jsx("input",{type:"hidden",name:r,value:n??e.hiddenValue??""});default:return null}};return e.fieldType==="hidden"?d():a.jsx("div",{className:`${x}`,children:d()})}exports.FormField=Q;exports.styles=u;
|
package/dist/FormField.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._formBlock_18qf1_1{width:100%;padding-top:var(--spacing-xl);padding-bottom:var(--spacing-xl)}._container_18qf1_7{width:100%;max-width:var(--layout-width, 1250px);margin:0 auto;padding-left:var(--site-gutter);padding-right:var(--site-gutter);display:flex;flex-direction:column;gap:var(--spacing-lg)}._formInner_18qf1_20{width:100%;margin-left:auto;margin-right:auto}._maxWidthSm_18qf1_26{max-width:480px}._maxWidthMd_18qf1_29{max-width:640px}._maxWidthLg_18qf1_32{max-width:800px}._maxWidthFull_18qf1_35{max-width:100%}._heading_18qf1_41{display:flex;flex-direction:column;gap:var(--spacing-sm)}._eyebrow_18qf1_47{font-weight:var(--font-weight-bold)}._title_18qf1_51{text-wrap:balance}._disclaimer_18qf1_55{font-size:var(--font-size-sm)}._progress_18qf1_61{display:flex;flex-direction:column;gap:var(--spacing-sm)}._progressHeader_18qf1_67{display:flex;justify-content:space-between;align-items:center}._stepLabel_18qf1_73{font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);color:var(--color-text-primary)}._stepCount_18qf1_79{font-size:var(--font-size-sm);color:var(--color-secondary-50)}._stepDescription_18qf1_84{color:var(--color-secondary-75);font-size:var(--font-size-md);margin:0}._fields_18qf1_92{display:flex;flex-wrap:wrap;gap:var(--spacing-md)}._fieldFull_18qf1_99{width:100%}._fieldHalf_18qf1_103{width:calc(50% - var(--spacing-md) / 2)}@media (max-width: 767px){._fieldHalf_18qf1_103{width:100%}}._fieldThird_18qf1_111{width:calc(33.333% - var(--spacing-md) * 2 / 3)}@media (max-width: 767px){._fieldThird_18qf1_111{width:100%}}._actions_18qf1_121{display:flex;align-items:center;gap:var(--spacing-md);padding-top:var(--spacing-sm)}._submitButton_18qf1_128{margin-left:auto}._success_18qf1_134{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-lg);padding:var(--spacing-md) 0 0}._success_18qf1_134 p{color:var(--color-states-success-bg);font-weight:var(--font-weight-semibold)}._errorBanner_18qf1_149{padding:var(--spacing-md);background-color:var(--color-states-error-bg);color:var(--color-states-error-text);border-radius:var(--radius-md);font-size:var(--font-size-sm)}.removePaddingAll ._container_18qf1_7{padding:0}.split ._container_18qf1_7{flex-direction:row;gap:3rem}.split ._heading_18qf1_41,.split form{flex:.5}@media (max-width: 767px){.split ._container_18qf1_7{flex-direction:column}.split ._heading_18qf1_41,.split form{flex:1}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const e=require("react/jsx-runtime"),i=require("react"),Y=require("react-dom"),L=require("../../../x-Dft9NVe_.cjs"),R="_overlay_6t5hy_2",P="_fadeIn_6t5hy_1",A="_container_6t5hy_19",F="_modal_6t5hy_49",K="_slideUp_6t5hy_1",X="_closeButton_6t5hy_60",G="_title_6t5hy_87",H="_content_6t5hy_97",J="_intro_6t5hy_116",Q="_trigger_6t5hy_123",V="_fadeOut_6t5hy_1",W="_closing_6t5hy_170",Z="_slideUpSheet_6t5hy_1",O="_slideDownSheet_6t5hy_1",t={overlay:R,fadeIn:P,container:A,"size-sm":"_size-sm_6t5hy_26","size-md":"_size-md_6t5hy_30","size-lg":"_size-lg_6t5hy_34","size-xl":"_size-xl_6t5hy_38","size-full":"_size-full_6t5hy_42",modal:F,slideUp:K,closeButton:X,title:G,content:H,intro:J,trigger:Q,fadeOut:V,closing:W,slideUpSheet:Z,slideDownSheet:O},ee=()=>{if(typeof document>"u")return;const s=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${s}px`,document.body.style.width="100%",document.body.style.overflowY="scroll"},k=()=>{if(typeof document>"u")return;const s=Math.abs(parseInt(document.body.style.top||"0",10));document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflowY="",s&&window.scrollTo(0,s)};function te({content:s,trigger:z,isOpen:m,onOpen:c,onClose:y,size:S="md",closeOnEscape:g=!0,closeOnOverlayClick:$=!0,showCloseButton:E=!0,className:j,overlayClassName:C,style:I,formData:v,renderForm:b}){const[q,p]=i.useState(!1),[_,w]=i.useState(!1),f=i.useRef(null),h=m!==void 0,o=h?m:q,N=()=>{h||p(!0),c==null||c()},r=()=>{w(!0),setTimeout(()=>{w(!1),h?y==null||y():p(!1)},300)},T=()=>o?r():N(),U=()=>{$&&r()};i.useEffect(()=>{if(!g||!o)return;const n=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[o,g]),i.useEffect(()=>(o?ee():k(),()=>k()),[o]),i.useEffect(()=>{if(!o||!f.current)return;const n=f.current,d=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=d[0],a=d[d.length-1],x=u=>{u.key==="Tab"&&(u.shiftKey?document.activeElement===l&&(u.preventDefault(),a==null||a.focus()):document.activeElement===a&&(u.preventDefault(),l==null||l.focus()))};return n.addEventListener("keydown",x),l==null||l.focus(),()=>n.removeEventListener("keydown",x)},[o]);const B=t[`size-${S}`]??"",D=s!==void 0?s:e.jsx(e.Fragment,{children:v&&b?b(v):null}),M=o||_?e.jsx("div",{className:`${t.overlay} ${_?t.closing:""} ${C??""}`.trim(),onClick:U,role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:`${B} ${t.container} ${_?t.closing:""}`,children:[E&&e.jsx("button",{"aria-label":"Close",className:t.closeButton,onClick:r,type:"button",children:e.jsx(L.X,{size:20})}),e.jsx("div",{ref:f,className:`${t.modal} ${j??""}`.trim(),style:I,onClick:n=>n.stopPropagation(),children:e.jsx("div",{className:t.content,children:D})})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t.trigger,onClick:T,children:z}),typeof window<"u"&&Y.createPortal(M,document.body)]})}exports.Modal=te;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as S, useRef as q, useEffect as
|
|
1
|
+
import { jsx as l, Fragment as z, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useRef as q, useEffect as f } from "react";
|
|
3
3
|
import { createPortal as A } from "react-dom";
|
|
4
4
|
import { X as K } from "../../../x-CnsEH4Ox.js";
|
|
5
|
-
import '../../../index38.css';const X = "
|
|
5
|
+
import '../../../index38.css';const X = "_overlay_6t5hy_2", F = "_fadeIn_6t5hy_1", G = "_container_6t5hy_19", H = "_modal_6t5hy_49", J = "_slideUp_6t5hy_1", Q = "_closeButton_6t5hy_60", V = "_title_6t5hy_87", W = "_content_6t5hy_97", Z = "_intro_6t5hy_116", O = "_trigger_6t5hy_123", ee = "_fadeOut_6t5hy_1", te = "_closing_6t5hy_170", oe = "_slideUpSheet_6t5hy_1", ne = "_slideDownSheet_6t5hy_1", e = {
|
|
6
6
|
overlay: X,
|
|
7
7
|
fadeIn: F,
|
|
8
8
|
container: G,
|
|
9
|
-
"size-sm": "_size-
|
|
10
|
-
"size-md": "_size-
|
|
11
|
-
"size-lg": "_size-
|
|
12
|
-
"size-xl": "_size-
|
|
13
|
-
"size-full": "_size-
|
|
9
|
+
"size-sm": "_size-sm_6t5hy_26",
|
|
10
|
+
"size-md": "_size-md_6t5hy_30",
|
|
11
|
+
"size-lg": "_size-lg_6t5hy_34",
|
|
12
|
+
"size-xl": "_size-xl_6t5hy_38",
|
|
13
|
+
"size-full": "_size-full_6t5hy_42",
|
|
14
14
|
modal: H,
|
|
15
15
|
slideUp: J,
|
|
16
16
|
closeButton: Q,
|
|
@@ -34,11 +34,11 @@ import '../../../index38.css';const X = "_overlay_2ihb4_2", F = "_fadeIn_2ihb4_1
|
|
|
34
34
|
function re({
|
|
35
35
|
content: n,
|
|
36
36
|
trigger: E,
|
|
37
|
-
isOpen:
|
|
38
|
-
onOpen:
|
|
37
|
+
isOpen: h,
|
|
38
|
+
onOpen: i,
|
|
39
39
|
onClose: u,
|
|
40
40
|
size: C = "md",
|
|
41
|
-
closeOnEscape:
|
|
41
|
+
closeOnEscape: v = !0,
|
|
42
42
|
closeOnOverlayClick: I = !0,
|
|
43
43
|
showCloseButton: N = !0,
|
|
44
44
|
className: U,
|
|
@@ -47,63 +47,63 @@ function re({
|
|
|
47
47
|
// title,
|
|
48
48
|
// richTextBlocks,
|
|
49
49
|
// renderRichText,
|
|
50
|
-
formData:
|
|
51
|
-
renderForm:
|
|
50
|
+
formData: g,
|
|
51
|
+
renderForm: p
|
|
52
52
|
}) {
|
|
53
|
-
const [Y,
|
|
54
|
-
|
|
53
|
+
const [Y, b] = S(!1), [y, w] = S(!1), _ = q(null), m = h !== void 0, t = m ? h : Y, D = () => {
|
|
54
|
+
m || b(!0), i == null || i();
|
|
55
55
|
}, d = () => {
|
|
56
56
|
w(!0), setTimeout(() => {
|
|
57
|
-
w(!1),
|
|
57
|
+
w(!1), m ? u == null || u() : b(!1);
|
|
58
58
|
}, 300);
|
|
59
59
|
}, L = () => t ? d() : D(), j = () => {
|
|
60
60
|
I && d();
|
|
61
61
|
};
|
|
62
|
-
|
|
63
|
-
if (!
|
|
62
|
+
f(() => {
|
|
63
|
+
if (!v || !t) return;
|
|
64
64
|
const o = (c) => {
|
|
65
65
|
c.key === "Escape" && d();
|
|
66
66
|
};
|
|
67
67
|
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
68
|
-
}, [t,
|
|
69
|
-
if (!t || !
|
|
70
|
-
const o =
|
|
68
|
+
}, [t, v]), f(() => (t ? se() : $(), () => $()), [t]), f(() => {
|
|
69
|
+
if (!t || !_.current) return;
|
|
70
|
+
const o = _.current, c = o.querySelectorAll(
|
|
71
71
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
72
72
|
), s = c[0], r = c[c.length - 1], k = (a) => {
|
|
73
73
|
a.key === "Tab" && (a.shiftKey ? document.activeElement === s && (a.preventDefault(), r == null || r.focus()) : document.activeElement === r && (a.preventDefault(), s == null || s.focus()));
|
|
74
74
|
};
|
|
75
75
|
return o.addEventListener("keydown", k), s == null || s.focus(), () => o.removeEventListener("keydown", k);
|
|
76
76
|
}, [t]);
|
|
77
|
-
const M = e[`size-${C}`] ?? "", P = n !== void 0 ? n : /* @__PURE__ */
|
|
77
|
+
const M = e[`size-${C}`] ?? "", P = n !== void 0 ? n : /* @__PURE__ */ l(z, { children: g && p ? p(g) : null }), R = t || y ? /* @__PURE__ */ l(
|
|
78
78
|
"div",
|
|
79
79
|
{
|
|
80
|
-
className: `${e.overlay} ${
|
|
80
|
+
className: `${e.overlay} ${y ? e.closing : ""} ${B ?? ""}`.trim(),
|
|
81
81
|
onClick: j,
|
|
82
82
|
role: "dialog",
|
|
83
83
|
"aria-modal": "true",
|
|
84
84
|
children: /* @__PURE__ */ x(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
className: `${M} ${e.container} ${
|
|
87
|
+
className: `${M} ${e.container} ${y ? e.closing : ""}`,
|
|
88
88
|
children: [
|
|
89
|
-
N && /* @__PURE__ */
|
|
89
|
+
N && /* @__PURE__ */ l(
|
|
90
90
|
"button",
|
|
91
91
|
{
|
|
92
92
|
"aria-label": "Close",
|
|
93
93
|
className: e.closeButton,
|
|
94
94
|
onClick: d,
|
|
95
95
|
type: "button",
|
|
96
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ l(K, { size: 20 })
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ l(
|
|
100
100
|
"div",
|
|
101
101
|
{
|
|
102
|
-
ref:
|
|
102
|
+
ref: _,
|
|
103
103
|
className: `${e.modal} ${U ?? ""}`.trim(),
|
|
104
104
|
style: T,
|
|
105
105
|
onClick: (o) => o.stopPropagation(),
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ l("div", { className: e.content, children: P })
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
]
|
|
@@ -112,7 +112,7 @@ function re({
|
|
|
112
112
|
}
|
|
113
113
|
) : null;
|
|
114
114
|
return /* @__PURE__ */ x(z, { children: [
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ l("div", { className: e.trigger, onClick: L, children: E }),
|
|
116
116
|
typeof window < "u" && A(R, document.body)
|
|
117
117
|
] });
|
|
118
118
|
}
|
package/dist/index38.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_6t5hy_2{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000;animation:_fadeIn_6t5hy_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}._container_6t5hy_19{position:relative;display:flex;flex-direction:column}._size-sm_6t5hy_26{width:90%;max-width:400px}._size-md_6t5hy_30{width:90%;max-width:600px}._size-lg_6t5hy_34{width:90%;max-width:800px}._size-xl_6t5hy_38{width:90%;max-width:1200px}._size-full_6t5hy_42{width:95%;height:95dvh;max-height:95dvh}._modal_6t5hy_49{position:relative;background-color:var(--color-background, #fff);border-radius:var(--radius-lg, .5rem);padding:var(--spacing-xl, 2rem);max-height:90dvh;overflow-y:auto;animation:_slideUp_6t5hy_1 .3s ease}._closeButton_6t5hy_60{background:none;border:none;cursor:pointer;padding:var(--spacing-xs, .25rem);margin-bottom:var(--spacing-xs);border-radius:var(--radius-sm, .25rem);color:#fff;transition:all .2s ease;display:flex;align-items:center;justify-content:center;align-self:flex-end;z-index:1}._closeButton_6t5hy_60:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_6t5hy_60:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_6t5hy_87{font-size:var(--font-size-xl, 1.5rem);font-weight:var(--font-weight-bold, 700);color:var(--color-heading, #111);margin-bottom:var(--spacing-lg, 1.5rem);padding-right:var(--spacing-xl, 2rem);line-height:var(--line-height-heading, 1.2)}._content_6t5hy_97{color:var(--color-text-primary, #333);line-height:var(--line-height-normal, 1.5);display:flex;flex-direction:column;gap:var(--spacing-xl)}._content_6t5hy_97 video,._content_6t5hy_97 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_6t5hy_97 video{width:100%}._intro_6t5hy_116{margin-bottom:var(--spacing-lg, 1.5rem);padding-bottom:var(--spacing-lg, 1.5rem);border-bottom:1px solid var(--color-border, #e5e7eb)}._trigger_6t5hy_123{width:auto;display:inline-block;cursor:pointer}@keyframes _fadeIn_6t5hy_1{0%{opacity:0}to{opacity:1}}@keyframes _fadeOut_6t5hy_1{0%{opacity:1}to{opacity:0}}@keyframes _slideUp_6t5hy_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 767px){._overlay_6t5hy_2{align-items:flex-end;justify-content:stretch;padding:0;overflow:hidden}._overlay_6t5hy_2._closing_6t5hy_170{animation:_fadeOut_6t5hy_1 .3s ease forwards}._container_6t5hy_19{width:100%;max-width:100%;max-height:92dvh;display:flex;flex-direction:column;border-radius:var(--radius-lg, .5rem) var(--radius-lg, .5rem) 0 0;background-color:var(--color-background, #fff);animation:_slideUpSheet_6t5hy_1 .3s cubic-bezier(.16,1,.3,1) forwards}._container_6t5hy_19._closing_6t5hy_170{animation:_slideDownSheet_6t5hy_1 .3s cubic-bezier(.16,1,.3,1) forwards}._size-sm_6t5hy_26,._size-md_6t5hy_30,._size-lg_6t5hy_34,._size-xl_6t5hy_38,._size-full_6t5hy_42{width:100%;max-width:100%;height:100%;max-height:92dvh}._closeButton_6t5hy_60{color:var(--color-text-primary, #333);align-self:flex-end;margin:var(--spacing-sm)}._modal_6t5hy_49{border-radius:var(--radius-lg, .5rem) var(--radius-lg, .5rem) 0 0;padding:2.5rem var(--spacing-lg) var(--spacing-lg, 1.5rem);flex:1;overflow-y:scroll;-webkit-overflow-scrolling:touch;max-height:none;animation:none;transform:none;overscroll-behavior:contain;position:absolute;height:100%}._content_6t5hy_97{height:unset;width:100%}._title_6t5hy_87{font-size:var(--font-size-lg, 1.25rem);padding-right:0}}@keyframes _slideUpSheet_6t5hy_1{0%{transform:translateY(150%);opacity:.75}to{transform:translateY(0);opacity:1}}@keyframes _slideDownSheet_6t5hy_1{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:0}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../../core/components/Input/index.cjs");require("../../../core/components/Textarea/index.cjs");require("../../../core/components/Select/index.cjs");require("../../../core/components/Checkbox/index.cjs");require("../../../core/components/Radio/index.cjs");require("../../../core/components/Fieldset/index.cjs");require("../../../core/components/DatePicker/index.cjs");require("../../../core/components/Range/index.cjs");const e=require("../../../FormField-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../../core/components/Input/index.cjs");require("../../../core/components/Textarea/index.cjs");require("../../../core/components/Select/index.cjs");require("../../../core/components/Checkbox/index.cjs");require("../../../core/components/Radio/index.cjs");require("../../../core/components/Fieldset/index.cjs");require("../../../core/components/DatePicker/index.cjs");require("../../../core/components/Range/index.cjs");const e=require("../../../FormField-DKM8k1nK.cjs");exports.FormField=e.FormField;
|
|
@@ -7,7 +7,7 @@ import "../../../core/components/Radio/index.mjs";
|
|
|
7
7
|
import "../../../core/components/Fieldset/index.mjs";
|
|
8
8
|
import "../../../core/components/DatePicker/index.mjs";
|
|
9
9
|
import "../../../core/components/Range/index.mjs";
|
|
10
|
-
import { F as l } from "../../../FormField-
|
|
10
|
+
import { F as l } from "../../../FormField-CNsm6oUT.js";
|
|
11
11
|
export {
|
|
12
12
|
l as FormField
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),W=require("../../../core/components/Form/index.cjs"),E=require("../../../index-CUjZDv40.cjs"),M=require("../../../core/components/ProgressBar/index.cjs"),A=require("../../hooks/useStyleClasses.cjs"),e=require("../../../FormField-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),W=require("../../../core/components/Form/index.cjs"),E=require("../../../index-CUjZDv40.cjs"),M=require("../../../core/components/ProgressBar/index.cjs"),A=require("../../hooks/useStyleClasses.cjs"),e=require("../../../FormField-DKM8k1nK.cjs"),_=require("./validate.cjs");function D(r,s){switch(s.type){case"SET_VALUE":return{...r,values:{...r.values,[s.name]:s.value},errors:{...r.errors,[s.name]:""}};case"SET_ERRORS":return{...r,errors:s.errors};case"CLEAR_ERROR":return{...r,errors:{...r.errors,[s.name]:""}};case"NEXT_STEP":return{...r,currentStep:r.currentStep+1,errors:{}};case"PREV_STEP":return{...r,currentStep:r.currentStep-1,errors:{}};case"SET_SUBMITTING":return{...r,isSubmitting:s.value};case"SET_RESULT":return{...r,submitResult:s.result,isSubmitting:!1};case"RESET":return{...r,currentStep:0,errors:{},submitResult:null,isSubmitting:!1};default:return r}}function G({id:r,heading:s,layout:B="vertical",maxWidth:x="md",steps:S,submitLabel:C="Submit",nextLabel:F="Next",backLabel:L="Back",successMessage:P="Thank you! Your submission has been received.",errorMessage:p="Something went wrong. Please try again.",styleOptions:$,renderRichText:c,onSubmit:v}){const N=A.useStyleClasses($??{}),j={sm:e.styles.maxWidthSm,md:e.styles.maxWidthMd,lg:e.styles.maxWidthLg,full:e.styles.maxWidthFull}[x],q=i.useMemo(()=>_.buildInitialValues(S),[]),[w,o]=i.useReducer(D,{values:q,errors:{},currentStep:0,isSubmitting:!1,submitResult:null}),{values:u,errors:T,currentStep:m,isSubmitting:b,submitResult:n}=w,y=S.length,k=y>1,f=m===y-1,I=(m+1)/y*100,a=S[m],O=i.useCallback((l,d)=>{o({type:"SET_VALUE",name:l,value:d})},[]),U=i.useCallback(()=>{const l=_.validateStep(a.fields,u);if(Object.keys(l).length>0){o({type:"SET_ERRORS",errors:l});return}o({type:"NEXT_STEP"})},[a.fields,u]),V=i.useCallback(()=>{o({type:"PREV_STEP"})},[]),R=i.useCallback(async()=>{const l=_.validateStep(a.fields,u);if(Object.keys(l).length>0){o({type:"SET_ERRORS",errors:l});return}o({type:"SET_SUBMITTING",value:!0});try{const d=await v(u);o({type:"SET_RESULT",result:d})}catch{o({type:"SET_RESULT",result:{success:!1,message:p}})}},[a.fields,u,v,p]);return n!=null&&n.success?t.jsx("section",{id:r,className:`${e.styles.formBlock} ${N}`,children:t.jsx("div",{className:`${e.styles.formInner} ${j}`,children:t.jsx("div",{className:e.styles.container,children:t.jsxs("div",{className:e.styles.success,children:[t.jsx("p",{children:n.message??P}),t.jsx(E.Button,{as:"button",variant:"secondary",onClick:()=>o({type:"RESET"}),children:"Submit another response"})]})})})}):t.jsx("section",{id:r,className:`${e.styles.formBlock} ${N}`,children:t.jsx("div",{className:`${e.styles.formInner} ${j}`,children:t.jsxs("div",{className:e.styles.container,children:[((s==null?void 0:s.title)||(s==null?void 0:s.description))&&t.jsxs("div",{className:e.styles.heading,children:[s.eyebrow&&(c==null?void 0:c({blocks:s.eyebrow,className:e.styles.eyebrow})),s.title&&(c==null?void 0:c({blocks:s.title,className:e.styles.title})),s.description&&(c==null?void 0:c({blocks:s.description}))]}),k&&t.jsxs("div",{className:e.styles.progress,children:[t.jsxs("div",{className:e.styles.progressHeader,children:[t.jsx("span",{className:e.styles.stepLabel,children:a.title}),t.jsxs("span",{className:e.styles.stepCount,children:[m+1," / ",y]})]}),t.jsx(M.ProgressBar,{progress:I,variant:"primary",size:"sm",showLabel:!1})]}),a.description&&t.jsx("p",{className:e.styles.stepDescription,children:a.description}),n&&!n.success&&t.jsx("div",{className:e.styles.errorBanner,role:"alert",children:n.message??p}),t.jsxs(W.Form,{layout:B,noValidate:!0,onSubmit:l=>{l.preventDefault(),f?R():U()},children:[t.jsx("div",{className:e.styles.fields,children:a.fields.map(l=>t.jsx(e.FormField,{field:l,value:u[l.name.current],error:T[l.name.current],onChange:O},l._key))}),(s==null?void 0:s.disclaimer)&&(c==null?void 0:c({blocks:s==null?void 0:s.disclaimer,className:e.styles.disclaimer})),t.jsxs("div",{className:e.styles.actions,children:[k&&m>0&&t.jsx(E.Button,{as:"button",type:"button",variant:"secondary",onClick:V,disabled:b,children:L}),t.jsx(E.Button,{as:"button",type:"submit",variant:"primary",disabled:b,className:e.styles.submitButton,children:b?"Submitting…":f?C:F})]})]})]})})})}exports.FormBlock=G;
|
|
@@ -4,7 +4,7 @@ import { Form as X } from "../../../core/components/Form/index.mjs";
|
|
|
4
4
|
import { B as d } from "../../../index--KCTRJKr.js";
|
|
5
5
|
import { ProgressBar as z } from "../../../core/components/ProgressBar/index.mjs";
|
|
6
6
|
import { useStyleClasses as H } from "../../hooks/useStyleClasses.mjs";
|
|
7
|
-
import { s as r, F as Y } from "../../../FormField-
|
|
7
|
+
import { s as r, F as Y } from "../../../FormField-CNsm6oUT.js";
|
|
8
8
|
import { buildInitialValues as h, validateStep as L } from "./validate.mjs";
|
|
9
9
|
function q(e, s) {
|
|
10
10
|
switch (s.type) {
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const styles: {
|
|
2
|
-
readonly "_accordionContent_14hw7_64": string;
|
|
3
|
-
readonly "_accordionHeader_14hw7_15": string;
|
|
4
|
-
readonly "_accordionItem_14hw7_7": string;
|
|
5
|
-
readonly "_accordion_14hw7_1": string;
|
|
6
|
-
readonly "_active_14hw7_30": string;
|
|
7
|
-
readonly "_closed_14hw7_51": string;
|
|
8
|
-
readonly "_icon_14hw7_44": string;
|
|
9
|
-
readonly "_open_14hw7_50": string;
|
|
10
|
-
readonly "_rotate_14hw7_80": string;
|
|
11
|
-
};
|
|
12
|
-
export = styles;
|
|
13
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare const styles: {
|
|
2
|
-
readonly "_applyFilters_x1tkl_218": string;
|
|
3
|
-
readonly "_buttonIsLoading_x1tkl_307": string;
|
|
4
|
-
readonly "_clearSearch_x1tkl_106": string;
|
|
5
|
-
readonly "_container_x1tkl_9": string;
|
|
6
|
-
readonly "_cta_x1tkl_25": string;
|
|
7
|
-
readonly "_documentList_x1tkl_1": string;
|
|
8
|
-
readonly "_eyebrow_x1tkl_30": string;
|
|
9
|
-
readonly "_filterHeader_x1tkl_178": string;
|
|
10
|
-
readonly "_filterList_x1tkl_203": string;
|
|
11
|
-
readonly "_filterToggle_x1tkl_163": string;
|
|
12
|
-
readonly "_heading_x1tkl_20": string;
|
|
13
|
-
readonly "_hide_x1tkl_256": string;
|
|
14
|
-
readonly "_listContainer_x1tkl_34": string;
|
|
15
|
-
readonly "_listFilters_x1tkl_210": string;
|
|
16
|
-
readonly "_listHeaderFilters_x1tkl_125": string;
|
|
17
|
-
readonly "_listHeader_x1tkl_66": string;
|
|
18
|
-
readonly "_listResults_x1tkl_136": string;
|
|
19
|
-
readonly "_listSearch_x1tkl_79": string;
|
|
20
|
-
readonly "_listSort_x1tkl_140": string;
|
|
21
|
-
readonly "_listWrapper_x1tkl_45": string;
|
|
22
|
-
readonly "_list_x1tkl_34": string;
|
|
23
|
-
readonly "_loadMore_x1tkl_199": string;
|
|
24
|
-
readonly "_rotate_x1tkl_1": string;
|
|
25
|
-
readonly "_show_x1tkl_247": string;
|
|
26
|
-
readonly "_text_x1tkl_25": string;
|
|
27
|
-
readonly "_title_x1tkl_25": string;
|
|
28
|
-
readonly "_wrapper_x1tkl_266": string;
|
|
29
|
-
};
|
|
30
|
-
export = styles;
|
|
31
|
-
|