@rjsf/shadcn 6.0.0-beta.1
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/README.md +225 -0
- package/dist/blue.css +1 -0
- package/dist/default.css +1 -0
- package/dist/green.css +1 -0
- package/dist/index.js +1521 -0
- package/dist/index.js.map +7 -0
- package/dist/orange.css +1 -0
- package/dist/red.css +1 -0
- package/dist/rjsf-shadcn.esm.js +1540 -0
- package/dist/rjsf-shadcn.esm.js.map +7 -0
- package/dist/rjsf-shadcn.umd.js +1329 -0
- package/dist/rose.css +1 -0
- package/dist/violet.css +1 -0
- package/dist/yellow.css +1 -0
- package/dist/zinc.css +1 -0
- package/lib/AddButton/AddButton.d.ts +6 -0
- package/lib/AddButton/AddButton.js +13 -0
- package/lib/AddButton/AddButton.js.map +1 -0
- package/lib/AddButton/index.d.ts +2 -0
- package/lib/AddButton/index.js +3 -0
- package/lib/AddButton/index.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +6 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +13 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldItemTemplate/index.js +3 -0
- package/lib/ArrayFieldItemTemplate/index.js.map +1 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +6 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +18 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -0
- package/lib/ArrayFieldTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldTemplate/index.js +3 -0
- package/lib/ArrayFieldTemplate/index.js.map +1 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +8 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js +25 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -0
- package/lib/BaseInputTemplate/index.d.ts +2 -0
- package/lib/BaseInputTemplate/index.js +3 -0
- package/lib/BaseInputTemplate/index.js.map +1 -0
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +7 -0
- package/lib/CheckboxWidget/CheckboxWidget.js +23 -0
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -0
- package/lib/CheckboxWidget/index.d.ts +2 -0
- package/lib/CheckboxWidget/index.js +3 -0
- package/lib/CheckboxWidget/index.js.map +1 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +7 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js +31 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -0
- package/lib/CheckboxesWidget/index.d.ts +2 -0
- package/lib/CheckboxesWidget/index.js +3 -0
- package/lib/CheckboxesWidget/index.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +6 -0
- package/lib/DescriptionField/DescriptionField.js +12 -0
- package/lib/DescriptionField/DescriptionField.js.map +1 -0
- package/lib/DescriptionField/index.d.ts +2 -0
- package/lib/DescriptionField/index.js +3 -0
- package/lib/DescriptionField/index.js.map +1 -0
- package/lib/ErrorList/ErrorList.d.ts +6 -0
- package/lib/ErrorList/ErrorList.js +15 -0
- package/lib/ErrorList/ErrorList.js.map +1 -0
- package/lib/ErrorList/index.d.ts +2 -0
- package/lib/ErrorList/index.js +3 -0
- package/lib/ErrorList/index.js.map +1 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +6 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +17 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -0
- package/lib/FieldErrorTemplate/index.d.ts +2 -0
- package/lib/FieldErrorTemplate/index.js +3 -0
- package/lib/FieldErrorTemplate/index.js.map +1 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +6 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +16 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -0
- package/lib/FieldHelpTemplate/index.d.ts +2 -0
- package/lib/FieldHelpTemplate/index.js +3 -0
- package/lib/FieldHelpTemplate/index.js.map +1 -0
- package/lib/FieldTemplate/FieldTemplate.d.ts +7 -0
- package/lib/FieldTemplate/FieldTemplate.js +17 -0
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -0
- package/lib/FieldTemplate/index.d.ts +2 -0
- package/lib/FieldTemplate/index.js +3 -0
- package/lib/FieldTemplate/index.js.map +1 -0
- package/lib/Form/Form.d.ts +6 -0
- package/lib/Form/Form.js +7 -0
- package/lib/Form/Form.js.map +1 -0
- package/lib/Form/index.d.ts +2 -0
- package/lib/Form/index.js +3 -0
- package/lib/Form/index.js.map +1 -0
- package/lib/GridTemplate/GridTemplate.d.ts +7 -0
- package/lib/GridTemplate/GridTemplate.js +12 -0
- package/lib/GridTemplate/GridTemplate.js.map +1 -0
- package/lib/GridTemplate/index.d.ts +2 -0
- package/lib/GridTemplate/index.js +3 -0
- package/lib/GridTemplate/index.js.map +1 -0
- package/lib/IconButton/IconButton.d.ts +39 -0
- package/lib/IconButton/IconButton.js +57 -0
- package/lib/IconButton/IconButton.js.map +1 -0
- package/lib/IconButton/index.d.ts +2 -0
- package/lib/IconButton/index.js +3 -0
- package/lib/IconButton/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +8 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +17 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -0
- package/lib/ObjectFieldTemplate/index.d.ts +2 -0
- package/lib/ObjectFieldTemplate/index.js +3 -0
- package/lib/ObjectFieldTemplate/index.js.map +1 -0
- package/lib/RadioWidget/RadioWidget.d.ts +7 -0
- package/lib/RadioWidget/RadioWidget.js +26 -0
- package/lib/RadioWidget/RadioWidget.js.map +1 -0
- package/lib/RadioWidget/index.d.ts +2 -0
- package/lib/RadioWidget/index.js +3 -0
- package/lib/RadioWidget/index.js.map +1 -0
- package/lib/RangeWidget/RangeWidget.d.ts +15 -0
- package/lib/RangeWidget/RangeWidget.js +39 -0
- package/lib/RangeWidget/RangeWidget.js.map +1 -0
- package/lib/RangeWidget/index.d.ts +2 -0
- package/lib/RangeWidget/index.js +3 -0
- package/lib/RangeWidget/index.js.map +1 -0
- package/lib/SelectWidget/SelectWidget.d.ts +7 -0
- package/lib/SelectWidget/SelectWidget.js +31 -0
- package/lib/SelectWidget/SelectWidget.js.map +1 -0
- package/lib/SelectWidget/index.d.ts +2 -0
- package/lib/SelectWidget/index.js +3 -0
- package/lib/SelectWidget/index.js.map +1 -0
- package/lib/SubmitButton/SubmitButton.d.ts +4 -0
- package/lib/SubmitButton/SubmitButton.js +13 -0
- package/lib/SubmitButton/SubmitButton.js.map +1 -0
- package/lib/SubmitButton/index.d.ts +2 -0
- package/lib/SubmitButton/index.js +3 -0
- package/lib/SubmitButton/index.js.map +1 -0
- package/lib/Templates/Templates.d.ts +4 -0
- package/lib/Templates/Templates.js +41 -0
- package/lib/Templates/Templates.js.map +1 -0
- package/lib/Templates/index.d.ts +2 -0
- package/lib/Templates/index.js +3 -0
- package/lib/Templates/index.js.map +1 -0
- package/lib/TextareaWidget/TextareaWidget.d.ts +10 -0
- package/lib/TextareaWidget/TextareaWidget.js +14 -0
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -0
- package/lib/TextareaWidget/index.d.ts +2 -0
- package/lib/TextareaWidget/index.js +3 -0
- package/lib/TextareaWidget/index.js.map +1 -0
- package/lib/Theme/Theme.d.ts +5 -0
- package/lib/Theme/Theme.js +10 -0
- package/lib/Theme/Theme.js.map +1 -0
- package/lib/Theme/index.d.ts +2 -0
- package/lib/Theme/index.js +3 -0
- package/lib/Theme/index.js.map +1 -0
- package/lib/TitleField/TitleField.d.ts +6 -0
- package/lib/TitleField/TitleField.js +12 -0
- package/lib/TitleField/TitleField.js.map +1 -0
- package/lib/TitleField/index.d.ts +2 -0
- package/lib/TitleField/index.js +3 -0
- package/lib/TitleField/index.js.map +1 -0
- package/lib/Widgets/Widgets.d.ts +4 -0
- package/lib/Widgets/Widgets.js +18 -0
- package/lib/Widgets/Widgets.js.map +1 -0
- package/lib/Widgets/index.d.ts +2 -0
- package/lib/Widgets/index.js +3 -0
- package/lib/Widgets/index.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +7 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +23 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/index.d.ts +2 -0
- package/lib/WrapIfAdditionalTemplate/index.js +3 -0
- package/lib/WrapIfAdditionalTemplate/index.js.map +1 -0
- package/lib/components/ui/alert.d.ts +27 -0
- package/lib/components/ui/alert.js +42 -0
- package/lib/components/ui/alert.js.map +1 -0
- package/lib/components/ui/badge.d.ts +26 -0
- package/lib/components/ui/badge.js +33 -0
- package/lib/components/ui/badge.js.map +1 -0
- package/lib/components/ui/button.d.ts +32 -0
- package/lib/components/ui/button.js +49 -0
- package/lib/components/ui/button.js.map +1 -0
- package/lib/components/ui/checkbox.d.ts +11 -0
- package/lib/components/ui/checkbox.js +19 -0
- package/lib/components/ui/checkbox.js.map +1 -0
- package/lib/components/ui/command.d.ts +134 -0
- package/lib/components/ui/command.js +84 -0
- package/lib/components/ui/command.js.map +1 -0
- package/lib/components/ui/dialog.d.ts +71 -0
- package/lib/components/ui/dialog.js +77 -0
- package/lib/components/ui/dialog.js.map +1 -0
- package/lib/components/ui/fancy-multi-select.d.ts +50 -0
- package/lib/components/ui/fancy-multi-select.js +62 -0
- package/lib/components/ui/fancy-multi-select.js.map +1 -0
- package/lib/components/ui/fancy-select.d.ts +50 -0
- package/lib/components/ui/fancy-select.js +41 -0
- package/lib/components/ui/fancy-select.js.map +1 -0
- package/lib/components/ui/input.d.ts +17 -0
- package/lib/components/ui/input.js +18 -0
- package/lib/components/ui/input.js.map +1 -0
- package/lib/components/ui/label.d.ts +12 -0
- package/lib/components/ui/label.js +19 -0
- package/lib/components/ui/label.js.map +1 -0
- package/lib/components/ui/radio-group.d.ts +20 -0
- package/lib/components/ui/radio-group.js +32 -0
- package/lib/components/ui/radio-group.js.map +1 -0
- package/lib/components/ui/select.d.ts +30 -0
- package/lib/components/ui/select.js +46 -0
- package/lib/components/ui/select.js.map +1 -0
- package/lib/components/ui/separator.d.ts +12 -0
- package/lib/components/ui/separator.js +19 -0
- package/lib/components/ui/separator.js.map +1 -0
- package/lib/components/ui/slider.d.ts +10 -0
- package/lib/components/ui/slider.js +17 -0
- package/lib/components/ui/slider.js.map +1 -0
- package/lib/components/ui/textarea.d.ts +16 -0
- package/lib/components/ui/textarea.js +17 -0
- package/lib/components/ui/textarea.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/lib/utils.d.ts +2 -0
- package/lib/lib/utils.js +6 -0
- package/lib/lib/utils.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +121 -0
- package/src/AddButton/AddButton.tsx +23 -0
- package/src/AddButton/index.ts +2 -0
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +40 -0
- package/src/ArrayFieldItemTemplate/index.ts +2 -0
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +84 -0
- package/src/ArrayFieldTemplate/index.ts +2 -0
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +85 -0
- package/src/BaseInputTemplate/index.ts +2 -0
- package/src/CheckboxWidget/CheckboxWidget.tsx +88 -0
- package/src/CheckboxWidget/index.ts +2 -0
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +73 -0
- package/src/CheckboxesWidget/index.ts +2 -0
- package/src/DescriptionField/DescriptionField.tsx +23 -0
- package/src/DescriptionField/index.ts +2 -0
- package/src/ErrorList/ErrorList.tsx +26 -0
- package/src/ErrorList/index.ts +2 -0
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +29 -0
- package/src/FieldErrorTemplate/index.ts +2 -0
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +24 -0
- package/src/FieldHelpTemplate/index.ts +2 -0
- package/src/FieldTemplate/FieldTemplate.tsx +93 -0
- package/src/FieldTemplate/index.ts +2 -0
- package/src/Form/Form.tsx +16 -0
- package/src/Form/index.ts +2 -0
- package/src/GridTemplate/GridTemplate.tsx +16 -0
- package/src/GridTemplate/index.ts +2 -0
- package/src/IconButton/IconButton.tsx +104 -0
- package/src/IconButton/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +89 -0
- package/src/ObjectFieldTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +77 -0
- package/src/RadioWidget/index.ts +2 -0
- package/src/RangeWidget/RangeWidget.tsx +64 -0
- package/src/RangeWidget/index.ts +2 -0
- package/src/SelectWidget/SelectWidget.tsx +93 -0
- package/src/SelectWidget/index.ts +2 -0
- package/src/SubmitButton/SubmitButton.tsx +21 -0
- package/src/SubmitButton/index.ts +2 -0
- package/src/Templates/Templates.ts +47 -0
- package/src/Templates/index.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +59 -0
- package/src/TextareaWidget/index.ts +2 -0
- package/src/Theme/Theme.tsx +18 -0
- package/src/Theme/index.ts +2 -0
- package/src/TitleField/TitleField.tsx +21 -0
- package/src/TitleField/index.ts +2 -0
- package/src/Widgets/Widgets.ts +24 -0
- package/src/Widgets/index.ts +2 -0
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +93 -0
- package/src/WrapIfAdditionalTemplate/index.ts +2 -0
- package/src/components/ui/alert.tsx +61 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/button.tsx +65 -0
- package/src/components/ui/checkbox.tsx +35 -0
- package/src/components/ui/command.tsx +183 -0
- package/src/components/ui/dialog.tsx +144 -0
- package/src/components/ui/fancy-multi-select.tsx +232 -0
- package/src/components/ui/fancy-select.tsx +157 -0
- package/src/components/ui/input.tsx +34 -0
- package/src/components/ui/label.tsx +27 -0
- package/src/components/ui/radio-group.tsx +54 -0
- package/src/components/ui/select.tsx +174 -0
- package/src/components/ui/separator.tsx +35 -0
- package/src/components/ui/slider.tsx +28 -0
- package/src/components/ui/textarea.tsx +33 -0
- package/src/css/blue.css +71 -0
- package/src/css/default.css +59 -0
- package/src/css/green.css +71 -0
- package/src/css/orange.css +71 -0
- package/src/css/red.css +70 -0
- package/src/css/rose.css +70 -0
- package/src/css/violet.css +69 -0
- package/src/css/yellow.css +69 -0
- package/src/css/zinc.css +69 -0
- package/src/index.ts +8 -0
- package/src/lib/utils.ts +6 -0
- package/src/tsconfig.json +23 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ariaDescribedByIds, enumOptionsIndexForValue, enumOptionsValueForIndex, } from '@rjsf/utils';
|
|
3
|
+
import { FancyMultiSelect } from '../components/ui/fancy-multi-select.js';
|
|
4
|
+
import { FancySelect } from '../components/ui/fancy-select.js';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
/** The `SelectWidget` is a widget for rendering dropdowns.
|
|
7
|
+
* It is typically used with string properties constrained with enum options.
|
|
8
|
+
*
|
|
9
|
+
* @param props - The `WidgetProps` for this component
|
|
10
|
+
*/
|
|
11
|
+
export default function SelectWidget({ id, options, required, disabled, readonly, value, multiple, autofocus, onChange, onBlur, onFocus, defaultValue, placeholder, rawErrors = [], }) {
|
|
12
|
+
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
13
|
+
const _onFancyFocus = () => {
|
|
14
|
+
onFocus(id, enumOptionsValueForIndex(value, enumOptions, optEmptyValue));
|
|
15
|
+
};
|
|
16
|
+
const _onFancyBlur = () => {
|
|
17
|
+
onBlur(id, enumOptionsValueForIndex(value, enumOptions, optEmptyValue));
|
|
18
|
+
};
|
|
19
|
+
const items = enumOptions === null || enumOptions === void 0 ? void 0 : enumOptions.map(({ value, label }, index) => ({
|
|
20
|
+
value: multiple ? value : index.toString(),
|
|
21
|
+
label: label,
|
|
22
|
+
index,
|
|
23
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(value),
|
|
24
|
+
}));
|
|
25
|
+
return (_jsx("div", { className: 'p-0.5', children: !multiple ? (_jsx(FancySelect, { items: items, selected: enumOptionsIndexForValue(value !== null && value !== void 0 ? value : defaultValue, enumOptions, false), onValueChange: (selectedValue) => {
|
|
26
|
+
onChange(enumOptionsValueForIndex(selectedValue, enumOptions, optEmptyValue));
|
|
27
|
+
}, autoFocus: autofocus, disabled: disabled || readonly, required: required, placeholder: placeholder, className: cn({ 'border-destructive': rawErrors.length > 0 }), onFocus: _onFancyFocus, onBlur: _onFancyBlur, ariaDescribedby: ariaDescribedByIds(id) })) : (_jsx(FancyMultiSelect, { id: id, autoFocus: autofocus, disabled: disabled || readonly, multiple: true, className: rawErrors.length > 0 ? 'border-destructive' : '', items: items, selected: value, onValueChange: (values) => {
|
|
28
|
+
onChange(enumOptionsValueForIndex(values, enumOptions, optEmptyValue));
|
|
29
|
+
}, onFocus: _onFancyFocus, onBlur: _onFancyBlur })) }));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=SelectWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectWidget.js","sourceRoot":"","sources":["../../src/SelectWidget/SelectWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GAKzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAA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E;gBAC/B,QAAQ,CAAC,wBAAwB,CAAI,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;YACnF,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,CAAC,EAAE,oBAAoB,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAC7D,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,kBAAkB,CAAI,EAAE,CAAC,GAC1C,CACH,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IACf,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,QACR,SAAS,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAC3D,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE;gBACxB,QAAQ,CAAC,wBAAwB,CAAI,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;YAC5E,CAAC,EACD,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,GACpB,CACH,GACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SelectWidget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, SubmitButtonProps } from '@rjsf/utils';
|
|
2
|
+
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
3
|
+
*/
|
|
4
|
+
export default function SubmitButton<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: SubmitButtonProps<T, S, F>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getSubmitButtonOptions } from '@rjsf/utils';
|
|
3
|
+
import { Button } from '../components/ui/button.js';
|
|
4
|
+
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
5
|
+
*/
|
|
6
|
+
export default function SubmitButton(props) {
|
|
7
|
+
const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(props.uiSchema);
|
|
8
|
+
if (norender) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (_jsx("div", { children: _jsx(Button, { type: 'submit', ...submitButtonProps, className: 'my-2', children: submitText }) }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=SubmitButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../src/SubmitButton/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,sBAAsB,EAAmD,MAAM,aAAa,CAAC;AAEvH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD;GACG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,KAAiC;IAEjC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,sBAAsB,CAAU,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3G,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,wBACE,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,KAAK,iBAAiB,EAAE,SAAS,EAAC,MAAM,YAC1D,UAAU,GACJ,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/SubmitButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, TemplatesType } from '@rjsf/utils';
|
|
2
|
+
export declare function generateTemplates<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): Partial<TemplatesType<T, S, F>>;
|
|
3
|
+
declare const _default: Partial<TemplatesType<any, RJSFSchema, any>>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import AddButton from '../AddButton/index.js';
|
|
2
|
+
import ArrayFieldItemTemplate from '../ArrayFieldItemTemplate/index.js';
|
|
3
|
+
import ArrayFieldTemplate from '../ArrayFieldTemplate/index.js';
|
|
4
|
+
import BaseInputTemplate from '../BaseInputTemplate/BaseInputTemplate.js';
|
|
5
|
+
import DescriptionField from '../DescriptionField/index.js';
|
|
6
|
+
import ErrorList from '../ErrorList/index.js';
|
|
7
|
+
import FieldErrorTemplate from '../FieldErrorTemplate/index.js';
|
|
8
|
+
import FieldHelpTemplate from '../FieldHelpTemplate/index.js';
|
|
9
|
+
import FieldTemplate from '../FieldTemplate/index.js';
|
|
10
|
+
import GridTemplate from '../GridTemplate/index.js';
|
|
11
|
+
import { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } from '../IconButton/index.js';
|
|
12
|
+
import ObjectFieldTemplate from '../ObjectFieldTemplate/index.js';
|
|
13
|
+
import SubmitButton from '../SubmitButton/index.js';
|
|
14
|
+
import TitleField from '../TitleField/index.js';
|
|
15
|
+
import WrapIfAdditionalTemplate from '../WrapIfAdditionalTemplate/index.js';
|
|
16
|
+
export function generateTemplates() {
|
|
17
|
+
return {
|
|
18
|
+
ArrayFieldItemTemplate,
|
|
19
|
+
ArrayFieldTemplate,
|
|
20
|
+
BaseInputTemplate,
|
|
21
|
+
ButtonTemplates: {
|
|
22
|
+
AddButton,
|
|
23
|
+
CopyButton,
|
|
24
|
+
MoveDownButton,
|
|
25
|
+
MoveUpButton,
|
|
26
|
+
RemoveButton,
|
|
27
|
+
SubmitButton,
|
|
28
|
+
},
|
|
29
|
+
DescriptionFieldTemplate: DescriptionField,
|
|
30
|
+
ErrorListTemplate: ErrorList,
|
|
31
|
+
FieldErrorTemplate,
|
|
32
|
+
FieldHelpTemplate,
|
|
33
|
+
FieldTemplate,
|
|
34
|
+
GridTemplate,
|
|
35
|
+
ObjectFieldTemplate,
|
|
36
|
+
TitleFieldTemplate: TitleField,
|
|
37
|
+
WrapIfAdditionalTemplate,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export default generateTemplates();
|
|
41
|
+
//# sourceMappingURL=Templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Templates.js","sourceRoot":"","sources":["../../src/Templates/Templates.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,sBAAsB,MAAM,2BAA2B,CAAC;AAC/D,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,wBAAwB,MAAM,6BAA6B,CAAC;AAEnE,MAAM,UAAU,iBAAiB;IAK/B,OAAO;QACL,sBAAsB;QACtB,kBAAkB;QAClB,iBAAiB;QACjB,eAAe,EAAE;YACf,SAAS;YACT,UAAU;YACV,cAAc;YACd,YAAY;YACZ,YAAY;YACZ,YAAY;SACb;QACD,wBAAwB,EAAE,gBAAgB;QAC1C,iBAAiB,EAAE,SAAS;QAC5B,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,YAAY;QACZ,mBAAmB;QACnB,kBAAkB,EAAE,UAAU;QAC9B,wBAAwB;KACzB,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
2
|
+
type CustomWidgetProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any> = WidgetProps<T, S, F> & {
|
|
3
|
+
options: any;
|
|
4
|
+
};
|
|
5
|
+
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
6
|
+
*
|
|
7
|
+
* @param props - The `WidgetProps` for this component
|
|
8
|
+
*/
|
|
9
|
+
export default function TextareaWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ id, placeholder, value, required, disabled, autofocus, readonly, onBlur, onFocus, onChange, options, }: CustomWidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ariaDescribedByIds } from '@rjsf/utils';
|
|
3
|
+
import { Textarea } from '../components/ui/textarea.js';
|
|
4
|
+
/** The `TextareaWidget` is a widget for rendering input fields as textarea.
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `WidgetProps` for this component
|
|
7
|
+
*/
|
|
8
|
+
export default function TextareaWidget({ id, placeholder, value, required, disabled, autofocus, readonly, onBlur, onFocus, onChange, options, }) {
|
|
9
|
+
const _onChange = ({ target: { value } }) => onChange(value === '' ? options.emptyValue : value);
|
|
10
|
+
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
11
|
+
const _onFocus = ({ target }) => onFocus(id, target && target.value);
|
|
12
|
+
return (_jsx("div", { className: 'flex p-0.5', children: _jsx(Textarea, { id: id, name: id, placeholder: placeholder, disabled: disabled, readOnly: readonly, value: value !== null && value !== void 0 ? value : '', required: required, autoFocus: autofocus, rows: options.rows || 5, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }) }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=TextareaWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextareaWidget.js","sourceRoot":"","sources":["../../src/TextareaWidget/TextareaWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAA8D,MAAM,aAAa,CAAC;AAE7G,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAUrD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAIpC,EACA,EAAE,EACF,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,GACoB;IAC3B,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAoC,EAAE,EAAE,CAC5E,QAAQ,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,EAAmC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IACpG,MAAM,QAAQ,GAAG,CAAC,EAAE,MAAM,EAAmC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtG,OAAO,CACL,cAAK,SAAS,EAAC,YAAY,YACzB,KAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,EAAE,EACR,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,EACvB,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,sBACC,kBAAkB,CAAI,EAAE,CAAC,GAC3C,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextareaWidget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThemeProps } from '@rjsf/core';
|
|
2
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
3
|
+
export declare function generateTheme<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): ThemeProps<T, S, F>;
|
|
4
|
+
declare const _default: ThemeProps<any, RJSFSchema, any>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { generateTemplates } from '../Templates/index.js';
|
|
2
|
+
import { generateWidgets } from '../Widgets/index.js';
|
|
3
|
+
export function generateTheme() {
|
|
4
|
+
return {
|
|
5
|
+
templates: generateTemplates(),
|
|
6
|
+
widgets: generateWidgets(),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export default generateTheme();
|
|
10
|
+
//# sourceMappingURL=Theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../src/Theme/Theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,aAAa;IAK3B,OAAO;QACL,SAAS,EAAE,iBAAiB,EAAW;QACvC,OAAO,EAAE,eAAe,EAAW;KACpC,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, TitleFieldProps } from '@rjsf/utils';
|
|
2
|
+
/** The `TitleField` is the template to use to render the title of a field
|
|
3
|
+
*
|
|
4
|
+
* @param props - The `TitleFieldProps` for this component
|
|
5
|
+
*/
|
|
6
|
+
export default function TitleField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ id, title, uiSchema, }: TitleFieldProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getUiOptions } from '@rjsf/utils';
|
|
3
|
+
import { Separator } from '../components/ui/separator.js';
|
|
4
|
+
/** The `TitleField` is the template to use to render the title of a field
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `TitleFieldProps` for this component
|
|
7
|
+
*/
|
|
8
|
+
export default function TitleField({ id, title, uiSchema, }) {
|
|
9
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
10
|
+
return (_jsxs("div", { id: id, className: 'my-1 flex flex-col gap-0.5', children: [_jsx("h5", { children: uiOptions.title || title }), _jsx(Separator, { dir: 'horizontal', style: { height: '1px' }, className: 'my-1' })] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=TitleField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TitleField.js","sourceRoot":"","sources":["../../src/TitleField/TitleField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,YAAY,EAAiD,MAAM,aAAa,CAAC;AAE3G,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAoF,EACpH,EAAE,EACF,KAAK,EACL,QAAQ,GACiB;IACzB,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,OAAO,CACL,eAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,4BAA4B,aACjD,uBAAK,SAAS,CAAC,KAAK,IAAI,KAAK,GAAM,EACnC,KAAC,SAAS,IAAC,GAAG,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,IACrE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TitleField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormContextType, RegistryWidgetsType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
export declare function generateWidgets<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(): RegistryWidgetsType<T, S, F>;
|
|
3
|
+
declare const _default: RegistryWidgetsType<any, RJSFSchema, any>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import CheckboxWidget from '../CheckboxWidget/CheckboxWidget.js';
|
|
2
|
+
import CheckboxesWidget from '../CheckboxesWidget/CheckboxesWidget.js';
|
|
3
|
+
import RadioWidget from '../RadioWidget/RadioWidget.js';
|
|
4
|
+
import RangeWidget from '../RangeWidget/RangeWidget.js';
|
|
5
|
+
import SelectWidget from '../SelectWidget/SelectWidget.js';
|
|
6
|
+
import TextareaWidget from '../TextareaWidget/TextareaWidget.js';
|
|
7
|
+
export function generateWidgets() {
|
|
8
|
+
return {
|
|
9
|
+
CheckboxWidget,
|
|
10
|
+
CheckboxesWidget,
|
|
11
|
+
RadioWidget,
|
|
12
|
+
RangeWidget,
|
|
13
|
+
SelectWidget,
|
|
14
|
+
TextareaWidget,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default generateWidgets();
|
|
18
|
+
//# sourceMappingURL=Widgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Widgets.js","sourceRoot":"","sources":["../../src/Widgets/Widgets.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAE9D,MAAM,UAAU,eAAe;IAK7B,OAAO;QACL,cAAc;QACd,gBAAgB;QAChB,WAAW;QACX,WAAW;QACX,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Widgets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, WrapIfAdditionalTemplateProps } from '@rjsf/utils';
|
|
2
|
+
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
3
|
+
* part of an `additionalProperties` part of a schema.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The `WrapIfAdditionalProps` for this component
|
|
6
|
+
*/
|
|
7
|
+
export default function WrapIfAdditionalTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ classNames, style, children, disabled, id, label, onDropPropertyClick, onKeyChange, readonly, required, schema, uiSchema, registry, }: WrapIfAdditionalTemplateProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId, TranslatableString, } from '@rjsf/utils';
|
|
3
|
+
import { Input } from '../components/ui/input.js';
|
|
4
|
+
import { Separator } from '../components/ui/separator.js';
|
|
5
|
+
/** The `WrapIfAdditional` component is used by the `FieldTemplate` to rename, or remove properties that are
|
|
6
|
+
* part of an `additionalProperties` part of a schema.
|
|
7
|
+
*
|
|
8
|
+
* @param props - The `WrapIfAdditionalProps` for this component
|
|
9
|
+
*/
|
|
10
|
+
export default function WrapIfAdditionalTemplate({ classNames, style, children, disabled, id, label, onDropPropertyClick, onKeyChange, readonly, required, schema, uiSchema, registry, }) {
|
|
11
|
+
const { templates, translateString } = registry;
|
|
12
|
+
// Button templates are not overridden in the uiSchema
|
|
13
|
+
const { RemoveButton } = templates.ButtonTemplates;
|
|
14
|
+
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
15
|
+
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
16
|
+
if (!additional) {
|
|
17
|
+
return (_jsx("div", { className: classNames, style: style, children: children }));
|
|
18
|
+
}
|
|
19
|
+
const handleBlur = ({ target }) => onKeyChange(target.value);
|
|
20
|
+
const keyId = `${id}-key`;
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `flex flex-row items-center gap-2 relative w-full ${classNames}`, style: style, children: [_jsxs("div", { className: 'flex flex-col w-full gap-2 line-clamp-1', children: [_jsxs("div", { className: 'flex-grow', children: [_jsx("label", { htmlFor: keyId, className: 'pt-2 text-sm font-medium text-muted-foreground mb-4 line-clamp-1', children: keyLabel }), _jsx("div", { className: 'pl-0.5', children: _jsx(Input, { required: required, defaultValue: label, disabled: disabled || readonly, id: keyId, name: keyId, onBlur: !readonly ? handleBlur : undefined, type: 'text', className: 'mt-1 w-full border shadow-sm' }) })] }), _jsx("div", { className: 'flex-grow pr-0.5', children: children })] }), _jsx(RemoveButton, { id: buttonId(id, 'remove'), iconType: 'block', className: 'rjsf-object-property-remove w-full', disabled: disabled || readonly, onClick: onDropPropertyClick(label), uiSchema: uiSchema, registry: registry })] }), _jsx(Separator, { dir: 'horizontal', className: 'mt-2' })] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=WrapIfAdditionalTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WrapIfAdditionalTemplate.js","sourceRoot":"","sources":["../../src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx"],"names":[],"mapp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AAC,QAAQ,YACrB,KAAC,KAAK,IACJ,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,EAAE,EAAE,KAAK,EACT,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,8BAA8B,GACxC,GACE,IACF,EACN,cAAK,SAAS,EAAC,kBAAkB,YAAE,QAAQ,GAAO,IAC9C,EAEN,KAAC,YAAY,IACX,EAAE,EAAE,QAAQ,CAAI,EAAE,EAAE,QAAQ,CAAC,EAC7B,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAC,oCAAoC,EAC9C,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACnC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,IACE,EACN,KAAC,SAAS,IAAC,GAAG,EAAC,YAAY,EAAC,SAAS,EAAC,MAAM,GAAG,IAC9C,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/WrapIfAdditionalTemplate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
/** A component that displays a brief, important message in a way that attracts the user's attention without interrupting their task.
|
|
4
|
+
*
|
|
5
|
+
* @param props - Component props
|
|
6
|
+
* @param props.variant - 'default' | 'destructive' - Style variant of the alert
|
|
7
|
+
* @param props.className - Additional CSS classes
|
|
8
|
+
* @returns A div element that serves as an alert component
|
|
9
|
+
*/
|
|
10
|
+
declare const Alert: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
11
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
/** Represents the title content of an Alert component.
|
|
14
|
+
*
|
|
15
|
+
* @param props - Component props
|
|
16
|
+
* @param props.className - Additional CSS classes
|
|
17
|
+
* @returns A heading element for the alert title
|
|
18
|
+
*/
|
|
19
|
+
declare const AlertTitle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHeadingElement> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
20
|
+
/** Represents the description content of an Alert component.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Component props
|
|
23
|
+
* @param props.className - Additional CSS classes
|
|
24
|
+
* @returns A div element containing the alert description
|
|
25
|
+
*/
|
|
26
|
+
declare const AlertDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
27
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
const alertVariants = cva('relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:ps-7', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-background text-foreground',
|
|
9
|
+
destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
variant: 'default',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/** A component that displays a brief, important message in a way that attracts the user's attention without interrupting their task.
|
|
17
|
+
*
|
|
18
|
+
* @param props - Component props
|
|
19
|
+
* @param props.variant - 'default' | 'destructive' - Style variant of the alert
|
|
20
|
+
* @param props.className - Additional CSS classes
|
|
21
|
+
* @returns A div element that serves as an alert component
|
|
22
|
+
*/
|
|
23
|
+
const Alert = forwardRef(({ className, variant, ...props }, ref) => (_jsx("div", { ref: ref, role: 'alert', className: cn(alertVariants({ variant }), className), ...props })));
|
|
24
|
+
Alert.displayName = 'Alert';
|
|
25
|
+
/** Represents the title content of an Alert component.
|
|
26
|
+
*
|
|
27
|
+
* @param props - Component props
|
|
28
|
+
* @param props.className - Additional CSS classes
|
|
29
|
+
* @returns A heading element for the alert title
|
|
30
|
+
*/
|
|
31
|
+
const AlertTitle = forwardRef(({ className, ...props }, ref) => (_jsx("h5", { ref: ref, className: cn('mb-1 font-medium leading-none tracking-tight', className), ...props })));
|
|
32
|
+
AlertTitle.displayName = 'AlertTitle';
|
|
33
|
+
/** Represents the description content of an Alert component.
|
|
34
|
+
*
|
|
35
|
+
* @param props - Component props
|
|
36
|
+
* @param props.className - Additional CSS classes
|
|
37
|
+
* @returns A div element containing the alert description
|
|
38
|
+
*/
|
|
39
|
+
const AlertDescription = forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('text-sm [&_p]:leading-relaxed', className), ...props })));
|
|
40
|
+
AlertDescription.displayName = 'AlertDescription';
|
|
41
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
42
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../src/components/ui/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAkB,MAAM,OAA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AE,gBAAgB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Predefined badge variants using class-variance-authority
|
|
5
|
+
* @see https://ui.shadcn.com/docs/components/badge
|
|
6
|
+
*/
|
|
7
|
+
declare const badgeVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Props for the Badge component
|
|
12
|
+
* @extends HTMLAttributes<HTMLDivElement> - HTML div element attributes
|
|
13
|
+
* @extends VariantProps<typeof badgeVariants> - Badge variant props
|
|
14
|
+
*/
|
|
15
|
+
export interface BadgeProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A badge component that displays short status descriptors
|
|
19
|
+
*
|
|
20
|
+
* @param props - The props for the Badge component
|
|
21
|
+
* @param props.className - Additional CSS classes to apply to the badge
|
|
22
|
+
* @param props.variant - The style variant of the badge: 'default' | 'secondary' | 'destructive' | 'outline'
|
|
23
|
+
* @returns A div element that displays as a badge
|
|
24
|
+
*/
|
|
25
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Predefined badge variants using class-variance-authority
|
|
6
|
+
* @see https://ui.shadcn.com/docs/components/badge
|
|
7
|
+
*/
|
|
8
|
+
const badgeVariants = cva('inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
|
|
12
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
13
|
+
destructive: 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
|
14
|
+
outline: 'text-foreground',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: 'default',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* A badge component that displays short status descriptors
|
|
23
|
+
*
|
|
24
|
+
* @param props - The props for the Badge component
|
|
25
|
+
* @param props.className - Additional CSS classes to apply to the badge
|
|
26
|
+
* @param props.variant - The style variant of the badge: 'default' | 'secondary' | 'destructive' | 'outline'
|
|
27
|
+
* @returns A div element that displays as a badge
|
|
28
|
+
*/
|
|
29
|
+
function Badge({ className, variant, ...props }) {
|
|
30
|
+
return _jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
31
|
+
}
|
|
32
|
+
export { Badge, badgeVariants };
|
|
33
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;GAGG;AACH,MAAM,aAAa,GAAG,GAAG,CACvB,sKAAsK,EACtK;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,kFAAkF;YAC3F,SAAS,EAAE,iFAAiF;YAC5F,WAAW,EAAE,8FAA8F;YAC3G,OAAO,EAAE,iBAAiB;SAC3B;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;KACnB;CACF,CACF,CAAC;AASF;;;;;;;GAOG;AACH,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAc;IACzD,OAAO,cAAK,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAClF,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Predefined button variants using class-variance-authority
|
|
5
|
+
* @see https://ui.shadcn.com/docs/components/button
|
|
6
|
+
*/
|
|
7
|
+
declare const buttonVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
9
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Props for the Button component
|
|
13
|
+
* @extends ButtonHTMLAttributes<HTMLButtonElement> - HTML button element attributes
|
|
14
|
+
* @extends VariantProps<typeof buttonVariants> - Button variant props
|
|
15
|
+
*/
|
|
16
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
17
|
+
/** Whether to render the button as a child component using Radix UI Slot */
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A button component with multiple style variants and sizes
|
|
22
|
+
*
|
|
23
|
+
* @param props - The props for the Button component
|
|
24
|
+
* @param props.className - Additional CSS classes to apply to the button
|
|
25
|
+
* @param props.variant - The style variant of the button: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
|
26
|
+
* @param props.size - The size variant of the button: 'default' | 'sm' | 'lg' | 'icon'
|
|
27
|
+
* @param props.asChild - Whether to render the button as a child component
|
|
28
|
+
* @param ref - The forwarded ref for the button element
|
|
29
|
+
* @returns A button element with the specified styles and behavior
|
|
30
|
+
*/
|
|
31
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Predefined button variants using class-variance-authority
|
|
8
|
+
* @see https://ui.shadcn.com/docs/components/button
|
|
9
|
+
*/
|
|
10
|
+
const buttonVariants = cva('inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
14
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
15
|
+
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
16
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
17
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: 'h-9 px-4 py-2',
|
|
22
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
23
|
+
lg: 'h-10 rounded-md px-8',
|
|
24
|
+
icon: 'h-9 w-9',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: 'default',
|
|
29
|
+
size: 'default',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* A button component with multiple style variants and sizes
|
|
34
|
+
*
|
|
35
|
+
* @param props - The props for the Button component
|
|
36
|
+
* @param props.className - Additional CSS classes to apply to the button
|
|
37
|
+
* @param props.variant - The style variant of the button: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
|
38
|
+
* @param props.size - The size variant of the button: 'default' | 'sm' | 'lg' | 'icon'
|
|
39
|
+
* @param props.asChild - Whether to render the button as a child component
|
|
40
|
+
* @param ref - The forwarded ref for the button element
|
|
41
|
+
* @returns A button element with the specified styles and behavior
|
|
42
|
+
*/
|
|
43
|
+
const Button = forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
44
|
+
const Comp = asChild ? Slot : 'button';
|
|
45
|
+
return _jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props });
|
|
46
|
+
});
|
|
47
|
+
Button.displayName = 'Button';
|
|
48
|
+
export { Button, buttonVariants };
|
|
49
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAwB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;GAGG;AACH,MAAM,cAAc,GAAG,GAAG,CACxB,qOAAqO,EACrO;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,+DAA+D;YACxE,WAAW,EAAE,8E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