@nolwenture/formik-jsonschema-form 1.0.0-beta.16 → 1.0.0-beta.17

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 CHANGED
@@ -630,7 +630,7 @@ const collapsibleSchema: Schema = {
630
630
  };
631
631
 
632
632
  const collapsibleUiSchema: UiSchema = {
633
- colObject: { props: { isCollapsible: true } },
633
+ colObject: { "ui:props": { isCollapsible: true } },
634
634
  };
635
635
  ```
636
636
 
@@ -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
- word-wrap: break-word;
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
- background: ${(props) => props.theme.color.intent.default.none};
67
- border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.intent.default.none}`};
68
- border-radius: ${(props) => props.theme.borderRadius.none};
69
- color: ${(props) => (0, polished_1.readableColor)(props.theme.color.text.default)};
70
- cursor: default;
71
- padding: ${(props) => `${props.theme.spacing.xs} ${props.theme.spacing.s}`};
72
- text-align: center;
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?.props?.isCollapsible
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 || {}));
@@ -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
- select {
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
- font-family: ${(props) => props.theme.typography.fontFamily.base};
196
- font-size: ${(props) => props.theme.typography.size.base};
197
- font-weight: ${(props) => props.theme.typography.weight.normal};
198
- padding: ${(props) => `${props.theme.spacing.s}`};
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
- &:focus {
201
- ${(props) => props.theme.focus.default};
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 {
@@ -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, isCollapsedOnLoad = true, openIcon, collapsedIcon, ariaLabel,
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?.props?.isCollapsible
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
- word-wrap: break-word;
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
- background: ${(props) => props.theme.color.intent.default.none};
64
- border: ${(props) => `${props.theme.strokeWidth.thin} solid ${props.theme.color.intent.default.none}`};
65
- border-radius: ${(props) => props.theme.borderRadius.none};
66
- color: ${(props) => readableColor(props.theme.color.text.default)};
67
- cursor: default;
68
- padding: ${(props) => `${props.theme.spacing.xs} ${props.theme.spacing.s}`};
69
- text-align: center;
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?.props?.isCollapsible
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 || {}));
@@ -183,21 +183,38 @@ export const commonRadioStyles = css `
183
183
  }
184
184
  `;
185
185
  export const commonSelectStyles = css `
186
- select {
187
- background-color: ${(props) => props.theme.color.background.input};
188
- border-radius: ${(props) => props.theme.borderRadius.none};
189
- border: ${(props) => `${props.theme.strokeWidth.thin} solid
190
- ${props.theme.color.border.default}`};
191
- color: ${(props) => props.theme.color.text.default};
192
- font-family: ${(props) => props.theme.typography.fontFamily.base};
193
- font-size: ${(props) => props.theme.typography.size.base};
194
- font-weight: ${(props) => props.theme.typography.weight.normal};
195
- padding: ${(props) => `${props.theme.spacing.s}`};
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
- &:focus {
198
- ${(props) => props.theme.focus.default};
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 {
@@ -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, isCollapsedOnLoad = true, openIcon, collapsedIcon, ariaLabel,
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?.props?.isCollapsible
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolwenture/formik-jsonschema-form",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "Formik form generation from json schema",
5
5
  "author": "anttivikman <antti.vikman@nolwenture.com>",
6
6
  "contributors": [