agroptima-design-system 0.18.5 → 0.19.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.
- package/package.json +1 -1
- package/src/atoms/Button/Button.scss +221 -218
- package/src/atoms/Button/Button.tsx +1 -1
- package/src/atoms/Button/IconButton.scss +30 -27
- package/src/atoms/Button/IconButton.tsx +1 -1
- package/src/atoms/Button/index.ts +3 -1
- package/src/atoms/EmptyState.scss +1 -0
- package/src/atoms/Pagination/Ellipsis.tsx +18 -0
- package/src/atoms/Pagination/Pagination.scss +94 -0
- package/src/atoms/Pagination/Pagination.tsx +27 -0
- package/src/atoms/Pagination/PaginationArrow.tsx +37 -0
- package/src/atoms/Pagination/PaginationNumber.tsx +43 -0
- package/src/atoms/Pagination/index.ts +6 -0
- package/src/settings/_layers.scss +1 -0
- package/src/stories/Changelog.mdx +6 -1
- package/src/stories/Pagination.stories.js +207 -0
- package/tests/Pagination.spec.tsx +95 -0
package/package.json
CHANGED
|
@@ -1,280 +1,283 @@
|
|
|
1
1
|
@use '../../settings/color_alias';
|
|
2
2
|
@use '../../settings/typography/content' as typography;
|
|
3
3
|
@use '../../settings/config';
|
|
4
|
+
@use '../../settings/layers';
|
|
4
5
|
|
|
5
|
-
@
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
@layer base-button {
|
|
7
|
+
@mixin button-style($main-color, $secondary-color, $hover-color) {
|
|
8
|
+
background: $main-color;
|
|
9
|
+
color: $secondary-color;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
fill: $secondary-color;
|
|
12
|
-
path {
|
|
11
|
+
> .icon {
|
|
12
|
+
> svg {
|
|
13
13
|
fill: $secondary-color;
|
|
14
|
+
path {
|
|
15
|
+
fill: $secondary-color;
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
|
-
}
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
&:not(:disabled):hover,
|
|
21
|
+
&:not(:disabled):active {
|
|
22
|
+
background: $hover-color;
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
|
-
}
|
|
23
25
|
|
|
24
|
-
.button {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
.button {
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
gap: config.$space-1x;
|
|
32
|
+
cursor: default;
|
|
33
|
+
height: fit-content;
|
|
34
|
+
padding: config.$space-2x config.$space-3x;
|
|
35
|
+
border-radius: config.$corner-radius-m;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
border: 1px solid transparent;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
> .icon {
|
|
40
|
+
width: config.$icon-size-3x;
|
|
41
|
+
height: config.$icon-size-3x;
|
|
42
|
+
> svg {
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@include typography.body-medium;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
@include button-style(
|
|
50
|
-
color_alias.$primary-color-600,
|
|
51
|
-
color_alias.$neutral-white,
|
|
52
|
-
color_alias.$primary-color-1000
|
|
53
|
-
);
|
|
54
|
-
}
|
|
48
|
+
@include typography.body-medium;
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
50
|
+
&.primary {
|
|
51
|
+
@include button-style(
|
|
52
|
+
color_alias.$primary-color-600,
|
|
53
|
+
color_alias.$neutral-white,
|
|
54
|
+
color_alias.$primary-color-1000
|
|
55
|
+
);
|
|
56
|
+
}
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
&:not(:disabled):hover,
|
|
72
|
-
&:not(:disabled):active {
|
|
58
|
+
&.primary-outlined {
|
|
59
|
+
@include button-style(
|
|
60
|
+
transparent,
|
|
61
|
+
color_alias.$primary-color-600,
|
|
62
|
+
color_alias.$primary-color-50
|
|
63
|
+
);
|
|
73
64
|
border: 1px solid color_alias.$primary-color-600;
|
|
74
65
|
}
|
|
75
|
-
}
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
&.primary-ghost {
|
|
68
|
+
@include button-style(
|
|
69
|
+
transparent,
|
|
70
|
+
color_alias.$primary-color-600,
|
|
71
|
+
transparent
|
|
72
|
+
);
|
|
73
|
+
&:not(:disabled):hover,
|
|
74
|
+
&:not(:disabled):active {
|
|
75
|
+
border: 1px solid color_alias.$primary-color-600;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
79
|
+
&.error {
|
|
80
|
+
@include button-style(
|
|
81
|
+
color_alias.$error-color-600,
|
|
82
|
+
color_alias.$neutral-white,
|
|
83
|
+
color_alias.$error-color-900
|
|
84
|
+
);
|
|
85
|
+
}
|
|
93
86
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
&:not(:disabled):hover,
|
|
101
|
-
&:not(:disabled):active {
|
|
87
|
+
&.error-outlined {
|
|
88
|
+
@include button-style(
|
|
89
|
+
transparent,
|
|
90
|
+
color_alias.$error-color-600,
|
|
91
|
+
color_alias.$error-color-50
|
|
92
|
+
);
|
|
102
93
|
border: 1px solid color_alias.$error-color-600;
|
|
103
94
|
}
|
|
104
|
-
}
|
|
105
95
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
96
|
+
&.error-ghost {
|
|
97
|
+
@include button-style(
|
|
98
|
+
transparent,
|
|
99
|
+
color_alias.$error-color-600,
|
|
100
|
+
transparent
|
|
101
|
+
);
|
|
102
|
+
&:not(:disabled):hover,
|
|
103
|
+
&:not(:disabled):active {
|
|
104
|
+
border: 1px solid color_alias.$error-color-600;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.success {
|
|
109
|
+
@include button-style(
|
|
110
|
+
color_alias.$success-color-1000,
|
|
111
|
+
color_alias.$neutral-color-900,
|
|
112
|
+
color_alias.$success-color-700
|
|
113
|
+
);
|
|
114
|
+
&:not(:disabled):hover,
|
|
115
|
+
&:not(:disabled):active {
|
|
116
|
+
color: color_alias.$neutral-white;
|
|
117
|
+
> .icon {
|
|
118
|
+
> svg {
|
|
119
119
|
fill: color_alias.$neutral-white;
|
|
120
|
+
path {
|
|
121
|
+
fill: color_alias.$neutral-white;
|
|
122
|
+
}
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
|
-
}
|
|
125
127
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
border: 1px solid color_alias.$success-color-1000;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&.success-ghost {
|
|
136
|
-
@include button-style(
|
|
137
|
-
transparent,
|
|
138
|
-
color_alias.$success-color-1000,
|
|
139
|
-
transparent
|
|
140
|
-
);
|
|
141
|
-
&:not(:disabled):hover,
|
|
142
|
-
&:not(:disabled):active {
|
|
128
|
+
&.success-outlined {
|
|
129
|
+
@include button-style(
|
|
130
|
+
transparent,
|
|
131
|
+
color_alias.$neutral-color-900,
|
|
132
|
+
color_alias.$success-color-50
|
|
133
|
+
);
|
|
143
134
|
border: 1px solid color_alias.$success-color-1000;
|
|
144
135
|
}
|
|
145
|
-
}
|
|
146
136
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
137
|
+
&.success-ghost {
|
|
138
|
+
@include button-style(
|
|
139
|
+
transparent,
|
|
140
|
+
color_alias.$success-color-1000,
|
|
141
|
+
transparent
|
|
142
|
+
);
|
|
143
|
+
&:not(:disabled):hover,
|
|
144
|
+
&:not(:disabled):active {
|
|
145
|
+
border: 1px solid color_alias.$success-color-1000;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.warning {
|
|
150
|
+
@include button-style(
|
|
151
|
+
color_alias.$warning-color-1000,
|
|
152
|
+
color_alias.$neutral-color-900,
|
|
153
|
+
color_alias.$warning-color-700
|
|
154
|
+
);
|
|
155
|
+
&:not(:disabled):hover,
|
|
156
|
+
&:not(:disabled):active {
|
|
157
|
+
color: color_alias.$neutral-white;
|
|
158
|
+
> .icon {
|
|
159
|
+
> svg {
|
|
160
160
|
fill: color_alias.$neutral-white;
|
|
161
|
+
path {
|
|
162
|
+
fill: color_alias.$neutral-white;
|
|
163
|
+
}
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
|
-
}
|
|
166
168
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
border: 1px solid color_alias.$warning-color-1000;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
&.warning-ghost {
|
|
177
|
-
@include button-style(
|
|
178
|
-
transparent,
|
|
179
|
-
color_alias.$warning-color-1000,
|
|
180
|
-
transparent
|
|
181
|
-
);
|
|
182
|
-
&:not(:disabled):hover,
|
|
183
|
-
&:not(:disabled):active {
|
|
169
|
+
&.warning-outlined {
|
|
170
|
+
@include button-style(
|
|
171
|
+
transparent,
|
|
172
|
+
color_alias.$neutral-color-900,
|
|
173
|
+
color_alias.$warning-color-50
|
|
174
|
+
);
|
|
184
175
|
border: 1px solid color_alias.$warning-color-1000;
|
|
185
176
|
}
|
|
186
|
-
}
|
|
187
177
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
178
|
+
&.warning-ghost {
|
|
179
|
+
@include button-style(
|
|
180
|
+
transparent,
|
|
181
|
+
color_alias.$warning-color-1000,
|
|
182
|
+
transparent
|
|
183
|
+
);
|
|
184
|
+
&:not(:disabled):hover,
|
|
185
|
+
&:not(:disabled):active {
|
|
186
|
+
border: 1px solid color_alias.$warning-color-1000;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
195
189
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
190
|
+
&.info {
|
|
191
|
+
@include button-style(
|
|
192
|
+
color_alias.$info-color-600,
|
|
193
|
+
color_alias.$neutral-white,
|
|
194
|
+
color_alias.$info-color-900
|
|
195
|
+
);
|
|
196
|
+
}
|
|
204
197
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
&:not(:disabled):hover,
|
|
212
|
-
&:not(:disabled):active {
|
|
198
|
+
&.info-outlined {
|
|
199
|
+
@include button-style(
|
|
200
|
+
transparent,
|
|
201
|
+
color_alias.$info-color-600,
|
|
202
|
+
color_alias.$info-color-50
|
|
203
|
+
);
|
|
213
204
|
border: 1px solid color_alias.$info-color-600;
|
|
214
205
|
}
|
|
215
|
-
}
|
|
216
206
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
207
|
+
&.info-ghost {
|
|
208
|
+
@include button-style(
|
|
209
|
+
transparent,
|
|
210
|
+
color_alias.$info-color-600,
|
|
211
|
+
transparent
|
|
212
|
+
);
|
|
213
|
+
&:not(:disabled):hover,
|
|
214
|
+
&:not(:disabled):active {
|
|
215
|
+
border: 1px solid color_alias.$info-color-600;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
224
218
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
219
|
+
&.neutral {
|
|
220
|
+
@include button-style(
|
|
221
|
+
color_alias.$neutral-color-100,
|
|
222
|
+
color_alias.$neutral-color-1000,
|
|
223
|
+
color_alias.$neutral-color-300
|
|
224
|
+
);
|
|
225
|
+
}
|
|
233
226
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
&:not(:disabled):hover,
|
|
241
|
-
&:not(:disabled):active {
|
|
227
|
+
&.neutral-outlined {
|
|
228
|
+
@include button-style(
|
|
229
|
+
transparent,
|
|
230
|
+
color_alias.$neutral-color-1000,
|
|
231
|
+
color_alias.$neutral-color-50
|
|
232
|
+
);
|
|
242
233
|
border: 1px solid color_alias.$neutral-color-100;
|
|
243
234
|
}
|
|
244
|
-
}
|
|
245
235
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
236
|
+
&.neutral-ghost {
|
|
237
|
+
@include button-style(
|
|
238
|
+
transparent,
|
|
239
|
+
color_alias.$neutral-color-1000,
|
|
240
|
+
transparent
|
|
241
|
+
);
|
|
242
|
+
&:not(:disabled):hover,
|
|
243
|
+
&:not(:disabled):active {
|
|
244
|
+
border: 1px solid color_alias.$neutral-color-100;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:disabled {
|
|
249
|
+
color: color_alias.$neutral-color-400;
|
|
250
|
+
> .icon {
|
|
251
|
+
> svg {
|
|
252
252
|
fill: color_alias.$neutral-color-400;
|
|
253
|
+
path {
|
|
254
|
+
fill: color_alias.$neutral-color-400;
|
|
255
|
+
}
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
|
-
}
|
|
257
259
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
&.primary,
|
|
261
|
+
&.error,
|
|
262
|
+
&.success,
|
|
263
|
+
&.warning,
|
|
264
|
+
&.info,
|
|
265
|
+
&.neutral {
|
|
266
|
+
&:disabled {
|
|
267
|
+
background: color_alias.$neutral-color-50;
|
|
268
|
+
}
|
|
266
269
|
}
|
|
267
|
-
}
|
|
268
270
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
271
|
+
&.primary-outlined,
|
|
272
|
+
&.error-outlined,
|
|
273
|
+
&.success-outlined,
|
|
274
|
+
&.warning-outlined,
|
|
275
|
+
&.info-outlined,
|
|
276
|
+
&.neutral-outlined {
|
|
277
|
+
&:disabled {
|
|
278
|
+
background: transparent;
|
|
279
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
280
|
+
}
|
|
278
281
|
}
|
|
279
282
|
}
|
|
280
283
|
}
|
|
@@ -1,48 +1,51 @@
|
|
|
1
1
|
@use '../../settings/color_alias';
|
|
2
2
|
@use '../../settings/config';
|
|
3
|
+
@use '../../settings/layers';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
@layer icon-button {
|
|
6
|
+
.icon-button {
|
|
7
|
+
border: none;
|
|
8
|
+
background: none;
|
|
9
|
+
cursor: default;
|
|
10
|
+
padding: 0;
|
|
9
11
|
|
|
10
|
-
> .icon {
|
|
11
|
-
width: config.$icon-size-5x;
|
|
12
|
-
height: config.$icon-size-5x;
|
|
13
|
-
> svg {
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&.primary {
|
|
20
12
|
> .icon {
|
|
13
|
+
width: config.$icon-size-5x;
|
|
14
|
+
height: config.$icon-size-5x;
|
|
21
15
|
> svg {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
fill: color_alias.$primary-color-600;
|
|
25
|
-
}
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
26
18
|
}
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
|
|
21
|
+
&.primary {
|
|
30
22
|
> .icon {
|
|
31
23
|
> svg {
|
|
32
|
-
fill: color_alias.$primary-color-
|
|
24
|
+
fill: color_alias.$primary-color-600;
|
|
33
25
|
path {
|
|
26
|
+
fill: color_alias.$primary-color-600;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
> .icon {
|
|
33
|
+
> svg {
|
|
34
34
|
fill: color_alias.$primary-color-1000;
|
|
35
|
+
path {
|
|
36
|
+
fill: color_alias.$primary-color-1000;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
fill: color_alias.$neutral-color-400;
|
|
44
|
-
path {
|
|
42
|
+
&:disabled {
|
|
43
|
+
> .icon {
|
|
44
|
+
> svg {
|
|
45
45
|
fill: color_alias.$neutral-color-400;
|
|
46
|
+
path {
|
|
47
|
+
fill: color_alias.$neutral-color-400;
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -21,7 +21,7 @@ export function IconButton({
|
|
|
21
21
|
variant = 'primary',
|
|
22
22
|
...props
|
|
23
23
|
}: IconButtonProps) {
|
|
24
|
-
const cssClasses = classNames('icon-button', variant
|
|
24
|
+
const cssClasses = classNames(props.className, 'icon-button', variant)
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<BaseButton
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Button } from './Button'
|
|
2
2
|
import { IconButton } from './IconButton'
|
|
3
3
|
import { FloatingButton } from './FloatingButton'
|
|
4
|
+
import { BaseButton } from './BaseButton'
|
|
4
5
|
|
|
5
6
|
export type { ButtonProps } from './Button'
|
|
6
7
|
export type { IconButtonProps } from './IconButton'
|
|
7
8
|
export type { FloatingButtonProps } from './FloatingButton'
|
|
9
|
+
export type { BaseButtonProps } from './BaseButton'
|
|
8
10
|
|
|
9
|
-
export { Button, IconButton, FloatingButton }
|
|
11
|
+
export { Button, IconButton, FloatingButton, BaseButton }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { classNames } from '../../utils/classNames'
|
|
3
|
+
import './Pagination.scss'
|
|
4
|
+
|
|
5
|
+
export interface EllipsisProps extends React.ComponentPropsWithoutRef<'span'> {}
|
|
6
|
+
|
|
7
|
+
export function Ellipsis({
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}: EllipsisProps): React.JSX.Element {
|
|
11
|
+
const cssClasses = classNames('ellipsis', className)
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<span className={cssClasses} {...props}>
|
|
15
|
+
...
|
|
16
|
+
</span>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@use '../../settings/color_alias';
|
|
2
|
+
@use '../../settings/typography/form' as form-typography;
|
|
3
|
+
@use '../../settings/typography/content' as typography;
|
|
4
|
+
@use '../../settings/config';
|
|
5
|
+
@use '../../settings/layers';
|
|
6
|
+
|
|
7
|
+
@layer pagination-button {
|
|
8
|
+
.pagination {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: config.$space-2x;
|
|
14
|
+
width: 100%;
|
|
15
|
+
|
|
16
|
+
.ellipsis {
|
|
17
|
+
@include typography.body-regular-primary;
|
|
18
|
+
color: color_alias.$neutral-color-600;
|
|
19
|
+
margin: 0 config.$space-2x 0.625rem config.$space-2x;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pagination-button {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: config.$space-2x;
|
|
27
|
+
border-radius: config.$corner-radius-xxs;
|
|
28
|
+
padding: config.$space-2x;
|
|
29
|
+
width: config.$icon-size-7x;
|
|
30
|
+
height: config.$icon-size-7x;
|
|
31
|
+
|
|
32
|
+
&.primary {
|
|
33
|
+
border: 1px solid color_alias.$neutral-color-600;
|
|
34
|
+
background: color_alias.$neutral-white;
|
|
35
|
+
@include typography.body-regular-primary;
|
|
36
|
+
> .icon {
|
|
37
|
+
> svg {
|
|
38
|
+
fill: color_alias.$primary-color-600;
|
|
39
|
+
path {
|
|
40
|
+
fill: color_alias.$primary-color-600;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
border: 1px solid color_alias.$primary-color-1000;
|
|
47
|
+
background: color_alias.$primary-color-50;
|
|
48
|
+
color: color_alias.$primary-color-1000;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.selected {
|
|
52
|
+
border: 1px solid color_alias.$primary-color-1000;
|
|
53
|
+
color: color_alias.$primary-color-1000;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:disabled,
|
|
57
|
+
&.disabled {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
60
|
+
background: color_alias.$neutral-color-50;
|
|
61
|
+
color: color_alias.$neutral-color-400;
|
|
62
|
+
> .icon {
|
|
63
|
+
> svg {
|
|
64
|
+
fill: color_alias.$neutral-color-400;
|
|
65
|
+
path {
|
|
66
|
+
fill: color_alias.$neutral-color-400;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.small {
|
|
75
|
+
.pagination-button {
|
|
76
|
+
width: config.$icon-size-5x;
|
|
77
|
+
height: config.$icon-size-5x;
|
|
78
|
+
gap: config.$space-1x;
|
|
79
|
+
padding: config.$space-1x;
|
|
80
|
+
|
|
81
|
+
&.primary {
|
|
82
|
+
border: 1px solid transparent;
|
|
83
|
+
background: none;
|
|
84
|
+
|
|
85
|
+
&.selected,
|
|
86
|
+
&:hover {
|
|
87
|
+
border: 1px solid color_alias.$primary-color-1000;
|
|
88
|
+
color: color_alias.$primary-color-1000;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { classNames } from '../../utils/classNames'
|
|
3
|
+
import './Pagination.scss'
|
|
4
|
+
|
|
5
|
+
type Size = 'small' | 'medium'
|
|
6
|
+
|
|
7
|
+
export interface PaginationProps
|
|
8
|
+
extends React.ComponentPropsWithoutRef<'section'> {
|
|
9
|
+
size?: Size
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Pagination({
|
|
13
|
+
size = 'medium',
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
}: PaginationProps): React.JSX.Element {
|
|
18
|
+
const cssClasses = classNames('pagination', className, {
|
|
19
|
+
small: size === 'small',
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<section role="navigation" className={cssClasses} {...props}>
|
|
24
|
+
{children}
|
|
25
|
+
</section>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { classNames } from '../../utils/classNames'
|
|
3
|
+
import './Pagination.scss'
|
|
4
|
+
import { IconButton, IconButtonProps } from '../Button'
|
|
5
|
+
|
|
6
|
+
export type Variant = 'primary'
|
|
7
|
+
|
|
8
|
+
export interface CustomProps {
|
|
9
|
+
href: string
|
|
10
|
+
accessibilityLabel?: string
|
|
11
|
+
variant?: Variant
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type PaginationArrowProps = CustomProps & IconButtonProps
|
|
15
|
+
|
|
16
|
+
export function PaginationArrow({
|
|
17
|
+
accessibilityLabel,
|
|
18
|
+
variant = 'primary',
|
|
19
|
+
href,
|
|
20
|
+
className,
|
|
21
|
+
disabled,
|
|
22
|
+
...props
|
|
23
|
+
}: PaginationArrowProps): React.JSX.Element {
|
|
24
|
+
const cssClasses = classNames('pagination-button', variant, className, {
|
|
25
|
+
disabled: disabled,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<IconButton
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
href={disabled ? '#' : href}
|
|
32
|
+
className={cssClasses}
|
|
33
|
+
accessibilityLabel={accessibilityLabel}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { classNames } from '../../utils/classNames'
|
|
3
|
+
import './Pagination.scss'
|
|
4
|
+
import { Button, ButtonProps } from '../Button'
|
|
5
|
+
|
|
6
|
+
export type Variant = 'primary'
|
|
7
|
+
|
|
8
|
+
export interface CustomProps {
|
|
9
|
+
href: string
|
|
10
|
+
selected?: boolean
|
|
11
|
+
label: string
|
|
12
|
+
accessibilityLabel?: string
|
|
13
|
+
variant?: Variant
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type PaginationNumberProps = CustomProps & ButtonProps
|
|
17
|
+
|
|
18
|
+
export function PaginationNumber({
|
|
19
|
+
label,
|
|
20
|
+
accessibilityLabel,
|
|
21
|
+
variant = 'primary',
|
|
22
|
+
href,
|
|
23
|
+
className,
|
|
24
|
+
disabled,
|
|
25
|
+
selected = false,
|
|
26
|
+
...props
|
|
27
|
+
}: PaginationNumberProps): React.JSX.Element {
|
|
28
|
+
const cssClasses = classNames('pagination-button', variant, className, {
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
selected: selected,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Button
|
|
35
|
+
label={label}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
href={disabled ? '#' : href}
|
|
38
|
+
className={cssClasses}
|
|
39
|
+
aria-current={selected}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer base-button, icon-button, pagination-button;
|
|
@@ -4,7 +4,12 @@ import { Meta } from "@storybook/blocks";
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
-
## 0.
|
|
7
|
+
## 0.19.0
|
|
8
|
+
|
|
9
|
+
* Add Pagination, Ellipsis, PaginationArrow and PaginationNumber components
|
|
10
|
+
* Add explicit margin-bottom to Empty State button component
|
|
11
|
+
|
|
12
|
+
## 0.18.4 / 0.18.5
|
|
8
13
|
|
|
9
14
|
* Add series icon
|
|
10
15
|
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Pagination, PaginationArrow, PaginationNumber, Ellipsis } from '../atoms/Pagination'
|
|
4
|
+
|
|
5
|
+
const figmaPrimaryDesign = {
|
|
6
|
+
design: {
|
|
7
|
+
type: 'figma',
|
|
8
|
+
url: 'https://www.figma.com/design/DN2ova21vWqCRvPspBXgI1/Design-System?node-id=2699-4057&m=dev',
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'Design System/Atoms/Pagination',
|
|
14
|
+
component: Pagination,
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
size: {
|
|
18
|
+
description: 'Pagination size (small, medium)',
|
|
19
|
+
},
|
|
20
|
+
variant: {
|
|
21
|
+
description: 'Component variant used',
|
|
22
|
+
},
|
|
23
|
+
href: {
|
|
24
|
+
description: 'Link to the page',
|
|
25
|
+
},
|
|
26
|
+
variant: {
|
|
27
|
+
description: 'Component variant used',
|
|
28
|
+
},
|
|
29
|
+
selected: {
|
|
30
|
+
description: 'Is PageNumber the current page?',
|
|
31
|
+
},
|
|
32
|
+
accessibilityLabel: {
|
|
33
|
+
description: 'Label for accessibility purposes',
|
|
34
|
+
},
|
|
35
|
+
label: {
|
|
36
|
+
description: 'PageNumber label',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
parameters: figmaPrimaryDesign,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default meta
|
|
43
|
+
|
|
44
|
+
export const BasicPagination = {
|
|
45
|
+
render: () => (
|
|
46
|
+
<Pagination>
|
|
47
|
+
<PaginationArrow
|
|
48
|
+
icon="AngleLeft"
|
|
49
|
+
href="https://google.com"
|
|
50
|
+
accessibilityLabel="Previous page"
|
|
51
|
+
variant="primary"
|
|
52
|
+
disabled
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<PaginationNumber
|
|
56
|
+
label="1"
|
|
57
|
+
href="https://google.com"
|
|
58
|
+
accessibilityLabel="Go to page 1"
|
|
59
|
+
variant="primary"
|
|
60
|
+
selected
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<PaginationNumber
|
|
64
|
+
label="2"
|
|
65
|
+
href="https://google.com"
|
|
66
|
+
accessibilityLabel="Go to page 2"
|
|
67
|
+
variant="primary"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<PaginationArrow
|
|
71
|
+
icon="AngleRight"
|
|
72
|
+
href="https://google.com"
|
|
73
|
+
accessibilityLabel="Next page"
|
|
74
|
+
variant="primary"
|
|
75
|
+
/>
|
|
76
|
+
</Pagination>
|
|
77
|
+
),
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const MiniPagination = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<Pagination size="small">
|
|
83
|
+
<PaginationArrow
|
|
84
|
+
icon="AngleLeft"
|
|
85
|
+
href="https://google.com"
|
|
86
|
+
accessibilityLabel="Previous page"
|
|
87
|
+
variant="primary"
|
|
88
|
+
disabled
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<PaginationNumber
|
|
92
|
+
label="1"
|
|
93
|
+
href="https://google.com"
|
|
94
|
+
accessibilityLabel="Go to page 1"
|
|
95
|
+
variant="primary"
|
|
96
|
+
selected
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<PaginationNumber
|
|
100
|
+
label="2"
|
|
101
|
+
href="https://google.com"
|
|
102
|
+
accessibilityLabel="Go to page 2"
|
|
103
|
+
variant="primary"
|
|
104
|
+
/>
|
|
105
|
+
|
|
106
|
+
<PaginationNumber
|
|
107
|
+
label="3"
|
|
108
|
+
href="https://google.com"
|
|
109
|
+
accessibilityLabel="Go to page 3"
|
|
110
|
+
variant="primary"
|
|
111
|
+
selected
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
<PaginationNumber
|
|
115
|
+
label="4"
|
|
116
|
+
href="https://google.com"
|
|
117
|
+
accessibilityLabel="Go to page 4"
|
|
118
|
+
variant="primary"
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<PaginationNumber
|
|
122
|
+
label="5"
|
|
123
|
+
href="https://google.com"
|
|
124
|
+
accessibilityLabel="Go to page 5"
|
|
125
|
+
variant="primary"
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<PaginationArrow
|
|
129
|
+
icon="AngleRight"
|
|
130
|
+
href="https://google.com"
|
|
131
|
+
accessibilityLabel="Next page"
|
|
132
|
+
variant="primary"
|
|
133
|
+
/>
|
|
134
|
+
</Pagination>
|
|
135
|
+
),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const AdvancedPagination = {
|
|
139
|
+
render: () => (
|
|
140
|
+
<Pagination>
|
|
141
|
+
<PaginationArrow
|
|
142
|
+
icon="AngleLeft"
|
|
143
|
+
href="https://google.com"
|
|
144
|
+
accessibilityLabel="Previous page"
|
|
145
|
+
variant="primary"
|
|
146
|
+
disabled
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<PaginationNumber
|
|
150
|
+
label="1"
|
|
151
|
+
href="https://google.com"
|
|
152
|
+
accessibilityLabel="Go to page 1"
|
|
153
|
+
variant="primary"
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<Ellipsis />
|
|
157
|
+
|
|
158
|
+
<PaginationNumber
|
|
159
|
+
label="4"
|
|
160
|
+
href="https://google.com"
|
|
161
|
+
accessibilityLabel="Go to page 4"
|
|
162
|
+
variant="primary"
|
|
163
|
+
/>
|
|
164
|
+
<PaginationNumber
|
|
165
|
+
label="5"
|
|
166
|
+
href="https://google.com"
|
|
167
|
+
accessibilityLabel="Go to page 5"
|
|
168
|
+
variant="primary"
|
|
169
|
+
/>
|
|
170
|
+
<PaginationNumber
|
|
171
|
+
label="6"
|
|
172
|
+
href="https://google.com"
|
|
173
|
+
accessibilityLabel="Go to page 6"
|
|
174
|
+
variant="primary"
|
|
175
|
+
selected
|
|
176
|
+
/>
|
|
177
|
+
<PaginationNumber
|
|
178
|
+
label="7"
|
|
179
|
+
href="https://google.com"
|
|
180
|
+
accessibilityLabel="Go to page 7"
|
|
181
|
+
variant="primary"
|
|
182
|
+
/>
|
|
183
|
+
<PaginationNumber
|
|
184
|
+
label="8"
|
|
185
|
+
href="https://google.com"
|
|
186
|
+
accessibilityLabel="Go to page 8"
|
|
187
|
+
variant="primary"
|
|
188
|
+
/>
|
|
189
|
+
|
|
190
|
+
<Ellipsis />
|
|
191
|
+
|
|
192
|
+
<PaginationNumber
|
|
193
|
+
label="50"
|
|
194
|
+
href="https://google.com"
|
|
195
|
+
accessibilityLabel="Go to page 50"
|
|
196
|
+
variant="primary"
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<PaginationArrow
|
|
200
|
+
icon="AngleRight"
|
|
201
|
+
href="https://google.com"
|
|
202
|
+
accessibilityLabel="Next page"
|
|
203
|
+
variant="primary"
|
|
204
|
+
/>
|
|
205
|
+
</Pagination>
|
|
206
|
+
),
|
|
207
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import {
|
|
4
|
+
Pagination,
|
|
5
|
+
PaginationArrow,
|
|
6
|
+
PaginationNumber,
|
|
7
|
+
Ellipsis,
|
|
8
|
+
} from '@/atoms/Pagination'
|
|
9
|
+
|
|
10
|
+
describe('Pagination', () => {
|
|
11
|
+
it('renders Pagination components', () => {
|
|
12
|
+
const { getByRole, getByText, getAllByText, getByLabelText } = render(
|
|
13
|
+
<Pagination>
|
|
14
|
+
<PaginationArrow
|
|
15
|
+
icon="AngleLeft"
|
|
16
|
+
href="https://google.com"
|
|
17
|
+
accessibilityLabel="Previous page"
|
|
18
|
+
variant="primary"
|
|
19
|
+
disabled
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<PaginationNumber
|
|
23
|
+
label="1"
|
|
24
|
+
href="https://google.com"
|
|
25
|
+
accessibilityLabel="Go to page 1"
|
|
26
|
+
variant="primary"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<Ellipsis />
|
|
30
|
+
|
|
31
|
+
<PaginationNumber
|
|
32
|
+
label="4"
|
|
33
|
+
href="https://google.com"
|
|
34
|
+
accessibilityLabel="Go to page 4"
|
|
35
|
+
variant="primary"
|
|
36
|
+
/>
|
|
37
|
+
<PaginationNumber
|
|
38
|
+
label="5"
|
|
39
|
+
href="https://google.com"
|
|
40
|
+
accessibilityLabel="Go to page 5"
|
|
41
|
+
variant="primary"
|
|
42
|
+
/>
|
|
43
|
+
<PaginationNumber
|
|
44
|
+
label="6"
|
|
45
|
+
href="https://google.com"
|
|
46
|
+
accessibilityLabel="Go to page 6"
|
|
47
|
+
variant="primary"
|
|
48
|
+
selected
|
|
49
|
+
/>
|
|
50
|
+
<PaginationNumber
|
|
51
|
+
label="7"
|
|
52
|
+
href="https://google.com"
|
|
53
|
+
accessibilityLabel="Go to page 7"
|
|
54
|
+
variant="primary"
|
|
55
|
+
/>
|
|
56
|
+
<PaginationNumber
|
|
57
|
+
label="8"
|
|
58
|
+
href="https://google.com"
|
|
59
|
+
accessibilityLabel="Go to page 8"
|
|
60
|
+
variant="primary"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<Ellipsis />
|
|
64
|
+
|
|
65
|
+
<PaginationNumber
|
|
66
|
+
label="50"
|
|
67
|
+
href="https://google.com"
|
|
68
|
+
accessibilityLabel="Go to page 50"
|
|
69
|
+
variant="primary"
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<PaginationArrow
|
|
73
|
+
icon="AngleRight"
|
|
74
|
+
href="https://google.com"
|
|
75
|
+
accessibilityLabel="Next page"
|
|
76
|
+
variant="primary"
|
|
77
|
+
/>
|
|
78
|
+
</Pagination>,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
expect(getByRole('navigation')).toHaveClass(`pagination`)
|
|
82
|
+
expect(getByRole('img', { name: 'AngleLeft' })).toBeInTheDocument()
|
|
83
|
+
expect(getByRole('img', { name: 'AngleRight' })).toBeInTheDocument()
|
|
84
|
+
expect(getByText('1')).toBeInTheDocument()
|
|
85
|
+
expect(getByText('4')).toBeInTheDocument()
|
|
86
|
+
expect(getByText('5')).toBeInTheDocument()
|
|
87
|
+
expect(getByText('6')).toBeInTheDocument()
|
|
88
|
+
expect(getByText('7')).toBeInTheDocument()
|
|
89
|
+
expect(getByText('8')).toBeInTheDocument()
|
|
90
|
+
expect(getByText('50')).toBeInTheDocument()
|
|
91
|
+
expect(getAllByText('...').length).toBe(2)
|
|
92
|
+
expect(getByText('6')).toHaveClass(`selected`)
|
|
93
|
+
expect(getByLabelText('Previous page')).toHaveClass(`disabled`)
|
|
94
|
+
})
|
|
95
|
+
})
|