@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.
@@ -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 {};
@@ -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
- export var Form = styled(formik.Form)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
34
- export var FormButtonWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
35
- export var FormButton = styled.button(templateObject_3 || (templateObject_3 = __makeTemplateObject([""], [""])));
36
- export var ObjectFieldWrapper = styled.fieldset(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""])));
37
- export var ObjectFieldTitle = styled.legend(templateObject_5 || (templateObject_5 = __makeTemplateObject([""], [""])));
38
- export var ObjectFieldList = styled.ul(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n list-style-type: none;\n padding: 0;\n"], ["\n list-style-type: none;\n padding: 0;\n"])));
39
- export var ObjectFieldItem = styled.li(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
40
- export var ObjectFieldItemButtons = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n margin: 0.5rem;\n"], ["\n display: flex;\n margin: 0.5rem;\n"])));
41
- export var ObjectFieldButton = styled.a(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: pointer;\n border: 1px solid black;\n line-height: 1em;\n height: 1em;\n padding: 0 0.3em;\n"], ["\n cursor: pointer;\n border: 1px solid black;\n line-height: 1em;\n height: 1em;\n padding: 0 0.3em;\n"])));
42
- export var ObjectFieldLineButton = styled(ObjectFieldButton)(templateObject_10 || (templateObject_10 = __makeTemplateObject([""], [""])));
43
- export var ObjectFieldUpButton = styled(ObjectFieldLineButton)(templateObject_11 || (templateObject_11 = __makeTemplateObject([""], [""])));
44
- export var ObjectFieldDownButton = styled(ObjectFieldLineButton)(templateObject_12 || (templateObject_12 = __makeTemplateObject([""], [""])));
45
- export var ObjectFieldRemoveButton = styled(ObjectFieldLineButton)(templateObject_13 || (templateObject_13 = __makeTemplateObject([""], [""])));
46
- export var ObjectFieldAddButton = styled(ObjectFieldButton)(templateObject_14 || (templateObject_14 = __makeTemplateObject([""], [""])));
47
- export function getObjectFieldButton(_a) {
48
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
49
- var purpose = _a.purpose, onClick = _a.onClick, uiSchema = _a.uiSchema;
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, __assign({}, ((_c = (_b = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : {}), { onClick: onClick }, { children: (_e = (_d = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _d === void 0 ? void 0 : _d.content) !== null && _e !== void 0 ? _e : "+" })));
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, __assign({}, ((_g = (_f = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _f === void 0 ? void 0 : _f.props) !== null && _g !== void 0 ? _g : {}), { onClick: onClick }, { children: (_j = (_h = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _h === void 0 ? void 0 : _h.content) !== null && _j !== void 0 ? _j : "-" })));
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, __assign({}, ((_l = (_k = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _k === void 0 ? void 0 : _k.props) !== null && _l !== void 0 ? _l : {}), { onClick: onClick }, { children: (_o = (_m = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _m === void 0 ? void 0 : _m.content) !== null && _o !== void 0 ? _o : "↑" })));
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, __assign({}, ((_q = (_p = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _p === void 0 ? void 0 : _p.props) !== null && _q !== void 0 ? _q : {}), { onClick: onClick }, { children: (_s = (_r = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _r === void 0 ? void 0 : _r.content) !== null && _s !== void 0 ? _s : "↓" })));
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, __assign({}, ((_u = (_t = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _t === void 0 ? void 0 : _t.props) !== null && _u !== void 0 ? _u : {}), { onClick: onClick }, { children: (_w = (_v = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _v === void 0 ? void 0 : _v.content) !== null && _w !== void 0 ? _w : "" })));
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 var ArrayFieldWrapper = ObjectFieldWrapper;
64
- export var ArrayFieldTitle = ObjectFieldTitle;
65
- export var ArrayFieldList = ObjectFieldList;
66
- export var ArrayFieldItem = ObjectFieldItem;
67
- export var ArrayFieldItemButtons = ObjectFieldItemButtons;
68
- export var ArrayFieldButton = styled(ObjectFieldButton)(templateObject_15 || (templateObject_15 = __makeTemplateObject([""], [""])));
69
- export var ArrayFieldLineButton = styled(ArrayFieldButton)(templateObject_16 || (templateObject_16 = __makeTemplateObject([""], [""])));
70
- export var ArrayFieldUpButton = styled(ArrayFieldLineButton)(templateObject_17 || (templateObject_17 = __makeTemplateObject([""], [""])));
71
- export var ArrayFieldDownButton = styled(ArrayFieldLineButton)(templateObject_18 || (templateObject_18 = __makeTemplateObject([""], [""])));
72
- export var ArrayFieldRemoveButton = styled(ArrayFieldLineButton)(templateObject_19 || (templateObject_19 = __makeTemplateObject([""], [""])));
73
- export var ArrayFieldAddButton = styled(ArrayFieldButton)(templateObject_20 || (templateObject_20 = __makeTemplateObject([""], [""])));
74
- export function GetArrayFieldButton(_a) {
75
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
76
- var purpose = _a.purpose, onClick = _a.onClick, uiSchema = _a.uiSchema;
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, __assign({}, ((_c = (_b = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : {}), { onClick: onClick }, { children: (_e = (_d = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:addButtonOptions"]) === null || _d === void 0 ? void 0 : _d.content) !== null && _e !== void 0 ? _e : "+" })));
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, __assign({}, ((_g = (_f = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _f === void 0 ? void 0 : _f.props) !== null && _g !== void 0 ? _g : {}), { onClick: onClick }, { children: (_j = (_h = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:removeButtonOptions"]) === null || _h === void 0 ? void 0 : _h.content) !== null && _j !== void 0 ? _j : "-" })));
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, __assign({}, ((_l = (_k = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _k === void 0 ? void 0 : _k.props) !== null && _l !== void 0 ? _l : {}), { onClick: onClick }, { children: (_o = (_m = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:upButtonOptions"]) === null || _m === void 0 ? void 0 : _m.content) !== null && _o !== void 0 ? _o : "↑" })));
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, __assign({}, ((_q = (_p = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _p === void 0 ? void 0 : _p.props) !== null && _q !== void 0 ? _q : {}), { onClick: onClick }, { children: (_s = (_r = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:downButtonOptions"]) === null || _r === void 0 ? void 0 : _r.content) !== null && _s !== void 0 ? _s : "↓" })));
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, __assign({}, ((_u = (_t = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _t === void 0 ? void 0 : _t.props) !== null && _u !== void 0 ? _u : {}), { onClick: onClick }, { children: (_w = (_v = uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["ui:customButtonOptions"]) === null || _v === void 0 ? void 0 : _v.content) !== null && _w !== void 0 ? _w : "" })));
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 var FieldWrapper = styled.div(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n margin: 0.5rem 0;\n"], ["\n margin: 0.5rem 0;\n"])));
92
- export var FieldTitle = styled.label(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n font-weight: 700;\n"], ["\n font-weight: 700;\n"])));
93
- export var FieldDescription = styled.p(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n margin: 0;\n font-size: 0.9em;\n"], ["\n margin: 0;\n font-size: 0.9em;\n"])));
94
- export var FieldHelp = styled.p(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n margin: 0;\n font-size: 0.9em;\n"], ["\n margin: 0;\n font-size: 0.9em;\n"])));
95
- export var InfoFieldBoxElement = styled.div(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n transition: opacity 0.5s;\n position: absolute;\n z-index: 1080;\n opacity: 0;\n visibility: hidden;\n margin: 0;\n font-size: 0.875rem;\n word-wrap: break-word;\n min-width: max-content;\n\n top: ", ";\n bottom: ", ";\n left: ", ";\n right: ", ";\n transform: translate(\n ", ",\n ", "\n );\n"], ["\n transition: opacity 0.5s;\n position: absolute;\n z-index: 1080;\n opacity: 0;\n visibility: hidden;\n margin: 0;\n font-size: 0.875rem;\n word-wrap: break-word;\n min-width: max-content;\n\n top: ", ";\n bottom: ", ";\n left: ", ";\n right: ", ";\n transform: translate(\n ", ",\n ", "\n );\n"])), function (_a) {
96
- var position = _a.position;
97
- return position === "bottom" ? "140%" : position === "top" ? "auto" : "50%";
98
- }, function (_a) {
99
- var position = _a.position;
100
- return position === "top"
101
- ? "140%"
102
- : position === "right" || position === "left"
103
- ? "50%"
104
- : "auto";
105
- }, function (_a) {
106
- var position = _a.position;
107
- return position === "right"
108
- ? "100%"
109
- : position === "bottom" || position === "top"
110
- ? "50%"
111
- : "auto";
112
- }, function (_a) {
113
- var position = _a.position;
114
- return position === "left"
115
- ? "100%"
116
- : position === "bottom" || position === "top"
117
- ? "50%"
118
- : "auto";
119
- }, function (_a) {
120
- var position = _a.position;
121
- return position === "bottom" || position === "top" ? "-50%" : "0";
122
- }, function (_a) {
123
- var position = _a.position;
124
- return position === "right" || position === "left" ? "-50%" : "0";
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
- : position === "right"
138
- ? "-2%"
139
- : "102.5%";
140
- }, function (_a) {
141
- var position = _a.position;
142
- return (position === "bottom" ? "100%" : "unset");
143
- }, function (_a) {
144
- var position = _a.position;
145
- return position === "top" ? "grey" : "transparent";
146
- }, function (_a) {
147
- var position = _a.position;
148
- return position === "bottom" ? "grey" : "transparent";
149
- }, function (_a) {
150
- var position = _a.position;
151
- return position === "right" ? "grey" : "transparent";
152
- }, function (_a) {
153
- var position = _a.position;
154
- return position === "left" ? "grey" : "transparent";
155
- });
156
- export var InfoFieldBoxInnerElement = styled.div(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n padding: 0.25rem 0.5rem;\n color: white;\n text-align: center;\n background: grey;\n border: solid 1px grey;\n border-radius: 0.25rem;\n cursor: default;\n"], ["\n padding: 0.25rem 0.5rem;\n color: white;\n text-align: center;\n background: grey;\n border: solid 1px grey;\n border-radius: 0.25rem;\n cursor: default;\n"])));
157
- export var InfoFieldContainerElement = styled.a(templateObject_28 || (templateObject_28 = __makeTemplateObject(["\n position: relative;\n color: black;\n background: none;\n outline: none;\n cursor: pointer;\n border: 1px solid black;\n border-radius: 50%;\n line-height: 1em;\n font-size: 0.7em;\n padding: 0 0.44em;\n text-decoration: unset;\n\n &:active,\n &:focus {\n color: white;\n background: black;\n ", " {\n opacity: 1;\n visibility: visible;\n }\n }\n"], ["\n position: relative;\n color: black;\n background: none;\n outline: none;\n cursor: pointer;\n border: 1px solid black;\n border-radius: 50%;\n line-height: 1em;\n font-size: 0.7em;\n padding: 0 0.44em;\n text-decoration: unset;\n\n &:active,\n &:focus {\n color: white;\n background: black;\n ", " {\n opacity: 1;\n visibility: visible;\n }\n }\n"])), InfoFieldBoxElement);
158
- export var InfoFieldLabel = styled.span(templateObject_29 || (templateObject_29 = __makeTemplateObject([""], [""])));
159
- export var InfoFieldButton = function (_a) {
160
- var label = _a.label, content = _a.content, position = _a.position, props = _a.props, className = _a.className;
161
- return (_jsxs(InfoFieldContainerElement, __assign({ href: "#", onClick: function (e) { return e.preventDefault(); }, className: className }, { children: [_jsx(InfoFieldLabel, { children: label !== null && label !== void 0 ? label : "i" }), _jsxs(InfoFieldBoxElement, __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 })] }))] })));
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
- export var ErrorMessage = styled(formik.ErrorMessage)(templateObject_30 || (templateObject_30 = __makeTemplateObject([""], [""])));
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 var FieldInput = styled(function (_a) {
176
- var formikAs = _a.formikAs, props = __rest(_a, ["formikAs"]);
177
- return _jsx(formik.Field, __assign({}, props, { as: formikAs }));
178
- })(templateObject_31 || (templateObject_31 = __makeTemplateObject([""], [""])));
179
- export var RequiredIndicator = styled.span(templateObject_32 || (templateObject_32 = __makeTemplateObject([""], [""])));
180
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32;
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
+ };