uikit-react-public 0.14.21 → 0.21.8
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 -2
- package/dist/components/Accordion/Accordion.Heading.d.ts +5 -4
- package/dist/components/Accordion/Accordion.Panel.d.ts +2 -2
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.stories.d.ts +57 -0
- package/dist/components/Accordion/index.d.ts +2 -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/Avatar/Avatar.stories.d.ts +107 -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 +8 -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/Calendar/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Datepicker/Datepicker.d.ts +1 -1
- package/dist/components/Datepicker/Datepicker.stories.d.ts +4 -3
- package/dist/components/Datepicker/Datepicker.types.d.ts +4 -5
- package/dist/components/Datepicker/subcomponents/CustomDatepicker.d.ts +4 -1
- package/dist/components/Datepicker/subcomponents/DatepickerInput.d.ts +15 -2
- package/dist/components/Datepicker/subcomponents/Panel.d.ts +1 -1
- package/dist/components/Datepicker/subcomponents/VisibleField.d.ts +6 -1
- package/dist/components/Datepicker/subcomponents/index.d.ts +0 -1
- package/dist/components/Datepicker/utils/index.d.ts +0 -1
- package/dist/components/Dialog/BaseDialog.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts +2 -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/index.d.ts +2 -0
- package/dist/components/Header/Header.d.ts +4 -1
- package/dist/components/Header/Header.stories.d.ts +40 -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/HeadingNew/Heading.d.ts +13 -0
- package/dist/components/HeadingNew/index.d.ts +2 -0
- 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/Main/Main.d.ts +21 -0
- package/dist/components/Main/Main.stories.d.ts +15 -0
- package/dist/components/Main/__tests__/Main.test.d.ts +1 -0
- package/dist/components/Main/index.d.ts +2 -0
- 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/NativeDatepicker/NativeDatepicker.d.ts +3 -0
- package/dist/components/NativeDatepicker/NativeDatepicker.stories.d.ts +36 -0
- package/dist/components/NativeDatepicker/NativeDatepicker.types.d.ts +10 -0
- package/dist/components/NativeDatepicker/index.d.ts +2 -0
- package/dist/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.d.ts +1 -1
- package/dist/components/NativeDatepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts +1 -0
- package/dist/components/NativeDatepicker/utils/index.d.ts +1 -0
- package/dist/components/Overlay/Overlay.stories.d.ts +12 -12
- package/dist/components/ParagraphNew/Paragraph.d.ts +13 -0
- package/dist/components/ParagraphNew/index.d.ts +4 -0
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.stories.d.ts +167 -3
- package/dist/components/Select/Select.types.d.ts +75 -19
- package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
- package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -2
- package/dist/components/Select/subcomponents/FilterInput.d.ts +16 -0
- package/dist/components/Select/subcomponents/NativeSelect.d.ts +5 -1
- package/dist/components/Select/subcomponents/VisibleField.d.ts +6 -1
- package/dist/components/Select/subcomponents/index.d.ts +1 -0
- 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/WeekPicker/WeekPicker.d.ts +2 -2
- package/dist/components/WeekPicker/WeekPicker.stories.d.ts +41 -0
- package/dist/components/WeekPicker/WeekPicker.types.d.ts +16 -0
- package/dist/components/WeekPicker/index.d.ts +1 -0
- package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +1 -1
- package/dist/components/index.d.ts +20 -0
- package/dist/hooks/useFocusTrap.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22204 -16719
- 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/__tests__/announce.test.d.ts +1 -0
- package/dist/utils/addAlphaToHex.d.ts +5 -0
- package/dist/utils/announce.d.ts +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/scrollToTop.d.ts +2 -0
- package/lib/components/Accordion/Accordion.Heading.tsx +65 -34
- package/lib/components/Accordion/Accordion.Panel.tsx +11 -7
- package/lib/components/Accordion/Accordion.stories.tsx +139 -0
- package/lib/components/Accordion/Accordion.tsx +39 -31
- package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +15 -13
- package/lib/components/Accordion/index.ts +2 -0
- package/lib/components/Alert/Alert.stories.tsx +1 -1
- 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/Avatar/Avatar.mdx +117 -0
- package/lib/components/Avatar/Avatar.stories.tsx +110 -2
- package/lib/components/Badge/Badge.stories.tsx +1 -1
- package/lib/components/Blanket/Blanket.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 +44 -51
- package/lib/components/Button/Button.tsx +166 -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 +1 -1
- package/lib/components/Calendar/Calendar.tsx +2 -2
- package/lib/components/Calendar/__tests__/Calendar.test.tsx +23 -15
- package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +99 -95
- package/lib/components/Calendar/index.ts +1 -5
- package/lib/components/Calendar/subcomponents/AcademicWeek.tsx +2 -1
- package/lib/components/Calendar/subcomponents/AcademicWeeks.tsx +1 -1
- package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +2 -2
- 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 +3 -6
- package/lib/components/Calendar/subcomponents/index.ts +1 -1
- package/lib/components/Calendar/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.ts +43 -11
- package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.test.ts +5 -5
- 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/Datepicker.lld.md +108 -0
- package/lib/components/Datepicker/Datepicker.stories.tsx +44 -5
- package/lib/components/Datepicker/Datepicker.tsx +14 -36
- package/lib/components/Datepicker/Datepicker.types.ts +5 -14
- package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +267 -8
- package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +20 -42
- package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +48 -5
- package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +30 -17
- package/lib/components/Datepicker/subcomponents/Panel.tsx +6 -2
- package/lib/components/Datepicker/subcomponents/VisibleField.tsx +46 -8
- package/lib/components/Datepicker/subcomponents/index.ts +0 -1
- package/lib/components/Datepicker/utils/index.ts +0 -1
- package/lib/components/Dialog/BaseDialog.tsx +13 -2
- package/lib/components/Dialog/Dialog.stories.tsx +1 -1
- package/lib/components/Dialog/Dialog.tsx +8 -1
- package/lib/components/Dialog/DialogBody.tsx +5 -1
- package/lib/components/Dialog/DialogHeader.tsx +2 -1
- package/lib/components/Divider/Divider.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 +2 -1
- package/lib/components/Field/Field.stories.tsx +1 -1
- package/lib/components/Field/Field.tsx +1 -1
- package/lib/components/Field/HelperText.tsx +3 -1
- package/lib/components/Field/__tests__/Field.test.tsx +13 -0
- 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/Footer.stories.tsx +1 -1
- package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +73 -82
- 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/Header/Header.mdx +52 -0
- package/lib/components/Header/Header.stories.tsx +98 -0
- package/lib/components/Header/Header.tsx +51 -6
- package/lib/components/Header/__tests__/Header.test.tsx +17 -1
- 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 +1 -1
- package/lib/components/HeadingNew/Heading.tsx +208 -0
- package/lib/components/HeadingNew/index.ts +2 -0
- package/lib/components/Icon/Icon.stories.tsx +1 -1
- 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.stories.tsx +1 -1
- package/lib/components/IconButton/IconButton.tsx +3 -4
- package/lib/components/IconButton/__tests__/__snapshots__/IconButton.test.tsx.snap +12 -9
- package/lib/components/Input/Input.stories.tsx +1 -1
- package/lib/components/Label/Label.stories.tsx +1 -1
- 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/Main/Main.stories.tsx +36 -0
- package/lib/components/Main/Main.tsx +46 -0
- package/lib/components/Main/__tests__/Main.test.tsx +80 -0
- package/lib/components/Main/__tests__/__snapshots__/Main.test.tsx.snap +33 -0
- package/lib/components/Main/index.ts +2 -0
- 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/NativeDatepicker/NativeDatepicker.stories.tsx +100 -0
- package/lib/components/{Datepicker/subcomponents → NativeDatepicker}/NativeDatepicker.tsx +14 -15
- package/lib/components/NativeDatepicker/NativeDatepicker.types.ts +19 -0
- package/lib/components/NativeDatepicker/index.ts +2 -0
- package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.ts +1 -1
- package/lib/components/NativeDatepicker/utils/index.ts +1 -0
- package/lib/components/Pagination/Pagination.stories.tsx +1 -1
- package/lib/components/Pagination/PaginationControls.tsx +59 -17
- package/lib/components/Pagination/PaginationInfo.tsx +7 -4
- package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
- package/lib/components/ParagraphNew/Paragraph.tsx +200 -0
- package/lib/components/ParagraphNew/index.ts +6 -0
- 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/Search.stories.tsx +1 -1
- package/lib/components/Search/Search.tsx +4 -1
- package/lib/components/Search/__tests__/Search.test.tsx +19 -1
- package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +12 -32
- package/lib/components/Select/Select.mdx +192 -0
- package/lib/components/Select/Select.stories.tsx +229 -48
- package/lib/components/Select/Select.tsx +50 -15
- package/lib/components/Select/Select.types.ts +99 -44
- package/lib/components/Select/__tests__/Select.test.tsx +698 -8
- package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +5 -4
- package/lib/components/Select/subcomponents/CustomOption.tsx +12 -4
- package/lib/components/Select/subcomponents/CustomSelect.tsx +411 -41
- package/lib/components/Select/subcomponents/FilterInput.tsx +90 -0
- package/lib/components/Select/subcomponents/NativeSelect.tsx +21 -17
- package/lib/components/Select/subcomponents/Panel.tsx +2 -2
- package/lib/components/Select/subcomponents/VisibleField.tsx +59 -6
- package/lib/components/Select/subcomponents/index.tsx +1 -0
- package/lib/components/Snackbar/Snackbar.stories.tsx +1 -1
- package/lib/components/Snackbar/__tests__/__snapshots__/Snackbar.test.tsx.snap +9 -15
- package/lib/components/Spinner/Spinner.stories.tsx +1 -1
- 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/Textarea/Textarea.stories.tsx +1 -1
- package/lib/components/Timepicker/Timepicker.stories.tsx +1 -1
- package/lib/components/Timepicker/Timepicker.tsx +4 -0
- package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +2 -2
- package/lib/components/Toggle/Toggle.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.stories.tsx +1 -1
- 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 +145 -0
- package/lib/components/WeekPicker/WeekPicker.tsx +2 -2
- package/lib/components/WeekPicker/WeekPicker.types.ts +21 -0
- package/lib/components/WeekPicker/index.ts +1 -0
- package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +1 -1
- package/lib/components/common/Common.mdx +1 -2
- package/lib/components/index.ts +30 -3
- package/lib/hooks/useFocusTrap.ts +40 -4
- package/lib/index.ts +1 -0
- 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/__tests__/announce.test.ts +121 -0
- package/lib/utils/addAlphaToHex.ts +29 -0
- package/lib/utils/announce.ts +134 -0
- package/lib/utils/index.ts +1 -0
- package/lib/utils/scrollToTop.ts +5 -0
- package/package.json +11 -9
- 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/components/Datepicker/subcomponents/NativeDatepicker.d.ts +0 -6
- package/dist/theme/defaultTheme.d.ts +0 -274
- package/lib/components/Accordion/Accordion.stories.tsx.NOT_READY +0 -93
- package/lib/components/Button/buttonPrimaryStyle.ts +0 -62
- package/lib/components/Button/buttonSecondaryStyle.ts +0 -65
- package/lib/components/Button/buttonTertiaryStyle.ts +0 -54
- /package/dist/components/{Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts → FooterNew/__tests__/Footer.test.d.ts} +0 -0
- /package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +0 -0
|
@@ -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>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { css, cx } from '@emotion/css';
|
|
2
2
|
import Checkbox from '../../../Checkbox/Checkbox';
|
|
3
|
-
import
|
|
3
|
+
import type { CheckboxProps } from '../../../Checkbox/Checkbox';
|
|
4
|
+
import Button from '../../../Button';
|
|
5
|
+
import type { ButtonProps } from '../../../Button';
|
|
4
6
|
import { useTheme } from '../../../../theme';
|
|
5
7
|
import type { ColumnVariant } from '../../Table.types';
|
|
6
8
|
|
|
@@ -8,6 +10,11 @@ interface CellContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8
10
|
variant: ColumnVariant;
|
|
9
11
|
icon?: React.ReactNode;
|
|
10
12
|
checked?: boolean;
|
|
13
|
+
checkboxProps?: Omit<CheckboxProps, 'checked' | 'onChange'>;
|
|
14
|
+
buttonProps?: Omit<
|
|
15
|
+
ButtonProps<'button'>,
|
|
16
|
+
'variant' | 'onClick' | 'className'
|
|
17
|
+
>;
|
|
11
18
|
handleCheckboxChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
19
|
handleButtonClick: (event: React.UIEvent) => void;
|
|
13
20
|
}
|
|
@@ -18,6 +25,8 @@ const CellContent = ({
|
|
|
18
25
|
variant,
|
|
19
26
|
icon,
|
|
20
27
|
checked,
|
|
28
|
+
checkboxProps,
|
|
29
|
+
buttonProps,
|
|
21
30
|
handleCheckboxChange,
|
|
22
31
|
handleButtonClick,
|
|
23
32
|
children,
|
|
@@ -72,6 +81,7 @@ const CellContent = ({
|
|
|
72
81
|
<Checkbox
|
|
73
82
|
checked={checked}
|
|
74
83
|
onChange={handleCheckboxChange}
|
|
84
|
+
{...checkboxProps}
|
|
75
85
|
/>
|
|
76
86
|
)}
|
|
77
87
|
{variant === 'button' && (
|
|
@@ -79,6 +89,7 @@ const CellContent = ({
|
|
|
79
89
|
variant='tertiary'
|
|
80
90
|
onClick={handleButtonClick}
|
|
81
91
|
className={buttonStyle}
|
|
92
|
+
{...buttonProps}
|
|
82
93
|
>
|
|
83
94
|
{children}
|
|
84
95
|
</Button>
|