uikit-react-public 0.37.0 → 0.38.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/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/Alert.stories.d.ts +1 -1
- package/dist/components/Alert/AlertTitle.d.ts +1 -1
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -0
- package/dist/components/Pagination/PaginationControls.d.ts +2 -1
- package/dist/components/Pagination/__tests__/PaginationControls.test.d.ts +1 -0
- package/dist/components/Pagination/subcomponents/PaginationCompactControls.d.ts +7 -0
- package/dist/components/Pagination/subcomponents/PaginationStandardControls.d.ts +8 -0
- package/dist/components/Pagination/subcomponents/index.d.ts +2 -0
- package/dist/components/Toggle/ToggleHandle.d.ts +1 -1
- package/dist/components/UclLogoNew/UclLogo.d.ts +2 -1
- package/dist/components/UclLogoNew/__tests__/UclLogo.test.d.ts +1 -0
- package/dist/components/WeekPicker/__tests__/WeekPicker.test.d.ts +1 -0
- package/dist/index.js +5383 -5149
- package/dist/theme/dark/darkColour.d.ts +1 -0
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/light/lightColour.d.ts +1 -0
- package/dist/theme/original/defaultTheme.d.ts +7 -0
- package/dist/theme/original/originalColourNewStructure.d.ts +1 -0
- package/dist/theme/useTheme.d.ts +12 -0
- package/lib/components/Alert/AlertMessage.tsx +5 -4
- package/lib/components/Alert/AlertTitle.tsx +6 -8
- package/lib/components/AppHeader/AppHeader.stories.tsx +3 -3
- package/lib/components/AppHeader/AppHeader.tsx +2 -2
- package/lib/components/AppHeader/AppHeaderBottom.tsx +2 -3
- package/lib/components/AppHeader/AppHeaderTop.tsx +1 -1
- package/lib/components/AppHeader/__tests__/__snapshots__/AppHeader.test.tsx.snap +1 -1
- package/lib/components/AppMenu/AppMenuContent.tsx +4 -5
- package/lib/components/AppMenu/AppMenuDivider.tsx +5 -6
- package/lib/components/AppMenu/AppMenuItem.tsx +6 -6
- package/lib/components/AppMenu/__tests__/__snapshots__/AppMenu.test.tsx.snap +1 -1
- package/lib/components/Avatar/Avatar.tsx +7 -5
- package/lib/components/Avatar/__tests__/__snapshots__/Avatar.test.tsx.snap +18 -18
- package/lib/components/Badge/Badge.tsx +12 -12
- package/lib/components/Badge/__tests__/Badge.test.tsx +84 -1
- package/lib/components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap +2 -2
- package/lib/components/Blanket/Blanket.tsx +1 -1
- package/lib/components/Blanket/__tests__/__snapshots__/Blanket.test.tsx.snap +1 -1
- package/lib/components/Button/__tests__/Button.test.tsx +46 -1
- package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +2 -2
- package/lib/components/Button/style/buttonAccentStyle.ts +1 -1
- package/lib/components/Button/style/buttonPrimaryDestructiveStyle.ts +1 -1
- package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +1 -1
- package/lib/components/Button/style/buttonSecondarySubtleStyle.ts +1 -1
- package/lib/components/Calendar/Calendar.tsx +1 -0
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +17 -17
- package/lib/components/Calendar/subcomponents/AcademicWeek.tsx +0 -1
- package/lib/components/Calendar/subcomponents/Day.tsx +2 -2
- package/lib/components/Chip/Chip.tsx +7 -8
- package/lib/components/Chip/__tests__/__snapshots__/Chip.test.tsx.snap +5 -5
- package/lib/components/CookieNotice/CookieNotice.tsx +3 -3
- package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +34 -1
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +6 -6
- package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +7 -6
- package/lib/components/Datepicker/subcomponents/VisibleField.tsx +6 -8
- package/lib/components/Dialog/BaseDialog.tsx +3 -3
- package/lib/components/Divider/Divider.tsx +5 -3
- package/lib/components/FileInput/FileInput.tsx +1 -1
- package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +2 -2
- package/lib/components/Footer/Footer.tsx +17 -17
- package/lib/components/Footer/FooterNavLink.tsx +3 -3
- package/lib/components/Footer/SocialLink.tsx +3 -3
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +55 -55
- package/lib/components/FooterNew/BackToTop.tsx +1 -1
- package/lib/components/FooterNew/FooterColumn.tsx +1 -2
- package/lib/components/FooterNew/FooterNavLink.tsx +6 -5
- package/lib/components/FooterNew/LegalAndCopyright.tsx +15 -15
- package/lib/components/FooterNew/LogoAddressAndSocial.tsx +8 -6
- package/lib/components/FooterNew/SocialLink.tsx +4 -4
- package/lib/components/FooterNew/__tests__/__snapshots__/Footer.test.tsx.snap +44 -44
- package/lib/components/Header/Header.tsx +3 -3
- package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +2 -2
- package/lib/components/HeaderDraft/HeaderBottomBreadcrumbs.tsx +3 -4
- package/lib/components/HeaderDraft/HeaderBottomHeadingAndAvatar.tsx +7 -7
- package/lib/components/HeaderDraft/HeaderBreadcrumb.tsx +4 -4
- package/lib/components/HeaderDraft/HeaderDraft.tsx +7 -7
- package/lib/components/HeaderDraft/__tests__/__snapshots__/Header.test.tsx.snap +5 -5
- package/lib/components/HeaderNew/Header.tsx +2 -2
- package/lib/components/HeaderNew/__tests__/__snapshots__/Header.test.tsx.snap +2 -2
- package/lib/components/Input/Input.tsx +6 -6
- package/lib/components/Input/__tests__/__snapshots__/Input.test.tsx.snap +4 -4
- package/lib/components/Label/Label.tsx +2 -2
- package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +1 -1
- package/lib/components/Layout/Layout.stories.tsx +12 -12
- package/lib/components/Link/Link.tsx +4 -4
- package/lib/components/Menu/MenuContent.tsx +3 -3
- package/lib/components/Menu/MenuItem.tsx +10 -8
- package/lib/components/Menu/MenuSection.tsx +1 -1
- package/lib/components/Modal/Modal.tsx +5 -15
- package/lib/components/Modal/__tests__/__snapshots__/Modal.test.tsx.snap +2 -2
- package/lib/components/NativeDatepicker/NativeDatepicker.tsx +9 -7
- package/lib/components/Pagination/Pagination.stories.tsx +9 -0
- package/lib/components/Pagination/PaginationControls.tsx +17 -245
- package/lib/components/Pagination/__tests__/PaginationControls.test.tsx +213 -0
- package/lib/components/Pagination/subcomponents/PaginationCompactControls.tsx +266 -0
- package/lib/components/Pagination/subcomponents/PaginationStandardControls.tsx +246 -0
- package/lib/components/Pagination/subcomponents/index.ts +2 -0
- package/lib/components/Radio/Radio.tsx +13 -4
- package/lib/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +3 -3
- package/lib/components/Search/Search.tsx +2 -2
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +2 -2
- package/lib/components/Select/subcomponents/CustomSelect.tsx +4 -4
- package/lib/components/Spinner/Spinner.stories.tsx +3 -3
- package/lib/components/Spinner/Spinner.tsx +1 -1
- package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +3 -3
- package/lib/components/Table/subcomponents/Head.tsx +2 -2
- package/lib/components/Table/subcomponents/Row.tsx +1 -1
- package/lib/components/Textarea/Textarea.tsx +7 -8
- package/lib/components/Textarea/__tests__/__snapshots__/Textarea.test.tsx.snap +4 -4
- package/lib/components/Timepicker/Timepicker.tsx +6 -4
- package/lib/components/Toggle/Toggle.tsx +3 -1
- package/lib/components/Toggle/ToggleHandle.tsx +4 -2
- package/lib/components/Tooltip/Tooltip.tsx +8 -5
- package/lib/components/Tooltip/__tests__/__snapshots__/tooltip.test.tsx.snap +2 -2
- package/lib/components/UclLogo/UclLogoNegativeSpace.tsx +7 -3
- package/lib/components/UclLogoNew/UclLogo.tsx +8 -9
- package/lib/components/UclLogoNew/__tests__/UclLogo.test.tsx +41 -0
- package/lib/components/WeekPicker/__tests__/WeekPicker.test.tsx +36 -0
- package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +6 -6
- package/lib/components/WeekPicker/subcomponents/VisibleField.tsx +9 -9
- package/lib/theme/dark/darkColour.ts +2 -1
- package/lib/theme/dark/darkTheme.ts +8 -1
- package/lib/theme/index.ts +1 -0
- package/lib/theme/light/lightColour.ts +2 -1
- package/lib/theme/light/lightTheme.ts +7 -0
- package/lib/theme/original/defaultTheme.ts +10 -0
- package/lib/theme/original/originalColourNewStructure.ts +2 -1
- package/package.json +6 -6
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as theme } from './original/defaultTheme';
|
|
2
2
|
export { default as lightTheme } from './light/lightTheme';
|
|
3
3
|
export { default as darkTheme } from './dark/darkTheme';
|
|
4
|
-
export type { ThemeType, DisplayColoursType, BlackAndWhiteColoursType, } from './original/defaultTheme';
|
|
4
|
+
export type { ThemeType, LogoVariant, DisplayColoursType, BlackAndWhiteColoursType, } from './original/defaultTheme';
|
|
5
5
|
export { default as useTheme, ThemeContextProvider, ThemeContextConsumer, ThemeConsumer, themes, } from './useTheme';
|
|
6
6
|
export type { ThemeName } from './useTheme';
|
|
7
7
|
export { uikitFontUrls, uikitFonts } from './fonts';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { blackAndWhite, displayColours } from './color';
|
|
2
|
+
export type LogoVariant = 'primary' | 'secondary' | 'primary-inverse' | 'secondary-inverse';
|
|
2
3
|
declare const theme: {
|
|
3
4
|
p0: number;
|
|
4
5
|
p2: string;
|
|
@@ -752,6 +753,7 @@ declare const theme: {
|
|
|
752
753
|
cautionPressed: string;
|
|
753
754
|
cautionSubtle: string;
|
|
754
755
|
warningSubtle: string;
|
|
756
|
+
warning: string;
|
|
755
757
|
success: string;
|
|
756
758
|
successSubtle: string;
|
|
757
759
|
};
|
|
@@ -841,6 +843,11 @@ declare const theme: {
|
|
|
841
843
|
inputDefault: string;
|
|
842
844
|
};
|
|
843
845
|
};
|
|
846
|
+
logo: {
|
|
847
|
+
ucl: {
|
|
848
|
+
variant: LogoVariant;
|
|
849
|
+
};
|
|
850
|
+
};
|
|
844
851
|
typography: {
|
|
845
852
|
heading: {
|
|
846
853
|
xxl: {
|
package/dist/theme/useTheme.d.ts
CHANGED
|
@@ -764,6 +764,7 @@ declare const useTheme: () => [{
|
|
|
764
764
|
cautionPressed: string;
|
|
765
765
|
cautionSubtle: string;
|
|
766
766
|
warningSubtle: string;
|
|
767
|
+
warning: string;
|
|
767
768
|
success: string;
|
|
768
769
|
successSubtle: string;
|
|
769
770
|
};
|
|
@@ -853,6 +854,11 @@ declare const useTheme: () => [{
|
|
|
853
854
|
inputDefault: string;
|
|
854
855
|
};
|
|
855
856
|
};
|
|
857
|
+
logo: {
|
|
858
|
+
ucl: {
|
|
859
|
+
variant: import('.').LogoVariant;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
856
862
|
typography: {
|
|
857
863
|
heading: {
|
|
858
864
|
xxl: {
|
|
@@ -2078,6 +2084,7 @@ declare const useTheme: () => [{
|
|
|
2078
2084
|
cautionPressed: string;
|
|
2079
2085
|
cautionSubtle: string;
|
|
2080
2086
|
warningSubtle: string;
|
|
2087
|
+
warning: string;
|
|
2081
2088
|
success: string;
|
|
2082
2089
|
successSubtle: string;
|
|
2083
2090
|
};
|
|
@@ -2167,6 +2174,11 @@ declare const useTheme: () => [{
|
|
|
2167
2174
|
inputDefault: string;
|
|
2168
2175
|
};
|
|
2169
2176
|
};
|
|
2177
|
+
logo: {
|
|
2178
|
+
ucl: {
|
|
2179
|
+
variant: import('.').LogoVariant;
|
|
2180
|
+
};
|
|
2181
|
+
};
|
|
2170
2182
|
typography: {
|
|
2171
2183
|
heading: {
|
|
2172
2184
|
xxl: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { css, cx } from '@emotion/css';
|
|
2
|
-
import {
|
|
2
|
+
import { useTheme } from '../../theme';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
export const NAME = 'ucl-uikit-alert__message';
|
|
6
6
|
|
|
7
|
-
export interface AlertMessageProps
|
|
8
|
-
extends HTMLAttributes<HTMLParagraphElement> {
|
|
7
|
+
export interface AlertMessageProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
9
8
|
testId?: string;
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -14,9 +13,11 @@ const AlertMessage = ({
|
|
|
14
13
|
className,
|
|
15
14
|
children,
|
|
16
15
|
}: AlertMessageProps) => {
|
|
16
|
+
const [theme] = useTheme();
|
|
17
|
+
|
|
17
18
|
const messageStyles = css`
|
|
18
19
|
font-size: ${theme.font.size.f16};
|
|
19
|
-
color: ${theme.
|
|
20
|
+
color: ${theme.colour.text.default};
|
|
20
21
|
margin: 0;
|
|
21
22
|
line-height: 1.5;
|
|
22
23
|
`;
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { css } from '@emotion/css';
|
|
2
|
-
import {
|
|
2
|
+
import { useTheme } from '../../theme';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
export const NAME = 'ucl-uikit-alert__title';
|
|
6
6
|
|
|
7
|
-
export interface AlertTitleProps
|
|
8
|
-
extends HTMLAttributes<HTMLHeadingElement> {
|
|
7
|
+
export interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
9
8
|
testId?: string;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const AlertTitle = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}: AlertTitleProps) => {
|
|
11
|
+
const AlertTitle = ({ children, testId = NAME }: AlertTitleProps) => {
|
|
12
|
+
const [theme] = useTheme();
|
|
13
|
+
|
|
16
14
|
const titleStyles = css`
|
|
17
15
|
margin: 0 0 ${theme.margin.m8} 0;
|
|
18
16
|
font-family: ${theme.font.family.primary};
|
|
19
17
|
font-size: ${theme.font.size.f16};
|
|
20
18
|
font-weight: 700;
|
|
21
|
-
color: ${theme.
|
|
19
|
+
color: ${theme.colour.text.default};
|
|
22
20
|
`;
|
|
23
21
|
|
|
24
22
|
return (
|
|
@@ -27,7 +27,7 @@ export const WithBreadcrumbs: Story = {
|
|
|
27
27
|
|
|
28
28
|
// This ought to be done in`<Breadcrumb>`or in `<AppHeader.Bottom>`!
|
|
29
29
|
const invertedTextStyle = css`
|
|
30
|
-
color: ${theme.
|
|
30
|
+
color: ${theme.colour.text.inverse};
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
33
|
return (
|
|
@@ -60,7 +60,7 @@ export const WithMultipleBreadcrumbs: Story = {
|
|
|
60
60
|
render: () => {
|
|
61
61
|
const [theme] = useTheme();
|
|
62
62
|
const invertedTextStyle = css`
|
|
63
|
-
color: ${theme.
|
|
63
|
+
color: ${theme.colour.text.inverse};
|
|
64
64
|
`;
|
|
65
65
|
return (
|
|
66
66
|
<AppHeader>
|
|
@@ -92,7 +92,7 @@ export const WithAppMenu: Story = {
|
|
|
92
92
|
`;
|
|
93
93
|
|
|
94
94
|
const invertedTextStyle = css`
|
|
95
|
-
color: ${theme.
|
|
95
|
+
color: ${theme.colour.text.inverse};
|
|
96
96
|
`;
|
|
97
97
|
|
|
98
98
|
return (
|
|
@@ -30,8 +30,8 @@ const AppHeader = ({
|
|
|
30
30
|
const [theme] = useTheme();
|
|
31
31
|
|
|
32
32
|
const baseStyle = css`
|
|
33
|
-
background-color: ${theme.
|
|
34
|
-
color: ${theme.
|
|
33
|
+
background-color: ${theme.colour.surface.default};
|
|
34
|
+
color: ${theme.colour.text.default};
|
|
35
35
|
font-family: ${theme.font.family.primary};
|
|
36
36
|
`;
|
|
37
37
|
|
|
@@ -24,9 +24,8 @@ const AppHeaderBottom = ({
|
|
|
24
24
|
line-height: 48px;
|
|
25
25
|
display: flex;
|
|
26
26
|
align-items: center;
|
|
27
|
-
background-color: ${theme.
|
|
28
|
-
|
|
29
|
-
color: inherit;
|
|
27
|
+
background-color: ${theme.colour.surface.inverseBrandPrimary};
|
|
28
|
+
color: ${theme.colour.text.brandInverse};
|
|
30
29
|
`;
|
|
31
30
|
|
|
32
31
|
const style = cx(NAME, baseStyle, className);
|
|
@@ -35,7 +35,7 @@ const AppHeaderTop = ({
|
|
|
35
35
|
margin-left: auto;
|
|
36
36
|
margin-top: 20px;
|
|
37
37
|
height: 36px;
|
|
38
|
-
color: ${theme.
|
|
38
|
+
color: ${theme.colour.text.brandPrimary};
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
const uclLogoStyle = cx(uclLogoBaseStyle, logoClassName);
|
|
@@ -9,8 +9,7 @@ import useMediaQuery from '../../hooks/useMediaQuery';
|
|
|
9
9
|
|
|
10
10
|
export const NAME = 'ucl-app-menu__content';
|
|
11
11
|
|
|
12
|
-
export interface AppMenuContentProps
|
|
13
|
-
extends LiHTMLAttributes<HTMLUListElement> {
|
|
12
|
+
export interface AppMenuContentProps extends LiHTMLAttributes<HTMLUListElement> {
|
|
14
13
|
testId?: string;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -41,12 +40,12 @@ const AppMenuContent: React.FC<AppMenuContentProps> = ({
|
|
|
41
40
|
min-width: 140px;
|
|
42
41
|
white-space: nowrap;
|
|
43
42
|
cursor: default;
|
|
44
|
-
background-color:
|
|
43
|
+
background-color: ${theme.colour.surface.default};
|
|
45
44
|
box-shadow: ${theme.boxShadow.y1};
|
|
46
|
-
border: ${theme.border.b1} solid ${theme.
|
|
45
|
+
border: ${theme.border.b1} solid ${theme.colour.border.disabled};
|
|
47
46
|
padding-left: 0;
|
|
48
47
|
padding-right: 0;
|
|
49
|
-
color: ${theme.
|
|
48
|
+
color: ${theme.colour.text.default};
|
|
50
49
|
list-style: none;
|
|
51
50
|
|
|
52
51
|
@media (max-width: ${theme.breakpoints.desktop}px) {
|
|
@@ -4,11 +4,10 @@ import useTheme from '../../theme/useTheme';
|
|
|
4
4
|
|
|
5
5
|
export const NAME = 'ucl-app-menu__divider';
|
|
6
6
|
|
|
7
|
-
export interface AppMenuDividerProps
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
> {
|
|
7
|
+
export interface AppMenuDividerProps extends Omit<
|
|
8
|
+
HtmlHTMLAttributes<HTMLHRElement>,
|
|
9
|
+
'children'
|
|
10
|
+
> {
|
|
12
11
|
testId?: string;
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -23,7 +22,7 @@ const AppMenuDivider: React.FC<AppMenuDividerProps> = ({
|
|
|
23
22
|
margin: 0;
|
|
24
23
|
height: 1px;
|
|
25
24
|
border: none;
|
|
26
|
-
background-color: ${theme.
|
|
25
|
+
background-color: ${theme.colour.border.disabled};
|
|
27
26
|
`;
|
|
28
27
|
|
|
29
28
|
const style = cx(NAME, baseStyle, className);
|
|
@@ -55,13 +55,13 @@ const AppMenuItem: React.FC<AppMenuItemProps> = ({
|
|
|
55
55
|
align-items: center;
|
|
56
56
|
font-family: ${theme.font.family.primary};
|
|
57
57
|
font-size: ${theme.font.size.f16};
|
|
58
|
-
color: ${theme.
|
|
58
|
+
color: ${theme.colour.text.secondary};
|
|
59
59
|
`;
|
|
60
60
|
|
|
61
61
|
const clickableMenuItemStyle = css`
|
|
62
|
-
color: ${theme.
|
|
62
|
+
color: ${theme.colour.text.default};
|
|
63
63
|
&:hover {
|
|
64
|
-
background-color: ${theme.
|
|
64
|
+
background-color: ${theme.colour.surface.brandSecondary};
|
|
65
65
|
}
|
|
66
66
|
&:focus-visible {
|
|
67
67
|
outline: none;
|
|
@@ -72,16 +72,16 @@ const AppMenuItem: React.FC<AppMenuItemProps> = ({
|
|
|
72
72
|
|
|
73
73
|
const menuLinkStyle = css`
|
|
74
74
|
text-decoration: none;
|
|
75
|
-
color: ${theme.
|
|
75
|
+
color: ${theme.colour.text.default};
|
|
76
76
|
display: flex;
|
|
77
77
|
align-items: center;
|
|
78
78
|
width: 100%;
|
|
79
79
|
height: 100%;
|
|
80
80
|
&:hover {
|
|
81
|
-
background-color: ${theme.
|
|
81
|
+
background-color: ${theme.colour.surface.brandSecondary};
|
|
82
82
|
}
|
|
83
83
|
&:visited {
|
|
84
|
-
color: ${theme.
|
|
84
|
+
color: ${theme.colour.text.default};
|
|
85
85
|
}
|
|
86
86
|
&:focus-visible {
|
|
87
87
|
outline: none;
|
|
@@ -36,7 +36,7 @@ exports[`AppMenu > snapshot: defaultOpen prop 1`] = `
|
|
|
36
36
|
</button>
|
|
37
37
|
<ul
|
|
38
38
|
aria-labelledby="app-menu-button"
|
|
39
|
-
class="ucl-app-menu__content css-
|
|
39
|
+
class="ucl-app-menu__content css-1r69pxi"
|
|
40
40
|
data-testid="ucl-app-menu__content"
|
|
41
41
|
id="app-menu"
|
|
42
42
|
role="menu"
|
|
@@ -72,8 +72,8 @@ const Avatar = forwardRef<Ref, AvatarProps>(
|
|
|
72
72
|
outline: none;
|
|
73
73
|
width: ${size}px;
|
|
74
74
|
height: ${size}px;
|
|
75
|
-
color: ${theme.
|
|
76
|
-
background-color: ${theme.
|
|
75
|
+
color: ${theme.colour.text.brandPrimary};
|
|
76
|
+
background-color: ${theme.colour.fill.brandSubtle};
|
|
77
77
|
font-family: ${theme.font.family.primary};
|
|
78
78
|
font-size: ${fontSize}px;
|
|
79
79
|
cursor: pointer;
|
|
@@ -86,8 +86,8 @@ const Avatar = forwardRef<Ref, AvatarProps>(
|
|
|
86
86
|
`;
|
|
87
87
|
|
|
88
88
|
const disabledStyle = css`
|
|
89
|
-
background-color: ${theme.
|
|
90
|
-
color: ${theme.
|
|
89
|
+
background-color: ${theme.colour.fill.disabled};
|
|
90
|
+
color: ${theme.colour.text.disabled};
|
|
91
91
|
cursor: not-allowed;
|
|
92
92
|
`;
|
|
93
93
|
|
|
@@ -109,7 +109,9 @@ const Avatar = forwardRef<Ref, AvatarProps>(
|
|
|
109
109
|
// `padding-top` to prevent a thin grey line
|
|
110
110
|
// from appearing at the bottom of the icon
|
|
111
111
|
const iconStyle = css`
|
|
112
|
-
color: ${
|
|
112
|
+
color: ${
|
|
113
|
+
disabled ? theme.colour.icon.disabled : theme.colour.icon.brandPrimary
|
|
114
|
+
};
|
|
113
115
|
width: 100%;
|
|
114
116
|
height: 100%;
|
|
115
117
|
padding-top: 0.1em;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Avatar > Snapshot: Default 1`] = `
|
|
4
4
|
<button
|
|
5
|
-
class="ucl-uikit-avatar css-
|
|
5
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
6
6
|
data-testid="ucl-uikit-avatar"
|
|
7
7
|
>
|
|
8
8
|
<svg
|
|
9
|
-
class="ucl-uikit-icon css-
|
|
9
|
+
class="ucl-uikit-icon css-1jd3cs6"
|
|
10
10
|
data-testid="ucl-uikit-icon"
|
|
11
11
|
fill="currentColor"
|
|
12
12
|
height="24"
|
|
@@ -31,12 +31,12 @@ exports[`Avatar > Snapshot: Default 1`] = `
|
|
|
31
31
|
|
|
32
32
|
exports[`Avatar > Snapshot: Default with disabled prop 1`] = `
|
|
33
33
|
<button
|
|
34
|
-
class="ucl-uikit-avatar css-
|
|
34
|
+
class="ucl-uikit-avatar css-ucbqvu"
|
|
35
35
|
data-testid="ucl-uikit-avatar"
|
|
36
36
|
disabled=""
|
|
37
37
|
>
|
|
38
38
|
<svg
|
|
39
|
-
class="ucl-uikit-icon css-
|
|
39
|
+
class="ucl-uikit-icon css-vtowat"
|
|
40
40
|
data-testid="ucl-uikit-icon"
|
|
41
41
|
fill="currentColor"
|
|
42
42
|
height="24"
|
|
@@ -61,12 +61,12 @@ exports[`Avatar > Snapshot: Default with disabled prop 1`] = `
|
|
|
61
61
|
|
|
62
62
|
exports[`Avatar > Snapshot: icon variant with disabled prop 1`] = `
|
|
63
63
|
<button
|
|
64
|
-
class="ucl-uikit-avatar css-
|
|
64
|
+
class="ucl-uikit-avatar css-ucbqvu"
|
|
65
65
|
data-testid="ucl-uikit-avatar"
|
|
66
66
|
disabled=""
|
|
67
67
|
>
|
|
68
68
|
<svg
|
|
69
|
-
class="ucl-uikit-icon css-
|
|
69
|
+
class="ucl-uikit-icon css-vtowat"
|
|
70
70
|
data-testid="ucl-uikit-icon"
|
|
71
71
|
fill="currentColor"
|
|
72
72
|
height="24"
|
|
@@ -91,11 +91,11 @@ exports[`Avatar > Snapshot: icon variant with disabled prop 1`] = `
|
|
|
91
91
|
|
|
92
92
|
exports[`Avatar > Snapshot: icon variant with no props 1`] = `
|
|
93
93
|
<button
|
|
94
|
-
class="ucl-uikit-avatar css-
|
|
94
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
95
95
|
data-testid="ucl-uikit-avatar"
|
|
96
96
|
>
|
|
97
97
|
<svg
|
|
98
|
-
class="ucl-uikit-icon css-
|
|
98
|
+
class="ucl-uikit-icon css-1jd3cs6"
|
|
99
99
|
data-testid="ucl-uikit-icon"
|
|
100
100
|
fill="currentColor"
|
|
101
101
|
height="24"
|
|
@@ -120,7 +120,7 @@ exports[`Avatar > Snapshot: icon variant with no props 1`] = `
|
|
|
120
120
|
|
|
121
121
|
exports[`Avatar > Snapshot: image variant with imageUrl and name props 1`] = `
|
|
122
122
|
<button
|
|
123
|
-
class="ucl-uikit-avatar css-
|
|
123
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
124
124
|
data-testid="ucl-uikit-avatar"
|
|
125
125
|
>
|
|
126
126
|
<img
|
|
@@ -134,7 +134,7 @@ exports[`Avatar > Snapshot: image variant with imageUrl and name props 1`] = `
|
|
|
134
134
|
|
|
135
135
|
exports[`Avatar > Snapshot: image variant with imageUrl prop only 1`] = `
|
|
136
136
|
<button
|
|
137
|
-
class="ucl-uikit-avatar css-
|
|
137
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
138
138
|
data-testid="ucl-uikit-avatar"
|
|
139
139
|
>
|
|
140
140
|
<img
|
|
@@ -148,7 +148,7 @@ exports[`Avatar > Snapshot: image variant with imageUrl prop only 1`] = `
|
|
|
148
148
|
|
|
149
149
|
exports[`Avatar > Snapshot: image variant with imageUrl, name and disabled props 1`] = `
|
|
150
150
|
<button
|
|
151
|
-
class="ucl-uikit-avatar css-
|
|
151
|
+
class="ucl-uikit-avatar css-ucbqvu"
|
|
152
152
|
data-testid="ucl-uikit-avatar"
|
|
153
153
|
disabled=""
|
|
154
154
|
>
|
|
@@ -163,7 +163,7 @@ exports[`Avatar > Snapshot: image variant with imageUrl, name and disabled props
|
|
|
163
163
|
|
|
164
164
|
exports[`Avatar > Snapshot: image variant with name prop only 1`] = `
|
|
165
165
|
<button
|
|
166
|
-
class="ucl-uikit-avatar css-
|
|
166
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
167
167
|
data-testid="ucl-uikit-avatar"
|
|
168
168
|
>
|
|
169
169
|
<span
|
|
@@ -176,11 +176,11 @@ exports[`Avatar > Snapshot: image variant with name prop only 1`] = `
|
|
|
176
176
|
|
|
177
177
|
exports[`Avatar > Snapshot: image variant with no props 1`] = `
|
|
178
178
|
<button
|
|
179
|
-
class="ucl-uikit-avatar css-
|
|
179
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
180
180
|
data-testid="ucl-uikit-avatar"
|
|
181
181
|
>
|
|
182
182
|
<svg
|
|
183
|
-
class="ucl-uikit-icon css-
|
|
183
|
+
class="ucl-uikit-icon css-1jd3cs6"
|
|
184
184
|
data-testid="ucl-uikit-icon"
|
|
185
185
|
fill="currentColor"
|
|
186
186
|
height="24"
|
|
@@ -205,7 +205,7 @@ exports[`Avatar > Snapshot: image variant with no props 1`] = `
|
|
|
205
205
|
|
|
206
206
|
exports[`Avatar > Snapshot: initials variant with name prop 1`] = `
|
|
207
207
|
<button
|
|
208
|
-
class="ucl-uikit-avatar css-
|
|
208
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
209
209
|
data-testid="ucl-uikit-avatar"
|
|
210
210
|
>
|
|
211
211
|
<span
|
|
@@ -218,7 +218,7 @@ exports[`Avatar > Snapshot: initials variant with name prop 1`] = `
|
|
|
218
218
|
|
|
219
219
|
exports[`Avatar > Snapshot: initials variant with name prop and disabled prop 1`] = `
|
|
220
220
|
<button
|
|
221
|
-
class="ucl-uikit-avatar css-
|
|
221
|
+
class="ucl-uikit-avatar css-ucbqvu"
|
|
222
222
|
data-testid="ucl-uikit-avatar"
|
|
223
223
|
disabled=""
|
|
224
224
|
>
|
|
@@ -232,11 +232,11 @@ exports[`Avatar > Snapshot: initials variant with name prop and disabled prop 1`
|
|
|
232
232
|
|
|
233
233
|
exports[`Avatar > Snapshot: initials variant with no props 1`] = `
|
|
234
234
|
<button
|
|
235
|
-
class="ucl-uikit-avatar css-
|
|
235
|
+
class="ucl-uikit-avatar css-8z8m41"
|
|
236
236
|
data-testid="ucl-uikit-avatar"
|
|
237
237
|
>
|
|
238
238
|
<svg
|
|
239
|
-
class="ucl-uikit-icon css-
|
|
239
|
+
class="ucl-uikit-icon css-1jd3cs6"
|
|
240
240
|
data-testid="ucl-uikit-icon"
|
|
241
241
|
fill="currentColor"
|
|
242
242
|
height="24"
|
|
@@ -46,12 +46,12 @@ export const getBadgeVariantColours = (
|
|
|
46
46
|
theme: ThemeType
|
|
47
47
|
): Record<BadgeVariant, BadgeVariantStyle> => ({
|
|
48
48
|
info: {
|
|
49
|
-
color: theme.colour.text.
|
|
49
|
+
color: theme.colour.text.brandInverse,
|
|
50
50
|
backgroundColor: theme.colour.fill.brandPrimary,
|
|
51
51
|
},
|
|
52
52
|
'info-subtle': {
|
|
53
53
|
color: theme.colour.text.default,
|
|
54
|
-
backgroundColor: theme.
|
|
54
|
+
backgroundColor: theme.colour.fill.brandSubtle,
|
|
55
55
|
},
|
|
56
56
|
neutral: {
|
|
57
57
|
color: theme.colour.text.default,
|
|
@@ -68,31 +68,31 @@ export const getBadgeVariantColours = (
|
|
|
68
68
|
},
|
|
69
69
|
'critical-subtle': {
|
|
70
70
|
color: theme.colour.text.critical,
|
|
71
|
-
backgroundColor: theme.
|
|
71
|
+
backgroundColor: theme.colour.fill.criticalSubtle,
|
|
72
72
|
},
|
|
73
73
|
caution: {
|
|
74
|
-
color: theme.
|
|
75
|
-
backgroundColor: theme.
|
|
74
|
+
color: theme.colour.text.caution,
|
|
75
|
+
backgroundColor: theme.colour.fill.caution,
|
|
76
76
|
},
|
|
77
77
|
'caution-subtle': {
|
|
78
|
-
color: theme.
|
|
79
|
-
backgroundColor: theme.
|
|
78
|
+
color: theme.colour.text.cautionSubtle,
|
|
79
|
+
backgroundColor: theme.colour.fill.cautionSubtle,
|
|
80
80
|
},
|
|
81
81
|
success: {
|
|
82
82
|
color: theme.colour.text.inverse,
|
|
83
83
|
backgroundColor: theme.colour.fill.success,
|
|
84
84
|
},
|
|
85
85
|
'success-subtle': {
|
|
86
|
-
color: theme.
|
|
87
|
-
backgroundColor: theme.
|
|
86
|
+
color: theme.colour.text.success,
|
|
87
|
+
backgroundColor: theme.colour.fill.successSubtle,
|
|
88
88
|
},
|
|
89
89
|
warning: {
|
|
90
90
|
color: theme.colour.text.inverse,
|
|
91
|
-
backgroundColor: theme.
|
|
91
|
+
backgroundColor: theme.colour.fill.warning,
|
|
92
92
|
},
|
|
93
93
|
'warning-subtle': {
|
|
94
|
-
color: theme.
|
|
95
|
-
backgroundColor: theme.
|
|
94
|
+
color: theme.colour.text.warningOnBgFill,
|
|
95
|
+
backgroundColor: theme.colour.fill.warningSubtle,
|
|
96
96
|
},
|
|
97
97
|
disabled: {
|
|
98
98
|
color: theme.colour.text.disabled,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { describe, expect, test } from 'vitest';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { ThemeContextProvider } from '../../../theme/useTheme';
|
|
4
|
-
import
|
|
4
|
+
import darkTheme from '../../../theme/dark/darkTheme';
|
|
5
|
+
import lightTheme from '../../../theme/light/lightTheme';
|
|
6
|
+
import Badge, { getBadgeVariantColours } from '../Badge';
|
|
5
7
|
|
|
6
8
|
const wrap = (ui: React.ReactElement) =>
|
|
7
9
|
render(<ThemeContextProvider>{ui}</ThemeContextProvider>);
|
|
@@ -138,4 +140,85 @@ describe('Badge', () => {
|
|
|
138
140
|
const { container } = wrap(<Badge variant='success'>Text</Badge>);
|
|
139
141
|
expect(container.querySelector('svg')).toBeNull();
|
|
140
142
|
});
|
|
143
|
+
|
|
144
|
+
test('uses semantic colours for caution badges in dark theme', () => {
|
|
145
|
+
const colours = getBadgeVariantColours(darkTheme);
|
|
146
|
+
|
|
147
|
+
expect(colours.caution).toMatchObject({
|
|
148
|
+
color: darkTheme.colour.text.caution,
|
|
149
|
+
backgroundColor: darkTheme.colour.fill.caution,
|
|
150
|
+
});
|
|
151
|
+
expect(colours['caution-subtle']).toMatchObject({
|
|
152
|
+
color: darkTheme.colour.text.cautionSubtle,
|
|
153
|
+
backgroundColor: darkTheme.colour.fill.cautionSubtle,
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('uses semantic colours for info badges in dark theme', () => {
|
|
158
|
+
const colours = getBadgeVariantColours(darkTheme);
|
|
159
|
+
|
|
160
|
+
expect(colours.info).toMatchObject({
|
|
161
|
+
color: darkTheme.colour.text.brandInverse,
|
|
162
|
+
backgroundColor: darkTheme.colour.fill.brandPrimary,
|
|
163
|
+
});
|
|
164
|
+
expect(colours['info-subtle']).toMatchObject({
|
|
165
|
+
color: darkTheme.colour.text.default,
|
|
166
|
+
backgroundColor: darkTheme.colour.fill.brandSubtle,
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test('uses semantic colours for warning badges in dark theme', () => {
|
|
171
|
+
const colours = getBadgeVariantColours(darkTheme);
|
|
172
|
+
|
|
173
|
+
expect(colours.warning).toMatchObject({
|
|
174
|
+
color: darkTheme.colour.text.inverse,
|
|
175
|
+
backgroundColor: darkTheme.colour.fill.warning,
|
|
176
|
+
});
|
|
177
|
+
expect(colours['warning-subtle']).toMatchObject({
|
|
178
|
+
color: darkTheme.colour.text.warningOnBgFill,
|
|
179
|
+
backgroundColor: darkTheme.colour.fill.warningSubtle,
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('uses semantic colours for subtle status badges in dark theme', () => {
|
|
184
|
+
const colours = getBadgeVariantColours(darkTheme);
|
|
185
|
+
|
|
186
|
+
expect(colours['critical-subtle']).toMatchObject({
|
|
187
|
+
color: darkTheme.colour.text.critical,
|
|
188
|
+
backgroundColor: darkTheme.colour.fill.criticalSubtle,
|
|
189
|
+
});
|
|
190
|
+
expect(colours['success-subtle']).toMatchObject({
|
|
191
|
+
color: darkTheme.colour.text.success,
|
|
192
|
+
backgroundColor: darkTheme.colour.fill.successSubtle,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test('uses semantic colours for info, caution, and warning badges in light theme', () => {
|
|
197
|
+
const colours = getBadgeVariantColours(lightTheme);
|
|
198
|
+
|
|
199
|
+
expect(colours.info).toMatchObject({
|
|
200
|
+
color: lightTheme.colour.text.brandInverse,
|
|
201
|
+
backgroundColor: lightTheme.colour.fill.brandPrimary,
|
|
202
|
+
});
|
|
203
|
+
expect(colours['info-subtle']).toMatchObject({
|
|
204
|
+
color: lightTheme.colour.text.default,
|
|
205
|
+
backgroundColor: lightTheme.colour.fill.brandSubtle,
|
|
206
|
+
});
|
|
207
|
+
expect(colours.caution).toMatchObject({
|
|
208
|
+
color: lightTheme.colour.text.caution,
|
|
209
|
+
backgroundColor: lightTheme.colour.fill.caution,
|
|
210
|
+
});
|
|
211
|
+
expect(colours['caution-subtle']).toMatchObject({
|
|
212
|
+
color: lightTheme.colour.text.cautionSubtle,
|
|
213
|
+
backgroundColor: lightTheme.colour.fill.cautionSubtle,
|
|
214
|
+
});
|
|
215
|
+
expect(colours.warning).toMatchObject({
|
|
216
|
+
color: lightTheme.colour.text.inverse,
|
|
217
|
+
backgroundColor: lightTheme.colour.fill.warning,
|
|
218
|
+
});
|
|
219
|
+
expect(colours['warning-subtle']).toMatchObject({
|
|
220
|
+
color: lightTheme.colour.text.warningOnBgFill,
|
|
221
|
+
backgroundColor: lightTheme.colour.fill.warningSubtle,
|
|
222
|
+
});
|
|
223
|
+
});
|
|
141
224
|
});
|