@nolwenture/formik-jsonschema-form 1.0.0-beta.2 → 1.0.0-beta.21

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.
Files changed (134) hide show
  1. package/README.md +25 -3
  2. package/dist/cjs/Form/components/Clickable.js +0 -7
  3. package/dist/cjs/Form/components/ErrorMessage.js +17 -7
  4. package/dist/cjs/Form/components/FieldInfo.js +26 -22
  5. package/dist/cjs/Form/components/FieldInput.js +38 -23
  6. package/dist/cjs/Form/components/Form.js +25 -15
  7. package/dist/cjs/Form/components/index.js +17 -7
  8. package/dist/cjs/Form/fields/AnyField/index.js +17 -7
  9. package/dist/cjs/Form/fields/ArrayField/ArrayField.js +20 -8
  10. package/dist/cjs/Form/fields/ArrayField/index.js +17 -7
  11. package/dist/cjs/Form/fields/BooleanField/BooleanField.js +1 -1
  12. package/dist/cjs/Form/fields/BooleanField/index.js +17 -7
  13. package/dist/cjs/Form/fields/BooleanField/styledComponents.js +5 -1
  14. package/dist/cjs/Form/fields/DateField/DateField.js +1 -1
  15. package/dist/cjs/Form/fields/DateField/index.js +17 -7
  16. package/dist/cjs/Form/fields/FileUploadField/index.js +17 -7
  17. package/dist/cjs/Form/fields/FileUploadField/styledComponents.js +6 -6
  18. package/dist/cjs/Form/fields/MultipleChoiceField/MultipleChoiceField.js +1 -1
  19. package/dist/cjs/Form/fields/MultipleChoiceField/index.js +17 -7
  20. package/dist/cjs/Form/fields/MultipleChoiceField/styledComponents.js +2 -0
  21. package/dist/cjs/Form/fields/NullField/index.js +17 -7
  22. package/dist/cjs/Form/fields/NumberField/index.js +17 -7
  23. package/dist/cjs/Form/fields/ObjectField/ObjectField.js +32 -13
  24. package/dist/cjs/Form/fields/ObjectField/index.js +17 -7
  25. package/dist/cjs/Form/fields/ObjectField/styledComponents.js +5 -5
  26. package/dist/cjs/Form/fields/RadioField/RadioField.js +1 -1
  27. package/dist/cjs/Form/fields/RadioField/index.js +17 -7
  28. package/dist/cjs/Form/fields/RadioField/styledComponents.js +5 -1
  29. package/dist/cjs/Form/fields/SchemaField/index.js +17 -7
  30. package/dist/cjs/Form/fields/SearchableMultiTagSelectField/index.js +17 -7
  31. package/dist/cjs/Form/fields/SearchableMultiTagSelectField/styledComponents.js +8 -8
  32. package/dist/cjs/Form/fields/SearchableSelectField/index.js +17 -7
  33. package/dist/cjs/Form/fields/SearchableSelectField/styledComponents.js +11 -8
  34. package/dist/cjs/Form/fields/StringField/StringField.js +4 -2
  35. package/dist/cjs/Form/fields/StringField/index.js +17 -7
  36. package/dist/cjs/Form/fields/TextAreaField/TextAreaField.js +1 -1
  37. package/dist/cjs/Form/fields/TextAreaField/index.js +17 -7
  38. package/dist/cjs/Form/fields/TextAreaField/styledComponents.js +5 -4
  39. package/dist/cjs/Form/fields/ToggleField/ToggleField.js +1 -1
  40. package/dist/cjs/Form/fields/ToggleField/index.js +17 -7
  41. package/dist/cjs/Form/fields/ToggleField/styledComponents.js +8 -4
  42. package/dist/cjs/Form/fields/index.js +17 -7
  43. package/dist/cjs/Form/index.js +1 -0
  44. package/dist/cjs/Form/styles/common.js +50 -32
  45. package/dist/cjs/Form/templates/ArrayFieldTemplate/index.js +17 -7
  46. package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +2 -2
  47. package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/index.js +17 -7
  48. package/dist/cjs/Form/templates/FieldTemplate/index.js +17 -7
  49. package/dist/cjs/Form/templates/ObjectFieldTemplate/index.js +17 -7
  50. package/dist/cjs/Form/templates/ObjectFieldTemplate/styledComponents.js +2 -2
  51. package/dist/cjs/Form/templates/index.js +17 -7
  52. package/dist/cjs/FormView/FormView.js +11 -4
  53. package/dist/cjs/FormView/components/Field.js +115 -9
  54. package/dist/cjs/FormView/components/index.js +17 -9
  55. package/dist/cjs/FormView/fields/ObjectField/ObjectField.js +1 -1
  56. package/dist/cjs/FormView/fields/ObjectField/index.js +17 -7
  57. package/dist/cjs/FormView/fields/index.js +17 -7
  58. package/dist/cjs/FormView/index.js +12 -2
  59. package/dist/cjs/FormView/templates/ArrayFieldTemplate/index.js +17 -7
  60. package/dist/cjs/FormView/templates/CollapsibleObjectFieldTemplate/index.js +17 -7
  61. package/dist/cjs/FormView/templates/FieldTemplate/index.js +17 -7
  62. package/dist/cjs/FormView/templates/ObjectFieldTemplate/index.js +17 -7
  63. package/dist/cjs/FormView/templates/ObjectFieldTemplate/styledComponents.js +8 -1
  64. package/dist/cjs/FormView/templates/index.js +17 -7
  65. package/dist/cjs/FormView/types/index.js +2 -0
  66. package/dist/cjs/index.js +1 -14
  67. package/dist/cjs/styles/types.js +2 -0
  68. package/dist/cjs/utils/createValidationSchema.js +17 -7
  69. package/dist/cjs/utils/getTitleAndDescription.js +6 -5
  70. package/dist/cjs/utils/index.js +1 -0
  71. package/dist/cjs/utils/orderAdditionalProperties.js +46 -0
  72. package/dist/esm/Form/components/Clickable.js +0 -7
  73. package/dist/esm/Form/components/FieldInfo.js +26 -22
  74. package/dist/esm/Form/components/FieldInput.js +20 -15
  75. package/dist/esm/Form/components/Form.js +8 -8
  76. package/dist/esm/Form/fields/ArrayField/ArrayField.js +20 -8
  77. package/dist/esm/Form/fields/BooleanField/BooleanField.js +1 -1
  78. package/dist/esm/Form/fields/BooleanField/styledComponents.js +5 -1
  79. package/dist/esm/Form/fields/DateField/DateField.js +1 -1
  80. package/dist/esm/Form/fields/FileUploadField/styledComponents.js +6 -6
  81. package/dist/esm/Form/fields/MultipleChoiceField/MultipleChoiceField.js +1 -1
  82. package/dist/esm/Form/fields/MultipleChoiceField/styledComponents.js +2 -0
  83. package/dist/esm/Form/fields/ObjectField/ObjectField.js +33 -14
  84. package/dist/esm/Form/fields/ObjectField/styledComponents.js +5 -5
  85. package/dist/esm/Form/fields/RadioField/RadioField.js +1 -1
  86. package/dist/esm/Form/fields/RadioField/styledComponents.js +5 -1
  87. package/dist/esm/Form/fields/SearchableMultiTagSelectField/styledComponents.js +8 -8
  88. package/dist/esm/Form/fields/SearchableSelectField/styledComponents.js +11 -8
  89. package/dist/esm/Form/fields/StringField/StringField.js +4 -2
  90. package/dist/esm/Form/fields/TextAreaField/TextAreaField.js +1 -1
  91. package/dist/esm/Form/fields/TextAreaField/styledComponents.js +5 -4
  92. package/dist/esm/Form/fields/ToggleField/ToggleField.js +1 -1
  93. package/dist/esm/Form/fields/ToggleField/styledComponents.js +8 -4
  94. package/dist/esm/Form/index.js +1 -0
  95. package/dist/esm/Form/styles/common.js +50 -32
  96. package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +2 -2
  97. package/dist/esm/Form/templates/ObjectFieldTemplate/styledComponents.js +2 -2
  98. package/dist/esm/FormView/FormView.js +7 -3
  99. package/dist/esm/FormView/components/Field.js +108 -7
  100. package/dist/esm/FormView/components/index.js +0 -2
  101. package/dist/esm/FormView/fields/ObjectField/ObjectField.js +1 -1
  102. package/dist/esm/FormView/index.js +9 -2
  103. package/dist/esm/FormView/templates/ObjectFieldTemplate/styledComponents.js +8 -1
  104. package/dist/esm/FormView/types/index.js +1 -0
  105. package/dist/esm/index.js +1 -1
  106. package/dist/esm/styles/types.js +1 -0
  107. package/dist/esm/utils/getTitleAndDescription.js +6 -5
  108. package/dist/esm/utils/index.js +1 -0
  109. package/dist/esm/utils/orderAdditionalProperties.js +43 -0
  110. package/dist/types/Form/components/FieldInput.d.ts +5 -0
  111. package/dist/types/Form/components/index.d.ts +5 -0
  112. package/dist/types/Form/index.d.ts +1 -0
  113. package/dist/types/Form/templates/ArrayFieldTemplate/types.d.ts +0 -4
  114. package/dist/types/Form/templates/FieldTemplate/types.d.ts +0 -4
  115. package/dist/types/FormView/FormView.d.ts +3 -3
  116. package/dist/types/FormView/components/Field.d.ts +36 -3
  117. package/dist/types/FormView/components/index.d.ts +15 -14
  118. package/dist/types/FormView/index.d.ts +10 -2
  119. package/dist/types/FormView/templates/ArrayFieldTemplate/types.d.ts +0 -4
  120. package/dist/types/FormView/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.d.ts +1 -1
  121. package/dist/types/FormView/templates/FieldTemplate/types.d.ts +0 -4
  122. package/dist/types/FormView/templates/index.d.ts +1 -1
  123. package/dist/types/FormView/types/index.d.ts +1 -0
  124. package/dist/types/common/types/Field.d.ts +0 -3
  125. package/dist/types/common/types/Schemas.d.ts +11 -8
  126. package/dist/types/index.d.ts +1 -1
  127. package/dist/types/styles/types.d.ts +216 -0
  128. package/dist/types/utils/getTitleAndDescription.d.ts +1 -1
  129. package/dist/types/utils/index.d.ts +1 -0
  130. package/dist/types/utils/orderAdditionalProperties.d.ts +1 -0
  131. package/package.json +23 -14
  132. package/dist/cjs/FormView/components/old_styledComponents.js +0 -65
  133. package/dist/esm/FormView/components/old_styledComponents.js +0 -57
  134. package/dist/types/FormView/components/old_styledComponents.d.ts +0 -32
@@ -2,16 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { styled } from "styled-components";
3
3
  import { readableColor } from "polished";
4
4
  export const FieldInfoBoxElement = styled.div `
5
- transition: opacity 0.5s;
6
- position: absolute;
7
- z-index: 1080;
8
- opacity: 0;
9
- visibility: hidden;
10
- margin: 0;
11
5
  font-family: ${(props) => props.theme.typography.fontFamily.base};
12
6
  font-size: ${(props) => props.theme.typography.size.small};
13
- word-wrap: break-word;
7
+ margin: 0;
14
8
  min-width: max-content;
9
+ opacity: 0;
10
+ position: absolute;
11
+ transition: opacity 0.5s;
12
+ visibility: hidden;
13
+ word-wrap: break-word;
14
+ z-index: 1080;
15
15
 
16
16
  top: ${({ position }) => position === "bottom" ? "140%" : position === "top" ? "auto" : "50%"};
17
17
  bottom: ${({ position }) => position === "top"
@@ -52,30 +52,34 @@ export const FieldInfoBoxArrowElement = styled.div `
52
52
  width: 0;
53
53
  position: absolute;
54
54
  pointer-events: none;
55
- border-top-color: ${({ position, theme }) => position === "top" ? theme.intent.none : "transparent"};
56
- border-bottom-color: ${({ position, theme }) => position === "bottom" ? theme.intent.none : "transparent"};
57
- border-right-color: ${({ position, theme }) => position === "right" ? theme.intent.none : "transparent"};
58
- border-left-color: ${({ position, theme }) => position === "left" ? theme.intent.none : "transparent"};
55
+ border-top-color: ${({ position, theme }) => position === "top" ? theme.color.intent.default.none : "transparent"};
56
+ border-bottom-color: ${({ position, theme }) => position === "bottom" ? theme.color.intent.default.none : "transparent"};
57
+ border-right-color: ${({ position, theme }) => position === "right" ? theme.color.intent.default.none : "transparent"};
58
+ border-left-color: ${({ position, theme }) => position === "left" ? theme.color.intent.default.none : "transparent"};
59
59
  border-width: 5px;
60
60
  margin-left: -5px;
61
61
  `;
62
62
  export const FieldInfoBoxInnerElement = styled.div `
63
- background: ${(props) => props.theme.intent.none};
64
- border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.intent.none}`};
65
- border-radius: ${(props) => props.theme.borderRadius.none};
66
- color: ${(props) => readableColor(props.theme.text.default)};
67
- cursor: default;
68
- padding: ${(props) => `${props.theme.spacing.xs} ${props.theme.spacing.s}`};
69
- text-align: center;
63
+ background: ${(props) => props.theme.color.background.default};
64
+ border-radius: ${(props) => props.theme.borderRadius.none};
65
+ border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.intent.default.none}`};
66
+ color: ${(props) => props.theme.color.text.default};
67
+ cursor: default;
68
+ font-size: ${(props) => props.theme.typography.size.small};
69
+ line-height: ${(props) => props.theme.typography.lineHeight.small};
70
+ max-width: 30ch;
71
+ padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
72
+ text-align: left;
73
+ white-space: pre-wrap;
70
74
  `;
71
75
  export const FieldInfoContainer = styled.a `
72
76
  position: relative;
73
- color: ${(props) => props.theme.text.default};
77
+ color: ${(props) => props.theme.color.text.default};
74
78
  background: none;
75
79
  outline: none;
76
80
  cursor: pointer;
77
81
  border: ${(props) => `${props.theme.strokeWidth.thin} solid
78
- ${props.theme.border.default}`};
82
+ ${props.theme.color.border.default}`};
79
83
  border-radius: ${(props) => props.theme.borderRadius.circle};
80
84
  line-height: 1em;
81
85
  font-family: ${(props) => props.theme.typography.fontFamily.base};
@@ -86,8 +90,8 @@ export const FieldInfoContainer = styled.a `
86
90
 
87
91
  &:active,
88
92
  &:focus {
89
- color: ${(props) => readableColor(props.theme.text.default)};
90
- background: ${(props) => props.theme.text.default};
93
+ color: ${(props) => readableColor(props.theme.color.text.default)};
94
+ background: ${(props) => props.theme.color.text.default};
91
95
  ${FieldInfoBoxElement} {
92
96
  opacity: 1;
93
97
  visibility: visible;
@@ -2,27 +2,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { styled } from "styled-components";
3
3
  import * as formik from "formik";
4
4
  export const FieldWrapper = styled.div `
5
- margin: ${(props) => `${props.theme.spacing.s} 0`};
6
- color: ${(props) => props.theme.text.default};
5
+ margin: ${(props) => `${props.theme.spacing.s} 0`};
6
+ color: ${(props) => props.theme.color.text.default};
7
7
  `;
8
8
  export const FieldTitle = styled.label `
9
- font-size: ${(props) => props.theme.typography.size.base};
10
- font-family: ${(props) => props.theme.typography.fontFamily.base};
11
- font-weight: ${(props) => props.theme.typography.weight.medium};
12
- margin-right: ${(props) => props.theme.spacing.s};
13
- color: ${(props) => props.theme.text.default};
9
+ font-size: ${(props) => props.theme.typography.size.base};
10
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
11
+ font-weight: ${(props) => props.theme.typography.weight.medium};
12
+ margin-right: ${(props) => props.theme.spacing.s};
13
+ color: ${(props) => props.theme.color.text.default};
14
14
  `;
15
15
  export const FieldDescription = styled.p `
16
- color: ${(props) => props.theme.text.default};
17
- margin: 0;
18
- font-family: ${(props) => props.theme.typography.fontFamily.base};
19
- font-size: ${(props) => props.theme.typography.size.base};
16
+ color: ${(props) => props.theme.color.text.default};
17
+ margin: 0;
18
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
19
+ font-size: ${(props) => props.theme.typography.size.base};
20
20
  `;
21
21
  export const FieldHelp = styled.p `
22
- color: ${(props) => props.theme.text.default};
23
- margin: 0;
24
- font-family: ${(props) => props.theme.typography.fontFamily.base};
25
- font-size: ${(props) => props.theme.typography.size.small};
22
+ color: ${(props) => props.theme.color.text.default};
23
+ margin: 0;
24
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
25
+ font-size: ${(props) => props.theme.typography.size.small};
26
26
  `;
27
27
  /*
28
28
  * Works like Formik field, but "as" props needs to be given with "formikAs", since styled components uses as.
@@ -31,3 +31,8 @@ export const FieldHelp = styled.p `
31
31
  export const FieldInput = styled(({ formikAs, ...props }) => {
32
32
  return _jsx(formik.Field, { ...props, as: formikAs });
33
33
  }) ``;
34
+ export const SelectFieldInput = styled(FieldInput) `
35
+ &[readonly] {
36
+ pointer-events: none;
37
+ }
38
+ `;
@@ -2,22 +2,22 @@ import styled from "styled-components";
2
2
  import * as formik from "formik";
3
3
  import { commonCheckboxStyles, commonRadioStyles, commonButtonStyles, commonInputStyles, commonSelectStyles, } from "../styles/common";
4
4
  export const Form = styled(formik.Form) `
5
- ${commonCheckboxStyles}
5
+ ${commonCheckboxStyles}
6
6
 
7
- ${commonRadioStyles}
7
+ ${commonRadioStyles}
8
8
 
9
- color: ${(props) => props.theme.text.default};
10
- font-family: ${(props) => props.theme.typography.fontFamily.base};
9
+ color: ${(props) => props.theme.color.text.default};
10
+ font-family: ${(props) => props.theme.typography.fontFamily.base};
11
11
 
12
- ${commonButtonStyles}
12
+ ${commonButtonStyles}
13
13
 
14
- ${commonInputStyles}
14
+ ${commonInputStyles}
15
15
 
16
16
  ${commonSelectStyles}
17
17
 
18
18
  :focus {
19
- ${(props) => props.theme.focus.default};
20
- }
19
+ ${(props) => props.theme.focus.default};
20
+ }
21
21
  `;
22
22
  export const FormButtonWrapper = styled.div ``;
23
23
  export const FormButton = styled.button `
@@ -29,7 +29,7 @@ const moveInArray = (values, index, direction) => {
29
29
  }
30
30
  };
31
31
  export const ArrayField = (props) => {
32
- const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: { FieldInput, ArrayFieldItem, ArrayFieldItemButtons, ArrayFieldList, ArrayFieldAddButton, ArrayFieldRemoveButton, ArrayFieldUpButton, ArrayFieldDownButton, }, useItemsAsAdditionalItems, } = useContext(FormRegistry);
32
+ const { fields: { SchemaField }, templates: { ArrayFieldTemplate, FieldTemplate }, components: { SelectFieldInput, ArrayFieldItem, ArrayFieldItemButtons, ArrayFieldList, ArrayFieldAddButton, ArrayFieldRemoveButton, ArrayFieldUpButton, ArrayFieldDownButton, }, useItemsAsAdditionalItems, } = useContext(FormRegistry);
33
33
  useSetDefault(props);
34
34
  const { name, schema, uiSchema } = props;
35
35
  const { type, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
@@ -95,15 +95,27 @@ export const ArrayField = (props) => {
95
95
  // Backwards compatibility ends
96
96
  const { disabled } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
97
97
  const valueArray = Array.isArray(value) ? value : undefined;
98
- return schema.anyOf !== undefined ? (_jsx(FieldTemplate, { ...props, "data-fjsf-array": name, children: _jsx(FieldInput, { type,
99
- ...inputProps, name: name, formikAs: "select", multiple: enums?.type === EnumsTypes.MULTI_SELECT, children: enums?.values.map((option, index) => (_jsx("option", { value: option.const, children: option.title }, index))) }) })) : (_jsxs(ArrayFieldTemplate, { ...props, "data-fjsf-array": name, children: [_jsxs(ArrayFieldList, { children: [(items || []).map((itemSchema, index) => (_jsx(ArrayFieldItem, { children: _jsx(SchemaField, { name: `${name}[${index}]`, schema: typeof itemSchema !== "boolean" ? itemSchema : {}, uiSchema: uiSchema?.[index] || uiSchema?.items,
98
+ const preventManipulation = disabled || schema.readOnly;
99
+ return schema.anyOf !== undefined ? (_jsx(FieldTemplate, { ...props, "data-fjsf-array": name, children: _jsx(SelectFieldInput, { type,
100
+ readOnly: schema.readOnly,
101
+ ...inputProps, name: name, formikAs: "select", multiple: enums?.type === EnumsTypes.MULTI_SELECT, children: enums?.values.map((option, index) => (_jsx("option", { value: option.const, children: option.title }, index))) }) })) : (_jsxs(ArrayFieldTemplate, { ...props, "data-fjsf-array": name, children: [_jsxs(ArrayFieldList, { children: [(items || []).map((itemSchema, index) => (_jsx(ArrayFieldItem, { children: _jsx(SchemaField, { name: `${name}[${index}]`, schema: prepareChildSchema(itemSchema, schema), uiSchema: {
102
+ disabled,
103
+ ...(uiSchema?.[index] || uiSchema?.items),
104
+ },
100
105
  // "true" will prevent validation for required array fields
101
106
  // since a value always exists in the array
102
- forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => (_jsxs(ArrayFieldItem, { children: [_jsx(SchemaField, { name: `${name}[${index + items.length}]`, schema: additionalItems && typeof additionalItems !== "boolean"
103
- ? additionalItems
104
- : {}, uiSchema: {
107
+ forceDefaultValue: false }) }, index))), (valueArray?.slice(items.length) || []).map((_, index) => (_jsxs(ArrayFieldItem, { children: [_jsx(SchemaField, { name: `${name}[${index + items.length}]`, schema: prepareChildSchema(additionalItems, schema), uiSchema: {
105
108
  disabled,
106
109
  ...(uiSchema?.[index + items.length] || uiSchema?.items),
107
- } }), _jsxs(ArrayFieldItemButtons, { children: [_jsx(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && (_jsx(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
108
- index < value?.slice(items.length).length - 1 && (_jsx(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] })] }, index)))] }), additionalItems && (_jsx(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
110
+ } }), !preventManipulation && (_jsxs(ArrayFieldItemButtons, { children: [_jsx(ArrayFieldRemoveButton, { ...(uiSchema?.["ui:removeButtonOptions"]?.props ?? {}), onClick: () => setValue(removeFromArray(value, index + items.length)), children: uiSchema?.["ui:removeButtonOptions"]?.content ?? "-" }), value.length > 1 && index > 0 && (_jsx(ArrayFieldUpButton, { ...(uiSchema?.["ui:upButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, -1)), children: uiSchema?.["ui:upButtonOptions"]?.content ?? "↑" })), value.length > 1 &&
111
+ index < value?.slice(items.length).length - 1 && (_jsx(ArrayFieldDownButton, { ...(uiSchema?.["ui:downButtonOptions"]?.props ?? {}), onClick: () => setValue(moveInArray(value, index + items.length, 1)), children: uiSchema?.["ui:downButtonOptions"]?.content ?? "↓" }))] }))] }, index)))] }), additionalItems && !preventManipulation && (_jsx(ArrayFieldAddButton, { ...(uiSchema?.["ui:addButtonOptions"]?.props ?? {}), onClick: () => setValue(appendArray(value)), children: uiSchema?.["ui:addButtonOptions"]?.content ?? "+" }))] }));
109
112
  };
113
+ function prepareChildSchema(childSchema, parentSchema) {
114
+ if (!childSchema || typeof childSchema === "boolean") {
115
+ return {};
116
+ }
117
+ if (parentSchema.readOnly) {
118
+ return { ...childSchema, readOnly: parentSchema.readOnly };
119
+ }
120
+ return childSchema;
121
+ }
@@ -10,7 +10,7 @@ export const BooleanField = (props) => {
10
10
  const { name, uiSchema } = props;
11
11
  const { label, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
12
12
  const { values, setValues } = useFormikContext();
13
- return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsxs(BooleanFieldWrapper, { children: [_jsx(FieldInput, { ...inputProps, name: name, type: "checkbox" }), _jsx("span", { onClick: () => {
13
+ return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsxs(BooleanFieldWrapper, { children: [_jsx(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "checkbox" }), _jsx("span", { onClick: () => {
14
14
  setValues({
15
15
  ...values,
16
16
  [name]: !values?.[name],
@@ -2,11 +2,15 @@ import { styled } from "styled-components";
2
2
  import { commonCheckboxStyles } from "../../styles/common";
3
3
  export const BooleanFieldWrapper = styled.div `
4
4
  align-items: center;
5
- color: ${(props) => props.theme.text.default};
5
+ color: ${(props) => props.theme.color.text.default};
6
6
  cursor: pointer;
7
7
  display: flex;
8
8
  font-family: ${(props) => props.theme.typography.fontFamily.base};
9
9
  gap: ${(props) => props.theme.spacing.s};
10
10
 
11
11
  ${commonCheckboxStyles}
12
+
13
+ & > input[readonly], & > input[readonly] ~ span {
14
+ pointer-events: none;
15
+ }
12
16
  `;
@@ -9,5 +9,5 @@ export const DateField = (props) => {
9
9
  useSetDefault(props);
10
10
  const { name, uiSchema } = props;
11
11
  const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
12
- return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(FieldInput, { ...inputProps, name: name, type: "date" }) }) }));
12
+ return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(DateFieldWrapper, { children: _jsx(FieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, type: "date" }) }) }));
13
13
  };
@@ -1,8 +1,8 @@
1
1
  import styled from "styled-components";
2
2
  import { readableColor } from "polished";
3
3
  export const FileUploadFieldFileUploadButton = styled.button `
4
- background-color: ${(props) => props.theme.intent.none};
5
- color: ${(props) => readableColor(props.theme.intent.none)};
4
+ background-color: ${(props) => props.theme.color.intent.default.none};
5
+ color: ${(props) => readableColor(props.theme.color.intent.default.none)};
6
6
  padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.xl}`};
7
7
  border: none;
8
8
  border-radius: ${(props) => props.theme.borderRadius.none};
@@ -17,14 +17,14 @@ export const FileUploadFieldProgressBarContainer = styled.div `
17
17
  width: 7.5rem;
18
18
  height: ${(props) => props.theme.spacing.xl};
19
19
  border-radius: ${(props) => props.theme.strokeWidth.thick};
20
- background-color: ${(props) => props.theme.background.input};
20
+ background-color: ${(props) => props.theme.color.background.input};
21
21
  position: relative;
22
22
  margin-left: ${(props) => props.theme.spacing.s};
23
23
  `;
24
24
  export const FileUploadFieldProgressBar = styled.div `
25
25
  width: ${(props) => props.$progress}%;
26
26
  height: 100%;
27
- background-color: ${(props) => props.theme.neutral[500]};
27
+ background-color: ${(props) => props.theme.color.palette.neutral[500]};
28
28
  border-radius: ${(props) => props.theme.strokeWidth.thick};
29
29
  transition: width 0.2s ease;
30
30
  `;
@@ -33,7 +33,7 @@ export const FileUploadFieldProgressText = styled.span `
33
33
  top: 50%;
34
34
  left: 50%;
35
35
  transform: translate(-50%, -50%);
36
- color: ${(props) => props.theme.neutral[200]};
36
+ color: ${(props) => props.theme.color.palette.neutral[200]};
37
37
  font-family: ${(props) => props.theme.typography.fontFamily.base};
38
38
  font-weight: ${(props) => props.theme.typography.weight.bold};
39
39
  `;
@@ -52,6 +52,6 @@ export const FileUploadFieldFileInfoText = styled.span `
52
52
  margin-left: ${(props) => props.theme.spacing.s};
53
53
  font-family: ${(props) => props.theme.typography.fontFamily.base};
54
54
  font-size: ${(props) => props.theme.typography.size.base};
55
- color: ${(props) => props.theme.text.default};
55
+ color: ${(props) => props.theme.color.text.default};
56
56
  `;
57
57
  export const FileUploadFieldContainer = styled.div ``;
@@ -24,5 +24,5 @@ export const MultipleChoiceField = (props) => {
24
24
  return { "data-fjsf-string": name };
25
25
  }
26
26
  })();
27
- return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(MultipleChoiceFieldInput, { inputProps: inputProps, name: name, enums: enums, style: style, value: value, form: form }) }));
27
+ return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(MultipleChoiceFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name, enums: enums, style: style, value: value, form: form }) }));
28
28
  };
@@ -5,6 +5,8 @@ export const MultipleChoiceFieldContainer = styled(RadioFieldContainer) `
5
5
  ${commonCheckboxStyles}
6
6
  ${commonRadioStyles}
7
7
  font-family: ${(props) => props.theme.typography.fontFamily.base};
8
+ flex-wrap: wrap;
9
+ justify-content: start;
8
10
  `;
9
11
  export const MultipleChoiceFieldElement = styled(RadioFieldElement) ``;
10
12
  export const MultipleChoiceFieldInputElement = styled(RadioFieldInputElement) ``;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useField, useFormikContext } from "formik";
3
3
  import { useContext, useEffect, useMemo } from "react";
4
- import { orderByUiSchema, resolveSchema } from "../../../utils";
4
+ import { orderAdditionalProperties, orderByUiSchema, resolveSchema, } from "../../../utils";
5
5
  import { useSetDefault } from "../../hooks";
6
6
  import { FormRegistry } from "../../FormRegistry";
7
7
  import { ObjectFieldButtonPurpose } from "./types";
@@ -32,10 +32,12 @@ export const ObjectField = (props) => {
32
32
  }, [valuesToRemove]);
33
33
  const propertyKeys = useMemo(() => Object.keys(properties || {}), [properties]);
34
34
  const additionalValues = useMemo(() => Object.fromEntries(Object.entries(value || {}).filter(([key, value]) => !propertyKeys.includes(key))), [value, propertyKeys]);
35
- const FieldTemplateComponent = props.uiSchema?.props?.isCollapsible
35
+ const FieldTemplateComponent = props.uiSchema?.["ui:options"]?.isCollapsible
36
36
  ? CollapsibleObjectFieldTemplate
37
37
  : ObjectFieldTemplate;
38
38
  const orderedProperties = orderByUiSchema(uiSchema?.["ui:order"], Object.keys(properties || {}));
39
+ const orderedAddProperties = orderByUiSchema(uiSchema?.["ui:order"], Object.keys(additionalValues || {}));
40
+ const additionalPropertiesInOrder = orderAdditionalProperties(orderedAddProperties, Object.keys(additionalValues || {}));
39
41
  const getObjectFieldButton = ({ purpose, onClick, uiSchema, }) => {
40
42
  switch (purpose) {
41
43
  case ObjectFieldButtonPurpose.ADD:
@@ -56,7 +58,7 @@ export const ObjectField = (props) => {
56
58
  const childSchema = properties?.[child];
57
59
  if (!childSchema)
58
60
  return undefined;
59
- return (_jsx(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema: typeof childSchema !== "boolean" ? childSchema : {}, uiSchema: uiSchema?.[child] }, child));
61
+ return (_jsx(SchemaField, { required: required?.includes(child), name: name ? [name, child].join(".") : child, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child] }, child));
60
62
  }
61
63
  else {
62
64
  const { title, fields, collapsible } = child;
@@ -64,21 +66,29 @@ export const ObjectField = (props) => {
64
66
  const childSchema = properties?.[child2];
65
67
  if (!childSchema)
66
68
  return undefined;
67
- return (_jsx(SchemaField, { name: name ? [name, child2].join(".") : child2, schema: typeof childSchema !== "boolean" ? childSchema : {}, uiSchema: uiSchema?.[child2] }, child2));
69
+ return (_jsx(SchemaField, { name: name ? [name, child2].join(".") : child2, schema: prepareChildSchema(childSchema, schema), uiSchema: uiSchema?.[child2] }, child2));
68
70
  }) }, fields.join("_")));
69
71
  }
70
72
  })
71
73
  .filter((x) => x), (!hideUnmarkedAdditionalProperties || additionalProperties) &&
72
- Object.entries(additionalValues || {}).map(([childName]) => (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: typeof schema.additionalProperties !== "boolean"
73
- ? schema.additionalProperties
74
- : {}, uiSchema: uiSchema?.[childName] }, childName), _jsx(ObjectFieldItemButtons, { children: getObjectFieldButton({
75
- purpose: ObjectFieldButtonPurpose.REMOVE,
76
- onClick: () => {
77
- const { [childName]: _removedProperty, ...newValue } = value;
78
- setValue(newValue);
79
- },
80
- uiSchema: uiSchema,
81
- }) })] }, childName))), additionalProperties &&
74
+ additionalPropertiesInOrder.map((childName) => {
75
+ let correctUiSchema = uiSchema?.[childName];
76
+ if (uiSchema.properties?.["ui:order"] !== undefined &&
77
+ uiSchema?.[childName]?.["ui:order"] === undefined) {
78
+ correctUiSchema = {
79
+ ...correctUiSchema,
80
+ "ui:order": uiSchema.properties?.["ui:order"],
81
+ };
82
+ }
83
+ return (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required?.includes(childName), name: name ? [name, childName].join(".") : childName, schema: prepareChildSchema(schema.additionalProperties, schema), uiSchema: correctUiSchema }, childName), _jsx(ObjectFieldItemButtons, { children: getObjectFieldButton({
84
+ purpose: ObjectFieldButtonPurpose.REMOVE,
85
+ onClick: () => {
86
+ const { [childName]: _removedProperty, ...newValue } = value;
87
+ setValue(newValue);
88
+ },
89
+ uiSchema: uiSchema,
90
+ }) })] }, childName));
91
+ }), additionalProperties &&
82
92
  getObjectFieldButton({
83
93
  purpose: ObjectFieldButtonPurpose.ADD,
84
94
  onClick: () => {
@@ -90,3 +100,12 @@ export const ObjectField = (props) => {
90
100
  uiSchema: uiSchema,
91
101
  })] }));
92
102
  };
103
+ function prepareChildSchema(childSchema, parentSchema) {
104
+ if (!childSchema || typeof childSchema === "boolean") {
105
+ return {};
106
+ }
107
+ if (parentSchema.readOnly) {
108
+ return { ...childSchema, readOnly: parentSchema.readOnly };
109
+ }
110
+ return childSchema;
111
+ }
@@ -1,11 +1,11 @@
1
1
  import { styled } from "styled-components";
2
2
  export const ObjectFieldList = styled.ul `
3
- color: ${(props) => props.theme.text.default};
3
+ color: ${(props) => props.theme.color.text.default};
4
4
  list-style-type: none;
5
5
  padding: 0;
6
6
  `;
7
7
  export const ObjectFieldItem = styled.li `
8
- color: ${(props) => props.theme.text.default};
8
+ color: ${(props) => props.theme.color.text.default};
9
9
  display: flex;
10
10
  `;
11
11
  export const ObjectFieldItemButtons = styled.div `
@@ -13,9 +13,9 @@ export const ObjectFieldItemButtons = styled.div `
13
13
  margin: ${(props) => props.theme.spacing.s};
14
14
  `;
15
15
  export const ObjectFieldButton = styled.a `
16
- background-color: ${(props) => props.theme.intent.none};
17
- border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.border.default}`};
18
- color: ${(props) => props.theme.neutral[900]};
16
+ background-color: ${(props) => props.theme.color.intent.default.none};
17
+ border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.border.default}`};
18
+ color: ${(props) => props.theme.color.palette.neutral[900]};
19
19
  cursor: pointer;
20
20
  display: inline-block;
21
21
  font-weight: ${(props) => props.theme.typography.weight.bold};
@@ -8,5 +8,5 @@ export const RadioField = (props) => {
8
8
  useSetDefault(props);
9
9
  const { name, uiSchema } = props;
10
10
  const { label, props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
11
- return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(RadioFieldInput, { inputProps: inputProps, label: label, name: name }) }));
11
+ return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(RadioFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, label: label, name: name }) }));
12
12
  };
@@ -2,7 +2,7 @@ import { styled } from "styled-components";
2
2
  import { FieldInput } from "../../components/FieldInput";
3
3
  import { commonRadioStyles } from "../../styles/common";
4
4
  export const RadioFieldContainer = styled.div `
5
- color: ${(props) => props.theme.text.default};
5
+ color: ${(props) => props.theme.color.text.default};
6
6
  display: flex;
7
7
  font-family: ${(props) => props.theme.typography.fontFamily.base};
8
8
  gap: ${(props) => props.theme.spacing.l};
@@ -11,6 +11,10 @@ export const RadioFieldContainer = styled.div `
11
11
  export const RadioFieldElement = styled.label `
12
12
  display: inline-flex;
13
13
  align-items: center;
14
+
15
+ &:has(input[readonly]) {
16
+ pointer-events: none;
17
+ }
14
18
  `;
15
19
  export const RadioFieldInputElement = styled(FieldInput) `
16
20
  margin: unset;
@@ -22,8 +22,8 @@ export const SearchableMultiTagSelectFieldBadgeContainer = styled.div `
22
22
  gap: ${(props) => props.theme.strokeWidth.thin};
23
23
  `;
24
24
  export const SearchableMultiTagSelectFieldBadge = styled.span `
25
- color: ${(props) => props.theme.background.input};
26
- background: ${(props) => props.theme.text.default};
25
+ color: ${(props) => props.theme.color.background.input};
26
+ background: ${(props) => props.theme.color.text.default};
27
27
  padding: ${(props) => `0 ${props.theme.spacing.xs} 0 ${props.theme.spacing.s}`};
28
28
  border-radius: ${(props) => props.theme.borderRadius.none};
29
29
  display: flex;
@@ -32,18 +32,18 @@ export const SearchableMultiTagSelectFieldBadge = styled.span `
32
32
  export const SearchableMultiTagSelectFieldBadgeCloseElement = styled.span `
33
33
  cursor: pointer;
34
34
  margin-left: ${(props) => props.theme.spacing.s};
35
- font-size: ${(props) => props.theme.typography.size.s};
36
- align-self: baseline;
35
+ font-size: ${(props) => props.theme.typography.size.small};
36
+ align-self: center;
37
37
  font-family: ${(props) => props.theme.typography.fontFamily.base};
38
38
  `;
39
39
  export const SearchableMultiTagSelectFieldOptionList = styled.ul `
40
40
  width: 100%;
41
41
  padding: unset;
42
42
  margin: unset;
43
- border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.border.default}`};
43
+ border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.border.default}`};
44
44
  border-radius: ${(props) => props.theme.borderRadius.s};
45
45
  position: absolute;
46
- background: ${(props) => props.theme.background.default};
46
+ background: ${(props) => props.theme.color.background.default};
47
47
  top: 100%;
48
48
  z-index: 1000;
49
49
  `;
@@ -53,12 +53,12 @@ export const SearchableMultiTagSelectFieldOptionListItem = styled.li `
53
53
  padding: ${(props) => `${props.theme.spacing.xxs} ${props.theme.spacing.xs}`};
54
54
  height: ${(props) => props.theme.spacing.xl};
55
55
  &:hover {
56
- background: ${(props) => props.theme.background.input};
56
+ background: ${(props) => props.theme.color.background.input};
57
57
  }
58
58
  `;
59
59
  export const SearchableMultiTagSelectFieldOptionListWithoutItem = styled.li `
60
60
  cursor: default;
61
- color: ${(props) => props.theme.background.default};
61
+ color: ${(props) => props.theme.color.background.default};
62
62
  list-style-type: none;
63
63
  padding: ${(props) => `${props.theme.spacing.xxs} ${props.theme.spacing.xs}`};
64
64
  height: ${(props) => props.theme.spacing.xl};
@@ -1,3 +1,4 @@
1
+ import { readableColor } from "polished";
1
2
  import { styled } from "styled-components";
2
3
  import { FieldInput } from "../../components/FieldInput";
3
4
  import { SearchableMultiTagSelectFieldSearchContainer, SearchableMultiTagSelectFieldOptionList, SearchableMultiTagSelectFieldOptionListItem, } from "../SearchableMultiTagSelectField/styledComponents";
@@ -29,18 +30,20 @@ export const SearchableSelectFieldInputElement = styled(FieldInput) `
29
30
  text-overflow: ellipsis;
30
31
  `;
31
32
  export const SearchableSelectFieldClearButton = styled.span `
32
- cursor: pointer;
33
- position: absolute;
34
- right: ${(props) => props.theme.spacing.xs};
35
- bottom: 0;
36
- top: 0;
37
- margin: auto;
38
- background-color: ${(props) => props.theme.neutral[500]};
33
+ background-color: ${(props) => props.theme.color.palette.neutral[500]};
39
34
  border-radius: ${(props) => props.theme.borderRadius.circle};
35
+ bottom: 0;
36
+ color: ${(props) => readableColor(props.theme.color.palette.neutral[500])};
37
+ cursor: pointer;
38
+ font-size: ${(props) => props.theme.typography.size.small};
39
+ height: 1rem;
40
40
  line-height: 1rem;
41
+ margin: auto;
41
42
  min-width: 1rem;
42
- height: 1rem;
43
+ position: absolute;
44
+ right: ${(props) => props.theme.spacing.xs};
43
45
  text-align: center;
46
+ top: 0;
44
47
  `;
45
48
  export const SearchableSelectFieldInputContainer = styled.div `
46
49
  display: flex;
@@ -6,7 +6,7 @@ import { FormRegistry } from "../../FormRegistry";
6
6
  import { useSetDefault } from "../../hooks";
7
7
  import { StringFieldWrapper } from "./styledComponents";
8
8
  export const StringField = (props) => {
9
- const { templates: { FieldTemplate }, components: { FieldInput }, } = useContext(FormRegistry);
9
+ const { templates: { FieldTemplate }, components: { FieldInput, SelectFieldInput }, } = useContext(FormRegistry);
10
10
  useSetDefault(props);
11
11
  const { name, uiSchema = {}, schema } = props;
12
12
  const { type, placeholder, props: inputProps, } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
@@ -17,7 +17,8 @@ export const StringField = (props) => {
17
17
  : { "data-fjsf-number": name };
18
18
  switch (enums?.type) {
19
19
  case "select":
20
- return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsxs(FieldInput, { type,
20
+ return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsxs(SelectFieldInput, { type,
21
+ readOnly: props.schema.readOnly,
21
22
  ...inputProps, name: name, formikAs: "select", onChange: (e) => {
22
23
  const selectedOption = enums?.values.find((option) => option.const.toString() === e.target.value);
23
24
  const selectedValue = selectedOption
@@ -30,6 +31,7 @@ export const StringField = (props) => {
30
31
  default:
31
32
  return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsx(FieldInput, { type,
32
33
  placeholder,
34
+ readOnly: props.schema.readOnly,
33
35
  ...inputProps, name: name }) }) }));
34
36
  }
35
37
  };
@@ -8,5 +8,5 @@ export const TextAreaField = (props) => {
8
8
  useSetDefault(props);
9
9
  const { name, uiSchema } = props;
10
10
  const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
11
- return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(TextAreaFieldInput, { ...inputProps, name: name, formikAs: "textarea" }) }));
11
+ return (_jsx(FieldTemplate, { ...props, "data-fjsf-string": name, children: _jsx(TextAreaFieldInput, { readOnly: props.schema.readOnly, ...inputProps, name: name, formikAs: "textarea" }) }));
12
12
  };
@@ -1,11 +1,12 @@
1
1
  import styled from "styled-components";
2
2
  import { FieldInput } from "../../components/FieldInput";
3
3
  export const TextAreaFieldInput = styled(FieldInput) `
4
- background-color: ${(props) => props.theme.background.input};
5
- width: 100%;
6
- min-height: 5rem;
7
- color: ${(props) => props.theme.text.default};
4
+ background-color: ${(props) => props.theme.color.background.input};
5
+ color: ${(props) => props.theme.color.text.default};
6
+ display: inline-block;
8
7
  font-family: ${(props) => props.theme.typography.fontFamily.base};
9
8
  font-size: ${(props) => props.theme.typography.size.base};
9
+ min-height: 5rem;
10
10
  padding: ${(props) => props.theme.spacing.s};
11
+ width: 95%;
11
12
  `;
@@ -8,5 +8,5 @@ export const ToggleField = (props) => {
8
8
  useSetDefault(props);
9
9
  const { name, uiSchema } = props;
10
10
  const { props: inputProps } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
11
- return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(ToggleFieldInput, { inputProps: inputProps, name: name }) }));
11
+ return (_jsx(FieldTemplate, { ...props, "data-fjsf-boolean": name, children: _jsx(ToggleFieldInput, { inputProps: { readOnly: props.schema.readOnly, ...inputProps }, name: name }) }));
12
12
  };