@nolwenture/formik-jsonschema-form 0.22.2 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Form.stories.js
CHANGED
|
@@ -200,10 +200,24 @@ export const WithRefAndDefinitions = {
|
|
|
200
200
|
uiSchema: refDefUiSchema,
|
|
201
201
|
},
|
|
202
202
|
};
|
|
203
|
+
// Test to add style to MultipleChoiceField
|
|
204
|
+
// const MyMultipleChoiceField = styled(MultipleChoiceField)`
|
|
205
|
+
// background: lavender;
|
|
206
|
+
// ${MultipleChoiceField.styles.MultipleChoiceFieldLabelStyle} {
|
|
207
|
+
// color: purple;
|
|
208
|
+
// }
|
|
209
|
+
// ${MultipleChoiceField.styles.MultipleChoiceFieldElementStyle} {
|
|
210
|
+
// background: lightblue;
|
|
211
|
+
// }
|
|
212
|
+
// ${MultipleChoiceField.styles.MultipleChoiceFieldInputStyle}:checked {
|
|
213
|
+
// accent-color: yellow;
|
|
214
|
+
// }
|
|
215
|
+
// `;
|
|
203
216
|
export const MultipleChoice = {
|
|
204
217
|
args: {
|
|
205
218
|
schema: multipleChoiceSchema,
|
|
206
219
|
uiSchema: multipleChoiceUiSchema,
|
|
220
|
+
//components: { MultipleChoiceField: MyMultipleChoiceField },
|
|
207
221
|
},
|
|
208
222
|
};
|
|
209
223
|
export const Collapsible = {
|
|
@@ -55,10 +55,10 @@ export const ObjectField = (props) => {
|
|
|
55
55
|
const childSchema = properties === null || properties === void 0 ? void 0 : properties[childName];
|
|
56
56
|
if (!childSchema)
|
|
57
57
|
return undefined;
|
|
58
|
-
return (_jsx(SchemaField, { required: required === null || required === void 0 ? void 0 : required.includes(childName), name: name ? [name, childName].join(".") : childName, schema: typeof childSchema !== "boolean" ? childSchema : {}, uiSchema: uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[childName] }, childName));
|
|
58
|
+
return (_jsx(SchemaField, { "data-fjsf-field": childName, required: required === null || required === void 0 ? void 0 : required.includes(childName), name: name ? [name, childName].join(".") : childName, schema: typeof childSchema !== "boolean" ? childSchema : {}, uiSchema: uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[childName] }, childName));
|
|
59
59
|
})
|
|
60
60
|
.filter((x) => x), (!hideUnmarkedAdditionalProperties || additionalProperties) &&
|
|
61
|
-
Object.entries(additionalValues || {}).map(([childName]) => (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { required: required === null || required === void 0 ? void 0 : required.includes(childName), name: name ? [name, childName].join(".") : childName, schema: typeof schema.additionalProperties !== "boolean"
|
|
61
|
+
Object.entries(additionalValues || {}).map(([childName]) => (_jsxs(ObjectFieldItem, { children: [_jsx(SchemaField, { "data-fjsf-field": childName, required: required === null || required === void 0 ? void 0 : required.includes(childName), name: name ? [name, childName].join(".") : childName, schema: typeof schema.additionalProperties !== "boolean"
|
|
62
62
|
? schema.additionalProperties
|
|
63
63
|
: {}, uiSchema: uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema[childName] }, childName), _jsx(ObjectFieldItemButtons, { children: getObjectFieldButton({
|
|
64
64
|
purpose: ObjectFieldButtonPurpose.REMOVE,
|
|
@@ -134,7 +134,40 @@ export declare const RadioButtonField: {
|
|
|
134
134
|
}, never>> & string;
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
|
-
export declare const
|
|
137
|
+
export declare const MultipleChoiceFieldContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
138
|
+
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
139
|
+
}, never>> & string;
|
|
140
|
+
export declare const MultipleChoiceFieldElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>, "ref"> & {
|
|
141
|
+
ref?: ((instance: HTMLLabelElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLLabelElement> | null | undefined;
|
|
142
|
+
}, never>> & string;
|
|
143
|
+
export declare const MultipleChoiceFieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
144
|
+
ref?: unknown;
|
|
145
|
+
}, never>, "ref"> & {
|
|
146
|
+
ref?: unknown;
|
|
147
|
+
}, never>, "ref"> & {
|
|
148
|
+
ref?: unknown;
|
|
149
|
+
}, never>> & string;
|
|
150
|
+
export declare const MultipleChoiceFieldLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>, "ref"> & {
|
|
151
|
+
ref?: ((instance: HTMLSpanElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
152
|
+
}, never>> & string;
|
|
153
|
+
export declare const MultipleChoiceField: {
|
|
154
|
+
({ inputProps, name, className, enums, style, }: MultipleChoiceFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
155
|
+
styles: {
|
|
156
|
+
MultipleChoiceFieldElementStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>, "ref"> & {
|
|
157
|
+
ref?: ((instance: HTMLLabelElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLLabelElement> | null | undefined;
|
|
158
|
+
}, never>> & string;
|
|
159
|
+
MultipleChoiceFieldInputStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
|
160
|
+
ref?: unknown;
|
|
161
|
+
}, never>, "ref"> & {
|
|
162
|
+
ref?: unknown;
|
|
163
|
+
}, never>, "ref"> & {
|
|
164
|
+
ref?: unknown;
|
|
165
|
+
}, never>> & string;
|
|
166
|
+
MultipleChoiceFieldLabelStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>, "ref"> & {
|
|
167
|
+
ref?: ((instance: HTMLSpanElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
168
|
+
}, never>> & string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
138
171
|
export declare const MultiSelectContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
139
172
|
export declare const MultiSelectSearchContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
140
173
|
export declare const MultiSelectInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<Omit<Omit<any, "as">, "ref"> & {
|
package/dist/styledComponents.js
CHANGED
|
@@ -273,13 +273,6 @@ export const RadioButtonField = ({ label, inputProps, name, className, }) => {
|
|
|
273
273
|
var _a, _b;
|
|
274
274
|
return (_jsxs(RadioButtonFieldContainer, { 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" })] })] }));
|
|
275
275
|
};
|
|
276
|
-
const MultipleChoiceFieldContainer = styled(RadioButtonFieldContainer) ``;
|
|
277
|
-
const MultipleChoiceFieldElement = styled(RadioButtonFieldElement) ``;
|
|
278
|
-
const MultipleChoiceFieldInput = styled(RadioButtonFieldInput) ``;
|
|
279
|
-
const MultipleChoiceFieldLabel = styled(ButtonLabel) ``;
|
|
280
|
-
export const MultipleChoiceField = ({ inputProps, name, className, enums, style, }) => {
|
|
281
|
-
return (_jsx(MultipleChoiceFieldContainer, { className: className, style: getStyle(style !== null && style !== void 0 ? style : ""), children: enums.values.map((v) => (_jsxs(MultipleChoiceFieldElement, { children: [_jsx(MultipleChoiceFieldInput, Object.assign({}, inputProps, { name: name, type: enums.type === "multiSelect" ? "checkbox" : "radio", value: typeof v === "string" || typeof v === "number" ? v : v.const })), _jsx(MultipleChoiceFieldLabel, { children: typeof v === "string" || typeof v === "number" ? v : v.title })] }, typeof v === "string" || typeof v === "number" ? v : v.const))) }));
|
|
282
|
-
};
|
|
283
276
|
RadioButtonField.styles = {
|
|
284
277
|
RadioButtonFieldContainerStyle: RadioButtonFieldContainer,
|
|
285
278
|
RadioButtonFieldElementStyle: RadioButtonFieldElement,
|
|
@@ -288,6 +281,18 @@ RadioButtonField.styles = {
|
|
|
288
281
|
ButtonLabelTrueStyle: ButtonLabelTrue,
|
|
289
282
|
ButtonLabelFalseStyle: ButtonLabelFalse,
|
|
290
283
|
};
|
|
284
|
+
export const MultipleChoiceFieldContainer = styled(RadioButtonFieldContainer) ``;
|
|
285
|
+
export const MultipleChoiceFieldElement = styled(RadioButtonFieldElement) ``;
|
|
286
|
+
export const MultipleChoiceFieldInput = styled(RadioButtonFieldInput) ``;
|
|
287
|
+
export const MultipleChoiceFieldLabel = styled(ButtonLabel) ``;
|
|
288
|
+
export const MultipleChoiceField = ({ inputProps, name, className, enums, style, }) => {
|
|
289
|
+
return (_jsx(MultipleChoiceFieldContainer, { className: className, style: getStyle(style !== null && style !== void 0 ? style : ""), children: enums.values.map((v) => (_jsxs(MultipleChoiceFieldElement, { children: [_jsx(MultipleChoiceFieldInput, Object.assign({}, inputProps, { name: name, type: enums.type === "multiSelect" ? "checkbox" : "radio", value: typeof v === "string" || typeof v === "number" ? v : v.const })), _jsx(MultipleChoiceFieldLabel, { "data-fjsf-enum-value": typeof v === "string" || typeof v === "number" ? v : v.const, children: typeof v === "string" || typeof v === "number" ? v : v.title })] }, typeof v === "string" || typeof v === "number" ? v : v.const))) }));
|
|
290
|
+
};
|
|
291
|
+
MultipleChoiceField.styles = {
|
|
292
|
+
MultipleChoiceFieldElementStyle: MultipleChoiceFieldElement,
|
|
293
|
+
MultipleChoiceFieldInputStyle: MultipleChoiceFieldInput,
|
|
294
|
+
MultipleChoiceFieldLabelStyle: MultipleChoiceFieldLabel,
|
|
295
|
+
};
|
|
291
296
|
// ---> SearchableMultiTagSelectField
|
|
292
297
|
export const MultiSelectContainer = styled.div `
|
|
293
298
|
display: flex;
|
package/dist/utils/getStyle.js
CHANGED
|
@@ -8,11 +8,11 @@ export function getStyle(key) {
|
|
|
8
8
|
}
|
|
9
9
|
if (key === "twoColumns") {
|
|
10
10
|
style.display = "grid";
|
|
11
|
-
style["
|
|
11
|
+
style["gridTemplateColumns"] = "1fr 1fr";
|
|
12
12
|
}
|
|
13
13
|
if (key === "threeColumns") {
|
|
14
14
|
style.display = "grid";
|
|
15
|
-
style["
|
|
15
|
+
style["gridTemplateColumns"] = "1fr 1fr 1fr";
|
|
16
16
|
}
|
|
17
17
|
return style;
|
|
18
18
|
}
|