@launchpad-ui/form 0.8.12 → 0.8.14
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/Checkbox.d.ts +3 -9
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/CompactTextField.d.ts +1 -9
- package/dist/CompactTextField.d.ts.map +1 -1
- package/dist/FieldError.d.ts +3 -3
- package/dist/FieldError.d.ts.map +1 -1
- package/dist/FieldSet.d.ts +3 -3
- package/dist/FieldSet.d.ts.map +1 -1
- package/dist/Form.d.ts +3 -3
- package/dist/Form.d.ts.map +1 -1
- package/dist/FormField.d.ts +1 -1
- package/dist/FormField.d.ts.map +1 -1
- package/dist/FormGroup.d.ts +3 -3
- package/dist/FormGroup.d.ts.map +1 -1
- package/dist/FormHint.d.ts +3 -3
- package/dist/FormHint.d.ts.map +1 -1
- package/dist/IconField.d.ts +3 -3
- package/dist/IconField.d.ts.map +1 -1
- package/dist/Label.d.ts +3 -3
- package/dist/Label.d.ts.map +1 -1
- package/dist/Radio.d.ts +3 -3
- package/dist/Radio.d.ts.map +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RequiredAsterisk.d.ts +3 -3
- package/dist/RequiredAsterisk.d.ts.map +1 -1
- package/dist/SelectField.d.ts +3 -3
- package/dist/SelectField.d.ts.map +1 -1
- package/dist/TextArea.d.ts +3 -5
- package/dist/TextArea.d.ts.map +1 -1
- package/dist/TextField.d.ts +3 -8
- package/dist/TextField.d.ts.map +1 -1
- package/dist/index.es.js +238 -265
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +239 -266
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require('./style.css');
|
2
2
|
"use strict";
|
3
|
-
Object.
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
4
5
|
const react = require("react");
|
5
6
|
const classix = require("classix");
|
6
|
-
const jsxRuntime = require("react/jsx-runtime");
|
7
7
|
const icons = require("@launchpad-ui/icons");
|
8
8
|
const visuallyHidden = require("@react-aria/visually-hidden");
|
9
9
|
const formGroup = "_formGroup_p76jo_10";
|
@@ -70,12 +70,7 @@ const RequiredAsterisk = ({
|
|
70
70
|
...rest
|
71
71
|
}) => {
|
72
72
|
const classes = classix.cx(styles.requiredAsterisk, className);
|
73
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", {
|
74
|
-
...rest,
|
75
|
-
"data-test-id": testId,
|
76
|
-
className: classes,
|
77
|
-
children: "*"
|
78
|
-
});
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { ...rest, "data-test-id": testId, className: classes, children: "*" });
|
79
74
|
};
|
80
75
|
const Label = ({
|
81
76
|
disabled,
|
@@ -87,141 +82,149 @@ const Label = ({
|
|
87
82
|
...rest
|
88
83
|
}) => {
|
89
84
|
const classes = classix.cx(styles.label, className, disabled && styles.labelDisabled);
|
90
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("label", {
|
91
|
-
|
92
|
-
"
|
93
|
-
|
94
|
-
|
95
|
-
className: styles.labelOptional,
|
96
|
-
children: "(optional)"
|
97
|
-
}), required && !optional && /* @__PURE__ */ jsxRuntime.jsx(RequiredAsterisk, {})]
|
98
|
-
});
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { ...rest, "data-test-id": testId, className: classes, children: [
|
86
|
+
children,
|
87
|
+
optional && !required && /* @__PURE__ */ jsxRuntime.jsx("small", { className: styles.labelOptional, children: "(optional)" }),
|
88
|
+
required && !optional && /* @__PURE__ */ jsxRuntime.jsx(RequiredAsterisk, {})
|
89
|
+
] });
|
99
90
|
};
|
100
|
-
const Checkbox = react.forwardRef(
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
91
|
+
const Checkbox = react.forwardRef(
|
92
|
+
({
|
93
|
+
"aria-label": ariaLabel,
|
94
|
+
"aria-labelledby": ariaLabelledby,
|
95
|
+
children,
|
96
|
+
disabled,
|
97
|
+
checked,
|
98
|
+
labelClassName,
|
99
|
+
"data-test-id": testId = "checkbox",
|
100
|
+
...rest
|
101
|
+
}, ref) => {
|
102
|
+
const hasAriaLabel = ariaLabel !== void 0 || ariaLabelledby !== void 0;
|
103
|
+
if (!children && !hasAriaLabel) {
|
104
|
+
console.warn(
|
105
|
+
"If you do not provide children, you must specify an aria-label for accessibility"
|
106
|
+
);
|
107
|
+
}
|
108
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Label, { className: labelClassName, children: [
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
110
|
+
"input",
|
111
|
+
{
|
112
|
+
...rest,
|
113
|
+
ref,
|
114
|
+
checked,
|
115
|
+
"aria-checked": checked ? "true" : "false",
|
116
|
+
"aria-label": ariaLabel,
|
117
|
+
"aria-labelledby": ariaLabelledby,
|
118
|
+
className: styles.checkbox,
|
119
|
+
disabled,
|
120
|
+
type: "checkbox",
|
121
|
+
"data-test-id": testId
|
122
|
+
}
|
123
|
+
),
|
124
|
+
" ",
|
125
|
+
disabled ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelDisabled, children }) : children
|
126
|
+
] });
|
113
127
|
}
|
114
|
-
|
115
|
-
className: labelClassName,
|
116
|
-
children: [/* @__PURE__ */ jsxRuntime.jsx("input", {
|
117
|
-
...rest,
|
118
|
-
ref,
|
119
|
-
checked,
|
120
|
-
"aria-checked": checked ? "true" : "false",
|
121
|
-
"aria-label": ariaLabel,
|
122
|
-
"aria-labelledby": ariaLabelledby,
|
123
|
-
className: styles.checkbox,
|
124
|
-
disabled,
|
125
|
-
type: "checkbox",
|
126
|
-
"data-test-id": testId
|
127
|
-
}), " ", disabled ? /* @__PURE__ */ jsxRuntime.jsx("span", {
|
128
|
-
className: styles.labelDisabled,
|
129
|
-
children
|
130
|
-
}) : children]
|
131
|
-
});
|
132
|
-
});
|
128
|
+
);
|
133
129
|
Checkbox.displayName = "Checkbox";
|
134
130
|
const createFieldErrorId = (fieldIdentifier) => fieldIdentifier ? `${[...fieldIdentifier].join("")}-err` : void 0;
|
135
|
-
const TextField = react.forwardRef(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
className: styles.suffixContainer,
|
150
|
-
|
131
|
+
const TextField = react.forwardRef(
|
132
|
+
({
|
133
|
+
className,
|
134
|
+
type = "text",
|
135
|
+
tiny = false,
|
136
|
+
readOnly,
|
137
|
+
tabIndex = 0,
|
138
|
+
suffix: suffix2,
|
139
|
+
overrideWidth,
|
140
|
+
"data-test-id": testId = "text-field",
|
141
|
+
...rest
|
142
|
+
}, ref) => {
|
143
|
+
const classes = overrideWidth ? className : classix.cx(styles.formInput, tiny && styles.formInputTiny, className);
|
144
|
+
if (suffix2) {
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.suffixContainer, children: [
|
146
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
147
|
+
"input",
|
148
|
+
{
|
149
|
+
...rest,
|
150
|
+
type,
|
151
|
+
"data-test-id": testId,
|
152
|
+
className: classes,
|
153
|
+
readOnly,
|
154
|
+
ref,
|
155
|
+
"aria-describedby": rest["aria-describedby"] || createFieldErrorId(rest.id)
|
156
|
+
}
|
157
|
+
),
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: styles.suffix, htmlFor: rest.id, children: suffix2 })
|
159
|
+
] });
|
160
|
+
}
|
161
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
162
|
+
"input",
|
163
|
+
{
|
151
164
|
...rest,
|
152
165
|
type,
|
153
|
-
"data-test-id": testId,
|
154
166
|
className: classes,
|
155
167
|
readOnly,
|
168
|
+
tabIndex,
|
156
169
|
ref,
|
170
|
+
"data-test-id": testId,
|
171
|
+
style: overrideWidth ? {
|
172
|
+
width: overrideWidth
|
173
|
+
} : void 0,
|
157
174
|
"aria-describedby": rest["aria-describedby"] || createFieldErrorId(rest.id)
|
158
|
-
}
|
159
|
-
|
160
|
-
htmlFor: rest.id,
|
161
|
-
children: suffix2
|
162
|
-
})]
|
163
|
-
});
|
175
|
+
}
|
176
|
+
);
|
164
177
|
}
|
165
|
-
|
166
|
-
...rest,
|
167
|
-
type,
|
168
|
-
className: classes,
|
169
|
-
readOnly,
|
170
|
-
tabIndex,
|
171
|
-
ref,
|
172
|
-
"data-test-id": testId,
|
173
|
-
style: overrideWidth ? {
|
174
|
-
width: overrideWidth
|
175
|
-
} : void 0,
|
176
|
-
"aria-describedby": rest["aria-describedby"] || createFieldErrorId(rest.id)
|
177
|
-
});
|
178
|
-
});
|
178
|
+
);
|
179
179
|
TextField.displayName = "TextField";
|
180
|
-
const CompactTextField = react.forwardRef(
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
htmlFor: id,
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
180
|
+
const CompactTextField = react.forwardRef(
|
181
|
+
({
|
182
|
+
className,
|
183
|
+
id,
|
184
|
+
label: label2,
|
185
|
+
needsErrorFeedback,
|
186
|
+
value,
|
187
|
+
onFocus,
|
188
|
+
onBlur,
|
189
|
+
"data-test-id": testId = "compact-text-field",
|
190
|
+
...rest
|
191
|
+
}, ref) => {
|
192
|
+
const [isActive2, setIsActive] = react.useState(
|
193
|
+
(typeof value === "boolean" || value ? value.toString() : "").trim().length !== 0
|
194
|
+
);
|
195
|
+
const isActiveState = isActive2 || needsErrorFeedback;
|
196
|
+
const classes = classix.cx(styles.compactTextField, className, isActiveState && styles.isActive);
|
197
|
+
const placeholder = isActiveState ? "" : label2;
|
198
|
+
const handleFocus = (event) => {
|
199
|
+
setIsActive(true);
|
200
|
+
if (onFocus) {
|
201
|
+
onFocus(event);
|
202
|
+
}
|
203
|
+
};
|
204
|
+
const handleBlur = (event) => {
|
205
|
+
const value2 = event.target.value || "";
|
206
|
+
setIsActive(value2.trim().length !== 0);
|
207
|
+
if (onBlur) {
|
208
|
+
onBlur(event);
|
209
|
+
}
|
210
|
+
};
|
211
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, "data-test-id": testId, children: [
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: id, children: label2 }),
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
214
|
+
TextField,
|
215
|
+
{
|
216
|
+
...rest,
|
217
|
+
id,
|
218
|
+
placeholder,
|
219
|
+
value,
|
220
|
+
ref,
|
221
|
+
onFocus: handleFocus,
|
222
|
+
onBlur: handleBlur
|
223
|
+
}
|
224
|
+
)
|
225
|
+
] });
|
226
|
+
}
|
227
|
+
);
|
225
228
|
CompactTextField.displayName = "CompactTextField";
|
226
229
|
const FieldError = ({
|
227
230
|
name,
|
@@ -233,17 +236,22 @@ const FieldError = ({
|
|
233
236
|
if (!errorMessage) {
|
234
237
|
return null;
|
235
238
|
}
|
236
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
239
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
240
|
+
"span",
|
241
|
+
{
|
242
|
+
...rest,
|
243
|
+
className: classix.cx(styles.fieldError, className),
|
244
|
+
"aria-live": "polite",
|
245
|
+
"data-test-id": testId,
|
246
|
+
"aria-label": "Error",
|
247
|
+
id: createFieldErrorId(name),
|
248
|
+
children: [
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.AlertRhombus, { size: "small" }),
|
250
|
+
" ",
|
251
|
+
errorMessage
|
252
|
+
]
|
253
|
+
}
|
254
|
+
);
|
247
255
|
};
|
248
256
|
const FieldSet = ({
|
249
257
|
children,
|
@@ -252,12 +260,7 @@ const FieldSet = ({
|
|
252
260
|
...rest
|
253
261
|
}) => {
|
254
262
|
const classes = classix.cx(styles.fieldSet, className);
|
255
|
-
return /* @__PURE__ */ jsxRuntime.jsx("fieldset", {
|
256
|
-
"data-test-id": testId,
|
257
|
-
className: classes,
|
258
|
-
...rest,
|
259
|
-
children
|
260
|
-
});
|
263
|
+
return /* @__PURE__ */ jsxRuntime.jsx("fieldset", { "data-test-id": testId, className: classes, ...rest, children });
|
261
264
|
};
|
262
265
|
const Form = (props) => {
|
263
266
|
const {
|
@@ -268,13 +271,13 @@ const Form = (props) => {
|
|
268
271
|
"data-test-id": testId = "form",
|
269
272
|
...rest
|
270
273
|
} = props;
|
271
|
-
const classes = classix.cx(
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
});
|
274
|
+
const classes = classix.cx(
|
275
|
+
styles.form,
|
276
|
+
className,
|
277
|
+
inline && styles.formInline,
|
278
|
+
!!hasIncreasedErrorMargin && styles.formIncreasedErrorMargin
|
279
|
+
);
|
280
|
+
return /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, "data-test-id": testId, className: classes, children });
|
278
281
|
};
|
279
282
|
const FormGroup = (props) => {
|
280
283
|
const {
|
@@ -286,13 +289,12 @@ const FormGroup = (props) => {
|
|
286
289
|
"data-test-id": testId = "form-group",
|
287
290
|
...rest
|
288
291
|
} = props;
|
289
|
-
const classes = classix.cx(
|
290
|
-
|
291
|
-
className
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
});
|
292
|
+
const classes = classix.cx(
|
293
|
+
styles.formGroup,
|
294
|
+
className,
|
295
|
+
!ignoreValidation && isInvalid2 && styles.isInvalid
|
296
|
+
);
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsx("fieldset", { className: classes, "data-test-id": testId, ...rest, children });
|
296
298
|
};
|
297
299
|
const FormHint = ({
|
298
300
|
className,
|
@@ -301,12 +303,7 @@ const FormHint = ({
|
|
301
303
|
...rest
|
302
304
|
}) => {
|
303
305
|
const classes = classix.cx(styles.hint, className);
|
304
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
305
|
-
...rest,
|
306
|
-
"data-test-id": testId,
|
307
|
-
className: classes,
|
308
|
-
children
|
309
|
-
});
|
306
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, "data-test-id": testId, className: classes, children });
|
310
307
|
};
|
311
308
|
const FormField = ({
|
312
309
|
isRequired,
|
@@ -325,26 +322,23 @@ const FormField = ({
|
|
325
322
|
const handleBlur = () => {
|
326
323
|
onBlur && onBlur(name);
|
327
324
|
};
|
328
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
isInvalid: isInvalid2,
|
333
|
-
onBlur: handleBlur,
|
334
|
-
"data-test-id": testId,
|
335
|
-
children: [label2 && /* @__PURE__ */ jsxRuntime.jsx(Label, {
|
336
|
-
htmlFor,
|
337
|
-
required: isRequired,
|
338
|
-
children: label2
|
339
|
-
}), hint2 && /* @__PURE__ */ jsxRuntime.jsx(FormHint, {
|
340
|
-
className: styles.hint,
|
341
|
-
children: hint2
|
342
|
-
}), children, /* @__PURE__ */ jsxRuntime.jsx(FieldError, {
|
343
|
-
className: styles.fieldErrorMessage,
|
325
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
326
|
+
FormGroup,
|
327
|
+
{
|
328
|
+
className: classix.cx(styles.field, className),
|
344
329
|
name,
|
345
|
-
|
346
|
-
|
347
|
-
|
330
|
+
ignoreValidation,
|
331
|
+
isInvalid: isInvalid2,
|
332
|
+
onBlur: handleBlur,
|
333
|
+
"data-test-id": testId,
|
334
|
+
children: [
|
335
|
+
label2 && /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor, required: isRequired, children: label2 }),
|
336
|
+
hint2 && /* @__PURE__ */ jsxRuntime.jsx(FormHint, { className: styles.hint, children: hint2 }),
|
337
|
+
children,
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldError, { className: styles.fieldErrorMessage, name, errorMessage })
|
339
|
+
]
|
340
|
+
}
|
341
|
+
);
|
348
342
|
};
|
349
343
|
const IconField = ({
|
350
344
|
icon,
|
@@ -355,15 +349,10 @@ const IconField = ({
|
|
355
349
|
}) => {
|
356
350
|
const Icon = icon;
|
357
351
|
const classes = classix.cx(styles.iconField, className);
|
358
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
359
|
-
|
360
|
-
"
|
361
|
-
|
362
|
-
children: [children, /* @__PURE__ */ jsxRuntime.jsx(Icon, {
|
363
|
-
size: "small",
|
364
|
-
className: styles.iconFieldIcon
|
365
|
-
})]
|
366
|
-
});
|
352
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, "data-test-id": testId, ...rest, children: [
|
353
|
+
children,
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: "small", className: styles.iconFieldIcon })
|
355
|
+
] });
|
367
356
|
};
|
368
357
|
const Radio = ({
|
369
358
|
"aria-label": ariaLabel,
|
@@ -380,29 +369,27 @@ const Radio = ({
|
|
380
369
|
}) => {
|
381
370
|
const hasAriaLabel = ariaLabel !== void 0 || ariaLabelledby !== void 0;
|
382
371
|
if (!children && !hasAriaLabel) {
|
383
|
-
console.warn(
|
372
|
+
console.warn(
|
373
|
+
"If you do not provide children, you must specify an aria-label for accessibility"
|
374
|
+
);
|
384
375
|
}
|
385
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
children
|
403
|
-
}) : children
|
404
|
-
})]
|
405
|
-
});
|
376
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
377
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
378
|
+
"input",
|
379
|
+
{
|
380
|
+
...rest,
|
381
|
+
"aria-label": ariaLabel,
|
382
|
+
"aria-labelledby": ariaLabelledby,
|
383
|
+
className: classix.cx(styles.radio, className),
|
384
|
+
checked,
|
385
|
+
disabled,
|
386
|
+
id,
|
387
|
+
"data-test-id": testId,
|
388
|
+
type: "radio"
|
389
|
+
}
|
390
|
+
),
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClassName, htmlFor: id, style: labelStyle, children: disabled ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.labelDisabled, children }) : children })
|
392
|
+
] });
|
406
393
|
};
|
407
394
|
const RadioGroup = (props) => {
|
408
395
|
const {
|
@@ -455,55 +442,41 @@ const RadioGroup = (props) => {
|
|
455
442
|
return null;
|
456
443
|
}
|
457
444
|
const radios = react.Children.map(children, (child) => updateRadioElems(child));
|
458
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", {
|
459
|
-
"
|
460
|
-
|
461
|
-
|
462
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(visuallyHidden.VisuallyHidden, {
|
463
|
-
children: legend
|
464
|
-
})
|
465
|
-
}), /* @__PURE__ */ jsxRuntime.jsx("div", {
|
466
|
-
...rest,
|
467
|
-
children: radios
|
468
|
-
})]
|
469
|
-
});
|
445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { "data-test-id": testId, ref: fieldsetRef, children: [
|
446
|
+
legend && /* @__PURE__ */ jsxRuntime.jsx("legend", { children: /* @__PURE__ */ jsxRuntime.jsx(visuallyHidden.VisuallyHidden, { children: legend }) }),
|
447
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, children: radios })
|
448
|
+
] });
|
470
449
|
};
|
471
|
-
const SelectField = (
|
472
|
-
className,
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
ref,
|
502
|
-
"data-test-id": testId,
|
503
|
-
"aria-describedby": props["aria-describedby"] || createFieldErrorId(props.id),
|
504
|
-
onKeyDown
|
505
|
-
});
|
506
|
-
});
|
450
|
+
const SelectField = react.forwardRef(
|
451
|
+
({ className, children, "data-test-id": testId = "select", ...rest }, ref) => {
|
452
|
+
const classes = classix.cx(styles.formInput, className);
|
453
|
+
return /* @__PURE__ */ jsxRuntime.jsx("select", { ...rest, "data-test-id": testId, className: classes, ref, children });
|
454
|
+
}
|
455
|
+
);
|
456
|
+
SelectField.displayName = "SelectField";
|
457
|
+
const TextArea = react.forwardRef(
|
458
|
+
({ className, "data-test-id": testId = "text-area", ...props }, ref) => {
|
459
|
+
const onKeyDown = (e) => {
|
460
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowLeft") {
|
461
|
+
e.stopPropagation();
|
462
|
+
}
|
463
|
+
if (e.key === "Escape") {
|
464
|
+
e.nativeEvent.stopImmediatePropagation();
|
465
|
+
}
|
466
|
+
};
|
467
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
468
|
+
"textarea",
|
469
|
+
{
|
470
|
+
...props,
|
471
|
+
className: classix.cx(styles.formInput, className),
|
472
|
+
ref,
|
473
|
+
"data-test-id": testId,
|
474
|
+
"aria-describedby": props["aria-describedby"] || createFieldErrorId(props.id),
|
475
|
+
onKeyDown
|
476
|
+
}
|
477
|
+
);
|
478
|
+
}
|
479
|
+
);
|
507
480
|
TextArea.displayName = "TextArea";
|
508
481
|
exports.Checkbox = Checkbox;
|
509
482
|
exports.CompactTextField = CompactTextField;
|