@innovaccer/design-system 2.13.4-5 → 2.13.4-7
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/core/common.type.tsx +70 -0
- package/core/components/atoms/button/Button.tsx +1 -1
- package/core/components/atoms/button/__stories__/IconButtonGroup.story.jsx +6 -2
- package/core/components/atoms/dropdown/DropdownList.tsx +2 -3
- package/core/components/atoms/link/Link.tsx +1 -1
- package/core/components/atoms/link/__tests__/Link.test.tsx +24 -2
- package/core/components/atoms/metricInput/MetricInput.tsx +3 -1
- package/core/components/atoms/metricInput/__tests__/MetricInput.test.tsx +2 -2
- package/core/components/atoms/metricInput/__tests__/__snapshots__/MetricInput.test.tsx.snap +20 -12
- package/core/components/atoms/progressBar/__stories__/WithAnimation.story.jsx +29 -0
- package/core/components/atoms/progressRing/__stories__/WithAnimation.story.tsx +29 -0
- package/core/components/atoms/text/Text.tsx +9 -3
- package/core/components/atoms/text/__stories__/variants/Color.story.jsx +108 -0
- package/core/components/atoms/text/__tests__/Text.test.tsx +18 -2
- package/core/components/molecules/pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +5 -3
- package/core/components/organisms/calendar/Calendar.tsx +8 -5
- package/core/components/organisms/horizontalNav/HorizontalNav.tsx +11 -4
- package/core/components/organisms/horizontalNav/__stories__/default.story.jsx +2 -2
- package/core/components/organisms/horizontalNav/__stories__/index.story.jsx +4 -18
- package/core/components/organisms/horizontalNav/__stories__/withCount.story.jsx +2 -2
- package/core/components/organisms/horizontalNav/__stories__/withIcon.story.jsx +2 -2
- package/core/components/organisms/horizontalNav/__tests__/HorizontalNav.test.tsx +24 -4
- package/core/components/organisms/horizontalNav/__tests__/__snapshots__/HorizontalNav.test.tsx.snap +9 -6
- package/core/components/organisms/navigation/__tests__/__snapshots__/Navigation.test.tsx.snap +36 -24
- package/core/components/organisms/pageHeader/PageHeader.tsx +21 -10
- package/core/components/organisms/table/__stories__/Filtering.story.jsx +1 -1
- package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.jsx +44 -0
- package/core/components/organisms/table/__stories__/TableAsDescriptionList.story.jsx +25 -1
- package/core/components/organisms/table/__stories__/asyncTable.story.jsx +4 -2
- package/core/components/organisms/table/__stories__/syncTable.story.jsx +3 -2
- package/core/components/organisms/table/__stories__/variants/nestedRows.story.jsx +4 -2
- package/core/components/organisms/table/__stories__/variants/showHead.story.jsx +119 -1
- package/core/components/organisms/table/__stories__/variants/showMenu.story.jsx +61 -0
- package/core/components/organisms/table/__stories__/variants/size.story.jsx +62 -0
- package/core/components/organisms/table/__stories__/variants/syncLoaderSchema.story.jsx +0 -1
- package/core/components/organisms/table/__stories__/variants/type.story.jsx +69 -0
- package/core/components/organisms/table/__stories__/variants/withCheckbox.story.jsx +69 -0
- package/core/components/organisms/table/__stories__/variants/withEditableCell.story.jsx +4 -2
- package/core/components/organisms/table/__stories__/variants/withHeader.story.jsx +135 -2
- package/core/components/organisms/table/__stories__/variants/withPagination.story.jsx +90 -0
- package/core/components/patterns/table/{Table with Header → TableWithHeader}/style.css +0 -0
- package/core/components/patterns/table/{Table with Header/tableWithHeader.story.jsx → TableWithHeader/tableWithHeader.story.jsx} +2 -2
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +1 -9
- package/core/utils/navigationHelper.tsx +8 -0
- package/css/dist/index.css +368 -19
- package/css/dist/index.css.map +1 -1
- package/css/src/components/ProgressBar.css +1 -1
- package/css/src/components/button.css +27 -6
- package/css/src/components/horizontalNav.css +26 -4
- package/css/src/components/input.css +5 -2
- package/css/src/components/link.css +15 -4
- package/css/src/components/pageHeader.css +11 -0
- package/css/src/components/progressRing.css +1 -1
- package/css/src/components/textarea.css +1 -1
- package/css/src/utils/textColor.css +280 -0
- package/dist/core/common.type.d.ts +1 -0
- package/dist/core/components/atoms/text/Text.d.ts +2 -0
- package/dist/core/utils/navigationHelper.d.ts +2 -0
- package/dist/index.esm.js +49 -33
- package/dist/index.js +67 -47
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-1.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-10.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-11.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-12.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-13.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-14.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-15.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-2.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-3.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-4.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-5.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-6.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-7.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-8.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layout-9.png +0 -0
- package/docs/src/pages/patterns/layouts/usage.mdx +29 -26
- package/package.json +1 -1
- package/docs/src/pages/patterns/layouts/images/layouts-1.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-10.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-11.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-12.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-13.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-14.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-15.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-16.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-17.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-2.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-3.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-4.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-5.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-6.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-7.jpg +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-8.png +0 -0
- package/docs/src/pages/patterns/layouts/images/layouts-9.png +0 -0
package/core/common.type.tsx
CHANGED
|
@@ -20,3 +20,73 @@ export type FooterOptions = {
|
|
|
20
20
|
export type AutoComplete = 'on' | 'off';
|
|
21
21
|
export type NumberRange = [number, number];
|
|
22
22
|
export type ChangeEvent = React.ChangeEvent<HTMLInputElement>;
|
|
23
|
+
|
|
24
|
+
export type TextColor =
|
|
25
|
+
| 'white'
|
|
26
|
+
| 'primary'
|
|
27
|
+
| 'secondary'
|
|
28
|
+
| 'success'
|
|
29
|
+
| 'alert'
|
|
30
|
+
| 'warning'
|
|
31
|
+
| 'accent1'
|
|
32
|
+
| 'accent2'
|
|
33
|
+
| 'accent3'
|
|
34
|
+
| 'accent4'
|
|
35
|
+
| 'inverse'
|
|
36
|
+
| 'primary-dark'
|
|
37
|
+
| 'secondary-dark'
|
|
38
|
+
| 'success-dark'
|
|
39
|
+
| 'alert-dark'
|
|
40
|
+
| 'warning-dark'
|
|
41
|
+
| 'accent1-dark'
|
|
42
|
+
| 'accent2-dark'
|
|
43
|
+
| 'accent3-dark'
|
|
44
|
+
| 'accent4-dark'
|
|
45
|
+
| 'primary-darker'
|
|
46
|
+
| 'success-darker'
|
|
47
|
+
| 'alert-darker'
|
|
48
|
+
| 'warning-darker'
|
|
49
|
+
| 'accent1-darker'
|
|
50
|
+
| 'accent2-darker'
|
|
51
|
+
| 'accent3-darker'
|
|
52
|
+
| 'accent4-darker'
|
|
53
|
+
| 'primary-light'
|
|
54
|
+
| 'secondary-light'
|
|
55
|
+
| 'success-light'
|
|
56
|
+
| 'alert-light'
|
|
57
|
+
| 'warning-light'
|
|
58
|
+
| 'accent1-light'
|
|
59
|
+
| 'accent2-light'
|
|
60
|
+
| 'accent3-light'
|
|
61
|
+
| 'accent4-light'
|
|
62
|
+
| 'inverse-light'
|
|
63
|
+
| 'primary-lighter'
|
|
64
|
+
| 'secondary-lighter'
|
|
65
|
+
| 'success-lighter'
|
|
66
|
+
| 'alert-lighter'
|
|
67
|
+
| 'warning-lighter'
|
|
68
|
+
| 'accent1-lighter'
|
|
69
|
+
| 'accent2-lighter'
|
|
70
|
+
| 'accent3-lighter'
|
|
71
|
+
| 'accent4-lighter'
|
|
72
|
+
| 'inverse-lighter'
|
|
73
|
+
| 'primary-lightest'
|
|
74
|
+
| 'secondary-lightest'
|
|
75
|
+
| 'success-lightest'
|
|
76
|
+
| 'alert-lightest'
|
|
77
|
+
| 'warning-lightest'
|
|
78
|
+
| 'accent1-lightest'
|
|
79
|
+
| 'accent2-lightest'
|
|
80
|
+
| 'accent3-lightest'
|
|
81
|
+
| 'accent4-lightest'
|
|
82
|
+
| 'inverse-lightest'
|
|
83
|
+
| 'primary-shadow'
|
|
84
|
+
| 'secondary-shadow'
|
|
85
|
+
| 'success-shadow'
|
|
86
|
+
| 'alert-shadow'
|
|
87
|
+
| 'warning-shadow'
|
|
88
|
+
| 'accent1-shadow'
|
|
89
|
+
| 'accent2-shadow'
|
|
90
|
+
| 'accent3-shadow'
|
|
91
|
+
| 'accent4-shadow'
|
|
92
|
+
| 'inverse-shadow';
|
|
@@ -3,8 +3,12 @@ import Button from '@/components/atoms/button';
|
|
|
3
3
|
|
|
4
4
|
export const iconButtonGroup = () => (
|
|
5
5
|
<div className="d-inline-flex">
|
|
6
|
-
<
|
|
7
|
-
|
|
6
|
+
<div className="mr-4">
|
|
7
|
+
<Button size="tiny" icon="content_copy" aria-label="Copy" tooltip="Copy" />
|
|
8
|
+
</div>
|
|
9
|
+
<div className="mr-4">
|
|
10
|
+
<Button size="tiny" icon="content_paste" aria-label="Paste" tooltip="Paste" />
|
|
11
|
+
</div>
|
|
8
12
|
<Button size="tiny" icon="delete" aria-label="Delete" tooltip="Delete" />
|
|
9
13
|
</div>
|
|
10
14
|
);
|
|
@@ -8,7 +8,6 @@ import classNames from 'classnames';
|
|
|
8
8
|
import Loading from './Loading';
|
|
9
9
|
import { BaseProps, extractBaseProps } from '@/utils/types';
|
|
10
10
|
import { ChangeEvent } from '@/common.type';
|
|
11
|
-
import uidGenerator from '@/utils/uidGenerator';
|
|
12
11
|
|
|
13
12
|
export type DropdownAlign = 'left' | 'right';
|
|
14
13
|
export type OptionType = 'DEFAULT' | 'WITH_ICON' | 'WITH_META' | 'ICON_WITH_META';
|
|
@@ -465,7 +464,7 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
465
464
|
const { selectAllLabel = 'Select All', selectAll, onSelectAll } = props;
|
|
466
465
|
|
|
467
466
|
const label = selectAllLabel.trim() ? selectAllLabel.trim() : 'Select All';
|
|
468
|
-
const
|
|
467
|
+
const id = `Checkbox-option-${label.toLowerCase().replace(/\s+/g, '')}-${new Date().getTime()}`;
|
|
469
468
|
|
|
470
469
|
return (
|
|
471
470
|
<div className={SelectAllClass} onMouseEnter={() => updateActiveOption(0, true)}>
|
|
@@ -494,7 +493,7 @@ const DropdownList = (props: OptionsProps) => {
|
|
|
494
493
|
|
|
495
494
|
const active = selectAllPresent ? index + 1 === cursor : index === cursor;
|
|
496
495
|
const optionIsSelected = tempSelected.findIndex((option) => option.value === item.value) !== -1;
|
|
497
|
-
const id = `Checkbox-option-${index}-${item.value}`;
|
|
496
|
+
const id = `Checkbox-option-${index}-${item.value}-${new Date().getTime()}`;
|
|
498
497
|
|
|
499
498
|
return (
|
|
500
499
|
<label htmlFor={id}>
|
|
@@ -60,9 +60,9 @@ export const Link = (props: LinkProps) => {
|
|
|
60
60
|
const classes = classNames(
|
|
61
61
|
{
|
|
62
62
|
Link: true,
|
|
63
|
-
['Link--disabled']: disabled,
|
|
64
63
|
[`Link--${size}`]: size,
|
|
65
64
|
[`Link--${appearance}`]: appearance,
|
|
65
|
+
[`Link--${appearance}-disabled`]: disabled,
|
|
66
66
|
},
|
|
67
67
|
className
|
|
68
68
|
);
|
|
@@ -73,10 +73,32 @@ describe('Link component', () => {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
describe('Link component with prop:disabled', () => {
|
|
76
|
+
describe('Link component with prop:disabled and with no appearance', () => {
|
|
77
77
|
it('link should be disabled', () => {
|
|
78
78
|
const { getByTestId } = render(<Link disabled={true}>Click on Link</Link>);
|
|
79
|
-
expect(getByTestId('DesignSystem-Link')).toHaveClass('Link--disabled');
|
|
79
|
+
expect(getByTestId('DesignSystem-Link')).toHaveClass('Link--default-disabled');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('Link component with prop:disabled and with default appearance', () => {
|
|
84
|
+
it('link should be disabled', () => {
|
|
85
|
+
const { getByTestId } = render(
|
|
86
|
+
<Link disabled={true} appearance="default">
|
|
87
|
+
Click on Link
|
|
88
|
+
</Link>
|
|
89
|
+
);
|
|
90
|
+
expect(getByTestId('DesignSystem-Link')).toHaveClass('Link--default-disabled');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('Link component with prop:disabled and with subtle appearance', () => {
|
|
95
|
+
it('link should be disabled', () => {
|
|
96
|
+
const { getByTestId } = render(
|
|
97
|
+
<Link disabled={true} appearance="subtle">
|
|
98
|
+
Click on Link
|
|
99
|
+
</Link>
|
|
100
|
+
);
|
|
101
|
+
expect(getByTestId('DesignSystem-Link')).toHaveClass('Link--subtle-disabled');
|
|
80
102
|
});
|
|
81
103
|
});
|
|
82
104
|
});
|
|
@@ -171,6 +171,8 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
|
|
|
171
171
|
const actionButton = classNames({
|
|
172
172
|
['p-0']: true,
|
|
173
173
|
[`MetricInput-arrowIcon--${size}`]: size,
|
|
174
|
+
['ml-4']: size === 'regular',
|
|
175
|
+
['ml-6']: size === 'large',
|
|
174
176
|
});
|
|
175
177
|
|
|
176
178
|
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -277,7 +279,7 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
|
|
|
277
279
|
</Text>
|
|
278
280
|
)}
|
|
279
281
|
|
|
280
|
-
<div>
|
|
282
|
+
<div className="MetricInput-arrowIcons">
|
|
281
283
|
<Button
|
|
282
284
|
icon="keyboard_arrow_up"
|
|
283
285
|
size={actionButtonSize}
|
|
@@ -65,8 +65,8 @@ describe('MetricInput component', () => {
|
|
|
65
65
|
it('renders input and arrow icons', () => {
|
|
66
66
|
const { getByTestId } = render(<MetricInput />);
|
|
67
67
|
expect(getByTestId('DesignSystem-MetricInput').tagName).toMatch('INPUT');
|
|
68
|
-
expect(getByTestId('DesignSystem-MetricInput--upIcon')).
|
|
69
|
-
expect(getByTestId('DesignSystem-MetricInput--downIcon')).
|
|
68
|
+
expect(getByTestId('DesignSystem-MetricInput--upIcon').tagName).toMatch('BUTTON');
|
|
69
|
+
expect(getByTestId('DesignSystem-MetricInput--downIcon').tagName).toMatch('BUTTON');
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -24,9 +24,11 @@ exports[`MetricInput component
|
|
|
24
24
|
type="number"
|
|
25
25
|
value="10"
|
|
26
26
|
/>
|
|
27
|
-
<div
|
|
27
|
+
<div
|
|
28
|
+
class="MetricInput-arrowIcons"
|
|
29
|
+
>
|
|
28
30
|
<button
|
|
29
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
31
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4 mb-2"
|
|
30
32
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
31
33
|
tabindex="0"
|
|
32
34
|
>
|
|
@@ -44,7 +46,7 @@ exports[`MetricInput component
|
|
|
44
46
|
</div>
|
|
45
47
|
</button>
|
|
46
48
|
<button
|
|
47
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
49
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4"
|
|
48
50
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
49
51
|
tabindex="0"
|
|
50
52
|
>
|
|
@@ -91,9 +93,11 @@ exports[`MetricInput component
|
|
|
91
93
|
type="number"
|
|
92
94
|
value="10"
|
|
93
95
|
/>
|
|
94
|
-
<div
|
|
96
|
+
<div
|
|
97
|
+
class="MetricInput-arrowIcons"
|
|
98
|
+
>
|
|
95
99
|
<button
|
|
96
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
100
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4 mb-2"
|
|
97
101
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
98
102
|
tabindex="0"
|
|
99
103
|
>
|
|
@@ -111,7 +115,7 @@ exports[`MetricInput component
|
|
|
111
115
|
</div>
|
|
112
116
|
</button>
|
|
113
117
|
<button
|
|
114
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
118
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4"
|
|
115
119
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
116
120
|
tabindex="0"
|
|
117
121
|
>
|
|
@@ -163,9 +167,11 @@ exports[`MetricInput component
|
|
|
163
167
|
>
|
|
164
168
|
kg
|
|
165
169
|
</span>
|
|
166
|
-
<div
|
|
170
|
+
<div
|
|
171
|
+
class="MetricInput-arrowIcons"
|
|
172
|
+
>
|
|
167
173
|
<button
|
|
168
|
-
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large mb-2"
|
|
174
|
+
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large ml-6 mb-2"
|
|
169
175
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
170
176
|
tabindex="0"
|
|
171
177
|
>
|
|
@@ -183,7 +189,7 @@ exports[`MetricInput component
|
|
|
183
189
|
</div>
|
|
184
190
|
</button>
|
|
185
191
|
<button
|
|
186
|
-
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large"
|
|
192
|
+
class="Button Button--regular Button--regularSquare Button--basic p-0 MetricInput-arrowIcon--large ml-6"
|
|
187
193
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
188
194
|
tabindex="0"
|
|
189
195
|
>
|
|
@@ -235,9 +241,11 @@ exports[`MetricInput component
|
|
|
235
241
|
>
|
|
236
242
|
kg
|
|
237
243
|
</span>
|
|
238
|
-
<div
|
|
244
|
+
<div
|
|
245
|
+
class="MetricInput-arrowIcons"
|
|
246
|
+
>
|
|
239
247
|
<button
|
|
240
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
248
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4 mb-2"
|
|
241
249
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
242
250
|
tabindex="0"
|
|
243
251
|
>
|
|
@@ -255,7 +263,7 @@ exports[`MetricInput component
|
|
|
255
263
|
</div>
|
|
256
264
|
</button>
|
|
257
265
|
<button
|
|
258
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
266
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4"
|
|
259
267
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
260
268
|
tabindex="0"
|
|
261
269
|
>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ProgressBar from '../ProgressBar';
|
|
3
|
+
|
|
4
|
+
const customCode = `() => {
|
|
5
|
+
const [progress, setProgress] = React.useState(0);
|
|
6
|
+
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
const interval = setInterval(() => {
|
|
9
|
+
setProgress(progress + 25);
|
|
10
|
+
}, 1000);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
return <ProgressBar value={progress} max={100} />;
|
|
14
|
+
}`;
|
|
15
|
+
|
|
16
|
+
export const withAnimation = () => <></>;
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title: 'Components/ProgressBar/With Animation',
|
|
20
|
+
component: ProgressBar,
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
docPage: {
|
|
24
|
+
customCode,
|
|
25
|
+
title: 'ProgressBar',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ProgressBar from '../ProgressRing';
|
|
3
|
+
|
|
4
|
+
const customCode = `() => {
|
|
5
|
+
const [progress, setProgress] = React.useState(0);
|
|
6
|
+
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
const interval = setInterval(() => {
|
|
9
|
+
setProgress(progress + 25);
|
|
10
|
+
}, 1000);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
return <ProgressRing value={progress} max={100} />;
|
|
14
|
+
}`;
|
|
15
|
+
|
|
16
|
+
export const withAnimation = () => <></>;
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title: 'Components/ProgressRing/With Animation',
|
|
20
|
+
component: ProgressBar,
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
docPage: {
|
|
24
|
+
customCode,
|
|
25
|
+
title: 'ProgressRing',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import GenericText from '../_text';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { BaseHtmlProps, BaseProps } from '@/utils/types';
|
|
5
|
+
import { TextColor } from '@/common.type';
|
|
5
6
|
|
|
6
7
|
export type TextSize = 'small' | 'regular' | 'large';
|
|
7
8
|
export type TextAppearance = 'default' | 'white' | 'destructive' | 'subtle' | 'disabled' | 'success' | 'link';
|
|
@@ -20,24 +21,29 @@ export interface TextProps extends BaseProps, BaseHtmlProps<HTMLSpanElement> {
|
|
|
20
21
|
*/
|
|
21
22
|
small?: boolean;
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* State of `Text`
|
|
24
25
|
*/
|
|
25
26
|
appearance: TextAppearance;
|
|
26
27
|
/**
|
|
27
28
|
* Size of `Text`
|
|
28
29
|
*/
|
|
29
30
|
size: TextSize;
|
|
31
|
+
/**
|
|
32
|
+
* Color of `Text`
|
|
33
|
+
*/
|
|
34
|
+
color?: TextColor;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export const Text = (props: TextProps) => {
|
|
33
|
-
const { appearance, size, children, weight, small, className, ...rest } = props;
|
|
38
|
+
const { appearance, size, children, weight, small, className, color, ...rest } = props;
|
|
34
39
|
|
|
35
40
|
const classes = classNames(
|
|
36
41
|
{
|
|
37
42
|
Text: true,
|
|
38
|
-
[`Text--${appearance}`]: appearance,
|
|
43
|
+
[`Text--${appearance}`]: !color && appearance,
|
|
39
44
|
[`Text--${weight}`]: weight,
|
|
40
45
|
[`Text--${size}`]: size,
|
|
46
|
+
[`color-${color}`]: color,
|
|
41
47
|
/* SOON_TO_BE_DEPRECATED */
|
|
42
48
|
['Text--small']: size === 'small' || small,
|
|
43
49
|
},
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Text from '../../index';
|
|
3
|
+
import { Row, Column } from '@/index';
|
|
4
|
+
|
|
5
|
+
// CSF format story
|
|
6
|
+
export const color = () => {
|
|
7
|
+
const colorList = [
|
|
8
|
+
[
|
|
9
|
+
'primary',
|
|
10
|
+
'primary-dark',
|
|
11
|
+
'primary-darker',
|
|
12
|
+
'primary-light',
|
|
13
|
+
'primary-lighter',
|
|
14
|
+
'primary-lightest',
|
|
15
|
+
'primary-shadow',
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
'success',
|
|
19
|
+
'success-dark',
|
|
20
|
+
'success-darker',
|
|
21
|
+
'success-light',
|
|
22
|
+
'success-lighter',
|
|
23
|
+
'success-lightest',
|
|
24
|
+
'success-shadow',
|
|
25
|
+
],
|
|
26
|
+
['alert', 'alert-dark', 'alert-darker', 'alert-light', 'alert-lighter', 'alert-lightest', 'alert-shadow'],
|
|
27
|
+
[
|
|
28
|
+
'warning',
|
|
29
|
+
'warning-dark',
|
|
30
|
+
'warning-darker',
|
|
31
|
+
'warning-light',
|
|
32
|
+
'warning-lighter',
|
|
33
|
+
'warning-lightest',
|
|
34
|
+
'warning-shadow',
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
'accent1',
|
|
38
|
+
'accent1-dark',
|
|
39
|
+
'accent1-darker',
|
|
40
|
+
'accent1-light',
|
|
41
|
+
'accent1-lighter',
|
|
42
|
+
'accent1-lightest',
|
|
43
|
+
'accent1-shadow',
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
'accent2',
|
|
47
|
+
'accent2-dark',
|
|
48
|
+
'accent2-darker',
|
|
49
|
+
'accent2-light',
|
|
50
|
+
'accent2-lighter',
|
|
51
|
+
'accent2-lightest',
|
|
52
|
+
'accent2-shadow',
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
'accent3',
|
|
56
|
+
'accent3-dark',
|
|
57
|
+
'accent3-darker',
|
|
58
|
+
'accent3-light',
|
|
59
|
+
'accent3-lighter',
|
|
60
|
+
'accent3-lightest',
|
|
61
|
+
'accent3-shadow',
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
'accent4',
|
|
65
|
+
'accent4-dark',
|
|
66
|
+
'accent4-darker',
|
|
67
|
+
'accent4-light',
|
|
68
|
+
'accent4-lighter',
|
|
69
|
+
'accent4-lightest',
|
|
70
|
+
'accent4-shadow',
|
|
71
|
+
],
|
|
72
|
+
['secondary', 'secondary-dark', 'secondary-light', 'secondary-lighter', 'secondary-lightest', 'secondary-shadow'],
|
|
73
|
+
|
|
74
|
+
['white', 'inverse', 'inverse-light', 'inverse-lighter', 'inverse-lightest', 'inverse-shadow'],
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Row>
|
|
79
|
+
{colorList.map((colors, key) => {
|
|
80
|
+
return (
|
|
81
|
+
<Row key={key} className="py-4">
|
|
82
|
+
{colors.map((color, ind) => {
|
|
83
|
+
return (
|
|
84
|
+
<Column key={ind}>
|
|
85
|
+
<Text size="large" color={color} className={color === 'white' ? 'bg-dark' : ''}>
|
|
86
|
+
{color}
|
|
87
|
+
</Text>
|
|
88
|
+
</Column>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
</Row>
|
|
92
|
+
);
|
|
93
|
+
})}
|
|
94
|
+
</Row>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
title: 'Components/Text/Variants/Color',
|
|
100
|
+
component: Text,
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
docPage: {
|
|
104
|
+
title: 'Text',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import Text, { TextProps as Props, TextAppearance,
|
|
2
|
+
import Text, { TextProps as Props, TextAppearance, TextSize } from '../Text';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
4
|
import { testHelper, filterUndefined, valueHelper, testMessageHelper } from '@/utils/testHelper';
|
|
5
5
|
|
|
6
|
-
const sizes:
|
|
6
|
+
const sizes: TextSize[] = ['small', 'regular', 'large'];
|
|
7
7
|
const appearances: TextAppearance[] = ['default', 'white', 'destructive', 'disabled', 'subtle', 'success', 'link'];
|
|
8
8
|
const weight = ['strong', 'medium'];
|
|
9
9
|
const BooleanValue = [true, false];
|
|
@@ -132,3 +132,19 @@ describe('Text component', () => {
|
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
|
+
|
|
136
|
+
describe('Text Component with Prop:color', () => {
|
|
137
|
+
it('should have the text color as accent1 when prop color="accent1"', () => {
|
|
138
|
+
const { getByTestId } = render(<Text color="accent1">{'Design System'}</Text>);
|
|
139
|
+
expect(getByTestId('DesignSystem-Text')).toHaveClass('color-accent1');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should given preference to color over appearance prop', () => {
|
|
143
|
+
const { getByTestId } = render(
|
|
144
|
+
<Text color="accent1-lightest" appearance="destructive">
|
|
145
|
+
{'Design System'}
|
|
146
|
+
</Text>
|
|
147
|
+
);
|
|
148
|
+
expect(getByTestId('DesignSystem-Text')).toHaveClass('color-accent1-lightest');
|
|
149
|
+
});
|
|
150
|
+
});
|
package/core/components/molecules/pagination/__tests__/__snapshots__/Pagination.test.tsx.snap
CHANGED
|
@@ -155,9 +155,11 @@ exports[`Pagination component
|
|
|
155
155
|
type="number"
|
|
156
156
|
value="10"
|
|
157
157
|
/>
|
|
158
|
-
<div
|
|
158
|
+
<div
|
|
159
|
+
class="MetricInput-arrowIcons"
|
|
160
|
+
>
|
|
159
161
|
<button
|
|
160
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular mb-2"
|
|
162
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4 mb-2"
|
|
161
163
|
data-test="DesignSystem-MetricInput--upIcon"
|
|
162
164
|
tabindex="0"
|
|
163
165
|
>
|
|
@@ -175,7 +177,7 @@ exports[`Pagination component
|
|
|
175
177
|
</div>
|
|
176
178
|
</button>
|
|
177
179
|
<button
|
|
178
|
-
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular"
|
|
180
|
+
class="Button Button--tiny Button--tinySquare Button--basic p-0 MetricInput-arrowIcon--regular ml-4"
|
|
179
181
|
data-test="DesignSystem-MetricInput--downIcon"
|
|
180
182
|
tabindex="0"
|
|
181
183
|
>
|
|
@@ -198,7 +198,7 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
|
198
198
|
componentDidUpdate(prevProps: CalendarProps, prevState: CalendarState) {
|
|
199
199
|
const { monthsInView } = this.props;
|
|
200
200
|
|
|
201
|
-
if (prevProps.date !== this.props.date) {
|
|
201
|
+
if (prevProps.date?.getTime() !== this.props.date?.getTime()) {
|
|
202
202
|
const { year, month, date } = getDateInfo(this.props.date);
|
|
203
203
|
this.updateState(year, month, date);
|
|
204
204
|
const d = convertToDate(this.props.date);
|
|
@@ -207,14 +207,14 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
if (prevProps.startDate !== this.props.startDate) {
|
|
210
|
+
if (prevProps.startDate?.getTime() !== this.props.startDate?.getTime()) {
|
|
211
211
|
const d = convertToDate(this.props.startDate);
|
|
212
212
|
this.setState({
|
|
213
213
|
startDate: d,
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
if (prevProps.endDate !== this.props.endDate) {
|
|
217
|
+
if (prevProps.endDate?.getTime() !== this.props.endDate?.getTime()) {
|
|
218
218
|
const d = convertToDate(this.props.endDate);
|
|
219
219
|
this.setState({
|
|
220
220
|
endDate: d,
|
|
@@ -248,7 +248,7 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
if (prevState.currDate !== this.state.currDate) {
|
|
251
|
+
if (prevState.currDate?.getTime() !== this.state.currDate?.getTime()) {
|
|
252
252
|
const { rangePicker, onDateChange } = this.props;
|
|
253
253
|
|
|
254
254
|
const { currDate, startDate, endDate } = this.state;
|
|
@@ -288,7 +288,10 @@ export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
if (
|
|
291
|
+
if (
|
|
292
|
+
prevState.startDate?.getTime() !== this.state.startDate?.getTime() ||
|
|
293
|
+
prevState.endDate?.getTime() !== this.state.endDate?.getTime()
|
|
294
|
+
) {
|
|
292
295
|
const { onRangeChange } = this.props;
|
|
293
296
|
|
|
294
297
|
const { startDate, endDate } = this.state;
|
|
@@ -3,7 +3,13 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Text, Icon, Pills } from '@/index';
|
|
4
4
|
import { VerticalNavProps } from '@/index.type';
|
|
5
5
|
import { extractBaseProps, BaseProps } from '@/utils/types';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getTextColor,
|
|
8
|
+
getHorizontalIconAppearance,
|
|
9
|
+
getPillsAppearance,
|
|
10
|
+
isMenuActive,
|
|
11
|
+
Menu,
|
|
12
|
+
} from '@/utils/navigationHelper';
|
|
7
13
|
|
|
8
14
|
export type HorizontalNavProps = BaseProps & Pick<VerticalNavProps, 'menus' | 'active' | 'onClick'>;
|
|
9
15
|
export type Align = 'left' | 'center';
|
|
@@ -50,7 +56,7 @@ export const HorizontalNav = (props: HorizontalNavProps) => {
|
|
|
50
56
|
<Icon
|
|
51
57
|
className="mr-3"
|
|
52
58
|
name={menu.icon}
|
|
53
|
-
appearance={
|
|
59
|
+
appearance={getHorizontalIconAppearance(isActive, menu.disabled)}
|
|
54
60
|
data-test="DesignSystem-HorizontalNav--Icon"
|
|
55
61
|
/>
|
|
56
62
|
);
|
|
@@ -64,6 +70,7 @@ export const HorizontalNav = (props: HorizontalNavProps) => {
|
|
|
64
70
|
|
|
65
71
|
const menuClasses = classNames({
|
|
66
72
|
'HorizontalNav-menu': true,
|
|
73
|
+
'HorizontalNav-menu--default': !isActive,
|
|
67
74
|
['HorizontalNav-menu--active']: isActive,
|
|
68
75
|
['HorizontalNav-menu--disabled']: menu.disabled,
|
|
69
76
|
});
|
|
@@ -71,10 +78,10 @@ export const HorizontalNav = (props: HorizontalNavProps) => {
|
|
|
71
78
|
return (
|
|
72
79
|
// TODO(a11y)
|
|
73
80
|
// eslint-disable-next-line
|
|
74
|
-
<div data-test="DesignSystem-HorizontalNav" key={index} className={menuClasses} onClick={onClickHandler(menu)}>
|
|
81
|
+
<div tabIndex={0} data-test="DesignSystem-HorizontalNav" key={index} className={menuClasses} onClick={onClickHandler(menu)}>
|
|
75
82
|
{renderIcon(menu, isActive)}
|
|
76
83
|
<Text
|
|
77
|
-
|
|
84
|
+
color={getTextColor(isActive, menu.disabled)}
|
|
78
85
|
data-test="DesignSystem-HorizontalNav--Text"
|
|
79
86
|
className="HorizontalNav-menuText"
|
|
80
87
|
>
|
|
@@ -24,7 +24,7 @@ export const defaultHorizontalNavigation = () => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<div className="d-flex align-items-center py-6
|
|
27
|
+
<div className="d-flex align-items-center py-6 bg-secondary-lightest">
|
|
28
28
|
<HorizontalNav className="w-100 justify-content-center" menus={data} active={active} onClick={onClickHandler} />
|
|
29
29
|
</div>
|
|
30
30
|
);
|
|
@@ -52,7 +52,7 @@ const customCode = `() => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
<div className="d-flex align-items-center py-6
|
|
55
|
+
<div className="d-flex align-items-center py-6 bg-secondary-lightest">
|
|
56
56
|
<HorizontalNav
|
|
57
57
|
className="w-100 justify-content-center"
|
|
58
58
|
menus={data}
|