@nolwenture/formik-jsonschema-form 1.0.0 → 1.0.1
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/components/Icon.js +1 -3
- package/dist/cjs/Form/fields/ObjectField/ObjectFieldSection.js +2 -1
- package/dist/cjs/Form/fields/ObjectField/styledComponents.js +15 -3
- package/dist/cjs/Form/styles/common.js +11 -0
- package/dist/cjs/Form/templates/CollapsibleObjectFieldTemplate/styledComponents.js +1 -0
- package/dist/esm/Form/components/Icon.js +1 -3
- package/dist/esm/Form/fields/ObjectField/ObjectFieldSection.js +3 -2
- package/dist/esm/Form/fields/ObjectField/styledComponents.js +14 -2
- package/dist/esm/Form/styles/common.js +11 -0
- package/dist/esm/Form/templates/CollapsibleObjectFieldTemplate/styledComponents.js +1 -0
- package/dist/types/Form/components/index.d.ts +1 -0
- package/dist/types/Form/fields/ObjectField/index.d.ts +1 -0
- package/dist/types/Form/fields/ObjectField/styledComponents.d.ts +1 -0
- package/dist/types/Form/fields/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Icon = void 0;
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
|
-
exports.Icon = styled_components_1.styled.div
|
|
6
|
-
padding: ${(props) => `0 ${props.theme.spacing.s}`};
|
|
7
|
-
`;
|
|
5
|
+
exports.Icon = styled_components_1.styled.div ``;
|
|
@@ -4,6 +4,7 @@ exports.ObjectFieldSection = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const FormRegistry_1 = require("../../FormRegistry");
|
|
7
|
+
const styledComponents_1 = require("./styledComponents");
|
|
7
8
|
const ObjectFieldSection = ({ title, collapsible, children, }) => {
|
|
8
9
|
const [collapsed, setCollapsed] = (0, react_1.useState)(collapsible);
|
|
9
10
|
const { components: { ObjectFieldSectionWrapper, ObjectFieldSectionTitle }, } = (0, react_1.useContext)(FormRegistry_1.FormRegistry);
|
|
@@ -11,6 +12,6 @@ const ObjectFieldSection = ({ title, collapsible, children, }) => {
|
|
|
11
12
|
if (collapsible) {
|
|
12
13
|
setCollapsed((currentState) => !currentState);
|
|
13
14
|
}
|
|
14
|
-
}, children: [collapsible && (collapsed ? "▸" : "▾")
|
|
15
|
+
}, children: [title, (0, jsx_runtime_1.jsx)(styledComponents_1.IconWrapper, { children: collapsible && (collapsed ? "▸" : "▾") })] }), !collapsed && children] }));
|
|
15
16
|
};
|
|
16
17
|
exports.ObjectFieldSection = ObjectFieldSection;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectFieldSectionTitle = exports.ObjectFieldSectionWrapper = exports.ObjectFieldAddButton = exports.ObjectFieldRemoveButton = exports.ObjectFieldDownButton = exports.ObjectFieldUpButton = exports.ObjectFieldButton = exports.ObjectFieldItemButtons = exports.ObjectFieldItem = exports.ObjectFieldWrapper = void 0;
|
|
3
|
+
exports.ObjectFieldSectionTitle = exports.ObjectFieldSectionWrapper = exports.ObjectFieldAddButton = exports.ObjectFieldRemoveButton = exports.ObjectFieldDownButton = exports.ObjectFieldUpButton = exports.ObjectFieldButton = exports.ObjectFieldItemButtons = exports.ObjectFieldItem = exports.ObjectFieldWrapper = exports.IconWrapper = void 0;
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
const common_1 = require("../../styles/common");
|
|
6
6
|
const component_library_1 = require("@nolwenture/component-library");
|
|
7
|
+
exports.IconWrapper = styled_components_1.styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
`;
|
|
7
10
|
exports.ObjectFieldWrapper = (0, styled_components_1.styled)(common_1.CommonFieldWrapper) ``;
|
|
8
11
|
exports.ObjectFieldItem = styled_components_1.styled.li `
|
|
9
12
|
color: ${(props) => props.theme.color.text.default};
|
|
@@ -23,5 +26,14 @@ exports.ObjectFieldUpButton = (0, styled_components_1.styled)(exports.ObjectFiel
|
|
|
23
26
|
exports.ObjectFieldDownButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
|
|
24
27
|
exports.ObjectFieldRemoveButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
|
|
25
28
|
exports.ObjectFieldAddButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
|
|
26
|
-
exports.ObjectFieldSectionWrapper = styled_components_1.styled.fieldset
|
|
27
|
-
|
|
29
|
+
exports.ObjectFieldSectionWrapper = styled_components_1.styled.fieldset `
|
|
30
|
+
padding: ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.l} ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.s};
|
|
31
|
+
`;
|
|
32
|
+
exports.ObjectFieldSectionTitle = styled_components_1.styled.legend `
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: ${(props) => props.theme.spacing.s};
|
|
35
|
+
float: left;
|
|
36
|
+
width: 100%;
|
|
37
|
+
margin: 0;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
`;
|
|
@@ -18,6 +18,9 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
|
|
|
18
18
|
color: ${(props) => props.theme.color.text.muted};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
&:read-only {
|
|
22
|
+
}
|
|
23
|
+
|
|
21
24
|
&:focus {
|
|
22
25
|
${(props) => props.theme.focus.default};
|
|
23
26
|
}
|
|
@@ -52,6 +55,10 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
|
|
|
52
55
|
background-repeat: no-repeat;
|
|
53
56
|
background-size: ${(props) => props.theme.spacing.l}; auto;
|
|
54
57
|
|
|
58
|
+
&:read-only {
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
&:focus {
|
|
56
63
|
${(props) => props.theme.focus.default};
|
|
57
64
|
}
|
|
@@ -166,5 +173,9 @@ exports.CommonCheckboxStyles = styled_components_1.styled.div `
|
|
|
166
173
|
transform: scale(1);
|
|
167
174
|
}
|
|
168
175
|
}
|
|
176
|
+
|
|
177
|
+
&:read-only {
|
|
178
|
+
|
|
179
|
+
}
|
|
169
180
|
}
|
|
170
181
|
`;
|
|
@@ -10,6 +10,7 @@ exports.CollapsibleObjectFieldTemplateIcon = undefined;
|
|
|
10
10
|
exports.CollapsibleObjectFieldTemplateTitle = (0, styled_components_1.styled)(styledComponents_1.ObjectFieldTemplateTitle) `
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
|
+
gap: ${(props) => props.theme.spacing.s};
|
|
13
14
|
`;
|
|
14
15
|
exports.CollapsibleObjectFieldTemplateDescription = undefined;
|
|
15
16
|
exports.CollapsibleObjectFieldTemplateHelp = undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useState } from "react";
|
|
3
3
|
import { FormRegistry } from "../../FormRegistry";
|
|
4
|
+
import { IconWrapper } from "./styledComponents";
|
|
4
5
|
export const ObjectFieldSection = ({ title, collapsible, children, }) => {
|
|
5
6
|
const [collapsed, setCollapsed] = useState(collapsible);
|
|
6
7
|
const { components: { ObjectFieldSectionWrapper, ObjectFieldSectionTitle }, } = useContext(FormRegistry);
|
|
@@ -8,5 +9,5 @@ export const ObjectFieldSection = ({ title, collapsible, children, }) => {
|
|
|
8
9
|
if (collapsible) {
|
|
9
10
|
setCollapsed((currentState) => !currentState);
|
|
10
11
|
}
|
|
11
|
-
}, children: [collapsible && (collapsed ? "▸" : "▾")
|
|
12
|
+
}, children: [title, _jsx(IconWrapper, { children: collapsible && (collapsed ? "▸" : "▾") })] }), !collapsed && children] }));
|
|
12
13
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { styled } from "styled-components";
|
|
2
2
|
import { CommonFieldWrapper } from "../../styles/common";
|
|
3
3
|
import { Button } from "@nolwenture/component-library";
|
|
4
|
+
export const IconWrapper = styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
`;
|
|
4
7
|
export const ObjectFieldWrapper = styled(CommonFieldWrapper) ``;
|
|
5
8
|
export const ObjectFieldItem = styled.li `
|
|
6
9
|
color: ${(props) => props.theme.color.text.default};
|
|
@@ -20,5 +23,14 @@ export const ObjectFieldUpButton = styled(ObjectFieldButton) ``;
|
|
|
20
23
|
export const ObjectFieldDownButton = styled(ObjectFieldButton) ``;
|
|
21
24
|
export const ObjectFieldRemoveButton = styled(ObjectFieldButton) ``;
|
|
22
25
|
export const ObjectFieldAddButton = styled(ObjectFieldButton) ``;
|
|
23
|
-
export const ObjectFieldSectionWrapper = styled.fieldset
|
|
24
|
-
|
|
26
|
+
export const ObjectFieldSectionWrapper = styled.fieldset `
|
|
27
|
+
padding: ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.l} ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.s};
|
|
28
|
+
`;
|
|
29
|
+
export const ObjectFieldSectionTitle = styled.legend `
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: ${(props) => props.theme.spacing.s};
|
|
32
|
+
float: left;
|
|
33
|
+
width: 100%;
|
|
34
|
+
margin: 0;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
`;
|
|
@@ -15,6 +15,9 @@ export const CommonFieldWrapper = styled.div `
|
|
|
15
15
|
color: ${(props) => props.theme.color.text.muted};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
&:read-only {
|
|
19
|
+
}
|
|
20
|
+
|
|
18
21
|
&:focus {
|
|
19
22
|
${(props) => props.theme.focus.default};
|
|
20
23
|
}
|
|
@@ -49,6 +52,10 @@ export const CommonFieldWrapper = styled.div `
|
|
|
49
52
|
background-repeat: no-repeat;
|
|
50
53
|
background-size: ${(props) => props.theme.spacing.l}; auto;
|
|
51
54
|
|
|
55
|
+
&:read-only {
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
&:focus {
|
|
53
60
|
${(props) => props.theme.focus.default};
|
|
54
61
|
}
|
|
@@ -163,5 +170,9 @@ export const CommonCheckboxStyles = styled.div `
|
|
|
163
170
|
transform: scale(1);
|
|
164
171
|
}
|
|
165
172
|
}
|
|
173
|
+
|
|
174
|
+
&:read-only {
|
|
175
|
+
|
|
176
|
+
}
|
|
166
177
|
}
|
|
167
178
|
`;
|
|
@@ -6,6 +6,7 @@ export const CollapsibleObjectFieldTemplateIcon = undefined;
|
|
|
6
6
|
export const CollapsibleObjectFieldTemplateTitle = styled(ObjectFieldTemplateTitle) `
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
|
+
gap: ${(props) => props.theme.spacing.s};
|
|
9
10
|
`;
|
|
10
11
|
export const CollapsibleObjectFieldTemplateDescription = undefined;
|
|
11
12
|
export const CollapsibleObjectFieldTemplateHelp = undefined;
|
|
@@ -146,6 +146,7 @@ export declare const components: {
|
|
|
146
146
|
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
147
147
|
}, never>> & string;
|
|
148
148
|
ObjectFieldSection: import("react").FC<import("../fields/ObjectField").ObjectFieldSectionProps>;
|
|
149
|
+
IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
149
150
|
ObjectFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
150
151
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
151
152
|
}, never>> & string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as fields from "./ObjectField";
|
|
2
2
|
declare const components: {
|
|
3
3
|
ObjectFieldSection: import("react").FC<import("./types").ObjectFieldSectionProps>;
|
|
4
|
+
IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
5
|
ObjectFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
5
6
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
6
7
|
}, never>> & string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Button } from "@nolwenture/component-library";
|
|
2
|
+
export declare const IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
3
|
export declare const ObjectFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
3
4
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
5
|
}, never>> & string;
|
|
@@ -76,6 +76,7 @@ export declare const fieldComponents: {
|
|
|
76
76
|
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
77
77
|
}, never>> & string;
|
|
78
78
|
ObjectFieldSection: import("react").FC<ObjectField.ObjectFieldSectionProps>;
|
|
79
|
+
IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
79
80
|
ObjectFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
80
81
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
81
82
|
}, never>> & string;
|