@nolwenture/formik-jsonschema-form 0.4.2 → 0.5.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/README.md +113 -0
- package/dist/Form.js +13 -24
- package/dist/Form.stories.js +91 -85
- package/dist/Form.test.js +2 -2
- package/dist/FormEditor.js +11 -56
- package/dist/FormEditor.stories.js +2 -13
- package/dist/_sampleData.d.ts +1 -0
- package/dist/_sampleData.js +45 -7
- package/dist/fields/AnyField.js +8 -19
- package/dist/fields/ArrayField.js +32 -54
- package/dist/fields/BooleanField.js +4 -15
- package/dist/fields/DateField.js +4 -15
- package/dist/fields/NullField.js +3 -14
- package/dist/fields/NumberField.js +1 -12
- package/dist/fields/ObjectField.js +18 -41
- package/dist/fields/RadioField.d.ts +3 -0
- package/dist/fields/RadioField.js +11 -0
- package/dist/fields/SchemaField.js +7 -18
- package/dist/fields/SearchMultiTagSelectField.d.ts +3 -0
- package/dist/fields/SearchMultiTagSelectField.js +13 -0
- package/dist/fields/StringField.js +9 -49
- package/dist/fields/ToggleField.d.ts +3 -0
- package/dist/fields/ToggleField.js +11 -0
- package/dist/fields/index.d.ts +3 -0
- package/dist/fields/index.js +3 -0
- package/dist/fields/types.js +1 -1
- package/dist/formEditorSchemas.js +3 -3
- package/dist/styledComponents.d.ts +50 -1
- package/dist/styledComponents.js +340 -135
- package/dist/templates/ArrayFieldTemplate.js +7 -20
- package/dist/templates/FieldTemplate.js +7 -20
- package/dist/templates/ObjectFieldTemplate.js +9 -20
- package/dist/types.d.ts +32 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +49 -36
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as formik from "formik";
|
|
3
|
-
import { ArrayFieldButtonProps, InfoFieldButtonProps, ObjectFieldButtonProps } from "./types";
|
|
3
|
+
import { ArrayFieldButtonProps, InfoFieldButtonProps, ObjectFieldButtonProps, RadioButtonFieldProps, ToggleSwitchFieldProps, SelectFieldProps } from "./types";
|
|
4
4
|
export declare const Form: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "name" | "acceptCharset" | "action" | "autoComplete" | "encType" | "method" | "noValidate" | "target" | "key"> & import("react").RefAttributes<HTMLFormElement>>, any, {}, never>;
|
|
5
5
|
export declare const FormButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const FormButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
@@ -53,4 +53,53 @@ export declare const InfoFieldButton: {
|
|
|
53
53
|
export declare const ErrorMessage: import("styled-components").StyledComponent<import("react").ComponentType<formik.ErrorMessageProps>, any, {}, never>;
|
|
54
54
|
export declare const FieldInput: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
55
55
|
export declare const RequiredIndicator: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
56
|
+
export declare const Toggle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
57
|
+
export declare const ToggleLabel: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
58
|
+
export declare const ToggleFieldInput: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
59
|
+
export declare const ToggleSwitchField: {
|
|
60
|
+
({ inputProps, name, className, }: ToggleSwitchFieldProps): JSX.Element;
|
|
61
|
+
styles: {
|
|
62
|
+
ToggleLabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
63
|
+
ToggleFieldInputStyle: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
64
|
+
ToggleStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export declare const RadioButtonFieldContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
68
|
+
export declare const RadioButtonFieldElement: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
69
|
+
export declare const RadioButtonFieldInput: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
70
|
+
export declare const ButtonLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
71
|
+
export declare const ButtonLabelTrue: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
72
|
+
export declare const ButtonLabelFalse: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
73
|
+
export declare const RadioButtonField: {
|
|
74
|
+
({ label, inputProps, name, className, }: RadioButtonFieldProps): JSX.Element;
|
|
75
|
+
styles: {
|
|
76
|
+
RadioButtonFieldContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
77
|
+
RadioButtonFieldElementStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
78
|
+
RadioButtonFieldInputStyle: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
79
|
+
ButtonLabelStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
80
|
+
ButtonLabelTrueStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
81
|
+
ButtonLabelFalseStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export declare const MultiSelectContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
85
|
+
export declare const MultiSelectInput: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
86
|
+
export declare const MultiSelectBadgeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
87
|
+
export declare const MultiSelectBadge: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
88
|
+
export declare const MultiSelectBadgeCloseElement: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
89
|
+
export declare const MultiSelectOptionList: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
90
|
+
export declare const MultiSelectOptionListItem: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
91
|
+
export declare const MultiSelectOptionListWithoutItem: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
92
|
+
export declare const SearchableMultiTagSelectField: {
|
|
93
|
+
({ name, placeholder, enums, emptySearchMessage, closeElement, className, }: SelectFieldProps): JSX.Element;
|
|
94
|
+
styles: {
|
|
95
|
+
MultiSelectContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
96
|
+
MultiSelectInputStyle: import("styled-components").StyledComponent<({ formikAs, ...props }: any) => JSX.Element, any, {}, never>;
|
|
97
|
+
MultiSelectBadgeContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
98
|
+
MultiSelectBadgeStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
99
|
+
MultiSelectBadgeCloseElementStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
100
|
+
MultiSelectOptionListStyle: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
101
|
+
MultiSelectOptionListItemStyle: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
102
|
+
MultiSelectOptionListWithoutItemStyle: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
56
105
|
export {};
|
package/dist/styledComponents.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
2
|
var t = {};
|
|
18
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -28,137 +13,185 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
28
13
|
import styled from "styled-components";
|
|
29
14
|
import * as formik from "formik";
|
|
30
15
|
import { ArrayFieldButtonPurpose, ObjectFieldButtonPurpose, } from "./types";
|
|
31
|
-
import { useContext } from "react";
|
|
16
|
+
import { useContext, useState } from "react";
|
|
32
17
|
import { FormRegistry } from "./Form";
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
import { Field } from "formik";
|
|
19
|
+
export const Form = styled(formik.Form) ``;
|
|
20
|
+
export const FormButtonWrapper = styled.div ``;
|
|
21
|
+
export const FormButton = styled.button ``;
|
|
22
|
+
export const ObjectFieldWrapper = styled.fieldset ``;
|
|
23
|
+
export const ObjectFieldTitle = styled.legend ``;
|
|
24
|
+
export const ObjectFieldList = styled.ul `
|
|
25
|
+
list-style-type: none;
|
|
26
|
+
padding: 0;
|
|
27
|
+
`;
|
|
28
|
+
export const ObjectFieldItem = styled.li `
|
|
29
|
+
display: flex;
|
|
30
|
+
`;
|
|
31
|
+
export const ObjectFieldItemButtons = styled.div `
|
|
32
|
+
display: flex;
|
|
33
|
+
margin: 0.5rem;
|
|
34
|
+
`;
|
|
35
|
+
export const ObjectFieldButton = styled.a `
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
border: 1px solid black;
|
|
38
|
+
line-height: 1em;
|
|
39
|
+
height: 1em;
|
|
40
|
+
padding: 0 0.3em;
|
|
41
|
+
`;
|
|
42
|
+
export const ObjectFieldLineButton = styled(ObjectFieldButton) ``;
|
|
43
|
+
export const ObjectFieldUpButton = styled(ObjectFieldLineButton) ``;
|
|
44
|
+
export const ObjectFieldDownButton = styled(ObjectFieldLineButton) ``;
|
|
45
|
+
export const ObjectFieldRemoveButton = styled(ObjectFieldLineButton) ``;
|
|
46
|
+
export const ObjectFieldAddButton = styled(ObjectFieldButton) ``;
|
|
47
|
+
export function getObjectFieldButton({ purpose, onClick, uiSchema, }) {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
50
49
|
switch (purpose) {
|
|
51
50
|
case ObjectFieldButtonPurpose.ADD:
|
|
52
|
-
return (_jsx(ObjectFieldAddButton,
|
|
51
|
+
return (_jsx(ObjectFieldAddButton, Object.assign({}, ((_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _a === void 0 ? void 0 : _a.props) !== null && _b !== void 0 ? _b : {}), { onClick: onClick }, { children: (_d = (_c = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _c === void 0 ? void 0 : _c.content) !== null && _d !== void 0 ? _d : "+" })));
|
|
53
52
|
case ObjectFieldButtonPurpose.REMOVE:
|
|
54
|
-
return (_jsx(ObjectFieldRemoveButton,
|
|
53
|
+
return (_jsx(ObjectFieldRemoveButton, Object.assign({}, ((_f = (_e = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _e === void 0 ? void 0 : _e.props) !== null && _f !== void 0 ? _f : {}), { onClick: onClick }, { children: (_h = (_g = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _g === void 0 ? void 0 : _g.content) !== null && _h !== void 0 ? _h : "-" })));
|
|
55
54
|
case ObjectFieldButtonPurpose.MOVE_UP:
|
|
56
|
-
return (_jsx(ObjectFieldUpButton,
|
|
55
|
+
return (_jsx(ObjectFieldUpButton, Object.assign({}, ((_k = (_j = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _j === void 0 ? void 0 : _j.props) !== null && _k !== void 0 ? _k : {}), { onClick: onClick }, { children: (_m = (_l = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _l === void 0 ? void 0 : _l.content) !== null && _m !== void 0 ? _m : "↑" })));
|
|
57
56
|
case ObjectFieldButtonPurpose.MOVE_DOWN:
|
|
58
|
-
return (_jsx(ObjectFieldDownButton,
|
|
57
|
+
return (_jsx(ObjectFieldDownButton, Object.assign({}, ((_p = (_o = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _o === void 0 ? void 0 : _o.props) !== null && _p !== void 0 ? _p : {}), { onClick: onClick }, { children: (_r = (_q = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _q === void 0 ? void 0 : _q.content) !== null && _r !== void 0 ? _r : "↓" })));
|
|
59
58
|
default:
|
|
60
|
-
return (_jsx(ObjectFieldButton,
|
|
59
|
+
return (_jsx(ObjectFieldButton, Object.assign({}, ((_t = (_s = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _s === void 0 ? void 0 : _s.props) !== null && _t !== void 0 ? _t : {}), { onClick: onClick }, { children: (_v = (_u = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _u === void 0 ? void 0 : _u.content) !== null && _v !== void 0 ? _v : "" })));
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
export
|
|
64
|
-
export
|
|
65
|
-
export
|
|
66
|
-
export
|
|
67
|
-
export
|
|
68
|
-
export
|
|
69
|
-
export
|
|
70
|
-
export
|
|
71
|
-
export
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export function GetArrayFieldButton(
|
|
75
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v
|
|
76
|
-
|
|
77
|
-
var _x = useContext(FormRegistry).components, ArrayFieldAddButton = _x.ArrayFieldAddButton, ArrayFieldRemoveButton = _x.ArrayFieldRemoveButton, ArrayFieldUpButton = _x.ArrayFieldUpButton, ArrayFieldDownButton = _x.ArrayFieldDownButton;
|
|
62
|
+
export const ArrayFieldWrapper = ObjectFieldWrapper;
|
|
63
|
+
export const ArrayFieldTitle = ObjectFieldTitle;
|
|
64
|
+
export const ArrayFieldList = ObjectFieldList;
|
|
65
|
+
export const ArrayFieldItem = ObjectFieldItem;
|
|
66
|
+
export const ArrayFieldItemButtons = ObjectFieldItemButtons;
|
|
67
|
+
export const ArrayFieldButton = styled(ObjectFieldButton) ``;
|
|
68
|
+
export const ArrayFieldLineButton = styled(ArrayFieldButton) ``;
|
|
69
|
+
export const ArrayFieldUpButton = styled(ArrayFieldLineButton) ``;
|
|
70
|
+
export const ArrayFieldDownButton = styled(ArrayFieldLineButton) ``;
|
|
71
|
+
export const ArrayFieldRemoveButton = styled(ArrayFieldLineButton) ``;
|
|
72
|
+
export const ArrayFieldAddButton = styled(ArrayFieldButton) ``;
|
|
73
|
+
export function GetArrayFieldButton({ purpose, onClick, uiSchema, }) {
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
75
|
+
const { components: { ArrayFieldAddButton, ArrayFieldRemoveButton, ArrayFieldUpButton, ArrayFieldDownButton, }, } = useContext(FormRegistry);
|
|
78
76
|
switch (purpose) {
|
|
79
77
|
case ArrayFieldButtonPurpose.ADD:
|
|
80
|
-
return (_jsx(ArrayFieldAddButton,
|
|
78
|
+
return (_jsx(ArrayFieldAddButton, Object.assign({}, ((_b = (_a = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _a === void 0 ? void 0 : _a.props) !== null && _b !== void 0 ? _b : {}), { onClick: onClick }, { children: (_d = (_c = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _c === void 0 ? void 0 : _c.content) !== null && _d !== void 0 ? _d : "+" })));
|
|
81
79
|
case ArrayFieldButtonPurpose.REMOVE:
|
|
82
|
-
return (_jsx(ArrayFieldRemoveButton,
|
|
80
|
+
return (_jsx(ArrayFieldRemoveButton, Object.assign({}, ((_f = (_e = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _e === void 0 ? void 0 : _e.props) !== null && _f !== void 0 ? _f : {}), { onClick: onClick }, { children: (_h = (_g = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _g === void 0 ? void 0 : _g.content) !== null && _h !== void 0 ? _h : "-" })));
|
|
83
81
|
case ArrayFieldButtonPurpose.MOVE_UP:
|
|
84
|
-
return (_jsx(ArrayFieldUpButton,
|
|
82
|
+
return (_jsx(ArrayFieldUpButton, Object.assign({}, ((_k = (_j = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _j === void 0 ? void 0 : _j.props) !== null && _k !== void 0 ? _k : {}), { onClick: onClick }, { children: (_m = (_l = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _l === void 0 ? void 0 : _l.content) !== null && _m !== void 0 ? _m : "↑" })));
|
|
85
83
|
case ArrayFieldButtonPurpose.MOVE_DOWN:
|
|
86
|
-
return (_jsx(ArrayFieldDownButton,
|
|
84
|
+
return (_jsx(ArrayFieldDownButton, Object.assign({}, ((_p = (_o = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _o === void 0 ? void 0 : _o.props) !== null && _p !== void 0 ? _p : {}), { onClick: onClick }, { children: (_r = (_q = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _q === void 0 ? void 0 : _q.content) !== null && _r !== void 0 ? _r : "↓" })));
|
|
87
85
|
default:
|
|
88
|
-
return (_jsx(ArrayFieldButton,
|
|
86
|
+
return (_jsx(ArrayFieldButton, Object.assign({}, ((_t = (_s = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _s === void 0 ? void 0 : _s.props) !== null && _t !== void 0 ? _t : {}), { onClick: onClick }, { children: (_v = (_u = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _u === void 0 ? void 0 : _u.content) !== null && _v !== void 0 ? _v : "" })));
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
export var InfoFieldBoxArrowElement = styled.div(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n top: ", ";\n left: ", ";\n bottom: ", ";\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top-color: ", ";\n border-bottom-color: ", ";\n border-right-color: ", ";\n border-left-color: ", ";\n border-width: 5px;\n margin-left: -5px;\n"], ["\n top: ", ";\n left: ", ";\n bottom: ", ";\n border: solid transparent;\n content: \"\";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top-color: ", ";\n border-bottom-color: ", ";\n border-right-color: ", ";\n border-left-color: ", ";\n border-width: 5px;\n margin-left: -5px;\n"])), function (_a) {
|
|
127
|
-
var position = _a.position;
|
|
128
|
-
return position === "top"
|
|
129
|
-
? "100%"
|
|
130
|
-
: position === "right" || position === "left"
|
|
131
|
-
? "40%"
|
|
132
|
-
: "unset";
|
|
133
|
-
}, function (_a) {
|
|
134
|
-
var position = _a.position;
|
|
135
|
-
return position === "top" || position === "bottom"
|
|
89
|
+
export const FieldWrapper = styled.div `
|
|
90
|
+
margin: 0.5rem 0;
|
|
91
|
+
`;
|
|
92
|
+
export const FieldTitle = styled.label `
|
|
93
|
+
font-weight: 700;
|
|
94
|
+
`;
|
|
95
|
+
export const FieldDescription = styled.p `
|
|
96
|
+
margin: 0;
|
|
97
|
+
font-size: 0.9em;
|
|
98
|
+
`;
|
|
99
|
+
export const FieldHelp = styled.p `
|
|
100
|
+
margin: 0;
|
|
101
|
+
font-size: 0.9em;
|
|
102
|
+
`;
|
|
103
|
+
export const InfoFieldBoxElement = styled.div `
|
|
104
|
+
transition: opacity 0.5s;
|
|
105
|
+
position: absolute;
|
|
106
|
+
z-index: 1080;
|
|
107
|
+
opacity: 0;
|
|
108
|
+
visibility: hidden;
|
|
109
|
+
margin: 0;
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
word-wrap: break-word;
|
|
112
|
+
min-width: max-content;
|
|
113
|
+
|
|
114
|
+
top: ${({ position }) => position === "bottom" ? "140%" : position === "top" ? "auto" : "50%"};
|
|
115
|
+
bottom: ${({ position }) => position === "top"
|
|
116
|
+
? "140%"
|
|
117
|
+
: position === "right" || position === "left"
|
|
118
|
+
? "50%"
|
|
119
|
+
: "auto"};
|
|
120
|
+
left: ${({ position }) => position === "right"
|
|
121
|
+
? "100%"
|
|
122
|
+
: position === "bottom" || position === "top"
|
|
136
123
|
? "50%"
|
|
137
|
-
:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
124
|
+
: "auto"};
|
|
125
|
+
right: ${({ position }) => position === "left"
|
|
126
|
+
? "100%"
|
|
127
|
+
: position === "bottom" || position === "top"
|
|
128
|
+
? "50%"
|
|
129
|
+
: "auto"};
|
|
130
|
+
transform: translate(
|
|
131
|
+
${({ position }) => position === "bottom" || position === "top" ? "-50%" : "0"},
|
|
132
|
+
${({ position }) => position === "right" || position === "left" ? "-50%" : "0"}
|
|
133
|
+
);
|
|
134
|
+
`;
|
|
135
|
+
export const InfoFieldBoxArrowElement = styled.div `
|
|
136
|
+
top: ${({ position }) => position === "top"
|
|
137
|
+
? "100%"
|
|
138
|
+
: position === "right" || position === "left"
|
|
139
|
+
? "40%"
|
|
140
|
+
: "unset"};
|
|
141
|
+
left: ${({ position }) => position === "top" || position === "bottom"
|
|
142
|
+
? "50%"
|
|
143
|
+
: position === "right"
|
|
144
|
+
? "-2%"
|
|
145
|
+
: "102.5%"};
|
|
146
|
+
bottom: ${({ position }) => (position === "bottom" ? "100%" : "unset")};
|
|
147
|
+
border: solid transparent;
|
|
148
|
+
content: "";
|
|
149
|
+
height: 0;
|
|
150
|
+
width: 0;
|
|
151
|
+
position: absolute;
|
|
152
|
+
pointer-events: none;
|
|
153
|
+
border-top-color: ${({ position }) => position === "top" ? "grey" : "transparent"};
|
|
154
|
+
border-bottom-color: ${({ position }) => position === "bottom" ? "grey" : "transparent"};
|
|
155
|
+
border-right-color: ${({ position }) => position === "right" ? "grey" : "transparent"};
|
|
156
|
+
border-left-color: ${({ position }) => position === "left" ? "grey" : "transparent"};
|
|
157
|
+
border-width: 5px;
|
|
158
|
+
margin-left: -5px;
|
|
159
|
+
`;
|
|
160
|
+
export const InfoFieldBoxInnerElement = styled.div `
|
|
161
|
+
padding: 0.25rem 0.5rem;
|
|
162
|
+
color: white;
|
|
163
|
+
text-align: center;
|
|
164
|
+
background: grey;
|
|
165
|
+
border: solid 1px grey;
|
|
166
|
+
border-radius: 0.25rem;
|
|
167
|
+
cursor: default;
|
|
168
|
+
`;
|
|
169
|
+
export const InfoFieldContainerElement = styled.a `
|
|
170
|
+
position: relative;
|
|
171
|
+
color: black;
|
|
172
|
+
background: none;
|
|
173
|
+
outline: none;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
border: 1px solid black;
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
line-height: 1em;
|
|
178
|
+
font-size: 0.7em;
|
|
179
|
+
padding: 0 0.44em;
|
|
180
|
+
text-decoration: unset;
|
|
181
|
+
|
|
182
|
+
&:active,
|
|
183
|
+
&:focus {
|
|
184
|
+
color: white;
|
|
185
|
+
background: black;
|
|
186
|
+
${InfoFieldBoxElement} {
|
|
187
|
+
opacity: 1;
|
|
188
|
+
visibility: visible;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
export const InfoFieldLabel = styled.span ``;
|
|
193
|
+
export const InfoFieldButton = ({ label, content, position, props, className, }) => {
|
|
194
|
+
return (_jsxs(InfoFieldContainerElement, Object.assign({ href: "#", onClick: (e) => e.preventDefault(), className: className }, { children: [_jsx(InfoFieldLabel, { children: label !== null && label !== void 0 ? label : "i" }), _jsxs(InfoFieldBoxElement, Object.assign({ position: position !== null && position !== void 0 ? position : "top", role: "tooltip" }, { children: [_jsx(InfoFieldBoxArrowElement, { position: position !== null && position !== void 0 ? position : "top" }), _jsx(InfoFieldBoxInnerElement, { children: content })] }))] })));
|
|
162
195
|
};
|
|
163
196
|
InfoFieldButton.styles = {
|
|
164
197
|
InfoFieldContainerElementStyle: InfoFieldContainerElement,
|
|
@@ -167,14 +200,186 @@ InfoFieldButton.styles = {
|
|
|
167
200
|
InfoFieldBoxArrowElementStyle: InfoFieldBoxArrowElement,
|
|
168
201
|
InfoFieldLabelStyle: InfoFieldLabel,
|
|
169
202
|
};
|
|
170
|
-
|
|
203
|
+
// <--- InfoFieldButton
|
|
204
|
+
export const ErrorMessage = styled(formik.ErrorMessage) ``;
|
|
171
205
|
/*
|
|
172
206
|
* Works like Formik field, but "as" props needs to be given with "formikAs", since styled components uses as.
|
|
173
207
|
*
|
|
174
208
|
*/
|
|
175
|
-
export
|
|
176
|
-
var formikAs = _a
|
|
177
|
-
return _jsx(formik.Field,
|
|
178
|
-
})
|
|
179
|
-
export
|
|
180
|
-
|
|
209
|
+
export const FieldInput = styled((_a) => {
|
|
210
|
+
var { formikAs } = _a, props = __rest(_a, ["formikAs"]);
|
|
211
|
+
return _jsx(formik.Field, Object.assign({}, props, { as: formikAs }));
|
|
212
|
+
}) ``;
|
|
213
|
+
export const RequiredIndicator = styled.span ``;
|
|
214
|
+
// ToggleSwitchField --->
|
|
215
|
+
export const Toggle = styled.span `
|
|
216
|
+
position: absolute;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
top: 0;
|
|
219
|
+
left: 0;
|
|
220
|
+
right: 0;
|
|
221
|
+
bottom: 0;
|
|
222
|
+
background: #ccc;
|
|
223
|
+
-webkit-transition: 0.4s;
|
|
224
|
+
transition: 0.4s;
|
|
225
|
+
border-radius: 34px;
|
|
226
|
+
|
|
227
|
+
&:before {
|
|
228
|
+
position: absolute;
|
|
229
|
+
content: "";
|
|
230
|
+
height: 0.9em;
|
|
231
|
+
width: 0.9em;
|
|
232
|
+
background: white;
|
|
233
|
+
-webkit-transition: 0.4s;
|
|
234
|
+
transition: 0.4s;
|
|
235
|
+
border-radius: 50%;
|
|
236
|
+
top: 0.13em;
|
|
237
|
+
left: 0.13em;
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
export const ToggleLabel = styled.label `
|
|
241
|
+
position: relative;
|
|
242
|
+
display: inline-block;
|
|
243
|
+
width: 2em;
|
|
244
|
+
`;
|
|
245
|
+
export const ToggleFieldInput = styled(FieldInput) `
|
|
246
|
+
opacity: 0;
|
|
247
|
+
width: 0;
|
|
248
|
+
height: 0;
|
|
249
|
+
|
|
250
|
+
&:checked + ${Toggle} {
|
|
251
|
+
background: #2196f3;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
&:focus + ${Toggle} {
|
|
255
|
+
box-shadow: 0 0 1px #2196f3;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&:checked + ${Toggle}:before {
|
|
259
|
+
transform: translateX(0.85em);
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
export const ToggleSwitchField = ({ inputProps, name, className, }) => {
|
|
263
|
+
return (_jsxs(ToggleLabel, Object.assign({ className: className }, { children: [_jsx(ToggleFieldInput, Object.assign({}, inputProps, { name: name, type: "checkbox" })), _jsx(Toggle, {})] })));
|
|
264
|
+
};
|
|
265
|
+
ToggleSwitchField.styles = {
|
|
266
|
+
ToggleLabelStyle: ToggleLabel,
|
|
267
|
+
ToggleFieldInputStyle: ToggleFieldInput,
|
|
268
|
+
ToggleStyle: Toggle,
|
|
269
|
+
};
|
|
270
|
+
// <--- ToggleSwitchField
|
|
271
|
+
// RadioButtonField --->
|
|
272
|
+
export const RadioButtonFieldContainer = styled.div `
|
|
273
|
+
display: flex;
|
|
274
|
+
gap: 1em;
|
|
275
|
+
`;
|
|
276
|
+
export const RadioButtonFieldElement = styled.label `
|
|
277
|
+
display: inline-flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
`;
|
|
280
|
+
export const RadioButtonFieldInput = styled(FieldInput) `
|
|
281
|
+
margin: unset;
|
|
282
|
+
margin-top: 0.15em;
|
|
283
|
+
`;
|
|
284
|
+
export const ButtonLabel = styled.span `
|
|
285
|
+
margin-left: 0.2em;
|
|
286
|
+
`;
|
|
287
|
+
export const ButtonLabelTrue = styled(ButtonLabel) ``;
|
|
288
|
+
export const ButtonLabelFalse = styled(ButtonLabel) ``;
|
|
289
|
+
export const RadioButtonField = ({ label, inputProps, name, className, }) => {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
return (_jsxs(RadioButtonFieldContainer, Object.assign({ className: className }, { children: [_jsxs(RadioButtonFieldElement, { children: [_jsx(RadioButtonFieldInput, Object.assign({}, inputProps, { name: name, type: "radio", value: "true" })), _jsx(ButtonLabelTrue, { children: (_a = label === null || label === void 0 ? void 0 : label.true) !== null && _a !== void 0 ? _a : "true" })] }), _jsxs(RadioButtonFieldElement, { children: [_jsx(RadioButtonFieldInput, Object.assign({}, inputProps, { name: name, type: "radio", value: "false" })), _jsx(ButtonLabelFalse, { children: (_b = label === null || label === void 0 ? void 0 : label.false) !== null && _b !== void 0 ? _b : "false" })] })] })));
|
|
292
|
+
};
|
|
293
|
+
RadioButtonField.styles = {
|
|
294
|
+
RadioButtonFieldContainerStyle: RadioButtonFieldContainer,
|
|
295
|
+
RadioButtonFieldElementStyle: RadioButtonFieldElement,
|
|
296
|
+
RadioButtonFieldInputStyle: RadioButtonFieldInput,
|
|
297
|
+
ButtonLabelStyle: ButtonLabel,
|
|
298
|
+
ButtonLabelTrueStyle: ButtonLabelTrue,
|
|
299
|
+
ButtonLabelFalseStyle: ButtonLabelFalse,
|
|
300
|
+
};
|
|
301
|
+
// ---> SearchableMultiTagSelectField
|
|
302
|
+
export const MultiSelectContainer = styled.div `
|
|
303
|
+
display: flex;
|
|
304
|
+
flex-direction: column;
|
|
305
|
+
`;
|
|
306
|
+
export const MultiSelectInput = styled(FieldInput) ``;
|
|
307
|
+
export const MultiSelectBadgeContainer = styled.div `
|
|
308
|
+
margin: 0.3em 0;
|
|
309
|
+
display: inline-flex;
|
|
310
|
+
gap: 1em;
|
|
311
|
+
`;
|
|
312
|
+
export const MultiSelectBadge = styled.span `
|
|
313
|
+
background: lightgray;
|
|
314
|
+
padding: 0 0.2em 0 0.5em;
|
|
315
|
+
border-radius: 0.1em;
|
|
316
|
+
display: flex;
|
|
317
|
+
`;
|
|
318
|
+
export const MultiSelectBadgeCloseElement = styled.span `
|
|
319
|
+
cursor: pointer;
|
|
320
|
+
margin-left: 0.5em;
|
|
321
|
+
font-size: 0.7em;
|
|
322
|
+
align-self: baseline;
|
|
323
|
+
font-family: sans-serif;
|
|
324
|
+
`;
|
|
325
|
+
export const MultiSelectOptionList = styled.ul `
|
|
326
|
+
padding: unset;
|
|
327
|
+
margin: unset;
|
|
328
|
+
border: 1px solid gray;
|
|
329
|
+
border-radius: 0.2em;
|
|
330
|
+
position: absolute;
|
|
331
|
+
background: white;
|
|
332
|
+
margin: 1.3em 0;
|
|
333
|
+
`;
|
|
334
|
+
export const MultiSelectOptionListItem = styled.li `
|
|
335
|
+
cursor: pointer;
|
|
336
|
+
list-style-type: none;
|
|
337
|
+
padding: 0.06em 0.2em;
|
|
338
|
+
height: 1.2em;
|
|
339
|
+
&:hover {
|
|
340
|
+
background: lightgray;
|
|
341
|
+
}
|
|
342
|
+
`;
|
|
343
|
+
export const MultiSelectOptionListWithoutItem = styled.li `
|
|
344
|
+
cursor: default;
|
|
345
|
+
color: gray;
|
|
346
|
+
list-style-type: none;
|
|
347
|
+
padding: 0.06em 0.2em;
|
|
348
|
+
height: 1.2em;
|
|
349
|
+
`;
|
|
350
|
+
export const SearchableMultiTagSelectField = ({ name, placeholder, enums, emptySearchMessage, closeElement, className, }) => {
|
|
351
|
+
const [search, setSearch] = useState("");
|
|
352
|
+
function searchIncludedInEnum() {
|
|
353
|
+
const hasValue = enums === null || enums === void 0 ? void 0 : enums.values.map((value) => value.title.toLowerCase().includes(search.toLowerCase()));
|
|
354
|
+
return hasValue === null || hasValue === void 0 ? void 0 : hasValue.includes(true);
|
|
355
|
+
}
|
|
356
|
+
return (_jsx(Field, Object.assign({ className: className, name: name, multiple: true }, { children: ({ field, form: { setValues }, meta }) => {
|
|
357
|
+
var _a;
|
|
358
|
+
return (_jsxs(MultiSelectContainer, Object.assign({ className: className }, { children: [_jsx(FieldInput, Object.assign({ type: "hidden" }, field)), _jsx(MultiSelectInput, { className: className, type: "text", onChange: (e) => {
|
|
359
|
+
setSearch(e.currentTarget.value);
|
|
360
|
+
}, placeholder: placeholder, value: search }), _jsx(MultiSelectBadgeContainer, { children: ((_a = field.value) !== null && _a !== void 0 ? _a : []).map((value) => {
|
|
361
|
+
var _a;
|
|
362
|
+
return (_jsxs(MultiSelectBadge, { children: [(_a = enums === null || enums === void 0 ? void 0 : enums.values.find((option) => option.const === value)) === null || _a === void 0 ? void 0 : _a.title, _jsx(MultiSelectBadgeCloseElement, Object.assign({ onClick: () => setValues({
|
|
363
|
+
[name]: field.value.filter((v) => v !== value),
|
|
364
|
+
}) }, { children: closeElement !== null && closeElement !== void 0 ? closeElement : "x" }))] }));
|
|
365
|
+
}) }), search.length > 0 && (_jsx(MultiSelectOptionList, { children: searchIncludedInEnum() ? (enums === null || enums === void 0 ? void 0 : enums.values.filter((item) => { var _a; return !((_a = field.value) !== null && _a !== void 0 ? _a : []).includes(item.const); }).filter((value) => value.title.toLowerCase().includes(search.toLowerCase())).map((option, index) => (_jsx(MultiSelectOptionListItem, Object.assign({ value: option.const, onClick: () => {
|
|
366
|
+
var _a;
|
|
367
|
+
setValues({
|
|
368
|
+
[name]: [
|
|
369
|
+
...new Set([...((_a = field.value) !== null && _a !== void 0 ? _a : []), option.const]),
|
|
370
|
+
],
|
|
371
|
+
});
|
|
372
|
+
setSearch("");
|
|
373
|
+
} }, { children: option.title }), index)))) : (_jsx(MultiSelectOptionListWithoutItem, { children: emptySearchMessage !== null && emptySearchMessage !== void 0 ? emptySearchMessage : "No match found" })) })), meta.touched && meta.error && (_jsx("div", Object.assign({ className: "error" }, { children: meta.error })))] })));
|
|
374
|
+
} })));
|
|
375
|
+
};
|
|
376
|
+
SearchableMultiTagSelectField.styles = {
|
|
377
|
+
MultiSelectContainerStyle: MultiSelectContainer,
|
|
378
|
+
MultiSelectInputStyle: MultiSelectInput,
|
|
379
|
+
MultiSelectBadgeContainerStyle: MultiSelectBadgeContainer,
|
|
380
|
+
MultiSelectBadgeStyle: MultiSelectBadge,
|
|
381
|
+
MultiSelectBadgeCloseElementStyle: MultiSelectBadgeCloseElement,
|
|
382
|
+
MultiSelectOptionListStyle: MultiSelectOptionList,
|
|
383
|
+
MultiSelectOptionListItemStyle: MultiSelectOptionListItem,
|
|
384
|
+
MultiSelectOptionListWithoutItemStyle: MultiSelectOptionListWithoutItem,
|
|
385
|
+
};
|