@digigov/react-core 0.21.0 → 0.21.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/CHANGELOG.md +8 -1
- package/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/CheckboxItem/index.d.ts +5 -0
- package/CheckboxItem/index.js +6 -3
- package/CheckboxItem/index.test.js +18 -0
- package/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/RadioItem/index.d.ts +5 -0
- package/RadioItem/index.js +6 -3
- package/RadioItem/index.test.js +18 -0
- package/es/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/es/CheckboxItem/index.js +6 -3
- package/es/CheckboxItem/index.test.js +18 -0
- package/es/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/es/RadioItem/index.js +6 -3
- package/es/RadioItem/index.test.js +18 -0
- package/esm/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/esm/CheckboxItem/index.js +6 -3
- package/esm/CheckboxItem/index.test.js +18 -0
- package/esm/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/esm/RadioItem/index.js +6 -3
- package/esm/RadioItem/index.test.js +18 -0
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/src/CheckboxItem/__snapshots__/index.test.tsx.snap +68 -0
- package/src/CheckboxItem/index.test.tsx +14 -0
- package/src/CheckboxItem/index.tsx +11 -1
- package/src/RadioItem/__snapshots__/index.test.tsx.snap +70 -0
- package/src/RadioItem/index.test.tsx +14 -0
- package/src/RadioItem/index.tsx +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @digigov/react-core
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 13 Mar 2023 10:21:39 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.21.1
|
|
6
|
+
Mon, 13 Mar 2023 10:21:39 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- add disabled prop and corresponding class for CheckboxItem and RadioItem components
|
|
4
11
|
|
|
5
12
|
## 0.21.0
|
|
6
13
|
Thu, 02 Mar 2023 11:33:41 GMT
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders the CheckboxItem with \`disabled\` prop 1`] = `
|
|
4
|
+
<ForwardRef(CheckboxItem)
|
|
5
|
+
disabled={true}
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="govgr-checkboxes__item"
|
|
9
|
+
>
|
|
10
|
+
<label
|
|
11
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
12
|
+
>
|
|
13
|
+
hello
|
|
14
|
+
<ForwardRef(Base)
|
|
15
|
+
as="input"
|
|
16
|
+
className="govgr-checkboxes__input"
|
|
17
|
+
disabled={true}
|
|
18
|
+
type="checkbox"
|
|
19
|
+
>
|
|
20
|
+
<input
|
|
21
|
+
className="govgr-checkboxes__input"
|
|
22
|
+
disabled={true}
|
|
23
|
+
type="checkbox"
|
|
24
|
+
/>
|
|
25
|
+
</ForwardRef(Base)>
|
|
26
|
+
</label>
|
|
27
|
+
</div>
|
|
28
|
+
</ForwardRef(CheckboxItem)>
|
|
29
|
+
`;
|
|
30
|
+
|
|
3
31
|
exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
4
32
|
<ForwardRef(CheckboxItem)
|
|
5
33
|
name="example"
|
|
@@ -14,13 +42,49 @@ exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
|
14
42
|
<ForwardRef(Base)
|
|
15
43
|
as="input"
|
|
16
44
|
className="govgr-checkboxes__input"
|
|
45
|
+
disabled={false}
|
|
46
|
+
name="example"
|
|
47
|
+
type="checkbox"
|
|
48
|
+
>
|
|
49
|
+
<input
|
|
50
|
+
className="govgr-checkboxes__input"
|
|
51
|
+
disabled={false}
|
|
52
|
+
name="example"
|
|
53
|
+
type="checkbox"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(CheckboxItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports[`renders the CheckboxItem with \`value\` \`name\` and \`disabled\` props 1`] = `
|
|
62
|
+
<ForwardRef(CheckboxItem)
|
|
63
|
+
disabled={true}
|
|
64
|
+
name="example"
|
|
65
|
+
value="example"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
className="govgr-checkboxes__item"
|
|
69
|
+
>
|
|
70
|
+
<label
|
|
71
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
72
|
+
>
|
|
73
|
+
hello
|
|
74
|
+
<ForwardRef(Base)
|
|
75
|
+
as="input"
|
|
76
|
+
className="govgr-checkboxes__input"
|
|
77
|
+
disabled={true}
|
|
17
78
|
name="example"
|
|
18
79
|
type="checkbox"
|
|
80
|
+
value="example"
|
|
19
81
|
>
|
|
20
82
|
<input
|
|
21
83
|
className="govgr-checkboxes__input"
|
|
84
|
+
disabled={true}
|
|
22
85
|
name="example"
|
|
23
86
|
type="checkbox"
|
|
87
|
+
value="example"
|
|
24
88
|
/>
|
|
25
89
|
</ForwardRef(Base)>
|
|
26
90
|
</label>
|
|
@@ -42,11 +106,13 @@ exports[`renders the CheckboxItem with \`value\` prop 1`] = `
|
|
|
42
106
|
<ForwardRef(Base)
|
|
43
107
|
as="input"
|
|
44
108
|
className="govgr-checkboxes__input"
|
|
109
|
+
disabled={false}
|
|
45
110
|
type="checkbox"
|
|
46
111
|
value="example"
|
|
47
112
|
>
|
|
48
113
|
<input
|
|
49
114
|
className="govgr-checkboxes__input"
|
|
115
|
+
disabled={false}
|
|
50
116
|
type="checkbox"
|
|
51
117
|
value="example"
|
|
52
118
|
/>
|
|
@@ -68,10 +134,12 @@ exports[`renders the CheckboxItem with no props 1`] = `
|
|
|
68
134
|
<ForwardRef(Base)
|
|
69
135
|
as="input"
|
|
70
136
|
className="govgr-checkboxes__input"
|
|
137
|
+
disabled={false}
|
|
71
138
|
type="checkbox"
|
|
72
139
|
>
|
|
73
140
|
<input
|
|
74
141
|
className="govgr-checkboxes__input"
|
|
142
|
+
disabled={false}
|
|
75
143
|
type="checkbox"
|
|
76
144
|
/>
|
|
77
145
|
</ForwardRef(Base)>
|
package/CheckboxItem/index.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface CheckboxItemProps extends BaseProps<'input'> {
|
|
|
9
9
|
* Value property is optional and it specifies the value of an <input> element.
|
|
10
10
|
*/
|
|
11
11
|
value?: string;
|
|
12
|
+
/**
|
|
13
|
+
* disabled prop disables the checkbox input.
|
|
14
|
+
* disabled property is optional and it is false by default.
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Details for the CheckboxItem.
|
package/CheckboxItem/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
|
|
|
17
17
|
|
|
18
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["name", "value", "className", "children"];
|
|
20
|
+
var _excluded = ["name", "value", "className", "disabled", "children"];
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Details for the CheckboxItem.
|
|
@@ -28,19 +28,22 @@ var CheckboxItem = /*#__PURE__*/_react["default"].forwardRef(function CheckboxIt
|
|
|
28
28
|
var name = _ref.name,
|
|
29
29
|
value = _ref.value,
|
|
30
30
|
className = _ref.className,
|
|
31
|
+
_ref$disabled = _ref.disabled,
|
|
32
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
31
33
|
children = _ref.children,
|
|
32
34
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
33
35
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
36
|
className: (0, _clsx["default"])(className, true && 'govgr-checkboxes__item')
|
|
35
37
|
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
36
|
-
className: (0, _clsx["default"])(true && 'govgr-label govgr-checkboxes__label')
|
|
38
|
+
className: (0, _clsx["default"])(disabled === true && 'govgr-checkboxes__label--disabled', true && 'govgr-label govgr-checkboxes__label')
|
|
37
39
|
}, children, /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
|
|
38
40
|
as: "input",
|
|
39
41
|
ref: ref,
|
|
40
42
|
type: "checkbox",
|
|
41
43
|
name: name,
|
|
42
44
|
value: value,
|
|
43
|
-
className: (0, _clsx["default"])(true && 'govgr-checkboxes__input')
|
|
45
|
+
className: (0, _clsx["default"])(true && 'govgr-checkboxes__input'),
|
|
46
|
+
disabled: disabled
|
|
44
47
|
}, props))));
|
|
45
48
|
});
|
|
46
49
|
|
|
@@ -28,4 +28,22 @@ var _ref3 = /*#__PURE__*/_react["default"].createElement(_CheckboxItem["default"
|
|
|
28
28
|
|
|
29
29
|
it('renders the CheckboxItem with `value` prop', function () {
|
|
30
30
|
expect((0, _enzyme.mount)(_ref3)).toMatchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ref4 = /*#__PURE__*/_react["default"].createElement(_CheckboxItem["default"], {
|
|
34
|
+
disabled: true
|
|
35
|
+
}, "hello");
|
|
36
|
+
|
|
37
|
+
it('renders the CheckboxItem with `disabled` prop', function () {
|
|
38
|
+
expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var _ref5 = /*#__PURE__*/_react["default"].createElement(_CheckboxItem["default"], {
|
|
42
|
+
value: "example",
|
|
43
|
+
name: "example",
|
|
44
|
+
disabled: true
|
|
45
|
+
}, "hello");
|
|
46
|
+
|
|
47
|
+
it('renders the CheckboxItem with `value` `name` and `disabled` props', function () {
|
|
48
|
+
expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
|
|
31
49
|
});
|
|
@@ -14,11 +14,13 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
14
14
|
<ForwardRef(Base)
|
|
15
15
|
as="input"
|
|
16
16
|
className="govgr-radios__input"
|
|
17
|
+
disabled={false}
|
|
17
18
|
type="radio"
|
|
18
19
|
value="someValue"
|
|
19
20
|
>
|
|
20
21
|
<input
|
|
21
22
|
className="govgr-radios__input"
|
|
23
|
+
disabled={false}
|
|
22
24
|
type="radio"
|
|
23
25
|
value="someValue"
|
|
24
26
|
/>
|
|
@@ -28,6 +30,34 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
28
30
|
</ForwardRef(RadioItem)>
|
|
29
31
|
`;
|
|
30
32
|
|
|
33
|
+
exports[`renders the RadioItem with disabled prop 1`] = `
|
|
34
|
+
<ForwardRef(RadioItem)
|
|
35
|
+
disabled={true}
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
className="govgr-radios__item"
|
|
39
|
+
>
|
|
40
|
+
<label
|
|
41
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
42
|
+
>
|
|
43
|
+
hello
|
|
44
|
+
<ForwardRef(Base)
|
|
45
|
+
as="input"
|
|
46
|
+
className="govgr-radios__input"
|
|
47
|
+
disabled={true}
|
|
48
|
+
type="radio"
|
|
49
|
+
>
|
|
50
|
+
<input
|
|
51
|
+
className="govgr-radios__input"
|
|
52
|
+
disabled={true}
|
|
53
|
+
type="radio"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(RadioItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
31
61
|
exports[`renders the RadioItem with name props 1`] = `
|
|
32
62
|
<ForwardRef(RadioItem)
|
|
33
63
|
name="name"
|
|
@@ -42,11 +72,13 @@ exports[`renders the RadioItem with name props 1`] = `
|
|
|
42
72
|
<ForwardRef(Base)
|
|
43
73
|
as="input"
|
|
44
74
|
className="govgr-radios__input"
|
|
75
|
+
disabled={false}
|
|
45
76
|
name="name"
|
|
46
77
|
type="radio"
|
|
47
78
|
>
|
|
48
79
|
<input
|
|
49
80
|
className="govgr-radios__input"
|
|
81
|
+
disabled={false}
|
|
50
82
|
name="name"
|
|
51
83
|
type="radio"
|
|
52
84
|
/>
|
|
@@ -71,12 +103,48 @@ exports[`renders the RadioItem with name and value props 1`] = `
|
|
|
71
103
|
<ForwardRef(Base)
|
|
72
104
|
as="input"
|
|
73
105
|
className="govgr-radios__input"
|
|
106
|
+
disabled={false}
|
|
107
|
+
name="name"
|
|
108
|
+
type="radio"
|
|
109
|
+
value="someValue"
|
|
110
|
+
>
|
|
111
|
+
<input
|
|
112
|
+
className="govgr-radios__input"
|
|
113
|
+
disabled={false}
|
|
114
|
+
name="name"
|
|
115
|
+
type="radio"
|
|
116
|
+
value="someValue"
|
|
117
|
+
/>
|
|
118
|
+
</ForwardRef(Base)>
|
|
119
|
+
</label>
|
|
120
|
+
</div>
|
|
121
|
+
</ForwardRef(RadioItem)>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`renders the RadioItem with name disabled and value props 1`] = `
|
|
125
|
+
<ForwardRef(RadioItem)
|
|
126
|
+
disabled={true}
|
|
127
|
+
name="name"
|
|
128
|
+
value="someValue"
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
className="govgr-radios__item"
|
|
132
|
+
>
|
|
133
|
+
<label
|
|
134
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
135
|
+
>
|
|
136
|
+
hello
|
|
137
|
+
<ForwardRef(Base)
|
|
138
|
+
as="input"
|
|
139
|
+
className="govgr-radios__input"
|
|
140
|
+
disabled={true}
|
|
74
141
|
name="name"
|
|
75
142
|
type="radio"
|
|
76
143
|
value="someValue"
|
|
77
144
|
>
|
|
78
145
|
<input
|
|
79
146
|
className="govgr-radios__input"
|
|
147
|
+
disabled={true}
|
|
80
148
|
name="name"
|
|
81
149
|
type="radio"
|
|
82
150
|
value="someValue"
|
|
@@ -99,10 +167,12 @@ exports[`renders the RadioItem with no props 1`] = `
|
|
|
99
167
|
<ForwardRef(Base)
|
|
100
168
|
as="input"
|
|
101
169
|
className="govgr-radios__input"
|
|
170
|
+
disabled={false}
|
|
102
171
|
type="radio"
|
|
103
172
|
>
|
|
104
173
|
<input
|
|
105
174
|
className="govgr-radios__input"
|
|
175
|
+
disabled={false}
|
|
106
176
|
type="radio"
|
|
107
177
|
/>
|
|
108
178
|
</ForwardRef(Base)>
|
package/RadioItem/index.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface RadioItemProps extends BaseProps<'input'> {
|
|
|
9
9
|
* Value property is optional and it specifies the value of an <input> element.
|
|
10
10
|
*/
|
|
11
11
|
value?: string;
|
|
12
|
+
/**
|
|
13
|
+
* disabled prop disables the radio input.
|
|
14
|
+
* disabled property is optional and it is false by default.
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* RadioItem component is used for display radio buttons.
|
package/RadioItem/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
|
|
|
17
17
|
|
|
18
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["name", "value", "className", "children"];
|
|
20
|
+
var _excluded = ["name", "value", "className", "disabled", "children"];
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* RadioItem component is used for display radio buttons.
|
|
@@ -27,19 +27,22 @@ var RadioItem = /*#__PURE__*/_react["default"].forwardRef(function RadioItem(_re
|
|
|
27
27
|
var name = _ref.name,
|
|
28
28
|
value = _ref.value,
|
|
29
29
|
className = _ref.className,
|
|
30
|
+
_ref$disabled = _ref.disabled,
|
|
31
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
30
32
|
children = _ref.children,
|
|
31
33
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
32
34
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
33
35
|
className: (0, _clsx["default"])(className, true && 'govgr-radios__item')
|
|
34
36
|
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
35
|
-
className: (0, _clsx["default"])(true && 'govgr-label govgr-radios__label')
|
|
37
|
+
className: (0, _clsx["default"])(disabled === true && 'govgr-radios__label--disabled', true && 'govgr-label govgr-radios__label')
|
|
36
38
|
}, children, /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
|
|
37
39
|
as: "input",
|
|
38
40
|
ref: ref,
|
|
39
41
|
type: "radio",
|
|
40
42
|
name: name,
|
|
41
43
|
value: value,
|
|
42
|
-
className: (0, _clsx["default"])(true && 'govgr-radios__input')
|
|
44
|
+
className: (0, _clsx["default"])(true && 'govgr-radios__input'),
|
|
45
|
+
disabled: disabled
|
|
43
46
|
}, props))));
|
|
44
47
|
});
|
|
45
48
|
|
package/RadioItem/index.test.js
CHANGED
|
@@ -37,4 +37,22 @@ var _ref4 = /*#__PURE__*/_react["default"].createElement(_RadioItem["default"],
|
|
|
37
37
|
|
|
38
38
|
it('renders the RadioItem with name and value props', function () {
|
|
39
39
|
expect((0, _enzyme.mount)(_ref4)).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var _ref5 = /*#__PURE__*/_react["default"].createElement(_RadioItem["default"], {
|
|
43
|
+
disabled: true
|
|
44
|
+
}, "hello");
|
|
45
|
+
|
|
46
|
+
it('renders the RadioItem with disabled prop', function () {
|
|
47
|
+
expect((0, _enzyme.mount)(_ref5)).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
var _ref6 = /*#__PURE__*/_react["default"].createElement(_RadioItem["default"], {
|
|
51
|
+
name: 'name',
|
|
52
|
+
value: 'someValue',
|
|
53
|
+
disabled: true
|
|
54
|
+
}, "hello");
|
|
55
|
+
|
|
56
|
+
it('renders the RadioItem with name disabled and value props', function () {
|
|
57
|
+
expect((0, _enzyme.mount)(_ref6)).toMatchSnapshot();
|
|
40
58
|
});
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders the CheckboxItem with \`disabled\` prop 1`] = `
|
|
4
|
+
<ForwardRef(CheckboxItem)
|
|
5
|
+
disabled={true}
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
className="govgr-checkboxes__item"
|
|
9
|
+
>
|
|
10
|
+
<label
|
|
11
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
12
|
+
>
|
|
13
|
+
hello
|
|
14
|
+
<ForwardRef(Base)
|
|
15
|
+
as="input"
|
|
16
|
+
className="govgr-checkboxes__input"
|
|
17
|
+
disabled={true}
|
|
18
|
+
type="checkbox"
|
|
19
|
+
>
|
|
20
|
+
<input
|
|
21
|
+
className="govgr-checkboxes__input"
|
|
22
|
+
disabled={true}
|
|
23
|
+
type="checkbox"
|
|
24
|
+
/>
|
|
25
|
+
</ForwardRef(Base)>
|
|
26
|
+
</label>
|
|
27
|
+
</div>
|
|
28
|
+
</ForwardRef(CheckboxItem)>
|
|
29
|
+
`;
|
|
30
|
+
|
|
3
31
|
exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
4
32
|
<ForwardRef(CheckboxItem)
|
|
5
33
|
name="example"
|
|
@@ -14,13 +42,49 @@ exports[`renders the CheckboxItem with \`name\` prop 1`] = `
|
|
|
14
42
|
<ForwardRef(Base)
|
|
15
43
|
as="input"
|
|
16
44
|
className="govgr-checkboxes__input"
|
|
45
|
+
disabled={false}
|
|
46
|
+
name="example"
|
|
47
|
+
type="checkbox"
|
|
48
|
+
>
|
|
49
|
+
<input
|
|
50
|
+
className="govgr-checkboxes__input"
|
|
51
|
+
disabled={false}
|
|
52
|
+
name="example"
|
|
53
|
+
type="checkbox"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(CheckboxItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports[`renders the CheckboxItem with \`value\` \`name\` and \`disabled\` props 1`] = `
|
|
62
|
+
<ForwardRef(CheckboxItem)
|
|
63
|
+
disabled={true}
|
|
64
|
+
name="example"
|
|
65
|
+
value="example"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
className="govgr-checkboxes__item"
|
|
69
|
+
>
|
|
70
|
+
<label
|
|
71
|
+
className="govgr-checkboxes__label--disabled govgr-label govgr-checkboxes__label"
|
|
72
|
+
>
|
|
73
|
+
hello
|
|
74
|
+
<ForwardRef(Base)
|
|
75
|
+
as="input"
|
|
76
|
+
className="govgr-checkboxes__input"
|
|
77
|
+
disabled={true}
|
|
17
78
|
name="example"
|
|
18
79
|
type="checkbox"
|
|
80
|
+
value="example"
|
|
19
81
|
>
|
|
20
82
|
<input
|
|
21
83
|
className="govgr-checkboxes__input"
|
|
84
|
+
disabled={true}
|
|
22
85
|
name="example"
|
|
23
86
|
type="checkbox"
|
|
87
|
+
value="example"
|
|
24
88
|
/>
|
|
25
89
|
</ForwardRef(Base)>
|
|
26
90
|
</label>
|
|
@@ -42,11 +106,13 @@ exports[`renders the CheckboxItem with \`value\` prop 1`] = `
|
|
|
42
106
|
<ForwardRef(Base)
|
|
43
107
|
as="input"
|
|
44
108
|
className="govgr-checkboxes__input"
|
|
109
|
+
disabled={false}
|
|
45
110
|
type="checkbox"
|
|
46
111
|
value="example"
|
|
47
112
|
>
|
|
48
113
|
<input
|
|
49
114
|
className="govgr-checkboxes__input"
|
|
115
|
+
disabled={false}
|
|
50
116
|
type="checkbox"
|
|
51
117
|
value="example"
|
|
52
118
|
/>
|
|
@@ -68,10 +134,12 @@ exports[`renders the CheckboxItem with no props 1`] = `
|
|
|
68
134
|
<ForwardRef(Base)
|
|
69
135
|
as="input"
|
|
70
136
|
className="govgr-checkboxes__input"
|
|
137
|
+
disabled={false}
|
|
71
138
|
type="checkbox"
|
|
72
139
|
>
|
|
73
140
|
<input
|
|
74
141
|
className="govgr-checkboxes__input"
|
|
142
|
+
disabled={false}
|
|
75
143
|
type="checkbox"
|
|
76
144
|
/>
|
|
77
145
|
</ForwardRef(Base)>
|
package/es/CheckboxItem/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["name", "value", "className", "children"];
|
|
3
|
+
var _excluded = ["name", "value", "className", "disabled", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Base from '@digigov/react-core/Base';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -14,20 +14,23 @@ export var CheckboxItem = /*#__PURE__*/React.forwardRef(function CheckboxItem(_r
|
|
|
14
14
|
var name = _ref.name,
|
|
15
15
|
value = _ref.value,
|
|
16
16
|
className = _ref.className,
|
|
17
|
+
_ref$disabled = _ref.disabled,
|
|
18
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
17
19
|
children = _ref.children,
|
|
18
20
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
21
|
|
|
20
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
23
|
className: clsx(className, true && 'govgr-checkboxes__item')
|
|
22
24
|
}, /*#__PURE__*/React.createElement("label", {
|
|
23
|
-
className: clsx(true && 'govgr-label govgr-checkboxes__label')
|
|
25
|
+
className: clsx(disabled === true && 'govgr-checkboxes__label--disabled', true && 'govgr-label govgr-checkboxes__label')
|
|
24
26
|
}, children, /*#__PURE__*/React.createElement(Base, _extends({
|
|
25
27
|
as: "input",
|
|
26
28
|
ref: ref,
|
|
27
29
|
type: "checkbox",
|
|
28
30
|
name: name,
|
|
29
31
|
value: value,
|
|
30
|
-
className: clsx(true && 'govgr-checkboxes__input')
|
|
32
|
+
className: clsx(true && 'govgr-checkboxes__input'),
|
|
33
|
+
disabled: disabled
|
|
31
34
|
}, props))));
|
|
32
35
|
});
|
|
33
36
|
export default CheckboxItem;
|
|
@@ -22,4 +22,22 @@ var _ref3 = /*#__PURE__*/React.createElement(CheckboxItem, {
|
|
|
22
22
|
|
|
23
23
|
it('renders the CheckboxItem with `value` prop', function () {
|
|
24
24
|
expect(mount(_ref3)).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _ref4 = /*#__PURE__*/React.createElement(CheckboxItem, {
|
|
28
|
+
disabled: true
|
|
29
|
+
}, "hello");
|
|
30
|
+
|
|
31
|
+
it('renders the CheckboxItem with `disabled` prop', function () {
|
|
32
|
+
expect(mount(_ref4)).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var _ref5 = /*#__PURE__*/React.createElement(CheckboxItem, {
|
|
36
|
+
value: "example",
|
|
37
|
+
name: "example",
|
|
38
|
+
disabled: true
|
|
39
|
+
}, "hello");
|
|
40
|
+
|
|
41
|
+
it('renders the CheckboxItem with `value` `name` and `disabled` props', function () {
|
|
42
|
+
expect(mount(_ref5)).toMatchSnapshot();
|
|
25
43
|
});
|
|
@@ -14,11 +14,13 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
14
14
|
<ForwardRef(Base)
|
|
15
15
|
as="input"
|
|
16
16
|
className="govgr-radios__input"
|
|
17
|
+
disabled={false}
|
|
17
18
|
type="radio"
|
|
18
19
|
value="someValue"
|
|
19
20
|
>
|
|
20
21
|
<input
|
|
21
22
|
className="govgr-radios__input"
|
|
23
|
+
disabled={false}
|
|
22
24
|
type="radio"
|
|
23
25
|
value="someValue"
|
|
24
26
|
/>
|
|
@@ -28,6 +30,34 @@ exports[`renders the RadioItem value props 1`] = `
|
|
|
28
30
|
</ForwardRef(RadioItem)>
|
|
29
31
|
`;
|
|
30
32
|
|
|
33
|
+
exports[`renders the RadioItem with disabled prop 1`] = `
|
|
34
|
+
<ForwardRef(RadioItem)
|
|
35
|
+
disabled={true}
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
className="govgr-radios__item"
|
|
39
|
+
>
|
|
40
|
+
<label
|
|
41
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
42
|
+
>
|
|
43
|
+
hello
|
|
44
|
+
<ForwardRef(Base)
|
|
45
|
+
as="input"
|
|
46
|
+
className="govgr-radios__input"
|
|
47
|
+
disabled={true}
|
|
48
|
+
type="radio"
|
|
49
|
+
>
|
|
50
|
+
<input
|
|
51
|
+
className="govgr-radios__input"
|
|
52
|
+
disabled={true}
|
|
53
|
+
type="radio"
|
|
54
|
+
/>
|
|
55
|
+
</ForwardRef(Base)>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</ForwardRef(RadioItem)>
|
|
59
|
+
`;
|
|
60
|
+
|
|
31
61
|
exports[`renders the RadioItem with name props 1`] = `
|
|
32
62
|
<ForwardRef(RadioItem)
|
|
33
63
|
name="name"
|
|
@@ -42,11 +72,13 @@ exports[`renders the RadioItem with name props 1`] = `
|
|
|
42
72
|
<ForwardRef(Base)
|
|
43
73
|
as="input"
|
|
44
74
|
className="govgr-radios__input"
|
|
75
|
+
disabled={false}
|
|
45
76
|
name="name"
|
|
46
77
|
type="radio"
|
|
47
78
|
>
|
|
48
79
|
<input
|
|
49
80
|
className="govgr-radios__input"
|
|
81
|
+
disabled={false}
|
|
50
82
|
name="name"
|
|
51
83
|
type="radio"
|
|
52
84
|
/>
|
|
@@ -71,12 +103,48 @@ exports[`renders the RadioItem with name and value props 1`] = `
|
|
|
71
103
|
<ForwardRef(Base)
|
|
72
104
|
as="input"
|
|
73
105
|
className="govgr-radios__input"
|
|
106
|
+
disabled={false}
|
|
107
|
+
name="name"
|
|
108
|
+
type="radio"
|
|
109
|
+
value="someValue"
|
|
110
|
+
>
|
|
111
|
+
<input
|
|
112
|
+
className="govgr-radios__input"
|
|
113
|
+
disabled={false}
|
|
114
|
+
name="name"
|
|
115
|
+
type="radio"
|
|
116
|
+
value="someValue"
|
|
117
|
+
/>
|
|
118
|
+
</ForwardRef(Base)>
|
|
119
|
+
</label>
|
|
120
|
+
</div>
|
|
121
|
+
</ForwardRef(RadioItem)>
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
exports[`renders the RadioItem with name disabled and value props 1`] = `
|
|
125
|
+
<ForwardRef(RadioItem)
|
|
126
|
+
disabled={true}
|
|
127
|
+
name="name"
|
|
128
|
+
value="someValue"
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
className="govgr-radios__item"
|
|
132
|
+
>
|
|
133
|
+
<label
|
|
134
|
+
className="govgr-radios__label--disabled govgr-label govgr-radios__label"
|
|
135
|
+
>
|
|
136
|
+
hello
|
|
137
|
+
<ForwardRef(Base)
|
|
138
|
+
as="input"
|
|
139
|
+
className="govgr-radios__input"
|
|
140
|
+
disabled={true}
|
|
74
141
|
name="name"
|
|
75
142
|
type="radio"
|
|
76
143
|
value="someValue"
|
|
77
144
|
>
|
|
78
145
|
<input
|
|
79
146
|
className="govgr-radios__input"
|
|
147
|
+
disabled={true}
|
|
80
148
|
name="name"
|
|
81
149
|
type="radio"
|
|
82
150
|
value="someValue"
|
|
@@ -99,10 +167,12 @@ exports[`renders the RadioItem with no props 1`] = `
|
|
|
99
167
|
<ForwardRef(Base)
|
|
100
168
|
as="input"
|
|
101
169
|
className="govgr-radios__input"
|
|
170
|
+
disabled={false}
|
|
102
171
|
type="radio"
|
|
103
172
|
>
|
|
104
173
|
<input
|
|
105
174
|
className="govgr-radios__input"
|
|
175
|
+
disabled={false}
|
|
106
176
|
type="radio"
|
|
107
177
|
/>
|
|
108
178
|
</ForwardRef(Base)>
|