@nolwenture/formik-jsonschema-form 1.0.0-beta.16 → 1.0.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/Form/components/Clickable.js +0 -7
- package/dist/cjs/Form/components/FieldInfo.js +18 -14
- package/dist/cjs/Form/fields/ObjectField/ObjectField.js +1 -1
- package/dist/cjs/Form/fields/SearchableMultiTagSelectField/styledComponents.js +1 -1
- package/dist/cjs/Form/fields/TextAreaField/styledComponents.js +3 -2
- package/dist/cjs/Form/styles/common.js +30 -13
- package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +2 -2
- package/dist/cjs/FormView/fields/ObjectField/ObjectField.js +1 -1
- package/dist/esm/Form/components/Clickable.js +0 -7
- package/dist/esm/Form/components/FieldInfo.js +18 -14
- package/dist/esm/Form/fields/ObjectField/ObjectField.js +1 -1
- package/dist/esm/Form/fields/SearchableMultiTagSelectField/styledComponents.js +1 -1
- package/dist/esm/Form/fields/TextAreaField/styledComponents.js +3 -2
- package/dist/esm/Form/styles/common.js +30 -13
- package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js +2 -2
- package/dist/esm/FormView/fields/ObjectField/ObjectField.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,13 +4,6 @@ exports.Clickable = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const styled_components_1 = require("styled-components");
|
|
6
6
|
const ClickableEl = styled_components_1.styled.button `
|
|
7
|
-
background: none;
|
|
8
|
-
color: inherit;
|
|
9
|
-
border: none;
|
|
10
|
-
padding: 0;
|
|
11
|
-
font: inherit;
|
|
12
|
-
outline: inherit;
|
|
13
|
-
cursor: pointer;
|
|
14
7
|
`;
|
|
15
8
|
const Clickable = ({ children, onClick, onMouseUp = () => { }, onMouseDown = () => { }, innerRef = () => { }, className, ariaLabel, ariaExpanded = false, ariaControls, id, }) => {
|
|
16
9
|
return ((0, jsx_runtime_1.jsx)(ClickableEl, { type: "button", onClick: onClick, onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: (r) => innerRef(r), className: className, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, "aria-controls": ariaControls, id: id, children: children }));
|
|
@@ -5,16 +5,16 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const styled_components_1 = require("styled-components");
|
|
6
6
|
const polished_1 = require("polished");
|
|
7
7
|
exports.FieldInfoBoxElement = styled_components_1.styled.div `
|
|
8
|
-
transition: opacity 0.5s;
|
|
9
|
-
position: absolute;
|
|
10
|
-
z-index: 1080;
|
|
11
|
-
opacity: 0;
|
|
12
|
-
visibility: hidden;
|
|
13
|
-
margin: 0;
|
|
14
8
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
15
9
|
font-size: ${(props) => props.theme.typography.size.small};
|
|
16
|
-
|
|
10
|
+
margin: 0;
|
|
17
11
|
min-width: max-content;
|
|
12
|
+
opacity: 0;
|
|
13
|
+
position: absolute;
|
|
14
|
+
transition: opacity 0.5s;
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
word-wrap: break-word;
|
|
17
|
+
z-index: 1080;
|
|
18
18
|
|
|
19
19
|
top: ${({ position }) => position === "bottom" ? "140%" : position === "top" ? "auto" : "50%"};
|
|
20
20
|
bottom: ${({ position }) => position === "top"
|
|
@@ -63,13 +63,17 @@ exports.FieldInfoBoxArrowElement = styled_components_1.styled.div `
|
|
|
63
63
|
margin-left: -5px;
|
|
64
64
|
`;
|
|
65
65
|
exports.FieldInfoBoxInnerElement = styled_components_1.styled.div `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
background: ${(props) => props.theme.color.background.default};
|
|
67
|
+
border-radius: ${(props) => props.theme.borderRadius.none};
|
|
68
|
+
border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.intent.default.none}`};
|
|
69
|
+
color: ${(props) => props.theme.color.text.default};
|
|
70
|
+
cursor: default;
|
|
71
|
+
font-size: ${(props) => props.theme.typography.size.small};
|
|
72
|
+
line-height: ${(props) => props.theme.typography.lineHeight.small};
|
|
73
|
+
max-width: 30ch;
|
|
74
|
+
padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
|
|
75
|
+
text-align: left;
|
|
76
|
+
white-space: pre-wrap;
|
|
73
77
|
`;
|
|
74
78
|
exports.FieldInfoContainer = styled_components_1.styled.a `
|
|
75
79
|
position: relative;
|
|
@@ -35,7 +35,7 @@ const ObjectField = (props) => {
|
|
|
35
35
|
}, [valuesToRemove]);
|
|
36
36
|
const propertyKeys = (0, react_1.useMemo)(() => Object.keys(properties || {}), [properties]);
|
|
37
37
|
const additionalValues = (0, react_1.useMemo)(() => Object.fromEntries(Object.entries(value || {}).filter(([key, value]) => !propertyKeys.includes(key))), [value, propertyKeys]);
|
|
38
|
-
const FieldTemplateComponent = props.uiSchema?.
|
|
38
|
+
const FieldTemplateComponent = props.uiSchema?.["ui:options"]?.isCollapsible
|
|
39
39
|
? CollapsibleObjectFieldTemplate
|
|
40
40
|
: ObjectFieldTemplate;
|
|
41
41
|
const orderedProperties = (0, utils_1.orderByUiSchema)(uiSchema?.["ui:order"], Object.keys(properties || {}));
|
|
@@ -36,7 +36,7 @@ exports.SearchableMultiTagSelectFieldBadgeCloseElement = styled_components_1.sty
|
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
margin-left: ${(props) => props.theme.spacing.s};
|
|
38
38
|
font-size: ${(props) => props.theme.typography.size.small};
|
|
39
|
-
align-self:
|
|
39
|
+
align-self: center;
|
|
40
40
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
41
41
|
`;
|
|
42
42
|
exports.SearchableMultiTagSelectFieldOptionList = styled_components_1.styled.ul `
|
|
@@ -8,10 +8,11 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
8
8
|
const FieldInput_1 = require("../../components/FieldInput");
|
|
9
9
|
exports.TextAreaFieldInput = (0, styled_components_1.default)(FieldInput_1.FieldInput) `
|
|
10
10
|
background-color: ${(props) => props.theme.color.background.input};
|
|
11
|
-
width: 100%;
|
|
12
|
-
min-height: 5rem;
|
|
13
11
|
color: ${(props) => props.theme.color.text.default};
|
|
12
|
+
display: inline-block;
|
|
14
13
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
15
14
|
font-size: ${(props) => props.theme.typography.size.base};
|
|
15
|
+
min-height: 5rem;
|
|
16
16
|
padding: ${(props) => props.theme.spacing.s};
|
|
17
|
+
width: 95%;
|
|
17
18
|
`;
|
|
@@ -186,21 +186,38 @@ exports.commonRadioStyles = (0, styled_components_1.css) `
|
|
|
186
186
|
}
|
|
187
187
|
`;
|
|
188
188
|
exports.commonSelectStyles = (0, styled_components_1.css) `
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
${props.theme.color.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
select {
|
|
190
|
+
appearance: none;
|
|
191
|
+
-webkit-appearance: none;
|
|
192
|
+
-moz-appearance: none;
|
|
193
|
+
background-color: ${(props) => props.theme.color.background.input};
|
|
194
|
+
border-radius: ${(props) => props.theme.borderRadius.none};
|
|
195
|
+
border: ${(props) => `${props.theme.strokeWidth.thin} solid
|
|
196
|
+
${props.theme.color.border.default}`};
|
|
197
|
+
color: ${(props) => props.theme.color.text.default};
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
200
|
+
font-size: ${(props) => props.theme.typography.size.base};
|
|
201
|
+
font-weight: ${(props) => props.theme.typography.weight.normal};
|
|
202
|
+
outline: none;
|
|
203
|
+
padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
|
|
204
|
+
width: 100%;
|
|
205
|
+
|
|
206
|
+
background-image: ${(props) => `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 320 512'%3E%3Cpath fill='${encodeURIComponent(props.theme.color.text.default)}' d='M31 192h258c17 0 26 21 14 33l-129 129c-8 8-21 8-29 0L17 225c-12-12-3-33 14-33z'/%3E%3C/svg%3E")`};
|
|
207
|
+
background-position: ${(props) => `right ${props.theme.spacing.m} top 50%`};
|
|
208
|
+
background-repeat: no-repeat;
|
|
209
|
+
background-size: ${(props) => props.theme.spacing.l}; auto;
|
|
199
210
|
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
&:focus {
|
|
212
|
+
${(props) => props.theme.focus.default};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
select[multiple] {
|
|
217
|
+
appearance: auto;
|
|
218
|
+
background-image: none;
|
|
219
|
+
overflow: auto;
|
|
202
220
|
}
|
|
203
|
-
}
|
|
204
221
|
`;
|
|
205
222
|
exports.datePickerIconStyles = (0, styled_components_1.css) `
|
|
206
223
|
::-webkit-calendar-picker-indicator {
|
package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js
CHANGED
|
@@ -12,9 +12,9 @@ const CollapsibleObjectFieldTemplate = (props) => {
|
|
|
12
12
|
const { children, name, uiSchema, ...otherProps } = props;
|
|
13
13
|
const title = (0, utils_1.getTitle)(props);
|
|
14
14
|
const description = (0, utils_1.getDescription)(props);
|
|
15
|
-
const { help, info,
|
|
15
|
+
const { help, info, isCollapsedOnLoad = true, openIcon, collapsedIcon,
|
|
16
16
|
//TODO: This is not right
|
|
17
|
-
props: { wrapper: wrapperProps = {}, title: titleProps, description: descriptionProps, help: helpProps,
|
|
17
|
+
props: { wrapper: wrapperProps = {}, title: titleProps, description: descriptionProps, help: helpProps, ariaLabel,
|
|
18
18
|
// error: errorProps,
|
|
19
19
|
} = {}, } = (0, react_1.useMemo)(() => (0, utils_1.extractUiSchema)(uiSchema), [uiSchema]);
|
|
20
20
|
const dataAttributes = Object.keys(otherProps)
|
|
@@ -30,7 +30,7 @@ const ObjectField = (props) => {
|
|
|
30
30
|
setValue(newValue);
|
|
31
31
|
}
|
|
32
32
|
}, [valuesToRemove]);
|
|
33
|
-
const FieldTemplateComponent = props.uiSchema?.
|
|
33
|
+
const FieldTemplateComponent = props.uiSchema?.["ui:options"]?.isCollapsible
|
|
34
34
|
? CollapsibleObjectFieldTemplate
|
|
35
35
|
: ObjectFieldTemplate;
|
|
36
36
|
const orderedProperties = (0, utils_1.orderByUiSchema)(uiSchema?.["ui:order"], Object.keys(properties || {}));
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { styled } from "styled-components";
|
|
3
3
|
const ClickableEl = styled.button `
|
|
4
|
-
background: none;
|
|
5
|
-
color: inherit;
|
|
6
|
-
border: none;
|
|
7
|
-
padding: 0;
|
|
8
|
-
font: inherit;
|
|
9
|
-
outline: inherit;
|
|
10
|
-
cursor: pointer;
|
|
11
4
|
`;
|
|
12
5
|
export const Clickable = ({ children, onClick, onMouseUp = () => { }, onMouseDown = () => { }, innerRef = () => { }, className, ariaLabel, ariaExpanded = false, ariaControls, id, }) => {
|
|
13
6
|
return (_jsx(ClickableEl, { type: "button", onClick: onClick, onMouseUp: onMouseUp, onMouseDown: onMouseDown, ref: (r) => innerRef(r), className: className, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, "aria-controls": ariaControls, id: id, children: children }));
|
|
@@ -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
|
-
|
|
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"
|
|
@@ -60,13 +60,17 @@ export const FieldInfoBoxArrowElement = styled.div `
|
|
|
60
60
|
margin-left: -5px;
|
|
61
61
|
`;
|
|
62
62
|
export const FieldInfoBoxInnerElement = styled.div `
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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;
|
|
@@ -32,7 +32,7 @@ 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?.
|
|
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 || {}));
|
|
@@ -33,7 +33,7 @@ export const SearchableMultiTagSelectFieldBadgeCloseElement = styled.span `
|
|
|
33
33
|
cursor: pointer;
|
|
34
34
|
margin-left: ${(props) => props.theme.spacing.s};
|
|
35
35
|
font-size: ${(props) => props.theme.typography.size.small};
|
|
36
|
-
align-self:
|
|
36
|
+
align-self: center;
|
|
37
37
|
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
38
38
|
`;
|
|
39
39
|
export const SearchableMultiTagSelectFieldOptionList = styled.ul `
|
|
@@ -2,10 +2,11 @@ import styled from "styled-components";
|
|
|
2
2
|
import { FieldInput } from "../../components/FieldInput";
|
|
3
3
|
export const TextAreaFieldInput = styled(FieldInput) `
|
|
4
4
|
background-color: ${(props) => props.theme.color.background.input};
|
|
5
|
-
width: 100%;
|
|
6
|
-
min-height: 5rem;
|
|
7
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
|
`;
|
|
@@ -183,21 +183,38 @@ export const commonRadioStyles = css `
|
|
|
183
183
|
}
|
|
184
184
|
`;
|
|
185
185
|
export const commonSelectStyles = css `
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
${props.theme.color.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
186
|
+
select {
|
|
187
|
+
appearance: none;
|
|
188
|
+
-webkit-appearance: none;
|
|
189
|
+
-moz-appearance: none;
|
|
190
|
+
background-color: ${(props) => props.theme.color.background.input};
|
|
191
|
+
border-radius: ${(props) => props.theme.borderRadius.none};
|
|
192
|
+
border: ${(props) => `${props.theme.strokeWidth.thin} solid
|
|
193
|
+
${props.theme.color.border.default}`};
|
|
194
|
+
color: ${(props) => props.theme.color.text.default};
|
|
195
|
+
cursor: pointer;
|
|
196
|
+
font-family: ${(props) => props.theme.typography.fontFamily.base};
|
|
197
|
+
font-size: ${(props) => props.theme.typography.size.base};
|
|
198
|
+
font-weight: ${(props) => props.theme.typography.weight.normal};
|
|
199
|
+
outline: none;
|
|
200
|
+
padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
|
|
201
|
+
width: 100%;
|
|
202
|
+
|
|
203
|
+
background-image: ${(props) => `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 320 512'%3E%3Cpath fill='${encodeURIComponent(props.theme.color.text.default)}' d='M31 192h258c17 0 26 21 14 33l-129 129c-8 8-21 8-29 0L17 225c-12-12-3-33 14-33z'/%3E%3C/svg%3E")`};
|
|
204
|
+
background-position: ${(props) => `right ${props.theme.spacing.m} top 50%`};
|
|
205
|
+
background-repeat: no-repeat;
|
|
206
|
+
background-size: ${(props) => props.theme.spacing.l}; auto;
|
|
196
207
|
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
&:focus {
|
|
209
|
+
${(props) => props.theme.focus.default};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
select[multiple] {
|
|
214
|
+
appearance: auto;
|
|
215
|
+
background-image: none;
|
|
216
|
+
overflow: auto;
|
|
199
217
|
}
|
|
200
|
-
}
|
|
201
218
|
`;
|
|
202
219
|
export const datePickerIconStyles = css `
|
|
203
220
|
::-webkit-calendar-picker-indicator {
|
package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/CollapsibleObjectFieldTemplate.js
CHANGED
|
@@ -9,9 +9,9 @@ export const CollapsibleObjectFieldTemplate = (props) => {
|
|
|
9
9
|
const { children, name, uiSchema, ...otherProps } = props;
|
|
10
10
|
const title = getTitle(props);
|
|
11
11
|
const description = getDescription(props);
|
|
12
|
-
const { help, info,
|
|
12
|
+
const { help, info, isCollapsedOnLoad = true, openIcon, collapsedIcon,
|
|
13
13
|
//TODO: This is not right
|
|
14
|
-
props: { wrapper: wrapperProps = {}, title: titleProps, description: descriptionProps, help: helpProps,
|
|
14
|
+
props: { wrapper: wrapperProps = {}, title: titleProps, description: descriptionProps, help: helpProps, ariaLabel,
|
|
15
15
|
// error: errorProps,
|
|
16
16
|
} = {}, } = useMemo(() => extractUiSchema(uiSchema), [uiSchema]);
|
|
17
17
|
const dataAttributes = Object.keys(otherProps)
|
|
@@ -27,7 +27,7 @@ export const ObjectField = (props) => {
|
|
|
27
27
|
setValue(newValue);
|
|
28
28
|
}
|
|
29
29
|
}, [valuesToRemove]);
|
|
30
|
-
const FieldTemplateComponent = props.uiSchema?.
|
|
30
|
+
const FieldTemplateComponent = props.uiSchema?.["ui:options"]?.isCollapsible
|
|
31
31
|
? CollapsibleObjectFieldTemplate
|
|
32
32
|
: ObjectFieldTemplate;
|
|
33
33
|
const orderedProperties = orderByUiSchema(uiSchema?.["ui:order"], Object.keys(properties || {}));
|
package/package.json
CHANGED