@onewelcome/react-lib-components 0.1.5-alpha → 0.1.8-alpha
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/dist/Button/IconButton.d.ts +2 -1
- package/dist/ContextMenu/ContextMenu.d.ts +2 -3
- package/dist/ContextMenu/ContextMenuItem.d.ts +10 -3
- package/dist/DataGrid/DataGrid.d.ts +30 -0
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +14 -0
- package/dist/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +13 -0
- package/dist/DataGrid/DataGridBody/DataGridBody.d.ts +16 -0
- package/dist/DataGrid/DataGridBody/DataGridCell.d.ts +6 -0
- package/dist/DataGrid/DataGridBody/DataGridRow.d.ts +7 -0
- package/dist/DataGrid/DataGridHeader/DataGridHeader.d.ts +10 -0
- package/dist/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +10 -0
- package/dist/DataGrid/datagrid.interfaces.d.ts +13 -0
- package/dist/Form/Checkbox/Checkbox.d.ts +2 -2
- package/dist/Form/Select/Option.d.ts +9 -4
- package/dist/Form/Select/Select.d.ts +8 -2
- package/dist/Form/Toggle/Toggle.d.ts +1 -1
- package/dist/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +1 -1
- package/dist/Icon/Icon.d.ts +1 -0
- package/dist/Link/Link.d.ts +4 -3
- package/dist/Notifications/BaseModal/BaseModal.d.ts +4 -2
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +4 -0
- package/dist/StatusIndicator/StatusIndicator.d.ts +9 -0
- package/dist/_BaseStyling_/BaseStyling.d.ts +4 -0
- package/dist/hooks/useSpacing.d.ts +1 -1
- package/dist/hooks/useWrapper.d.ts +1 -1
- package/dist/index.d.ts +48 -43
- package/dist/react-lib-components.cjs.development.js +2900 -2049
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +2897 -2050
- package/dist/react-lib-components.esm.js.map +1 -1
- package/dist/util/helper.d.ts +1 -1
- package/package.json +11 -11
- package/src/Button/BaseButton.module.scss +3 -18
- package/src/Button/Button.module.scss +4 -311
- package/src/Button/IconButton.module.scss +21 -128
- package/src/Button/IconButton.test.tsx +24 -0
- package/src/Button/IconButton.tsx +6 -1
- package/src/ContextMenu/ContextMenu.test.tsx +121 -6
- package/src/ContextMenu/ContextMenu.tsx +99 -6
- package/src/ContextMenu/ContextMenuItem.tsx +57 -9
- package/src/DataGrid/DataGrid.module.scss +21 -0
- package/src/DataGrid/DataGrid.test.tsx +276 -0
- package/src/DataGrid/DataGrid.tsx +101 -0
- package/src/DataGrid/DataGridActions/DataGridActions.module.scss +35 -0
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +184 -0
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +109 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +41 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +83 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +88 -0
- package/src/DataGrid/DataGridBody/DataGridBody.module.scss +10 -0
- package/src/DataGrid/DataGridBody/DataGridBody.test.tsx +123 -0
- package/src/DataGrid/DataGridBody/DataGridBody.tsx +64 -0
- package/src/DataGrid/DataGridBody/DataGridCell.module.scss +33 -0
- package/src/DataGrid/DataGridBody/DataGridCell.test.tsx +74 -0
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +25 -0
- package/src/DataGrid/DataGridBody/DataGridRow.module.scss +7 -0
- package/src/DataGrid/DataGridBody/DataGridRow.test.tsx +101 -0
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +27 -0
- package/src/DataGrid/DataGridBody/__snapshots__/DataGridBody.test.tsx.snap +258 -0
- package/src/DataGrid/DataGridHeader/DataGridHeader.module.scss +26 -0
- package/src/DataGrid/DataGridHeader/DataGridHeader.test.tsx +255 -0
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +80 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +68 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +128 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +72 -0
- package/src/DataGrid/datagrid.interfaces.ts +14 -0
- package/src/Form/Checkbox/Checkbox.test.tsx +144 -8
- package/src/Form/Checkbox/Checkbox.tsx +8 -8
- package/src/Form/Select/Option.tsx +39 -21
- package/src/Form/Select/Select.module.scss +1 -1
- package/src/Form/Select/Select.test.tsx +235 -56
- package/src/Form/Select/Select.tsx +194 -34
- package/src/Form/Toggle/Toggle.module.scss +1 -0
- package/src/Form/Toggle/Toggle.test.tsx +45 -19
- package/src/Form/Toggle/Toggle.tsx +3 -3
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +1 -1
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +44 -0
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +4 -2
- package/src/Icon/Icon.module.scss +4 -0
- package/src/Icon/Icon.tsx +1 -0
- package/src/Link/Link.module.scss +20 -0
- package/src/Link/Link.test.tsx +33 -0
- package/src/Link/Link.tsx +8 -2
- package/src/Notifications/BaseModal/BaseModal.module.scss +1 -1
- package/src/Notifications/BaseModal/BaseModal.test.tsx +77 -12
- package/src/Notifications/BaseModal/BaseModal.tsx +27 -6
- package/src/Notifications/Dialog/Dialog.module.scss +1 -1
- package/src/Notifications/Dialog/Dialog.tsx +1 -1
- package/src/Notifications/SlideInModal/SlideInModal.module.scss +36 -0
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +69 -0
- package/src/Notifications/SlideInModal/SlideInModal.tsx +31 -0
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.module.scss +1 -1
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +1 -1
- package/src/Pagination/Pagination.module.scss +74 -74
- package/src/StatusIndicator/StatusIndicator.module.scss +27 -0
- package/src/StatusIndicator/StatusIndicator.test.tsx +127 -0
- package/src/StatusIndicator/StatusIndicator.tsx +25 -0
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tiles/Tile.test.tsx +4 -4
- package/src/_BaseStyling_/BaseStyling.tsx +14 -6
- package/src/index.ts +85 -48
- package/src/mixins.module.scss +171 -0
- package/src/readyclasses.module.scss +0 -30
package/dist/util/helper.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare type KeyValuePair = {
|
|
2
2
|
[key: string]: unknown;
|
|
3
3
|
};
|
|
4
|
-
export declare const generateID: (length?: number, stringToWeaveIn?: string) => string;
|
|
4
|
+
export declare const generateID: (length?: number, stringToWeaveIn?: string | undefined) => string;
|
|
5
5
|
export declare const filterProps: (props: any, regexPattern: RegExp, returnFiltered?: boolean) => KeyValuePair;
|
|
6
6
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onewelcome/react-lib-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-alpha",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "OneWelcome B.V.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": ">=16"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=16"
|
|
38
38
|
},
|
|
39
39
|
"size-limit": [
|
|
40
40
|
{
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@babel/core": "^7.18.0",
|
|
51
51
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
52
|
-
"@storybook/addon-a11y": "^6.5.
|
|
53
|
-
"@storybook/addon-docs": "^6.5.
|
|
54
|
-
"@storybook/addon-essentials": "^6.5.
|
|
55
|
-
"@storybook/addon-links": "^6.5.
|
|
56
|
-
"@storybook/addons": "^6.5.
|
|
57
|
-
"@storybook/builder-webpack5": "^6.5.
|
|
58
|
-
"@storybook/manager-webpack5": "^6.5.
|
|
52
|
+
"@storybook/addon-a11y": "^6.5.8",
|
|
53
|
+
"@storybook/addon-docs": "^6.5.8",
|
|
54
|
+
"@storybook/addon-essentials": "^6.5.8",
|
|
55
|
+
"@storybook/addon-links": "^6.5.8",
|
|
56
|
+
"@storybook/addons": "^6.5.8",
|
|
57
|
+
"@storybook/builder-webpack5": "^6.5.8",
|
|
58
|
+
"@storybook/manager-webpack5": "^6.5.8",
|
|
59
59
|
"@storybook/preset-scss": "^1.0.3",
|
|
60
|
-
"@storybook/react": "^6.5.
|
|
61
|
-
"@storybook/theming": "^6.5.
|
|
60
|
+
"@storybook/react": "^6.5.8",
|
|
61
|
+
"@storybook/theming": "^6.5.8",
|
|
62
62
|
"@testing-library/dom": "^8.13.0",
|
|
63
63
|
"@testing-library/jest-dom": "^5.16.4",
|
|
64
64
|
"@testing-library/react": "^12.1.5",
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
.
|
|
2
|
-
border-width: var(--button-border-width);
|
|
3
|
-
border-style: var(--button-border-style);
|
|
4
|
-
border-radius: var(--button-border-radius);
|
|
5
|
-
font-size: var(--button-font-size);
|
|
6
|
-
line-height: var(--button-font-size);
|
|
7
|
-
margin: 0;
|
|
8
|
-
padding: 0.5rem 1.25rem;
|
|
9
|
-
min-height: 2.5rem;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
transition-property: color, background-color, border-color;
|
|
12
|
-
transition-duration: 0.2s;
|
|
13
|
-
transition-timing-function: ease-in-out;
|
|
14
|
-
font-family: var(--font-family);
|
|
1
|
+
@import '../mixins.module.scss';
|
|
15
2
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cursor: not-allowed;
|
|
19
|
-
}
|
|
3
|
+
.button {
|
|
4
|
+
@include buttonBase();
|
|
20
5
|
}
|
|
@@ -1,323 +1,16 @@
|
|
|
1
1
|
@import '../readyclasses.module.scss';
|
|
2
|
+
@import '../mixins.module.scss';
|
|
2
3
|
|
|
3
4
|
.fill {
|
|
4
|
-
|
|
5
|
-
font-weight: bold;
|
|
6
|
-
|
|
7
|
-
&.primary:not(:disabled) {
|
|
8
|
-
background-color: var(--color-primary);
|
|
9
|
-
border-color: var(--color-primary);
|
|
10
|
-
|
|
11
|
-
@include focusOutline(var(--color-primary));
|
|
12
|
-
|
|
13
|
-
&:hover,
|
|
14
|
-
&:focus {
|
|
15
|
-
color: var(--color-primary);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&:active {
|
|
19
|
-
position: relative;
|
|
20
|
-
color: var(--color-primary);
|
|
21
|
-
|
|
22
|
-
&:after {
|
|
23
|
-
content: '';
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: calc(-1 * var(--button-border-width));
|
|
26
|
-
left: 0;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: calc(100% + var(--button-border-width));
|
|
29
|
-
background-color: var(--color-primary);
|
|
30
|
-
border-radius: var(--button-border-radius);
|
|
31
|
-
filter: opacity(0.1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&.secondary:not(:disabled) {
|
|
37
|
-
background-color: var(--color-secondary);
|
|
38
|
-
border-color: var(--color-secondary);
|
|
39
|
-
|
|
40
|
-
@include focusOutline(var(--color-secondary));
|
|
41
|
-
|
|
42
|
-
&:hover,
|
|
43
|
-
&:focus {
|
|
44
|
-
color: var(--color-secondary);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:active {
|
|
48
|
-
position: relative;
|
|
49
|
-
color: var(--color-secondary);
|
|
50
|
-
|
|
51
|
-
&:after {
|
|
52
|
-
content: '';
|
|
53
|
-
position: absolute;
|
|
54
|
-
top: calc(-1 * var(--button-border-width));
|
|
55
|
-
left: 0;
|
|
56
|
-
width: 100%;
|
|
57
|
-
height: calc(100% + var(--button-border-width));
|
|
58
|
-
background-color: var(--color-secondary);
|
|
59
|
-
border-radius: var(--button-border-radius);
|
|
60
|
-
filter: opacity(0.1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.tertiary:not(:disabled) {
|
|
66
|
-
background-color: var(--color-tertiary);
|
|
67
|
-
border-color: var(--color-tertiary);
|
|
68
|
-
|
|
69
|
-
@include focusOutline(var(--color-tertiary));
|
|
70
|
-
|
|
71
|
-
&:hover,
|
|
72
|
-
&:focus {
|
|
73
|
-
color: var(--color-tertiary);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&:active {
|
|
77
|
-
position: relative;
|
|
78
|
-
color: var(--color-tertiary);
|
|
79
|
-
|
|
80
|
-
&:after {
|
|
81
|
-
content: '';
|
|
82
|
-
position: absolute;
|
|
83
|
-
top: calc(-1 * var(--button-border-width));
|
|
84
|
-
left: 0;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: calc(100% + var(--button-border-width));
|
|
87
|
-
background-color: var(--color-tertiary);
|
|
88
|
-
border-radius: var(--button-border-radius);
|
|
89
|
-
filter: opacity(0.1);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&.default:not(:disabled) {
|
|
95
|
-
background-color: var(--default);
|
|
96
|
-
border-color: var(--default);
|
|
97
|
-
|
|
98
|
-
@include focusOutline(var(--default));
|
|
99
|
-
|
|
100
|
-
&:hover,
|
|
101
|
-
&:focus {
|
|
102
|
-
color: var(--default);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&:active {
|
|
106
|
-
position: relative;
|
|
107
|
-
color: var(--default);
|
|
108
|
-
|
|
109
|
-
&:after {
|
|
110
|
-
content: '';
|
|
111
|
-
position: absolute;
|
|
112
|
-
top: calc(-1 * var(--button-border-width));
|
|
113
|
-
left: 0;
|
|
114
|
-
width: 100%;
|
|
115
|
-
height: calc(100% + var(--button-border-width));
|
|
116
|
-
background-color: var(--default);
|
|
117
|
-
border-radius: var(--button-border-radius);
|
|
118
|
-
filter: opacity(0.1);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&:hover:not(:disabled),
|
|
124
|
-
&:focus:not(:disabled),
|
|
125
|
-
&:active:not(:disabled) {
|
|
126
|
-
background-color: var(--button-fill-background-color);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&:disabled {
|
|
130
|
-
background-color: var(--disabled);
|
|
131
|
-
border-color: var(--disabled);
|
|
132
|
-
}
|
|
5
|
+
@include button('fill');
|
|
133
6
|
}
|
|
134
7
|
|
|
135
8
|
.outline {
|
|
136
|
-
|
|
137
|
-
font-weight: bold;
|
|
138
|
-
|
|
139
|
-
&.primary:not(:disabled) {
|
|
140
|
-
border-color: var(--color-primary);
|
|
141
|
-
color: var(--color-primary);
|
|
142
|
-
|
|
143
|
-
@include focusOutline(var(--color-primary));
|
|
144
|
-
|
|
145
|
-
&:hover,
|
|
146
|
-
&:focus {
|
|
147
|
-
background-color: var(--color-primary);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&.secondary:not(:disabled) {
|
|
152
|
-
border-color: var(--color-secondary);
|
|
153
|
-
color: var(--color-secondary);
|
|
154
|
-
|
|
155
|
-
@include focusOutline(var(--color-secondary));
|
|
156
|
-
|
|
157
|
-
&:hover,
|
|
158
|
-
&:focus {
|
|
159
|
-
background-color: var(--color-secondary);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&.tertiary:not(:disabled) {
|
|
164
|
-
border-color: var(--color-tertiary);
|
|
165
|
-
color: var(--color-tertiary);
|
|
166
|
-
|
|
167
|
-
@include focusOutline(var(--color-tertiary));
|
|
168
|
-
|
|
169
|
-
&:hover,
|
|
170
|
-
&:focus {
|
|
171
|
-
background-color: var(--color-tertiary);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&.default:not(:disabled) {
|
|
176
|
-
border-color: var(--default);
|
|
177
|
-
color: var(--default);
|
|
178
|
-
|
|
179
|
-
@include focusOutline(var(--default));
|
|
180
|
-
|
|
181
|
-
&:hover,
|
|
182
|
-
&:focus {
|
|
183
|
-
background-color: var(--default);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&:hover:not(:disabled),
|
|
188
|
-
&:focus:not(:disabled) {
|
|
189
|
-
color: var(--button-outline-hover-text-color);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
&:disabled {
|
|
193
|
-
border-color: var(--greyed-out);
|
|
194
|
-
background-color: transparent;
|
|
195
|
-
}
|
|
9
|
+
@include button('outline');
|
|
196
10
|
}
|
|
197
11
|
|
|
198
12
|
.text {
|
|
199
|
-
|
|
200
|
-
background-color: transparent;
|
|
201
|
-
|
|
202
|
-
&.primary:not(:disabled) {
|
|
203
|
-
color: var(--color-primary);
|
|
204
|
-
|
|
205
|
-
@include focusOutline(var(--color-primary));
|
|
206
|
-
|
|
207
|
-
&:hover,
|
|
208
|
-
&:focus {
|
|
209
|
-
border-color: var(--color-primary);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
&:active {
|
|
213
|
-
background-color: transparent;
|
|
214
|
-
position: relative;
|
|
215
|
-
color: var(--color-primary);
|
|
216
|
-
border-color: var(--button-fill-background-color);
|
|
217
|
-
|
|
218
|
-
&:after {
|
|
219
|
-
content: '';
|
|
220
|
-
position: absolute;
|
|
221
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
222
|
-
left: 0;
|
|
223
|
-
width: 100%;
|
|
224
|
-
height: calc(100% + var(--button-border-width));
|
|
225
|
-
background-color: var(--color-primary);
|
|
226
|
-
border-radius: var(--button-border-radius);
|
|
227
|
-
filter: opacity(0.1);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
&.secondary:not(:disabled) {
|
|
233
|
-
color: var(--color-secondary);
|
|
234
|
-
|
|
235
|
-
@include focusOutline(var(--color-secondary));
|
|
236
|
-
|
|
237
|
-
&:hover,
|
|
238
|
-
&:focus {
|
|
239
|
-
border-color: var(--color-secondary);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
&:active {
|
|
243
|
-
background-color: transparent;
|
|
244
|
-
position: relative;
|
|
245
|
-
color: var(--color-secondary);
|
|
246
|
-
border-color: var(--button-fill-background-color);
|
|
247
|
-
|
|
248
|
-
&:after {
|
|
249
|
-
content: '';
|
|
250
|
-
position: absolute;
|
|
251
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
252
|
-
left: 0;
|
|
253
|
-
width: 100%;
|
|
254
|
-
height: calc(100% + var(--button-border-width));
|
|
255
|
-
background-color: var(--color-secondary);
|
|
256
|
-
border-radius: var(--button-border-radius);
|
|
257
|
-
filter: opacity(0.1);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
&.tertiary:not(:disabled) {
|
|
263
|
-
color: var(--color-tertiary);
|
|
264
|
-
|
|
265
|
-
@include focusOutline(var(--color-tertiary));
|
|
266
|
-
|
|
267
|
-
&:hover,
|
|
268
|
-
&:focus {
|
|
269
|
-
border-color: var(--color-tertiary);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
&:active {
|
|
273
|
-
background-color: transparent;
|
|
274
|
-
position: relative;
|
|
275
|
-
color: var(--color-tertiary);
|
|
276
|
-
border-color: var(--button-fill-background-color);
|
|
277
|
-
|
|
278
|
-
&:after {
|
|
279
|
-
content: '';
|
|
280
|
-
position: absolute;
|
|
281
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
282
|
-
left: 0;
|
|
283
|
-
width: 100%;
|
|
284
|
-
height: calc(100% + var(--button-border-width));
|
|
285
|
-
background-color: var(--color-tertiary);
|
|
286
|
-
border-radius: var(--button-border-radius);
|
|
287
|
-
filter: opacity(0.1);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
&.default:not(:disabled) {
|
|
293
|
-
color: var(--default);
|
|
294
|
-
|
|
295
|
-
@include focusOutline(var(--default));
|
|
296
|
-
|
|
297
|
-
&:hover,
|
|
298
|
-
&:focus {
|
|
299
|
-
border-color: var(--default);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
&:active {
|
|
303
|
-
background-color: transparent;
|
|
304
|
-
position: relative;
|
|
305
|
-
color: var(--default);
|
|
306
|
-
border-color: var(--button-fill-background-color);
|
|
307
|
-
|
|
308
|
-
&:after {
|
|
309
|
-
content: '';
|
|
310
|
-
position: absolute;
|
|
311
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
312
|
-
left: 0;
|
|
313
|
-
width: 100%;
|
|
314
|
-
height: calc(100% + var(--button-border-width));
|
|
315
|
-
background-color: var(--default);
|
|
316
|
-
border-radius: var(--button-border-radius);
|
|
317
|
-
filter: opacity(0.1);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
13
|
+
@include button('text');
|
|
321
14
|
}
|
|
322
15
|
|
|
323
16
|
.has-icon {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../readyclasses.module.scss';
|
|
2
|
+
@import '../mixins.module.scss';
|
|
2
3
|
|
|
3
4
|
.icon-button {
|
|
4
5
|
border: var(--button-border-width) var(--button-border-style) transparent;
|
|
@@ -8,154 +9,46 @@
|
|
|
8
9
|
display: flex;
|
|
9
10
|
align-items: center;
|
|
10
11
|
justify-content: center;
|
|
12
|
+
min-height: auto;
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
span {
|
|
13
15
|
vertical-align: top;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/** Sizes **/
|
|
17
19
|
&.button-s {
|
|
18
|
-
|
|
19
|
-
font-size:
|
|
20
|
+
span {
|
|
21
|
+
font-size: 0.75rem;
|
|
20
22
|
}
|
|
21
|
-
width:
|
|
22
|
-
height:
|
|
23
|
+
width: 1.875rem;
|
|
24
|
+
height: 1.875rem;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
&.button-m {
|
|
26
|
-
|
|
27
|
-
font-size:
|
|
28
|
+
span {
|
|
29
|
+
font-size: 1rem;
|
|
28
30
|
}
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
31
|
+
width: 2.5rem;
|
|
32
|
+
height: 2.5rem;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
&.button-l {
|
|
34
|
-
|
|
35
|
-
font-size:
|
|
36
|
+
span {
|
|
37
|
+
font-size: 1.375rem;
|
|
36
38
|
}
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
39
|
+
width: 3.125rem;
|
|
40
|
+
height: 3.125rem;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
color: var(--color-primary);
|
|
44
|
-
|
|
45
|
-
@include focusOutline(var(--color-primary));
|
|
46
|
-
|
|
47
|
-
&:hover,
|
|
48
|
-
&:focus {
|
|
49
|
-
border-color: var(--color-primary);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&:active {
|
|
53
|
-
background-color: transparent;
|
|
54
|
-
position: relative;
|
|
55
|
-
color: var(--color-primary);
|
|
56
|
-
border-color: var(--button-fill-background-color);
|
|
57
|
-
|
|
58
|
-
&:after {
|
|
59
|
-
content: '';
|
|
60
|
-
position: absolute;
|
|
61
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
62
|
-
left: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
63
|
-
width: calc(100% + var(--button-border-width));
|
|
64
|
-
height: calc(100% + var(--button-border-width));
|
|
65
|
-
background-color: var(--color-primary);
|
|
66
|
-
border-radius: var(--button-border-radius);
|
|
67
|
-
filter: opacity(0.1);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&.secondary:not(:disabled) {
|
|
73
|
-
color: var(--color-secondary);
|
|
74
|
-
|
|
75
|
-
@include focusOutline(var(--color-secondary));
|
|
76
|
-
|
|
77
|
-
&:hover,
|
|
78
|
-
&:focus {
|
|
79
|
-
border-color: var(--color-secondary);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&:active {
|
|
83
|
-
background-color: transparent;
|
|
84
|
-
position: relative;
|
|
85
|
-
color: var(--color-secondary);
|
|
86
|
-
border-color: var(--button-fill-background-color);
|
|
87
|
-
|
|
88
|
-
&:after {
|
|
89
|
-
content: '';
|
|
90
|
-
position: absolute;
|
|
91
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
92
|
-
left: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
93
|
-
width: calc(100% + var(--button-border-width));
|
|
94
|
-
height: calc(100% + var(--button-border-width));
|
|
95
|
-
background-color: var(--color-secondary);
|
|
96
|
-
border-radius: var(--button-border-radius);
|
|
97
|
-
filter: opacity(0.1);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
43
|
+
&.fill {
|
|
44
|
+
@include button('fill', 'icon');
|
|
100
45
|
}
|
|
101
46
|
|
|
102
|
-
&.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
@include focusOutline(var(--color-tertiary));
|
|
106
|
-
|
|
107
|
-
&:hover,
|
|
108
|
-
&:focus {
|
|
109
|
-
border-color: var(--color-tertiary);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&:active {
|
|
113
|
-
background-color: transparent;
|
|
114
|
-
position: relative;
|
|
115
|
-
color: var(--color-tertiary);
|
|
116
|
-
border-color: var(--button-fill-background-color);
|
|
117
|
-
|
|
118
|
-
&:after {
|
|
119
|
-
content: '';
|
|
120
|
-
position: absolute;
|
|
121
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
122
|
-
left: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
123
|
-
width: calc(100% + var(--button-border-width));
|
|
124
|
-
height: calc(100% + var(--button-border-width));
|
|
125
|
-
background-color: var(--color-tertiary);
|
|
126
|
-
border-radius: var(--button-border-radius);
|
|
127
|
-
filter: opacity(0.1);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
47
|
+
&.text {
|
|
48
|
+
@include button('text', 'icon');
|
|
130
49
|
}
|
|
131
50
|
|
|
132
|
-
&.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
@include focusOutline(var(--default));
|
|
136
|
-
|
|
137
|
-
&:hover,
|
|
138
|
-
&:focus {
|
|
139
|
-
border-color: var(--default);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&:active {
|
|
143
|
-
background-color: transparent;
|
|
144
|
-
position: relative;
|
|
145
|
-
color: var(--default);
|
|
146
|
-
border-color: var(--button-fill-background-color);
|
|
147
|
-
|
|
148
|
-
&:after {
|
|
149
|
-
content: '';
|
|
150
|
-
position: absolute;
|
|
151
|
-
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
152
|
-
left: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
153
|
-
width: calc(100% + var(--button-border-width));
|
|
154
|
-
height: calc(100% + var(--button-border-width));
|
|
155
|
-
background-color: var(--default);
|
|
156
|
-
border-radius: var(--button-border-radius);
|
|
157
|
-
filter: opacity(0.1);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
51
|
+
&.outline {
|
|
52
|
+
@include button('outline', 'icon');
|
|
160
53
|
}
|
|
161
54
|
}
|
|
@@ -79,4 +79,28 @@ describe('Different variants of the button', () => {
|
|
|
79
79
|
}));
|
|
80
80
|
expect(iconButton.classList.contains('tertiary')).toBe(true);
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
it('should have a class of "fill"', () => {
|
|
84
|
+
const { iconButton } = createIconButton((defaultParams) => ({
|
|
85
|
+
...defaultParams,
|
|
86
|
+
variant: 'fill',
|
|
87
|
+
}));
|
|
88
|
+
expect(iconButton.classList.contains('fill')).toBe(true);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should have a class of "outline"', () => {
|
|
92
|
+
const { iconButton } = createIconButton((defaultParams) => ({
|
|
93
|
+
...defaultParams,
|
|
94
|
+
variant: 'outline',
|
|
95
|
+
}));
|
|
96
|
+
expect(iconButton.classList.contains('outline')).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should have a class of "text"', () => {
|
|
100
|
+
const { iconButton } = createIconButton((defaultParams) => ({
|
|
101
|
+
...defaultParams,
|
|
102
|
+
variant: 'text',
|
|
103
|
+
}));
|
|
104
|
+
expect(iconButton.classList.contains('text')).toBe(true);
|
|
105
|
+
});
|
|
82
106
|
});
|
|
@@ -6,18 +6,23 @@ import readyclasses from '../readyclasses.module.scss';
|
|
|
6
6
|
export interface Props extends BaseButtonProps {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
iconSize?: 's' | 'm' | 'l';
|
|
9
|
+
variant?: 'text' | 'fill' | 'outline';
|
|
9
10
|
className?: string;
|
|
10
11
|
title?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const IconButton = React.forwardRef<HTMLButtonElement, Props>(
|
|
14
|
-
(
|
|
15
|
+
(
|
|
16
|
+
{ children, color = 'primary', variant = 'text', iconSize = 'm', title, className, ...rest },
|
|
17
|
+
ref
|
|
18
|
+
) => {
|
|
15
19
|
if (!title) {
|
|
16
20
|
console.error("Please make sure to specify a 'title' prop to your IconButton component! ");
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
const iconButtonClasses = [
|
|
20
24
|
classes['icon-button'],
|
|
25
|
+
classes[variant],
|
|
21
26
|
classes[color],
|
|
22
27
|
classes['button-' + iconSize],
|
|
23
28
|
];
|