quirk-ui 0.1.151 → 0.1.153
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-Rqe3qF_t.js → FormField-D1m8xWkL.js} +82 -82
- package/dist/FormField-DU5sh1Fk.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 +42 -43
- 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/FormField-fg7Q2UyZ.cjs +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { Input as
|
|
2
|
+
import { Input as g } from "./core/components/Input/index.mjs";
|
|
3
3
|
import { Textarea as T } from "./core/components/Textarea/index.mjs";
|
|
4
|
-
import { Select as
|
|
5
|
-
import { Checkbox as
|
|
4
|
+
import { Select as m } from "./core/components/Select/index.mjs";
|
|
5
|
+
import { Checkbox as h } from "./core/components/Checkbox/index.mjs";
|
|
6
6
|
import { Radio as W } from "./core/components/Radio/index.mjs";
|
|
7
|
-
import { Fieldset as
|
|
8
|
-
import { DatePicker as
|
|
9
|
-
import { Range as
|
|
10
|
-
import './FormField.css';const L = "
|
|
7
|
+
import { Fieldset as p } from "./core/components/Fieldset/index.mjs";
|
|
8
|
+
import { DatePicker as f } from "./core/components/DatePicker/index.mjs";
|
|
9
|
+
import { Range as k } from "./core/components/Range/index.mjs";
|
|
10
|
+
import './FormField.css';const L = "_formBlock_1nwvd_1", C = "_container_1nwvd_7", F = "_formInner_1nwvd_20", y = "_maxWidthSm_1nwvd_26", B = "_maxWidthMd_1nwvd_29", q = "_maxWidthLg_1nwvd_32", S = "_maxWidthFull_1nwvd_35", H = "_heading_1nwvd_41", G = "_eyebrow_1nwvd_47", M = "_title_1nwvd_51", $ = "_progress_1nwvd_57", I = "_progressHeader_1nwvd_63", D = "_stepLabel_1nwvd_69", O = "_stepCount_1nwvd_75", V = "_stepDescription_1nwvd_80", P = "_fields_1nwvd_88", R = "_fieldFull_1nwvd_95", j = "_fieldHalf_1nwvd_99", N = "_fieldThird_1nwvd_107", z = "_actions_1nwvd_117", A = "_submitButton_1nwvd_124", E = "_success_1nwvd_130", J = "_errorBanner_1nwvd_145", u = {
|
|
11
11
|
formBlock: L,
|
|
12
12
|
container: C,
|
|
13
13
|
formInner: F,
|
|
@@ -32,37 +32,37 @@ import './FormField.css';const L = "_formBlock_b7mbf_1", C = "_container_b7mbf_7
|
|
|
32
32
|
success: E,
|
|
33
33
|
errorBanner: J
|
|
34
34
|
};
|
|
35
|
-
function
|
|
36
|
-
return (e ?? []).map((
|
|
37
|
-
label:
|
|
38
|
-
value:
|
|
39
|
-
disabled:
|
|
35
|
+
function i(e) {
|
|
36
|
+
return (e ?? []).map((n) => ({
|
|
37
|
+
label: n.label,
|
|
38
|
+
value: n.value.current,
|
|
39
|
+
disabled: n.disabled
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return (e ?? []).map((
|
|
44
|
-
label:
|
|
45
|
-
options:
|
|
46
|
-
label:
|
|
47
|
-
value:
|
|
48
|
-
disabled:
|
|
42
|
+
function _(e) {
|
|
43
|
+
return (e ?? []).map((n) => ({
|
|
44
|
+
label: n.label,
|
|
45
|
+
options: n.options.map((a) => ({
|
|
46
|
+
label: a.label,
|
|
47
|
+
value: a.value.current,
|
|
48
|
+
disabled: a.disabled
|
|
49
49
|
}))
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
full:
|
|
55
|
-
half:
|
|
56
|
-
third:
|
|
57
|
-
}[e.width ?? "full"],
|
|
58
|
-
id:
|
|
59
|
-
name:
|
|
52
|
+
function re({ field: e, value: n, error: a, onChange: o }) {
|
|
53
|
+
const r = e.name.current, b = {
|
|
54
|
+
full: u.fieldFull,
|
|
55
|
+
half: u.fieldHalf,
|
|
56
|
+
third: u.fieldThird
|
|
57
|
+
}[e.width ?? "full"], d = {
|
|
58
|
+
id: r,
|
|
59
|
+
name: r,
|
|
60
60
|
label: e.label,
|
|
61
61
|
required: e.required,
|
|
62
62
|
disabled: e.disabled,
|
|
63
63
|
helperText: e.helperText,
|
|
64
|
-
error:
|
|
65
|
-
},
|
|
64
|
+
error: a
|
|
65
|
+
}, c = () => {
|
|
66
66
|
switch (e.fieldType) {
|
|
67
67
|
// ── Text-based inputs ──────────────────────────────────────────────
|
|
68
68
|
case "text":
|
|
@@ -71,16 +71,16 @@ function ae({ field: e, value: r, error: n, onChange: o }) {
|
|
|
71
71
|
case "number":
|
|
72
72
|
case "url":
|
|
73
73
|
return /* @__PURE__ */ s(
|
|
74
|
-
|
|
74
|
+
g,
|
|
75
75
|
{
|
|
76
|
-
...
|
|
76
|
+
...d,
|
|
77
77
|
type: e.fieldType === "phone" ? "tel" : e.fieldType,
|
|
78
78
|
placeholder: e.placeholder,
|
|
79
|
-
value:
|
|
79
|
+
value: n ?? "",
|
|
80
80
|
minLength: e.minLength,
|
|
81
81
|
maxLength: e.maxLength,
|
|
82
82
|
fullWidth: !0,
|
|
83
|
-
onChange: (t) => o(
|
|
83
|
+
onChange: (t) => o(r, t.target.value)
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
// ── Textarea ───────────────────────────────────────────────────────
|
|
@@ -88,76 +88,76 @@ function ae({ field: e, value: r, error: n, onChange: o }) {
|
|
|
88
88
|
return /* @__PURE__ */ s(
|
|
89
89
|
T,
|
|
90
90
|
{
|
|
91
|
-
...
|
|
91
|
+
...d,
|
|
92
92
|
placeholder: e.placeholder,
|
|
93
|
-
value:
|
|
93
|
+
value: n ?? "",
|
|
94
94
|
rows: e.rows ?? 4,
|
|
95
95
|
maxLength: e.maxLength,
|
|
96
96
|
showCharCount: e.showCharCount,
|
|
97
97
|
fullWidth: !0,
|
|
98
|
-
onChange: (t) => o(
|
|
98
|
+
onChange: (t) => o(r, t.target.value)
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
// ── Select ─────────────────────────────────────────────────────────
|
|
102
102
|
case "select": {
|
|
103
|
-
const t = e.useOptionGroups ?
|
|
103
|
+
const t = e.useOptionGroups ? _(e.optionGroups) : i(e.options);
|
|
104
104
|
return /* @__PURE__ */ s(
|
|
105
|
-
|
|
105
|
+
m,
|
|
106
106
|
{
|
|
107
|
-
...
|
|
107
|
+
...d,
|
|
108
108
|
placeholder: e.placeholder,
|
|
109
109
|
options: t,
|
|
110
|
-
value:
|
|
110
|
+
value: n ?? "",
|
|
111
111
|
fullWidth: !0,
|
|
112
|
-
onChange: (l) => o(
|
|
112
|
+
onChange: (l) => o(r, l.target.value)
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
// ── Multi-select ───────────────────────────────────────────────────
|
|
117
117
|
case "multiselect": {
|
|
118
|
-
const t = e.useOptionGroups ?
|
|
118
|
+
const t = e.useOptionGroups ? _(e.optionGroups) : i(e.options);
|
|
119
119
|
return /* @__PURE__ */ s(
|
|
120
|
-
|
|
120
|
+
m,
|
|
121
121
|
{
|
|
122
|
-
...
|
|
122
|
+
...d,
|
|
123
123
|
multiple: !0,
|
|
124
124
|
options: t,
|
|
125
|
-
value:
|
|
125
|
+
value: n ?? [],
|
|
126
126
|
showSelectedCount: !0,
|
|
127
|
-
onChange: (l) => o(
|
|
127
|
+
onChange: (l) => o(r, l)
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
// ── Single checkbox ────────────────────────────────────────────────
|
|
132
132
|
case "checkbox":
|
|
133
133
|
return /* @__PURE__ */ s(
|
|
134
|
-
|
|
134
|
+
h,
|
|
135
135
|
{
|
|
136
|
-
id:
|
|
137
|
-
name:
|
|
136
|
+
id: d.id,
|
|
137
|
+
name: d.name,
|
|
138
138
|
label: e.label,
|
|
139
139
|
required: e.required,
|
|
140
140
|
disabled: e.disabled,
|
|
141
|
-
helperText:
|
|
142
|
-
error: !!
|
|
143
|
-
checked:
|
|
144
|
-
onChange: (t) => o(
|
|
141
|
+
helperText: a ?? e.helperText,
|
|
142
|
+
error: !!a,
|
|
143
|
+
checked: n ?? !1,
|
|
144
|
+
onChange: (t) => o(r, t.target.checked)
|
|
145
145
|
}
|
|
146
146
|
);
|
|
147
147
|
// ── Checkbox group ─────────────────────────────────────────────────
|
|
148
148
|
case "checkboxGroup": {
|
|
149
|
-
const t =
|
|
150
|
-
return /* @__PURE__ */ s(
|
|
151
|
-
|
|
149
|
+
const t = n ?? [];
|
|
150
|
+
return /* @__PURE__ */ s(p, { legend: e.label, error: !!a, helperText: a, children: i(e.options).map((l) => /* @__PURE__ */ s(
|
|
151
|
+
h,
|
|
152
152
|
{
|
|
153
|
-
id: `${
|
|
154
|
-
name: `${
|
|
153
|
+
id: `${r}-${l.value}`,
|
|
154
|
+
name: `${r}[]`,
|
|
155
155
|
label: l.label,
|
|
156
156
|
checked: t.includes(l.value),
|
|
157
157
|
disabled: l.disabled || e.disabled,
|
|
158
|
-
onChange: (
|
|
159
|
-
const
|
|
160
|
-
o(
|
|
158
|
+
onChange: (v) => {
|
|
159
|
+
const x = v.target.checked ? [...t, l.value] : t.filter((w) => w !== l.value);
|
|
160
|
+
o(r, x);
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
163
|
l.value
|
|
@@ -165,50 +165,50 @@ function ae({ field: e, value: r, error: n, onChange: o }) {
|
|
|
165
165
|
}
|
|
166
166
|
// ── Radio group ────────────────────────────────────────────────────
|
|
167
167
|
case "radio":
|
|
168
|
-
return /* @__PURE__ */ s(
|
|
168
|
+
return /* @__PURE__ */ s(p, { legend: e.label, error: !!a, helperText: a, children: i(e.options).map((t) => /* @__PURE__ */ s(
|
|
169
169
|
W,
|
|
170
170
|
{
|
|
171
|
-
id: `${
|
|
172
|
-
name:
|
|
171
|
+
id: `${r}-${t.value}`,
|
|
172
|
+
name: r,
|
|
173
173
|
value: t.value,
|
|
174
174
|
label: t.label,
|
|
175
|
-
checked:
|
|
175
|
+
checked: n === t.value,
|
|
176
176
|
disabled: t.disabled || e.disabled,
|
|
177
177
|
required: e.required,
|
|
178
|
-
onChange: () => o(
|
|
178
|
+
onChange: () => o(r, t.value)
|
|
179
179
|
},
|
|
180
180
|
t.value
|
|
181
181
|
)) });
|
|
182
182
|
// ── Date picker ────────────────────────────────────────────────────
|
|
183
183
|
case "date":
|
|
184
184
|
return /* @__PURE__ */ s(
|
|
185
|
-
|
|
185
|
+
f,
|
|
186
186
|
{
|
|
187
|
-
id:
|
|
188
|
-
name:
|
|
187
|
+
id: d.id,
|
|
188
|
+
name: d.name,
|
|
189
189
|
label: e.label,
|
|
190
190
|
required: e.required,
|
|
191
191
|
disabled: e.disabled,
|
|
192
|
-
helperText:
|
|
193
|
-
error: !!
|
|
194
|
-
value:
|
|
195
|
-
onChange: (t) => o(
|
|
192
|
+
helperText: a ?? e.helperText,
|
|
193
|
+
error: !!a,
|
|
194
|
+
value: n ?? null,
|
|
195
|
+
onChange: (t) => o(r, t)
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
// ── Range ──────────────────────────────────────────────────────────
|
|
199
199
|
case "range":
|
|
200
200
|
return /* @__PURE__ */ s(
|
|
201
|
-
|
|
201
|
+
k,
|
|
202
202
|
{
|
|
203
|
-
...
|
|
204
|
-
value:
|
|
203
|
+
...d,
|
|
204
|
+
value: n ?? e.rangeMin ?? 0,
|
|
205
205
|
min: e.rangeMin ?? 0,
|
|
206
206
|
max: e.rangeMax ?? 100,
|
|
207
207
|
step: e.rangeStep ?? 1,
|
|
208
208
|
valuePrefix: e.rangeValuePrefix,
|
|
209
209
|
valueSuffix: e.rangeValueSuffix,
|
|
210
210
|
showValue: !0,
|
|
211
|
-
onChange: (t) => o(
|
|
211
|
+
onChange: (t) => o(r, t)
|
|
212
212
|
}
|
|
213
213
|
);
|
|
214
214
|
// ── Hidden ─────────────────────────────────────────────────────────
|
|
@@ -217,17 +217,17 @@ function ae({ field: e, value: r, error: n, onChange: o }) {
|
|
|
217
217
|
"input",
|
|
218
218
|
{
|
|
219
219
|
type: "hidden",
|
|
220
|
-
name:
|
|
221
|
-
value:
|
|
220
|
+
name: r,
|
|
221
|
+
value: n ?? e.hiddenValue ?? ""
|
|
222
222
|
}
|
|
223
223
|
);
|
|
224
224
|
default:
|
|
225
225
|
return null;
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
return e.fieldType === "hidden" ?
|
|
228
|
+
return e.fieldType === "hidden" ? c() : /* @__PURE__ */ s("div", { className: `${b}`, children: c() });
|
|
229
229
|
}
|
|
230
230
|
export {
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
re as F,
|
|
232
|
+
u as s
|
|
233
233
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./FormField.css');const a=require("react/jsx-runtime"),g=require("./core/components/Input/index.cjs"),q=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_1nwvd_1",j="_container_1nwvd_7",C="_formInner_1nwvd_20",L="_maxWidthSm_1nwvd_26",y="_maxWidthMd_1nwvd_29",S="_maxWidthLg_1nwvd_32",B="_maxWidthFull_1nwvd_35",$="_heading_1nwvd_41",H="_eyebrow_1nwvd_47",G="_title_1nwvd_51",I="_progress_1nwvd_57",M="_progressHeader_1nwvd_63",D="_stepLabel_1nwvd_69",O="_stepCount_1nwvd_75",P="_stepDescription_1nwvd_80",R="_fields_1nwvd_88",V="_fieldFull_1nwvd_95",f="_fieldHalf_1nwvd_99",N="_fieldThird_1nwvd_107",z="_actions_1nwvd_117",A="_submitButton_1nwvd_124",E="_success_1nwvd_130",J="_errorBanner_1nwvd_145",i={formBlock:F,container:j,formInner:C,maxWidthSm:L,maxWidthMd:y,maxWidthLg:S,maxWidthFull:B,heading:$,eyebrow:H,title:G,progress:I,progressHeader:M,stepLabel:D,stepCount:O,stepDescription:P,fields:R,fieldFull:V,fieldHalf:f,fieldThird:N,actions:z,submitButton:A,success:E,errorBanner:J};function d(e){return(e??[]).map(t=>({label:t.label,value:t.value.current,disabled:t.disabled}))}function m(e){return(e??[]).map(t=>({label:t.label,options:t.options.map(s=>({label:s.label,value:s.value.current,disabled:s.disabled}))}))}function K({field:e,value:t,error:s,onChange:l}){const r=e.name.current,x={full:i.fieldFull,half:i.fieldHalf,third:i.fieldThird}[e.width??"full"],c={id:r,name:r,label:e.label,required:e.required,disabled:e.disabled,helperText:e.helperText,error:s},u=()=>{switch(e.fieldType){case"text":case"email":case"phone":case"number":case"url":return a.jsx(g.Input,{...c,type:e.fieldType==="phone"?"tel":e.fieldType,placeholder:e.placeholder,value:t??"",minLength:e.minLength,maxLength:e.maxLength,fullWidth:!0,onChange:n=>l(r,n.target.value)});case"textarea":return a.jsx(q.Textarea,{...c,placeholder:e.placeholder,value:t??"",rows:e.rows??4,maxLength:e.maxLength,showCharCount:e.showCharCount,fullWidth:!0,onChange:n=>l(r,n.target.value)});case"select":{const n=e.useOptionGroups?m(e.optionGroups):d(e.options);return a.jsx(_.Select,{...c,placeholder:e.placeholder,options:n,value:t??"",fullWidth:!0,onChange:o=>l(r,o.target.value)})}case"multiselect":{const n=e.useOptionGroups?m(e.optionGroups):d(e.options);return a.jsx(_.Select,{...c,multiple:!0,options:n,value:t??[],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:t??!1,onChange:n=>l(r,n.target.checked)});case"checkboxGroup":{const n=t??[];return a.jsx(p.Fieldset,{legend:e.label,error:!!s,helperText:s,children:d(e.options).map(o=>a.jsx(h.Checkbox,{id:`${r}-${o.value}`,name:`${r}[]`,label:o.label,checked:n.includes(o.value),disabled:o.disabled||e.disabled,onChange:b=>{const v=b.target.checked?[...n,o.value]:n.filter(w=>w!==o.value);l(r,v)}},o.value))})}case"radio":return a.jsx(p.Fieldset,{legend:e.label,error:!!s,helperText:s,children:d(e.options).map(n=>a.jsx(T.Radio,{id:`${r}-${n.value}`,name:r,value:n.value,label:n.label,checked:t===n.value,disabled:n.disabled||e.disabled,required:e.required,onChange:()=>l(r,n.value)},n.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:t??null,onChange:n=>l(r,n)});case"range":return a.jsx(W.Range,{...c,value:t??e.rangeMin??0,min:e.rangeMin??0,max:e.rangeMax??100,step:e.rangeStep??1,valuePrefix:e.rangeValuePrefix,valueSuffix:e.rangeValueSuffix,showValue:!0,onChange:n=>l(r,n)});case"hidden":return a.jsx("input",{type:"hidden",name:r,value:t??e.hiddenValue??""});default:return null}};return e.fieldType==="hidden"?u():a.jsx("div",{className:`${x}`,children:u()})}exports.FormField=K;exports.styles=i;
|
package/dist/FormField.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._formBlock_1nwvd_1{width:100%;padding-top:var(--spacing-xl);padding-bottom:var(--spacing-xl)}._container_1nwvd_7{width:100%;max-width:var(--layout-width, 1250px);margin:0 auto;padding-left:var(--spacing-md);padding-right:var(--spacing-md);display:flex;flex-direction:column;gap:var(--spacing-lg)}._formInner_1nwvd_20{width:100%;margin-left:auto;margin-right:auto}._maxWidthSm_1nwvd_26{max-width:480px}._maxWidthMd_1nwvd_29{max-width:640px}._maxWidthLg_1nwvd_32{max-width:800px}._maxWidthFull_1nwvd_35{max-width:100%}._heading_1nwvd_41{display:flex;flex-direction:column;gap:var(--spacing-sm)}._eyebrow_1nwvd_47{font-weight:var(--font-weight-bold)}._title_1nwvd_51{text-wrap:balance}._progress_1nwvd_57{display:flex;flex-direction:column;gap:var(--spacing-sm)}._progressHeader_1nwvd_63{display:flex;justify-content:space-between;align-items:center}._stepLabel_1nwvd_69{font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);color:var(--color-text-primary)}._stepCount_1nwvd_75{font-size:var(--font-size-sm);color:var(--color-secondary-50)}._stepDescription_1nwvd_80{color:var(--color-secondary-75);font-size:var(--font-size-md);margin:0}._fields_1nwvd_88{display:flex;flex-wrap:wrap;gap:var(--spacing-md)}._fieldFull_1nwvd_95{width:100%}._fieldHalf_1nwvd_99{width:calc(50% - var(--spacing-md) / 2)}@media (max-width: 767px){._fieldHalf_1nwvd_99{width:100%}}._fieldThird_1nwvd_107{width:calc(33.333% - var(--spacing-md) * 2 / 3)}@media (max-width: 767px){._fieldThird_1nwvd_107{width:100%}}._actions_1nwvd_117{display:flex;align-items:center;gap:var(--spacing-md);padding-top:var(--spacing-sm)}._submitButton_1nwvd_124{margin-left:auto}._success_1nwvd_130{display:flex;flex-direction:column;align-items:flex-start;gap:var(--spacing-lg);padding:var(--spacing-md) 0 0}._success_1nwvd_130 p{color:var(--color-states-success-bg);font-weight:var(--font-weight-semibold)}._errorBanner_1nwvd_145{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)}
|
|
@@ -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"),d=require("react"),C=require("react-dom"),F=require("../../../x-Dft9NVe_.cjs"),K="_overlay_1u4kf_2",X="_fadeIn_1u4kf_1",B="_container_1u4kf_19",G="_modal_1u4kf_49",H="_slideUp_1u4kf_1",J="_closeButton_1u4kf_60",Q="_title_1u4kf_87",V="_content_1u4kf_97",W="_trigger_1u4kf_117",t={overlay:K,fadeIn:X,container:B,"size-sm":"_size-sm_1u4kf_26","size-md":"_size-md_1u4kf_30","size-lg":"_size-lg_1u4kf_34","size-xl":"_size-xl_1u4kf_38","size-full":"_size-full_1u4kf_42",modal:G,slideUp:H,closeButton:J,title:Q,content:V,trigger:W},Y=()=>{typeof document<"u"&&(document.body.style.overflow="hidden")},E=()=>{typeof document<"u"&&(document.body.style.overflow="")};function Z({content:y,trigger:p,isOpen:k,onOpen:o,onClose:i,size:$="md",closeOnEscape:g=!0,closeOnOverlayClick:w=!0,showCloseButton:N=!0,className:q,overlayClassName:S,style:I,title:_,richTextBlocks:a,renderRichText:b,formData:h,renderForm:z}){const[L,j]=d.useState(!1),m=d.useRef(null),v=k!==void 0,n=v?k:L,M=()=>{v||j(!0),o==null||o()},r=()=>{v||j(!1),i==null||i()},P=()=>n?r():M(),R=()=>{w&&r()};d.useEffect(()=>{if(!g||!n)return;const s=c=>{c.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[n,g]),d.useEffect(()=>(n?Y():E(),()=>E()),[n]),d.useEffect(()=>{if(!n||!m.current)return;const s=m.current,c=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=c[0],u=c[c.length-1],x=f=>{f.key==="Tab"&&(f.shiftKey?document.activeElement===l&&(f.preventDefault(),u==null||u.focus()):document.activeElement===u&&(f.preventDefault(),l==null||l.focus()))};return s.addEventListener("keydown",x),l==null||l.focus(),()=>s.removeEventListener("keydown",x)},[n]);const U=t[`size-${$}`]??"",D=y!==void 0?y:e.jsxs(e.Fragment,{children:[a!=null&&a.length&&b?e.jsx("div",{className:t.intro,children:b({blocks:a})}):null,h&&z?z(h):null]}),A=n?e.jsx("div",{className:`${t.overlay} ${S??""}`.trim(),onClick:R,role:"dialog","aria-modal":"true","aria-labelledby":_?"modal-title":void 0,children:e.jsxs("div",{className:`${U} ${t.container}`,children:[N&&e.jsx("button",{"aria-label":"Close",className:t.closeButton,onClick:r,type:"button",children:e.jsx(F.X,{size:20})}),e.jsxs("div",{ref:m,className:`${t.modal} ${q??""}`.trim(),style:I,onClick:s=>s.stopPropagation(),children:[_&&e.jsx("div",{className:t.title,id:"modal-title",children:_}),e.jsx("div",{className:t.content,children:D})]})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t.trigger,onClick:P,children:p}),typeof window<"u"&&C.createPortal(A,document.body)]})}exports.Modal=Z;
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as X, useRef as B, useEffect as
|
|
1
|
+
import { jsxs as f, Fragment as N, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as X, useRef as B, useEffect as y } from "react";
|
|
3
3
|
import { createPortal as F } from "react-dom";
|
|
4
4
|
import { X as G } from "../../../x-CnsEH4Ox.js";
|
|
5
|
-
import '../../../index38.css';const H = "
|
|
5
|
+
import '../../../index38.css';const H = "_overlay_1u4kf_2", J = "_fadeIn_1u4kf_1", Q = "_container_1u4kf_19", V = "_modal_1u4kf_49", W = "_slideUp_1u4kf_1", Y = "_closeButton_1u4kf_60", Z = "_title_1u4kf_87", T = "_content_1u4kf_97", O = "_trigger_1u4kf_117", e = {
|
|
6
6
|
overlay: H,
|
|
7
7
|
fadeIn: J,
|
|
8
8
|
container: Q,
|
|
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_1u4kf_26",
|
|
10
|
+
"size-md": "_size-md_1u4kf_30",
|
|
11
|
+
"size-lg": "_size-lg_1u4kf_34",
|
|
12
|
+
"size-xl": "_size-xl_1u4kf_38",
|
|
13
|
+
"size-full": "_size-full_1u4kf_42",
|
|
14
14
|
modal: V,
|
|
15
15
|
slideUp: W,
|
|
16
16
|
closeButton: Y,
|
|
17
17
|
title: Z,
|
|
18
18
|
content: T,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, te = () => {
|
|
19
|
+
trigger: O
|
|
20
|
+
}, ee = () => {
|
|
22
21
|
typeof document < "u" && (document.body.style.overflow = "hidden");
|
|
23
22
|
}, $ = () => {
|
|
24
23
|
typeof document < "u" && (document.body.style.overflow = "");
|
|
25
24
|
};
|
|
26
|
-
function
|
|
27
|
-
content:
|
|
25
|
+
function ie({
|
|
26
|
+
content: k,
|
|
28
27
|
trigger: I,
|
|
29
28
|
isOpen: g,
|
|
30
|
-
onOpen:
|
|
31
|
-
onClose:
|
|
29
|
+
onOpen: i,
|
|
30
|
+
onClose: s,
|
|
32
31
|
size: L = "md",
|
|
33
32
|
closeOnEscape: b = !0,
|
|
34
33
|
closeOnOverlayClick: S = !0,
|
|
@@ -36,37 +35,37 @@ function ce({
|
|
|
36
35
|
className: j,
|
|
37
36
|
overlayClassName: x,
|
|
38
37
|
style: P,
|
|
39
|
-
title:
|
|
40
|
-
richTextBlocks:
|
|
38
|
+
title: m,
|
|
39
|
+
richTextBlocks: c,
|
|
41
40
|
renderRichText: h,
|
|
42
|
-
formData:
|
|
43
|
-
renderForm:
|
|
41
|
+
formData: p,
|
|
42
|
+
renderForm: z
|
|
44
43
|
}) {
|
|
45
|
-
const [q, E] = X(!1),
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
}, C = () => t ?
|
|
50
|
-
S &&
|
|
44
|
+
const [q, E] = X(!1), _ = B(null), v = g !== void 0, t = v ? g : q, A = () => {
|
|
45
|
+
v || E(!0), i == null || i();
|
|
46
|
+
}, a = () => {
|
|
47
|
+
v || E(!1), s == null || s();
|
|
48
|
+
}, C = () => t ? a() : A(), D = () => {
|
|
49
|
+
S && a();
|
|
51
50
|
};
|
|
52
|
-
|
|
51
|
+
y(() => {
|
|
53
52
|
if (!b || !t) return;
|
|
54
|
-
const n = (
|
|
55
|
-
|
|
53
|
+
const n = (d) => {
|
|
54
|
+
d.key === "Escape" && a();
|
|
56
55
|
};
|
|
57
56
|
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
58
|
-
}, [t, b]),
|
|
59
|
-
if (!t || !
|
|
60
|
-
const n =
|
|
57
|
+
}, [t, b]), y(() => (t ? ee() : $(), () => $()), [t]), y(() => {
|
|
58
|
+
if (!t || !_.current) return;
|
|
59
|
+
const n = _.current, d = n.querySelectorAll(
|
|
61
60
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
62
|
-
), l =
|
|
61
|
+
), l = d[0], r = d[d.length - 1], w = (u) => {
|
|
63
62
|
u.key === "Tab" && (u.shiftKey ? document.activeElement === l && (u.preventDefault(), r == null || r.focus()) : document.activeElement === r && (u.preventDefault(), l == null || l.focus()));
|
|
64
63
|
};
|
|
65
64
|
return n.addEventListener("keydown", w), l == null || l.focus(), () => n.removeEventListener("keydown", w);
|
|
66
65
|
}, [t]);
|
|
67
|
-
const K = e[`size-${L}`] ?? "", M =
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const K = e[`size-${L}`] ?? "", M = k !== void 0 ? k : /* @__PURE__ */ f(N, { children: [
|
|
67
|
+
c != null && c.length && h ? /* @__PURE__ */ o("div", { className: e.intro, children: h({ blocks: c }) }) : null,
|
|
68
|
+
p && z ? z(p) : null
|
|
70
69
|
] }), R = t ? /* @__PURE__ */ o(
|
|
71
70
|
"div",
|
|
72
71
|
{
|
|
@@ -74,27 +73,27 @@ function ce({
|
|
|
74
73
|
onClick: D,
|
|
75
74
|
role: "dialog",
|
|
76
75
|
"aria-modal": "true",
|
|
77
|
-
"aria-labelledby":
|
|
78
|
-
children: /* @__PURE__ */
|
|
76
|
+
"aria-labelledby": m ? "modal-title" : void 0,
|
|
77
|
+
children: /* @__PURE__ */ f("div", { className: `${K} ${e.container}`, children: [
|
|
79
78
|
U && /* @__PURE__ */ o(
|
|
80
79
|
"button",
|
|
81
80
|
{
|
|
82
81
|
"aria-label": "Close",
|
|
83
82
|
className: e.closeButton,
|
|
84
|
-
onClick:
|
|
83
|
+
onClick: a,
|
|
85
84
|
type: "button",
|
|
86
85
|
children: /* @__PURE__ */ o(G, { size: 20 })
|
|
87
86
|
}
|
|
88
87
|
),
|
|
89
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ f(
|
|
90
89
|
"div",
|
|
91
90
|
{
|
|
92
|
-
ref:
|
|
91
|
+
ref: _,
|
|
93
92
|
className: `${e.modal} ${j ?? ""}`.trim(),
|
|
94
93
|
style: P,
|
|
95
94
|
onClick: (n) => n.stopPropagation(),
|
|
96
95
|
children: [
|
|
97
|
-
|
|
96
|
+
m && /* @__PURE__ */ o("div", { className: e.title, id: "modal-title", children: m }),
|
|
98
97
|
/* @__PURE__ */ o("div", { className: e.content, children: M })
|
|
99
98
|
]
|
|
100
99
|
}
|
|
@@ -102,11 +101,11 @@ function ce({
|
|
|
102
101
|
] })
|
|
103
102
|
}
|
|
104
103
|
) : null;
|
|
105
|
-
return /* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ f(N, { children: [
|
|
106
105
|
/* @__PURE__ */ o("div", { className: e.trigger, onClick: C, children: I }),
|
|
107
106
|
typeof window < "u" && F(R, document.body)
|
|
108
107
|
] });
|
|
109
108
|
}
|
|
110
109
|
export {
|
|
111
|
-
|
|
110
|
+
ie as Modal
|
|
112
111
|
};
|
package/dist/index38.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_1u4kf_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_1u4kf_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}._container_1u4kf_19{position:relative;display:flex;flex-direction:column}._size-sm_1u4kf_26{width:90%;max-width:400px}._size-md_1u4kf_30{width:90%;max-width:600px}._size-lg_1u4kf_34{width:90%;max-width:800px}._size-xl_1u4kf_38{width:90%;max-width:1200px}._size-full_1u4kf_42{width:95%;height:95dvh;max-height:95dvh}._modal_1u4kf_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_1u4kf_1 .3s ease}._closeButton_1u4kf_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_1u4kf_60:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_1u4kf_60:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_1u4kf_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_1u4kf_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_1u4kf_97 video,._content_1u4kf_97 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_1u4kf_97 video{width:100%}._trigger_1u4kf_117{width:auto;display:inline-block;cursor:pointer}@keyframes _fadeIn_1u4kf_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUp_1u4kf_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){._modal_1u4kf_49{padding:var(--spacing-lg, 1.5rem);max-height:85dvh}._size-sm_1u4kf_26,._size-md_1u4kf_30,._size-lg_1u4kf_34,._size-xl_1u4kf_38{width:95%}._title_1u4kf_87{font-size:var(--font-size-lg, 1.25rem);padding-right:var(--spacing-lg, 1.5rem)}}@media (max-width: 480px){._overlay_1u4kf_2{padding:var(--spacing-sm, .5rem)}._modal_1u4kf_49{padding:var(--spacing-md, 1rem);max-height:90dvh}._title_1u4kf_87{font-size:var(--font-size-md, 1rem);margin-bottom:var(--spacing-md, 1rem)}}
|
|
@@ -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-DU5sh1Fk.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-D1m8xWkL.js";
|
|
11
11
|
export {
|
|
12
12
|
l as FormField
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),U=require("../../../core/components/Form/index.cjs"),E=require("../../../index-0SVQqhAg.cjs"),V=require("../../../core/components/ProgressBar/index.cjs"),W=require("../../hooks/useStyleClasses.cjs"),s=require("../../../FormField-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),U=require("../../../core/components/Form/index.cjs"),E=require("../../../index-0SVQqhAg.cjs"),V=require("../../../core/components/ProgressBar/index.cjs"),W=require("../../hooks/useStyleClasses.cjs"),s=require("../../../FormField-DU5sh1Fk.cjs"),_=require("./validate.cjs");function M(r,t){switch(t.type){case"SET_VALUE":return{...r,values:{...r.values,[t.name]:t.value},errors:{...r.errors,[t.name]:""}};case"SET_ERRORS":return{...r,errors:t.errors};case"CLEAR_ERROR":return{...r,errors:{...r.errors,[t.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:t.value};case"SET_RESULT":return{...r,submitResult:t.result,isSubmitting:!1};case"RESET":return{...r,currentStep:0,errors:{},submitResult:null,isSubmitting:!1};default:return r}}function A({id:r,heading:t,layout:x="vertical",maxWidth:B="md",steps:S,submitLabel:h="Submit",nextLabel:C="Next",backLabel:T="Back",successMessage:F="Thank you! Your submission has been received.",errorMessage:p="Something went wrong. Please try again.",styleOptions:R,renderRichText:n,onSubmit:v}){const j=W.useStyleClasses(R??{}),N={sm:s.styles.maxWidthSm,md:s.styles.maxWidthMd,lg:s.styles.maxWidthLg,full:s.styles.maxWidthFull}[B],g=u.useMemo(()=>_.buildInitialValues(S),[]),[L,c]=u.useReducer(M,{values:g,errors:{},currentStep:0,isSubmitting:!1,submitResult:null}),{values:i,errors:P,currentStep:m,isSubmitting:d,submitResult:o}=L,y=S.length,k=y>1,f=m===y-1,$=(m+1)/y*100,a=S[m],q=u.useCallback((l,b)=>{c({type:"SET_VALUE",name:l,value:b})},[]),w=u.useCallback(()=>{const l=_.validateStep(a.fields,i);if(Object.keys(l).length>0){c({type:"SET_ERRORS",errors:l});return}c({type:"NEXT_STEP"})},[a.fields,i]),I=u.useCallback(()=>{c({type:"PREV_STEP"})},[]),O=u.useCallback(async()=>{const l=_.validateStep(a.fields,i);if(Object.keys(l).length>0){c({type:"SET_ERRORS",errors:l});return}c({type:"SET_SUBMITTING",value:!0});try{const b=await v(i);c({type:"SET_RESULT",result:b})}catch{c({type:"SET_RESULT",result:{success:!1,message:p}})}},[a.fields,i,v,p]);return o!=null&&o.success?e.jsx("section",{id:r,className:`${s.styles.formBlock} ${j}`,children:e.jsx("div",{className:`${s.styles.formInner} ${N}`,children:e.jsx("div",{className:s.styles.container,children:e.jsxs("div",{className:s.styles.success,children:[e.jsx("p",{children:o.message??F}),e.jsx(E.Button,{as:"button",variant:"secondary",onClick:()=>c({type:"RESET"}),children:"Submit another response"})]})})})}):e.jsx("section",{id:r,className:`${s.styles.formBlock} ${j}`,children:e.jsx("div",{className:`${s.styles.formInner} ${N}`,children:e.jsxs("div",{className:s.styles.container,children:[((t==null?void 0:t.title)||(t==null?void 0:t.description))&&e.jsxs("div",{className:s.styles.heading,children:[t.eyebrow&&(n==null?void 0:n({blocks:t.eyebrow,className:s.styles.eyebrow})),t.title&&(n==null?void 0:n({blocks:t.title,className:s.styles.title})),t.description&&(n==null?void 0:n({blocks:t.description}))]}),k&&e.jsxs("div",{className:s.styles.progress,children:[e.jsxs("div",{className:s.styles.progressHeader,children:[e.jsx("span",{className:s.styles.stepLabel,children:a.title}),e.jsxs("span",{className:s.styles.stepCount,children:[m+1," / ",y]})]}),e.jsx(V.ProgressBar,{progress:$,variant:"primary",size:"sm",showLabel:!1})]}),a.description&&e.jsx("p",{className:s.styles.stepDescription,children:a.description}),o&&!o.success&&e.jsx("div",{className:s.styles.errorBanner,role:"alert",children:o.message??p}),e.jsxs(U.Form,{layout:x,noValidate:!0,onSubmit:l=>{l.preventDefault(),f?O():w()},children:[e.jsx("div",{className:s.styles.fields,children:a.fields.map(l=>e.jsx(s.FormField,{field:l,value:i[l.name.current],error:P[l.name.current],onChange:q},l._key))}),e.jsxs("div",{className:s.styles.actions,children:[k&&m>0&&e.jsx(E.Button,{as:"button",type:"button",variant:"secondary",onClick:I,disabled:d,children:T}),e.jsx(E.Button,{as:"button",type:"submit",variant:"primary",disabled:d,className:s.styles.submitButton,children:d?"Submitting…":f?h:C})]})]})]})})})}exports.FormBlock=A;
|
|
@@ -4,7 +4,7 @@ import { Form as M } from "../../../core/components/Form/index.mjs";
|
|
|
4
4
|
import { B as y } from "../../../index-aWdsapYP.js";
|
|
5
5
|
import { ProgressBar as G } from "../../../core/components/ProgressBar/index.mjs";
|
|
6
6
|
import { useStyleClasses as X } from "../../hooks/useStyleClasses.mjs";
|
|
7
|
-
import { s, F as z } from "../../../FormField-
|
|
7
|
+
import { s, F as z } from "../../../FormField-D1m8xWkL.js";
|
|
8
8
|
import { buildInitialValues as H, validateStep as B } from "./validate.mjs";
|
|
9
9
|
function Y(r, e) {
|
|
10
10
|
switch (e.type) {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require('./FormField.css');const a=require("react/jsx-runtime"),v=require("./core/components/Input/index.cjs"),q=require("./core/components/Textarea/index.cjs"),b=require("./core/components/Select/index.cjs"),_=require("./core/components/Checkbox/index.cjs"),T=require("./core/components/Radio/index.cjs"),m=require("./core/components/Fieldset/index.cjs"),k=require("./core/components/DatePicker/index.cjs"),W=require("./core/components/Range/index.cjs"),F="_formBlock_b7mbf_1",j="_container_b7mbf_7",C="_formInner_b7mbf_20",w="_maxWidthSm_b7mbf_26",L="_maxWidthMd_b7mbf_29",y="_maxWidthLg_b7mbf_32",S="_maxWidthFull_b7mbf_35",B="_heading_b7mbf_41",$="_eyebrow_b7mbf_47",H="_title_b7mbf_51",G="_progress_b7mbf_57",I="_progressHeader_b7mbf_63",M="_stepLabel_b7mbf_69",D="_stepCount_b7mbf_75",O="_stepDescription_b7mbf_80",P="_fields_b7mbf_88",R="_fieldFull_b7mbf_95",V="_fieldHalf_b7mbf_99",N="_fieldThird_b7mbf_107",z="_actions_b7mbf_117",A="_submitButton_b7mbf_124",E="_success_b7mbf_130",J="_errorBanner_b7mbf_143",u={formBlock:F,container:j,formInner:C,maxWidthSm:w,maxWidthMd:L,maxWidthLg:y,maxWidthFull:S,heading:B,eyebrow:$,title:H,progress:G,progressHeader:I,stepLabel:M,stepCount:D,stepDescription:O,fields:P,fieldFull:R,fieldHalf:V,fieldThird:N,actions:z,submitButton:A,success:E,errorBanner:J};function i(e){return(e??[]).map(n=>({label:n.label,value:n.value.current,disabled:n.disabled}))}function h(e){return(e??[]).map(n=>({label:n.label,options:n.options.map(s=>({label:s.label,value:s.value.current,disabled:s.disabled}))}))}function K({field:e,value:n,error:s,onChange:l}){const r=e.name.current,p={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(v.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(q.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?h(e.optionGroups):i(e.options);return a.jsx(b.Select,{...c,placeholder:e.placeholder,options:t,value:n??"",fullWidth:!0,onChange:o=>l(r,o.target.value)})}case"multiselect":{const t=e.useOptionGroups?h(e.optionGroups):i(e.options);return a.jsx(b.Select,{...c,multiple:!0,options:t,value:n??[],showSelectedCount:!0,onChange:o=>l(r,o)})}case"checkbox":return a.jsx(_.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(m.Fieldset,{legend:e.label,error:!!s,helperText:s,children:i(e.options).map(o=>a.jsx(_.Checkbox,{id:`${r}-${o.value}`,name:`${r}[]`,label:o.label,checked:t.includes(o.value),disabled:o.disabled||e.disabled,onChange:x=>{const g=x.target.checked?[...t,o.value]:t.filter(f=>f!==o.value);l(r,g)}},o.value))})}case"radio":return a.jsx(m.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:`${p}`,children:d()})}exports.FormField=K;exports.styles=u;
|