uikit-react-public 0.17.4 → 0.21.9
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/README.md +2 -4
- package/dist/components/Accordion/Accordion.Heading.d.ts +1 -0
- package/dist/components/AppHeader/AppHeader.d.ts +1 -1
- package/dist/components/AppHeader/AppHeaderBottom.d.ts +1 -1
- package/dist/components/AppHeader/AppHeaderNav.d.ts +1 -1
- package/dist/components/AppHeader/AppHeaderTop.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumb.d.ts +3 -4
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +7 -3
- package/dist/components/Button/Button.stories.d.ts +17 -7
- package/dist/components/Button/style/buttonAccentStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonPrimaryDestructiveStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonPrimaryStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonPrimarySubtleStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonPrimaryWarningStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonSecondaryDestructiveStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonSecondaryStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonSecondarySubtleStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonTertiaryDestructiveStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonTertiaryNoPaddingStyle.d.ts +4 -0
- package/dist/components/Button/style/buttonTertiaryStyle.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/FooterNew/BackToTop.d.ts +8 -0
- package/dist/components/FooterNew/Footer.d.ts +23 -0
- package/dist/components/FooterNew/FooterColumn.d.ts +8 -0
- package/dist/components/FooterNew/FooterLinks.d.ts +7 -0
- package/dist/components/FooterNew/FooterNavLink.d.ts +8 -0
- package/dist/components/FooterNew/LegalAndCopyright.d.ts +14 -0
- package/dist/components/FooterNew/LogoAddressAndSocial.d.ts +10 -0
- package/dist/components/FooterNew/SocialLink.d.ts +8 -0
- package/dist/components/FooterNew/__tests__/Footer.test.d.ts +1 -0
- package/dist/components/FooterNew/index.d.ts +2 -0
- package/dist/components/HeaderNew/Header.d.ts +18 -0
- package/dist/components/HeaderNew/HeaderBorder.d.ts +7 -0
- package/dist/components/HeaderNew/HeaderLogo.d.ts +9 -0
- package/dist/components/HeaderNew/HeaderMenuContainer.d.ts +7 -0
- package/dist/components/HeaderNew/HeaderTitle.d.ts +9 -0
- package/dist/components/HeaderNew/__tests__/Header.test.d.ts +1 -0
- package/dist/components/HeaderNew/constants.d.ts +3 -0
- package/dist/components/HeaderNew/index.d.ts +3 -0
- package/dist/components/Heading/Heading.d.ts +6 -4
- package/dist/components/Heading/Heading.stories.d.ts +8 -6
- package/dist/components/Icon/svgImports.d.ts +7 -881
- package/dist/components/Link/BaseLink.d.ts +14 -5
- package/dist/components/Link/Link.d.ts +8 -3
- package/dist/components/Link/Link.stories.d.ts +3 -1
- package/dist/components/MenuNew/Menu.context.d.ts +14 -0
- package/dist/components/MenuNew/Menu.d.ts +20 -0
- package/dist/components/MenuNew/MenuContent.d.ts +9 -0
- package/dist/components/MenuNew/MenuItem.d.ts +10 -0
- package/dist/components/MenuNew/MenuSection.d.ts +7 -0
- package/dist/components/MenuNew/index.d.ts +6 -0
- package/dist/components/MenuNew/trigger/ButtonMenuTrigger.d.ts +8 -0
- package/dist/components/MenuNew/trigger/IconMenuTrigger.d.ts +8 -0
- package/dist/components/Overlay/Overlay.stories.d.ts +12 -12
- package/dist/components/Paragraph/Paragraph.d.ts +5 -2
- package/dist/components/Paragraph/Paragraph.stories.d.ts +6 -3
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.stories.d.ts +13 -1
- package/dist/components/Select/Select.types.d.ts +40 -13
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -3
- package/dist/components/Select/subcomponents/FilterInput.d.ts +3 -1
- package/dist/components/Select/subcomponents/NativeSelect.d.ts +2 -2
- package/dist/components/Select/subcomponents/VisibleField.d.ts +4 -1
- package/dist/components/Spinner/Spinner.d.ts +2 -0
- package/dist/components/StandaloneLink/StandaloneLink.d.ts +8 -5
- package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +3 -1
- package/dist/components/Table/Table.d.ts +3 -3
- package/dist/components/Table/Table.stories.d.ts +3 -3
- package/dist/components/Table/Table.types.d.ts +1 -0
- package/dist/components/Table/subcomponents/Cell/Cell.d.ts +5 -1
- package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +15 -13
- package/dist/components/Table/subcomponents/Cell/CellContent.d.ts +5 -1
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.d.ts +2 -1
- package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +14 -13
- package/dist/components/Table/subcomponents/HeadCell/HeadCellContent.d.ts +2 -1
- package/dist/components/Table/subcomponents/__tests__/Row.test.d.ts +1 -0
- package/dist/components/UclLogoNew/UclLogo.d.ts +8 -0
- package/dist/components/UclLogoNew/index.d.ts +2 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/index.js +20104 -15317
- package/dist/theme/__tests__/fonts.test.d.ts +1 -0
- package/dist/theme/common/themeCommon.d.ts +904 -0
- package/dist/theme/fonts.d.ts +18 -0
- package/dist/theme/index.d.ts +6 -3
- package/dist/theme/light/lightColour.d.ts +126 -0
- package/dist/theme/light/lightTheme.d.ts +3 -0
- package/dist/theme/original/color.d.ts +166 -0
- package/dist/theme/original/defaultTheme.d.ts +1340 -0
- package/dist/theme/original/originalColourNewStructure.d.ts +126 -0
- package/dist/theme/useTheme.d.ts +2174 -0
- package/dist/utils/addAlphaToHex.d.ts +5 -0
- package/dist/utils/scrollToTop.d.ts +2 -0
- package/lib/components/Accordion/Accordion.Heading.tsx +51 -39
- package/lib/components/Accordion/Accordion.Panel.tsx +0 -4
- package/lib/components/Accordion/Accordion.tsx +34 -28
- package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +12 -10
- package/lib/components/Alert/Alert.tsx +12 -12
- package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +13 -39
- package/lib/components/AppHeader/AppHeader.tsx +6 -11
- package/lib/components/AppHeader/AppHeaderBottom.tsx +2 -3
- package/lib/components/AppHeader/AppHeaderNav.tsx +2 -3
- package/lib/components/AppHeader/AppHeaderTop.tsx +1 -1
- package/lib/components/AppHeader/__tests__/__snapshots__/AppHeader.test.tsx.snap +2 -2
- package/lib/components/AppMenu/__tests__/__snapshots__/AppMenu.test.tsx.snap +6 -19
- package/lib/components/Badge/Badge.stories.tsx +1 -1
- package/lib/components/Breadcrumbs/Breadcrumb.tsx +26 -12
- package/lib/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/lib/components/Breadcrumbs/__tests__/Breadcrumbs.test.tsx +9 -27
- package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +24 -20
- package/lib/components/Button/Button.mdx +32 -279
- package/lib/components/Button/Button.stories.tsx +43 -50
- package/lib/components/Button/Button.tsx +165 -25
- package/lib/components/Button/__tests__/Button.test.tsx +49 -15
- package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +80 -73
- package/lib/components/Button/style/buttonAccentStyle.ts +53 -0
- package/lib/components/Button/style/buttonPrimaryDestructiveStyle.ts +55 -0
- package/lib/components/Button/style/buttonPrimaryStyle.ts +53 -0
- package/lib/components/Button/style/buttonPrimarySubtleStyle.ts +64 -0
- package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +56 -0
- package/lib/components/Button/style/buttonSecondaryDestructiveStyle.ts +63 -0
- package/lib/components/Button/style/buttonSecondaryStyle.ts +62 -0
- package/lib/components/Button/style/buttonSecondarySubtleStyle.ts +72 -0
- package/lib/components/Button/style/buttonTertiaryDestructiveStyle.ts +65 -0
- package/lib/components/Button/style/buttonTertiaryNoPaddingStyle.ts +52 -0
- package/lib/components/Button/style/buttonTertiaryStyle.ts +62 -0
- package/lib/components/Calendar/Calendar.stories.tsx +33 -13
- package/lib/components/Calendar/Calendar.tsx +2 -2
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +99 -95
- package/lib/components/Calendar/subcomponents/AcademicWeek.tsx +2 -1
- package/lib/components/Calendar/subcomponents/AcademicWeeks.tsx +2 -3
- package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +3 -7
- package/lib/components/Calendar/subcomponents/Controls.tsx +1 -1
- package/lib/components/Calendar/subcomponents/Day.stories.tsx +1 -1
- package/lib/components/Calendar/subcomponents/Day.tsx +7 -9
- package/lib/components/Calendar/subcomponents/EventDot.tsx +4 -8
- package/lib/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/lib/components/Checkbox/Checkbox.tsx +12 -10
- package/lib/components/Checkbox/__tests__/Checkbox.test.tsx +29 -0
- package/lib/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +4 -4
- package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +117 -0
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +16 -44
- package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +10 -1
- package/lib/components/Datepicker/subcomponents/VisibleField.tsx +24 -23
- package/lib/components/Dialog/BaseDialog.tsx +2 -2
- package/lib/components/Dialog/Dialog.stories.tsx +1 -1
- package/lib/components/Divider/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +12 -12
- package/lib/components/FeedbackDialog/FeedbackDialog.stories.tsx +1 -1
- package/lib/components/FeedbackDialog/FeedbackDialog.tsx +4 -6
- package/lib/components/Field/CharacterCount.tsx +2 -2
- package/lib/components/Field/ErrorText.tsx +1 -1
- package/lib/components/Field/Field.tsx +1 -1
- package/lib/components/Field/HelperText.tsx +3 -1
- package/lib/components/FileInput/FileInput.stories.tsx +1 -1
- package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +4 -20
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +70 -79
- package/lib/components/FooterNew/BackToTop.tsx +83 -0
- package/lib/components/FooterNew/Footer.tsx +110 -0
- package/lib/components/FooterNew/FooterColumn.tsx +79 -0
- package/lib/components/FooterNew/FooterLinks.tsx +44 -0
- package/lib/components/FooterNew/FooterNavLink.tsx +63 -0
- package/lib/components/FooterNew/LegalAndCopyright.tsx +150 -0
- package/lib/components/FooterNew/LogoAddressAndSocial.tsx +154 -0
- package/lib/components/FooterNew/SocialLink.tsx +108 -0
- package/lib/components/FooterNew/__tests__/Footer.test.tsx +51 -0
- package/lib/components/FooterNew/__tests__/__snapshots__/Footer.test.tsx.snap +1107 -0
- package/lib/components/FooterNew/index.ts +2 -0
- package/lib/components/HeaderDraft/__tests__/__snapshots__/Header.test.tsx.snap +3 -2
- package/lib/components/HeaderNew/Header.tsx +93 -0
- package/lib/components/HeaderNew/HeaderBorder.tsx +55 -0
- package/lib/components/HeaderNew/HeaderLogo.tsx +70 -0
- package/lib/components/HeaderNew/HeaderMenuContainer.tsx +35 -0
- package/lib/components/HeaderNew/HeaderTitle.tsx +53 -0
- package/lib/components/HeaderNew/__tests__/Header.test.tsx +42 -0
- package/lib/components/HeaderNew/__tests__/__snapshots__/Header.test.tsx.snap +79 -0
- package/lib/components/HeaderNew/constants.ts +3 -0
- package/lib/components/HeaderNew/index.ts +7 -0
- package/lib/components/Heading/Heading.stories.tsx +34 -41
- package/lib/components/Heading/Heading.tsx +180 -49
- package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +4 -4
- package/lib/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap +16 -12
- package/lib/components/Icon/svgImports.ts +318 -296
- package/lib/components/IconButton/IconButton.tsx +3 -4
- package/lib/components/IconButton/__tests__/__snapshots__/IconButton.test.tsx.snap +12 -9
- package/lib/components/Link/BaseLink.tsx +114 -71
- package/lib/components/Link/Link.stories.tsx +1 -1
- package/lib/components/Link/Link.tsx +120 -109
- package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +2 -2
- package/lib/components/MenuNew/Menu.context.tsx +149 -0
- package/lib/components/MenuNew/Menu.tsx +75 -0
- package/lib/components/MenuNew/MenuContent.tsx +140 -0
- package/lib/components/MenuNew/MenuItem.tsx +101 -0
- package/lib/components/MenuNew/MenuSection.tsx +47 -0
- package/lib/components/MenuNew/index.ts +8 -0
- package/lib/components/MenuNew/trigger/ButtonMenuTrigger.tsx +42 -0
- package/lib/components/MenuNew/trigger/IconMenuTrigger.tsx +40 -0
- package/lib/components/Pagination/Pagination.stories.tsx +1 -1
- package/lib/components/Pagination/PaginationControls.tsx +4 -5
- package/lib/components/Pagination/PaginationInfo.tsx +2 -3
- package/lib/components/Paragraph/Paragraph.stories.tsx +29 -27
- package/lib/components/Paragraph/Paragraph.tsx +212 -81
- package/lib/components/Paragraph/__tests__/__snapshots__/Paragraph.test.tsx.snap +5 -5
- package/lib/components/Radio/Radio.stories.tsx +1 -1
- package/lib/components/Radio/Radio.tsx +8 -8
- package/lib/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +4 -4
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +12 -32
- package/lib/components/Select/Select.mdx +23 -0
- package/lib/components/Select/Select.stories.tsx +43 -10
- package/lib/components/Select/Select.tsx +14 -3
- package/lib/components/Select/Select.types.ts +53 -16
- package/lib/components/Select/__tests__/Select.test.tsx +250 -1
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +5 -4
- package/lib/components/Select/subcomponents/CustomOption.tsx +10 -3
- package/lib/components/Select/subcomponents/CustomSelect.tsx +110 -10
- package/lib/components/Select/subcomponents/FilterInput.tsx +13 -3
- package/lib/components/Select/subcomponents/NativeSelect.tsx +10 -18
- package/lib/components/Select/subcomponents/Panel.tsx +2 -2
- package/lib/components/Select/subcomponents/VisibleField.tsx +48 -3
- package/lib/components/Snackbar/__tests__/__snapshots__/Snackbar.test.tsx.snap +9 -15
- package/lib/components/Spinner/Spinner.tsx +24 -5
- package/lib/components/Spinner/__tests__/Spinner.test.tsx +35 -5
- package/lib/components/Spinner/__tests__/__snapshots__/Spinner.test.tsx.snap +40 -16
- package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +1 -1
- package/lib/components/StandaloneLink/StandaloneLink.tsx +180 -163
- package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +2 -2
- package/lib/components/Table/Table.stories.tsx +1 -1
- package/lib/components/Table/Table.tsx +2 -0
- package/lib/components/Table/Table.types.ts +1 -0
- package/lib/components/Table/__tests__/Table.test.tsx +19 -0
- package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +7 -3
- package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +1 -1
- package/lib/components/Table/subcomponents/Cell/Cell.tsx +23 -2
- package/lib/components/Table/subcomponents/Cell/CellContent.tsx +12 -1
- package/lib/components/Table/subcomponents/Cell/__tests__/Cell.test.tsx +106 -0
- package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +4 -3
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +1 -1
- package/lib/components/Table/subcomponents/HeadCell/HeadCell.tsx +28 -6
- package/lib/components/Table/subcomponents/HeadCell/HeadCellContent.tsx +3 -0
- package/lib/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.tsx +221 -2
- package/lib/components/Table/subcomponents/HeadCell/__tests__/__snapshots__/HeadCell.test.tsx.snap +6 -4
- package/lib/components/Table/subcomponents/Row.tsx +2 -2
- package/lib/components/Table/subcomponents/SortIcon.tsx +1 -0
- package/lib/components/Table/subcomponents/__tests__/Row.test.tsx +59 -0
- package/lib/components/Tabs/Tab.tsx +3 -3
- package/lib/components/Tabs/Tabs.stories.tsx +1 -1
- package/lib/components/Tabs/Tabs.tsx +5 -3
- package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +4 -4
- package/lib/components/Timepicker/Timepicker.stories.tsx +1 -1
- package/lib/components/Toggle/Toggle.tsx +5 -5
- package/lib/components/Toggle/ToggleHandle.tsx +2 -3
- package/lib/components/Tooltip/Tooltip.tsx +2 -2
- package/lib/components/Tooltip/__tests__/__snapshots__/tooltip.test.tsx.snap +2 -2
- package/lib/components/UclLogoNew/UclLogo.tsx +42 -0
- package/lib/components/UclLogoNew/index.ts +2 -0
- package/lib/components/WeekPicker/WeekPicker.stories.tsx +3 -5
- package/lib/components/common/Common.mdx +0 -1
- package/lib/components/index.ts +19 -1
- package/lib/theme/Colours.mdx +1 -1
- package/lib/theme/Theme.mdx +1 -1
- package/lib/theme/Typography.mdx +1 -1
- package/lib/theme/__tests__/fonts.test.ts +37 -0
- package/lib/theme/common/themeCommon.ts +515 -0
- package/lib/theme/fonts.ts +110 -0
- package/lib/theme/index.ts +6 -6
- package/lib/theme/light/lightColour.ts +232 -0
- package/lib/theme/light/lightTheme.ts +37 -0
- package/lib/theme/{defaultTheme.ts → original/color.ts} +17 -199
- package/lib/theme/original/defaultTheme.ts +207 -0
- package/lib/theme/original/originalColourNewStructure.ts +185 -0
- package/lib/theme/useTheme.tsx +72 -15
- package/lib/types/assets.d.ts +10 -0
- package/lib/utils/addAlphaToHex.ts +29 -0
- package/lib/utils/scrollToTop.ts +5 -0
- package/package.json +11 -6
- package/dist/components/Button/buttonPrimaryStyle.d.ts +0 -4
- package/dist/components/Button/buttonSecondaryStyle.d.ts +0 -4
- package/dist/components/Button/buttonTertiaryStyle.d.ts +0 -4
- package/dist/theme/defaultTheme.d.ts +0 -274
- package/lib/components/Button/buttonPrimaryStyle.ts +0 -62
- package/lib/components/Button/buttonSecondaryStyle.ts +0 -65
- package/lib/components/Button/buttonTertiaryStyle.ts +0 -54
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`SpinnerSvg > Snapshot: custom className 1`] = `
|
|
4
4
|
<svg
|
|
5
|
-
class="ucl-uikit-spinner css-
|
|
5
|
+
class="ucl-uikit-spinner css-g7tq6j"
|
|
6
6
|
data-testid="ucl-uikit-spinner"
|
|
7
|
-
height="
|
|
7
|
+
height="72"
|
|
8
8
|
viewBox="0 0 50 50"
|
|
9
|
-
width="
|
|
9
|
+
width="72"
|
|
10
10
|
>
|
|
11
11
|
<g
|
|
12
|
-
class="css-
|
|
12
|
+
class="css-ypv7tf"
|
|
13
13
|
>
|
|
14
14
|
<circle
|
|
15
|
-
class="css-
|
|
15
|
+
class="css-1w5ipzg"
|
|
16
16
|
cx="25"
|
|
17
17
|
cy="25"
|
|
18
18
|
fill="none"
|
|
19
19
|
r="20"
|
|
20
20
|
stroke="currentColor"
|
|
21
|
-
stroke-width="
|
|
21
|
+
stroke-width="4"
|
|
22
22
|
/>
|
|
23
23
|
</g>
|
|
24
24
|
</svg>
|
|
@@ -26,23 +26,23 @@ exports[`SpinnerSvg > Snapshot: custom className 1`] = `
|
|
|
26
26
|
|
|
27
27
|
exports[`SpinnerSvg > snapshot: custom size 1`] = `
|
|
28
28
|
<svg
|
|
29
|
-
class="ucl-uikit-spinner"
|
|
29
|
+
class="ucl-uikit-spinner css-1g359sh"
|
|
30
30
|
data-testid="ucl-uikit-spinner"
|
|
31
31
|
height="32"
|
|
32
32
|
viewBox="0 0 50 50"
|
|
33
33
|
width="32"
|
|
34
34
|
>
|
|
35
35
|
<g
|
|
36
|
-
class="css-
|
|
36
|
+
class="css-ypv7tf"
|
|
37
37
|
>
|
|
38
38
|
<circle
|
|
39
|
-
class="css-
|
|
39
|
+
class="css-1w5ipzg"
|
|
40
40
|
cx="25"
|
|
41
41
|
cy="25"
|
|
42
42
|
fill="none"
|
|
43
43
|
r="20"
|
|
44
44
|
stroke="currentColor"
|
|
45
|
-
stroke-width="
|
|
45
|
+
stroke-width="4"
|
|
46
46
|
/>
|
|
47
47
|
</g>
|
|
48
48
|
</svg>
|
|
@@ -50,23 +50,47 @@ exports[`SpinnerSvg > snapshot: custom size 1`] = `
|
|
|
50
50
|
|
|
51
51
|
exports[`SpinnerSvg > snapshot: default props 1`] = `
|
|
52
52
|
<svg
|
|
53
|
-
class="ucl-uikit-spinner"
|
|
53
|
+
class="ucl-uikit-spinner css-1g359sh"
|
|
54
54
|
data-testid="ucl-uikit-spinner"
|
|
55
|
-
height="
|
|
55
|
+
height="72"
|
|
56
56
|
viewBox="0 0 50 50"
|
|
57
|
-
width="
|
|
57
|
+
width="72"
|
|
58
58
|
>
|
|
59
59
|
<g
|
|
60
|
-
class="css-
|
|
60
|
+
class="css-ypv7tf"
|
|
61
61
|
>
|
|
62
62
|
<circle
|
|
63
|
-
class="css-
|
|
63
|
+
class="css-1w5ipzg"
|
|
64
64
|
cx="25"
|
|
65
65
|
cy="25"
|
|
66
66
|
fill="none"
|
|
67
67
|
r="20"
|
|
68
68
|
stroke="currentColor"
|
|
69
|
-
stroke-width="
|
|
69
|
+
stroke-width="4"
|
|
70
|
+
/>
|
|
71
|
+
</g>
|
|
72
|
+
</svg>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`SpinnerSvg > snapshot: inherits parent colour when inheritColour is true 1`] = `
|
|
76
|
+
<svg
|
|
77
|
+
class="ucl-uikit-spinner css-1izyex6"
|
|
78
|
+
data-testid="ucl-uikit-spinner"
|
|
79
|
+
height="72"
|
|
80
|
+
viewBox="0 0 50 50"
|
|
81
|
+
width="72"
|
|
82
|
+
>
|
|
83
|
+
<g
|
|
84
|
+
class="css-ypv7tf"
|
|
85
|
+
>
|
|
86
|
+
<circle
|
|
87
|
+
class="css-1w5ipzg"
|
|
88
|
+
cx="25"
|
|
89
|
+
cy="25"
|
|
90
|
+
fill="none"
|
|
91
|
+
r="20"
|
|
92
|
+
stroke="currentColor"
|
|
93
|
+
stroke-width="4"
|
|
70
94
|
/>
|
|
71
95
|
</g>
|
|
72
96
|
</svg>
|
|
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
3
3
|
import Link from './StandaloneLink';
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
|
-
title: 'Components/
|
|
6
|
+
title: 'Components/StandaloneLink',
|
|
7
7
|
component: Link,
|
|
8
8
|
args: {
|
|
9
9
|
children: 'Default link text',
|
|
@@ -1,183 +1,200 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {
|
|
2
|
+
cloneElement,
|
|
3
|
+
ComponentPropsWithoutRef,
|
|
4
|
+
ElementType,
|
|
5
|
+
forwardRef,
|
|
6
|
+
ReactElement,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import { css, cx } from '@emotion/css';
|
|
3
9
|
import useTheme from '../../theme/useTheme';
|
|
4
10
|
import { IconProps } from '../Icon';
|
|
5
11
|
import BaseLink, { BaseLinkProps } from '../Link/BaseLink';
|
|
6
12
|
import marginsStyle, { MarginProps } from '../common/marginsStyle';
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
type StandaloneLinkOwnProps = {
|
|
9
15
|
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
10
16
|
icon?: ReactElement<IconProps>;
|
|
11
17
|
iconPosition?: 'left' | 'right';
|
|
12
|
-
}
|
|
18
|
+
};
|
|
13
19
|
|
|
14
|
-
export type StandaloneLinkProps =
|
|
20
|
+
export type StandaloneLinkProps<C extends ElementType = 'a'> =
|
|
21
|
+
StandaloneLinkOwnProps &
|
|
22
|
+
BaseLinkProps<C> &
|
|
23
|
+
MarginProps &
|
|
24
|
+
Omit<ComponentPropsWithoutRef<C>, keyof StandaloneLinkOwnProps>;
|
|
15
25
|
|
|
16
26
|
const NAME = 'ucl-uikit-standalone-link';
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const secondaryNoVisitedStyle = css`
|
|
74
|
-
&:visited {
|
|
75
|
-
color: ${theme.color.link.default};
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
const tertiaryNoVisitedStyle = css`
|
|
80
|
-
&:visited {
|
|
81
|
-
color: ${theme.color.text.primary};
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const primaryHoverAndActiveStyle = css`
|
|
86
|
-
&:hover {
|
|
87
|
-
color: ${theme.color.link.hover};
|
|
88
|
-
text-decoration: underline;
|
|
89
|
-
text-decoration-skip-ink: none;
|
|
90
|
-
text-decoration-thickness: 10%;
|
|
91
|
-
text-underline-offset: 25%;
|
|
92
|
-
text-underline-position: from-font;
|
|
93
|
-
}
|
|
94
|
-
&:active {
|
|
95
|
-
color: ${theme.color.link.hover};
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
const secondaryHoverAndActiveStyle = css`
|
|
100
|
-
&:hover {
|
|
101
|
-
color: ${theme.color.link.hover};
|
|
102
|
-
text-decoration: underline;
|
|
103
|
-
text-decoration-skip-ink: none;
|
|
104
|
-
text-decoration-thickness: 10%;
|
|
105
|
-
text-underline-offset: 25%;
|
|
106
|
-
text-underline-position: from-font;
|
|
107
|
-
}
|
|
108
|
-
&:active {
|
|
109
|
-
color: ${theme.color.link.hover};
|
|
110
|
-
}
|
|
111
|
-
`;
|
|
112
|
-
|
|
113
|
-
const tertiaryHoverAndActiveStyle = css`
|
|
114
|
-
&:hover {
|
|
115
|
-
text-decoration: underline;
|
|
116
|
-
text-decoration-skip-ink: none;
|
|
117
|
-
text-decoration-thickness: 10%;
|
|
118
|
-
text-underline-offset: 25%;
|
|
119
|
-
text-underline-position: from-font;
|
|
120
|
-
}
|
|
121
|
-
&:hover {
|
|
122
|
-
color: ${theme.color.text.primary};
|
|
123
|
-
}
|
|
124
|
-
`;
|
|
125
|
-
|
|
126
|
-
let variantStyle = undefined;
|
|
127
|
-
if (variant === 'primary') {
|
|
128
|
-
variantStyle = cx(
|
|
129
|
-
primaryStyle,
|
|
130
|
-
noVisited && !disabled && primaryNoVisitedStyle,
|
|
131
|
-
!disabled && primaryHoverAndActiveStyle,
|
|
132
|
-
!noVisited && !disabled && visitedStyle
|
|
133
|
-
);
|
|
134
|
-
} else if (variant === 'secondary') {
|
|
135
|
-
variantStyle = cx(
|
|
136
|
-
secondaryStyle,
|
|
137
|
-
noVisited && !disabled && secondaryNoVisitedStyle,
|
|
138
|
-
!disabled && secondaryHoverAndActiveStyle,
|
|
139
|
-
!noVisited && !disabled && visitedStyle
|
|
140
|
-
);
|
|
141
|
-
} else if (variant === 'tertiary') {
|
|
142
|
-
variantStyle = cx(
|
|
143
|
-
tertiaryStyle,
|
|
144
|
-
!disabled && tertiaryNoVisitedStyle,
|
|
145
|
-
!disabled && tertiaryHoverAndActiveStyle
|
|
146
|
-
);
|
|
28
|
+
type StandaloneLinkComponent = <C extends ElementType = 'a'>(
|
|
29
|
+
props: StandaloneLinkProps<C> & {
|
|
30
|
+
ref?: React.ComponentPropsWithRef<C>['ref'];
|
|
31
|
+
}
|
|
32
|
+
) => React.JSX.Element;
|
|
33
|
+
|
|
34
|
+
const StandaloneLink = forwardRef(function StandaloneLinkInner(
|
|
35
|
+
{
|
|
36
|
+
variant = 'primary',
|
|
37
|
+
icon,
|
|
38
|
+
iconPosition = 'left',
|
|
39
|
+
noVisited = false,
|
|
40
|
+
disabled = false,
|
|
41
|
+
testId = NAME,
|
|
42
|
+
className,
|
|
43
|
+
children,
|
|
44
|
+
...props
|
|
45
|
+
}: StandaloneLinkProps<ElementType>,
|
|
46
|
+
ref: React.Ref<Element>
|
|
47
|
+
) {
|
|
48
|
+
const iconSize: number = {
|
|
49
|
+
primary: 24,
|
|
50
|
+
secondary: 16,
|
|
51
|
+
tertiary: 16,
|
|
52
|
+
}[variant];
|
|
53
|
+
|
|
54
|
+
const [theme] = useTheme();
|
|
55
|
+
|
|
56
|
+
const baseStyle = css`
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 8px;
|
|
60
|
+
text-decoration: none;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
// todo: primary -> accent
|
|
64
|
+
const primaryStyle = css`
|
|
65
|
+
color: ${theme.colour.link.brand};
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
// todo: secondary -> primary
|
|
70
|
+
const secondaryStyle = css`
|
|
71
|
+
color: ${theme.colour.link.primary};
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
// todo: tertiary -> secondary
|
|
75
|
+
const tertiaryStyle = css`
|
|
76
|
+
color: ${theme.colour.link.primary};
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
const visitedStyle = css`
|
|
80
|
+
&:visited {
|
|
81
|
+
color: ${theme.colour.link.visited};
|
|
147
82
|
}
|
|
83
|
+
`;
|
|
148
84
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
color: ${theme.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
className
|
|
161
|
-
);
|
|
85
|
+
const primaryNoVisitedStyle = css`
|
|
86
|
+
&:visited {
|
|
87
|
+
color: ${theme.colour.link.brand};
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const secondaryNoVisitedStyle = css`
|
|
92
|
+
&:visited {
|
|
93
|
+
color: ${theme.colour.link.primary};
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
162
96
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
97
|
+
const tertiaryNoVisitedStyle = css`
|
|
98
|
+
&:visited {
|
|
99
|
+
color: ${theme.colour.link.primary};
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
const primaryHoverAndActiveStyle = css`
|
|
104
|
+
&:hover {
|
|
105
|
+
color: ${theme.colour.link.brandHover};
|
|
106
|
+
text-decoration: underline;
|
|
107
|
+
text-decoration-skip-ink: none;
|
|
108
|
+
text-decoration-thickness: 10%;
|
|
109
|
+
text-underline-offset: 25%;
|
|
110
|
+
text-underline-position: from-font;
|
|
111
|
+
}
|
|
112
|
+
&:active {
|
|
113
|
+
color: ${theme.colour.link.brandHover};
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
const secondaryHoverAndActiveStyle = css`
|
|
118
|
+
&:hover {
|
|
119
|
+
color: ${theme.colour.link.primaryHover};
|
|
120
|
+
text-decoration: underline;
|
|
121
|
+
text-decoration-skip-ink: none;
|
|
122
|
+
text-decoration-thickness: 10%;
|
|
123
|
+
text-underline-offset: 25%;
|
|
124
|
+
text-underline-position: from-font;
|
|
125
|
+
}
|
|
126
|
+
&:active {
|
|
127
|
+
color: ${theme.colour.link.primaryHover};
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
const tertiaryHoverAndActiveStyle = css`
|
|
132
|
+
&:hover {
|
|
133
|
+
text-decoration: underline;
|
|
134
|
+
text-decoration-skip-ink: none;
|
|
135
|
+
text-decoration-thickness: 10%;
|
|
136
|
+
text-underline-offset: 25%;
|
|
137
|
+
text-underline-position: from-font;
|
|
138
|
+
}
|
|
139
|
+
&:hover {
|
|
140
|
+
color: ${theme.colour.link.primaryHover};
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
let variantStyle: string | undefined = undefined;
|
|
145
|
+
if (variant === 'primary') {
|
|
146
|
+
variantStyle = cx(
|
|
147
|
+
primaryStyle,
|
|
148
|
+
noVisited && !disabled && primaryNoVisitedStyle,
|
|
149
|
+
!disabled && primaryHoverAndActiveStyle,
|
|
150
|
+
!noVisited && !disabled && visitedStyle
|
|
151
|
+
);
|
|
152
|
+
} else if (variant === 'secondary') {
|
|
153
|
+
variantStyle = cx(
|
|
154
|
+
secondaryStyle,
|
|
155
|
+
noVisited && !disabled && secondaryNoVisitedStyle,
|
|
156
|
+
!disabled && secondaryHoverAndActiveStyle,
|
|
157
|
+
!noVisited && !disabled && visitedStyle
|
|
158
|
+
);
|
|
159
|
+
} else if (variant === 'tertiary') {
|
|
160
|
+
variantStyle = cx(
|
|
161
|
+
tertiaryStyle,
|
|
162
|
+
!disabled && tertiaryNoVisitedStyle,
|
|
163
|
+
!disabled && tertiaryHoverAndActiveStyle
|
|
179
164
|
);
|
|
180
165
|
}
|
|
181
|
-
|
|
166
|
+
|
|
167
|
+
const disabledStyle = css`
|
|
168
|
+
cursor: not-allowed;
|
|
169
|
+
color: ${theme.colour.link.disabled};
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
const style = cx(
|
|
173
|
+
NAME,
|
|
174
|
+
baseStyle,
|
|
175
|
+
marginsStyle(props, theme),
|
|
176
|
+
variantStyle,
|
|
177
|
+
disabled && disabledStyle,
|
|
178
|
+
className
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<BaseLink
|
|
183
|
+
ref={ref}
|
|
184
|
+
className={style}
|
|
185
|
+
testId={testId}
|
|
186
|
+
disabled={disabled}
|
|
187
|
+
{...props}
|
|
188
|
+
>
|
|
189
|
+
{icon &&
|
|
190
|
+
iconPosition === 'left' &&
|
|
191
|
+
cloneElement(icon, { size: iconSize })}
|
|
192
|
+
{children}
|
|
193
|
+
{icon &&
|
|
194
|
+
iconPosition === 'right' &&
|
|
195
|
+
cloneElement(icon, { size: iconSize })}
|
|
196
|
+
</BaseLink>
|
|
197
|
+
);
|
|
198
|
+
}) as unknown as StandaloneLinkComponent;
|
|
182
199
|
|
|
183
200
|
export default StandaloneLink;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Link > snapshot: no props 1`] = `
|
|
4
4
|
<a
|
|
5
|
-
class="ucl-uikit-base-link ucl-uikit-standalone-link css-
|
|
5
|
+
class="ucl-uikit-base-link ucl-uikit-standalone-link css-1hrm145"
|
|
6
6
|
data-testid="ucl-uikit-standalone-link"
|
|
7
7
|
>
|
|
8
8
|
test
|
|
@@ -11,7 +11,7 @@ exports[`Link > snapshot: no props 1`] = `
|
|
|
11
11
|
|
|
12
12
|
exports[`Link > snapshot: testId prop 1`] = `
|
|
13
13
|
<a
|
|
14
|
-
class="ucl-uikit-base-link ucl-uikit-standalone-link css-
|
|
14
|
+
class="ucl-uikit-base-link ucl-uikit-standalone-link css-1hrm145"
|
|
15
15
|
data-testid="test123"
|
|
16
16
|
>
|
|
17
17
|
testidlink
|
|
@@ -10,6 +10,7 @@ const Table = ({
|
|
|
10
10
|
className,
|
|
11
11
|
children,
|
|
12
12
|
ref,
|
|
13
|
+
ariaLabel,
|
|
13
14
|
...props
|
|
14
15
|
}: TableProps) => {
|
|
15
16
|
const [theme] = useTheme();
|
|
@@ -26,6 +27,7 @@ const Table = ({
|
|
|
26
27
|
<table
|
|
27
28
|
className={style}
|
|
28
29
|
data-testid={testId}
|
|
30
|
+
aria-label={ariaLabel}
|
|
29
31
|
ref={ref}
|
|
30
32
|
{...props}
|
|
31
33
|
>
|
|
@@ -118,4 +118,23 @@ describe('Table', () => {
|
|
|
118
118
|
);
|
|
119
119
|
expect(ref.current).toBeInstanceOf(HTMLTableElement);
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
// Accessibility tests
|
|
123
|
+
|
|
124
|
+
test('aria-label is applied to the table element when passed', () => {
|
|
125
|
+
render(
|
|
126
|
+
<ThemeContextProvider>
|
|
127
|
+
<Table ariaLabel='User list'>
|
|
128
|
+
<Table.Body>
|
|
129
|
+
<Table.Row>
|
|
130
|
+
<Table.Cell>Test Cell</Table.Cell>
|
|
131
|
+
</Table.Row>
|
|
132
|
+
</Table.Body>
|
|
133
|
+
</Table>
|
|
134
|
+
</ThemeContextProvider>
|
|
135
|
+
);
|
|
136
|
+
expect(
|
|
137
|
+
screen.getByRole('table', { name: 'User list' })
|
|
138
|
+
).toBeInTheDocument();
|
|
139
|
+
});
|
|
121
140
|
});
|
|
@@ -13,7 +13,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
13
13
|
class="css-7kbd2r"
|
|
14
14
|
>
|
|
15
15
|
<th
|
|
16
|
-
class="css-
|
|
16
|
+
class="css-19iwbn3 ucl-uikit-table__head-cell"
|
|
17
17
|
data-testid="ucl-uikit-table__head-cell"
|
|
18
18
|
scope="col"
|
|
19
19
|
>
|
|
@@ -23,6 +23,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
23
23
|
>
|
|
24
24
|
Header Cell 1
|
|
25
25
|
<svg
|
|
26
|
+
aria-hidden="true"
|
|
26
27
|
fill="none"
|
|
27
28
|
height="16"
|
|
28
29
|
viewBox="0 0 48 48"
|
|
@@ -63,7 +64,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
63
64
|
</div>
|
|
64
65
|
</th>
|
|
65
66
|
<th
|
|
66
|
-
class="css-
|
|
67
|
+
class="css-19iwbn3 ucl-uikit-table__head-cell"
|
|
67
68
|
data-testid="ucl-uikit-table__head-cell"
|
|
68
69
|
scope="col"
|
|
69
70
|
>
|
|
@@ -73,6 +74,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
73
74
|
>
|
|
74
75
|
Header Cell 2
|
|
75
76
|
<svg
|
|
77
|
+
aria-hidden="true"
|
|
76
78
|
fill="none"
|
|
77
79
|
height="16"
|
|
78
80
|
viewBox="0 0 48 48"
|
|
@@ -113,7 +115,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
113
115
|
</div>
|
|
114
116
|
</th>
|
|
115
117
|
<th
|
|
116
|
-
class="css-
|
|
118
|
+
class="css-19iwbn3 ucl-uikit-table__head-cell"
|
|
117
119
|
data-testid="ucl-uikit-table__head-cell"
|
|
118
120
|
scope="col"
|
|
119
121
|
>
|
|
@@ -123,6 +125,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
123
125
|
>
|
|
124
126
|
Header Cell 3
|
|
125
127
|
<svg
|
|
128
|
+
aria-hidden="true"
|
|
126
129
|
fill="none"
|
|
127
130
|
height="16"
|
|
128
131
|
viewBox="0 0 48 48"
|
|
@@ -168,6 +171,7 @@ exports[`Table > Snapshot: basic table 1`] = `
|
|
|
168
171
|
data-testid="ucl-uikit-table__body"
|
|
169
172
|
>
|
|
170
173
|
<tr
|
|
174
|
+
aria-selected="false"
|
|
171
175
|
class="css-jetl3c ucl-uikit-table__row"
|
|
172
176
|
data-testid="ucl-uikit-table__row"
|
|
173
177
|
>
|
|
@@ -2,9 +2,10 @@ import { css, cx } from '@emotion/css';
|
|
|
2
2
|
import CellContent from './CellContent';
|
|
3
3
|
import { useTheme } from '../../../../theme';
|
|
4
4
|
import type { ColumnVariant } from '../../Table.types';
|
|
5
|
+
import type { CheckboxProps } from '../../../Checkbox/Checkbox';
|
|
6
|
+
import type { ButtonProps } from '../../../Button';
|
|
5
7
|
|
|
6
|
-
export interface TableCellProps
|
|
7
|
-
extends React.HTMLAttributes<HTMLTableCellElement> {
|
|
8
|
+
export interface TableCellProps extends React.HTMLAttributes<HTMLTableCellElement> {
|
|
8
9
|
variant?: ColumnVariant;
|
|
9
10
|
icon?: React.ReactNode;
|
|
10
11
|
checked?: boolean;
|
|
@@ -15,6 +16,11 @@ export interface TableCellProps
|
|
|
15
16
|
onButtonClick?: (event: React.UIEvent) => void;
|
|
16
17
|
className?: string;
|
|
17
18
|
testId?: string;
|
|
19
|
+
checkboxProps?: Omit<CheckboxProps, 'checked' | 'onChange'>;
|
|
20
|
+
buttonProps?: Omit<
|
|
21
|
+
ButtonProps<'button'>,
|
|
22
|
+
'variant' | 'onClick' | 'className'
|
|
23
|
+
>;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
const NAME = 'ucl-uikit-table__cell';
|
|
@@ -28,10 +34,23 @@ const Cell = ({
|
|
|
28
34
|
testId = NAME,
|
|
29
35
|
className,
|
|
30
36
|
children,
|
|
37
|
+
checkboxProps,
|
|
38
|
+
buttonProps,
|
|
31
39
|
...props
|
|
32
40
|
}: TableCellProps) => {
|
|
33
41
|
const [theme] = useTheme();
|
|
34
42
|
|
|
43
|
+
if (
|
|
44
|
+
variant === 'checkbox' &&
|
|
45
|
+
!checkboxProps?.ariaLabel &&
|
|
46
|
+
!checkboxProps?.['aria-label']
|
|
47
|
+
) {
|
|
48
|
+
console.warn(
|
|
49
|
+
`${NAME}: checkboxProps.ariaLabel is required when using variant="checkbox". ` +
|
|
50
|
+
'Provide a row-specific label (e.g. "Select John Smith") so screen readers can identify each checkbox.'
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
35
54
|
const handleCheckboxChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
36
55
|
if (variant === 'checkbox' && onCheck) onCheck(event.target.checked, event);
|
|
37
56
|
};
|
|
@@ -62,6 +81,8 @@ const Cell = ({
|
|
|
62
81
|
checked={checked}
|
|
63
82
|
handleCheckboxChange={handleCheckboxChange}
|
|
64
83
|
handleButtonClick={handleButtonClick}
|
|
84
|
+
checkboxProps={checkboxProps}
|
|
85
|
+
buttonProps={buttonProps}
|
|
65
86
|
>
|
|
66
87
|
{children}
|
|
67
88
|
</CellContent>
|