uikit-react-public 0.50.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.d.ts +8 -4
- package/dist/components/Button/Button.stories.d.ts +11 -2
- package/dist/components/Button/style/buttonPrimarySubtleStyle.d.ts +1 -1
- package/dist/components/Button/style/buttonSecondaryStyle.d.ts +1 -1
- package/dist/components/Button/style/buttonSecondarySubtleStyle.d.ts +1 -1
- package/dist/components/Button/style/buttonTertiaryDestructiveNoPaddingStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonTertiaryDestructiveStyle.d.ts +1 -1
- package/dist/components/Button/style/buttonTertiaryNoPaddingStyle.d.ts +1 -1
- package/dist/components/Button/style/buttonTertiaryStyle.d.ts +1 -1
- package/dist/index.js +4695 -4630
- package/lib/components/Button/Button.mdx +12 -0
- package/lib/components/Button/Button.stories.tsx +46 -0
- package/lib/components/Button/Button.tsx +48 -25
- package/lib/components/Button/__tests__/Button.test.tsx +120 -1
- package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +11 -11
- package/lib/components/Button/style/buttonAccentStyle.ts +2 -0
- package/lib/components/Button/style/buttonPrimaryDestructiveStyle.ts +2 -0
- package/lib/components/Button/style/buttonPrimaryStyle.ts +2 -0
- package/lib/components/Button/style/buttonPrimarySubtleStyle.ts +10 -11
- package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +2 -0
- package/lib/components/Button/style/buttonSecondaryDestructiveStyle.ts +13 -7
- package/lib/components/Button/style/buttonSecondaryStyle.ts +49 -16
- package/lib/components/Button/style/buttonSecondarySubtleStyle.ts +15 -13
- package/lib/components/Button/style/buttonTertiaryDestructiveNoPaddingStyle.ts +34 -0
- package/lib/components/Button/style/buttonTertiaryDestructiveStyle.ts +9 -8
- package/lib/components/Button/style/buttonTertiaryNoPaddingStyle.ts +13 -15
- package/lib/components/Button/style/buttonTertiaryStyle.ts +10 -9
- package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ const buttonSecondaryDestructiveStyle = (
|
|
|
9
9
|
loading: ButtonBaseProps['loading']
|
|
10
10
|
) => {
|
|
11
11
|
const {
|
|
12
|
-
colour: { border, fill, text },
|
|
12
|
+
colour: { border, fill, icon, text },
|
|
13
13
|
} = theme;
|
|
14
14
|
|
|
15
15
|
const textColour = text.critical;
|
|
@@ -20,35 +20,41 @@ const buttonSecondaryDestructiveStyle = (
|
|
|
20
20
|
const activeFillColour = fill.criticalPressed;
|
|
21
21
|
|
|
22
22
|
const baseStyle = css`
|
|
23
|
-
|
|
23
|
+
--ucl-uikit-button-icon-colour: ${icon.critical};
|
|
24
|
+
background-color: transparent;
|
|
24
25
|
color: ${textColour};
|
|
25
|
-
|
|
26
|
+
outline: ${theme.border.b1} solid ${borderColour};
|
|
27
|
+
outline-offset: -${theme.border.b1};
|
|
26
28
|
`;
|
|
27
29
|
|
|
28
30
|
const selectedStyle = css`
|
|
31
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
29
32
|
background-color: ${fill.criticalSelected};
|
|
30
33
|
color: ${text.inverse};
|
|
31
|
-
|
|
34
|
+
outline-color: transparent;
|
|
32
35
|
`;
|
|
33
36
|
|
|
34
37
|
const interactiveStyle = css`
|
|
35
38
|
cursor: pointer;
|
|
36
39
|
|
|
37
40
|
&:hover {
|
|
41
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
38
42
|
background-color: ${hoverFillColour};
|
|
39
|
-
|
|
43
|
+
outline-color: transparent;
|
|
40
44
|
color: ${hoverTextColour};
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
&:active {
|
|
48
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
44
49
|
background-color: ${activeFillColour};
|
|
45
50
|
color: ${activeTextColour};
|
|
46
|
-
|
|
51
|
+
outline-color: transparent;
|
|
47
52
|
}
|
|
48
53
|
`;
|
|
49
54
|
|
|
50
55
|
const disabledStyle = css`
|
|
51
|
-
|
|
56
|
+
--ucl-uikit-button-icon-colour: ${icon.disabled};
|
|
57
|
+
outline-color: ${theme.colour.border.disabled};
|
|
52
58
|
color: ${theme.colour.text.disabled};
|
|
53
59
|
`;
|
|
54
60
|
|
|
@@ -6,49 +6,82 @@ const buttonSecondaryStyle = (
|
|
|
6
6
|
theme: ThemeType,
|
|
7
7
|
selected: ButtonBaseProps['selected'],
|
|
8
8
|
disabled: ButtonBaseProps['disabled'],
|
|
9
|
-
loading: ButtonBaseProps['loading']
|
|
9
|
+
loading: ButtonBaseProps['loading'],
|
|
10
|
+
onLight: ButtonBaseProps['onLight']
|
|
10
11
|
) => {
|
|
11
12
|
const {
|
|
12
|
-
colour: { border, fill, text },
|
|
13
|
+
colour: { border, fill, icon, text },
|
|
13
14
|
} = theme;
|
|
14
15
|
|
|
15
|
-
const textColour = text.brand;
|
|
16
|
-
const borderColour = border.brand;
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const textColour = onLight ? text.brand : text.brandInverse;
|
|
17
|
+
const borderColour = onLight ? border.brand : border.brandInverse;
|
|
18
|
+
const iconColour = onLight ? icon.brand : icon.brandInverse;
|
|
19
|
+
const hoverTextColour = onLight
|
|
20
|
+
? text.inverse
|
|
21
|
+
: text.brandInverseSecondaryHover;
|
|
22
|
+
const hoverFillColour = onLight ? fill.brandHover : 'transparent';
|
|
23
|
+
const hoverBorderColour = onLight
|
|
24
|
+
? 'transparent'
|
|
25
|
+
: border.brandInverseSecondaryHover;
|
|
26
|
+
const activeTextColour = onLight
|
|
27
|
+
? text.inverse
|
|
28
|
+
: text.brandInverseSecondarySelected;
|
|
29
|
+
const activeFillColour = onLight ? fill.brandPressed : 'transparent';
|
|
30
|
+
const activeBorderColour = onLight
|
|
31
|
+
? 'transparent'
|
|
32
|
+
: border.brandInverseSecondarySelected;
|
|
21
33
|
|
|
22
34
|
const baseStyle = css`
|
|
23
|
-
|
|
35
|
+
--ucl-uikit-button-icon-colour: ${iconColour};
|
|
36
|
+
background-color: transparent;
|
|
24
37
|
color: ${textColour};
|
|
25
|
-
|
|
38
|
+
outline: ${theme.border.b2} solid ${borderColour};
|
|
39
|
+
outline-offset: -${theme.border.b2};
|
|
26
40
|
`;
|
|
27
41
|
|
|
28
42
|
const selectedStyle = css`
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
--ucl-uikit-button-icon-colour: ${
|
|
44
|
+
onLight ? icon.brandSelectedOnBgFill : icon.brandInverseSecondarySelected
|
|
45
|
+
};
|
|
46
|
+
background-color: ${onLight ? fill.brandSubtleSelected : 'transparent'};
|
|
47
|
+
color: ${onLight ? text.brandHover : text.brandInverseSecondarySelected};
|
|
48
|
+
outline-color: ${
|
|
49
|
+
onLight ? border.brand : border.brandInverseSecondarySelected
|
|
50
|
+
};
|
|
31
51
|
`;
|
|
32
52
|
|
|
33
53
|
const interactiveStyle = css`
|
|
34
54
|
cursor: pointer;
|
|
35
55
|
|
|
36
56
|
&:hover {
|
|
57
|
+
--ucl-uikit-button-icon-colour: ${
|
|
58
|
+
onLight ? icon.inverse : icon.brandInverseSecondaryHover
|
|
59
|
+
};
|
|
37
60
|
background-color: ${hoverFillColour};
|
|
38
|
-
|
|
61
|
+
outline-color: ${hoverBorderColour};
|
|
39
62
|
color: ${hoverTextColour};
|
|
40
63
|
}
|
|
41
64
|
|
|
42
65
|
&:active {
|
|
66
|
+
--ucl-uikit-button-icon-colour: ${
|
|
67
|
+
onLight ? icon.inverse : icon.brandInverseSecondarySelected
|
|
68
|
+
};
|
|
43
69
|
background-color: ${activeFillColour};
|
|
44
70
|
color: ${activeTextColour};
|
|
45
|
-
|
|
71
|
+
outline-color: ${activeBorderColour};
|
|
46
72
|
}
|
|
47
73
|
`;
|
|
48
74
|
|
|
49
75
|
const disabledStyle = css`
|
|
50
|
-
|
|
51
|
-
|
|
76
|
+
--ucl-uikit-button-icon-colour: ${
|
|
77
|
+
onLight ? icon.disabled : icon.inverseDisabled
|
|
78
|
+
};
|
|
79
|
+
outline-color: ${
|
|
80
|
+
onLight ? theme.colour.border.disabled : theme.colour.icon.inverseDisabled
|
|
81
|
+
};
|
|
82
|
+
color: ${
|
|
83
|
+
onLight ? theme.colour.text.disabled : theme.colour.link.inverseDisabled
|
|
84
|
+
};
|
|
52
85
|
`;
|
|
53
86
|
|
|
54
87
|
return cx(
|
|
@@ -6,15 +6,14 @@ const buttonSecondarySubtleStyle = (
|
|
|
6
6
|
theme: ThemeType,
|
|
7
7
|
selected: ButtonBaseProps['selected'],
|
|
8
8
|
disabled: ButtonBaseProps['disabled'],
|
|
9
|
-
loading: ButtonBaseProps['loading']
|
|
10
|
-
paddingPx: number
|
|
9
|
+
loading: ButtonBaseProps['loading']
|
|
11
10
|
) => {
|
|
12
11
|
const {
|
|
13
|
-
colour: { border, fill, text },
|
|
12
|
+
colour: { border, fill, icon, text },
|
|
14
13
|
} = theme;
|
|
15
14
|
|
|
16
15
|
const textColour = text.brand;
|
|
17
|
-
const borderColour = border.
|
|
16
|
+
const borderColour = border.brandSubtle;
|
|
18
17
|
const hoverTextColour = text.brandHover;
|
|
19
18
|
const hoverFillColour = fill.brandSubtleHover;
|
|
20
19
|
const hoverBorderColour = border.brandSubtle;
|
|
@@ -25,18 +24,18 @@ const buttonSecondarySubtleStyle = (
|
|
|
25
24
|
const selectedBorderColour = border.brand;
|
|
26
25
|
const selectedTextColour = text.brandHover;
|
|
27
26
|
|
|
28
|
-
const adjustedPaddingPx = paddingPx + 1;
|
|
29
|
-
|
|
30
27
|
const baseStyle = css`
|
|
31
|
-
|
|
28
|
+
--ucl-uikit-button-icon-colour: ${icon.brand};
|
|
29
|
+
background-color: transparent;
|
|
32
30
|
color: ${textColour};
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
outline: ${theme.border.b1} solid ${borderColour};
|
|
32
|
+
outline-offset: -${theme.border.b1};
|
|
35
33
|
`;
|
|
36
34
|
|
|
37
35
|
const selectedStyle = css`
|
|
36
|
+
--ucl-uikit-button-icon-colour: ${icon.brandSelectedOnBgFill};
|
|
38
37
|
background-color: ${selectedFillColour};
|
|
39
|
-
|
|
38
|
+
outline-color: ${selectedBorderColour};
|
|
40
39
|
color: ${selectedTextColour};
|
|
41
40
|
`;
|
|
42
41
|
|
|
@@ -44,20 +43,23 @@ const buttonSecondarySubtleStyle = (
|
|
|
44
43
|
cursor: pointer;
|
|
45
44
|
|
|
46
45
|
&:hover {
|
|
46
|
+
--ucl-uikit-button-icon-colour: ${icon.brandHover};
|
|
47
47
|
background-color: ${hoverFillColour};
|
|
48
|
-
|
|
48
|
+
outline-color: ${hoverBorderColour};
|
|
49
49
|
color: ${hoverTextColour};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
&:active {
|
|
53
|
+
--ucl-uikit-button-icon-colour: ${icon.brandPressed};
|
|
53
54
|
background-color: ${activeFillColour};
|
|
54
55
|
color: ${activeTextColour};
|
|
55
|
-
|
|
56
|
+
outline-color: ${activeBorderColour};
|
|
56
57
|
}
|
|
57
58
|
`;
|
|
58
59
|
|
|
59
60
|
const disabledStyle = css`
|
|
60
|
-
|
|
61
|
+
--ucl-uikit-button-icon-colour: ${icon.disabled};
|
|
62
|
+
outline-color: ${border.disabled};
|
|
61
63
|
color: ${text.disabled};
|
|
62
64
|
`;
|
|
63
65
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { css, cx } from '@emotion/css';
|
|
2
|
+
import { ThemeType } from '../../../theme';
|
|
3
|
+
import { ButtonBaseProps } from '../Button';
|
|
4
|
+
|
|
5
|
+
const buttonTertiaryDestructiveNoPaddingStyle = (
|
|
6
|
+
theme: ThemeType,
|
|
7
|
+
disabled: ButtonBaseProps['disabled'],
|
|
8
|
+
loading: ButtonBaseProps['loading']
|
|
9
|
+
) => {
|
|
10
|
+
const baseStyle = css`
|
|
11
|
+
--ucl-uikit-button-icon-colour: ${theme.colour.icon.critical};
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
color: ${theme.colour.text.critical};
|
|
14
|
+
height: fit-content;
|
|
15
|
+
padding: 0;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const interactiveStyle = css`
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const disabledStyle = css`
|
|
23
|
+
--ucl-uikit-button-icon-colour: ${theme.colour.icon.disabled};
|
|
24
|
+
color: ${theme.colour.text.disabled};
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
return cx(
|
|
28
|
+
baseStyle,
|
|
29
|
+
!disabled && !loading && interactiveStyle,
|
|
30
|
+
disabled && disabledStyle
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default buttonTertiaryDestructiveNoPaddingStyle;
|
|
@@ -6,11 +6,10 @@ const buttonTertiaryDestructiveStyle = (
|
|
|
6
6
|
theme: ThemeType,
|
|
7
7
|
selected: ButtonBaseProps['selected'],
|
|
8
8
|
disabled: ButtonBaseProps['disabled'],
|
|
9
|
-
loading: ButtonBaseProps['loading']
|
|
10
|
-
paddingPx: number
|
|
9
|
+
loading: ButtonBaseProps['loading']
|
|
11
10
|
) => {
|
|
12
11
|
const {
|
|
13
|
-
colour: { fill, text },
|
|
12
|
+
colour: { fill, icon, text },
|
|
14
13
|
} = theme;
|
|
15
14
|
|
|
16
15
|
const textColour = text.critical;
|
|
@@ -21,16 +20,14 @@ const buttonTertiaryDestructiveStyle = (
|
|
|
21
20
|
const selectedTextColour = text.inverse;
|
|
22
21
|
const selectedFillColour = fill.criticalSelected;
|
|
23
22
|
|
|
24
|
-
const adjustedPaddingPx = disabled ? paddingPx + 1 : paddingPx + 2;
|
|
25
|
-
|
|
26
23
|
const baseStyle = css`
|
|
27
|
-
|
|
24
|
+
--ucl-uikit-button-icon-colour: ${icon.critical};
|
|
28
25
|
background-color: transparent;
|
|
29
26
|
color: ${textColour};
|
|
30
|
-
padding: 0 ${adjustedPaddingPx}px;
|
|
31
27
|
`;
|
|
32
28
|
|
|
33
29
|
const selectedStyle = css`
|
|
30
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
34
31
|
color: ${selectedTextColour};
|
|
35
32
|
background-color: ${selectedFillColour};
|
|
36
33
|
`;
|
|
@@ -39,18 +36,22 @@ const buttonTertiaryDestructiveStyle = (
|
|
|
39
36
|
cursor: pointer;
|
|
40
37
|
|
|
41
38
|
&:hover {
|
|
39
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
42
40
|
color: ${hoverTextColour};
|
|
43
41
|
background-color: ${hoverFillColour};
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
&:active {
|
|
45
|
+
--ucl-uikit-button-icon-colour: ${icon.inverse};
|
|
47
46
|
background-color: ${activeFillColour};
|
|
48
47
|
color: ${activeTextColour};
|
|
49
48
|
}
|
|
50
49
|
`;
|
|
51
50
|
|
|
52
51
|
const disabledStyle = css`
|
|
53
|
-
|
|
52
|
+
--ucl-uikit-button-icon-colour: ${icon.disabled};
|
|
53
|
+
outline: ${theme.border.b1} solid ${theme.colour.border.disabled};
|
|
54
|
+
outline-offset: -${theme.border.b1};
|
|
54
55
|
color: ${theme.colour.text.disabled};
|
|
55
56
|
`;
|
|
56
57
|
|
|
@@ -6,40 +6,38 @@ const buttonTertiaryNoPaddingStyle = (
|
|
|
6
6
|
theme: ThemeType,
|
|
7
7
|
disabled: ButtonBaseProps['disabled'],
|
|
8
8
|
loading: ButtonBaseProps['loading'],
|
|
9
|
-
|
|
9
|
+
onLight: ButtonBaseProps['onLight']
|
|
10
10
|
) => {
|
|
11
11
|
const {
|
|
12
|
-
colour: { text },
|
|
12
|
+
colour: { icon, text },
|
|
13
13
|
} = theme;
|
|
14
14
|
|
|
15
|
-
const textColour = text.brand;
|
|
16
|
-
const
|
|
17
|
-
const activeTextColour = text.brandHover;
|
|
18
|
-
|
|
19
|
-
const adjustedPaddingPx = paddingPx + 2;
|
|
15
|
+
const textColour = onLight ? text.brand : text.brandInverse;
|
|
16
|
+
const iconColour = onLight ? icon.brand : icon.brandInverse;
|
|
20
17
|
|
|
21
18
|
const tertiaryBaseStyle = css`
|
|
22
|
-
|
|
19
|
+
--ucl-uikit-button-icon-colour: ${iconColour};
|
|
23
20
|
background-color: transparent;
|
|
24
21
|
color: ${textColour};
|
|
25
22
|
height: fit-content;
|
|
26
|
-
padding: 0
|
|
23
|
+
padding: 0;
|
|
27
24
|
`;
|
|
28
25
|
|
|
29
26
|
const interactiveStyle = css`
|
|
30
27
|
cursor: pointer;
|
|
31
28
|
|
|
32
29
|
&:hover {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&:active {
|
|
37
|
-
color: ${activeTextColour};
|
|
30
|
+
text-decoration: ${onLight ? 'none' : 'underline'};
|
|
38
31
|
}
|
|
39
32
|
`;
|
|
40
33
|
|
|
41
34
|
const disabledStyle = css`
|
|
42
|
-
|
|
35
|
+
--ucl-uikit-button-icon-colour: ${
|
|
36
|
+
onLight ? icon.disabled : icon.inverseDisabled
|
|
37
|
+
};
|
|
38
|
+
color: ${
|
|
39
|
+
onLight ? theme.colour.text.disabled : theme.colour.link.inverseDisabled
|
|
40
|
+
};
|
|
43
41
|
`;
|
|
44
42
|
|
|
45
43
|
return cx(
|
|
@@ -6,48 +6,49 @@ const buttonTertiaryStyle = (
|
|
|
6
6
|
theme: ThemeType,
|
|
7
7
|
selected: ButtonBaseProps['selected'],
|
|
8
8
|
disabled: ButtonBaseProps['disabled'],
|
|
9
|
-
loading: ButtonBaseProps['loading']
|
|
10
|
-
paddingPx: number
|
|
9
|
+
loading: ButtonBaseProps['loading']
|
|
11
10
|
) => {
|
|
12
11
|
const {
|
|
13
|
-
colour: { fill, text },
|
|
12
|
+
colour: { fill, icon, text },
|
|
14
13
|
} = theme;
|
|
15
14
|
|
|
16
15
|
const textColour = text.brand;
|
|
17
|
-
const hoverTextColour =
|
|
16
|
+
const hoverTextColour = text.brandHover;
|
|
18
17
|
const hoverFillColour = fill.brandSubtleHover;
|
|
19
|
-
const activeTextColour =
|
|
18
|
+
const activeTextColour = text.brandPressed;
|
|
20
19
|
const activeFillColour = fill.brandSubtleHover;
|
|
21
20
|
const selectedFillColour = fill.brandSubtleHover;
|
|
22
21
|
|
|
23
|
-
const adjustedPaddingPx = paddingPx;
|
|
24
|
-
|
|
25
22
|
const baseStyle = css`
|
|
23
|
+
--ucl-uikit-button-icon-colour: ${icon.brand};
|
|
26
24
|
background-color: transparent;
|
|
27
25
|
color: ${textColour};
|
|
28
|
-
padding: 0 ${adjustedPaddingPx}px;
|
|
29
26
|
`;
|
|
30
27
|
|
|
31
28
|
const selectedStyle = css`
|
|
32
|
-
|
|
29
|
+
--ucl-uikit-button-icon-colour: ${icon.brandSelectedOnBgFill};
|
|
33
30
|
background-color: ${selectedFillColour};
|
|
31
|
+
color: ${text.brandHover};
|
|
34
32
|
`;
|
|
35
33
|
|
|
36
34
|
const interactiveStyle = css`
|
|
37
35
|
cursor: pointer;
|
|
38
36
|
|
|
39
37
|
&:hover {
|
|
38
|
+
--ucl-uikit-button-icon-colour: ${icon.brandHover};
|
|
40
39
|
color: ${hoverTextColour};
|
|
41
40
|
background-color: ${hoverFillColour};
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
&:active {
|
|
44
|
+
--ucl-uikit-button-icon-colour: ${icon.brandPressed};
|
|
45
45
|
background-color: ${activeFillColour};
|
|
46
46
|
color: ${activeTextColour};
|
|
47
47
|
}
|
|
48
48
|
`;
|
|
49
49
|
|
|
50
50
|
const disabledStyle = css`
|
|
51
|
+
--ucl-uikit-button-icon-colour: ${icon.disabled};
|
|
51
52
|
color: ${theme.colour.text.disabled};
|
|
52
53
|
`;
|
|
53
54
|
|