@digigov/react-core 0.5.2 → 0.6.0

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.
Files changed (123) hide show
  1. package/ArrowIcon/__snapshots__/index.test.tsx.snap +67 -0
  2. package/ArrowIcon/index.d.ts +15 -0
  3. package/ArrowIcon/index.js +73 -0
  4. package/ArrowIcon/index.test.d.ts +1 -0
  5. package/ArrowIcon/index.test.js +39 -0
  6. package/BackLink/index.d.ts +1 -1
  7. package/BackLink/index.js +5 -3
  8. package/BurgerIcon/__snapshots__/index.test.tsx.snap +146 -30
  9. package/BurgerIcon/index.d.ts +9 -3
  10. package/BurgerIcon/index.js +50 -11
  11. package/BurgerIcon/index.test.js +32 -6
  12. package/Button/index.d.ts +1 -1
  13. package/ButtonLink/index.d.ts +1 -1
  14. package/CHANGELOG.md +31 -1
  15. package/CallToAction/index.d.ts +1 -1
  16. package/CallToAction/index.js +3 -8
  17. package/CaretIcon/__snapshots__/index.test.tsx.snap +67 -0
  18. package/CaretIcon/index.d.ts +15 -0
  19. package/CaretIcon/index.js +73 -0
  20. package/CaretIcon/index.test.d.ts +1 -0
  21. package/CaretIcon/index.test.js +39 -0
  22. package/CheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  23. package/CheckIcon/index.d.ts +19 -0
  24. package/CheckIcon/index.js +68 -0
  25. package/CheckIcon/index.test.d.ts +1 -0
  26. package/CheckIcon/index.test.js +129 -0
  27. package/CheckboxItem/index.d.ts +1 -1
  28. package/CloseIcon/__snapshots__/index.test.tsx.snap +16 -0
  29. package/CloseIcon/index.d.ts +10 -0
  30. package/CloseIcon/index.js +42 -0
  31. package/CloseIcon/index.test.d.ts +1 -0
  32. package/CloseIcon/index.test.js +15 -0
  33. package/DateInputItem/index.d.ts +2 -2
  34. package/DateInputItem/index.js +5 -5
  35. package/Fieldset/index.d.ts +1 -1
  36. package/FileUpload/index.d.ts +1 -1
  37. package/FooterContainer/index.d.ts +8 -1
  38. package/FooterContainer/index.js +4 -2
  39. package/FooterImage/index.d.ts +1 -1
  40. package/FooterLink/index.d.ts +1 -1
  41. package/GovGRLogo/index.d.ts +1 -1
  42. package/Grid/index.d.ts +1 -1
  43. package/HeaderLogo/index.d.ts +1 -1
  44. package/HeaderSecondaryLogo/index.d.ts +1 -1
  45. package/HeaderTitle/index.d.ts +1 -1
  46. package/HellenicRepublicLogo/index.d.ts +1 -1
  47. package/Link/index.d.ts +1 -1
  48. package/MoreVertIcon/__snapshots__/index.test.tsx.snap +436 -0
  49. package/MoreVertIcon/index.d.ts +19 -0
  50. package/MoreVertIcon/index.js +82 -0
  51. package/MoreVertIcon/index.test.d.ts +1 -0
  52. package/MoreVertIcon/index.test.js +129 -0
  53. package/NavHorizontalListItem/index.d.ts +1 -1
  54. package/NavVerticalItem/index.d.ts +1 -1
  55. package/NormalText/index.d.ts +1 -1
  56. package/NotificationBannerLink/index.d.ts +1 -1
  57. package/Paragraph/index.d.ts +1 -1
  58. package/RadioItem/index.d.ts +1 -1
  59. package/Select/index.d.ts +1 -1
  60. package/Table/index.d.ts +1 -1
  61. package/TabsListItem/index.d.ts +1 -1
  62. package/TextArea/index.d.ts +1 -1
  63. package/TextInput/index.d.ts +1 -1
  64. package/UncheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  65. package/UncheckIcon/index.d.ts +19 -0
  66. package/UncheckIcon/index.js +68 -0
  67. package/UncheckIcon/index.test.d.ts +1 -0
  68. package/UncheckIcon/index.test.js +129 -0
  69. package/es/ArrowIcon/__snapshots__/index.test.tsx.snap +67 -0
  70. package/es/ArrowIcon/index.js +50 -0
  71. package/es/ArrowIcon/index.test.js +33 -0
  72. package/es/BackLink/index.js +4 -3
  73. package/es/BurgerIcon/__snapshots__/index.test.tsx.snap +146 -30
  74. package/es/BurgerIcon/index.js +42 -11
  75. package/es/BurgerIcon/index.test.js +32 -6
  76. package/es/CallToAction/index.js +2 -8
  77. package/es/CaretIcon/__snapshots__/index.test.tsx.snap +67 -0
  78. package/es/CaretIcon/index.js +50 -0
  79. package/es/CaretIcon/index.test.js +33 -0
  80. package/es/CheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  81. package/es/CheckIcon/index.js +45 -0
  82. package/es/CheckIcon/index.test.js +123 -0
  83. package/es/CloseIcon/__snapshots__/index.test.tsx.snap +16 -0
  84. package/es/CloseIcon/index.js +27 -0
  85. package/es/CloseIcon/index.test.js +9 -0
  86. package/es/DateInputItem/index.js +5 -5
  87. package/es/FooterContainer/index.js +4 -2
  88. package/es/MoreVertIcon/__snapshots__/index.test.tsx.snap +436 -0
  89. package/es/MoreVertIcon/index.js +59 -0
  90. package/es/MoreVertIcon/index.test.js +123 -0
  91. package/es/UncheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  92. package/es/UncheckIcon/index.js +45 -0
  93. package/es/UncheckIcon/index.test.js +123 -0
  94. package/es/index.js +6 -0
  95. package/esm/ArrowIcon/__snapshots__/index.test.tsx.snap +67 -0
  96. package/esm/ArrowIcon/index.js +50 -0
  97. package/esm/ArrowIcon/index.test.js +33 -0
  98. package/esm/BackLink/index.js +4 -3
  99. package/esm/BurgerIcon/__snapshots__/index.test.tsx.snap +146 -30
  100. package/esm/BurgerIcon/index.js +42 -11
  101. package/esm/BurgerIcon/index.test.js +32 -6
  102. package/esm/CallToAction/index.js +2 -8
  103. package/esm/CaretIcon/__snapshots__/index.test.tsx.snap +67 -0
  104. package/esm/CaretIcon/index.js +50 -0
  105. package/esm/CaretIcon/index.test.js +33 -0
  106. package/esm/CheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  107. package/esm/CheckIcon/index.js +45 -0
  108. package/esm/CheckIcon/index.test.js +123 -0
  109. package/esm/CloseIcon/__snapshots__/index.test.tsx.snap +16 -0
  110. package/esm/CloseIcon/index.js +27 -0
  111. package/esm/CloseIcon/index.test.js +9 -0
  112. package/esm/DateInputItem/index.js +5 -5
  113. package/esm/FooterContainer/index.js +4 -2
  114. package/esm/MoreVertIcon/__snapshots__/index.test.tsx.snap +436 -0
  115. package/esm/MoreVertIcon/index.js +59 -0
  116. package/esm/MoreVertIcon/index.test.js +123 -0
  117. package/esm/UncheckIcon/__snapshots__/index.test.tsx.snap +256 -0
  118. package/esm/UncheckIcon/index.js +45 -0
  119. package/esm/UncheckIcon/index.test.js +123 -0
  120. package/esm/index.js +7 -1
  121. package/index.d.ts +6 -0
  122. package/index.js +48 -0
  123. package/package.json +3 -3
@@ -1,59 +1,175 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`renders the BurgerIcon with active=false 1`] = `
3
+ exports[`renders the BurgerIcon prop variant= "light" 1`] = `
4
4
  <ForwardRef(BurgerIcon)
5
- active={false}
5
+ variant="light"
6
6
  >
7
- <div
8
- className="govgr-burger-menu govgr-burger-menu--white-bg"
7
+ <svg
8
+ aria-hidden="true"
9
+ className="govgr-svg-icon--light govgr-burger-icon"
10
+ focusable="false"
11
+ viewBox="0 0 24 24"
9
12
  >
10
- <div
11
- className="govgr-burger-menu__line1"
13
+ <rect
14
+ height="3.3"
15
+ id="govgr-burger-icon__line-1"
16
+ width="20"
12
17
  />
13
- <div
14
- className="govgr-burger-menu__line2"
18
+ <rect
19
+ height="3.3"
20
+ id="govgr-burger-icon__line-2"
21
+ width="20"
15
22
  />
16
- <div
17
- className="govgr-burger-menu__line3"
23
+ <rect
24
+ height="3.3"
25
+ id="govgr-burger-icon__line-3"
26
+ width="20"
18
27
  />
19
- </div>
28
+ </svg>
20
29
  </ForwardRef(BurgerIcon)>
21
30
  `;
22
31
 
23
- exports[`renders the BurgerIcon with active=true 1`] = `
32
+ exports[`renders the BurgerIcon props active hidden="md" variant= "light" 1`] = `
24
33
  <ForwardRef(BurgerIcon)
25
34
  active={true}
35
+ variant="light"
26
36
  >
27
- <div
28
- className="govgr-burger-menu--active govgr-burger-menu govgr-burger-menu--white-bg"
37
+ <svg
38
+ aria-hidden="true"
39
+ className="govgr-svg-icon--light govgr-burger-icon--active govgr-burger-icon"
40
+ focusable="false"
41
+ viewBox="0 0 24 24"
29
42
  >
30
- <div
31
- className="govgr-burger-menu__line1"
43
+ <rect
44
+ height="3.3"
45
+ id="govgr-burger-icon__line-1"
46
+ width="20"
32
47
  />
33
- <div
34
- className="govgr-burger-menu__line2"
48
+ <rect
49
+ height="3.3"
50
+ id="govgr-burger-icon__line-2"
51
+ width="20"
35
52
  />
36
- <div
37
- className="govgr-burger-menu__line3"
53
+ <rect
54
+ height="3.3"
55
+ id="govgr-burger-icon__line-3"
56
+ width="20"
38
57
  />
39
- </div>
58
+ </svg>
40
59
  </ForwardRef(BurgerIcon)>
41
60
  `;
42
61
 
43
62
  exports[`renders the BurgerIcon with no props 1`] = `
44
63
  <ForwardRef(BurgerIcon)>
45
- <div
46
- className="govgr-burger-menu govgr-burger-menu--white-bg"
64
+ <svg
65
+ aria-hidden="true"
66
+ className="govgr-burger-icon"
67
+ focusable="false"
68
+ viewBox="0 0 24 24"
47
69
  >
48
- <div
49
- className="govgr-burger-menu__line1"
70
+ <rect
71
+ height="3.3"
72
+ id="govgr-burger-icon__line-1"
73
+ width="20"
50
74
  />
51
- <div
52
- className="govgr-burger-menu__line2"
75
+ <rect
76
+ height="3.3"
77
+ id="govgr-burger-icon__line-2"
78
+ width="20"
53
79
  />
54
- <div
55
- className="govgr-burger-menu__line3"
80
+ <rect
81
+ height="3.3"
82
+ id="govgr-burger-icon__line-3"
83
+ width="20"
56
84
  />
57
- </div>
85
+ </svg>
86
+ </ForwardRef(BurgerIcon)>
87
+ `;
88
+
89
+ exports[`renders the BurgerIcon with prop active=true 1`] = `
90
+ <ForwardRef(BurgerIcon)
91
+ active={true}
92
+ >
93
+ <svg
94
+ aria-hidden="true"
95
+ className="govgr-burger-icon--active govgr-burger-icon"
96
+ focusable="false"
97
+ viewBox="0 0 24 24"
98
+ >
99
+ <rect
100
+ height="3.3"
101
+ id="govgr-burger-icon__line-1"
102
+ width="20"
103
+ />
104
+ <rect
105
+ height="3.3"
106
+ id="govgr-burger-icon__line-2"
107
+ width="20"
108
+ />
109
+ <rect
110
+ height="3.3"
111
+ id="govgr-burger-icon__line-3"
112
+ width="20"
113
+ />
114
+ </svg>
115
+ </ForwardRef(BurgerIcon)>
116
+ `;
117
+
118
+ exports[`renders the BurgerIcon with prop variant=dark 1`] = `
119
+ <ForwardRef(BurgerIcon)
120
+ variant="dark"
121
+ >
122
+ <svg
123
+ aria-hidden="true"
124
+ className="govgr-svg-icon--dark govgr-burger-icon"
125
+ focusable="false"
126
+ viewBox="0 0 24 24"
127
+ >
128
+ <rect
129
+ height="3.3"
130
+ id="govgr-burger-icon__line-1"
131
+ width="20"
132
+ />
133
+ <rect
134
+ height="3.3"
135
+ id="govgr-burger-icon__line-2"
136
+ width="20"
137
+ />
138
+ <rect
139
+ height="3.3"
140
+ id="govgr-burger-icon__line-3"
141
+ width="20"
142
+ />
143
+ </svg>
144
+ </ForwardRef(BurgerIcon)>
145
+ `;
146
+
147
+ exports[`renders the BurgerIcon with props active hidden=md and variant="dark" 1`] = `
148
+ <ForwardRef(BurgerIcon)
149
+ active={true}
150
+ variant="dark"
151
+ >
152
+ <svg
153
+ aria-hidden="true"
154
+ className="govgr-svg-icon--dark govgr-burger-icon--active govgr-burger-icon"
155
+ focusable="false"
156
+ viewBox="0 0 24 24"
157
+ >
158
+ <rect
159
+ height="3.3"
160
+ id="govgr-burger-icon__line-1"
161
+ width="20"
162
+ />
163
+ <rect
164
+ height="3.3"
165
+ id="govgr-burger-icon__line-2"
166
+ width="20"
167
+ />
168
+ <rect
169
+ height="3.3"
170
+ id="govgr-burger-icon__line-3"
171
+ width="20"
172
+ />
173
+ </svg>
58
174
  </ForwardRef(BurgerIcon)>
59
175
  `;
@@ -1,9 +1,28 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["active", "className"];
4
- import React from 'react';
4
+ var _excluded = ["active", "className", "variant"];
5
+ import React, { useEffect, useState } from 'react';
5
6
  import clsx from 'clsx';
6
7
 
8
+ var _ref2 = /*#__PURE__*/React.createElement("rect", {
9
+ id: "govgr-burger-icon__line-1",
10
+ width: "20",
11
+ height: "3.3"
12
+ });
13
+
14
+ var _ref3 = /*#__PURE__*/React.createElement("rect", {
15
+ id: "govgr-burger-icon__line-2",
16
+ width: "20",
17
+ height: "3.3"
18
+ });
19
+
20
+ var _ref4 = /*#__PURE__*/React.createElement("rect", {
21
+ id: "govgr-burger-icon__line-3",
22
+ width: "20",
23
+ height: "3.3"
24
+ });
25
+
7
26
  /**
8
27
  * BurgerIcon is used inside the Header component.
9
28
  * It should be linked with the NavHorizontal component. It is hidden when the NavHorizontal is visible and vice versa.
@@ -11,17 +30,29 @@ import clsx from 'clsx';
11
30
  export var BurgerIcon = /*#__PURE__*/React.forwardRef(function BurgerIcon(_ref, ref) {
12
31
  var active = _ref.active,
13
32
  className = _ref.className,
33
+ variant = _ref.variant,
14
34
  props = _objectWithoutProperties(_ref, _excluded);
15
35
 
16
- return /*#__PURE__*/React.createElement("div", _extends({
36
+ var _useState = useState(active),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ iconActive = _useState2[0],
39
+ setActive = _useState2[1];
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({
17
51
  ref: ref,
18
- className: clsx(className, active === true && 'govgr-burger-menu--active', true && ['govgr-burger-menu', 'govgr-burger-menu--white-bg'])
19
- }, props), /*#__PURE__*/React.createElement("div", {
20
- className: clsx(true && 'govgr-burger-menu__line1')
21
- }), /*#__PURE__*/React.createElement("div", {
22
- className: clsx(true && 'govgr-burger-menu__line2')
23
- }), /*#__PURE__*/React.createElement("div", {
24
- className: clsx(true && 'govgr-burger-menu__line3')
25
- }));
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"
56
+ }, props), _ref2, _ref3, _ref4);
26
57
  });
27
58
  export default BurgerIcon;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { mount } from 'enzyme';
3
3
  import BurgerIcon from '@digigov/react-core/BurgerIcon';
4
4
 
5
- var _ref = /*#__PURE__*/React.createElement(BurgerIcon, null, "hello");
5
+ var _ref = /*#__PURE__*/React.createElement(BurgerIcon, null);
6
6
 
7
7
  it('renders the BurgerIcon with no props', function () {
8
8
  expect(mount(_ref)).toMatchSnapshot();
@@ -10,16 +10,42 @@ it('renders the BurgerIcon with no props', function () {
10
10
 
11
11
  var _ref2 = /*#__PURE__*/React.createElement(BurgerIcon, {
12
12
  active: true
13
- }, "hello");
13
+ });
14
14
 
15
- it('renders the BurgerIcon with active=true', function () {
15
+ it('renders the BurgerIcon with prop active=true', function () {
16
16
  expect(mount(_ref2)).toMatchSnapshot();
17
17
  });
18
18
 
19
19
  var _ref3 = /*#__PURE__*/React.createElement(BurgerIcon, {
20
- active: false
21
- }, "hello");
20
+ variant: "dark"
21
+ });
22
22
 
23
- it('renders the BurgerIcon with active=false', function () {
23
+ it('renders the BurgerIcon with prop variant=dark', function () {
24
24
  expect(mount(_ref3)).toMatchSnapshot();
25
+ });
26
+
27
+ var _ref4 = /*#__PURE__*/React.createElement(BurgerIcon, {
28
+ variant: "light"
29
+ });
30
+
31
+ it('renders the BurgerIcon prop variant= "light"', function () {
32
+ expect(mount(_ref4)).toMatchSnapshot();
33
+ });
34
+
35
+ var _ref5 = /*#__PURE__*/React.createElement(BurgerIcon, {
36
+ active: true,
37
+ variant: "dark"
38
+ });
39
+
40
+ it('renders the BurgerIcon with props active hidden=md and variant="dark"', function () {
41
+ expect(mount(_ref5)).toMatchSnapshot();
42
+ });
43
+
44
+ var _ref6 = /*#__PURE__*/React.createElement(BurgerIcon, {
45
+ active: true,
46
+ variant: "light"
47
+ });
48
+
49
+ it('renders the BurgerIcon props active hidden="md" variant= "light"', function () {
50
+ expect(mount(_ref6)).toMatchSnapshot();
25
51
  });
@@ -4,15 +4,9 @@ var _excluded = ["className", "children"];
4
4
  import React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import ButtonLink from '@digigov/react-core/ButtonLink';
7
+ import ArrowIcon from '@digigov/react-core/ArrowIcon';
7
8
 
8
- var _ref2 = /*#__PURE__*/React.createElement("svg", {
9
- className: "govgr-btn-cta__arrow",
10
- focusable: "false",
11
- viewBox: "0 0 24 24",
12
- "aria-hidden": "true"
13
- }, /*#__PURE__*/React.createElement("path", {
14
- d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
15
- }));
9
+ var _ref2 = /*#__PURE__*/React.createElement(ArrowIcon, null);
16
10
 
17
11
  /**
18
12
  * Use this button for the main call to action on your service’s start page.
@@ -0,0 +1,67 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`renders the CaretIcon with direction down prop 1`] = `
4
+ <ForwardRef(CaretIcon)
5
+ direction="down"
6
+ >
7
+ <svg
8
+ aria-hidden="true"
9
+ className="govgr-caret--down"
10
+ focusable="false"
11
+ viewBox="0 0 24 24"
12
+ >
13
+ <path
14
+ d="M22,6H2l10,12L22,6z"
15
+ />
16
+ </svg>
17
+ </ForwardRef(CaretIcon)>
18
+ `;
19
+
20
+ exports[`renders the CaretIcon with direction right prop 1`] = `
21
+ <ForwardRef(CaretIcon)
22
+ direction="right"
23
+ >
24
+ <svg
25
+ aria-hidden="true"
26
+ className="govgr-caret--right"
27
+ focusable="false"
28
+ viewBox="0 0 24 24"
29
+ >
30
+ <path
31
+ d="M6,2v20l12-10L6,2z"
32
+ />
33
+ </svg>
34
+ </ForwardRef(CaretIcon)>
35
+ `;
36
+
37
+ exports[`renders the CaretIcon with direction up prop 1`] = `
38
+ <ForwardRef(CaretIcon)
39
+ direction="up"
40
+ >
41
+ <svg
42
+ aria-hidden="true"
43
+ className="govgr-caret--up"
44
+ focusable="false"
45
+ viewBox="0 0 24 24"
46
+ >
47
+ <path
48
+ d="M2,18h20L12,6L2,18z"
49
+ />
50
+ </svg>
51
+ </ForwardRef(CaretIcon)>
52
+ `;
53
+
54
+ exports[`renders the CaretIcon with no props, direction prop is left by default 1`] = `
55
+ <ForwardRef(CaretIcon)>
56
+ <svg
57
+ aria-hidden="true"
58
+ className="govgr-caret--left"
59
+ focusable="false"
60
+ viewBox="0 0 24 24"
61
+ >
62
+ <path
63
+ d="M18,22V2L6,12L18,22z"
64
+ />
65
+ </svg>
66
+ </ForwardRef(CaretIcon)>
67
+ `;
@@ -0,0 +1,50 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["direction", "className"];
5
+ import React, { useEffect, useState } from 'react';
6
+ import clsx from 'clsx';
7
+
8
+ var _ref2 = /*#__PURE__*/React.createElement("path", {
9
+ d: "M18,22V2L6,12L18,22z"
10
+ });
11
+
12
+ var _ref3 = /*#__PURE__*/React.createElement("path", {
13
+ d: "M6,2v20l12-10L6,2z"
14
+ });
15
+
16
+ var _ref4 = /*#__PURE__*/React.createElement("path", {
17
+ d: "M2,18h20L12,6L2,18z"
18
+ });
19
+
20
+ var _ref5 = /*#__PURE__*/React.createElement("path", {
21
+ d: "M22,6H2l10,12L22,6z"
22
+ });
23
+
24
+ /**
25
+ * CaretIcon component is used to add caret icon.
26
+ * CaretIcon can be used inside other components, for example BackLink component.
27
+ */
28
+ export var CaretIcon = /*#__PURE__*/React.forwardRef(function CaretIcon(_ref, ref) {
29
+ var _ref$direction = _ref.direction,
30
+ direction = _ref$direction === void 0 ? 'left' : _ref$direction,
31
+ className = _ref.className,
32
+ props = _objectWithoutProperties(_ref, _excluded);
33
+
34
+ var _useState = useState(direction),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ caretDirection = _useState2[0],
37
+ setDirection = _useState2[1];
38
+
39
+ useEffect(function () {
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);
49
+ });
50
+ export default CaretIcon;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import CaretIcon from '@digigov/react-core/CaretIcon';
4
+
5
+ var _ref = /*#__PURE__*/React.createElement(CaretIcon, null);
6
+
7
+ it('renders the CaretIcon with no props, direction prop is left by default', function () {
8
+ expect(mount(_ref)).toMatchSnapshot();
9
+ });
10
+
11
+ var _ref2 = /*#__PURE__*/React.createElement(CaretIcon, {
12
+ direction: "right"
13
+ });
14
+
15
+ it('renders the CaretIcon with direction right prop', function () {
16
+ expect(mount(_ref2)).toMatchSnapshot();
17
+ });
18
+
19
+ var _ref3 = /*#__PURE__*/React.createElement(CaretIcon, {
20
+ direction: "up"
21
+ });
22
+
23
+ it('renders the CaretIcon with direction up prop', function () {
24
+ expect(mount(_ref3)).toMatchSnapshot();
25
+ });
26
+
27
+ var _ref4 = /*#__PURE__*/React.createElement(CaretIcon, {
28
+ direction: "down"
29
+ });
30
+
31
+ it('renders the CaretIcon with direction down prop', function () {
32
+ expect(mount(_ref4)).toMatchSnapshot();
33
+ });