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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { css, cx } from '@emotion/css';
|
|
2
|
+
import { useTheme } from '../../../theme';
|
|
3
|
+
import type { FilterInputProps } from '../Select.types';
|
|
4
|
+
|
|
5
|
+
type FilterInputComponentProps = {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
9
|
+
onTabOut?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
inputRef?: React.RefObject<HTMLInputElement | null>;
|
|
13
|
+
className?: string;
|
|
14
|
+
ariaControls?: string;
|
|
15
|
+
ariaExpanded?: boolean;
|
|
16
|
+
ariaActiveDescendant?: string;
|
|
17
|
+
} & FilterInputProps;
|
|
18
|
+
|
|
19
|
+
const FilterInput = ({
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
onBlur,
|
|
23
|
+
onTabOut,
|
|
24
|
+
placeholder,
|
|
25
|
+
disabled,
|
|
26
|
+
inputRef,
|
|
27
|
+
className,
|
|
28
|
+
ariaControls,
|
|
29
|
+
ariaExpanded,
|
|
30
|
+
ariaActiveDescendant,
|
|
31
|
+
...rest
|
|
32
|
+
}: FilterInputComponentProps) => {
|
|
33
|
+
const [theme] = useTheme();
|
|
34
|
+
|
|
35
|
+
const handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
36
|
+
if (e.key === 'Tab') {
|
|
37
|
+
onTabOut?.(e);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Let parent handle key navigation
|
|
42
|
+
if (
|
|
43
|
+
e.key === 'Escape' ||
|
|
44
|
+
e.key === 'Enter' ||
|
|
45
|
+
e.key === 'ArrowUp' ||
|
|
46
|
+
e.key === 'ArrowDown'
|
|
47
|
+
)
|
|
48
|
+
return;
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const style = css`
|
|
53
|
+
flex: 1;
|
|
54
|
+
border: none;
|
|
55
|
+
outline: none;
|
|
56
|
+
background: transparent;
|
|
57
|
+
font: inherit;
|
|
58
|
+
color: ${theme.colour.text.default};
|
|
59
|
+
&::placeholder {
|
|
60
|
+
color: ${theme.colour.text.tertiary};
|
|
61
|
+
}
|
|
62
|
+
&:disabled {
|
|
63
|
+
color: ${theme.colour.text.disabled};
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
return (
|
|
68
|
+
<input
|
|
69
|
+
ref={inputRef}
|
|
70
|
+
className={cx(style, className)}
|
|
71
|
+
value={value}
|
|
72
|
+
placeholder={placeholder}
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
onChange={(e) => onChange(e.target.value)}
|
|
75
|
+
onBlur={onBlur}
|
|
76
|
+
onClick={(e) => e.stopPropagation()}
|
|
77
|
+
onKeyDown={(e) => handleOnKeyDown(e)}
|
|
78
|
+
aria-label='Filter options'
|
|
79
|
+
aria-autocomplete='list'
|
|
80
|
+
role='searchbox'
|
|
81
|
+
aria-haspopup='listbox'
|
|
82
|
+
aria-controls={ariaControls}
|
|
83
|
+
aria-expanded={ariaExpanded}
|
|
84
|
+
aria-activedescendant={ariaActiveDescendant}
|
|
85
|
+
{...rest}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default FilterInput;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { css, cx } from '@emotion/css';
|
|
2
2
|
import { useTheme } from '../../../theme';
|
|
3
3
|
import { dataUri as chevronDownSvgDataUri } from '../../Icon/svgs/ChevronDownSvg';
|
|
4
|
-
import {
|
|
4
|
+
import type { InternalSelectProps } from '../Select.types';
|
|
5
|
+
|
|
6
|
+
type NativeSelectProps = Omit<
|
|
7
|
+
React.SelectHTMLAttributes<HTMLSelectElement>,
|
|
8
|
+
'value' | 'defaultValue'
|
|
9
|
+
> &
|
|
10
|
+
Omit<
|
|
11
|
+
InternalSelectProps,
|
|
12
|
+
'native' | 'filterable' | 'nativeHtmlAttributes' | 'onValueChange' | 'ref'
|
|
13
|
+
> & {
|
|
14
|
+
value?: string | number;
|
|
15
|
+
ref?: React.Ref<HTMLSelectElement>;
|
|
16
|
+
};
|
|
5
17
|
|
|
6
18
|
const NAME = 'ucl-uikit-select--native';
|
|
7
19
|
|
|
@@ -17,8 +29,8 @@ const NativeSelect = ({
|
|
|
17
29
|
const [theme] = useTheme();
|
|
18
30
|
|
|
19
31
|
const chevronColour = disabled
|
|
20
|
-
? theme.
|
|
21
|
-
: theme.
|
|
32
|
+
? theme.colour.icon.disabled
|
|
33
|
+
: theme.colour.icon.default;
|
|
22
34
|
const chevronDownSvg = chevronDownSvgDataUri(chevronColour);
|
|
23
35
|
|
|
24
36
|
const baseStyle = css`
|
|
@@ -27,9 +39,9 @@ const NativeSelect = ({
|
|
|
27
39
|
line-height: ${theme.font.lineHeight.h150};
|
|
28
40
|
font-family: ${theme.font.family.primary};
|
|
29
41
|
font-size: ${theme.font.size.f16};
|
|
30
|
-
background-color: ${theme.
|
|
31
|
-
border: ${theme.border.b1} solid ${theme.
|
|
32
|
-
color: ${theme.
|
|
42
|
+
background-color: ${theme.colour.fill.inverse};
|
|
43
|
+
border: ${theme.border.b1} solid ${theme.colour.border.secondary};
|
|
44
|
+
color: ${theme.colour.text.default};
|
|
33
45
|
appearance: none;
|
|
34
46
|
-webkit-appearance: none;
|
|
35
47
|
-moz-appearance: none;
|
|
@@ -46,13 +58,6 @@ const NativeSelect = ({
|
|
|
46
58
|
width: ${width}px;
|
|
47
59
|
`;
|
|
48
60
|
|
|
49
|
-
const hoverStyle = css`
|
|
50
|
-
&:hover {
|
|
51
|
-
border-color: ${theme.color.neutral.grey60};
|
|
52
|
-
background-color: ${theme.color.neutral.grey5};
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
61
|
const focusStyle = css`
|
|
57
62
|
&:focus-visible {
|
|
58
63
|
box-shadow: ${theme.boxShadow.focus};
|
|
@@ -60,13 +65,13 @@ const NativeSelect = ({
|
|
|
60
65
|
`;
|
|
61
66
|
|
|
62
67
|
const disabledStyle = css`
|
|
63
|
-
color: ${theme.
|
|
64
|
-
border: ${theme.border.b1} solid ${theme.
|
|
68
|
+
color: ${theme.colour.text.disabled};
|
|
69
|
+
border: ${theme.border.b1} solid ${theme.colour.border.disabled};
|
|
65
70
|
opacity: 1; // Override user-agent default
|
|
66
71
|
cursor: not-allowed;
|
|
67
72
|
|
|
68
73
|
&:hover {
|
|
69
|
-
background-color: ${theme.
|
|
74
|
+
background-color: ${theme.colour.fill.inverse};
|
|
70
75
|
}
|
|
71
76
|
`;
|
|
72
77
|
|
|
@@ -74,7 +79,6 @@ const NativeSelect = ({
|
|
|
74
79
|
NAME,
|
|
75
80
|
baseStyle,
|
|
76
81
|
!!width && widthStyle,
|
|
77
|
-
!disabled && hoverStyle,
|
|
78
82
|
!disabled && focusStyle,
|
|
79
83
|
disabled && disabledStyle,
|
|
80
84
|
className
|
|
@@ -26,8 +26,8 @@ const Panel = ({ className, ...props }: PanelProps) => {
|
|
|
26
26
|
overflow-x: hidden;
|
|
27
27
|
box-sizing: content-box;
|
|
28
28
|
padding: ${theme.padding.p8} 0;
|
|
29
|
-
border: ${theme.border.b1} solid ${theme.
|
|
30
|
-
background-color: ${theme.
|
|
29
|
+
border: ${theme.border.b1} solid ${theme.colour.border.subtle};
|
|
30
|
+
background-color: ${theme.colour.fill.inverse};
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
33
|
const style = cx(NAME, baseStyle, className);
|
|
@@ -10,6 +10,11 @@ interface VisibleFieldProps<T> {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
selectedOption: OptionData<T> | null | undefined;
|
|
12
12
|
placeholder?: string;
|
|
13
|
+
filterable?: boolean;
|
|
14
|
+
clearable?: boolean;
|
|
15
|
+
onClear?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
16
|
+
clearButtonRef?: React.RefObject<HTMLButtonElement | null>;
|
|
17
|
+
children?: React.ReactNode;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
const VisibleField = <T extends string | number>({
|
|
@@ -17,6 +22,11 @@ const VisibleField = <T extends string | number>({
|
|
|
17
22
|
isOpen,
|
|
18
23
|
placeholder,
|
|
19
24
|
disabled,
|
|
25
|
+
filterable,
|
|
26
|
+
clearable = false,
|
|
27
|
+
onClear,
|
|
28
|
+
clearButtonRef,
|
|
29
|
+
children,
|
|
20
30
|
}: VisibleFieldProps<T>) => {
|
|
21
31
|
const [theme] = useTheme();
|
|
22
32
|
|
|
@@ -40,7 +50,7 @@ const VisibleField = <T extends string | number>({
|
|
|
40
50
|
const chevronIconBaseStyle = css`
|
|
41
51
|
flex-shrink: 0;
|
|
42
52
|
margin-left: auto;
|
|
43
|
-
color: ${theme.
|
|
53
|
+
color: ${theme.colour.icon.default};
|
|
44
54
|
`;
|
|
45
55
|
|
|
46
56
|
const chevronIconOpenStyle = css`
|
|
@@ -48,7 +58,7 @@ const VisibleField = <T extends string | number>({
|
|
|
48
58
|
`;
|
|
49
59
|
|
|
50
60
|
const chevronIconDisabledStyle = css`
|
|
51
|
-
color: ${theme.
|
|
61
|
+
color: ${theme.colour.icon.disabled};
|
|
52
62
|
`;
|
|
53
63
|
|
|
54
64
|
const chevronIconStyle = cx(
|
|
@@ -57,15 +67,58 @@ const VisibleField = <T extends string | number>({
|
|
|
57
67
|
disabled && chevronIconDisabledStyle
|
|
58
68
|
);
|
|
59
69
|
|
|
70
|
+
const clearButtonStyle = css`
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
margin-left: auto;
|
|
76
|
+
padding: 0;
|
|
77
|
+
border: none;
|
|
78
|
+
background: transparent;
|
|
79
|
+
color: ${theme.colour.icon.default};
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
|
|
82
|
+
&:focus-visible {
|
|
83
|
+
outline: none;
|
|
84
|
+
box-shadow: ${theme.boxShadow.focus};
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const showClearButton = clearable && !!selectedOption && !disabled;
|
|
89
|
+
|
|
60
90
|
return (
|
|
61
91
|
<div
|
|
62
92
|
className={style}
|
|
63
93
|
data-testid={NAME}
|
|
64
94
|
>
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
95
|
+
{filterable && isOpen ? (
|
|
96
|
+
<div className={innerStyle}>{children}</div>
|
|
97
|
+
) : (
|
|
98
|
+
<span className={innerStyle}>
|
|
99
|
+
{selectedOption ? selectedOption.label : placeholder || ''}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
{showClearButton ? (
|
|
103
|
+
<button
|
|
104
|
+
ref={clearButtonRef}
|
|
105
|
+
type='button'
|
|
106
|
+
className={clearButtonStyle}
|
|
107
|
+
aria-label='Clear selection'
|
|
108
|
+
data-testid={`${NAME}-clear-button`}
|
|
109
|
+
onClick={(event) => {
|
|
110
|
+
event.stopPropagation();
|
|
111
|
+
onClear?.(event);
|
|
112
|
+
}}
|
|
113
|
+
onKeyDown={(event) => {
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
<Icon.X />
|
|
118
|
+
</button>
|
|
119
|
+
) : (
|
|
120
|
+
<Icon.ChevronDown className={chevronIconStyle} />
|
|
121
|
+
)}
|
|
69
122
|
</div>
|
|
70
123
|
);
|
|
71
124
|
};
|
|
@@ -3,3 +3,4 @@ export { default as NativeSelect } from './NativeSelect';
|
|
|
3
3
|
export { default as CustomOption } from './CustomOption';
|
|
4
4
|
export { default as Panel } from './Panel';
|
|
5
5
|
export { default as VisibleField } from './VisibleField';
|
|
6
|
+
export { default as FilterInput } from './FilterInput';
|
|
@@ -9,6 +9,7 @@ exports[`Snackbar > snapshot: custom test id 1`] = `
|
|
|
9
9
|
class="ucl-uikit-icon css-1uzxprk"
|
|
10
10
|
data-testid="ucl-uikit-icon"
|
|
11
11
|
fill="none"
|
|
12
|
+
focusable="false"
|
|
12
13
|
height="24"
|
|
13
14
|
stroke="currentColor"
|
|
14
15
|
stroke-linecap="round"
|
|
@@ -21,8 +22,8 @@ exports[`Snackbar > snapshot: custom test id 1`] = `
|
|
|
21
22
|
<path
|
|
22
23
|
d="M22 11.08V12a10 10 0 1 1-5.93-9.14"
|
|
23
24
|
/>
|
|
24
|
-
<
|
|
25
|
-
|
|
25
|
+
<path
|
|
26
|
+
d="M22 4 12 14.01l-3-3"
|
|
26
27
|
/>
|
|
27
28
|
</svg>
|
|
28
29
|
<span>
|
|
@@ -50,6 +51,7 @@ exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
|
50
51
|
class="ucl-uikit-icon css-1uzxprk"
|
|
51
52
|
data-testid="ucl-uikit-icon"
|
|
52
53
|
fill="none"
|
|
54
|
+
focusable="false"
|
|
53
55
|
height="24"
|
|
54
56
|
stroke="currentColor"
|
|
55
57
|
stroke-linecap="round"
|
|
@@ -62,8 +64,8 @@ exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
|
62
64
|
<path
|
|
63
65
|
d="M22 11.08V12a10 10 0 1 1-5.93-9.14"
|
|
64
66
|
/>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
+
<path
|
|
68
|
+
d="M22 4 12 14.01l-3-3"
|
|
67
69
|
/>
|
|
68
70
|
</svg>
|
|
69
71
|
<span>
|
|
@@ -80,6 +82,7 @@ exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
|
80
82
|
class="ucl-uikit-icon css-148hpxb"
|
|
81
83
|
data-testid="ucl-uikit-icon"
|
|
82
84
|
fill="none"
|
|
85
|
+
focusable="false"
|
|
83
86
|
height="24"
|
|
84
87
|
stroke="currentColor"
|
|
85
88
|
stroke-linecap="round"
|
|
@@ -89,17 +92,8 @@ exports[`Snackbar > snapshot: minimal props 1`] = `
|
|
|
89
92
|
width="24"
|
|
90
93
|
xmlns="http://www.w3.org/2000/svg"
|
|
91
94
|
>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
x2="6"
|
|
95
|
-
y1="6"
|
|
96
|
-
y2="18"
|
|
97
|
-
/>
|
|
98
|
-
<line
|
|
99
|
-
x1="6"
|
|
100
|
-
x2="18"
|
|
101
|
-
y1="6"
|
|
102
|
-
y2="18"
|
|
95
|
+
<path
|
|
96
|
+
d="M18 6 6 18M6 6l12 12"
|
|
103
97
|
/>
|
|
104
98
|
</svg>
|
|
105
99
|
</button>
|
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import { SVGAttributes, forwardRef, memo } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
|
+
import { useTheme } from '../../theme';
|
|
3
4
|
|
|
4
5
|
export const NAME = 'ucl-uikit-spinner';
|
|
5
6
|
|
|
6
7
|
export interface SpinnerProps extends SVGAttributes<SVGSVGElement> {
|
|
7
8
|
size?: number;
|
|
9
|
+
strokeWidth?: number;
|
|
8
10
|
testId?: string;
|
|
11
|
+
inheritColour?: boolean;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
const Spinner = forwardRef<SVGSVGElement, SpinnerProps>(
|
|
12
|
-
(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
size = 72,
|
|
18
|
+
strokeWidth = 4,
|
|
19
|
+
className,
|
|
20
|
+
testId = NAME,
|
|
21
|
+
inheritColour = false,
|
|
22
|
+
...rest
|
|
23
|
+
}: SpinnerProps,
|
|
24
|
+
ref
|
|
25
|
+
) => {
|
|
26
|
+
const [theme] = useTheme();
|
|
27
|
+
|
|
28
|
+
const rotationDuration = `3s`; // rotation duration
|
|
29
|
+
const dashDuration = `2s`; // dash duration
|
|
30
|
+
|
|
31
|
+
const baseStyle = css`
|
|
32
|
+
color: ${inheritColour ? 'inherit' : theme.colour.icon.brand};
|
|
33
|
+
`;
|
|
15
34
|
|
|
16
35
|
const gStyle = css`
|
|
17
36
|
transform-origin: 50% 50%;
|
|
@@ -44,7 +63,7 @@ const Spinner = forwardRef<SVGSVGElement, SpinnerProps>(
|
|
|
44
63
|
}
|
|
45
64
|
`;
|
|
46
65
|
|
|
47
|
-
const style = cx(NAME, className);
|
|
66
|
+
const style = cx(NAME, baseStyle, className);
|
|
48
67
|
|
|
49
68
|
return (
|
|
50
69
|
<svg
|
|
@@ -64,7 +83,7 @@ const Spinner = forwardRef<SVGSVGElement, SpinnerProps>(
|
|
|
64
83
|
r='20'
|
|
65
84
|
fill='none'
|
|
66
85
|
stroke='currentColor'
|
|
67
|
-
strokeWidth={
|
|
86
|
+
strokeWidth={strokeWidth}
|
|
68
87
|
/>
|
|
69
88
|
</g>
|
|
70
89
|
</svg>
|
|
@@ -2,17 +2,26 @@ import { describe, expect, test } from 'vitest';
|
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { css } from '@emotion/css';
|
|
4
4
|
import SpinnerSvg from '../Spinner';
|
|
5
|
+
import { ThemeContextProvider } from '../../..';
|
|
5
6
|
|
|
6
7
|
describe('SpinnerSvg', () => {
|
|
7
8
|
// Snapshot tests
|
|
8
9
|
|
|
9
10
|
test('snapshot: default props', () => {
|
|
10
|
-
const renderResult = render(
|
|
11
|
+
const renderResult = render(
|
|
12
|
+
<ThemeContextProvider>
|
|
13
|
+
<SpinnerSvg />
|
|
14
|
+
</ThemeContextProvider>
|
|
15
|
+
);
|
|
11
16
|
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
test('snapshot: custom size', () => {
|
|
15
|
-
const renderResult = render(
|
|
20
|
+
const renderResult = render(
|
|
21
|
+
<ThemeContextProvider>
|
|
22
|
+
<SpinnerSvg size={32} />
|
|
23
|
+
</ThemeContextProvider>
|
|
24
|
+
);
|
|
16
25
|
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
17
26
|
});
|
|
18
27
|
|
|
@@ -20,7 +29,20 @@ describe('SpinnerSvg', () => {
|
|
|
20
29
|
const style = css`
|
|
21
30
|
color: #0d68cf;
|
|
22
31
|
`;
|
|
23
|
-
const renderResult = render(
|
|
32
|
+
const renderResult = render(
|
|
33
|
+
<ThemeContextProvider>
|
|
34
|
+
<SpinnerSvg className={style} />
|
|
35
|
+
</ThemeContextProvider>
|
|
36
|
+
);
|
|
37
|
+
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('snapshot: inherits parent colour when inheritColour is true', () => {
|
|
41
|
+
const renderResult = render(
|
|
42
|
+
<ThemeContextProvider>
|
|
43
|
+
<SpinnerSvg inheritColour />
|
|
44
|
+
</ThemeContextProvider>
|
|
45
|
+
);
|
|
24
46
|
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
25
47
|
});
|
|
26
48
|
|
|
@@ -28,13 +50,21 @@ describe('SpinnerSvg', () => {
|
|
|
28
50
|
|
|
29
51
|
test('Can be found with default testId', () => {
|
|
30
52
|
const defaultTestId = 'ucl-uikit-spinner';
|
|
31
|
-
const { getByTestId } = render(
|
|
53
|
+
const { getByTestId } = render(
|
|
54
|
+
<ThemeContextProvider>
|
|
55
|
+
<SpinnerSvg testId={defaultTestId} />
|
|
56
|
+
</ThemeContextProvider>
|
|
57
|
+
);
|
|
32
58
|
const svg = getByTestId(defaultTestId);
|
|
33
59
|
expect(svg).toBeDefined();
|
|
34
60
|
});
|
|
35
61
|
|
|
36
62
|
test('test ID: custom', () => {
|
|
37
|
-
const { getByTestId } = render(
|
|
63
|
+
const { getByTestId } = render(
|
|
64
|
+
<ThemeContextProvider>
|
|
65
|
+
<SpinnerSvg testId='custom-test-id' />
|
|
66
|
+
</ThemeContextProvider>
|
|
67
|
+
);
|
|
38
68
|
const svg = getByTestId('custom-test-id');
|
|
39
69
|
expect(svg).toBeDefined();
|
|
40
70
|
});
|
|
@@ -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',
|