@innovaccer/design-system 2.13.4-5 → 2.13.4-6
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/__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/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/pageHeader/PageHeader.tsx +21 -10
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +1 -9
- package/css/dist/index.css +307 -4
- package/css/dist/index.css.map +1 -1
- package/css/src/components/link.css +15 -4
- package/css/src/components/pageHeader.css +11 -0
- 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/index.esm.js +37 -29
- package/dist/index.js +55 -43
- 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/package.json +1 -1
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
|
>
|
|
@@ -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;
|
|
@@ -82,31 +82,42 @@ export const PageHeader = (props: PageHeaderProps) => {
|
|
|
82
82
|
PageHeader: true,
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
const
|
|
85
|
+
const renderNav = () => {
|
|
86
86
|
if (!navigation && !stepper) {
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
|
-
|
|
90
89
|
return <div className="PageHeader-navigationWrapper">{navigation || stepper}</div>;
|
|
91
90
|
};
|
|
92
91
|
|
|
92
|
+
const colSize = (navigation || stepper) && navigationPosition === 'center' ? '4' : actions ? '8' : '12';
|
|
93
|
+
|
|
93
94
|
return (
|
|
94
95
|
<div {...baseProps} className={wrapperClasses}>
|
|
95
96
|
{breadcrumbs}
|
|
96
97
|
<div className={classes}>
|
|
97
98
|
<Row>
|
|
98
|
-
<Column size=
|
|
99
|
+
<Column size={colSize} sizeXL={colSize} sizeM={colSize}>
|
|
99
100
|
<div className="PageHeader-titleWrapper">
|
|
100
101
|
<Heading className="PageHeader-title">{title}</Heading>
|
|
101
102
|
{badge}
|
|
102
103
|
</div>
|
|
103
104
|
</Column>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
{(!breadcrumbs || navigationPosition === 'center') && colSize === '4' && (
|
|
106
|
+
<Column size="4" sizeXL="4" sizeM="4">
|
|
107
|
+
{renderNav()}
|
|
108
|
+
</Column>
|
|
109
|
+
)}
|
|
110
|
+
{actions ? (
|
|
111
|
+
<Column size="4" sizeXL="4" sizeM="4">
|
|
112
|
+
<div className="PageHeader-actionsWrapper">{actions}</div>
|
|
113
|
+
</Column>
|
|
114
|
+
) : (
|
|
115
|
+
(navigation || stepper) && (
|
|
116
|
+
<Column size="4" sizeXL="4" sizeM="4">
|
|
117
|
+
<div className="PageHeader-actionsWrapper"></div>
|
|
118
|
+
</Column>
|
|
119
|
+
)
|
|
120
|
+
)}
|
|
110
121
|
</Row>
|
|
111
122
|
</div>
|
|
112
123
|
{(status || meta) && (
|
|
@@ -115,7 +126,7 @@ export const PageHeader = (props: PageHeaderProps) => {
|
|
|
115
126
|
{meta}
|
|
116
127
|
</div>
|
|
117
128
|
)}
|
|
118
|
-
{breadcrumbs && navigationPosition === 'bottom' &&
|
|
129
|
+
{breadcrumbs && navigationPosition === 'bottom' && renderNav()}
|
|
119
130
|
{tabs && <div>{tabs}</div>}
|
|
120
131
|
</div>
|
|
121
132
|
);
|
|
@@ -2481,7 +2481,7 @@ exports[`TS renders children 1`] = `
|
|
|
2481
2481
|
data-test="DesignSystem-Row"
|
|
2482
2482
|
>
|
|
2483
2483
|
<div
|
|
2484
|
-
class="Col Col--
|
|
2484
|
+
class="Col Col--12 Col--m-12 Col--xl-12"
|
|
2485
2485
|
data-test="DesignSystem-Column"
|
|
2486
2486
|
>
|
|
2487
2487
|
<div
|
|
@@ -2495,14 +2495,6 @@ exports[`TS renders children 1`] = `
|
|
|
2495
2495
|
</h4>
|
|
2496
2496
|
</div>
|
|
2497
2497
|
</div>
|
|
2498
|
-
<div
|
|
2499
|
-
class="Col Col--4 Col--m-4 Col--xl-4"
|
|
2500
|
-
data-test="DesignSystem-Column"
|
|
2501
|
-
/>
|
|
2502
|
-
<div
|
|
2503
|
-
class="Col Col--4 Col--m-4 Col--xl-4"
|
|
2504
|
-
data-test="DesignSystem-Column"
|
|
2505
|
-
/>
|
|
2506
2498
|
</div>
|
|
2507
2499
|
</div>
|
|
2508
2500
|
</div>
|