uikit-react-public 0.32.5 → 0.36.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.
@@ -47,31 +47,35 @@ const Day = ({
47
47
  outline: none;
48
48
 
49
49
  &:hover {
50
- background-color: ${theme.colour.fill.hover};
50
+ background-color: ${theme.colour.fill.primary};
51
51
  }
52
52
 
53
- ${isSelected &&
54
- css`
55
- background-color: ${isDisabled
56
- ? theme.colour.fill.disabled
57
- : theme.colour.fill.brand};
58
-
59
- color: ${theme.colour.text.inverse};
60
-
61
- &:hover {
62
- background-color: ${theme.colour.fill.brandHover};
63
- }
64
- `}
65
- ${isDisabled &&
66
- css`
67
- cursor: not-allowed;
68
-
69
- &:hover {
70
- background-color: ${isSelected
71
- ? theme.color.neutral.grey10
72
- : theme.color.neutral.white};
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
- ${!isInCurrentMonth &&
83
- css`
84
- color: ${theme.color.neutral.grey40};
85
- `}
86
- ${isToday &&
87
- css`
88
- font-weight: 700;
89
- `}
90
- ${isDisabled &&
91
- css`
92
- color: ${theme.colour.text.disabled};
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`
@@ -68,7 +68,7 @@ export const HeaderResponsiveTrigger: Story = {
68
68
  cursor: pointer;
69
69
 
70
70
  &:hover {
71
- background-color: ${theme.colour.fill.hover};
71
+ background-color: ${theme.colour.fill.primary};
72
72
  }
73
73
  `;
74
74
 
@@ -64,7 +64,7 @@ const Snackbar = ({
64
64
  min-height: ${minHeight};
65
65
  z-index: 9999;
66
66
  padding: ${padding};
67
- color: ${theme.colour.text.inverse};
67
+ color: ${theme.colour.text.brandInverse};
68
68
  background-color: ${backgroundColor};
69
69
  `;
70
70
 
@@ -90,7 +90,7 @@ const Snackbar = ({
90
90
 
91
91
  const closeButtonStyle = css`
92
92
  &:hover {
93
- color: ${theme.colour.icon.inverseHover};
93
+ color: ${theme.colour.icon.brandInverse}; // todo: update to hover token when available
94
94
  }
95
95
  `;
96
96
 
@@ -98,11 +98,11 @@ const Snackbar = ({
98
98
  padding: ${theme.padding.p4};
99
99
  border: none;
100
100
  background-color: transparent;
101
- color: ${theme.colour.text.inverse};
101
+ color: ${theme.colour.text.brandInverse};
102
102
  cursor: pointer;
103
103
 
104
104
  &:hover {
105
- color: ${theme.colour.icon.inverseHover};
105
+ color: ${theme.colour.icon.brandInverse}; // todo: update to hover token when available
106
106
  }
107
107
 
108
108
  &: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-4vd8ej"
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-1s4q0nw"
43
+ class="css-16c49qk"
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-4vd8ej"
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-uv5ig"
98
+ class="ucl-uikit-icon-button css-1kh68vi"
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.surface.disabled};
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: ${checked
59
- ? theme.colour.fill.brandHover
60
- : theme.colour.icon.secondary};
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.brand,
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.brand,
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
  });