@rjsf/mantine 6.8.0 → 6.10.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/dist/index.cjs +35 -10
- package/dist/index.cjs.map +4 -4
- package/dist/mantine.esm.js +36 -11
- package/dist/mantine.esm.js.map +4 -4
- package/dist/mantine.umd.js +38 -10
- package/lib/Form/index.d.ts +1 -0
- package/lib/Form/index.d.ts.map +1 -0
- package/lib/Form/index.js +1 -1
- package/lib/Form/index.js.map +1 -1
- package/lib/Theme/index.d.ts +1 -0
- package/lib/Theme/index.d.ts.map +1 -0
- package/lib/Theme/index.js +2 -2
- package/lib/Theme/index.js.map +1 -1
- package/lib/index.d.ts +5 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/templates/ArrayFieldItemTemplate.d.ts +1 -0
- package/lib/templates/ArrayFieldItemTemplate.d.ts.map +1 -0
- package/lib/templates/ArrayFieldTemplate.d.ts +1 -0
- package/lib/templates/ArrayFieldTemplate.d.ts.map +1 -0
- package/lib/templates/ArrayFieldTitleTemplate.d.ts +1 -0
- package/lib/templates/ArrayFieldTitleTemplate.d.ts.map +1 -0
- package/lib/templates/BaseInputTemplate.d.ts +1 -0
- package/lib/templates/BaseInputTemplate.d.ts.map +1 -0
- package/lib/templates/BaseInputTemplate.js +4 -7
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/AddButton.d.ts +1 -0
- package/lib/templates/ButtonTemplates/AddButton.d.ts.map +1 -0
- package/lib/templates/ButtonTemplates/AddButton.js +2 -2
- package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/IconButton.d.ts +1 -0
- package/lib/templates/ButtonTemplates/IconButton.d.ts.map +1 -0
- package/lib/templates/ButtonTemplates/IconButton.js +1 -1
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/SubmitButton.d.ts +1 -0
- package/lib/templates/ButtonTemplates/SubmitButton.d.ts.map +1 -0
- package/lib/templates/ButtonTemplates/index.d.ts +1 -0
- package/lib/templates/ButtonTemplates/index.d.ts.map +1 -0
- package/lib/templates/ButtonTemplates/index.js +3 -3
- package/lib/templates/ButtonTemplates/index.js.map +1 -1
- package/lib/templates/CyclicSchemaExpandTemplate.d.ts +1 -0
- package/lib/templates/CyclicSchemaExpandTemplate.d.ts.map +1 -0
- package/lib/templates/CyclicSchemaExpandTemplate.js +1 -1
- package/lib/templates/CyclicSchemaExpandTemplate.js.map +1 -1
- package/lib/templates/DescriptionField.d.ts +1 -0
- package/lib/templates/DescriptionField.d.ts.map +1 -0
- package/lib/templates/ErrorList.d.ts +1 -0
- package/lib/templates/ErrorList.d.ts.map +1 -0
- package/lib/templates/ErrorList.js +1 -1
- package/lib/templates/ErrorList.js.map +1 -1
- package/lib/templates/FieldErrorTemplate.d.ts +1 -0
- package/lib/templates/FieldErrorTemplate.d.ts.map +1 -0
- package/lib/templates/FieldErrorTemplate.js +1 -1
- package/lib/templates/FieldErrorTemplate.js.map +1 -1
- package/lib/templates/FieldHelpTemplate.d.ts +1 -0
- package/lib/templates/FieldHelpTemplate.d.ts.map +1 -0
- package/lib/templates/FieldTemplate.d.ts +1 -0
- package/lib/templates/FieldTemplate.d.ts.map +1 -0
- package/lib/templates/GridTemplate.d.ts +1 -0
- package/lib/templates/GridTemplate.d.ts.map +1 -0
- package/lib/templates/MultiSchemaFieldTemplate.d.ts +1 -0
- package/lib/templates/MultiSchemaFieldTemplate.d.ts.map +1 -0
- package/lib/templates/ObjectFieldTemplate.d.ts +1 -0
- package/lib/templates/ObjectFieldTemplate.d.ts.map +1 -0
- package/lib/templates/ObjectFieldTemplate.js +3 -3
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate.d.ts +1 -0
- package/lib/templates/OptionalDataControlsTemplate.d.ts.map +1 -0
- package/lib/templates/OptionalDataControlsTemplate.js +2 -2
- package/lib/templates/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/templates/TitleField.d.ts +1 -0
- package/lib/templates/TitleField.d.ts.map +1 -0
- package/lib/templates/WrapIfAdditionalTemplate.d.ts +1 -0
- package/lib/templates/WrapIfAdditionalTemplate.d.ts.map +1 -0
- package/lib/templates/icons.d.ts +1 -0
- package/lib/templates/icons.d.ts.map +1 -0
- package/lib/templates/index.d.ts +1 -0
- package/lib/templates/index.d.ts.map +1 -0
- package/lib/templates/index.js +17 -17
- package/lib/templates/index.js.map +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +25 -1
- package/lib/utils.js.map +1 -1
- package/lib/widgets/CheckboxWidget.d.ts +1 -0
- package/lib/widgets/CheckboxWidget.d.ts.map +1 -0
- package/lib/widgets/CheckboxWidget.js +3 -2
- package/lib/widgets/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget.d.ts +1 -0
- package/lib/widgets/CheckboxesWidget.d.ts.map +1 -0
- package/lib/widgets/CheckboxesWidget.js +1 -1
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/ColorWidget.d.ts +1 -0
- package/lib/widgets/ColorWidget.d.ts.map +1 -0
- package/lib/widgets/ColorWidget.js +3 -3
- package/lib/widgets/ColorWidget.js.map +1 -1
- package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +1 -0
- package/lib/widgets/DateTime/AltDateTimeWidget.d.ts.map +1 -0
- package/lib/widgets/DateTime/AltDateWidget.d.ts +1 -0
- package/lib/widgets/DateTime/AltDateWidget.d.ts.map +1 -0
- package/lib/widgets/DateTime/AltDateWidget.js +1 -1
- package/lib/widgets/DateTime/AltDateWidget.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeInput.d.ts +1 -0
- package/lib/widgets/DateTime/DateTimeInput.d.ts.map +1 -0
- package/lib/widgets/DateTime/DateTimeInput.js +4 -1
- package/lib/widgets/DateTime/DateTimeInput.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeWidget.d.ts +1 -0
- package/lib/widgets/DateTime/DateTimeWidget.d.ts.map +1 -0
- package/lib/widgets/DateTime/DateTimeWidget.js +1 -1
- package/lib/widgets/DateTime/DateTimeWidget.js.map +1 -1
- package/lib/widgets/DateTime/DateWidget.d.ts +1 -0
- package/lib/widgets/DateTime/DateWidget.d.ts.map +1 -0
- package/lib/widgets/DateTime/DateWidget.js +1 -1
- package/lib/widgets/DateTime/DateWidget.js.map +1 -1
- package/lib/widgets/DateTime/TimeWidget.d.ts +1 -0
- package/lib/widgets/DateTime/TimeWidget.d.ts.map +1 -0
- package/lib/widgets/DateTime/TimeWidget.js +3 -3
- package/lib/widgets/DateTime/TimeWidget.js.map +1 -1
- package/lib/widgets/DateTime/index.d.ts +6 -5
- package/lib/widgets/DateTime/index.d.ts.map +1 -0
- package/lib/widgets/DateTime/index.js +5 -5
- package/lib/widgets/DateTime/index.js.map +1 -1
- package/lib/widgets/FileWidget.d.ts +1 -0
- package/lib/widgets/FileWidget.d.ts.map +1 -0
- package/lib/widgets/FileWidget.js +1 -1
- package/lib/widgets/FileWidget.js.map +1 -1
- package/lib/widgets/PasswordWidget.d.ts +1 -0
- package/lib/widgets/PasswordWidget.d.ts.map +1 -0
- package/lib/widgets/PasswordWidget.js +3 -3
- package/lib/widgets/PasswordWidget.js.map +1 -1
- package/lib/widgets/RadioWidget.d.ts +1 -0
- package/lib/widgets/RadioWidget.d.ts.map +1 -0
- package/lib/widgets/RadioWidget.js +3 -3
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/RangeWidget.d.ts +1 -0
- package/lib/widgets/RangeWidget.d.ts.map +1 -0
- package/lib/widgets/RangeWidget.js +3 -3
- package/lib/widgets/RangeWidget.js.map +1 -1
- package/lib/widgets/SelectWidget.d.ts +1 -0
- package/lib/widgets/SelectWidget.d.ts.map +1 -0
- package/lib/widgets/SelectWidget.js +3 -3
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.d.ts +1 -0
- package/lib/widgets/TextareaWidget.d.ts.map +1 -0
- package/lib/widgets/TextareaWidget.js +4 -4
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.d.ts.map +1 -0
- package/lib/widgets/index.js +10 -14
- package/lib/widgets/index.js.map +1 -1
- package/package.json +8 -11
- package/src/Form/index.ts +1 -1
- package/src/Theme/index.ts +2 -2
- package/src/index.ts +4 -4
- package/src/templates/BaseInputTemplate.tsx +2 -2
- package/src/templates/ButtonTemplates/AddButton.tsx +2 -2
- package/src/templates/ButtonTemplates/IconButton.tsx +1 -1
- package/src/templates/ButtonTemplates/index.ts +3 -3
- package/src/templates/CyclicSchemaExpandTemplate.tsx +1 -1
- package/src/templates/ErrorList.tsx +1 -1
- package/src/templates/OptionalDataControlsTemplate.tsx +2 -2
- package/src/templates/index.ts +17 -17
- package/src/utils.ts +25 -1
- package/src/widgets/CheckboxWidget.tsx +13 -3
- package/src/widgets/CheckboxesWidget.tsx +1 -1
- package/src/widgets/ColorWidget.tsx +1 -1
- package/src/widgets/DateTime/DateTimeInput.tsx +4 -0
- package/src/widgets/DateTime/DateTimeWidget.tsx +1 -1
- package/src/widgets/DateTime/DateWidget.tsx +1 -1
- package/src/widgets/DateTime/index.ts +5 -5
- package/src/widgets/FileWidget.tsx +1 -1
- package/src/widgets/PasswordWidget.tsx +1 -1
- package/src/widgets/RadioWidget.tsx +1 -1
- package/src/widgets/RangeWidget.tsx +1 -1
- package/src/widgets/SelectWidget.tsx +1 -1
- package/src/widgets/TextareaWidget.tsx +1 -1
- package/src/widgets/index.ts +10 -15
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/src/tsconfig.json +0 -22
|
@@ -5,3 +5,4 @@ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from
|
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function PasswordWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PasswordWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordWidget.d.ts","sourceRoot":"","sources":["../../src/widgets/PasswordWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK9F;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+BAiE5B"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { PasswordInput } from '@mantine/core';
|
|
4
4
|
import { ariaDescribedByIds, labelValue } from '@rjsf/utils';
|
|
5
|
-
import { cleanupOptions } from
|
|
5
|
+
import { cleanupOptions } from "../utils.js";
|
|
6
6
|
/**
|
|
7
7
|
* The `PasswordWidget` component renders a password input element.
|
|
8
8
|
*
|
|
@@ -17,12 +17,12 @@ export default function PasswordWidget(props) {
|
|
|
17
17
|
}, [onChange, emptyValue]);
|
|
18
18
|
const handleBlur = useCallback(({ target }) => {
|
|
19
19
|
if (onBlur) {
|
|
20
|
-
onBlur(id, target
|
|
20
|
+
onBlur(id, target?.value);
|
|
21
21
|
}
|
|
22
22
|
}, [onBlur, id]);
|
|
23
23
|
const handleFocus = useCallback(({ target }) => {
|
|
24
24
|
if (onFocus) {
|
|
25
|
-
onFocus(id, target
|
|
25
|
+
onFocus(id, target?.value);
|
|
26
26
|
}
|
|
27
27
|
}, [onFocus, id]);
|
|
28
28
|
return (_jsx(PasswordInput, { id: id, name: name, value: value || '', placeholder: placeholder || undefined, required: required, disabled: disabled || readonly, autoFocus: autofocus, label: labelValue(label || undefined, hideLabel, false), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, ...themeProps, "aria-describedby": ariaDescribedByIds(id) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordWidget.js","sourceRoot":"","sources":["../../src/widgets/PasswordWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PasswordWidget.js","sourceRoot":"","sources":["../../src/widgets/PasswordWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAIpC,KAA2B;IAC3B,MAAM,EACJ,EAAE,EACF,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,GACR,GAAG,KAAK,CAAC;IAEV,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAA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I,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,KACvE,UAAU,sBACI,kBAAkB,CAAC,EAAE,CAAC,GACxC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -5,3 +5,4 @@ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from
|
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function RadioWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=RadioWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioWidget.d.ts","sourceRoot":"","sources":["../../src/widgets/RadioWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY9F;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACnH,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+BAmF5B"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Radio, Flex } from '@mantine/core';
|
|
4
4
|
import { ariaDescribedByIds, enumOptionValueDecoder, enumOptionValueEncoder, enumOptionsIndexForValue, getOptionValueFormat, optionId, } from '@rjsf/utils';
|
|
5
|
-
import { cleanupOptions } from
|
|
5
|
+
import { cleanupOptions } from "../utils.js";
|
|
6
6
|
/** The `RadioWidget` is a widget for rendering a radio group.
|
|
7
7
|
* It is typically used with a string property constrained with enum options.
|
|
8
8
|
*
|
|
@@ -20,12 +20,12 @@ export default function RadioWidget(props) {
|
|
|
20
20
|
}, [onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]);
|
|
21
21
|
const handleBlur = useCallback(({ target }) => {
|
|
22
22
|
if (onBlur) {
|
|
23
|
-
onBlur(id, enumOptionValueDecoder(target
|
|
23
|
+
onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
24
24
|
}
|
|
25
25
|
}, [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
|
|
26
26
|
const handleFocus = useCallback(({ target }) => {
|
|
27
27
|
if (onFocus) {
|
|
28
|
-
onFocus(id, enumOptionValueDecoder(target
|
|
28
|
+
onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
29
29
|
}
|
|
30
30
|
}, [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
|
|
31
31
|
const selected = enumOptionsIndexForValue(value, enumOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioWidget.js","sourceRoot":"","sources":["../../src/widgets/RadioWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RadioWidget.js","sourceRoot":"","sources":["../../src/widgets/RadioWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,QAAQ,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C,CAAC,EACnB,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,iBAAiB,CAAC,EACjE,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5E,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI,SAAS,EAC/B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,IAPf,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAQzB,CACH,CAAC,GACG,CACR,CAAC,CAAC,CAAC,IAAI,GACI,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -5,3 +5,4 @@ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from
|
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function RangeWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=RangeWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeWidget.d.ts","sourceRoot":"","sources":["../../src/widgets/RangeWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK9F;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACnH,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+BA2E5B"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Slider, Input } from '@mantine/core';
|
|
4
4
|
import { ariaDescribedByIds, rangeSpec, titleId } from '@rjsf/utils';
|
|
5
|
-
import { cleanupOptions } from
|
|
5
|
+
import { cleanupOptions } from "../utils.js";
|
|
6
6
|
/** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result
|
|
7
7
|
* in a div, with the value alongside it.
|
|
8
8
|
*
|
|
@@ -27,8 +27,8 @@ export default function RangeWidget(props) {
|
|
|
27
27
|
onFocus(id, value);
|
|
28
28
|
}
|
|
29
29
|
}, [onFocus, id, value]);
|
|
30
|
-
return (_jsxs(_Fragment, { children: [!hideLabel && !!label && (_jsx(Input.Label, { id: titleId(id), required: required, children: label })),
|
|
31
|
-
|
|
30
|
+
return (_jsxs(_Fragment, { children: [!hideLabel && !!label && (_jsx(Input.Label, { id: titleId(id), required: required, children: label })), options?.description && _jsx(Input.Description, { children: options.description }), _jsx(Slider, { id: id, name: name, value: value, max: max, min: min, step: step, disabled: disabled || readonly, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, ...themeProps, "aria-describedby": ariaDescribedByIds(id) }), rawErrors &&
|
|
31
|
+
rawErrors?.length > 0 &&
|
|
32
32
|
rawErrors.map((error, index) => (_jsx(Input.Error, { children: error }, `range-widget-input-errors-${index}`)))] }));
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=RangeWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeWidget.js","sourceRoot":"","sources":["../../src/widgets/RangeWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,EAA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M,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzB,OAAO,CACL,8BACG,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,IAAI,CACxB,KAAC,KAAK,CAAC,KAAK,IAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,YAC7C,KAAK,GACM,CACf,EACA,OAAO,EAAE,WAAW,IAAI,KAAC,KAAK,CAAC,WAAW,cAAE,OAAO,CAAC,WAAW,GAAqB,EACrF,KAAC,MAAM,IACL,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,KAChB,UAAU,sBACI,kBAAkB,CAAC,EAAE,CAAC,GACxC,EACD,SAAS;gBACR,SAAS,EAAE,MAAM,GAAG,CAAC;gBACrB,SAAS,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,KAAa,EAAE,EAAE,CAAC,CAE9C,KAAC,KAAK,CAAC,KAAK,cAA6C,KAAK,IAA5C,6BAA6B,KAAK,EAAE,CAAuB,CAC9E,CAAC,IACH,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -5,3 +5,4 @@ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from
|
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SelectWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectWidget.d.ts","sourceRoot":"","sources":["../../src/widgets/SelectWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc9F;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAAE,CAAC,SAAS,eAAe,GAAG,GAAG,EACpH,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,+BAqG5B"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import { Select, MultiSelect } from '@mantine/core';
|
|
4
4
|
import { ariaDescribedByIds, enumOptionSelectedValue, enumOptionValueDecoder, enumOptionValueEncoder, getOptionValueFormat, labelValue, logUnsupportedDefaultForEnum, SelectedOptionDescription, } from '@rjsf/utils';
|
|
5
|
-
import { cleanupOptions } from
|
|
5
|
+
import { cleanupOptions } from "../utils.js";
|
|
6
6
|
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
7
7
|
* It is typically used with string properties constrained with enum options.
|
|
8
8
|
*
|
|
@@ -21,12 +21,12 @@ export default function SelectWidget(props) {
|
|
|
21
21
|
}, [onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]);
|
|
22
22
|
const handleBlur = useCallback(({ target }) => {
|
|
23
23
|
if (onBlur) {
|
|
24
|
-
onBlur(id, enumOptionValueDecoder(target
|
|
24
|
+
onBlur(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
25
25
|
}
|
|
26
26
|
}, [onBlur, id, enumOptions, emptyValue, optionValueFormat]);
|
|
27
27
|
const handleFocus = useCallback(({ target }) => {
|
|
28
28
|
if (onFocus) {
|
|
29
|
-
onFocus(id, enumOptionValueDecoder(target
|
|
29
|
+
onFocus(id, enumOptionValueDecoder(target?.value, enumOptions, optionValueFormat, emptyValue));
|
|
30
30
|
}
|
|
31
31
|
}, [onFocus, id, enumOptions, emptyValue, optionValueFormat]);
|
|
32
32
|
const selectOptions = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectWidget.js","sourceRoot":"","sources":["../../src/widgets/SelectWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectWidget.js","sourceRoot":"","sources":["../../src/widgets/SelectWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,KAA2B;IAE3B,MAAM,EACJ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AAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QAC5C,SAAS,EAAE,SAAS;QACpB,WAAW;QACX,QAAQ,EAAE,QAAQ,IAAI,QAAQ;QAC9B,QAAQ;QACR,KAAK,EAAE,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3E,UAAU,EAAE,IAAI;QAChB,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,CAAC;QAC1C,aAAa,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE;QACtC,GAAG,UAAU;KACd,CAAC;IAEF,OAAO,CACL,8BACE,KAAC,yBAAyB,OAAK,KAAK,GAAI,EACvC,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,WAAW,OACN,WAAW,EACf,KAAK,EAAE,uBAAuB,CAAI,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,CAAa,GAC9F,CACH,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,OACD,WAAW,EACf,KAAK,EAAE,uBAAuB,CAAI,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAkB,GACtG,CACH,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -5,3 +5,4 @@ import type { StrictRJSFSchema, RJSFSchema, FormContextType, WidgetProps } from
|
|
|
5
5
|
* @param props - The `WidgetProps` for this component
|
|
6
6
|
*/
|
|
7
7
|
export default function TextareaWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): ReactElement;
|
|
8
|
+
//# sourceMappingURL=TextareaWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextareaWidget.d.ts","sourceRoot":"","sources":["../../src/widgets/TextareaWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK9F;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAkE3C"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Textarea } from '@mantine/core';
|
|
4
4
|
import { labelValue, ariaDescribedByIds } from '@rjsf/utils';
|
|
5
|
-
import { cleanupOptions } from
|
|
5
|
+
import { cleanupOptions } from "../utils.js";
|
|
6
6
|
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
7
7
|
*
|
|
8
8
|
* @param props - The `WidgetProps` for this component
|
|
@@ -10,18 +10,18 @@ import { cleanupOptions } from '../utils.js';
|
|
|
10
10
|
export default function TextareaWidget(props) {
|
|
11
11
|
const { id, name, htmlName, value, placeholder, required, disabled, readonly, autofocus, label, hideLabel, rawErrors, options, onChange, onBlur, onFocus, } = props;
|
|
12
12
|
const themeProps = cleanupOptions(options);
|
|
13
|
-
const emptyValue = options
|
|
13
|
+
const emptyValue = options?.emptyValue;
|
|
14
14
|
const handleChange = useCallback((e) => {
|
|
15
15
|
onChange(e.target.value === '' ? emptyValue : e.target.value);
|
|
16
16
|
}, [onChange, emptyValue]);
|
|
17
17
|
const handleBlur = useCallback(({ target }) => {
|
|
18
18
|
if (onBlur) {
|
|
19
|
-
onBlur(id, target
|
|
19
|
+
onBlur(id, target?.value);
|
|
20
20
|
}
|
|
21
21
|
}, [onBlur, id]);
|
|
22
22
|
const handleFocus = useCallback(({ target }) => {
|
|
23
23
|
if (onFocus) {
|
|
24
|
-
onFocus(id, target
|
|
24
|
+
onFocus(id, target?.value);
|
|
25
25
|
}
|
|
26
26
|
}, [onFocus, id]);
|
|
27
27
|
return (_jsx(Textarea, { id: id, name: htmlName || name, value: value || '', placeholder: placeholder || undefined, required: required, disabled: disabled || readonly, autoFocus: autofocus, label: labelValue(label || undefined, hideLabel, false), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, error: rawErrors && rawErrors.length > 0 ? rawErrors.join('\n') : undefined, "aria-describedby": ariaDescribedByIds(id), ...themeProps }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaWidget.js","sourceRoot":"","sources":["../../src/widgets/TextareaWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TextareaWidget.js","sourceRoot":"","sources":["../../src/widgets/TextareaWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAIpC,KAA2B;IAC3B,MAAM,EACJ,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN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tB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,sBACzD,kBAAkB,CAAC,EAAE,CAAC,KACpC,UAAU,GACd,CACH,CAAC;AACJ,CAAC"}
|
package/lib/widgets/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ import type { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema
|
|
|
2
2
|
export declare function generateWidgets<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): RegistryWidgetsType<T, S, F>;
|
|
3
3
|
declare const _default: RegistryWidgetsType<any, RJSFSchema, any>;
|
|
4
4
|
export default _default;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAatG,wBAAgB,eAAe,CAC7B,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,KAC5B,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAiBhC;;AAED,wBAAiC"}
|
package/lib/widgets/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import SelectWidget from './SelectWidget.js';
|
|
12
|
-
import TextareaWidget from './TextareaWidget.js';
|
|
13
|
-
// This plugin is needed to support the parsing of date and time values in the `DateWidget` and `DateTimeWidget`
|
|
14
|
-
dayjs.extend(customParseFormat);
|
|
1
|
+
import CheckboxesWidget from "./CheckboxesWidget.js";
|
|
2
|
+
import CheckboxWidget from "./CheckboxWidget.js";
|
|
3
|
+
import ColorWidget from "./ColorWidget.js";
|
|
4
|
+
import { AltDateTimeWidget, AltDateWidget, DateWidget, DateTimeWidget, TimeWidget } from "./DateTime/index.js";
|
|
5
|
+
import FileWidget from "./FileWidget.js";
|
|
6
|
+
import PasswordWidget from "./PasswordWidget.js";
|
|
7
|
+
import RadioWidget from "./RadioWidget.js";
|
|
8
|
+
import RangeWidget from "./RangeWidget.js";
|
|
9
|
+
import SelectWidget from "./SelectWidget.js";
|
|
10
|
+
import TextareaWidget from "./TextareaWidget.js";
|
|
15
11
|
export function generateWidgets() {
|
|
16
12
|
return {
|
|
17
13
|
AltDateTimeWidget,
|
package/lib/widgets/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,uBAAwB,CAAC;AACtD,OAAO,cAAc,MAAM,qBAAsB,CAAC;AAClD,OAAO,WAAW,MAAM,kBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,UAAU,MAAM,iBAAkB,CAAC;AAC1C,OAAO,cAAc,MAAM,qBAAsB,CAAC;AAClD,OAAO,WAAW,MAAM,kBAAmB,CAAC;AAC5C,OAAO,WAAW,MAAM,kBAAmB,CAAC;AAC5C,OAAO,YAAY,MAAM,mBAAoB,CAAC;AAC9C,OAAO,cAAc,MAAM,qBAAsB,CAAC;AAElD,MAAM,UAAU,eAAe;IAK7B,OAAO;QACL,iBAAiB;QACjB,aAAa;QACb,gBAAgB;QAChB,cAAc;QACd,WAAW;QACX,UAAU;QACV,cAAc;QACd,UAAU;QACV,cAAc;QACd,WAAW;QACX,WAAW;QACX,YAAY;QACZ,cAAc;QACd,UAAU;KACX,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rjsf/mantine",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"description": "Mantine theme, fields and widgets for react-jsonschema-form",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
@@ -53,20 +54,16 @@
|
|
|
53
54
|
"@mantine/dates": ">=8",
|
|
54
55
|
"@mantine/hooks": ">=8",
|
|
55
56
|
"react": ">=18",
|
|
56
|
-
"@rjsf/
|
|
57
|
-
"@rjsf/
|
|
57
|
+
"@rjsf/core": "^6.10.0",
|
|
58
|
+
"@rjsf/utils": "^6.10.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@mantine/core": "^8.3.18",
|
|
61
62
|
"@mantine/dates": "^8.3.18",
|
|
62
63
|
"@mantine/hooks": "^8.3.18",
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
66
|
-
"@rjsf/core": "^6.8.0",
|
|
67
|
-
"@rjsf/snapshot-tests": "^6.8.0",
|
|
68
|
-
"@rjsf/utils": "^6.8.0",
|
|
69
|
-
"@rjsf/validator-ajv8": "^6.8.0"
|
|
64
|
+
"@rjsf/core": "^6.10.0",
|
|
65
|
+
"@rjsf/snapshot-tests": "^6.10.0",
|
|
66
|
+
"@rjsf/utils": "^6.10.0"
|
|
70
67
|
},
|
|
71
68
|
"dependencies": {
|
|
72
69
|
"dayjs": "^1.11.21"
|
|
@@ -98,7 +95,7 @@
|
|
|
98
95
|
},
|
|
99
96
|
"license": "Apache-2.0",
|
|
100
97
|
"scripts": {
|
|
101
|
-
"build:ts": "tsc -b
|
|
98
|
+
"build:ts": "tsc -b",
|
|
102
99
|
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
|
|
103
100
|
"build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/mantine.esm.js --sourcemap --packages=external --format=esm",
|
|
104
101
|
"build:umd": "rollup dist/mantine.esm.js --format=umd --file=dist/mantine.umd.js --name=@rjsf/mantine",
|
package/src/Form/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { FormProps } from '@rjsf/core';
|
|
|
3
3
|
import { withTheme } from '@rjsf/core';
|
|
4
4
|
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
5
5
|
|
|
6
|
-
import { generateTheme } from '../Theme';
|
|
6
|
+
import { generateTheme } from '../Theme/index.ts';
|
|
7
7
|
|
|
8
8
|
export function generateForm<
|
|
9
9
|
T = any,
|
package/src/Theme/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ThemeProps } from '@rjsf/core';
|
|
2
2
|
import type { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
|
|
4
|
-
import { generateTemplates } from '../templates';
|
|
5
|
-
import { generateWidgets } from '../widgets';
|
|
4
|
+
import { generateTemplates } from '../templates/index.ts';
|
|
5
|
+
import { generateWidgets } from '../widgets/index.ts';
|
|
6
6
|
|
|
7
7
|
export function generateTheme<
|
|
8
8
|
T = any,
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Form, { generateForm } from './Form';
|
|
2
|
-
import Templates, { generateTemplates } from './templates';
|
|
3
|
-
import Theme, { generateTheme } from './Theme';
|
|
4
|
-
import Widgets, { generateWidgets } from './widgets';
|
|
1
|
+
import Form, { generateForm } from './Form/index.ts';
|
|
2
|
+
import Templates, { generateTemplates } from './templates/index.ts';
|
|
3
|
+
import Theme, { generateTheme } from './Theme/index.ts';
|
|
4
|
+
import Widgets, { generateWidgets } from './widgets/index.ts';
|
|
5
5
|
|
|
6
6
|
export { Form, Templates, Theme, Widgets, generateForm, generateTemplates, generateTheme, generateWidgets };
|
|
7
7
|
|
|
@@ -5,7 +5,7 @@ import { SchemaExamples } from '@rjsf/core';
|
|
|
5
5
|
import type { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
6
6
|
import { ariaDescribedByIds, examplesId, getInputProps, labelValue } from '@rjsf/utils';
|
|
7
7
|
|
|
8
|
-
import { cleanupOptions } from '../utils';
|
|
8
|
+
import { cleanupOptions } from '../utils.ts';
|
|
9
9
|
|
|
10
10
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
11
11
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
@@ -75,7 +75,7 @@ export default function BaseInputTemplate<
|
|
|
75
75
|
(e: MouseEvent) => {
|
|
76
76
|
e.preventDefault();
|
|
77
77
|
e.stopPropagation();
|
|
78
|
-
onChange(options.emptyValue
|
|
78
|
+
onChange(options.emptyValue);
|
|
79
79
|
},
|
|
80
80
|
[onChange, options.emptyValue],
|
|
81
81
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
import { TranslatableString } from '@rjsf/utils';
|
|
3
3
|
|
|
4
|
-
import { Plus } from '../icons';
|
|
5
|
-
import IconButton from './IconButton';
|
|
4
|
+
import { Plus } from '../icons.tsx';
|
|
5
|
+
import IconButton from './IconButton.tsx';
|
|
6
6
|
|
|
7
7
|
/** The `AddButton` renders a button that represent the `Add` action on a form
|
|
8
8
|
*/
|
|
@@ -5,7 +5,7 @@ import { ActionIcon } from '@mantine/core';
|
|
|
5
5
|
import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
6
6
|
import { TranslatableString } from '@rjsf/utils';
|
|
7
7
|
|
|
8
|
-
import { Copy, ChevronDown, ChevronUp, X } from '../icons';
|
|
8
|
+
import { Copy, ChevronDown, ChevronUp, X } from '../icons.tsx';
|
|
9
9
|
|
|
10
10
|
export type MantineIconButtonProps<
|
|
11
11
|
T = any,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
2
|
|
|
3
|
-
import AddButton from './AddButton';
|
|
4
|
-
import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton, ClearButton } from './IconButton';
|
|
5
|
-
import SubmitButton from './SubmitButton';
|
|
3
|
+
import AddButton from './AddButton.tsx';
|
|
4
|
+
import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton, ClearButton } from './IconButton.tsx';
|
|
5
|
+
import SubmitButton from './SubmitButton.tsx';
|
|
6
6
|
|
|
7
7
|
function buttonTemplates<
|
|
8
8
|
T = any,
|
|
@@ -2,7 +2,7 @@ import { Alert, Button, Group } from '@mantine/core';
|
|
|
2
2
|
import type { CyclicSchemaExpandProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
import { ID_KEY, TranslatableString } from '@rjsf/utils';
|
|
4
4
|
|
|
5
|
-
import { ExclamationCircle } from './icons';
|
|
5
|
+
import { ExclamationCircle } from './icons.tsx';
|
|
6
6
|
|
|
7
7
|
/** The `CyclicSchemaExpandTemplate` is the template to use to render the cyclic schema expand message and controls
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import { Alert, Title, List } from '@mantine/core';
|
|
|
2
2
|
import type { ErrorListProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
3
|
import { TranslatableString } from '@rjsf/utils';
|
|
4
4
|
|
|
5
|
-
import { ExclamationCircle } from './icons';
|
|
5
|
+
import { ExclamationCircle } from './icons.tsx';
|
|
6
6
|
|
|
7
7
|
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
8
8
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FormContextType, OptionalDataControlsTemplateProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
|
|
3
|
-
import AddButton from './ButtonTemplates/AddButton';
|
|
4
|
-
import { RemoveButton } from './ButtonTemplates/IconButton';
|
|
3
|
+
import AddButton from './ButtonTemplates/AddButton.tsx';
|
|
4
|
+
import { RemoveButton } from './ButtonTemplates/IconButton.tsx';
|
|
5
5
|
|
|
6
6
|
/** The OptionalDataControlsTemplate renders one of three different states. If
|
|
7
7
|
* there is an `onAddClick()` function, it renders the "Add" button. If there is
|
package/src/templates/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
2
|
|
|
3
|
-
import ArrayFieldItemTemplate from './ArrayFieldItemTemplate';
|
|
4
|
-
import ArrayFieldTemplate from './ArrayFieldTemplate';
|
|
5
|
-
import ArrayFieldTitleTemplate from './ArrayFieldTitleTemplate';
|
|
6
|
-
import BaseInputTemplate from './BaseInputTemplate';
|
|
7
|
-
import ButtonTemplates from './ButtonTemplates';
|
|
8
|
-
import CyclicSchemaExpandTemplate from './CyclicSchemaExpandTemplate';
|
|
9
|
-
import DescriptionField from './DescriptionField';
|
|
10
|
-
import ErrorList from './ErrorList';
|
|
11
|
-
import FieldErrorTemplate from './FieldErrorTemplate';
|
|
12
|
-
import FieldHelpTemplate from './FieldHelpTemplate';
|
|
13
|
-
import FieldTemplate from './FieldTemplate';
|
|
14
|
-
import GridTemplate from './GridTemplate';
|
|
15
|
-
import MultiSchemaFieldTemplate from './MultiSchemaFieldTemplate';
|
|
16
|
-
import ObjectFieldTemplate from './ObjectFieldTemplate';
|
|
17
|
-
import OptionalDataControlsTemplate from './OptionalDataControlsTemplate';
|
|
18
|
-
import TitleField from './TitleField';
|
|
19
|
-
import WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate';
|
|
3
|
+
import ArrayFieldItemTemplate from './ArrayFieldItemTemplate.tsx';
|
|
4
|
+
import ArrayFieldTemplate from './ArrayFieldTemplate.tsx';
|
|
5
|
+
import ArrayFieldTitleTemplate from './ArrayFieldTitleTemplate.tsx';
|
|
6
|
+
import BaseInputTemplate from './BaseInputTemplate.tsx';
|
|
7
|
+
import ButtonTemplates from './ButtonTemplates/index.ts';
|
|
8
|
+
import CyclicSchemaExpandTemplate from './CyclicSchemaExpandTemplate.tsx';
|
|
9
|
+
import DescriptionField from './DescriptionField.tsx';
|
|
10
|
+
import ErrorList from './ErrorList.tsx';
|
|
11
|
+
import FieldErrorTemplate from './FieldErrorTemplate.tsx';
|
|
12
|
+
import FieldHelpTemplate from './FieldHelpTemplate.tsx';
|
|
13
|
+
import FieldTemplate from './FieldTemplate.tsx';
|
|
14
|
+
import GridTemplate from './GridTemplate.tsx';
|
|
15
|
+
import MultiSchemaFieldTemplate from './MultiSchemaFieldTemplate.tsx';
|
|
16
|
+
import ObjectFieldTemplate from './ObjectFieldTemplate.tsx';
|
|
17
|
+
import OptionalDataControlsTemplate from './OptionalDataControlsTemplate.tsx';
|
|
18
|
+
import TitleField from './TitleField.tsx';
|
|
19
|
+
import WrapIfAdditionalTemplate from './WrapIfAdditionalTemplate.tsx';
|
|
20
20
|
|
|
21
21
|
export function generateTemplates<
|
|
22
22
|
T = any,
|
package/src/utils.ts
CHANGED
|
@@ -3,12 +3,17 @@ import type { UIOptionsType } from '@rjsf/utils';
|
|
|
3
3
|
const uiOptionsKeys: (keyof UIOptionsType)[] = [
|
|
4
4
|
'emptyValue',
|
|
5
5
|
'classNames',
|
|
6
|
+
'style',
|
|
6
7
|
'title',
|
|
7
8
|
'label',
|
|
8
9
|
'help',
|
|
10
|
+
'autofocus',
|
|
9
11
|
'autocomplete',
|
|
12
|
+
'autocapitalize',
|
|
10
13
|
'disabled',
|
|
11
14
|
'enumDisabled',
|
|
15
|
+
'enumNames',
|
|
16
|
+
'enumOrder',
|
|
12
17
|
'hideError',
|
|
13
18
|
'readonly',
|
|
14
19
|
'order',
|
|
@@ -17,7 +22,7 @@ const uiOptionsKeys: (keyof UIOptionsType)[] = [
|
|
|
17
22
|
'inputType',
|
|
18
23
|
'submitButtonOptions',
|
|
19
24
|
'widget',
|
|
20
|
-
'
|
|
25
|
+
'field',
|
|
21
26
|
'addable',
|
|
22
27
|
'copyable',
|
|
23
28
|
'orderable',
|
|
@@ -26,7 +31,26 @@ const uiOptionsKeys: (keyof UIOptionsType)[] = [
|
|
|
26
31
|
'enumOptions',
|
|
27
32
|
'enableMarkdownInDescription',
|
|
28
33
|
'enableMarkdownInHelp',
|
|
34
|
+
'enableOptionalDataFieldForType',
|
|
29
35
|
'globalOptions',
|
|
36
|
+
'allowClearTextInputs',
|
|
37
|
+
'optionValueFormat',
|
|
38
|
+
'optionsSchemaSelector',
|
|
39
|
+
'deprecatedHandling',
|
|
40
|
+
'ArrayFieldDescriptionTemplate',
|
|
41
|
+
'ArrayFieldItemTemplate',
|
|
42
|
+
'ArrayFieldTemplate',
|
|
43
|
+
'ArrayFieldTitleTemplate',
|
|
44
|
+
'BaseInputTemplate',
|
|
45
|
+
'DescriptionFieldTemplate',
|
|
46
|
+
'ErrorListTemplate',
|
|
47
|
+
'FieldErrorTemplate',
|
|
48
|
+
'FieldHelpTemplate',
|
|
49
|
+
'FieldTemplate',
|
|
50
|
+
'ObjectFieldTemplate',
|
|
51
|
+
'TitleFieldTemplate',
|
|
52
|
+
'UnsupportedFieldTemplate',
|
|
53
|
+
'WrapIfAdditionalTemplate',
|
|
30
54
|
];
|
|
31
55
|
|
|
32
56
|
export function cleanupOptions<T extends object>(options: T): Omit<T, keyof UIOptionsType> {
|
|
@@ -2,7 +2,7 @@ import type { ReactElement, ChangeEvent, FocusEvent } from 'react';
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Checkbox } from '@mantine/core';
|
|
4
4
|
import type { StrictRJSFSchema, RJSFSchema, FormContextType, WidgetProps } from '@rjsf/utils';
|
|
5
|
-
import { descriptionId, getTemplate, labelValue, ariaDescribedByIds } from '@rjsf/utils';
|
|
5
|
+
import { descriptionId, getTemplate, labelValue, ariaDescribedByIds, schemaRequiresTrueValue } from '@rjsf/utils';
|
|
6
6
|
|
|
7
7
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
8
8
|
* It is typically used to represent a boolean.
|
|
@@ -35,6 +35,7 @@ export default function CheckboxWidget<
|
|
|
35
35
|
uiSchema,
|
|
36
36
|
} = props;
|
|
37
37
|
|
|
38
|
+
const trueValueRequired = schemaRequiresTrueValue(schema) && required;
|
|
38
39
|
const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
|
|
39
40
|
'DescriptionFieldTemplate',
|
|
40
41
|
registry,
|
|
@@ -83,9 +84,18 @@ export default function CheckboxWidget<
|
|
|
83
84
|
<Checkbox
|
|
84
85
|
id={id}
|
|
85
86
|
name={htmlName || name}
|
|
86
|
-
label={
|
|
87
|
+
label={
|
|
88
|
+
!hideLabel && label ? (
|
|
89
|
+
<>
|
|
90
|
+
{label}
|
|
91
|
+
{trueValueRequired && <span className='required'>*</span>}
|
|
92
|
+
</>
|
|
93
|
+
) : (
|
|
94
|
+
labelValue(label || undefined, hideLabel, false)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
87
97
|
disabled={disabled || readonly}
|
|
88
|
-
required={
|
|
98
|
+
required={trueValueRequired}
|
|
89
99
|
autoFocus={autofocus}
|
|
90
100
|
checked={typeof value === 'undefined' ? false : value === 'true' || value}
|
|
91
101
|
onChange={handleCheckboxChange}
|