@nolwenture/formik-jsonschema-form 1.2.3 → 1.2.4

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.
@@ -10,6 +10,11 @@ exports.MultipleChoiceFieldContainer = (0, styled_components_1.default)(styledCo
10
10
  font-family: ${(props) => props.theme.typography.fontFamily.base};
11
11
  flex-wrap: wrap;
12
12
  justify-content: start;
13
+
14
+ &:has(input[readonly]) {
15
+ flex-direction: column;
16
+ gap: ${(props) => props.theme.spacing.s};
17
+ }
13
18
  `;
14
19
  exports.MultipleChoiceFieldElement = (0, styled_components_1.default)(styledComponents_1.RadioFieldElement) ``;
15
20
  exports.MultipleChoiceFieldInputElement = (0, styled_components_1.default)(styledComponents_1.RadioFieldInputElement) ``;
@@ -10,6 +10,11 @@ exports.RadioFieldContainer = (0, styled_components_1.styled)(common_1.CommonChe
10
10
  display: flex;
11
11
  font-family: ${(props) => props.theme.typography.fontFamily.base};
12
12
  gap: ${(props) => props.theme.spacing.l};
13
+
14
+ &:has(input[readonly]) {
15
+ flex-direction: column;
16
+ gap: ${(props) => props.theme.spacing.xxs};
17
+ }
13
18
 
14
19
  input[type="radio"] {
15
20
  -webkit-appearance: none;
@@ -52,7 +57,6 @@ exports.RadioFieldContainer = (0, styled_components_1.styled)(common_1.CommonChe
52
57
 
53
58
  &[readonly] {
54
59
  background-color: transparent;
55
- border: none;
56
60
  }
57
61
  }
58
62
  `;
@@ -248,7 +248,6 @@ exports.CommonCheckboxStyles = styled_components_1.styled.div `
248
248
 
249
249
  &[readonly] {
250
250
  background: transparent;
251
- border: none;
252
251
  }
253
252
 
254
253
  &:disabled {
@@ -3,19 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
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;
6
+ exports.MultipleChoiceFieldValue = exports.BooleanFieldValue = exports.MultipleChoiceFieldWrapper = exports.BooleanFieldWrapper = exports.NotSelectedIcon = exports.SelectedIcon = exports.EJSFieldValue = exports.ArrayFieldItem = exports.TextAreaValue = exports.StringFieldValue = exports.FieldDescription = exports.FieldTitle = exports.FieldWrapper = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const styledComponents_1 = require("../../Form/fields/MultipleChoiceField/styledComponents");
10
10
  const getStyle_1 = require("../../utils/getStyle");
11
+ const fa_1 = require("react-icons/fa");
11
12
  exports.FieldWrapper = styled_components_1.default.div `
12
13
  color: ${(props) => props.theme.color.text.default};
13
14
  font-family: ${(props) => props.theme.typography.fontFamily.base};
14
15
  margin: ${(props) => `0 0 ${props.theme.spacing.s} 0 `};
15
16
  width: min(100%, 70rem);
16
- -webkit-column-break-inside: avoid;
17
- page-break-inside: avoid;
18
- break-inside: avoid;
19
17
  `;
20
18
  exports.FieldTitle = styled_components_1.default.label `
21
19
  color: ${(props) => props.theme.color.text.default};
@@ -67,7 +65,6 @@ exports.EJSFieldValue = styled_components_1.default.div `
67
65
  width: 100%;
68
66
  `;
69
67
  const NotSelected = styled_components_1.default.div `
70
- opacity: 0.3;
71
68
  display: flex;
72
69
  align-items: start;
73
70
  `;
@@ -75,28 +72,38 @@ const Selected = styled_components_1.default.div `
75
72
  display: flex;
76
73
  align-items: start;
77
74
  `;
78
- const SelectedBox = styled_components_1.default.span `
79
- color: ${(props) => props.theme.color.background.default};
80
- background: ${(props) => props.theme.color.text.default};
81
- padding: ${(props) => `0 ${props.theme.spacing.xs}`};
75
+ const SelectedBox = styled_components_1.default.div `
76
+ color: ${(props) => props.theme.color.text.default};
77
+ background: ${(props) => props.theme.color.background.default};
78
+ border: ${(props) => props.theme.strokeWidth.thin} solid
79
+ ${(props) => props.theme.color.border.default};
80
+ padding: 0 .05rem;
82
81
  font-family: ${(props) => props.theme.typography.fontFamily.base};
83
82
  font-size: ${(props) => props.theme.typography.size.small};
84
- display: inline-flex;
83
+ display: flex;
85
84
  justify-content: center;
86
85
  align-items: start;
87
86
  `;
88
- const NotSelectedCircle = styled_components_1.default.span `
89
- color: ${(props) => props.theme.color.background.default};
90
- background: ${(props) => props.theme.color.text.default};
91
- padding: ${(props) => props.theme.spacing.xxs};
87
+ const NotSelectedCircle = styled_components_1.default.div `
88
+ color: ${(props) => props.theme.color.text.default};
89
+ background: ${(props) => props.theme.color.background.default};
90
+ border: ${(props) => props.theme.strokeWidth.thin} solid
91
+ ${(props) => props.theme.color.border.default};
92
92
  border-radius: ${(props) => props.theme.borderRadius.circle};
93
93
  font-family: ${(props) => props.theme.typography.fontFamily.base};
94
94
  font-size: ${(props) => props.theme.typography.size.small};
95
- line-height: 1.1;
96
95
  display: inline-flex;
97
96
  justify-content: center;
98
97
  align-items: start;
99
- flex: 0 0 1rem;
98
+ padding: 0 .1rem;
99
+ `;
100
+ exports.SelectedIcon = (0, styled_components_1.default)(fa_1.FaCheck) `
101
+ color: ${(props) => props.theme.color.text.default};
102
+ width: .75rem;
103
+ `;
104
+ exports.NotSelectedIcon = (0, styled_components_1.default)(fa_1.FaTimes) `
105
+ color: ${(props) => props.theme.color.text.default};
106
+ width: .75rem;
100
107
  `;
101
108
  exports.BooleanFieldWrapper = styled_components_1.default.div `
102
109
  font-family: ${(props) => props.theme.typography.fontFamily.base};
@@ -117,14 +124,14 @@ exports.MultipleChoiceFieldWrapper = styled_components_1.default.div `
117
124
  break-inside: avoid;
118
125
  `;
119
126
  const BooleanFieldValue = ({ name, className, value, label, }) => {
120
- 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" })] })) }));
127
+ return ((0, jsx_runtime_1.jsx)("div", { className: className, children: value === true ? ((0, jsx_runtime_1.jsxs)(Selected, { children: [(0, jsx_runtime_1.jsx)(SelectedBox, { children: (0, jsx_runtime_1.jsx)(exports.SelectedIcon, {}) }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: label !== undefined ? label : "Selected" })] })) : ((0, jsx_runtime_1.jsxs)(Selected, { children: [(0, jsx_runtime_1.jsx)(SelectedBox, { children: (0, jsx_runtime_1.jsx)(exports.NotSelectedIcon, {}) }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: label !== undefined ? label : "Not selected" })] })) }));
121
128
  };
122
129
  exports.BooleanFieldValue = BooleanFieldValue;
123
130
  const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
124
131
  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 &&
125
132
  selected.length > 0 &&
126
- selected.map((s) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { "data-fjsf-enum-value-view": s.const, 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 &&
133
+ selected.map((s) => ((0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldElement, { "data-fjsf-enum-value-view": s.const, children: (0, jsx_runtime_1.jsxs)(Selected, { children: [(0, jsx_runtime_1.jsx)(SelectedBox, { children: (0, jsx_runtime_1.jsx)(exports.SelectedIcon, {}) }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
127
134
  notSelected?.length > 0 &&
128
- 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)))] }) }));
135
+ 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: (0, jsx_runtime_1.jsx)(exports.NotSelectedIcon, {}) }), (0, jsx_runtime_1.jsx)(styledComponents_1.MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }) }));
129
136
  };
130
137
  exports.MultipleChoiceFieldValue = MultipleChoiceFieldValue;
@@ -4,6 +4,11 @@ export const MultipleChoiceFieldContainer = styled(RadioFieldContainer) `
4
4
  font-family: ${(props) => props.theme.typography.fontFamily.base};
5
5
  flex-wrap: wrap;
6
6
  justify-content: start;
7
+
8
+ &:has(input[readonly]) {
9
+ flex-direction: column;
10
+ gap: ${(props) => props.theme.spacing.s};
11
+ }
7
12
  `;
8
13
  export const MultipleChoiceFieldElement = styled(RadioFieldElement) ``;
9
14
  export const MultipleChoiceFieldInputElement = styled(RadioFieldInputElement) ``;
@@ -7,6 +7,11 @@ export const RadioFieldContainer = styled(CommonCheckboxStyles) `
7
7
  display: flex;
8
8
  font-family: ${(props) => props.theme.typography.fontFamily.base};
9
9
  gap: ${(props) => props.theme.spacing.l};
10
+
11
+ &:has(input[readonly]) {
12
+ flex-direction: column;
13
+ gap: ${(props) => props.theme.spacing.xxs};
14
+ }
10
15
 
11
16
  input[type="radio"] {
12
17
  -webkit-appearance: none;
@@ -49,7 +54,6 @@ export const RadioFieldContainer = styled(CommonCheckboxStyles) `
49
54
 
50
55
  &[readonly] {
51
56
  background-color: transparent;
52
- border: none;
53
57
  }
54
58
  }
55
59
  `;
@@ -245,7 +245,6 @@ export const CommonCheckboxStyles = styled.div `
245
245
 
246
246
  &[readonly] {
247
247
  background: transparent;
248
- border: none;
249
248
  }
250
249
 
251
250
  &:disabled {
@@ -2,14 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import styled from "styled-components";
3
3
  import { MultipleChoiceFieldContainer, MultipleChoiceFieldElement, MultipleChoiceFieldLabel, } from "../../Form/fields/MultipleChoiceField/styledComponents";
4
4
  import { getStyle } from "../../utils/getStyle";
5
+ import { FaCheck, FaTimes } from "react-icons/fa";
5
6
  export const FieldWrapper = styled.div `
6
7
  color: ${(props) => props.theme.color.text.default};
7
8
  font-family: ${(props) => props.theme.typography.fontFamily.base};
8
9
  margin: ${(props) => `0 0 ${props.theme.spacing.s} 0 `};
9
10
  width: min(100%, 70rem);
10
- -webkit-column-break-inside: avoid;
11
- page-break-inside: avoid;
12
- break-inside: avoid;
13
11
  `;
14
12
  export const FieldTitle = styled.label `
15
13
  color: ${(props) => props.theme.color.text.default};
@@ -61,7 +59,6 @@ export const EJSFieldValue = styled.div `
61
59
  width: 100%;
62
60
  `;
63
61
  const NotSelected = styled.div `
64
- opacity: 0.3;
65
62
  display: flex;
66
63
  align-items: start;
67
64
  `;
@@ -69,28 +66,38 @@ const Selected = styled.div `
69
66
  display: flex;
70
67
  align-items: start;
71
68
  `;
72
- const SelectedBox = styled.span `
73
- color: ${(props) => props.theme.color.background.default};
74
- background: ${(props) => props.theme.color.text.default};
75
- padding: ${(props) => `0 ${props.theme.spacing.xs}`};
69
+ const SelectedBox = styled.div `
70
+ color: ${(props) => props.theme.color.text.default};
71
+ background: ${(props) => props.theme.color.background.default};
72
+ border: ${(props) => props.theme.strokeWidth.thin} solid
73
+ ${(props) => props.theme.color.border.default};
74
+ padding: 0 .05rem;
76
75
  font-family: ${(props) => props.theme.typography.fontFamily.base};
77
76
  font-size: ${(props) => props.theme.typography.size.small};
78
- display: inline-flex;
77
+ display: flex;
79
78
  justify-content: center;
80
79
  align-items: start;
81
80
  `;
82
- const NotSelectedCircle = styled.span `
83
- color: ${(props) => props.theme.color.background.default};
84
- background: ${(props) => props.theme.color.text.default};
85
- padding: ${(props) => props.theme.spacing.xxs};
81
+ const NotSelectedCircle = styled.div `
82
+ color: ${(props) => props.theme.color.text.default};
83
+ background: ${(props) => props.theme.color.background.default};
84
+ border: ${(props) => props.theme.strokeWidth.thin} solid
85
+ ${(props) => props.theme.color.border.default};
86
86
  border-radius: ${(props) => props.theme.borderRadius.circle};
87
87
  font-family: ${(props) => props.theme.typography.fontFamily.base};
88
88
  font-size: ${(props) => props.theme.typography.size.small};
89
- line-height: 1.1;
90
89
  display: inline-flex;
91
90
  justify-content: center;
92
91
  align-items: start;
93
- flex: 0 0 1rem;
92
+ padding: 0 .1rem;
93
+ `;
94
+ export const SelectedIcon = styled(FaCheck) `
95
+ color: ${(props) => props.theme.color.text.default};
96
+ width: .75rem;
97
+ `;
98
+ export const NotSelectedIcon = styled(FaTimes) `
99
+ color: ${(props) => props.theme.color.text.default};
100
+ width: .75rem;
94
101
  `;
95
102
  export const BooleanFieldWrapper = styled.div `
96
103
  font-family: ${(props) => props.theme.typography.fontFamily.base};
@@ -111,12 +118,12 @@ export const MultipleChoiceFieldWrapper = styled.div `
111
118
  break-inside: avoid;
112
119
  `;
113
120
  export const BooleanFieldValue = ({ name, className, value, label, }) => {
114
- 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" })] })) }));
121
+ return (_jsx("div", { className: className, children: value === true ? (_jsxs(Selected, { children: [_jsx(SelectedBox, { children: _jsx(SelectedIcon, {}) }), _jsx(MultipleChoiceFieldLabel, { children: label !== undefined ? label : "Selected" })] })) : (_jsxs(Selected, { children: [_jsx(SelectedBox, { children: _jsx(NotSelectedIcon, {}) }), _jsx(MultipleChoiceFieldLabel, { children: label !== undefined ? label : "Not selected" })] })) }));
115
122
  };
116
123
  export const MultipleChoiceFieldValue = ({ inputProps, name, className, style, selected, notSelected }) => {
117
124
  return (_jsx(MultipleChoiceFieldWrapper, { children: _jsxs(MultipleChoiceFieldContainer, { className: className, style: getStyle(style ?? ""), children: [!selected && !notSelected && _jsx(_Fragment, { children: "Nothing was selected" }), selected &&
118
125
  selected.length > 0 &&
119
- selected.map((s) => (_jsx(MultipleChoiceFieldElement, { "data-fjsf-enum-value-view": s.const, children: _jsxs(Selected, { children: [_jsx(SelectedBox, { children: "\u2713" }), _jsx(MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
126
+ selected.map((s) => (_jsx(MultipleChoiceFieldElement, { "data-fjsf-enum-value-view": s.const, children: _jsxs(Selected, { children: [_jsx(SelectedBox, { children: _jsx(SelectedIcon, {}) }), _jsx(MultipleChoiceFieldLabel, { children: s.title ?? "Hello" })] }) }, s.title ?? s))), notSelected &&
120
127
  notSelected?.length > 0 &&
121
- notSelected.map((n) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(NotSelected, { children: [_jsx(NotSelectedCircle, { children: "\u2715" }), _jsx(MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }) }));
128
+ notSelected.map((n) => (_jsx(MultipleChoiceFieldElement, { children: _jsxs(NotSelected, { children: [_jsx(NotSelectedCircle, { children: _jsx(NotSelectedIcon, {}) }), _jsx(MultipleChoiceFieldLabel, { children: n.title })] }) }, n.title ?? n)))] }) }));
122
129
  };
@@ -7,6 +7,8 @@ export declare const StringFieldValue: import("styled-components/dist/types").IS
7
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
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
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 SelectedIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-icons").IconBaseProps, never>> & string & Omit<import("react-icons").IconType, keyof React.Component<any, {}, any>>;
11
+ export declare const NotSelectedIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-icons").IconBaseProps, never>> & string & Omit<import("react-icons").IconType, keyof React.Component<any, {}, any>>;
10
12
  export declare const BooleanFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
11
13
  export declare const MultipleChoiceFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
12
14
  type BooleanValueFieldProps = {
@@ -12,6 +12,8 @@ export declare const components: {
12
12
  TextAreaValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
13
  ArrayFieldItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
14
14
  EJSFieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
15
+ SelectedIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-icons").IconBaseProps, never>> & string & Omit<import("react-icons").IconType, keyof import("react").Component<any, {}, any>>;
16
+ NotSelectedIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react-icons").IconBaseProps, never>> & string & Omit<import("react-icons").IconType, keyof import("react").Component<any, {}, any>>;
15
17
  BooleanFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
18
  MultipleChoiceFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
19
  BooleanFieldValue: React.FC<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolwenture/formik-jsonschema-form",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Formik form generation from json schema",
5
5
  "author": "anttivikman <antti.vikman@nolwenture.com>",
6
6
  "contributors": [