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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "0.18.5",
3
+ "version": "0.19.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -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
- @mixin button-style($main-color, $secondary-color, $hover-color) {
6
- background: $main-color;
7
- color: $secondary-color;
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
- > .icon {
10
- > svg {
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
- &:not(:disabled):hover,
19
- &:not(:disabled):active {
20
- background: $hover-color;
20
+ &:not(:disabled):hover,
21
+ &:not(:disabled):active {
22
+ background: $hover-color;
23
+ }
21
24
  }
22
- }
23
25
 
24
- .button {
25
- display: inline-flex;
26
- justify-content: center;
27
- align-items: center;
28
- flex-shrink: 0;
29
- gap: config.$space-1x;
30
- cursor: default;
31
- height: fit-content;
32
- padding: config.$space-2x config.$space-3x;
33
- border-radius: config.$corner-radius-m;
34
- text-decoration: none;
35
- border: 1px solid transparent;
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
- > .icon {
38
- width: config.$icon-size-3x;
39
- height: config.$icon-size-3x;
40
- > svg {
41
- width: 100%;
42
- height: 100%;
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
- &.primary {
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
- &.primary-outlined {
57
- @include button-style(
58
- transparent,
59
- color_alias.$primary-color-600,
60
- color_alias.$primary-color-50
61
- );
62
- border: 1px solid color_alias.$primary-color-600;
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
- &.primary-ghost {
66
- @include button-style(
67
- transparent,
68
- color_alias.$primary-color-600,
69
- transparent
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
- &.error {
78
- @include button-style(
79
- color_alias.$error-color-600,
80
- color_alias.$neutral-white,
81
- color_alias.$error-color-900
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
- &.error-outlined {
86
- @include button-style(
87
- transparent,
88
- color_alias.$error-color-600,
89
- color_alias.$error-color-50
90
- );
91
- border: 1px solid color_alias.$error-color-600;
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
- &.error-ghost {
95
- @include button-style(
96
- transparent,
97
- color_alias.$error-color-600,
98
- transparent
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
- &.success {
107
- @include button-style(
108
- color_alias.$success-color-1000,
109
- color_alias.$neutral-color-900,
110
- color_alias.$success-color-700
111
- );
112
- &:not(:disabled):hover,
113
- &:not(:disabled):active {
114
- color: color_alias.$neutral-white;
115
- > .icon {
116
- > svg {
117
- fill: color_alias.$neutral-white;
118
- path {
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
- &.success-outlined {
127
- @include button-style(
128
- transparent,
129
- color_alias.$neutral-color-900,
130
- color_alias.$success-color-50
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
- &.warning {
148
- @include button-style(
149
- color_alias.$warning-color-1000,
150
- color_alias.$neutral-color-900,
151
- color_alias.$warning-color-700
152
- );
153
- &:not(:disabled):hover,
154
- &:not(:disabled):active {
155
- color: color_alias.$neutral-white;
156
- > .icon {
157
- > svg {
158
- fill: color_alias.$neutral-white;
159
- path {
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
- &.warning-outlined {
168
- @include button-style(
169
- transparent,
170
- color_alias.$neutral-color-900,
171
- color_alias.$warning-color-50
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
- &.info {
189
- @include button-style(
190
- color_alias.$info-color-600,
191
- color_alias.$neutral-white,
192
- color_alias.$info-color-900
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
- &.info-outlined {
197
- @include button-style(
198
- transparent,
199
- color_alias.$info-color-600,
200
- color_alias.$info-color-50
201
- );
202
- border: 1px solid color_alias.$info-color-600;
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
- &.info-ghost {
206
- @include button-style(
207
- transparent,
208
- color_alias.$info-color-600,
209
- transparent
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
- &.neutral {
218
- @include button-style(
219
- color_alias.$neutral-color-100,
220
- color_alias.$neutral-color-1000,
221
- color_alias.$neutral-color-300
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
- &.neutral-outlined {
226
- @include button-style(
227
- transparent,
228
- color_alias.$neutral-color-1000,
229
- color_alias.$neutral-color-50
230
- );
231
- border: 1px solid color_alias.$neutral-color-100;
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
- &.neutral-ghost {
235
- @include button-style(
236
- transparent,
237
- color_alias.$neutral-color-1000,
238
- transparent
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
- &:disabled {
247
- color: color_alias.$neutral-color-400;
248
- > .icon {
249
- > svg {
250
- fill: color_alias.$neutral-color-400;
251
- path {
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
- &.primary,
259
- &.error,
260
- &.success,
261
- &.warning,
262
- &.info,
263
- &.neutral {
264
- &:disabled {
265
- background: color_alias.$neutral-color-50;
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
- &.primary-outlined,
270
- &.error-outlined,
271
- &.success-outlined,
272
- &.warning-outlined,
273
- &.info-outlined,
274
- &.neutral-outlined {
275
- &:disabled {
276
- background: transparent;
277
- border: 1px solid color_alias.$neutral-color-400;
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
  }
@@ -48,7 +48,7 @@ export function Button({
48
48
  if (loading) {
49
49
  leftIcon = 'Loading'
50
50
  }
51
- const cssClasses = classNames('button', variant, props.className)
51
+ const cssClasses = classNames(props.className, 'button', variant)
52
52
 
53
53
  return (
54
54
  <BaseButton
@@ -1,48 +1,51 @@
1
1
  @use '../../settings/color_alias';
2
2
  @use '../../settings/config';
3
+ @use '../../settings/layers';
3
4
 
4
- .icon-button {
5
- border: none;
6
- background: none;
7
- cursor: default;
8
- padding: 0;
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
- fill: color_alias.$primary-color-600;
23
- path {
24
- fill: color_alias.$primary-color-600;
25
- }
16
+ width: 100%;
17
+ height: 100%;
26
18
  }
27
19
  }
28
20
 
29
- &:hover {
21
+ &.primary {
30
22
  > .icon {
31
23
  > svg {
32
- fill: color_alias.$primary-color-1000;
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
- &:disabled {
41
- > .icon {
42
- > svg {
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, props.className)
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 }
@@ -11,6 +11,7 @@
11
11
 
12
12
  > p {
13
13
  margin-top: config.$space-2x;
14
+ margin-bottom: config.$space-4x;
14
15
  }
15
16
 
16
17
  &:not(:has(> .button)) {
@@ -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,6 @@
1
+ import { Pagination } from './Pagination'
2
+ import { PaginationArrow } from './PaginationArrow'
3
+ import { PaginationNumber } from './PaginationNumber'
4
+ import { Ellipsis } from './Ellipsis'
5
+
6
+ export { Pagination, PaginationArrow, PaginationNumber, Ellipsis }
@@ -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.18.4
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
+ })