uikit-react-public 0.32.5 → 0.36.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/index.js +10092 -6744
- package/dist/theme/common/themeCommon.d.ts +629 -7
- package/dist/theme/dark/darkColour.d.ts +144 -0
- package/dist/theme/dark/darkTheme.d.ts +3 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/light/lightColour.d.ts +29 -11
- package/dist/theme/original/defaultTheme.d.ts +29 -49
- package/dist/theme/original/originalColourNewStructure.d.ts +29 -11
- package/dist/theme/useTheme.d.ts +59 -98
- package/lib/components/Button/style/buttonPrimarySubtleStyle.ts +3 -3
- package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +4 -4
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +93 -93
- package/lib/components/Calendar/subcomponents/Day.tsx +45 -35
- package/lib/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/lib/components/Snackbar/Snackbar.tsx +4 -5
- package/lib/components/Snackbar/__tests__/__snapshots__/Snackbar.test.tsx.snap +4 -4
- package/lib/components/Toggle/Toggle.tsx +4 -4
- package/lib/theme/__tests__/useTheme.test.tsx +28 -0
- package/lib/theme/common/themeCommon.ts +162 -142
- package/lib/theme/dark/darkColour.ts +260 -0
- package/lib/theme/dark/darkTheme.ts +38 -0
- package/lib/theme/index.ts +1 -0
- package/lib/theme/light/lightColour.ts +76 -17
- package/lib/theme/light/lightTheme.ts +2 -2
- package/lib/theme/original/defaultTheme.ts +2 -2
- package/lib/theme/original/originalColourNewStructure.ts +34 -20
- package/lib/theme/useTheme.tsx +22 -9
- package/package.json +2 -2
|
@@ -47,31 +47,35 @@ const Day = ({
|
|
|
47
47
|
outline: none;
|
|
48
48
|
|
|
49
49
|
&:hover {
|
|
50
|
-
background-color: ${theme.colour.fill.
|
|
50
|
+
background-color: ${theme.colour.fill.primary};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
${
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
53
|
+
${
|
|
54
|
+
isSelected &&
|
|
55
|
+
css`
|
|
56
|
+
background-color: ${
|
|
57
|
+
isDisabled ? theme.colour.fill.disabled : theme.colour.fill.brand
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
color: ${theme.colour.text.inverse};
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background-color: ${theme.colour.fill.brandHover};
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
}
|
|
67
|
+
${
|
|
68
|
+
isDisabled &&
|
|
69
|
+
css`
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: ${
|
|
74
|
+
isSelected ? theme.color.neutral.grey10 : theme.color.neutral.white
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
}
|
|
75
79
|
`;
|
|
76
80
|
|
|
77
81
|
const foregroundStyle = css`
|
|
@@ -79,18 +83,24 @@ const Day = ({
|
|
|
79
83
|
user-select: none;
|
|
80
84
|
font-size: 16px;
|
|
81
85
|
|
|
82
|
-
${
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
${
|
|
87
|
+
!isInCurrentMonth &&
|
|
88
|
+
css`
|
|
89
|
+
color: ${theme.color.neutral.grey40};
|
|
90
|
+
`
|
|
91
|
+
}
|
|
92
|
+
${
|
|
93
|
+
isToday &&
|
|
94
|
+
css`
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
`
|
|
97
|
+
}
|
|
98
|
+
${
|
|
99
|
+
isDisabled &&
|
|
100
|
+
css`
|
|
101
|
+
color: ${theme.colour.text.disabled};
|
|
102
|
+
`
|
|
103
|
+
}
|
|
94
104
|
`;
|
|
95
105
|
|
|
96
106
|
const eventDotsContainerStyle = css`
|
|
@@ -40,7 +40,6 @@ const Snackbar = ({
|
|
|
40
40
|
error: Icon.AlertTriangle,
|
|
41
41
|
success: Icon.CheckCircle,
|
|
42
42
|
}[variant];
|
|
43
|
-
// Success token currently differs from Figma (#008E49).
|
|
44
43
|
const backgroundColor = {
|
|
45
44
|
default: theme.colour.fill.brandPrimary,
|
|
46
45
|
error: theme.colour.fill.critical,
|
|
@@ -64,7 +63,7 @@ const Snackbar = ({
|
|
|
64
63
|
min-height: ${minHeight};
|
|
65
64
|
z-index: 9999;
|
|
66
65
|
padding: ${padding};
|
|
67
|
-
color: ${theme.colour.text.
|
|
66
|
+
color: ${theme.colour.text.brandInverse};
|
|
68
67
|
background-color: ${backgroundColor};
|
|
69
68
|
`;
|
|
70
69
|
|
|
@@ -90,7 +89,7 @@ const Snackbar = ({
|
|
|
90
89
|
|
|
91
90
|
const closeButtonStyle = css`
|
|
92
91
|
&:hover {
|
|
93
|
-
color: ${theme.colour.icon.
|
|
92
|
+
color: ${theme.colour.icon.brandInverseSecondaryHover};
|
|
94
93
|
}
|
|
95
94
|
`;
|
|
96
95
|
|
|
@@ -98,11 +97,11 @@ const Snackbar = ({
|
|
|
98
97
|
padding: ${theme.padding.p4};
|
|
99
98
|
border: none;
|
|
100
99
|
background-color: transparent;
|
|
101
|
-
color: ${theme.colour.text.
|
|
100
|
+
color: ${theme.colour.text.brandInverse};
|
|
102
101
|
cursor: pointer;
|
|
103
102
|
|
|
104
103
|
&:hover {
|
|
105
|
-
color: ${theme.colour.icon.
|
|
104
|
+
color: ${theme.colour.icon.brandInverseSecondaryHover};
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
&:focus-visible {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Snackbar > snapshot: custom test id 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
class="ucl-uikit-snackbar css-
|
|
5
|
+
class="ucl-uikit-snackbar css-x2zf4j"
|
|
6
6
|
data-testid="custom-test-id"
|
|
7
7
|
>
|
|
8
8
|
<svg
|
|
@@ -40,7 +40,7 @@ exports[`Snackbar > snapshot: custom test id 1`] = `
|
|
|
40
40
|
class="css-1xjm0bq"
|
|
41
41
|
>
|
|
42
42
|
<button
|
|
43
|
-
class="css-
|
|
43
|
+
class="css-1omltr1"
|
|
44
44
|
data-testid="custom-test-id-undo-button"
|
|
45
45
|
>
|
|
46
46
|
<span
|
|
@@ -56,7 +56,7 @@ exports[`Snackbar > snapshot: custom test id 1`] = `
|
|
|
56
56
|
|
|
57
57
|
exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
58
58
|
<div
|
|
59
|
-
class="ucl-uikit-snackbar css-
|
|
59
|
+
class="ucl-uikit-snackbar css-x2zf4j"
|
|
60
60
|
data-testid="ucl-uikit-snackbar"
|
|
61
61
|
>
|
|
62
62
|
<svg
|
|
@@ -95,7 +95,7 @@ exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
|
95
95
|
>
|
|
96
96
|
<button
|
|
97
97
|
aria-label="Dismiss notification"
|
|
98
|
-
class="ucl-uikit-icon-button css-
|
|
98
|
+
class="ucl-uikit-icon-button css-1s0isp9"
|
|
99
99
|
data-testid="ucl-uikit-snackbar-close-button"
|
|
100
100
|
>
|
|
101
101
|
<svg
|
|
@@ -47,7 +47,7 @@ const Toggle = forwardRef<Ref, ToggleProps>(
|
|
|
47
47
|
`;
|
|
48
48
|
|
|
49
49
|
const disabledStyle = css`
|
|
50
|
-
background-color: ${theme.colour.
|
|
50
|
+
background-color: ${theme.colour.fill.disabled};
|
|
51
51
|
cursor: not-allowed;
|
|
52
52
|
`;
|
|
53
53
|
|
|
@@ -55,9 +55,9 @@ const Toggle = forwardRef<Ref, ToggleProps>(
|
|
|
55
55
|
!disabled &&
|
|
56
56
|
css`
|
|
57
57
|
&:hover {
|
|
58
|
-
background-color: ${
|
|
59
|
-
? theme.colour.fill.brandHover
|
|
60
|
-
|
|
58
|
+
background-color: ${
|
|
59
|
+
checked ? theme.colour.fill.brandHover : theme.colour.icon.secondary
|
|
60
|
+
};
|
|
61
61
|
}
|
|
62
62
|
`;
|
|
63
63
|
|
|
@@ -2,6 +2,7 @@ import { render, screen, fireEvent } from '@testing-library/react';
|
|
|
2
2
|
import { describe, expect, test } from 'vitest';
|
|
3
3
|
import defaultTheme from '../original/defaultTheme';
|
|
4
4
|
import lightTheme from '../light/lightTheme';
|
|
5
|
+
import darkTheme from '../dark/darkTheme';
|
|
5
6
|
import { ThemeContextProvider, ThemeConsumer, themes } from '../useTheme';
|
|
6
7
|
import type { ThemeType } from '../original/defaultTheme';
|
|
7
8
|
|
|
@@ -10,6 +11,12 @@ const ThemeProbe = () => (
|
|
|
10
11
|
{({ theme, setTheme }) => (
|
|
11
12
|
<>
|
|
12
13
|
<span data-testid='bg-default'>{theme.colour.bg.default}</span>
|
|
14
|
+
<button
|
|
15
|
+
data-testid='set-dark'
|
|
16
|
+
onClick={() => setTheme(darkTheme)}
|
|
17
|
+
>
|
|
18
|
+
set-dark
|
|
19
|
+
</button>
|
|
13
20
|
<button
|
|
14
21
|
data-testid='set-default'
|
|
15
22
|
onClick={() => setTheme(defaultTheme)}
|
|
@@ -85,8 +92,29 @@ describe('useTheme', () => {
|
|
|
85
92
|
);
|
|
86
93
|
});
|
|
87
94
|
|
|
95
|
+
test('sets document colours from the active theme', () => {
|
|
96
|
+
render(
|
|
97
|
+
<ThemeContextProvider theme='light'>
|
|
98
|
+
<ThemeProbe />
|
|
99
|
+
</ThemeContextProvider>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
expect(document.body).toHaveStyle({
|
|
103
|
+
backgroundColor: lightTheme.colour.bg.default,
|
|
104
|
+
color: lightTheme.colour.text.default,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
fireEvent.click(screen.getByTestId('set-dark'));
|
|
108
|
+
|
|
109
|
+
expect(document.body).toHaveStyle({
|
|
110
|
+
backgroundColor: darkTheme.colour.bg.default,
|
|
111
|
+
color: darkTheme.colour.text.default,
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
88
115
|
test('exports named themes map', () => {
|
|
89
116
|
expect(themes.default).toBe(defaultTheme);
|
|
90
117
|
expect(themes.light).toBe(lightTheme);
|
|
118
|
+
expect(themes.dark).toBe(darkTheme);
|
|
91
119
|
});
|
|
92
120
|
});
|