uikit-react-public 0.37.2 → 0.38.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.
Files changed (123) hide show
  1. package/dist/components/Alert/Alert.d.ts +1 -1
  2. package/dist/components/Alert/Alert.stories.d.ts +1 -1
  3. package/dist/components/Alert/AlertTitle.d.ts +1 -1
  4. package/dist/components/Datepicker/subcomponents/Panel.d.ts +1 -2
  5. package/dist/components/Overlay/Overlay.d.ts +2 -1
  6. package/dist/components/Overlay/Overlay.stories.d.ts +1 -0
  7. package/dist/components/Toggle/ToggleHandle.d.ts +1 -1
  8. package/dist/components/UclLogoNew/UclLogo.d.ts +2 -1
  9. package/dist/components/UclLogoNew/__tests__/UclLogo.test.d.ts +1 -0
  10. package/dist/components/WeekPicker/__tests__/WeekPicker.test.d.ts +1 -0
  11. package/dist/index.js +3479 -3396
  12. package/dist/theme/dark/darkColour.d.ts +1 -0
  13. package/dist/theme/index.d.ts +1 -1
  14. package/dist/theme/light/lightColour.d.ts +1 -0
  15. package/dist/theme/original/defaultTheme.d.ts +7 -0
  16. package/dist/theme/original/originalColourNewStructure.d.ts +1 -0
  17. package/dist/theme/useTheme.d.ts +12 -0
  18. package/lib/components/Alert/AlertMessage.tsx +5 -4
  19. package/lib/components/Alert/AlertTitle.tsx +6 -8
  20. package/lib/components/AppHeader/AppHeader.stories.tsx +3 -3
  21. package/lib/components/AppHeader/AppHeader.tsx +2 -2
  22. package/lib/components/AppHeader/AppHeaderBottom.tsx +2 -3
  23. package/lib/components/AppHeader/AppHeaderTop.tsx +1 -1
  24. package/lib/components/AppHeader/__tests__/__snapshots__/AppHeader.test.tsx.snap +1 -1
  25. package/lib/components/AppMenu/AppMenuContent.tsx +4 -5
  26. package/lib/components/AppMenu/AppMenuDivider.tsx +5 -6
  27. package/lib/components/AppMenu/AppMenuItem.tsx +6 -6
  28. package/lib/components/AppMenu/__tests__/__snapshots__/AppMenu.test.tsx.snap +1 -1
  29. package/lib/components/Avatar/Avatar.tsx +7 -5
  30. package/lib/components/Avatar/__tests__/__snapshots__/Avatar.test.tsx.snap +18 -18
  31. package/lib/components/Badge/Badge.tsx +12 -12
  32. package/lib/components/Badge/__tests__/Badge.test.tsx +84 -1
  33. package/lib/components/Badge/__tests__/__snapshots__/Badge.test.tsx.snap +2 -2
  34. package/lib/components/Blanket/Blanket.tsx +1 -1
  35. package/lib/components/Blanket/__tests__/__snapshots__/Blanket.test.tsx.snap +1 -1
  36. package/lib/components/Button/__tests__/Button.test.tsx +46 -1
  37. package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +2 -2
  38. package/lib/components/Button/style/buttonAccentStyle.ts +1 -1
  39. package/lib/components/Button/style/buttonPrimaryDestructiveStyle.ts +1 -1
  40. package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +1 -1
  41. package/lib/components/Button/style/buttonSecondarySubtleStyle.ts +1 -1
  42. package/lib/components/Calendar/Calendar.tsx +1 -0
  43. package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +17 -17
  44. package/lib/components/Calendar/subcomponents/AcademicWeek.tsx +0 -1
  45. package/lib/components/Calendar/subcomponents/Day.tsx +2 -2
  46. package/lib/components/Chip/Chip.tsx +7 -8
  47. package/lib/components/Chip/__tests__/__snapshots__/Chip.test.tsx.snap +5 -5
  48. package/lib/components/CookieNotice/CookieNotice.tsx +3 -3
  49. package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +58 -1
  50. package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +6 -6
  51. package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +32 -11
  52. package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +7 -6
  53. package/lib/components/Datepicker/subcomponents/Panel.tsx +3 -21
  54. package/lib/components/Datepicker/subcomponents/VisibleField.tsx +6 -8
  55. package/lib/components/Dialog/BaseDialog.tsx +3 -3
  56. package/lib/components/Divider/Divider.tsx +5 -3
  57. package/lib/components/FileInput/FileInput.tsx +1 -1
  58. package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +2 -2
  59. package/lib/components/Footer/Footer.tsx +17 -17
  60. package/lib/components/Footer/FooterNavLink.tsx +3 -3
  61. package/lib/components/Footer/SocialLink.tsx +3 -3
  62. package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +55 -55
  63. package/lib/components/FooterNew/BackToTop.tsx +1 -1
  64. package/lib/components/FooterNew/FooterColumn.tsx +1 -2
  65. package/lib/components/FooterNew/FooterNavLink.tsx +6 -5
  66. package/lib/components/FooterNew/LegalAndCopyright.tsx +15 -15
  67. package/lib/components/FooterNew/LogoAddressAndSocial.tsx +8 -6
  68. package/lib/components/FooterNew/SocialLink.tsx +4 -4
  69. package/lib/components/FooterNew/__tests__/__snapshots__/Footer.test.tsx.snap +44 -44
  70. package/lib/components/Header/Header.tsx +3 -3
  71. package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +2 -2
  72. package/lib/components/HeaderDraft/HeaderBottomBreadcrumbs.tsx +3 -4
  73. package/lib/components/HeaderDraft/HeaderBottomHeadingAndAvatar.tsx +7 -7
  74. package/lib/components/HeaderDraft/HeaderBreadcrumb.tsx +4 -4
  75. package/lib/components/HeaderDraft/HeaderDraft.tsx +7 -7
  76. package/lib/components/HeaderDraft/__tests__/__snapshots__/Header.test.tsx.snap +5 -5
  77. package/lib/components/HeaderNew/Header.tsx +2 -2
  78. package/lib/components/HeaderNew/__tests__/__snapshots__/Header.test.tsx.snap +2 -2
  79. package/lib/components/Input/Input.tsx +6 -6
  80. package/lib/components/Input/__tests__/__snapshots__/Input.test.tsx.snap +4 -4
  81. package/lib/components/Label/Label.tsx +2 -2
  82. package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +1 -1
  83. package/lib/components/Layout/Layout.stories.tsx +12 -12
  84. package/lib/components/Link/Link.tsx +4 -4
  85. package/lib/components/Menu/MenuContent.tsx +3 -3
  86. package/lib/components/Menu/MenuItem.tsx +10 -8
  87. package/lib/components/Menu/MenuSection.tsx +1 -1
  88. package/lib/components/Modal/Modal.tsx +5 -15
  89. package/lib/components/Modal/__tests__/__snapshots__/Modal.test.tsx.snap +2 -2
  90. package/lib/components/NativeDatepicker/NativeDatepicker.tsx +9 -7
  91. package/lib/components/Overlay/Overlay.tsx +17 -5
  92. package/lib/components/Radio/Radio.tsx +13 -4
  93. package/lib/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +3 -3
  94. package/lib/components/Search/Search.tsx +2 -2
  95. package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +2 -2
  96. package/lib/components/Select/subcomponents/CustomSelect.tsx +4 -4
  97. package/lib/components/Spinner/Spinner.stories.tsx +3 -3
  98. package/lib/components/Spinner/Spinner.tsx +1 -1
  99. package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +3 -3
  100. package/lib/components/Table/subcomponents/Head.tsx +2 -2
  101. package/lib/components/Table/subcomponents/Row.tsx +1 -1
  102. package/lib/components/Textarea/Textarea.tsx +7 -8
  103. package/lib/components/Textarea/__tests__/__snapshots__/Textarea.test.tsx.snap +4 -4
  104. package/lib/components/Timepicker/Timepicker.tsx +6 -4
  105. package/lib/components/Toggle/Toggle.tsx +4 -2
  106. package/lib/components/Toggle/ToggleHandle.tsx +4 -2
  107. package/lib/components/Tooltip/Tooltip.tsx +8 -5
  108. package/lib/components/Tooltip/__tests__/__snapshots__/tooltip.test.tsx.snap +2 -2
  109. package/lib/components/UclLogo/UclLogoNegativeSpace.tsx +7 -3
  110. package/lib/components/UclLogoNew/UclLogo.tsx +8 -9
  111. package/lib/components/UclLogoNew/__tests__/UclLogo.test.tsx +41 -0
  112. package/lib/components/WeekPicker/__tests__/WeekPicker.test.tsx +36 -0
  113. package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +27 -11
  114. package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +6 -6
  115. package/lib/components/WeekPicker/subcomponents/VisibleField.tsx +9 -9
  116. package/lib/theme/dark/darkColour.ts +2 -1
  117. package/lib/theme/dark/darkTheme.ts +8 -1
  118. package/lib/theme/index.ts +1 -0
  119. package/lib/theme/light/lightColour.ts +2 -1
  120. package/lib/theme/light/lightTheme.ts +7 -0
  121. package/lib/theme/original/defaultTheme.ts +10 -0
  122. package/lib/theme/original/originalColourNewStructure.ts +2 -1
  123. package/package.json +2 -2
@@ -5,7 +5,7 @@ exports[`Input > snapshot: no props 1`] = `
5
5
  class="ucl-uikit-input css-1bpb1dw"
6
6
  >
7
7
  <input
8
- class="ucl-uikit-input__input css-1nizqet"
8
+ class="ucl-uikit-input__input css-1i2w3yn"
9
9
  data-testid="ucl-uikit-input"
10
10
  id=""
11
11
  />
@@ -17,7 +17,7 @@ exports[`Input > snapshot: placeholder prop 1`] = `
17
17
  class="ucl-uikit-input css-1bpb1dw"
18
18
  >
19
19
  <input
20
- class="ucl-uikit-input__input css-1nizqet"
20
+ class="ucl-uikit-input__input css-1i2w3yn"
21
21
  data-testid="ucl-uikit-input"
22
22
  id=""
23
23
  placeholder="Type your value..."
@@ -30,7 +30,7 @@ exports[`Input > snapshot: testId prop 1`] = `
30
30
  class="ucl-uikit-input css-1bpb1dw"
31
31
  >
32
32
  <input
33
- class="ucl-uikit-input__input css-1nizqet"
33
+ class="ucl-uikit-input__input css-1i2w3yn"
34
34
  data-testid="test123"
35
35
  id=""
36
36
  />
@@ -42,7 +42,7 @@ exports[`Input > snapshot: value prop 1`] = `
42
42
  class="ucl-uikit-input css-1bpb1dw"
43
43
  >
44
44
  <input
45
- class="ucl-uikit-input__input css-1nizqet"
45
+ class="ucl-uikit-input__input css-1i2w3yn"
46
46
  data-testid="ucl-uikit-input"
47
47
  id=""
48
48
  value="abc"
@@ -43,7 +43,7 @@ const Label = forwardRef<Ref, LabelProps>(
43
43
 
44
44
  const baseStyle = css`
45
45
  width: 100%;
46
- color: ${theme.color.neutral.grey90};
46
+ color: ${theme.colour.text.default};
47
47
  font-family: ${theme.font.family.primary};
48
48
  font-size: ${theme.font.size.f16};
49
49
  `;
@@ -61,7 +61,7 @@ const Label = forwardRef<Ref, LabelProps>(
61
61
  `;
62
62
 
63
63
  const disabledStyle = css`
64
- color: ${theme.color.neutral.grey20};
64
+ color: ${theme.colour.text.disabled};
65
65
  `;
66
66
 
67
67
  const style = cx(
@@ -52,7 +52,7 @@ exports[`Label > snapshot: type prop with inline value 1`] = `
52
52
 
53
53
  exports[`Label > snapshot: with disabled prop 1`] = `
54
54
  <label
55
- class="ucl-uikit-label css-19nek55"
55
+ class="ucl-uikit-label css-h3b4e6"
56
56
  data-testid="ucl-uikit-label"
57
57
  for=""
58
58
  >
@@ -26,7 +26,7 @@ export const ThreeColumns: Story = {
26
26
  const sectionStyle = css`
27
27
  grid-column: span 4;
28
28
  height: 100%;
29
- background-color: ${theme.color.display.blueMuted};
29
+ background-color: ${theme.primitiveColour.blue['06'].$value.hex};
30
30
  `;
31
31
 
32
32
  const numberMarkerStyle = css`
@@ -36,7 +36,7 @@ export const ThreeColumns: Story = {
36
36
  height: 8rem;
37
37
  font-size: ${theme.font.size.f20};
38
38
  font-weight: ${theme.font.weight.semiBold};
39
- color: ${theme.color.text.primary};
39
+ color: ${theme.colour.text.default};
40
40
  font-family: ${theme.font.family.fixed};
41
41
  font-size: ${theme.font.size.f20};
42
42
  `;
@@ -65,7 +65,7 @@ export const FourColumns: Story = {
65
65
  const sectionStyle = css`
66
66
  grid-column: span 4;
67
67
  height: 100%;
68
- background-color: ${theme.color.display.pinkMuted};
68
+ background-color: ${theme.primitiveColour.red['03'].$value.hex};
69
69
 
70
70
  ${theme.mq.mobile} {
71
71
  grid-column: span 2;
@@ -83,7 +83,7 @@ export const FourColumns: Story = {
83
83
  height: 8rem;
84
84
  font-size: ${theme.font.size.f20};
85
85
  font-weight: ${theme.font.weight.semiBold};
86
- color: ${theme.color.text.primary};
86
+ color: ${theme.colour.text.default};
87
87
  font-family: ${theme.font.family.fixed};
88
88
  font-size: ${theme.font.size.f20};
89
89
  `;
@@ -155,7 +155,7 @@ export const GenericScreen: Story = {
155
155
  `;
156
156
 
157
157
  const colourBlockStyle = css`
158
- background-color: ${theme.color.display.yellowVibrant};
158
+ background-color: ${theme.primitiveColour.yellow['08'].$value.hex};
159
159
  height: 250px;
160
160
  `;
161
161
 
@@ -236,7 +236,7 @@ export const CreativeGrid: Story = {
236
236
 
237
237
  const block1Style = css`
238
238
  ${gridItemBaseStyle}
239
- background-color: ${theme.color.display.purpleVibrant};
239
+ background-color: ${theme.primitiveColour.brandPurple['10'].$value.hex};
240
240
 
241
241
  ${theme.mq.mobile} {
242
242
  grid-column: 1 / 8;
@@ -264,7 +264,7 @@ export const CreativeGrid: Story = {
264
264
 
265
265
  const block2Style = css`
266
266
  ${gridItemBaseStyle}
267
- background-color: ${theme.color.display.blueVibrant};
267
+ background-color: ${theme.primitiveColour.blue['09'].$value.hex};
268
268
 
269
269
  ${theme.mq.mobile} {
270
270
  grid-column: 8 / 13;
@@ -291,7 +291,7 @@ export const CreativeGrid: Story = {
291
291
 
292
292
  const block3Style = css`
293
293
  ${gridItemBaseStyle}
294
- background-color: ${theme.color.display.greenVibrant};
294
+ background-color: ${theme.primitiveColour.green['07'].$value.hex};
295
295
 
296
296
  ${theme.mq.mobile} {
297
297
  grid-column: 8 / 13;
@@ -319,7 +319,7 @@ export const CreativeGrid: Story = {
319
319
 
320
320
  const block4Style = css`
321
321
  ${gridItemBaseStyle}
322
- background-color: ${theme.color.display.blueMuted};
322
+ background-color: ${theme.primitiveColour.blue['06'].$value.hex};
323
323
 
324
324
  ${theme.mq.mobile} {
325
325
  grid-column: 1 / 8;
@@ -346,7 +346,7 @@ export const CreativeGrid: Story = {
346
346
 
347
347
  const block5Style = css`
348
348
  ${gridItemBaseStyle}
349
- background-color: ${theme.color.display.yellowVibrant};
349
+ background-color: ${theme.primitiveColour.yellow['08'].$value.hex};
350
350
 
351
351
  ${theme.mq.mobile} {
352
352
  grid-column: 1 / 8;
@@ -373,7 +373,7 @@ export const CreativeGrid: Story = {
373
373
 
374
374
  const block6Style = css`
375
375
  ${gridItemBaseStyle}
376
- background-color: ${theme.color.display.pinkVibrant};
376
+ background-color: ${theme.primitiveColour.red['11'].$value.hex};
377
377
 
378
378
  ${theme.mq.mobile} {
379
379
  grid-column: 8 / 13;
@@ -400,7 +400,7 @@ export const CreativeGrid: Story = {
400
400
 
401
401
  const block7Style = css`
402
402
  ${gridItemBaseStyle}
403
- background-color: ${theme.color.display.blueVibrant};
403
+ background-color: ${theme.primitiveColour.blue['09'].$value.hex};
404
404
 
405
405
  ${theme.mq.mobile} {
406
406
  grid-column: 1 / 13;
@@ -51,10 +51,10 @@ const Link = forwardRef(function LinkInner(
51
51
 
52
52
  // todo: deprecate secondary
53
53
  const secondaryStyle = css`
54
- color: ${theme.color.link.secondaryDefault};
54
+ color: ${theme.colour.link.default};
55
55
 
56
56
  &:active {
57
- color: ${theme.color.link.secondaryHover};
57
+ color: ${theme.colour.link.brandHover};
58
58
  }
59
59
  `;
60
60
 
@@ -72,7 +72,7 @@ const Link = forwardRef(function LinkInner(
72
72
 
73
73
  const secondaryNoVisitedStyle = css`
74
74
  &:visited {
75
- color: ${theme.color.link.secondaryDefault};
75
+ color: ${theme.colour.link.default};
76
76
  }
77
77
  `;
78
78
 
@@ -84,7 +84,7 @@ const Link = forwardRef(function LinkInner(
84
84
 
85
85
  const secondaryHoverStyle = css`
86
86
  &:hover {
87
- color: ${theme.color.link.secondaryHover};
87
+ color: ${theme.colour.link.brandHover};
88
88
  }
89
89
  `;
90
90
 
@@ -38,8 +38,8 @@ const MenuContent: React.FC<MenuContentProps> = ({
38
38
  z-index: 100;
39
39
  ${position === 'left' ? 'left: 0;' : 'right: 0;'}
40
40
  white-space: nowrap;
41
- background-color: ${theme.color.neutral.white};
42
- color: ${theme.color.text.primary};
41
+ background-color: ${theme.colour.surface.default};
42
+ color: ${theme.colour.text.default};
43
43
 
44
44
  position: fixed;
45
45
  height: 100vh;
@@ -58,7 +58,7 @@ const MenuContent: React.FC<MenuContentProps> = ({
58
58
  position: absolute;
59
59
  height: auto;
60
60
  min-width: 600px;
61
- border: ${theme.border.b1} solid ${theme.color.neutral.grey20};
61
+ border: ${theme.border.b1} solid ${theme.colour.border.default};
62
62
  box-shadow: ${theme.boxShadow.y1};
63
63
  }
64
64
  `;
@@ -32,19 +32,21 @@ const MenuItem: React.FC<MenuItemProps> = ({
32
32
  align-items: center;
33
33
  font-family: ${theme.font.family.primary};
34
34
  font-size: ${theme.font.size.f16};
35
- font-weight: ${secondary
36
- ? `${theme.font.weight.medium}`
37
- : `${theme.font.weight.bold}`};
38
- color: ${theme.color.text.secondary};
35
+ font-weight: ${
36
+ secondary ? `${theme.font.weight.medium}` : `${theme.font.weight.bold}`
37
+ };
38
+ color: ${theme.colour.text.secondary};
39
39
  `;
40
40
 
41
41
  const clickableMenuItemStyle = css`
42
- color: ${secondary
43
- ? `${theme.color.text.secondary}`
44
- : `${theme.color.text.primary}`};
42
+ color: ${
43
+ secondary
44
+ ? `${theme.colour.text.secondary}`
45
+ : `${theme.colour.text.default}`
46
+ };
45
47
  cursor: pointer;
46
48
  &:hover {
47
- background-color: ${theme.color.interaction.blue5};
49
+ background-color: ${theme.colour.fill.brandSubtleHover};
48
50
  }
49
51
  &:focus-visible {
50
52
  outline: none;
@@ -21,7 +21,7 @@ const MenuSection: React.FC<MenuSectionProps> = ({
21
21
  margin-bottom: ${theme.margin.m32};
22
22
 
23
23
  &:not(:last-of-type) {
24
- border-bottom: 1px solid ${theme.color.neutral.grey10};
24
+ border-bottom: 1px solid ${theme.colour.border.default};
25
25
  }
26
26
  `;
27
27
 
@@ -1,17 +1,11 @@
1
- import {
2
- HTMLAttributes,
3
- forwardRef,
4
- memo,
5
- useCallback,
6
- } from 'react';
1
+ import { HTMLAttributes, forwardRef, memo, useCallback } from 'react';
7
2
  import { css, cx } from '@emotion/css';
8
3
  import useTheme from '../../theme/useTheme';
9
4
  import Blanket from '../Blanket';
10
5
 
11
6
  export const NAME = 'ucl-modal';
12
7
 
13
- export interface ModalProps
14
- extends HTMLAttributes<HTMLDivElement> {
8
+ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
15
9
  centered?: boolean;
16
10
  closeOnClickOutside?: boolean;
17
11
  onClose?: () => void;
@@ -40,7 +34,7 @@ const Modal = forwardRef<Ref, ModalProps>(
40
34
  max-width: 600px;
41
35
  font-family: ${theme.font.family.primary};
42
36
  font-size: ${theme.font.size.f16};
43
- color: ${theme.color.text.primary};
37
+ color: ${theme.colour.text.default};
44
38
  pointer-events: none;
45
39
  `;
46
40
 
@@ -61,7 +55,7 @@ const Modal = forwardRef<Ref, ModalProps>(
61
55
  const dialogStyle = css`
62
56
  position: relative;
63
57
  background-clip: padding-box;
64
- background-color: ${theme.color.neutral.white};
58
+ background-color: ${theme.colour.surface.default};
65
59
  box-shadow: ${theme.boxShadow.x2y4};
66
60
  outline: 0;
67
61
  pointer-events: auto;
@@ -79,11 +73,7 @@ const Modal = forwardRef<Ref, ModalProps>(
79
73
  return (
80
74
  <Blanket
81
75
  className={className}
82
- onClick={
83
- closeOnClickOutside
84
- ? handleOutsideDialogClick
85
- : undefined
86
- }
76
+ onClick={closeOnClickOutside ? handleOutsideDialogClick : undefined}
87
77
  >
88
78
  <div
89
79
  className={positioningStyle}
@@ -4,7 +4,7 @@ exports[`Modal > snapshot: default 1`] = `
4
4
  <div
5
5
  aria-hidden="true"
6
6
  aria-label="Backdrop overlay, click to close modal"
7
- class="ucl-blanket css-gsa5om"
7
+ class="ucl-blanket css-1kp3xax"
8
8
  data-testid="ucl-blanket"
9
9
  >
10
10
  <div
@@ -12,7 +12,7 @@ exports[`Modal > snapshot: default 1`] = `
12
12
  >
13
13
  <div
14
14
  aira-modal="true"
15
- class="css-fjo1in"
15
+ class="css-1py9lz2"
16
16
  data-testid="ucl-modal"
17
17
  role="dialog"
18
18
  />
@@ -1,5 +1,5 @@
1
1
  import { css, cx } from '@emotion/css';
2
- import { theme } from '../../theme';
2
+ import { useTheme } from '../../theme';
3
3
  import { dateToLocaleISOString } from './utils';
4
4
  import type { NativeDatepickerProps } from './NativeDatepicker.types';
5
5
 
@@ -16,13 +16,15 @@ const NativeDatepicker = ({
16
16
  ref,
17
17
  ...props
18
18
  }: NativeDatepickerProps) => {
19
+ const [theme] = useTheme();
20
+
19
21
  const baseStyle = css`
20
22
  width: 196px;
21
23
  height: 48px;
22
24
  box-sizing: border-box;
23
25
  padding: 0 16px;
24
- border: 1px solid ${theme.color.neutral.grey60};
25
- color: #1a1a1a;
26
+ border: 1px solid ${theme.colour.speciality.inputDefault};
27
+ color: ${theme.colour.text.default};
26
28
  font-size: 16px;
27
29
  font-family: sans-serif;
28
30
  text-transform: uppercase;
@@ -34,14 +36,14 @@ const NativeDatepicker = ({
34
36
  }
35
37
 
36
38
  &::placeholder {
37
- color: #8c8c8c; // TODO: Needs a design token -- Figma says 'color/text/tertiary'
39
+ color: ${theme.colour.text.tertiary};
38
40
  }
39
41
  `;
40
42
 
41
43
  const disabledStyle = css`
42
- color: ${theme.color.text.disabled};
43
- background-color: ${theme.color.neutral.white};
44
- border-color: ${theme.color.neutral.grey20};
44
+ color: ${theme.colour.text.disabled};
45
+ background-color: ${theme.colour.fill.inverse};
46
+ border-color: ${theme.colour.border.disabled};
45
47
  cursor: not-allowed;
46
48
  `;
47
49
 
@@ -21,7 +21,7 @@ import {
21
21
  Placement,
22
22
  type FlipOptions,
23
23
  type ShiftOptions,
24
- // Strategy,
24
+ type Strategy,
25
25
  } from '@floating-ui/react-dom';
26
26
 
27
27
  import { css, cx } from '@emotion/css';
@@ -44,6 +44,7 @@ export type OverlaySize = {
44
44
  export interface OverlayProps extends HTMLAttributes<HTMLDivElement> {
45
45
  reference: RefObject<HTMLElement | null>;
46
46
  placement?: Placement;
47
+ strategy?: Strategy;
47
48
  blanket?: boolean;
48
49
  flip?: boolean | FlipOptions;
49
50
  shift?: boolean | ShiftOptions;
@@ -62,6 +63,7 @@ const Overlay = forwardRef<Ref, OverlayProps>(
62
63
  {
63
64
  reference,
64
65
  placement = 'bottom',
66
+ strategy = 'absolute',
65
67
  blanket = false,
66
68
  flip = true,
67
69
  shift = true,
@@ -84,10 +86,21 @@ const Overlay = forwardRef<Ref, OverlayProps>(
84
86
  useImperativeHandle<Ref, Ref>(forwardedRef, () => ref.current);
85
87
 
86
88
  const fuiMiddleware = [];
87
- if (flip) fuiMiddleware.push(fuiFlip(typeof flip === 'object' ? flip : {}));
89
+ if (offset) fuiMiddleware.push(fuiOffset(offset));
90
+ if (flip)
91
+ fuiMiddleware.push(
92
+ fuiFlip({
93
+ // When escaping a containing element (e.g. a small Dialog) via
94
+ // `fixed` positioning, fall back to the originally-requested side
95
+ // rather than floating-ui's default "best fit" placement - bestFit
96
+ // can pick a placement that overlaps the reference entirely when
97
+ // nothing fits within the (still dialog-sized) boundary.
98
+ ...(strategy === 'fixed' && { fallbackStrategy: 'initialPlacement' }),
99
+ ...(typeof flip === 'object' ? flip : {}),
100
+ })
101
+ );
88
102
  if (shift)
89
103
  fuiMiddleware.push(fuiShift(typeof shift === 'object' ? shift : {}));
90
- if (offset) fuiMiddleware.push(fuiOffset(offset));
91
104
  if (size) {
92
105
  const sizeOptions = typeof size === 'object' ? size : {};
93
106
  const { padding = 0, matchReferenceWidth = false } = sizeOptions;
@@ -116,13 +129,12 @@ const Overlay = forwardRef<Ref, OverlayProps>(
116
129
  x,
117
130
  y,
118
131
  refs,
119
- strategy,
120
132
  placement: currentPlacement,
121
133
  } = useFloating({
122
134
  open: true,
123
135
  middleware: fuiMiddleware,
124
136
  placement,
125
- // strategy: 'absolute',
137
+ strategy,
126
138
  whileElementsMounted: autoUpdate,
127
139
  });
128
140
 
@@ -50,7 +50,7 @@ const Radio = forwardRef<Ref, RadioProps>(
50
50
  border-style: solid;
51
51
  outline: none;
52
52
  box-sizing: border-box;
53
- color: ${theme.color.neutral.white};
53
+ color: ${theme.colour.icon.inverse};
54
54
  transition:
55
55
  background-color 0.15s ease-out,
56
56
  border-color 0.15s ease-out;
@@ -74,7 +74,13 @@ const Radio = forwardRef<Ref, RadioProps>(
74
74
  border-color: ${theme.colour.speciality.inputDefault};
75
75
  `;
76
76
 
77
- const disabledStyle = css`
77
+ const disabledUncheckedStyle = css`
78
+ background-color: ${theme.colour.icon.inverse};
79
+ border-color: ${theme.colour.border.disabled};
80
+ cursor: not-allowed;
81
+ `;
82
+
83
+ const disabledCheckedStyle = css`
78
84
  background-color: ${theme.colour.icon.disabled};
79
85
  border-color: ${theme.colour.icon.disabled};
80
86
  cursor: not-allowed;
@@ -87,7 +93,8 @@ const Radio = forwardRef<Ref, RadioProps>(
87
93
  !disabled && focusStyle,
88
94
  isChecked && checkedStyle,
89
95
  !isChecked && uncheckedStyle,
90
- disabled && disabledStyle,
96
+ disabled && !isChecked && disabledUncheckedStyle,
97
+ disabled && isChecked && disabledCheckedStyle,
91
98
  className
92
99
  );
93
100
 
@@ -112,7 +119,9 @@ const Radio = forwardRef<Ref, RadioProps>(
112
119
  width: 12px;
113
120
  height: 12px;
114
121
  border-radius: 50%;
115
- background-color: ${theme.colour.icon.inverse};
122
+ background-color: ${
123
+ disabled ? theme.colour.icon.brandInverse : theme.colour.icon.inverse
124
+ };
116
125
  user-select: none;
117
126
  pointer-events: none;
118
127
  `;
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Radio > snapshot: checked prop 1`] = `
4
4
  <span
5
- class="ucl-uikit-radio css-1y63xt7"
5
+ class="ucl-uikit-radio css-1elh2am"
6
6
  >
7
7
  <input
8
8
  checked=""
@@ -18,7 +18,7 @@ exports[`Radio > snapshot: checked prop 1`] = `
18
18
 
19
19
  exports[`Radio > snapshot: no props 1`] = `
20
20
  <span
21
- class="ucl-uikit-radio css-121ivaw"
21
+ class="ucl-uikit-radio css-auet16"
22
22
  >
23
23
  <input
24
24
  class="css-19qtec1"
@@ -30,7 +30,7 @@ exports[`Radio > snapshot: no props 1`] = `
30
30
 
31
31
  exports[`Radio > snapshot: testId prop 1`] = `
32
32
  <span
33
- class="ucl-uikit-radio css-121ivaw"
33
+ class="ucl-uikit-radio css-auet16"
34
34
  >
35
35
  <input
36
36
  class="css-19qtec1"
@@ -119,7 +119,7 @@ const Search = ({
119
119
  `;
120
120
 
121
121
  const cancelIconButtonInactiveStyle = css`
122
- color: ${theme.color.neutral.grey20};
122
+ color: ${theme.colour.icon.disabled};
123
123
  `;
124
124
 
125
125
  const cancelButtonStyle = cx(
@@ -130,7 +130,7 @@ const Search = ({
130
130
  const dividerStyle = css`
131
131
  width: 1px;
132
132
  height: 38px;
133
- background-color: ${theme.color.neutral.grey20};
133
+ background-color: ${theme.colour.border.disabled};
134
134
  `;
135
135
 
136
136
  const submitButtonStyle = css`
@@ -8,7 +8,7 @@ exports[`Search > snapshot: no props 1`] = `
8
8
  class="ucl-uikit-input css-1bpb1dw"
9
9
  >
10
10
  <input
11
- class="ucl-uikit-input__input css-181a0dk"
11
+ class="ucl-uikit-input__input css-1g04erc"
12
12
  data-testid="ucl-uikit-search"
13
13
  id=""
14
14
  placeholder=""
@@ -87,7 +87,7 @@ exports[`Search > snapshot: testId prop 1`] = `
87
87
  class="ucl-uikit-input css-1bpb1dw"
88
88
  >
89
89
  <input
90
- class="ucl-uikit-input__input css-181a0dk"
90
+ class="ucl-uikit-input__input css-1g04erc"
91
91
  data-testid="test123"
92
92
  id=""
93
93
  placeholder=""
@@ -588,18 +588,18 @@ const CustomSelect = <T extends string | number>({
588
588
  `;
589
589
 
590
590
  const disabledStyle = css`
591
- color: ${theme.color.text.disabled};
592
- border: ${theme.border.b1} solid ${theme.color.neutral.grey20};
591
+ color: ${theme.colour.text.disabled};
592
+ border: ${theme.border.b1} solid ${theme.colour.border.disabled};
593
593
  cursor: not-allowed;
594
594
 
595
595
  &:hover {
596
- background-color: ${theme.color.neutral.white};
596
+ background-color: ${theme.colour.fill.inverse};
597
597
  }
598
598
  `;
599
599
 
600
600
  const noOptionsStyle = css`
601
601
  padding: ${theme.padding.p8} ${theme.padding.p16};
602
- color: ${theme.color.text.secondary};
602
+ color: ${theme.colour.text.secondary};
603
603
  `;
604
604
 
605
605
  // Visually hidden but available to assistive technology
@@ -25,7 +25,7 @@ export const White: Story = {
25
25
  },
26
26
  args: {
27
27
  className: css`
28
- color: ${theme.color.neutral.white};
28
+ color: ${theme.colour.fill.inverse};
29
29
  `,
30
30
  },
31
31
  };
@@ -33,7 +33,7 @@ export const White: Story = {
33
33
  export const Blue: Story = {
34
34
  args: {
35
35
  className: css`
36
- color: ${theme.color.system.blue70};
36
+ color: ${theme.colour.fill.brand};
37
37
  `,
38
38
  },
39
39
  };
@@ -41,7 +41,7 @@ export const Blue: Story = {
41
41
  export const Red: Story = {
42
42
  args: {
43
43
  className: css`
44
- color: ${theme.color.system.red70};
44
+ color: ${theme.colour.fill.critical};
45
45
  `,
46
46
  },
47
47
  };
@@ -27,7 +27,7 @@ const Spinner = ({
27
27
  const dashDuration = `2s`; // dash duration
28
28
 
29
29
  const baseStyle = css`
30
- color: ${inheritColour ? 'inherit' : theme.colour.icon.brand};
30
+ color: ${inheritColour ? 'inherit' : theme.colour.fill.brand};
31
31
  `;
32
32
 
33
33
  const gStyle = css`
@@ -6,11 +6,11 @@ exports[`Table > Snapshot: basic table 1`] = `
6
6
  data-testid="ucl-uikit-table"
7
7
  >
8
8
  <thead
9
- class="css-1ux39q6 ucl-uikit-table__head"
9
+ class="css-b9vb4h ucl-uikit-table__head"
10
10
  data-testid="ucl-uikit-table__head"
11
11
  >
12
12
  <tr
13
- class="css-1pr7kjy"
13
+ class="css-7kbd2r"
14
14
  >
15
15
  <th
16
16
  class="css-x1n4gt ucl-uikit-table__head-cell"
@@ -173,7 +173,7 @@ exports[`Table > Snapshot: basic table 1`] = `
173
173
  >
174
174
  <tr
175
175
  aria-selected="false"
176
- class="css-icxsp9 ucl-uikit-table__row"
176
+ class="css-h7fw6w ucl-uikit-table__row"
177
177
  data-mobile-expanded="true"
178
178
  data-testid="ucl-uikit-table__row"
179
179
  >
@@ -10,7 +10,7 @@ const Head = ({ className, children, ...props }: TableHeadProps) => {
10
10
 
11
11
  const baseStyle = css`
12
12
  height: 40px;
13
- background-color: #f8f8f8; // TODO: Add a design token
13
+ background-color: ${theme.colour.surface.secondary};
14
14
 
15
15
  @media screen and (max-width: ${theme.breakpoints.tablet - 1}px) {
16
16
  position: absolute;
@@ -26,7 +26,7 @@ const Head = ({ className, children, ...props }: TableHeadProps) => {
26
26
  `;
27
27
 
28
28
  const rowStyle = css`
29
- border-bottom: 1px solid ${theme.colour.border.default};
29
+ border-bottom: 1px solid ${theme.colour.border.disabled};
30
30
  `;
31
31
 
32
32
  const style = cx(baseStyle, className, NAME);
@@ -87,7 +87,7 @@ const Row = ({
87
87
 
88
88
  const baseStyle = css`
89
89
  height: 40px;
90
- border-bottom: 1px solid ${theme.colour.border.default};
90
+ border-bottom: 1px solid ${theme.colour.border.disabled};
91
91
 
92
92
  &:hover {
93
93
  background-color: ${theme.colour.surface.secondary};