@digigov/react-core 0.6.1 → 0.6.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.
- 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 +23 -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/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/Dropdown/index.d.ts +30 -0
- package/Dropdown/index.js +42 -0
- package/Dropdown/index.test.d.ts +1 -0
- package/Dropdown/index.test.js +101 -0
- package/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/DropdownButton/index.d.ts +28 -0
- package/DropdownButton/index.js +47 -0
- package/DropdownButton/index.test.d.ts +1 -0
- package/DropdownButton/index.test.js +195 -0
- package/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/DropdownContent/index.d.ts +9 -0
- package/DropdownContent/index.js +35 -0
- package/DropdownContent/index.test.d.ts +1 -0
- package/DropdownContent/index.test.js +15 -0
- 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/TableDataCell/index.d.ts +1 -1
- package/TableHeaderCell/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/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/es/Dropdown/index.js +27 -0
- package/es/Dropdown/index.test.js +95 -0
- package/es/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/es/DropdownButton/index.js +31 -0
- package/es/DropdownButton/index.test.js +189 -0
- package/es/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/es/DropdownContent/index.js +20 -0
- package/es/DropdownContent/index.test.js +9 -0
- 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 +4 -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/Dropdown/__snapshots__/index.test.tsx.snap +144 -0
- package/esm/Dropdown/index.js +27 -0
- package/esm/Dropdown/index.test.js +95 -0
- package/esm/DropdownButton/__snapshots__/index.test.tsx.snap +375 -0
- package/esm/DropdownButton/index.js +31 -0
- package/esm/DropdownButton/index.test.js +189 -0
- package/esm/DropdownContent/__snapshots__/index.test.tsx.snap +11 -0
- package/esm/DropdownContent/index.js +20 -0
- package/esm/DropdownContent/index.test.js +9 -0
- 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 +5 -1
- package/index.d.ts +4 -0
- package/index.js +32 -0
- package/package.json +2 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the Dropdown disabled 1`] = `
|
|
4
|
+
<ForwardRef(Dropdown)
|
|
5
|
+
disabled={true}
|
|
6
|
+
>
|
|
7
|
+
<details
|
|
8
|
+
className="govgr-dropdown--disabled govgr-dropdown"
|
|
9
|
+
>
|
|
10
|
+
hello
|
|
11
|
+
</details>
|
|
12
|
+
</ForwardRef(Dropdown)>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`renders the Dropdown with align=left 1`] = `
|
|
16
|
+
<ForwardRef(Dropdown)
|
|
17
|
+
align="left"
|
|
18
|
+
>
|
|
19
|
+
<details
|
|
20
|
+
className="govgr-dropdown--left govgr-dropdown"
|
|
21
|
+
>
|
|
22
|
+
hello
|
|
23
|
+
</details>
|
|
24
|
+
</ForwardRef(Dropdown)>
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`renders the Dropdown with align=left and open=true 1`] = `
|
|
28
|
+
<ForwardRef(Dropdown)
|
|
29
|
+
align="left"
|
|
30
|
+
open={true}
|
|
31
|
+
>
|
|
32
|
+
<details
|
|
33
|
+
className="govgr-dropdown--left govgr-dropdown"
|
|
34
|
+
open={true}
|
|
35
|
+
>
|
|
36
|
+
hello
|
|
37
|
+
</details>
|
|
38
|
+
</ForwardRef(Dropdown)>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`renders the Dropdown with align=right and open=false 1`] = `
|
|
42
|
+
<ForwardRef(Dropdown)
|
|
43
|
+
align="right"
|
|
44
|
+
open={false}
|
|
45
|
+
>
|
|
46
|
+
<details
|
|
47
|
+
className="govgr-dropdown"
|
|
48
|
+
open={false}
|
|
49
|
+
>
|
|
50
|
+
hello
|
|
51
|
+
</details>
|
|
52
|
+
</ForwardRef(Dropdown)>
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
exports[`renders the Dropdown with no props 1`] = `
|
|
56
|
+
<ForwardRef(Dropdown)>
|
|
57
|
+
<details
|
|
58
|
+
className="govgr-dropdown"
|
|
59
|
+
>
|
|
60
|
+
hello
|
|
61
|
+
</details>
|
|
62
|
+
</ForwardRef(Dropdown)>
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
exports[`renders the Dropdown with open=false 1`] = `
|
|
66
|
+
<ForwardRef(Dropdown)
|
|
67
|
+
open={false}
|
|
68
|
+
>
|
|
69
|
+
<details
|
|
70
|
+
className="govgr-dropdown"
|
|
71
|
+
open={false}
|
|
72
|
+
>
|
|
73
|
+
hello
|
|
74
|
+
</details>
|
|
75
|
+
</ForwardRef(Dropdown)>
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`renders the Dropdown with open=true 1`] = `
|
|
79
|
+
<ForwardRef(Dropdown)
|
|
80
|
+
open={true}
|
|
81
|
+
>
|
|
82
|
+
<details
|
|
83
|
+
className="govgr-dropdown"
|
|
84
|
+
open={true}
|
|
85
|
+
>
|
|
86
|
+
hello
|
|
87
|
+
</details>
|
|
88
|
+
</ForwardRef(Dropdown)>
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
exports[`renders the Dropdown with placement=bottom and open=false 1`] = `
|
|
92
|
+
<ForwardRef(Dropdown)
|
|
93
|
+
open={false}
|
|
94
|
+
placement="bottom"
|
|
95
|
+
>
|
|
96
|
+
<details
|
|
97
|
+
className="govgr-dropdown"
|
|
98
|
+
open={false}
|
|
99
|
+
>
|
|
100
|
+
hello
|
|
101
|
+
</details>
|
|
102
|
+
</ForwardRef(Dropdown)>
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
exports[`renders the Dropdown with placement=top 1`] = `
|
|
106
|
+
<ForwardRef(Dropdown)
|
|
107
|
+
placement="top"
|
|
108
|
+
>
|
|
109
|
+
<details
|
|
110
|
+
className="govgr-dropdown--up govgr-dropdown"
|
|
111
|
+
>
|
|
112
|
+
hello
|
|
113
|
+
</details>
|
|
114
|
+
</ForwardRef(Dropdown)>
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`renders the Dropdown with placement=top align=left and open=true 1`] = `
|
|
118
|
+
<ForwardRef(Dropdown)
|
|
119
|
+
align="left"
|
|
120
|
+
open={true}
|
|
121
|
+
placement="top"
|
|
122
|
+
>
|
|
123
|
+
<details
|
|
124
|
+
className="govgr-dropdown--up govgr-dropdown--left govgr-dropdown"
|
|
125
|
+
open={true}
|
|
126
|
+
>
|
|
127
|
+
hello
|
|
128
|
+
</details>
|
|
129
|
+
</ForwardRef(Dropdown)>
|
|
130
|
+
`;
|
|
131
|
+
|
|
132
|
+
exports[`renders the Dropdown with placement=top and open=true 1`] = `
|
|
133
|
+
<ForwardRef(Dropdown)
|
|
134
|
+
open={true}
|
|
135
|
+
placement="top"
|
|
136
|
+
>
|
|
137
|
+
<details
|
|
138
|
+
className="govgr-dropdown--up govgr-dropdown"
|
|
139
|
+
open={true}
|
|
140
|
+
>
|
|
141
|
+
hello
|
|
142
|
+
</details>
|
|
143
|
+
</ForwardRef(Dropdown)>
|
|
144
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children", "align", "placement", "open", "disabled"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Dropdown is the main component for a dropdown.
|
|
9
|
+
* Inside this component must be DropdownButton and DropdownContent components.
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line react/display-name
|
|
12
|
+
export var Dropdown = /*#__PURE__*/React.forwardRef(function Dropdown(_ref, ref) {
|
|
13
|
+
var className = _ref.className,
|
|
14
|
+
children = _ref.children,
|
|
15
|
+
align = _ref.align,
|
|
16
|
+
placement = _ref.placement,
|
|
17
|
+
open = _ref.open,
|
|
18
|
+
disabled = _ref.disabled,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
|
|
21
|
+
return /*#__PURE__*/React.createElement("details", _extends({
|
|
22
|
+
ref: ref,
|
|
23
|
+
open: open,
|
|
24
|
+
className: clsx(className, placement === 'top' && 'govgr-dropdown--up', disabled === true && 'govgr-dropdown--disabled', align === 'left' && 'govgr-dropdown--left', true && 'govgr-dropdown')
|
|
25
|
+
}, props), children);
|
|
26
|
+
});
|
|
27
|
+
export default Dropdown;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import Dropdown from '@digigov/react-core/Dropdown';
|
|
4
|
+
|
|
5
|
+
var _ref = /*#__PURE__*/React.createElement(Dropdown, null, "hello");
|
|
6
|
+
|
|
7
|
+
it('renders the Dropdown with no props', function () {
|
|
8
|
+
expect(mount(_ref)).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var _ref2 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
12
|
+
disabled: true
|
|
13
|
+
}, "hello");
|
|
14
|
+
|
|
15
|
+
it('renders the Dropdown disabled', function () {
|
|
16
|
+
expect(mount(_ref2)).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _ref3 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
20
|
+
open: true
|
|
21
|
+
}, "hello");
|
|
22
|
+
|
|
23
|
+
it('renders the Dropdown with open=true', function () {
|
|
24
|
+
expect(mount(_ref3)).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _ref4 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
28
|
+
open: false
|
|
29
|
+
}, "hello");
|
|
30
|
+
|
|
31
|
+
it('renders the Dropdown with open=false', function () {
|
|
32
|
+
expect(mount(_ref4)).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var _ref5 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
36
|
+
align: "left"
|
|
37
|
+
}, "hello");
|
|
38
|
+
|
|
39
|
+
it('renders the Dropdown with align=left', function () {
|
|
40
|
+
expect(mount(_ref5)).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var _ref6 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
44
|
+
placement: "top"
|
|
45
|
+
}, "hello");
|
|
46
|
+
|
|
47
|
+
it('renders the Dropdown with placement=top', function () {
|
|
48
|
+
expect(mount(_ref6)).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var _ref7 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
52
|
+
open: true,
|
|
53
|
+
align: "left"
|
|
54
|
+
}, "hello");
|
|
55
|
+
|
|
56
|
+
it('renders the Dropdown with align=left and open=true', function () {
|
|
57
|
+
expect(mount(_ref7)).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
var _ref8 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
61
|
+
open: false,
|
|
62
|
+
align: "right"
|
|
63
|
+
}, "hello");
|
|
64
|
+
|
|
65
|
+
it('renders the Dropdown with align=right and open=false', function () {
|
|
66
|
+
expect(mount(_ref8)).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
var _ref9 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
70
|
+
open: true,
|
|
71
|
+
placement: "top"
|
|
72
|
+
}, "hello");
|
|
73
|
+
|
|
74
|
+
it('renders the Dropdown with placement=top and open=true', function () {
|
|
75
|
+
expect(mount(_ref9)).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
var _ref10 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
79
|
+
open: false,
|
|
80
|
+
placement: "bottom"
|
|
81
|
+
}, "hello");
|
|
82
|
+
|
|
83
|
+
it('renders the Dropdown with placement=bottom and open=false', function () {
|
|
84
|
+
expect(mount(_ref10)).toMatchSnapshot();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
var _ref11 = /*#__PURE__*/React.createElement(Dropdown, {
|
|
88
|
+
open: true,
|
|
89
|
+
placement: "top",
|
|
90
|
+
align: "left"
|
|
91
|
+
}, "hello");
|
|
92
|
+
|
|
93
|
+
it('renders the Dropdown with placement=top align=left and open=true', function () {
|
|
94
|
+
expect(mount(_ref11)).toMatchSnapshot();
|
|
95
|
+
});
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the DropdownButton with arrow=false 1`] = `
|
|
4
|
+
<ForwardRef(DropdownButton)
|
|
5
|
+
arrow={false}
|
|
6
|
+
>
|
|
7
|
+
<summary
|
|
8
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
9
|
+
>
|
|
10
|
+
hello
|
|
11
|
+
</summary>
|
|
12
|
+
</ForwardRef(DropdownButton)>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`renders the DropdownButton with arrow=true 1`] = `
|
|
16
|
+
<ForwardRef(DropdownButton)
|
|
17
|
+
arrow={true}
|
|
18
|
+
>
|
|
19
|
+
<summary
|
|
20
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
21
|
+
>
|
|
22
|
+
hello
|
|
23
|
+
<ForwardRef(ArrowIcon)
|
|
24
|
+
direction="down"
|
|
25
|
+
>
|
|
26
|
+
<ForwardRef(SvgIcon)
|
|
27
|
+
className="govgr-arrow--down"
|
|
28
|
+
>
|
|
29
|
+
<svg
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
32
|
+
focusable="false"
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
39
|
+
</ForwardRef(SvgIcon)>
|
|
40
|
+
</ForwardRef(ArrowIcon)>
|
|
41
|
+
</summary>
|
|
42
|
+
</ForwardRef(DropdownButton)>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`renders the DropdownButton with color=primary 1`] = `
|
|
46
|
+
<ForwardRef(DropdownButton)
|
|
47
|
+
color="primary"
|
|
48
|
+
>
|
|
49
|
+
<summary
|
|
50
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
51
|
+
>
|
|
52
|
+
hello
|
|
53
|
+
</summary>
|
|
54
|
+
</ForwardRef(DropdownButton)>
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
exports[`renders the DropdownButton with color=primary and arrow={false} 1`] = `
|
|
58
|
+
<ForwardRef(DropdownButton)
|
|
59
|
+
arrow={false}
|
|
60
|
+
color="primary"
|
|
61
|
+
>
|
|
62
|
+
<summary
|
|
63
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
64
|
+
>
|
|
65
|
+
hello
|
|
66
|
+
</summary>
|
|
67
|
+
</ForwardRef(DropdownButton)>
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
exports[`renders the DropdownButton with color=primary and arrow={true} 1`] = `
|
|
71
|
+
<ForwardRef(DropdownButton)
|
|
72
|
+
arrow={true}
|
|
73
|
+
color="primary"
|
|
74
|
+
>
|
|
75
|
+
<summary
|
|
76
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
77
|
+
>
|
|
78
|
+
<ForwardRef(ArrowIcon)
|
|
79
|
+
direction="down"
|
|
80
|
+
>
|
|
81
|
+
<ForwardRef(SvgIcon)
|
|
82
|
+
className="govgr-arrow--down"
|
|
83
|
+
>
|
|
84
|
+
<svg
|
|
85
|
+
aria-hidden="true"
|
|
86
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
87
|
+
focusable="false"
|
|
88
|
+
viewBox="0 0 24 24"
|
|
89
|
+
>
|
|
90
|
+
<path
|
|
91
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
</ForwardRef(SvgIcon)>
|
|
95
|
+
</ForwardRef(ArrowIcon)>
|
|
96
|
+
</summary>
|
|
97
|
+
</ForwardRef(DropdownButton)>
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
exports[`renders the DropdownButton with color=primary and variant="button" 1`] = `
|
|
101
|
+
<ForwardRef(DropdownButton)
|
|
102
|
+
color="primary"
|
|
103
|
+
variant="button"
|
|
104
|
+
>
|
|
105
|
+
<summary
|
|
106
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
107
|
+
>
|
|
108
|
+
hello
|
|
109
|
+
</summary>
|
|
110
|
+
</ForwardRef(DropdownButton)>
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
exports[`renders the DropdownButton with color=primary and variant="link" 1`] = `
|
|
114
|
+
<ForwardRef(DropdownButton)
|
|
115
|
+
color="primary"
|
|
116
|
+
variant="link"
|
|
117
|
+
>
|
|
118
|
+
<summary
|
|
119
|
+
className="govgr-link govgr-dropdown__button"
|
|
120
|
+
>
|
|
121
|
+
hello
|
|
122
|
+
</summary>
|
|
123
|
+
</ForwardRef(DropdownButton)>
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
exports[`renders the DropdownButton with color=primary and variant="link" 2`] = `
|
|
127
|
+
<ForwardRef(DropdownButton)
|
|
128
|
+
color="secondary"
|
|
129
|
+
variant="link"
|
|
130
|
+
>
|
|
131
|
+
<summary
|
|
132
|
+
className="govgr-link govgr-dropdown__button"
|
|
133
|
+
>
|
|
134
|
+
hello
|
|
135
|
+
</summary>
|
|
136
|
+
</ForwardRef(DropdownButton)>
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
exports[`renders the DropdownButton with color=primary variant="button" and arrow={false} 1`] = `
|
|
140
|
+
<ForwardRef(DropdownButton)
|
|
141
|
+
arrow={false}
|
|
142
|
+
color="primary"
|
|
143
|
+
variant="button"
|
|
144
|
+
>
|
|
145
|
+
<summary
|
|
146
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
147
|
+
>
|
|
148
|
+
hello
|
|
149
|
+
</summary>
|
|
150
|
+
</ForwardRef(DropdownButton)>
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
exports[`renders the DropdownButton with color=primary variant="button" arrow={true} 1`] = `
|
|
154
|
+
<ForwardRef(DropdownButton)
|
|
155
|
+
arrow={true}
|
|
156
|
+
color="primary"
|
|
157
|
+
variant="button"
|
|
158
|
+
>
|
|
159
|
+
<summary
|
|
160
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
161
|
+
>
|
|
162
|
+
<ForwardRef(ArrowIcon)
|
|
163
|
+
direction="down"
|
|
164
|
+
>
|
|
165
|
+
<ForwardRef(SvgIcon)
|
|
166
|
+
className="govgr-arrow--down"
|
|
167
|
+
>
|
|
168
|
+
<svg
|
|
169
|
+
aria-hidden="true"
|
|
170
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
171
|
+
focusable="false"
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
>
|
|
174
|
+
<path
|
|
175
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
176
|
+
/>
|
|
177
|
+
</svg>
|
|
178
|
+
</ForwardRef(SvgIcon)>
|
|
179
|
+
</ForwardRef(ArrowIcon)>
|
|
180
|
+
</summary>
|
|
181
|
+
</ForwardRef(DropdownButton)>
|
|
182
|
+
`;
|
|
183
|
+
|
|
184
|
+
exports[`renders the DropdownButton with color=primary variant="link" arrow={false} 1`] = `
|
|
185
|
+
<ForwardRef(DropdownButton)
|
|
186
|
+
arrow={false}
|
|
187
|
+
color="primary"
|
|
188
|
+
variant="link"
|
|
189
|
+
>
|
|
190
|
+
<summary
|
|
191
|
+
className="govgr-link govgr-dropdown__button"
|
|
192
|
+
>
|
|
193
|
+
hello
|
|
194
|
+
</summary>
|
|
195
|
+
</ForwardRef(DropdownButton)>
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
exports[`renders the DropdownButton with color=primary variant="link" arrow={true} 1`] = `
|
|
199
|
+
<ForwardRef(DropdownButton)
|
|
200
|
+
arrow={true}
|
|
201
|
+
color="primary"
|
|
202
|
+
variant="link"
|
|
203
|
+
>
|
|
204
|
+
<summary
|
|
205
|
+
className="govgr-link govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
206
|
+
>
|
|
207
|
+
<ForwardRef(ArrowIcon)
|
|
208
|
+
direction="down"
|
|
209
|
+
>
|
|
210
|
+
<ForwardRef(SvgIcon)
|
|
211
|
+
className="govgr-arrow--down"
|
|
212
|
+
>
|
|
213
|
+
<svg
|
|
214
|
+
aria-hidden="true"
|
|
215
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
216
|
+
focusable="false"
|
|
217
|
+
viewBox="0 0 24 24"
|
|
218
|
+
>
|
|
219
|
+
<path
|
|
220
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
221
|
+
/>
|
|
222
|
+
</svg>
|
|
223
|
+
</ForwardRef(SvgIcon)>
|
|
224
|
+
</ForwardRef(ArrowIcon)>
|
|
225
|
+
</summary>
|
|
226
|
+
</ForwardRef(DropdownButton)>
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
exports[`renders the DropdownButton with color=secondary 1`] = `
|
|
230
|
+
<ForwardRef(DropdownButton)
|
|
231
|
+
color="secondary"
|
|
232
|
+
>
|
|
233
|
+
<summary
|
|
234
|
+
className="govgr-btn-secondary govgr-btn govgr-dropdown__button"
|
|
235
|
+
>
|
|
236
|
+
hello
|
|
237
|
+
</summary>
|
|
238
|
+
</ForwardRef(DropdownButton)>
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
exports[`renders the DropdownButton with color=secondary and arrow={false} 1`] = `
|
|
242
|
+
<ForwardRef(DropdownButton)
|
|
243
|
+
arrow={false}
|
|
244
|
+
color="secondary"
|
|
245
|
+
>
|
|
246
|
+
<summary
|
|
247
|
+
className="govgr-btn-secondary govgr-btn govgr-dropdown__button"
|
|
248
|
+
>
|
|
249
|
+
hello
|
|
250
|
+
</summary>
|
|
251
|
+
</ForwardRef(DropdownButton)>
|
|
252
|
+
`;
|
|
253
|
+
|
|
254
|
+
exports[`renders the DropdownButton with color=secondary and arrow={true} 1`] = `
|
|
255
|
+
<ForwardRef(DropdownButton)
|
|
256
|
+
arrow={true}
|
|
257
|
+
color="secondary"
|
|
258
|
+
>
|
|
259
|
+
<summary
|
|
260
|
+
className="govgr-btn-secondary govgr-btn govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
261
|
+
>
|
|
262
|
+
<ForwardRef(ArrowIcon)
|
|
263
|
+
direction="down"
|
|
264
|
+
>
|
|
265
|
+
<ForwardRef(SvgIcon)
|
|
266
|
+
className="govgr-arrow--down"
|
|
267
|
+
>
|
|
268
|
+
<svg
|
|
269
|
+
aria-hidden="true"
|
|
270
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
271
|
+
focusable="false"
|
|
272
|
+
viewBox="0 0 24 24"
|
|
273
|
+
>
|
|
274
|
+
<path
|
|
275
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
276
|
+
/>
|
|
277
|
+
</svg>
|
|
278
|
+
</ForwardRef(SvgIcon)>
|
|
279
|
+
</ForwardRef(ArrowIcon)>
|
|
280
|
+
</summary>
|
|
281
|
+
</ForwardRef(DropdownButton)>
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
exports[`renders the DropdownButton with color=secondary and variant="button" 1`] = `
|
|
285
|
+
<ForwardRef(DropdownButton)
|
|
286
|
+
color="secondary"
|
|
287
|
+
variant="button"
|
|
288
|
+
>
|
|
289
|
+
<summary
|
|
290
|
+
className="govgr-btn-secondary govgr-btn govgr-dropdown__button"
|
|
291
|
+
>
|
|
292
|
+
hello
|
|
293
|
+
</summary>
|
|
294
|
+
</ForwardRef(DropdownButton)>
|
|
295
|
+
`;
|
|
296
|
+
|
|
297
|
+
exports[`renders the DropdownButton with color=warning variant="button" arrow={false} 1`] = `
|
|
298
|
+
<ForwardRef(DropdownButton)
|
|
299
|
+
arrow={false}
|
|
300
|
+
color="warning"
|
|
301
|
+
variant="link"
|
|
302
|
+
>
|
|
303
|
+
<summary
|
|
304
|
+
className="govgr-link govgr-dropdown__button"
|
|
305
|
+
>
|
|
306
|
+
hello
|
|
307
|
+
</summary>
|
|
308
|
+
</ForwardRef(DropdownButton)>
|
|
309
|
+
`;
|
|
310
|
+
|
|
311
|
+
exports[`renders the DropdownButton with color=warning variant="button" arrow={true} 1`] = `
|
|
312
|
+
<ForwardRef(DropdownButton)
|
|
313
|
+
arrow={true}
|
|
314
|
+
color="warning"
|
|
315
|
+
variant="link"
|
|
316
|
+
>
|
|
317
|
+
<summary
|
|
318
|
+
className="govgr-link govgr-dropdown__button--arrow govgr-dropdown__button"
|
|
319
|
+
>
|
|
320
|
+
hello
|
|
321
|
+
<ForwardRef(ArrowIcon)
|
|
322
|
+
direction="down"
|
|
323
|
+
>
|
|
324
|
+
<ForwardRef(SvgIcon)
|
|
325
|
+
className="govgr-arrow--down"
|
|
326
|
+
>
|
|
327
|
+
<svg
|
|
328
|
+
aria-hidden="true"
|
|
329
|
+
className="govgr-arrow--down govgr-svg-icon"
|
|
330
|
+
focusable="false"
|
|
331
|
+
viewBox="0 0 24 24"
|
|
332
|
+
>
|
|
333
|
+
<path
|
|
334
|
+
d="M22,8.2l-2.3-2.4L12,13.4L4.4,5.8L2,8.2l10,10L22,8.2z"
|
|
335
|
+
/>
|
|
336
|
+
</svg>
|
|
337
|
+
</ForwardRef(SvgIcon)>
|
|
338
|
+
</ForwardRef(ArrowIcon)>
|
|
339
|
+
</summary>
|
|
340
|
+
</ForwardRef(DropdownButton)>
|
|
341
|
+
`;
|
|
342
|
+
|
|
343
|
+
exports[`renders the DropdownButton with no props 1`] = `
|
|
344
|
+
<ForwardRef(DropdownButton)>
|
|
345
|
+
<summary
|
|
346
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
347
|
+
>
|
|
348
|
+
hello
|
|
349
|
+
</summary>
|
|
350
|
+
</ForwardRef(DropdownButton)>
|
|
351
|
+
`;
|
|
352
|
+
|
|
353
|
+
exports[`renders the DropdownButton with variant=button 1`] = `
|
|
354
|
+
<ForwardRef(DropdownButton)
|
|
355
|
+
variant="button"
|
|
356
|
+
>
|
|
357
|
+
<summary
|
|
358
|
+
className="govgr-btn-primary govgr-btn govgr-dropdown__button"
|
|
359
|
+
>
|
|
360
|
+
hello
|
|
361
|
+
</summary>
|
|
362
|
+
</ForwardRef(DropdownButton)>
|
|
363
|
+
`;
|
|
364
|
+
|
|
365
|
+
exports[`renders the DropdownButton with variant=link 1`] = `
|
|
366
|
+
<ForwardRef(DropdownButton)
|
|
367
|
+
variant="link"
|
|
368
|
+
>
|
|
369
|
+
<summary
|
|
370
|
+
className="govgr-link govgr-dropdown__button"
|
|
371
|
+
>
|
|
372
|
+
hello
|
|
373
|
+
</summary>
|
|
374
|
+
</ForwardRef(DropdownButton)>
|
|
375
|
+
`;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children", "color", "variant", "arrow"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import ArrowIcon from '@digigov/react-core/ArrowIcon';
|
|
7
|
+
|
|
8
|
+
var _ref2 = /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
9
|
+
direction: "down"
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* DropdownButton it should be inside the Dropdown and it is used for opening or closing dropdown.
|
|
14
|
+
*/
|
|
15
|
+
export var DropdownButton = /*#__PURE__*/React.forwardRef(function DropdownButton(_ref, ref) {
|
|
16
|
+
var className = _ref.className,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
_ref$color = _ref.color,
|
|
19
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
20
|
+
_ref$variant = _ref.variant,
|
|
21
|
+
variant = _ref$variant === void 0 ? 'button' : _ref$variant,
|
|
22
|
+
_ref$arrow = _ref.arrow,
|
|
23
|
+
arrow = _ref$arrow === void 0 ? false : _ref$arrow,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
|
|
26
|
+
return /*#__PURE__*/React.createElement("summary", _extends({
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: clsx(className, variant === 'button' && [color === 'secondary' && 'govgr-btn-secondary', color === 'primary' && 'govgr-btn-primary', color === 'warning' && 'govgr-btn-warning', 'govgr-btn'], variant === 'link' && 'govgr-link', arrow === true && 'govgr-dropdown__button--arrow', true && 'govgr-dropdown__button')
|
|
29
|
+
}, props), children, arrow === true && _ref2);
|
|
30
|
+
});
|
|
31
|
+
export default DropdownButton;
|