@digigov/react-core 0.6.1 → 0.6.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.
- package/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/ArrowIcon/index.d.ts +4 -3
- package/ArrowIcon/index.js +13 -27
- package/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/BurgerIcon/index.d.ts +13 -7
- package/BurgerIcon/index.js +13 -33
- package/BurgerIcon/index.test.js +47 -5
- package/Button/index.d.ts +1 -1
- package/CHANGELOG.md +9 -1
- package/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/CaretIcon/index.d.ts +4 -3
- package/CaretIcon/index.js +13 -27
- package/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/CheckIcon/index.d.ts +7 -11
- package/CheckIcon/index.js +10 -34
- package/CheckboxItem/index.d.ts +1 -1
- package/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/CloseIcon/index.d.ts +9 -3
- package/CloseIcon/index.js +10 -7
- package/DateInputItem/index.d.ts +1 -1
- package/FieldsetLegend/index.d.ts +1 -1
- package/FileUpload/index.d.ts +1 -1
- package/Grid/index.d.ts +1 -1
- package/LabelTitle/index.d.ts +1 -1
- package/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/MoreVertIcon/index.d.ts +7 -11
- package/MoreVertIcon/index.js +10 -34
- package/NormalText/index.d.ts +1 -1
- package/Paragraph/index.d.ts +1 -1
- package/RadioItem/index.d.ts +1 -1
- package/Select/index.d.ts +1 -1
- package/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/SvgIcon/index.d.ts +20 -0
- package/SvgIcon/index.js +41 -0
- package/SvgIcon/index.test.d.ts +1 -0
- package/SvgIcon/index.test.js +129 -0
- package/Table/index.d.ts +1 -1
- package/TextArea/index.d.ts +1 -1
- package/TextInput/index.d.ts +1 -1
- package/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/UncheckIcon/index.d.ts +9 -13
- package/UncheckIcon/index.js +15 -39
- package/es/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/es/ArrowIcon/index.js +12 -19
- package/es/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/es/BurgerIcon/index.js +12 -25
- package/es/BurgerIcon/index.test.js +47 -5
- package/es/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/es/CaretIcon/index.js +12 -19
- package/es/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/es/CheckIcon/index.js +9 -26
- package/es/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/es/CloseIcon/index.js +9 -7
- package/es/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/es/MoreVertIcon/index.js +9 -26
- package/es/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/es/SvgIcon/index.js +26 -0
- package/es/SvgIcon/index.test.js +123 -0
- package/es/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/es/UncheckIcon/index.js +12 -29
- package/es/index.js +1 -0
- package/esm/ArrowIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/esm/ArrowIcon/index.js +12 -19
- package/esm/BurgerIcon/__snapshots__/index.test.tsx.snap +323 -126
- package/esm/BurgerIcon/index.js +12 -25
- package/esm/BurgerIcon/index.test.js +47 -5
- package/esm/CaretIcon/__snapshots__/index.test.tsx.snap +48 -32
- package/esm/CaretIcon/index.js +12 -19
- package/esm/CheckIcon/__snapshots__/index.test.tsx.snap +196 -136
- package/esm/CheckIcon/index.js +9 -26
- package/esm/CloseIcon/__snapshots__/index.test.tsx.snap +12 -8
- package/esm/CloseIcon/index.js +9 -7
- package/esm/MoreVertIcon/__snapshots__/index.test.tsx.snap +391 -315
- package/esm/MoreVertIcon/index.js +9 -26
- package/esm/SvgIcon/__snapshots__/index.test.tsx.snap +224 -0
- package/esm/SvgIcon/index.js +26 -0
- package/esm/SvgIcon/index.test.js +123 -0
- package/esm/UncheckIcon/__snapshots__/index.test.tsx.snap +241 -165
- package/esm/UncheckIcon/index.js +12 -29
- package/esm/index.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +8 -0
- package/package.json +2 -2
package/esm/BurgerIcon/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["active", "
|
|
5
|
-
import React
|
|
3
|
+
var _excluded = ["variant", "size", "active", "hidden", "className"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import SvgIcon from '@digigov/react-core/SvgIcon';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
|
|
8
8
|
var _ref2 = /*#__PURE__*/React.createElement("rect", {
|
|
@@ -28,31 +28,18 @@ var _ref4 = /*#__PURE__*/React.createElement("rect", {
|
|
|
28
28
|
* It should be linked with the NavHorizontal component. It is hidden when the NavHorizontal is visible and vice versa.
|
|
29
29
|
*/
|
|
30
30
|
export var BurgerIcon = /*#__PURE__*/React.forwardRef(function BurgerIcon(_ref, ref) {
|
|
31
|
-
var
|
|
31
|
+
var variant = _ref.variant,
|
|
32
|
+
size = _ref.size,
|
|
33
|
+
active = _ref.active,
|
|
34
|
+
hidden = _ref.hidden,
|
|
32
35
|
className = _ref.className,
|
|
33
|
-
variant = _ref.variant,
|
|
34
36
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var _useState3 = useState(variant),
|
|
42
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
-
iconVariant = _useState4[0],
|
|
44
|
-
setVariant = _useState4[1];
|
|
45
|
-
|
|
46
|
-
useEffect(function () {
|
|
47
|
-
setActive(active);
|
|
48
|
-
setVariant(variant);
|
|
49
|
-
}, [active, variant]);
|
|
50
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
51
|
-
ref: ref,
|
|
52
|
-
className: clsx(iconVariant === 'light' && 'govgr-svg-icon--light', iconVariant === 'dark' && 'govgr-svg-icon--dark', iconActive === true && 'govgr-burger-icon--active', className && className, true && 'govgr-burger-icon'),
|
|
53
|
-
focusable: "false",
|
|
54
|
-
viewBox: "0 0 24 24",
|
|
55
|
-
"aria-hidden": "true"
|
|
38
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
39
|
+
variant: variant,
|
|
40
|
+
size: size,
|
|
41
|
+
className: clsx(active === true && 'govgr-burger-icon--active', hidden === 's' && 'govgr-burger-icon--hidden-s', hidden === 'm' && 'govgr-burger-icon--hidden-m', hidden === 'l' && 'govgr-burger-icon--hidden-l', className && className, true && 'govgr-burger-icon'),
|
|
42
|
+
ref: ref
|
|
56
43
|
}, props), _ref2, _ref3, _ref4);
|
|
57
44
|
});
|
|
58
45
|
export default BurgerIcon;
|
|
@@ -33,19 +33,61 @@ it('renders the BurgerIcon prop variant= "light"', function () {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
var _ref5 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
36
|
-
|
|
37
|
-
variant: "dark"
|
|
36
|
+
variant: "error"
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
it('renders the BurgerIcon
|
|
39
|
+
it('renders the BurgerIcon prop variant= "error"', function () {
|
|
41
40
|
expect(mount(_ref5)).toMatchSnapshot();
|
|
42
41
|
});
|
|
43
42
|
|
|
44
43
|
var _ref6 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
44
|
+
hidden: "s"
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('renders the BurgerIcon prop hidden="s"', function () {
|
|
48
|
+
expect(mount(_ref6)).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var _ref7 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
52
|
+
hidden: "m"
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('renders the BurgerIcon prop hidden="m"', function () {
|
|
56
|
+
expect(mount(_ref7)).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _ref8 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
60
|
+
hidden: "l"
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('renders the BurgerIcon prop hidden="l"', function () {
|
|
64
|
+
expect(mount(_ref8)).toMatchSnapshot();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
var _ref9 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
68
|
+
active: true,
|
|
69
|
+
hidden: "s",
|
|
70
|
+
variant: "dark"
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('renders the BurgerIcon with props active hidden="s" and variant="dark"', function () {
|
|
74
|
+
expect(mount(_ref9)).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var _ref10 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
78
|
+
hidden: "l",
|
|
79
|
+
variant: "success"
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('renders the BurgerIcon with props hidden="l" and variant="success"', function () {
|
|
83
|
+
expect(mount(_ref10)).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var _ref11 = /*#__PURE__*/React.createElement(BurgerIcon, {
|
|
45
87
|
active: true,
|
|
46
88
|
variant: "light"
|
|
47
89
|
});
|
|
48
90
|
|
|
49
|
-
it('renders the BurgerIcon props active hidden="
|
|
50
|
-
expect(mount(
|
|
91
|
+
it('renders the BurgerIcon props active hidden="no" variant= "light"', function () {
|
|
92
|
+
expect(mount(_ref11)).toMatchSnapshot();
|
|
51
93
|
});
|
|
@@ -4,16 +4,20 @@ exports[`renders the CaretIcon with direction down prop 1`] = `
|
|
|
4
4
|
<ForwardRef(CaretIcon)
|
|
5
5
|
direction="down"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
aria-hidden="true"
|
|
7
|
+
<ForwardRef(SvgIcon)
|
|
9
8
|
className="govgr-caret--down"
|
|
10
|
-
focusable="false"
|
|
11
|
-
viewBox="0 0 24 24"
|
|
12
9
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<svg
|
|
11
|
+
aria-hidden="true"
|
|
12
|
+
className="govgr-svg-icon--dark govgr-svg-icon--m govgr-caret--down govgr-svg-icon"
|
|
13
|
+
focusable="false"
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="M22,6H2l10,12L22,6z"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
</ForwardRef(SvgIcon)>
|
|
17
21
|
</ForwardRef(CaretIcon)>
|
|
18
22
|
`;
|
|
19
23
|
|
|
@@ -21,16 +25,20 @@ exports[`renders the CaretIcon with direction right prop 1`] = `
|
|
|
21
25
|
<ForwardRef(CaretIcon)
|
|
22
26
|
direction="right"
|
|
23
27
|
>
|
|
24
|
-
<
|
|
25
|
-
aria-hidden="true"
|
|
28
|
+
<ForwardRef(SvgIcon)
|
|
26
29
|
className="govgr-caret--right"
|
|
27
|
-
focusable="false"
|
|
28
|
-
viewBox="0 0 24 24"
|
|
29
30
|
>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<svg
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
className="govgr-svg-icon--dark govgr-svg-icon--m govgr-caret--right govgr-svg-icon"
|
|
34
|
+
focusable="false"
|
|
35
|
+
viewBox="0 0 24 24"
|
|
36
|
+
>
|
|
37
|
+
<path
|
|
38
|
+
d="M6,2v20l12-10L6,2z"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
</ForwardRef(SvgIcon)>
|
|
34
42
|
</ForwardRef(CaretIcon)>
|
|
35
43
|
`;
|
|
36
44
|
|
|
@@ -38,30 +46,38 @@ exports[`renders the CaretIcon with direction up prop 1`] = `
|
|
|
38
46
|
<ForwardRef(CaretIcon)
|
|
39
47
|
direction="up"
|
|
40
48
|
>
|
|
41
|
-
<
|
|
42
|
-
aria-hidden="true"
|
|
49
|
+
<ForwardRef(SvgIcon)
|
|
43
50
|
className="govgr-caret--up"
|
|
44
|
-
focusable="false"
|
|
45
|
-
viewBox="0 0 24 24"
|
|
46
51
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
<svg
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
className="govgr-svg-icon--dark govgr-svg-icon--m govgr-caret--up govgr-svg-icon"
|
|
55
|
+
focusable="false"
|
|
56
|
+
viewBox="0 0 24 24"
|
|
57
|
+
>
|
|
58
|
+
<path
|
|
59
|
+
d="M2,18h20L12,6L2,18z"
|
|
60
|
+
/>
|
|
61
|
+
</svg>
|
|
62
|
+
</ForwardRef(SvgIcon)>
|
|
51
63
|
</ForwardRef(CaretIcon)>
|
|
52
64
|
`;
|
|
53
65
|
|
|
54
66
|
exports[`renders the CaretIcon with no props, direction prop is left by default 1`] = `
|
|
55
67
|
<ForwardRef(CaretIcon)>
|
|
56
|
-
<
|
|
57
|
-
aria-hidden="true"
|
|
68
|
+
<ForwardRef(SvgIcon)
|
|
58
69
|
className="govgr-caret--left"
|
|
59
|
-
focusable="false"
|
|
60
|
-
viewBox="0 0 24 24"
|
|
61
70
|
>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
<svg
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
className="govgr-svg-icon--dark govgr-svg-icon--m govgr-caret--left govgr-svg-icon"
|
|
74
|
+
focusable="false"
|
|
75
|
+
viewBox="0 0 24 24"
|
|
76
|
+
>
|
|
77
|
+
<path
|
|
78
|
+
d="M18,22V2L6,12L18,22z"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
</ForwardRef(SvgIcon)>
|
|
66
82
|
</ForwardRef(CaretIcon)>
|
|
67
83
|
`;
|
package/esm/CaretIcon/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["direction", "className"];
|
|
5
|
-
import React
|
|
3
|
+
var _excluded = ["size", "variant", "direction", "className"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import SvgIcon from '@digigov/react-core/SvgIcon';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
|
|
8
8
|
var _ref2 = /*#__PURE__*/React.createElement("path", {
|
|
@@ -26,25 +26,18 @@ var _ref5 = /*#__PURE__*/React.createElement("path", {
|
|
|
26
26
|
* CaretIcon can be used inside other components, for example BackLink component.
|
|
27
27
|
*/
|
|
28
28
|
export var CaretIcon = /*#__PURE__*/React.forwardRef(function CaretIcon(_ref, ref) {
|
|
29
|
-
var
|
|
29
|
+
var size = _ref.size,
|
|
30
|
+
variant = _ref.variant,
|
|
31
|
+
_ref$direction = _ref.direction,
|
|
30
32
|
direction = _ref$direction === void 0 ? 'left' : _ref$direction,
|
|
31
33
|
className = _ref.className,
|
|
32
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setDirection(direction);
|
|
41
|
-
}, [direction]);
|
|
42
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
43
|
-
ref: ref,
|
|
44
|
-
className: clsx(caretDirection === 'right' && 'govgr-caret--right', caretDirection === 'left' && 'govgr-caret--left', caretDirection === 'down' && 'govgr-caret--down', caretDirection === 'up' && 'govgr-caret--up', className && className),
|
|
45
|
-
focusable: "false",
|
|
46
|
-
viewBox: "0 0 24 24",
|
|
47
|
-
"aria-hidden": "true"
|
|
48
|
-
}, props), caretDirection === 'left' && _ref2, caretDirection === 'right' && _ref3, caretDirection === 'up' && _ref4, caretDirection === 'down' && _ref5);
|
|
36
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
37
|
+
size: size,
|
|
38
|
+
variant: variant,
|
|
39
|
+
className: clsx(direction === 'right' && 'govgr-caret--right', direction === 'left' && 'govgr-caret--left', direction === 'down' && 'govgr-caret--down', direction === 'up' && 'govgr-caret--up', className && className),
|
|
40
|
+
ref: ref
|
|
41
|
+
}, props), direction === 'left' && _ref2, direction === 'right' && _ref3, direction === 'up' && _ref4, direction === 'down' && _ref5);
|
|
49
42
|
});
|
|
50
43
|
export default CaretIcon;
|