@nolwenture/formik-jsonschema-form 1.0.0-beta.5 → 1.0.0-beta.8
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/cjs/Form/fields/MultipleChoiceField/styledComponents.js +2 -0
- package/dist/cjs/Form/fields/SchemaField/SchemaField.js +0 -1
- package/dist/cjs/Form/fields/StringField/StringField.js +0 -1
- package/dist/cjs/FormView/FormView.js +10 -2
- package/dist/cjs/FormView/components/Field.js +102 -9
- package/dist/cjs/FormView/components/index.js +0 -2
- package/dist/cjs/FormView/templates/ObjectFieldTemplate/styledComponents.js +5 -1
- package/dist/esm/Form/fields/MultipleChoiceField/styledComponents.js +2 -0
- package/dist/esm/Form/fields/SchemaField/SchemaField.js +0 -1
- package/dist/esm/Form/fields/StringField/StringField.js +0 -1
- package/dist/esm/FormView/FormView.js +6 -1
- package/dist/esm/FormView/components/Field.js +95 -7
- package/dist/esm/FormView/components/index.js +0 -2
- package/dist/esm/FormView/templates/ObjectFieldTemplate/styledComponents.js +5 -1
- package/dist/types/FormView/FormView.d.ts +2 -0
- package/dist/types/FormView/components/Field.d.ts +36 -3
- package/dist/types/FormView/components/index.d.ts +15 -14
- package/package.json +19 -14
- package/dist/cjs/FormView/components/old_styledComponents.js +0 -65
- package/dist/esm/FormView/components/old_styledComponents.js +0 -57
- package/dist/types/FormView/components/old_styledComponents.d.ts +0 -32
|
@@ -11,6 +11,8 @@ exports.MultipleChoiceFieldContainer = (0, styled_components_1.default)(styledCo
|
|
|
11
11
|
${common_1.commonCheckboxStyles}
|
|
12
12
|
${common_1.commonRadioStyles}
|
|
13
13
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
justify-content: start;
|
|
14
16
|
`;
|
|
15
17
|
exports.MultipleChoiceFieldElement = (0, styled_components_1.default)(styledComponents_1.RadioFieldElement) ``;
|
|
16
18
|
exports.MultipleChoiceFieldInputElement = (0, styled_components_1.default)(styledComponents_1.RadioFieldInputElement) ``;
|
|
@@ -33,7 +33,6 @@ const SchemaField = (props) => {
|
|
|
33
33
|
schema: schemaSolvedForReferences.schema,
|
|
34
34
|
uiSchema: schemaSolvedForReferences.uiSchema,
|
|
35
35
|
};
|
|
36
|
-
console.log({ newProps });
|
|
37
36
|
return (0, jsx_runtime_1.jsx)(FieldComponent, { ...newProps });
|
|
38
37
|
};
|
|
39
38
|
exports.SchemaField = SchemaField;
|
|
@@ -32,7 +32,6 @@ const StringField = (props) => {
|
|
|
32
32
|
hidden: true,
|
|
33
33
|
...uiSchema["ui:placeholderOptionOptions"]?.props, children: placeholder }), enums?.values.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.const.toString(), children: option.title }, index)))] }) }) }));
|
|
34
34
|
default:
|
|
35
|
-
console.log({ props, type, inputProps });
|
|
36
35
|
return ((0, jsx_runtime_1.jsx)(FieldTemplate, { ...props, ...fieldDataAttribute, children: (0, jsx_runtime_1.jsx)(styledComponents_1.StringFieldWrapper, { children: (0, jsx_runtime_1.jsx)(FieldInput, { type,
|
|
37
36
|
placeholder,
|
|
38
37
|
readOnly: props.schema.readOnly,
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormView = void 0;
|
|
6
|
+
exports.FormView = exports.FormWrapper = void 0;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
5
9
|
const utils_1 = require("../utils");
|
|
6
10
|
const fields_1 = require("./fields");
|
|
7
11
|
const components_1 = require("./components");
|
|
8
12
|
const templates_1 = require("./templates");
|
|
9
13
|
const FormViewRegistry_1 = require("./FormViewRegistry");
|
|
14
|
+
exports.FormWrapper = styled_components_1.default.div `
|
|
15
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
16
|
+
padding: ${(props) => props.theme.spacing.xxxxxl};
|
|
17
|
+
`;
|
|
10
18
|
const FormView = (props) => {
|
|
11
19
|
(0, utils_1.warnFromUnsupportedKeys)("Form", props, [
|
|
12
20
|
"schema",
|
|
@@ -37,6 +45,6 @@ const FormView = (props) => {
|
|
|
37
45
|
};
|
|
38
46
|
const { Form: FormEl } = registry.components;
|
|
39
47
|
const SchemaField = registry.fields.SchemaField;
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(FormViewRegistry_1.FormViewRegistry.Provider, { value: registry, children: (0, jsx_runtime_1.jsx)(FormEl, { className: className, children: (0, jsx_runtime_1.jsx)(SchemaField, { name: "", schema: schema, uiSchema: uiSchema, values: values }) }) }));
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(exports.FormWrapper, { children: (0, jsx_runtime_1.jsx)(FormViewRegistry_1.FormViewRegistry.Provider, { value: registry, children: (0, jsx_runtime_1.jsx)(FormEl, { className: className, children: (0, jsx_runtime_1.jsx)(SchemaField, { name: "", schema: schema, uiSchema: uiSchema, values: values }) }) }) }));
|
|
41
49
|
};
|
|
42
50
|
exports.FormView = FormView;
|
|
@@ -1,13 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FieldDescription = exports.FieldTitle = exports.FieldWrapper = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
exports.MultipleChoiceFieldValue = exports.BooleanFieldValue = exports.MultipleChoiceFieldWrapper = exports.BooleanFieldWrapper = exports.EJSFieldValue = exports.ArrayFieldItem = exports.TextAreaValue = exports.StringFieldValue = exports.FieldDescription = exports.FieldTitle = exports.FieldWrapper = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const styledComponents_1 = require("../../Form/fields/MultipleChoiceField/styledComponents");
|
|
10
|
+
const getStyle_1 = require("../../utils/getStyle");
|
|
11
|
+
exports.FieldWrapper = styled_components_1.default.div `
|
|
12
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
13
|
+
width: clamp(20rem, 100%, 70rem);
|
|
14
|
+
margin: ${(props) => `${props.theme.spacing.l} 0`};
|
|
15
|
+
break-before: auto;
|
|
16
|
+
`;
|
|
17
|
+
exports.FieldTitle = styled_components_1.default.label `
|
|
18
|
+
color: ${(props) => props.theme.color.text.default};
|
|
19
|
+
display: inline-block;
|
|
20
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
21
|
+
font-size: ${(props) => props.theme.typography.size.large};
|
|
22
|
+
font-weight: ${(props) => props.theme.typography.weight.bold};
|
|
23
|
+
margin: ${(props) => `${props.theme.spacing.xs} 0 ${props.theme.spacing.m} 0`};
|
|
24
|
+
border-top: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.text.default}`};
|
|
25
|
+
padding-top: ${(props) => props.theme.spacing.s};
|
|
26
|
+
width: 100%;
|
|
27
|
+
`;
|
|
28
|
+
exports.FieldDescription = styled_components_1.default.div `
|
|
29
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
30
|
+
font-weight: ${(props) => props.theme.typography.weight.normal};
|
|
31
|
+
font-style: italic;
|
|
32
|
+
font-size: ${(props) => props.theme.typography.size.base};
|
|
33
|
+
margin-bottom: ${(props) => props.theme.spacing.xs};
|
|
34
|
+
max-width: 66ch;
|
|
35
|
+
`;
|
|
36
|
+
exports.StringFieldValue = styled_components_1.default.div `
|
|
37
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
38
|
+
margin-bottom: ${(props) => props.theme.spacing.m};
|
|
39
|
+
max-width: 66ch;
|
|
40
|
+
white-space: pre-line;
|
|
41
|
+
`;
|
|
42
|
+
exports.TextAreaValue = styled_components_1.default.div `
|
|
43
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
44
|
+
margin-bottom: ${(props) => props.theme.spacing.m};
|
|
45
|
+
max-width: 66ch;
|
|
46
|
+
white-space: pre-line;
|
|
47
|
+
`;
|
|
48
|
+
exports.ArrayFieldItem = styled_components_1.default.div `
|
|
49
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
50
|
+
`;
|
|
51
|
+
exports.EJSFieldValue = styled_components_1.default.div `
|
|
52
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
53
|
+
width: 100%;
|
|
54
|
+
`;
|
|
55
|
+
const NotSelected = styled_components_1.default.div `
|
|
56
|
+
opacity: 0.3;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: start;
|
|
59
|
+
`;
|
|
60
|
+
const Selected = styled_components_1.default.div `
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: start;
|
|
63
|
+
`;
|
|
64
|
+
const SelectedBox = styled_components_1.default.span `
|
|
65
|
+
color: ${(props) => props.theme.color.background.default};
|
|
66
|
+
background: ${(props) => props.theme.color.text.default};
|
|
67
|
+
padding: ${(props) => `0 ${props.theme.spacing.xs}`};
|
|
68
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
69
|
+
font-size: ${(props) => props.theme.typography.size.small};
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
align-items: start;
|
|
73
|
+
`;
|
|
74
|
+
const NotSelectedCircle = styled_components_1.default.span `
|
|
75
|
+
color: ${(props) => props.theme.color.background.default};
|
|
76
|
+
background: ${(props) => props.theme.color.text.default};
|
|
77
|
+
padding: ${(props) => props.theme.spacing.xxs};
|
|
78
|
+
border-radius: ${(props) => props.theme.borderRadius.circle};
|
|
8
79
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
9
|
-
font-
|
|
10
|
-
|
|
11
|
-
|
|
80
|
+
font-size: ${(props) => props.theme.typography.size.small};
|
|
81
|
+
line-height: 1.1;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
align-items: start;
|
|
85
|
+
flex: 0 0 1rem;
|
|
86
|
+
`;
|
|
87
|
+
exports.BooleanFieldWrapper = styled_components_1.default.div `
|
|
88
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
89
|
+
`;
|
|
90
|
+
exports.MultipleChoiceFieldWrapper = styled_components_1.default.div `
|
|
91
|
+
label {
|
|
92
|
+
align-items: start;
|
|
93
|
+
}
|
|
12
94
|
`;
|
|
13
|
-
|
|
95
|
+
const BooleanFieldValue = ({ name, className, value, label, }) => {
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: value === true ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u2713" }), (0, jsx_runtime_1.jsx)("span", { children: label !== undefined ? label : "Selected" })] })) : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u2716" }), (0, jsx_runtime_1.jsx)("span", { children: label !== undefined ? label : "Not selected" })] })) }));
|
|
97
|
+
};
|
|
98
|
+
exports.BooleanFieldValue = BooleanFieldValue;
|
|
99
|
+
const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(exports.MultipleChoiceFieldWrapper, { children: (0, jsx_runtime_1.jsxs)(styledComponents_1.MultipleChoiceFieldContainer, { className: className, style: (0, getStyle_1.getStyle)(style ?? ""), children: [!selected && !notSelected && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Nothing was selected" }), selected &&
|
|
101
|
+
selected.length > 0 &&
|
|
102
|
+
selected.map((s) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { children: (0, jsx_runtime_1.jsxs)(Selected, { children: [(0, jsx_runtime_1.jsx)(SelectedBox, { children: "\u2713" }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
|
|
103
|
+
notSelected?.length > 0 &&
|
|
104
|
+
notSelected.map((n) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { children: (0, jsx_runtime_1.jsxs)(NotSelected, { children: [(0, jsx_runtime_1.jsx)(NotSelectedCircle, { children: "\u2715" }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }) }));
|
|
105
|
+
};
|
|
106
|
+
exports.MultipleChoiceFieldValue = MultipleChoiceFieldValue;
|
|
@@ -36,9 +36,7 @@ const templates_1 = require("../templates");
|
|
|
36
36
|
const Field = __importStar(require("./Field"));
|
|
37
37
|
const Form = __importStar(require("./Form"));
|
|
38
38
|
const Icon = __importStar(require("./Icon"));
|
|
39
|
-
const oldComponents = __importStar(require("./old_styledComponents"));
|
|
40
39
|
exports.components = {
|
|
41
|
-
...oldComponents,
|
|
42
40
|
...fields_1.fieldComponents,
|
|
43
41
|
...templates_1.templateComponents,
|
|
44
42
|
//Please keep this in alphabetical order
|
|
@@ -7,7 +7,11 @@ exports.ObjectFieldTemplateDescription = exports.ObjectFieldTemplateTitle = expo
|
|
|
7
7
|
exports.getComponents = getComponents;
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
exports.ObjectFieldTemplateWrapper = styled_components_1.default.div ``;
|
|
10
|
-
exports.ObjectFieldTemplateTitle = styled_components_1.default.div
|
|
10
|
+
exports.ObjectFieldTemplateTitle = styled_components_1.default.div `
|
|
11
|
+
font-size: ${(props) => props.theme.typography.size.h3};
|
|
12
|
+
font-weight: ${(props) => props.theme.typography.weight.bold};
|
|
13
|
+
margin-bottom: ${(props) => props.theme.spacing.l};
|
|
14
|
+
`;
|
|
11
15
|
exports.ObjectFieldTemplateDescription = undefined;
|
|
12
16
|
function getComponents(components) {
|
|
13
17
|
return {
|
|
@@ -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) ``;
|
|
@@ -29,7 +29,6 @@ export const StringField = (props) => {
|
|
|
29
29
|
hidden: true,
|
|
30
30
|
...uiSchema["ui:placeholderOptionOptions"]?.props, children: placeholder }), enums?.values.map((option, index) => (_jsx("option", { value: option.const.toString(), children: option.title }, index)))] }) }) }));
|
|
31
31
|
default:
|
|
32
|
-
console.log({ props, type, inputProps });
|
|
33
32
|
return (_jsx(FieldTemplate, { ...props, ...fieldDataAttribute, children: _jsx(StringFieldWrapper, { children: _jsx(FieldInput, { type,
|
|
34
33
|
placeholder,
|
|
35
34
|
readOnly: props.schema.readOnly,
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
2
3
|
import { warnFromUnsupportedKeys } from "../utils";
|
|
3
4
|
import { fields as defaultFields } from "./fields";
|
|
4
5
|
import { components as defaultComponents } from "./components";
|
|
5
6
|
import { templates as defaultTemplates } from "./templates";
|
|
6
7
|
import { FormViewRegistry } from "./FormViewRegistry";
|
|
8
|
+
export const FormWrapper = styled.div `
|
|
9
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
10
|
+
padding: ${(props) => props.theme.spacing.xxxxxl};
|
|
11
|
+
`;
|
|
7
12
|
export const FormView = (props) => {
|
|
8
13
|
warnFromUnsupportedKeys("Form", props, [
|
|
9
14
|
"schema",
|
|
@@ -34,5 +39,5 @@ export const FormView = (props) => {
|
|
|
34
39
|
};
|
|
35
40
|
const { Form: FormEl } = registry.components;
|
|
36
41
|
const SchemaField = registry.fields.SchemaField;
|
|
37
|
-
return (_jsx(FormViewRegistry.Provider, { value: registry, children: _jsx(FormEl, { className: className, children: _jsx(SchemaField, { name: "", schema: schema, uiSchema: uiSchema, values: values }) }) }));
|
|
42
|
+
return (_jsx(FormWrapper, { children: _jsx(FormViewRegistry.Provider, { value: registry, children: _jsx(FormEl, { className: className, children: _jsx(SchemaField, { name: "", schema: schema, uiSchema: uiSchema, values: values }) }) }) }));
|
|
38
43
|
};
|
|
@@ -1,10 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { MultipleChoiceFieldContainer, MultipleChoiceFieldElement, MultipleChoiceFieldLabel, } from "../../Form/fields/MultipleChoiceField/styledComponents";
|
|
4
|
+
import { getStyle } from "../../utils/getStyle";
|
|
5
|
+
export const FieldWrapper = styled.div `
|
|
6
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
7
|
+
width: clamp(20rem, 100%, 70rem);
|
|
8
|
+
margin: ${(props) => `${props.theme.spacing.l} 0`};
|
|
9
|
+
break-before: auto;
|
|
10
|
+
`;
|
|
3
11
|
export const FieldTitle = styled.label `
|
|
4
|
-
|
|
12
|
+
color: ${(props) => props.theme.color.text.default};
|
|
13
|
+
display: inline-block;
|
|
14
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
15
|
+
font-size: ${(props) => props.theme.typography.size.large};
|
|
16
|
+
font-weight: ${(props) => props.theme.typography.weight.bold};
|
|
17
|
+
margin: ${(props) => `${props.theme.spacing.xs} 0 ${props.theme.spacing.m} 0`};
|
|
18
|
+
border-top: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.text.default}`};
|
|
19
|
+
padding-top: ${(props) => props.theme.spacing.s};
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
export const FieldDescription = styled.div `
|
|
23
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
24
|
+
font-weight: ${(props) => props.theme.typography.weight.normal};
|
|
25
|
+
font-style: italic;
|
|
26
|
+
font-size: ${(props) => props.theme.typography.size.base};
|
|
27
|
+
margin-bottom: ${(props) => props.theme.spacing.xs};
|
|
28
|
+
max-width: 66ch;
|
|
29
|
+
`;
|
|
30
|
+
export const StringFieldValue = styled.div `
|
|
31
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
32
|
+
margin-bottom: ${(props) => props.theme.spacing.m};
|
|
33
|
+
max-width: 66ch;
|
|
34
|
+
white-space: pre-line;
|
|
35
|
+
`;
|
|
36
|
+
export const TextAreaValue = styled.div `
|
|
37
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
38
|
+
margin-bottom: ${(props) => props.theme.spacing.m};
|
|
39
|
+
max-width: 66ch;
|
|
40
|
+
white-space: pre-line;
|
|
41
|
+
`;
|
|
42
|
+
export const ArrayFieldItem = styled.div `
|
|
43
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
44
|
+
`;
|
|
45
|
+
export const EJSFieldValue = styled.div `
|
|
46
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
47
|
+
width: 100%;
|
|
48
|
+
`;
|
|
49
|
+
const NotSelected = styled.div `
|
|
50
|
+
opacity: 0.3;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: start;
|
|
53
|
+
`;
|
|
54
|
+
const Selected = styled.div `
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: start;
|
|
57
|
+
`;
|
|
58
|
+
const SelectedBox = styled.span `
|
|
59
|
+
color: ${(props) => props.theme.color.background.default};
|
|
60
|
+
background: ${(props) => props.theme.color.text.default};
|
|
61
|
+
padding: ${(props) => `0 ${props.theme.spacing.xs}`};
|
|
62
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
63
|
+
font-size: ${(props) => props.theme.typography.size.small};
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
align-items: start;
|
|
67
|
+
`;
|
|
68
|
+
const NotSelectedCircle = styled.span `
|
|
69
|
+
color: ${(props) => props.theme.color.background.default};
|
|
70
|
+
background: ${(props) => props.theme.color.text.default};
|
|
71
|
+
padding: ${(props) => props.theme.spacing.xxs};
|
|
72
|
+
border-radius: ${(props) => props.theme.borderRadius.circle};
|
|
5
73
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
6
|
-
font-
|
|
7
|
-
|
|
8
|
-
|
|
74
|
+
font-size: ${(props) => props.theme.typography.size.small};
|
|
75
|
+
line-height: 1.1;
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: start;
|
|
79
|
+
flex: 0 0 1rem;
|
|
80
|
+
`;
|
|
81
|
+
export const BooleanFieldWrapper = styled.div `
|
|
82
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
83
|
+
`;
|
|
84
|
+
export const MultipleChoiceFieldWrapper = styled.div `
|
|
85
|
+
label {
|
|
86
|
+
align-items: start;
|
|
87
|
+
}
|
|
9
88
|
`;
|
|
10
|
-
export const
|
|
89
|
+
export const BooleanFieldValue = ({ name, className, value, label, }) => {
|
|
90
|
+
return (_jsx("div", { className: className, children: value === true ? (_jsxs("div", { children: [_jsx("span", { children: "\u2713" }), _jsx("span", { children: label !== undefined ? label : "Selected" })] })) : (_jsxs("div", { children: [_jsx("span", { children: "\u2716" }), _jsx("span", { children: label !== undefined ? label : "Not selected" })] })) }));
|
|
91
|
+
};
|
|
92
|
+
export const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
|
|
93
|
+
return (_jsx(MultipleChoiceFieldWrapper, { children: _jsxs(MultipleChoiceFieldContainer, { className: className, style: getStyle(style ?? ""), children: [!selected && !notSelected && _jsx(_Fragment, { children: "Nothing was selected" }), selected &&
|
|
94
|
+
selected.length > 0 &&
|
|
95
|
+
selected.map((s) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(Selected, { children: [_jsx(SelectedBox, { children: "\u2713" }), _jsx(MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
|
|
96
|
+
notSelected?.length > 0 &&
|
|
97
|
+
notSelected.map((n) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(NotSelected, { children: [_jsx(NotSelectedCircle, { children: "\u2715" }), _jsx(MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }) }));
|
|
98
|
+
};
|
|
@@ -7,9 +7,7 @@ import { templateComponents } from "../templates";
|
|
|
7
7
|
import * as Field from "./Field";
|
|
8
8
|
import * as Form from "./Form";
|
|
9
9
|
import * as Icon from "./Icon";
|
|
10
|
-
import * as oldComponents from "./old_styledComponents";
|
|
11
10
|
export const components = {
|
|
12
|
-
...oldComponents,
|
|
13
11
|
...fieldComponents,
|
|
14
12
|
...templateComponents,
|
|
15
13
|
//Please keep this in alphabetical order
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
export const ObjectFieldTemplateWrapper = styled.div ``;
|
|
3
|
-
export const ObjectFieldTemplateTitle = styled.div
|
|
3
|
+
export const ObjectFieldTemplateTitle = styled.div `
|
|
4
|
+
font-size: ${(props) => props.theme.typography.size.h3};
|
|
5
|
+
font-weight: ${(props) => props.theme.typography.weight.bold};
|
|
6
|
+
margin-bottom: ${(props) => props.theme.spacing.l};
|
|
7
|
+
`;
|
|
4
8
|
export const ObjectFieldTemplateDescription = undefined;
|
|
5
9
|
export function getComponents(components) {
|
|
6
10
|
return {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { FormProps } from "../common/types";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const FormWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
4
|
export declare const FormView: <T>(props: FormProps<T> & {
|
|
3
5
|
values: Record<string, any>;
|
|
4
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import * as formik from "formik";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const FieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const FieldTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
5
|
+
export declare const FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const StringFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const TextAreaValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const ArrayFieldItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
+
export declare const EJSFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
+
export declare const BooleanFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const MultipleChoiceFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
type BooleanValueFieldProps = {
|
|
13
|
+
name: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
value: boolean;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const BooleanFieldValue: React.FC<BooleanValueFieldProps>;
|
|
19
|
+
type MultipleChoiceFieldValueProps = {
|
|
20
|
+
selected: {
|
|
21
|
+
const: string | number;
|
|
22
|
+
title: string;
|
|
23
|
+
}[] | undefined;
|
|
24
|
+
notSelected: {
|
|
25
|
+
const: string | number;
|
|
26
|
+
title: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
inputProps?: any;
|
|
29
|
+
name?: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
style?: string;
|
|
32
|
+
value?: string | number;
|
|
33
|
+
form?: formik.FormikContextType<unknown>;
|
|
34
|
+
};
|
|
35
|
+
export declare const MultipleChoiceFieldValue: React.FC<MultipleChoiceFieldValueProps>;
|
|
36
|
+
export {};
|
|
@@ -8,25 +8,12 @@ export declare const components: {
|
|
|
8
8
|
FieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
9
|
FieldTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>> & string;
|
|
10
10
|
FieldDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
-
getComponents(components: ComponentsType): {
|
|
12
|
-
Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
-
Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
14
|
-
Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
15
|
-
};
|
|
16
|
-
ObjectFieldTemplateWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
17
|
-
ObjectFieldTemplateTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
-
ObjectFieldTemplateDescription: typeof Field.FieldDescription | undefined;
|
|
19
|
-
ArrayFieldTemplateWrapper: typeof import("../templates/ObjectFieldTemplate/styledComponents").ObjectFieldTemplateWrapper | undefined;
|
|
20
|
-
ArrayFieldTemplateTitle: typeof import("../templates/ObjectFieldTemplate/styledComponents").ObjectFieldTemplateTitle | undefined;
|
|
21
|
-
ArrayFieldTemplateDescription: typeof Field.FieldDescription | undefined;
|
|
22
|
-
ObjectFieldSection: import("react").FC<import("../fields/ObjectField").ObjectFieldSectionProps>;
|
|
23
|
-
ObjectFieldSectionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
|
|
24
|
-
ObjectFieldSectionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
|
|
25
11
|
StringFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
26
12
|
TextAreaValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
27
13
|
ArrayFieldItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
28
14
|
EJSFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
29
15
|
BooleanFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
16
|
+
MultipleChoiceFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
30
17
|
BooleanFieldValue: React.FC<{
|
|
31
18
|
name: string;
|
|
32
19
|
className?: string;
|
|
@@ -49,5 +36,19 @@ export declare const components: {
|
|
|
49
36
|
value?: string | number;
|
|
50
37
|
form?: import("formik").FormikContextType<unknown>;
|
|
51
38
|
}>;
|
|
39
|
+
getComponents(components: ComponentsType): {
|
|
40
|
+
Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
41
|
+
Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
42
|
+
Description: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
43
|
+
};
|
|
44
|
+
ObjectFieldTemplateWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
45
|
+
ObjectFieldTemplateTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
46
|
+
ObjectFieldTemplateDescription: typeof Field.FieldDescription | undefined;
|
|
47
|
+
ArrayFieldTemplateWrapper: typeof import("../templates/ObjectFieldTemplate/styledComponents").ObjectFieldTemplateWrapper | undefined;
|
|
48
|
+
ArrayFieldTemplateTitle: typeof import("../templates/ObjectFieldTemplate/styledComponents").ObjectFieldTemplateTitle | undefined;
|
|
49
|
+
ArrayFieldTemplateDescription: typeof Field.FieldDescription | undefined;
|
|
50
|
+
ObjectFieldSection: import("react").FC<import("../fields/ObjectField").ObjectFieldSectionProps>;
|
|
51
|
+
ObjectFieldSectionWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
|
|
52
|
+
ObjectFieldSectionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, never>> & string;
|
|
52
53
|
};
|
|
53
54
|
export type ComponentsType = typeof components;
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nolwenture/formik-jsonschema-form",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
4
4
|
"description": "Formik form generation from json schema",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "anttivikman <antti.vikman@nolwenture.com>",
|
|
6
6
|
"contributors": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
7
|
+
"NoNasanen <nona.nasanen@nolwenture.com",
|
|
8
|
+
"anttivikman <antti.vikman@nolwenture.com>",
|
|
9
|
+
"nikolintunen-nolwenture <niko.lintunen@nolwenture.com>",
|
|
10
|
+
"tuunjuuso <juuso.tuunanen@nolwenture.com",
|
|
11
|
+
"anttischroderus <antti.schroderus@nolwenture.com>",
|
|
12
|
+
"samulinolw <samuli.vayrynen@nolwenture.com>",
|
|
13
|
+
"nolwram <rammohan.balasubramanian@nolwenture.com>"
|
|
9
14
|
],
|
|
10
15
|
"license": "MIT",
|
|
11
16
|
"types": "./dist/types/index.d.ts",
|
|
@@ -68,15 +73,15 @@
|
|
|
68
73
|
"@babel/preset-env": "^7.25.4",
|
|
69
74
|
"@babel/preset-react": "^7.24.1",
|
|
70
75
|
"@babel/preset-typescript": "^7.24.1",
|
|
71
|
-
"@nolwenture/component-library": "^1.0.
|
|
72
|
-
"@storybook/addon-essentials": "^8.0
|
|
73
|
-
"@storybook/addon-interactions": "^8.0
|
|
74
|
-
"@storybook/addon-links": "^8.0
|
|
75
|
-
"@storybook/addon-webpack5-compiler-babel": "^3.0.
|
|
76
|
-
"@storybook/react": "^8.0
|
|
77
|
-
"@storybook/react-webpack5": "^8.0
|
|
78
|
-
"@storybook/test": "^8.0
|
|
79
|
-
"@storybook/test-runner": "^0.
|
|
76
|
+
"@nolwenture/component-library": "^1.0.8",
|
|
77
|
+
"@storybook/addon-essentials": "^8.5.0",
|
|
78
|
+
"@storybook/addon-interactions": "^8.5.0",
|
|
79
|
+
"@storybook/addon-links": "^8.5.0",
|
|
80
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.5",
|
|
81
|
+
"@storybook/react": "^8.5.0",
|
|
82
|
+
"@storybook/react-webpack5": "^8.5.0",
|
|
83
|
+
"@storybook/test": "^8.5.0",
|
|
84
|
+
"@storybook/test-runner": "^0.21.0",
|
|
80
85
|
"@testing-library/jest-dom": "^6.4.2",
|
|
81
86
|
"@testing-library/react": "^14.2.2",
|
|
82
87
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -96,7 +101,7 @@
|
|
|
96
101
|
"react-router": "^7.0.1",
|
|
97
102
|
"react-router-dom": "^7.0.1",
|
|
98
103
|
"rimraf": "^6.0.1",
|
|
99
|
-
"storybook": "^8.0
|
|
104
|
+
"storybook": "^8.5.0",
|
|
100
105
|
"styled-components": "^6.1.8",
|
|
101
106
|
"ts-jest": "^29.1.2",
|
|
102
107
|
"webpack": "^5.91.0",
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MultipleChoiceFieldValue = exports.BooleanFieldValue = exports.BooleanFieldWrapper = exports.EJSFieldValue = exports.ArrayFieldItem = exports.TextAreaValue = exports.StringFieldValue = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const styledComponents_1 = require("../../Form/fields/MultipleChoiceField/styledComponents");
|
|
10
|
-
const getStyle_1 = require("../../utils/getStyle");
|
|
11
|
-
exports.StringFieldValue = styled_components_1.default.div `
|
|
12
|
-
white-space: pre-line;
|
|
13
|
-
`;
|
|
14
|
-
exports.TextAreaValue = styled_components_1.default.div `
|
|
15
|
-
white-space: pre-line;
|
|
16
|
-
`;
|
|
17
|
-
exports.ArrayFieldItem = styled_components_1.default.div ``;
|
|
18
|
-
exports.EJSFieldValue = styled_components_1.default.div `
|
|
19
|
-
width: 100%;
|
|
20
|
-
`;
|
|
21
|
-
exports.BooleanFieldWrapper = styled_components_1.default.div ``;
|
|
22
|
-
const BooleanFieldValue = ({ name, className, value, label, }) => {
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: value === true ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u2713" }), (0, jsx_runtime_1.jsx)("span", { children: label !== undefined ? label : "Selected" })] })) : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u2716" }), (0, jsx_runtime_1.jsx)("span", { children: label !== undefined ? label : "Not selected" })] })) }));
|
|
24
|
-
};
|
|
25
|
-
exports.BooleanFieldValue = BooleanFieldValue;
|
|
26
|
-
const NotSelected = styled_components_1.default.div `
|
|
27
|
-
opacity: 0.3;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
`;
|
|
31
|
-
const Selected = styled_components_1.default.div `
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
`;
|
|
35
|
-
const SelectedBox = styled_components_1.default.span `
|
|
36
|
-
color: ${(props) => props.theme.color.background.default};
|
|
37
|
-
background: ${(props) => props.theme.color.text.default};
|
|
38
|
-
padding: ${(props) => `0 ${props.theme.spacing.xs}`};
|
|
39
|
-
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
40
|
-
font-size: ${(props) => props.theme.typography.size.small};
|
|
41
|
-
display: inline-flex;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
align-items: center;
|
|
44
|
-
`;
|
|
45
|
-
const NotSelectedCircle = styled_components_1.default.span `
|
|
46
|
-
color: ${(props) => props.theme.color.background.default};
|
|
47
|
-
background: ${(props) => props.theme.color.text.default};
|
|
48
|
-
padding: ${(props) => props.theme.spacing.xxs};
|
|
49
|
-
border-radius: ${(props) => props.theme.borderRadius.circle};
|
|
50
|
-
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
51
|
-
font-size: ${(props) => props.theme.typography.size.small};
|
|
52
|
-
line-height: 1.1;
|
|
53
|
-
display: inline-flex;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
align-items: center;
|
|
56
|
-
flex: 0 0 1rem;
|
|
57
|
-
`;
|
|
58
|
-
const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(styledComponents_1.MultipleChoiceFieldContainer, { className: className, style: (0, getStyle_1.getStyle)(style ?? ""), children: [!selected && !notSelected && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Nothing was selected" }), selected &&
|
|
60
|
-
selected.length > 0 &&
|
|
61
|
-
selected.map((s) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { children: (0, jsx_runtime_1.jsxs)(Selected, { children: [(0, jsx_runtime_1.jsx)(SelectedBox, { children: "\u2713" }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
|
|
62
|
-
notSelected?.length > 0 &&
|
|
63
|
-
notSelected.map((n) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { children: (0, jsx_runtime_1.jsxs)(NotSelected, { children: [(0, jsx_runtime_1.jsx)(NotSelectedCircle, { children: "\u2715" }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }));
|
|
64
|
-
};
|
|
65
|
-
exports.MultipleChoiceFieldValue = MultipleChoiceFieldValue;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { MultipleChoiceFieldContainer, MultipleChoiceFieldElement, MultipleChoiceFieldLabel, } from "../../Form/fields/MultipleChoiceField/styledComponents";
|
|
4
|
-
import { getStyle } from "../../utils/getStyle";
|
|
5
|
-
export const StringFieldValue = styled.div `
|
|
6
|
-
white-space: pre-line;
|
|
7
|
-
`;
|
|
8
|
-
export const TextAreaValue = styled.div `
|
|
9
|
-
white-space: pre-line;
|
|
10
|
-
`;
|
|
11
|
-
export const ArrayFieldItem = styled.div ``;
|
|
12
|
-
export const EJSFieldValue = styled.div `
|
|
13
|
-
width: 100%;
|
|
14
|
-
`;
|
|
15
|
-
export const BooleanFieldWrapper = styled.div ``;
|
|
16
|
-
export const BooleanFieldValue = ({ name, className, value, label, }) => {
|
|
17
|
-
return (_jsx("div", { className: className, children: value === true ? (_jsxs("div", { children: [_jsx("span", { children: "\u2713" }), _jsx("span", { children: label !== undefined ? label : "Selected" })] })) : (_jsxs("div", { children: [_jsx("span", { children: "\u2716" }), _jsx("span", { children: label !== undefined ? label : "Not selected" })] })) }));
|
|
18
|
-
};
|
|
19
|
-
const NotSelected = styled.div `
|
|
20
|
-
opacity: 0.3;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
`;
|
|
24
|
-
const Selected = styled.div `
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
`;
|
|
28
|
-
const SelectedBox = styled.span `
|
|
29
|
-
color: ${(props) => props.theme.color.background.default};
|
|
30
|
-
background: ${(props) => props.theme.color.text.default};
|
|
31
|
-
padding: ${(props) => `0 ${props.theme.spacing.xs}`};
|
|
32
|
-
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
33
|
-
font-size: ${(props) => props.theme.typography.size.small};
|
|
34
|
-
display: inline-flex;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
align-items: center;
|
|
37
|
-
`;
|
|
38
|
-
const NotSelectedCircle = styled.span `
|
|
39
|
-
color: ${(props) => props.theme.color.background.default};
|
|
40
|
-
background: ${(props) => props.theme.color.text.default};
|
|
41
|
-
padding: ${(props) => props.theme.spacing.xxs};
|
|
42
|
-
border-radius: ${(props) => props.theme.borderRadius.circle};
|
|
43
|
-
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
44
|
-
font-size: ${(props) => props.theme.typography.size.small};
|
|
45
|
-
line-height: 1.1;
|
|
46
|
-
display: inline-flex;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
align-items: center;
|
|
49
|
-
flex: 0 0 1rem;
|
|
50
|
-
`;
|
|
51
|
-
export const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
|
|
52
|
-
return (_jsxs(MultipleChoiceFieldContainer, { className: className, style: getStyle(style ?? ""), children: [!selected && !notSelected && _jsx(_Fragment, { children: "Nothing was selected" }), selected &&
|
|
53
|
-
selected.length > 0 &&
|
|
54
|
-
selected.map((s) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(Selected, { children: [_jsx(SelectedBox, { children: "\u2713" }), _jsx(MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
|
|
55
|
-
notSelected?.length > 0 &&
|
|
56
|
-
notSelected.map((n) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(NotSelected, { children: [_jsx(NotSelectedCircle, { children: "\u2715" }), _jsx(MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }));
|
|
57
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as formik from "formik";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare const StringFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
-
export declare const TextAreaValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
-
export declare const ArrayFieldItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
-
export declare const EJSFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
-
type BooleanValueFieldProps = {
|
|
8
|
-
name: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
value: boolean;
|
|
11
|
-
label?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const BooleanFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
14
|
-
export declare const BooleanFieldValue: React.FC<BooleanValueFieldProps>;
|
|
15
|
-
type MultipleChoiceFieldValueProps = {
|
|
16
|
-
selected: {
|
|
17
|
-
const: string | number;
|
|
18
|
-
title: string;
|
|
19
|
-
}[] | undefined;
|
|
20
|
-
notSelected: {
|
|
21
|
-
const: string | number;
|
|
22
|
-
title: string;
|
|
23
|
-
}[] | undefined;
|
|
24
|
-
inputProps?: any;
|
|
25
|
-
name?: React.ReactNode;
|
|
26
|
-
className?: string;
|
|
27
|
-
style?: string;
|
|
28
|
-
value?: string | number;
|
|
29
|
-
form?: formik.FormikContextType<unknown>;
|
|
30
|
-
};
|
|
31
|
-
export declare const MultipleChoiceFieldValue: React.FC<MultipleChoiceFieldValueProps>;
|
|
32
|
-
export {};
|