@rjsf/mantine 6.6.1 → 6.7.0
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/LICENSE.md +201 -0
- package/dist/index.cjs +356 -302
- package/dist/index.cjs.map +4 -4
- package/dist/mantine.esm.js +218 -226
- package/dist/mantine.esm.js.map +4 -4
- package/dist/mantine.umd.js +175 -127
- package/lib/Form/index.d.ts +3 -3
- package/lib/Form/index.js.map +1 -1
- package/lib/Theme/index.d.ts +2 -2
- package/lib/templates/ArrayFieldItemTemplate.d.ts +2 -2
- package/lib/templates/ArrayFieldItemTemplate.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate.d.ts +2 -2
- package/lib/templates/ArrayFieldTemplate.js +1 -1
- package/lib/templates/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTitleTemplate.d.ts +2 -2
- package/lib/templates/ArrayFieldTitleTemplate.js +1 -1
- package/lib/templates/ArrayFieldTitleTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate.d.ts +2 -2
- package/lib/templates/BaseInputTemplate.js +9 -7
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/AddButton.d.ts +2 -2
- package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/IconButton.d.ts +15 -8
- package/lib/templates/ButtonTemplates/IconButton.js +14 -6
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/SubmitButton.d.ts +2 -2
- package/lib/templates/ButtonTemplates/SubmitButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/index.d.ts +1 -1
- package/lib/templates/CyclicSchemaExpandTemplate.d.ts +6 -0
- package/lib/templates/CyclicSchemaExpandTemplate.js +15 -0
- package/lib/templates/CyclicSchemaExpandTemplate.js.map +1 -0
- package/lib/templates/DescriptionField.d.ts +2 -2
- package/lib/templates/ErrorList.d.ts +2 -2
- package/lib/templates/ErrorList.js.map +1 -1
- package/lib/templates/FieldErrorTemplate.d.ts +2 -2
- package/lib/templates/FieldErrorTemplate.js +1 -1
- package/lib/templates/FieldErrorTemplate.js.map +1 -1
- package/lib/templates/FieldHelpTemplate.d.ts +2 -2
- package/lib/templates/FieldHelpTemplate.js.map +1 -1
- package/lib/templates/FieldTemplate.d.ts +2 -2
- package/lib/templates/FieldTemplate.js +1 -1
- package/lib/templates/FieldTemplate.js.map +1 -1
- package/lib/templates/GridTemplate.d.ts +2 -2
- package/lib/templates/MultiSchemaFieldTemplate.d.ts +2 -2
- package/lib/templates/ObjectFieldTemplate.d.ts +2 -2
- package/lib/templates/ObjectFieldTemplate.js +1 -1
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate.d.ts +2 -2
- package/lib/templates/OptionalDataControlsTemplate.js +1 -1
- package/lib/templates/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/templates/TitleField.d.ts +2 -2
- package/lib/templates/WrapIfAdditionalTemplate.d.ts +2 -2
- package/lib/templates/WrapIfAdditionalTemplate.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/templates/icons.d.ts +7 -7
- package/lib/templates/index.d.ts +1 -1
- package/lib/templates/index.js +2 -0
- package/lib/templates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js.map +1 -1
- package/lib/widgets/CheckboxWidget.d.ts +2 -2
- package/lib/widgets/CheckboxWidget.js +1 -1
- package/lib/widgets/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget.d.ts +2 -2
- package/lib/widgets/CheckboxesWidget.js +1 -1
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/ColorWidget.d.ts +2 -2
- package/lib/widgets/ColorWidget.js +3 -3
- package/lib/widgets/ColorWidget.js.map +1 -1
- package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +2 -2
- package/lib/widgets/DateTime/AltDateWidget.d.ts +2 -2
- package/lib/widgets/DateTime/AltDateWidget.js +1 -1
- package/lib/widgets/DateTime/AltDateWidget.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeInput.d.ts +2 -2
- package/lib/widgets/DateTime/DateTimeInput.js +1 -1
- package/lib/widgets/DateTime/DateTimeInput.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeWidget.d.ts +2 -2
- package/lib/widgets/DateTime/DateWidget.d.ts +2 -2
- package/lib/widgets/DateTime/TimeWidget.d.ts +2 -2
- package/lib/widgets/DateTime/TimeWidget.js +3 -3
- package/lib/widgets/DateTime/TimeWidget.js.map +1 -1
- package/lib/widgets/FileWidget.d.ts +2 -2
- package/lib/widgets/FileWidget.js +2 -1
- package/lib/widgets/FileWidget.js.map +1 -1
- package/lib/widgets/PasswordWidget.d.ts +2 -2
- package/lib/widgets/PasswordWidget.js +4 -4
- package/lib/widgets/PasswordWidget.js.map +1 -1
- package/lib/widgets/RadioWidget.d.ts +2 -2
- package/lib/widgets/RadioWidget.js +3 -3
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/RangeWidget.d.ts +2 -2
- package/lib/widgets/RangeWidget.js +1 -1
- package/lib/widgets/RangeWidget.js.map +1 -1
- package/lib/widgets/SelectWidget.d.ts +2 -2
- package/lib/widgets/SelectWidget.js +8 -7
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.d.ts +2 -2
- package/lib/widgets/TextareaWidget.js +3 -3
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/lib/widgets/index.d.ts +1 -1
- package/package.json +27 -24
- package/src/Form/index.ts +4 -3
- package/src/Theme/index.ts +2 -2
- package/src/templates/ArrayFieldItemTemplate.tsx +2 -8
- package/src/templates/ArrayFieldTemplate.tsx +2 -9
- package/src/templates/ArrayFieldTitleTemplate.tsx +2 -8
- package/src/templates/BaseInputTemplate.tsx +10 -17
- package/src/templates/ButtonTemplates/AddButton.tsx +2 -1
- package/src/templates/ButtonTemplates/IconButton.tsx +19 -10
- package/src/templates/ButtonTemplates/SubmitButton.tsx +2 -1
- package/src/templates/ButtonTemplates/index.ts +1 -1
- package/src/templates/CyclicSchemaExpandTemplate.tsx +34 -0
- package/src/templates/DescriptionField.tsx +1 -1
- package/src/templates/ErrorList.tsx +3 -1
- package/src/templates/FieldErrorTemplate.tsx +4 -2
- package/src/templates/FieldHelpTemplate.tsx +2 -1
- package/src/templates/FieldTemplate.tsx +2 -8
- package/src/templates/GridTemplate.tsx +1 -1
- package/src/templates/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/templates/ObjectFieldTemplate.tsx +4 -8
- package/src/templates/OptionalDataControlsTemplate.tsx +3 -2
- package/src/templates/TitleField.tsx +1 -1
- package/src/templates/WrapIfAdditionalTemplate.tsx +2 -10
- package/src/templates/icons.tsx +1 -1
- package/src/templates/index.ts +3 -1
- package/src/utils.ts +2 -2
- package/src/widgets/CheckboxWidget.tsx +4 -11
- package/src/widgets/CheckboxesWidget.tsx +5 -7
- package/src/widgets/ColorWidget.tsx +6 -11
- package/src/widgets/DateTime/AltDateTimeWidget.tsx +1 -1
- package/src/widgets/DateTime/AltDateWidget.tsx +4 -12
- package/src/widgets/DateTime/DateTimeInput.tsx +2 -8
- package/src/widgets/DateTime/DateTimeWidget.tsx +1 -1
- package/src/widgets/DateTime/DateWidget.tsx +1 -1
- package/src/widgets/DateTime/TimeWidget.tsx +6 -11
- package/src/widgets/FileWidget.tsx +4 -9
- package/src/widgets/PasswordWidget.tsx +7 -12
- package/src/widgets/RadioWidget.tsx +7 -9
- package/src/widgets/RangeWidget.tsx +3 -9
- package/src/widgets/SelectWidget.tsx +25 -18
- package/src/widgets/TextareaWidget.tsx +6 -11
- package/src/widgets/index.ts +1 -1
package/dist/mantine.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@mantine/core'), require('@rjsf/utils'), require('react/jsx-runtime'), require('react'), require('dayjs'), require('dayjs/plugin/customParseFormat'), require('@mantine/dates')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@mantine/core', '@rjsf/utils', 'react/jsx-runtime', 'react', 'dayjs', 'dayjs/plugin/customParseFormat', '@mantine/dates'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/mantine"] = {}, global.core, global.core
|
|
5
|
-
})(this, (function (exports, core, core
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/mantine"] = {}, global.core$1, global.core, global.utils, global.jsxRuntime, global.react, global.dayjs, global.customParseFormat, global.dates));
|
|
5
|
+
})(this, (function (exports, core$1, core, utils, jsxRuntime, react, dayjs, customParseFormat, dates) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/Form/index.ts
|
|
8
8
|
function ArrayFieldItemTemplate(props) {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
registry,
|
|
14
14
|
uiOptions
|
|
15
15
|
);
|
|
16
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
17
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
18
|
-
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { className: className || "rjsf-array-item", mb: "xs", children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", align: "end", justify: "center", children: [
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { w: "100%", children }),
|
|
18
|
+
hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { wrap: "nowrap", gap: 2, mb: 7, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
|
|
19
19
|
] }) }, `array-item-${index}`);
|
|
20
20
|
}
|
|
21
21
|
function ArrayFieldTemplate(props) {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
64
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Fieldset, { legend, className, id: fieldPathId.$id, children: [
|
|
65
65
|
(uiOptions.description || schema.description) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
66
|
ArrayFieldDescriptionTemplate,
|
|
67
67
|
{
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
registry
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "row rjsf-array-item-list", children: [
|
|
76
76
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
77
77
|
items
|
|
78
78
|
] }),
|
|
79
|
-
canAdd && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
79
|
+
canAdd && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
80
|
AddButton2,
|
|
81
81
|
{
|
|
82
82
|
id: utils.buttonId(fieldPathId, "add"),
|
|
@@ -97,11 +97,11 @@
|
|
|
97
97
|
if (!title || !displayLabel) {
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(core
|
|
100
|
+
let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(core.Title, { id: utils.titleId(fieldPathId), order: 4, fw: "normal", children: title }) : null;
|
|
101
101
|
if (optionalDataControl) {
|
|
102
|
-
heading = /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
103
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
102
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs(core.Grid, { children: [
|
|
103
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "auto", children: heading }),
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "content", children: optionalDataControl })
|
|
105
105
|
] });
|
|
106
106
|
}
|
|
107
107
|
return heading;
|
|
@@ -172,24 +172,24 @@
|
|
|
172
172
|
const inputProps = utils.getInputProps(schema, type, options, false);
|
|
173
173
|
const description = hideLabel ? void 0 : options.description || schema.description;
|
|
174
174
|
const themeProps = cleanupOptions(options);
|
|
175
|
-
const handleNumberChange = react.useCallback((
|
|
175
|
+
const handleNumberChange = react.useCallback((newValue) => onChange(newValue), [onChange]);
|
|
176
176
|
const handleChange = react.useCallback(
|
|
177
177
|
(e) => {
|
|
178
|
-
const handler = onChangeOverride
|
|
179
|
-
const
|
|
180
|
-
handler(
|
|
178
|
+
const handler = onChangeOverride || onChange;
|
|
179
|
+
const newValue = e.target.value === "" ? options.emptyValue : e.target.value;
|
|
180
|
+
handler(newValue);
|
|
181
181
|
},
|
|
182
182
|
[onChange, onChangeOverride, options]
|
|
183
183
|
);
|
|
184
184
|
const handleBlur = react.useCallback(
|
|
185
185
|
(e) => {
|
|
186
|
-
onBlur(id, e.target
|
|
186
|
+
onBlur(id, e.target?.value);
|
|
187
187
|
},
|
|
188
188
|
[onBlur, id]
|
|
189
189
|
);
|
|
190
190
|
const handleFocus = react.useCallback(
|
|
191
191
|
(e) => {
|
|
192
|
-
onFocus(id, e.target
|
|
192
|
+
onFocus(id, e.target?.value);
|
|
193
193
|
},
|
|
194
194
|
[onFocus, id]
|
|
195
195
|
);
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
};
|
|
217
217
|
const { min, max, ...restInputProps } = inputProps;
|
|
218
218
|
const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
-
core
|
|
219
|
+
core.NumberInput,
|
|
220
220
|
{
|
|
221
221
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
222
222
|
...componentProps,
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
232
232
|
}
|
|
233
233
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
234
|
-
core
|
|
234
|
+
core.TextInput,
|
|
235
235
|
{
|
|
236
236
|
onChange: !readonly ? handleChange : void 0,
|
|
237
237
|
...componentProps,
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
input,
|
|
247
247
|
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: handleClear }),
|
|
248
248
|
children,
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.SchemaExamples, { id, schema })
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.SchemaExamples, { id, schema })
|
|
250
250
|
] });
|
|
251
251
|
}
|
|
252
252
|
function Plus({ size, style, ...others }) {
|
|
@@ -391,10 +391,10 @@
|
|
|
391
391
|
}
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function IconButtonFn(props) {
|
|
395
395
|
const { icon, iconType = "sm", color, onClick, uiSchema, registry, ...otherProps } = props;
|
|
396
396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
397
|
-
core
|
|
397
|
+
core.ActionIcon,
|
|
398
398
|
{
|
|
399
399
|
size: iconType,
|
|
400
400
|
color,
|
|
@@ -404,13 +404,16 @@
|
|
|
404
404
|
}
|
|
405
405
|
);
|
|
406
406
|
}
|
|
407
|
-
|
|
407
|
+
var IconButton = react.memo(IconButtonFn);
|
|
408
|
+
var IconButton_default = IconButton;
|
|
409
|
+
function CopyButtonFn(props) {
|
|
408
410
|
const {
|
|
409
411
|
registry: { translateString }
|
|
410
412
|
} = props;
|
|
411
413
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(Copy, {}) });
|
|
412
414
|
}
|
|
413
|
-
|
|
415
|
+
var CopyButton = react.memo(CopyButtonFn);
|
|
416
|
+
function MoveDownButtonFn(props) {
|
|
414
417
|
const {
|
|
415
418
|
registry: { translateString }
|
|
416
419
|
} = props;
|
|
@@ -424,7 +427,8 @@
|
|
|
424
427
|
}
|
|
425
428
|
);
|
|
426
429
|
}
|
|
427
|
-
|
|
430
|
+
var MoveDownButton = react.memo(MoveDownButtonFn);
|
|
431
|
+
function MoveUpButtonFn(props) {
|
|
428
432
|
const {
|
|
429
433
|
registry: { translateString }
|
|
430
434
|
} = props;
|
|
@@ -438,7 +442,8 @@
|
|
|
438
442
|
}
|
|
439
443
|
);
|
|
440
444
|
}
|
|
441
|
-
|
|
445
|
+
var MoveUpButton = react.memo(MoveUpButtonFn);
|
|
446
|
+
function RemoveButtonFn(props) {
|
|
442
447
|
const {
|
|
443
448
|
registry: { translateString }
|
|
444
449
|
} = props;
|
|
@@ -453,24 +458,26 @@
|
|
|
453
458
|
}
|
|
454
459
|
);
|
|
455
460
|
}
|
|
456
|
-
|
|
461
|
+
var RemoveButton = react.memo(RemoveButtonFn);
|
|
462
|
+
function ClearButtonFn(props) {
|
|
457
463
|
const {
|
|
458
464
|
registry: { translateString }
|
|
459
465
|
} = props;
|
|
460
466
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.ClearButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(X, {}) });
|
|
461
467
|
}
|
|
468
|
+
var ClearButton = react.memo(ClearButtonFn);
|
|
462
469
|
function AddButton(props) {
|
|
463
470
|
const {
|
|
464
471
|
registry: { translateString }
|
|
465
472
|
} = props;
|
|
466
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IconButton_default, { title: translateString(utils.TranslatableString.AddItemButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(Plus, {}) });
|
|
467
474
|
}
|
|
468
475
|
function SubmitButton({ uiSchema }) {
|
|
469
476
|
const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
|
|
470
477
|
if (norender) {
|
|
471
478
|
return null;
|
|
472
479
|
}
|
|
473
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
480
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Button, { type: "submit", variant: "filled", ...submitButtonProps, children: submitText });
|
|
474
481
|
}
|
|
475
482
|
|
|
476
483
|
// src/templates/ButtonTemplates/index.ts
|
|
@@ -486,10 +493,26 @@
|
|
|
486
493
|
};
|
|
487
494
|
}
|
|
488
495
|
var ButtonTemplates_default = buttonTemplates;
|
|
496
|
+
function CyclicSchemaExpandTemplate(props) {
|
|
497
|
+
const { name, fieldPathId, registry, onExpand } = props;
|
|
498
|
+
const { translateString } = registry;
|
|
499
|
+
const buttonId4 = `${fieldPathId[utils.ID_KEY]}-button`;
|
|
500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
+
core.Alert,
|
|
502
|
+
{
|
|
503
|
+
color: "yellow",
|
|
504
|
+
variant: "transparent",
|
|
505
|
+
title: translateString(utils.TranslatableString.CycleDetected, [name]),
|
|
506
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(ExclamationCircle, {}),
|
|
507
|
+
mt: "md",
|
|
508
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(core.Group, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Button, { id: buttonId4, size: "xs", variant: "outline", color: "yellow", onClick: () => onExpand(fieldPathId[utils.ID_KEY]), children: translateString(utils.TranslatableString.ExpandButton) }) })
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
}
|
|
489
512
|
function DescriptionField(props) {
|
|
490
513
|
const { id, description, registry, uiSchema } = props;
|
|
491
514
|
if (description) {
|
|
492
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
515
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Text, { id, mt: 3, mb: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(core$1.RichDescription, { description, registry, uiSchema }) });
|
|
493
516
|
}
|
|
494
517
|
return null;
|
|
495
518
|
}
|
|
@@ -499,29 +522,35 @@
|
|
|
499
522
|
}) {
|
|
500
523
|
const { translateString } = registry;
|
|
501
524
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
502
|
-
core
|
|
525
|
+
core.Alert,
|
|
503
526
|
{
|
|
504
527
|
color: "red",
|
|
505
528
|
variant: "transparent",
|
|
506
|
-
title: /* @__PURE__ */ jsxRuntime.jsx(core
|
|
529
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(core.Title, { order: 5, fw: "normal", children: translateString(utils.TranslatableString.ErrorsLabel) }),
|
|
507
530
|
icon: /* @__PURE__ */ jsxRuntime.jsx(ExclamationCircle, {}),
|
|
508
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(core
|
|
531
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(core.List, { children: errors.map((error, index) => (
|
|
532
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
533
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.List.Item, { c: "red", children: error.stack }, `error-${index}`)
|
|
534
|
+
)) })
|
|
509
535
|
}
|
|
510
536
|
);
|
|
511
537
|
}
|
|
512
538
|
function FieldErrorTemplate({ errors, fieldPathId }) {
|
|
513
|
-
if (!errors
|
|
539
|
+
if (!errors?.length) {
|
|
514
540
|
return null;
|
|
515
541
|
}
|
|
516
542
|
const id = utils.errorId(fieldPathId);
|
|
517
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
543
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { id, c: "red", display: "none", children: /* @__PURE__ */ jsxRuntime.jsx(core.List, { children: errors.map((error, index) => (
|
|
544
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
545
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.List.Item, { children: error }, `field-error-${index}`)
|
|
546
|
+
)) }) });
|
|
518
547
|
}
|
|
519
548
|
function FieldHelpTemplate(props) {
|
|
520
549
|
const { fieldPathId, help, uiSchema, registry } = props;
|
|
521
550
|
if (!help) {
|
|
522
551
|
return null;
|
|
523
552
|
}
|
|
524
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
553
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Text, { id: utils.helpId(fieldPathId), size: "sm", my: "xs", c: "dimmed", children: /* @__PURE__ */ jsxRuntime.jsx(core$1.RichHelp, { help, registry, uiSchema }) });
|
|
525
554
|
}
|
|
526
555
|
function FieldTemplate(props) {
|
|
527
556
|
const {
|
|
@@ -548,7 +577,7 @@
|
|
|
548
577
|
uiOptions
|
|
549
578
|
);
|
|
550
579
|
if (hidden) {
|
|
551
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
580
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { display: "none", children });
|
|
552
581
|
}
|
|
553
582
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
554
583
|
WrapIfAdditionalTemplate2,
|
|
@@ -574,15 +603,15 @@
|
|
|
574
603
|
function GridTemplate(props) {
|
|
575
604
|
const { children, column, fluid = true, ...rest } = props;
|
|
576
605
|
if (column) {
|
|
577
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
606
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { ...rest, children });
|
|
578
607
|
}
|
|
579
608
|
if (fluid) {
|
|
580
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
609
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Container, { p: "4", mx: 0, w: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(core.Grid, { ...rest, children }) });
|
|
581
610
|
}
|
|
582
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
611
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Grid, { grow: true, ...rest, children });
|
|
583
612
|
}
|
|
584
613
|
function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
585
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
614
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Stack, { style: { marginBottom: "1rem" }, children: [
|
|
586
615
|
selector,
|
|
587
616
|
optionSchemaField
|
|
588
617
|
] });
|
|
@@ -617,7 +646,7 @@
|
|
|
617
646
|
const gridCols = typeof uiOptions?.gridCols === "number" && uiOptions?.gridCols || void 0;
|
|
618
647
|
const gridSpacing = uiOptions?.gridSpacing;
|
|
619
648
|
const gridVerticalSpacing = uiOptions?.gridVerticalSpacing;
|
|
620
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
649
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Container, { id: fieldPathId.$id, p: 0, children: [
|
|
621
650
|
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
622
651
|
TitleFieldTemplate,
|
|
623
652
|
{
|
|
@@ -641,7 +670,7 @@
|
|
|
641
670
|
}
|
|
642
671
|
),
|
|
643
672
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
644
|
-
core
|
|
673
|
+
core.SimpleGrid,
|
|
645
674
|
{
|
|
646
675
|
cols: gridCols,
|
|
647
676
|
spacing: gridSpacing,
|
|
@@ -649,11 +678,11 @@
|
|
|
649
678
|
mb: "sm",
|
|
650
679
|
children: [
|
|
651
680
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
652
|
-
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsxRuntime.jsx(core
|
|
681
|
+
properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsxRuntime.jsx(core.Box, { children: element.content }, element.name))
|
|
653
682
|
]
|
|
654
683
|
}
|
|
655
684
|
),
|
|
656
|
-
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
685
|
+
utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { mt: "xs", justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
657
686
|
AddButton2,
|
|
658
687
|
{
|
|
659
688
|
id: utils.buttonId(fieldPathId, "add"),
|
|
@@ -680,7 +709,8 @@
|
|
|
680
709
|
title: label
|
|
681
710
|
}
|
|
682
711
|
);
|
|
683
|
-
}
|
|
712
|
+
}
|
|
713
|
+
if (onRemoveClick) {
|
|
684
714
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
685
715
|
RemoveButton,
|
|
686
716
|
{
|
|
@@ -697,11 +727,11 @@
|
|
|
697
727
|
}
|
|
698
728
|
function TitleField(props) {
|
|
699
729
|
const { id, title, optionalDataControl } = props;
|
|
700
|
-
let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(core
|
|
730
|
+
let heading = title ? /* @__PURE__ */ jsxRuntime.jsx(core.Title, { id, order: 3, fw: "normal", children: title }) : null;
|
|
701
731
|
if (optionalDataControl) {
|
|
702
|
-
heading = /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
703
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
704
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
732
|
+
heading = /* @__PURE__ */ jsxRuntime.jsxs(core.Grid, { children: [
|
|
733
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "auto", children: heading }),
|
|
734
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: "content", children: optionalDataControl })
|
|
705
735
|
] });
|
|
706
736
|
}
|
|
707
737
|
return heading;
|
|
@@ -736,10 +766,10 @@
|
|
|
736
766
|
...uiSchema,
|
|
737
767
|
[utils.UI_OPTIONS_KEY]: { ...uiOptions, block: true }
|
|
738
768
|
};
|
|
739
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children: /* @__PURE__ */ jsxRuntime.jsxs(core
|
|
740
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core
|
|
741
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
742
|
-
core
|
|
769
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", align: "end", justify: "center", children: [
|
|
770
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Grid, { w: "100%", align: "center", children: [
|
|
771
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: 6, className: "form-additional", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
772
|
+
core.TextInput,
|
|
743
773
|
{
|
|
744
774
|
className: "form-group",
|
|
745
775
|
label: displayLabel ? keyLabel : void 0,
|
|
@@ -753,7 +783,7 @@
|
|
|
753
783
|
},
|
|
754
784
|
label
|
|
755
785
|
) }),
|
|
756
|
-
/* @__PURE__ */ jsxRuntime.jsx(core
|
|
786
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: 6, className: "form-additional", children })
|
|
757
787
|
] }),
|
|
758
788
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
759
789
|
RemoveButton2,
|
|
@@ -777,6 +807,7 @@
|
|
|
777
807
|
ArrayFieldTemplate,
|
|
778
808
|
ArrayFieldTitleTemplate,
|
|
779
809
|
BaseInputTemplate,
|
|
810
|
+
CyclicSchemaExpandTemplate,
|
|
780
811
|
ButtonTemplates: ButtonTemplates_default(),
|
|
781
812
|
DescriptionFieldTemplate: DescriptionField,
|
|
782
813
|
ErrorListTemplate: ErrorList,
|
|
@@ -838,9 +869,9 @@
|
|
|
838
869
|
);
|
|
839
870
|
const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, true);
|
|
840
871
|
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
841
|
-
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
872
|
+
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core.Input.Label, { id: utils.titleId(id), required, children: label }),
|
|
842
873
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
core
|
|
874
|
+
core.Checkbox.Group,
|
|
844
875
|
{
|
|
845
876
|
id,
|
|
846
877
|
value: selectedIndexes,
|
|
@@ -850,19 +881,19 @@
|
|
|
850
881
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
851
882
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
852
883
|
...themeProps,
|
|
853
|
-
children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsxRuntime.jsx(core
|
|
854
|
-
core
|
|
884
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
885
|
+
core.Checkbox,
|
|
855
886
|
{
|
|
856
887
|
id: utils.optionId(id, i),
|
|
857
888
|
name: htmlName || id,
|
|
858
889
|
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
859
890
|
label: option.label,
|
|
860
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
891
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
861
892
|
autoFocus: i === 0 && autofocus,
|
|
862
893
|
onBlur: handleBlur,
|
|
863
894
|
onFocus: handleFocus
|
|
864
895
|
},
|
|
865
|
-
|
|
896
|
+
String(option.value)
|
|
866
897
|
)) }) : null
|
|
867
898
|
}
|
|
868
899
|
)
|
|
@@ -931,7 +962,7 @@
|
|
|
931
962
|
}
|
|
932
963
|
),
|
|
933
964
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
934
|
-
core
|
|
965
|
+
core.Checkbox,
|
|
935
966
|
{
|
|
936
967
|
id,
|
|
937
968
|
name: htmlName || name,
|
|
@@ -977,7 +1008,7 @@
|
|
|
977
1008
|
const handleBlur = react.useCallback(
|
|
978
1009
|
({ target }) => {
|
|
979
1010
|
if (onBlur) {
|
|
980
|
-
onBlur(id, target
|
|
1011
|
+
onBlur(id, target?.value);
|
|
981
1012
|
}
|
|
982
1013
|
},
|
|
983
1014
|
[onBlur, id]
|
|
@@ -985,13 +1016,13 @@
|
|
|
985
1016
|
const handleFocus = react.useCallback(
|
|
986
1017
|
({ target }) => {
|
|
987
1018
|
if (onFocus) {
|
|
988
|
-
onFocus(id, target
|
|
1019
|
+
onFocus(id, target?.value);
|
|
989
1020
|
}
|
|
990
1021
|
},
|
|
991
1022
|
[onFocus, id]
|
|
992
1023
|
);
|
|
993
1024
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
994
|
-
core
|
|
1025
|
+
core.ColorInput,
|
|
995
1026
|
{
|
|
996
1027
|
id,
|
|
997
1028
|
name,
|
|
@@ -1020,33 +1051,39 @@
|
|
|
1020
1051
|
const { translateString } = registry;
|
|
1021
1052
|
const { elements, handleChange, handleClear, handleSetNow } = utils.useAltDateWidgetProps(props);
|
|
1022
1053
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1023
|
-
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1024
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core
|
|
1054
|
+
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core.Input.Label, { id: utils.titleId(id), required, children: label }),
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
1025
1056
|
elements.map((elemProps, i) => {
|
|
1026
1057
|
const elemId = `${id}_${elemProps.type}`;
|
|
1027
|
-
return
|
|
1028
|
-
|
|
1029
|
-
{
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1058
|
+
return (
|
|
1059
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1060
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1061
|
+
core.Select,
|
|
1062
|
+
{
|
|
1063
|
+
id: elemId,
|
|
1064
|
+
name: elemId,
|
|
1065
|
+
placeholder: elemProps.type,
|
|
1066
|
+
disabled: disabled || readonly,
|
|
1067
|
+
data: utils.dateRangeOptions(elemProps.range[0], elemProps.range[1]).map((item) => item.value.toString()),
|
|
1068
|
+
value: !elemProps.value || elemProps.value < 0 ? null : elemProps.value.toString(),
|
|
1069
|
+
onChange: (v) => handleChange(elemProps.type, v || void 0),
|
|
1070
|
+
searchable: false,
|
|
1071
|
+
allowDeselect: false,
|
|
1072
|
+
comboboxProps: { withinPortal: false },
|
|
1073
|
+
"aria-describedby": utils.ariaDescribedByIds(elemId)
|
|
1074
|
+
}
|
|
1075
|
+
) }, i)
|
|
1076
|
+
);
|
|
1043
1077
|
}),
|
|
1044
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core
|
|
1045
|
-
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1046
|
-
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1078
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Group, { wrap: "nowrap", gap: 3, children: [
|
|
1079
|
+
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsxRuntime.jsx(core.Button, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(utils.TranslatableString.NowLabel) }),
|
|
1080
|
+
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsxRuntime.jsx(core.Button, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(utils.TranslatableString.ClearLabel) })
|
|
1047
1081
|
] })
|
|
1048
1082
|
] }),
|
|
1049
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) =>
|
|
1083
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => (
|
|
1084
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1085
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`)
|
|
1086
|
+
))
|
|
1050
1087
|
] });
|
|
1051
1088
|
}
|
|
1052
1089
|
var dateParser = (input, format) => {
|
|
@@ -1174,7 +1211,7 @@
|
|
|
1174
1211
|
const handleBlur = react.useCallback(
|
|
1175
1212
|
({ target }) => {
|
|
1176
1213
|
if (onBlur) {
|
|
1177
|
-
onBlur(id, target
|
|
1214
|
+
onBlur(id, target?.value);
|
|
1178
1215
|
}
|
|
1179
1216
|
},
|
|
1180
1217
|
[onBlur, id]
|
|
@@ -1182,7 +1219,7 @@
|
|
|
1182
1219
|
const handleFocus = react.useCallback(
|
|
1183
1220
|
({ target }) => {
|
|
1184
1221
|
if (onFocus) {
|
|
1185
|
-
onFocus(id, target
|
|
1222
|
+
onFocus(id, target?.value);
|
|
1186
1223
|
}
|
|
1187
1224
|
},
|
|
1188
1225
|
[onFocus, id]
|
|
@@ -1237,12 +1274,15 @@
|
|
|
1237
1274
|
);
|
|
1238
1275
|
const ValueComponent = react.useCallback(() => {
|
|
1239
1276
|
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1240
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Pill.Group, { children: filesInfo.map((file, index) => (
|
|
1278
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1279
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Pill, { withRemoveButton: true, onRemove: () => handleRemove(index), children: file.name }, index)
|
|
1280
|
+
)) });
|
|
1241
1281
|
}
|
|
1242
1282
|
return null;
|
|
1243
1283
|
}, [handleRemove, filesInfo]);
|
|
1244
1284
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1245
|
-
core
|
|
1285
|
+
core.FileInput,
|
|
1246
1286
|
{
|
|
1247
1287
|
id,
|
|
1248
1288
|
name,
|
|
@@ -1279,7 +1319,7 @@
|
|
|
1279
1319
|
onBlur,
|
|
1280
1320
|
onFocus
|
|
1281
1321
|
} = props;
|
|
1282
|
-
const emptyValue = options
|
|
1322
|
+
const { emptyValue } = options;
|
|
1283
1323
|
const themeProps = cleanupOptions(options);
|
|
1284
1324
|
const handleChange = react.useCallback(
|
|
1285
1325
|
(e) => {
|
|
@@ -1290,7 +1330,7 @@
|
|
|
1290
1330
|
const handleBlur = react.useCallback(
|
|
1291
1331
|
({ target }) => {
|
|
1292
1332
|
if (onBlur) {
|
|
1293
|
-
onBlur(id, target
|
|
1333
|
+
onBlur(id, target?.value);
|
|
1294
1334
|
}
|
|
1295
1335
|
},
|
|
1296
1336
|
[onBlur, id]
|
|
@@ -1298,13 +1338,13 @@
|
|
|
1298
1338
|
const handleFocus = react.useCallback(
|
|
1299
1339
|
({ target }) => {
|
|
1300
1340
|
if (onFocus) {
|
|
1301
|
-
onFocus(id, target
|
|
1341
|
+
onFocus(id, target?.value);
|
|
1302
1342
|
}
|
|
1303
1343
|
},
|
|
1304
1344
|
[onFocus, id]
|
|
1305
1345
|
);
|
|
1306
1346
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1307
|
-
core
|
|
1347
|
+
core.PasswordInput,
|
|
1308
1348
|
{
|
|
1309
1349
|
id,
|
|
1310
1350
|
name,
|
|
@@ -1354,7 +1394,7 @@
|
|
|
1354
1394
|
const handleBlur = react.useCallback(
|
|
1355
1395
|
({ target }) => {
|
|
1356
1396
|
if (onBlur) {
|
|
1357
|
-
onBlur(id, utils.enumOptionValueDecoder(target
|
|
1397
|
+
onBlur(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
1358
1398
|
}
|
|
1359
1399
|
},
|
|
1360
1400
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
@@ -1362,14 +1402,14 @@
|
|
|
1362
1402
|
const handleFocus = react.useCallback(
|
|
1363
1403
|
({ target }) => {
|
|
1364
1404
|
if (onFocus) {
|
|
1365
|
-
onFocus(id, utils.enumOptionValueDecoder(target
|
|
1405
|
+
onFocus(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
1366
1406
|
}
|
|
1367
1407
|
},
|
|
1368
1408
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
1369
1409
|
);
|
|
1370
1410
|
const selected = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
1371
1411
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1372
|
-
core
|
|
1412
|
+
core.Radio.Group,
|
|
1373
1413
|
{
|
|
1374
1414
|
id,
|
|
1375
1415
|
name: htmlName || id,
|
|
@@ -1381,18 +1421,18 @@
|
|
|
1381
1421
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1382
1422
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1383
1423
|
...themeProps,
|
|
1384
|
-
children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1385
|
-
core
|
|
1424
|
+
children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsxRuntime.jsx(core.Flex, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1425
|
+
core.Radio,
|
|
1386
1426
|
{
|
|
1387
1427
|
id: utils.optionId(id, i),
|
|
1388
1428
|
value: utils.enumOptionValueEncoder(option.value, i, optionValueFormat),
|
|
1389
1429
|
label: option.label,
|
|
1390
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1430
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
1391
1431
|
autoFocus: i === 0 && autofocus,
|
|
1392
1432
|
onBlur: handleBlur,
|
|
1393
1433
|
onFocus: handleFocus
|
|
1394
1434
|
},
|
|
1395
|
-
|
|
1435
|
+
String(option.value)
|
|
1396
1436
|
)) }) : null
|
|
1397
1437
|
}
|
|
1398
1438
|
);
|
|
@@ -1436,10 +1476,10 @@
|
|
|
1436
1476
|
}
|
|
1437
1477
|
}, [onFocus, id, value]);
|
|
1438
1478
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1439
|
-
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1440
|
-
options?.description && /* @__PURE__ */ jsxRuntime.jsx(core
|
|
1479
|
+
!hideLabel && !!label && /* @__PURE__ */ jsxRuntime.jsx(core.Input.Label, { id: utils.titleId(id), required, children: label }),
|
|
1480
|
+
options?.description && /* @__PURE__ */ jsxRuntime.jsx(core.Input.Description, { children: options.description }),
|
|
1441
1481
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1442
|
-
core
|
|
1482
|
+
core.Slider,
|
|
1443
1483
|
{
|
|
1444
1484
|
id,
|
|
1445
1485
|
name,
|
|
@@ -1456,7 +1496,10 @@
|
|
|
1456
1496
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1457
1497
|
}
|
|
1458
1498
|
),
|
|
1459
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) =>
|
|
1499
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => (
|
|
1500
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1501
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Input.Error, { children: error }, `range-widget-input-errors-${index}`)
|
|
1502
|
+
))
|
|
1460
1503
|
] });
|
|
1461
1504
|
}
|
|
1462
1505
|
function SelectWidget(props) {
|
|
@@ -1473,6 +1516,7 @@
|
|
|
1473
1516
|
hideLabel,
|
|
1474
1517
|
multiple,
|
|
1475
1518
|
rawErrors,
|
|
1519
|
+
schema,
|
|
1476
1520
|
options,
|
|
1477
1521
|
onChange,
|
|
1478
1522
|
onBlur,
|
|
@@ -1481,6 +1525,7 @@
|
|
|
1481
1525
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1482
1526
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
1483
1527
|
const themeProps = cleanupOptions(options);
|
|
1528
|
+
utils.logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple);
|
|
1484
1529
|
const handleChange = react.useCallback(
|
|
1485
1530
|
(nextValue) => {
|
|
1486
1531
|
if (!disabled && !readonly && onChange) {
|
|
@@ -1492,7 +1537,7 @@
|
|
|
1492
1537
|
const handleBlur = react.useCallback(
|
|
1493
1538
|
({ target }) => {
|
|
1494
1539
|
if (onBlur) {
|
|
1495
|
-
onBlur(id, utils.enumOptionValueDecoder(target
|
|
1540
|
+
onBlur(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
1496
1541
|
}
|
|
1497
1542
|
},
|
|
1498
1543
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
@@ -1500,7 +1545,7 @@
|
|
|
1500
1545
|
const handleFocus = react.useCallback(
|
|
1501
1546
|
({ target }) => {
|
|
1502
1547
|
if (onFocus) {
|
|
1503
|
-
onFocus(id, utils.enumOptionValueDecoder(target
|
|
1548
|
+
onFocus(id, utils.enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
1504
1549
|
}
|
|
1505
1550
|
},
|
|
1506
1551
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
@@ -1511,7 +1556,7 @@
|
|
|
1511
1556
|
key: String(index),
|
|
1512
1557
|
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
1513
1558
|
label: option.label,
|
|
1514
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1559
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value)
|
|
1515
1560
|
}));
|
|
1516
1561
|
}
|
|
1517
1562
|
return [];
|
|
@@ -1534,19 +1579,22 @@
|
|
|
1534
1579
|
comboboxProps: { withinPortal: false },
|
|
1535
1580
|
...themeProps
|
|
1536
1581
|
};
|
|
1537
|
-
return
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1582
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1583
|
+
/* @__PURE__ */ jsxRuntime.jsx(utils.SelectedOptionDescription, { ...props }),
|
|
1584
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1585
|
+
core.MultiSelect,
|
|
1586
|
+
{
|
|
1587
|
+
...sharedProps,
|
|
1588
|
+
value: utils.enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, [])
|
|
1589
|
+
}
|
|
1590
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1591
|
+
core.Select,
|
|
1592
|
+
{
|
|
1593
|
+
...sharedProps,
|
|
1594
|
+
value: utils.enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, null)
|
|
1595
|
+
}
|
|
1596
|
+
)
|
|
1597
|
+
] });
|
|
1550
1598
|
}
|
|
1551
1599
|
function TextareaWidget(props) {
|
|
1552
1600
|
const {
|
|
@@ -1578,7 +1626,7 @@
|
|
|
1578
1626
|
const handleBlur = react.useCallback(
|
|
1579
1627
|
({ target }) => {
|
|
1580
1628
|
if (onBlur) {
|
|
1581
|
-
onBlur(id, target
|
|
1629
|
+
onBlur(id, target?.value);
|
|
1582
1630
|
}
|
|
1583
1631
|
},
|
|
1584
1632
|
[onBlur, id]
|
|
@@ -1586,13 +1634,13 @@
|
|
|
1586
1634
|
const handleFocus = react.useCallback(
|
|
1587
1635
|
({ target }) => {
|
|
1588
1636
|
if (onFocus) {
|
|
1589
|
-
onFocus(id, target
|
|
1637
|
+
onFocus(id, target?.value);
|
|
1590
1638
|
}
|
|
1591
1639
|
},
|
|
1592
1640
|
[onFocus, id]
|
|
1593
1641
|
);
|
|
1594
1642
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1595
|
-
core
|
|
1643
|
+
core.Textarea,
|
|
1596
1644
|
{
|
|
1597
1645
|
id,
|
|
1598
1646
|
name: htmlName || name,
|
|
@@ -1645,7 +1693,7 @@
|
|
|
1645
1693
|
|
|
1646
1694
|
// src/Form/index.ts
|
|
1647
1695
|
function generateForm() {
|
|
1648
|
-
return core.withTheme(generateTheme());
|
|
1696
|
+
return core$1.withTheme(generateTheme());
|
|
1649
1697
|
}
|
|
1650
1698
|
var Form_default = generateForm();
|
|
1651
1699
|
|