@nolwenture/formik-jsonschema-form 1.0.0 → 1.0.2

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.
@@ -38,6 +38,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const styled_components_1 = require("styled-components");
39
39
  const formik = __importStar(require("formik"));
40
40
  exports.FieldWrapper = styled_components_1.styled.div `
41
+ display: flex;
42
+ flex-direction: column;
41
43
  margin: ${(props) => `${props.theme.spacing.s} 0`};
42
44
  color: ${(props) => props.theme.color.text.default};
43
45
  `;
@@ -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 ? "▸" : "▾"), title] }), !collapsed && children] }));
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};
@@ -18,10 +21,20 @@ exports.ObjectFieldItemButtons = styled_components_1.styled.div `
18
21
  exports.ObjectFieldButton = (0, styled_components_1.styled)(component_library_1.Button) `
19
22
  line-height: 1;
20
23
  padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
24
+ justify-content: center;
21
25
  `;
22
26
  exports.ObjectFieldUpButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
23
27
  exports.ObjectFieldDownButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
24
28
  exports.ObjectFieldRemoveButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
25
29
  exports.ObjectFieldAddButton = (0, styled_components_1.styled)(exports.ObjectFieldButton) ``;
26
- exports.ObjectFieldSectionWrapper = styled_components_1.styled.fieldset ``;
27
- exports.ObjectFieldSectionTitle = styled_components_1.styled.legend ``;
30
+ exports.ObjectFieldSectionWrapper = styled_components_1.styled.fieldset `
31
+ padding: ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.l} ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.s};
32
+ `;
33
+ exports.ObjectFieldSectionTitle = styled_components_1.styled.legend `
34
+ display: flex;
35
+ gap: ${(props) => props.theme.spacing.s};
36
+ float: left;
37
+ width: 100%;
38
+ margin: 0;
39
+ justify-content: space-between;
40
+ `;
@@ -11,12 +11,10 @@ exports.SearchableMultiTagSelectFieldContainer = (0, styled_components_1.styled)
11
11
 
12
12
  `;
13
13
  exports.SearchableMultiTagSelectFieldSearchContainer = styled_components_1.styled.div `
14
- display: inline-block;
15
- position: relative;
16
- width: fit-content;
14
+ display: flex;
15
+ flex-direction: column;
17
16
  `;
18
17
  exports.SearchableMultiTagSelectFieldInputElement = (0, styled_components_1.styled)(FieldInput_1.FieldInput) `
19
- width: 100%;
20
18
  `;
21
19
  exports.SearchableMultiTagSelectFieldBadgeContainer = styled_components_1.styled.div `
22
20
  font-family: ${(props) => props.theme.typography.fontFamily.base};
@@ -14,5 +14,4 @@ exports.TextAreaFieldInput = (0, styled_components_1.default)(FieldInput_1.Field
14
14
  font-size: ${(props) => props.theme.typography.size.base};
15
15
  min-height: 5rem;
16
16
  padding: ${(props) => props.theme.spacing.s};
17
- width: 95%;
18
17
  `;
@@ -4,6 +4,10 @@ exports.CommonCheckboxStyles = exports.CommonFieldWrapper = void 0;
4
4
  const styled_components_1 = require("styled-components");
5
5
  const polished_1 = require("polished");
6
6
  exports.CommonFieldWrapper = styled_components_1.styled.div `
7
+
8
+ display: flex;
9
+ flex-direction: column;
10
+
7
11
  input {
8
12
  background-color: ${(props) => props.theme.color.background.input};
9
13
  border-radius: ${(props) => props.theme.borderRadius.none};
@@ -18,6 +22,9 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
18
22
  color: ${(props) => props.theme.color.text.muted};
19
23
  }
20
24
 
25
+ &:read-only {
26
+ }
27
+
21
28
  &:focus {
22
29
  ${(props) => props.theme.focus.default};
23
30
  }
@@ -52,6 +59,10 @@ exports.CommonFieldWrapper = styled_components_1.styled.div `
52
59
  background-repeat: no-repeat;
53
60
  background-size: ${(props) => props.theme.spacing.l}; auto;
54
61
 
62
+ &:read-only {
63
+
64
+ }
65
+
55
66
  &:focus {
56
67
  ${(props) => props.theme.focus.default};
57
68
  }
@@ -166,5 +177,9 @@ exports.CommonCheckboxStyles = styled_components_1.styled.div `
166
177
  transform: scale(1);
167
178
  }
168
179
  }
180
+
181
+ &:read-only {
182
+
183
+ }
169
184
  }
170
185
  `;
@@ -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;
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { styled } from "styled-components";
3
3
  import * as formik from "formik";
4
4
  export const FieldWrapper = styled.div `
5
+ display: flex;
6
+ flex-direction: column;
5
7
  margin: ${(props) => `${props.theme.spacing.s} 0`};
6
8
  color: ${(props) => props.theme.color.text.default};
7
9
  `;
@@ -1,4 +1,2 @@
1
1
  import { styled } from "styled-components";
2
- export const Icon = styled.div `
3
- padding: ${(props) => `0 ${props.theme.spacing.s}`};
4
- `;
2
+ export const Icon = styled.div ``;
@@ -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 ? "▸" : "▾"), title] }), !collapsed && children] }));
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};
@@ -15,10 +18,20 @@ export const ObjectFieldItemButtons = styled.div `
15
18
  export const ObjectFieldButton = styled(Button) `
16
19
  line-height: 1;
17
20
  padding: ${(props) => `${props.theme.spacing.s} ${props.theme.spacing.m}`};
21
+ justify-content: center;
18
22
  `;
19
23
  export const ObjectFieldUpButton = styled(ObjectFieldButton) ``;
20
24
  export const ObjectFieldDownButton = styled(ObjectFieldButton) ``;
21
25
  export const ObjectFieldRemoveButton = styled(ObjectFieldButton) ``;
22
26
  export const ObjectFieldAddButton = styled(ObjectFieldButton) ``;
23
- export const ObjectFieldSectionWrapper = styled.fieldset ``;
24
- export const ObjectFieldSectionTitle = styled.legend ``;
27
+ export const ObjectFieldSectionWrapper = styled.fieldset `
28
+ padding: ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.l} ${(props) => props.theme.spacing.s} ${(props) => props.theme.spacing.s};
29
+ `;
30
+ export const ObjectFieldSectionTitle = styled.legend `
31
+ display: flex;
32
+ gap: ${(props) => props.theme.spacing.s};
33
+ float: left;
34
+ width: 100%;
35
+ margin: 0;
36
+ justify-content: space-between;
37
+ `;
@@ -8,12 +8,10 @@ export const SearchableMultiTagSelectFieldContainer = styled(CommonFieldWrapper)
8
8
 
9
9
  `;
10
10
  export const SearchableMultiTagSelectFieldSearchContainer = styled.div `
11
- display: inline-block;
12
- position: relative;
13
- width: fit-content;
11
+ display: flex;
12
+ flex-direction: column;
14
13
  `;
15
14
  export const SearchableMultiTagSelectFieldInputElement = styled(FieldInput) `
16
- width: 100%;
17
15
  `;
18
16
  export const SearchableMultiTagSelectFieldBadgeContainer = styled.div `
19
17
  font-family: ${(props) => props.theme.typography.fontFamily.base};
@@ -8,5 +8,4 @@ export const TextAreaFieldInput = styled(FieldInput) `
8
8
  font-size: ${(props) => props.theme.typography.size.base};
9
9
  min-height: 5rem;
10
10
  padding: ${(props) => props.theme.spacing.s};
11
- width: 95%;
12
11
  `;
@@ -1,6 +1,10 @@
1
1
  import { styled } from "styled-components";
2
2
  import { readableColor } from "polished";
3
3
  export const CommonFieldWrapper = styled.div `
4
+
5
+ display: flex;
6
+ flex-direction: column;
7
+
4
8
  input {
5
9
  background-color: ${(props) => props.theme.color.background.input};
6
10
  border-radius: ${(props) => props.theme.borderRadius.none};
@@ -15,6 +19,9 @@ export const CommonFieldWrapper = styled.div `
15
19
  color: ${(props) => props.theme.color.text.muted};
16
20
  }
17
21
 
22
+ &:read-only {
23
+ }
24
+
18
25
  &:focus {
19
26
  ${(props) => props.theme.focus.default};
20
27
  }
@@ -49,6 +56,10 @@ export const CommonFieldWrapper = styled.div `
49
56
  background-repeat: no-repeat;
50
57
  background-size: ${(props) => props.theme.spacing.l}; auto;
51
58
 
59
+ &:read-only {
60
+
61
+ }
62
+
52
63
  &:focus {
53
64
  ${(props) => props.theme.focus.default};
54
65
  }
@@ -163,5 +174,9 @@ export const CommonCheckboxStyles = styled.div `
163
174
  transform: scale(1);
164
175
  }
165
176
  }
177
+
178
+ &:read-only {
179
+
180
+ }
166
181
  }
167
182
  `;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolwenture/formik-jsonschema-form",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Formik form generation from json schema",
5
5
  "author": "anttivikman <antti.vikman@nolwenture.com>",
6
6
  "contributors": [