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,207 @@
|
|
|
1
|
+
import { typography, primitiveColour } from '../common/themeCommon';
|
|
2
|
+
import color, { blackAndWhite, displayColours } from './color';
|
|
3
|
+
import originalColour from './originalColourNewStructure';
|
|
4
|
+
|
|
5
|
+
// UCL Theme
|
|
6
|
+
|
|
7
|
+
const baseSizes = {
|
|
8
|
+
s1: '1px',
|
|
9
|
+
s2: '2px',
|
|
10
|
+
s4: '4px',
|
|
11
|
+
s6: '6px',
|
|
12
|
+
s8: '8px',
|
|
13
|
+
s12: '12px',
|
|
14
|
+
s16: '16px',
|
|
15
|
+
s20: '20px',
|
|
16
|
+
s24: '24px',
|
|
17
|
+
s28: '28px',
|
|
18
|
+
s32: '32px',
|
|
19
|
+
s36: '36px',
|
|
20
|
+
s40: '40px',
|
|
21
|
+
s44: '44px',
|
|
22
|
+
s48: '48px',
|
|
23
|
+
s52: '52px',
|
|
24
|
+
s56: '56px',
|
|
25
|
+
s60: '60px',
|
|
26
|
+
s64: '64px',
|
|
27
|
+
s72: '72px',
|
|
28
|
+
s80: '80px',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const margin = {
|
|
32
|
+
m0: 0,
|
|
33
|
+
m2: baseSizes.s2,
|
|
34
|
+
m4: baseSizes.s4,
|
|
35
|
+
m6: baseSizes.s6,
|
|
36
|
+
m8: baseSizes.s8,
|
|
37
|
+
m12: baseSizes.s12,
|
|
38
|
+
m16: baseSizes.s16,
|
|
39
|
+
m20: baseSizes.s20,
|
|
40
|
+
m24: baseSizes.s24,
|
|
41
|
+
m32: baseSizes.s32,
|
|
42
|
+
m40: baseSizes.s40,
|
|
43
|
+
m48: baseSizes.s48,
|
|
44
|
+
m56: baseSizes.s56,
|
|
45
|
+
m64: baseSizes.s64,
|
|
46
|
+
m72: baseSizes.s72,
|
|
47
|
+
m80: baseSizes.s80,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const padding = {
|
|
51
|
+
p0: 0,
|
|
52
|
+
p2: baseSizes.s2,
|
|
53
|
+
p4: baseSizes.s4,
|
|
54
|
+
p6: baseSizes.s6,
|
|
55
|
+
p8: baseSizes.s8,
|
|
56
|
+
p12: baseSizes.s12,
|
|
57
|
+
p16: baseSizes.s16,
|
|
58
|
+
p20: baseSizes.s20,
|
|
59
|
+
p24: baseSizes.s24,
|
|
60
|
+
p32: baseSizes.s32,
|
|
61
|
+
p40: baseSizes.s40,
|
|
62
|
+
p48: baseSizes.s48,
|
|
63
|
+
p56: baseSizes.s56,
|
|
64
|
+
p64: baseSizes.s64,
|
|
65
|
+
p72: baseSizes.s72,
|
|
66
|
+
p80: baseSizes.s80,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const breakpoints = {
|
|
70
|
+
mobile: 320,
|
|
71
|
+
tablet: 672,
|
|
72
|
+
desktop: 1056,
|
|
73
|
+
desktopLarge: 1536,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const createMediaQuery = (breakpoint: number) =>
|
|
77
|
+
// Breakpoints apply at the specified width and above
|
|
78
|
+
`@media (min-width: ${breakpoint}px)`;
|
|
79
|
+
|
|
80
|
+
const custom = (breakpoint: number) =>
|
|
81
|
+
// Fallback for edge cases
|
|
82
|
+
createMediaQuery(breakpoint);
|
|
83
|
+
|
|
84
|
+
const mq = {
|
|
85
|
+
mobile: createMediaQuery(breakpoints.mobile),
|
|
86
|
+
tablet: createMediaQuery(breakpoints.tablet),
|
|
87
|
+
desktop: createMediaQuery(breakpoints.desktop),
|
|
88
|
+
desktopLarge: createMediaQuery(breakpoints.desktopLarge),
|
|
89
|
+
custom,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const theme = {
|
|
93
|
+
// new
|
|
94
|
+
primitiveColour,
|
|
95
|
+
colour: originalColour,
|
|
96
|
+
typography,
|
|
97
|
+
|
|
98
|
+
// to deprecate
|
|
99
|
+
color,
|
|
100
|
+
|
|
101
|
+
thickness: {
|
|
102
|
+
t1: baseSizes.s1,
|
|
103
|
+
t2: baseSizes.s2,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
width: {
|
|
107
|
+
h16: baseSizes.s16,
|
|
108
|
+
h20: baseSizes.s20,
|
|
109
|
+
h24: baseSizes.s24,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
height: {
|
|
113
|
+
h16: baseSizes.s16,
|
|
114
|
+
h20: baseSizes.s20,
|
|
115
|
+
h24: baseSizes.s24,
|
|
116
|
+
h32: baseSizes.s32,
|
|
117
|
+
h36: baseSizes.s36,
|
|
118
|
+
h40: baseSizes.s40,
|
|
119
|
+
h80: baseSizes.s80,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
margin,
|
|
123
|
+
|
|
124
|
+
padding,
|
|
125
|
+
|
|
126
|
+
radius: {
|
|
127
|
+
r2: baseSizes.s2,
|
|
128
|
+
r4: baseSizes.s4,
|
|
129
|
+
r8: baseSizes.s8,
|
|
130
|
+
r12: baseSizes.s12,
|
|
131
|
+
r16: baseSizes.s16,
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
border: {
|
|
135
|
+
b1: baseSizes.s1,
|
|
136
|
+
b2: baseSizes.s2,
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
outline: {
|
|
140
|
+
o2: baseSizes.s2,
|
|
141
|
+
o4: baseSizes.s4,
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
font: {
|
|
145
|
+
family: {
|
|
146
|
+
primary: 'Helvetica, "Helvetica Neue", Arial, sans-serif',
|
|
147
|
+
secondary:
|
|
148
|
+
'Garamond, Baskerville, "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif',
|
|
149
|
+
fixed: 'Courier, fixed',
|
|
150
|
+
},
|
|
151
|
+
size: {
|
|
152
|
+
f12: '12px',
|
|
153
|
+
f14: '14px', // Font should be at least 14px in most cases
|
|
154
|
+
f16: '16px', // Prefer 16px to 14px in most cases
|
|
155
|
+
f18: '18px',
|
|
156
|
+
f20: '20px',
|
|
157
|
+
f22: '22px',
|
|
158
|
+
f24: '24px',
|
|
159
|
+
f26: '26px',
|
|
160
|
+
f28: '28px',
|
|
161
|
+
f30: '30px',
|
|
162
|
+
f32: '32px',
|
|
163
|
+
f36: '36px',
|
|
164
|
+
f40: '40px',
|
|
165
|
+
},
|
|
166
|
+
weight: {
|
|
167
|
+
light: 300,
|
|
168
|
+
regular: 400,
|
|
169
|
+
medium: 500,
|
|
170
|
+
semiBold: 600,
|
|
171
|
+
bold: 700,
|
|
172
|
+
extraBold: 800,
|
|
173
|
+
},
|
|
174
|
+
lineHeight: {
|
|
175
|
+
h100: '100%',
|
|
176
|
+
h110: '110%',
|
|
177
|
+
h120: '120%',
|
|
178
|
+
h130: '130%',
|
|
179
|
+
h140: '140%',
|
|
180
|
+
h150: '150%',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
boxShadow: {
|
|
185
|
+
// offset-x | offset-y | blur-radius | spread-radius | color
|
|
186
|
+
y1: '0 1px 4px 1px rgba(0, 0, 0, 0.1)',
|
|
187
|
+
y2: '0 2px 4px 1px rgba(0, 0, 0, 0.1)',
|
|
188
|
+
x2y4: '2px 4px 8px 4px rgba(0, 0, 0, 0.1)',
|
|
189
|
+
focus: `0px 0px 0px 2px ${color.neutral.white}, 0px 0px 0px 4px ${color.neutral.black}, 0px 0px 0px 6px ${color.system.orange70}`,
|
|
190
|
+
active: `0px 6px 0px 0px ${color.interaction.blue80} inset`,
|
|
191
|
+
destructiveActive: `0px 6px 0px 0px ${color.system.red100} inset`,
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
breakpoints,
|
|
195
|
+
mq,
|
|
196
|
+
|
|
197
|
+
// For ease of use, margin and padding are added at the top level
|
|
198
|
+
// Usage: margin-top: ${theme.m16};
|
|
199
|
+
...margin,
|
|
200
|
+
...padding,
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type ThemeType = typeof theme;
|
|
204
|
+
export type DisplayColoursType = typeof displayColours;
|
|
205
|
+
export type BlackAndWhiteColoursType = typeof blackAndWhite;
|
|
206
|
+
|
|
207
|
+
export default theme;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { tokens } from 'design-system-foundations-public';
|
|
2
|
+
import tokenToHex from '../../utils/addAlphaToHex';
|
|
3
|
+
import color from './color';
|
|
4
|
+
|
|
5
|
+
const { light: lightThemeTokens } = tokens;
|
|
6
|
+
|
|
7
|
+
// UCL Original Theme Colours - in new format
|
|
8
|
+
|
|
9
|
+
const bg = {
|
|
10
|
+
default: tokenToHex(lightThemeTokens.colour.bg.default.$value),
|
|
11
|
+
brand: tokenToHex(lightThemeTokens.colour.bg.brand.$value),
|
|
12
|
+
inverse: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.bg.inverse.$value),
|
|
13
|
+
inversePrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.bg['inverse-primary'].$value),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const border = {
|
|
17
|
+
default: tokenToHex(lightThemeTokens.colour.border.default.$value),
|
|
18
|
+
brand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.border.brand.$value),
|
|
19
|
+
brandHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.border['brand-hover'].$value),
|
|
20
|
+
brandSubtle: color.base.blue20Alt, // tokenToHex(lightThemeTokens.colour.border['brand-subtle'].$value),
|
|
21
|
+
primary: tokenToHex(lightThemeTokens.colour.border.primary.$value),
|
|
22
|
+
secondary: tokenToHex(lightThemeTokens.colour.border.secondary.$value),
|
|
23
|
+
tertiary: tokenToHex(lightThemeTokens.colour.border.tertiary.$value),
|
|
24
|
+
subtle: tokenToHex(lightThemeTokens.colour.border.subtle.$value),
|
|
25
|
+
disabled: tokenToHex(lightThemeTokens.colour.border.disabled.$value),
|
|
26
|
+
inverse: tokenToHex(lightThemeTokens.colour.border.inverse.$value),
|
|
27
|
+
brandInverse: tokenToHex(
|
|
28
|
+
lightThemeTokens.colour.border['brand-inverse'].$value
|
|
29
|
+
),
|
|
30
|
+
brandInverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.border['brand-inverse-secondary'].$value),
|
|
31
|
+
focus: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.border.focus.$value),
|
|
32
|
+
success: color.system.green70, // tokenToHex(lightThemeTokens.colour.border.success.$value),
|
|
33
|
+
critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.border.critical.$value),
|
|
34
|
+
warning: color.system.orange70, // tokenToHex(lightThemeTokens.colour.border.warning.$value),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const fill = {
|
|
38
|
+
default: tokenToHex(lightThemeTokens.colour.fill.default.$value),
|
|
39
|
+
hover: tokenToHex(lightThemeTokens.colour.fill.hover.$value),
|
|
40
|
+
brand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.fill.brand.$value),
|
|
41
|
+
brandHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.fill['brand-hover'].$value),
|
|
42
|
+
brandPressed: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.fill['brand-pressed'].$value),
|
|
43
|
+
brandSubtleSelected: color.interaction.blue10, // tokenToHex(lightThemeTokens.colour.fill['brand-subtle-selected'].$value),
|
|
44
|
+
brandSubtleHover: color.interaction.blue10, // tokenToHex(lightThemeTokens.colour.fill['brand-subtle-hover'].$value),
|
|
45
|
+
brandPrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.fill['brand-primary'].$value),
|
|
46
|
+
disabled: tokenToHex(lightThemeTokens.colour.fill.disabled.$value),
|
|
47
|
+
inverse: tokenToHex(lightThemeTokens.colour.fill.inverse.$value),
|
|
48
|
+
brandInverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.fill['brand-inverse-secondary'].$value),
|
|
49
|
+
inverseHover: color.base.blue20Alt, // tokenToHex(lightThemeTokens.colour.fill['inverse-hover'].$value),
|
|
50
|
+
critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.fill.critical.$value),
|
|
51
|
+
criticalHover: color.base.red80, // tokenToHex(lightThemeTokens.colour.fill['critical-hover'].$value),
|
|
52
|
+
criticalSelected: color.base.red80, // tokenToHex(lightThemeTokens.colour.fill['critical-selected'].$value),
|
|
53
|
+
criticalPressed: color.base.red90, // tokenToHex(lightThemeTokens.colour.fill['critical-pressed'].$value),
|
|
54
|
+
warning: tokenToHex(lightThemeTokens.colour.fill.warning.$value),
|
|
55
|
+
warningHover: tokenToHex(
|
|
56
|
+
lightThemeTokens.colour.fill['warning-hover'].$value
|
|
57
|
+
),
|
|
58
|
+
warningSelected: tokenToHex(
|
|
59
|
+
lightThemeTokens.colour.fill['warning-selected'].$value
|
|
60
|
+
),
|
|
61
|
+
warningPressed: tokenToHex(
|
|
62
|
+
lightThemeTokens.colour.fill['warning-pressed'].$value
|
|
63
|
+
),
|
|
64
|
+
success: color.system.green70, // tokenToHex(lightThemeTokens.colour.fill.success.$value),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const icon = {
|
|
68
|
+
default: tokenToHex(lightThemeTokens.colour.icon.default.$value),
|
|
69
|
+
hover: tokenToHex(lightThemeTokens.colour.icon.hover.$value),
|
|
70
|
+
secondary: tokenToHex(lightThemeTokens.colour.icon.secondary.$value),
|
|
71
|
+
tertiary: tokenToHex(lightThemeTokens.colour.icon.tertiary.$value),
|
|
72
|
+
disabled: tokenToHex(lightThemeTokens.colour.icon.disabled.$value),
|
|
73
|
+
disabledOnBgFill: tokenToHex(
|
|
74
|
+
lightThemeTokens.colour.icon['disabled-on-bg-fill'].$value
|
|
75
|
+
),
|
|
76
|
+
brand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.icon.brand.$value),
|
|
77
|
+
brandHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.icon['brand-hover'].$value),
|
|
78
|
+
brandSelectedOnBgFill: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.icon['brand-selected-on-bg-fill'].$value),
|
|
79
|
+
visited: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.icon.visited.$value),
|
|
80
|
+
brandPrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.icon['brand-primary'].$value),
|
|
81
|
+
brandInverted: tokenToHex(
|
|
82
|
+
lightThemeTokens.colour.icon['brand-inverted'].$value
|
|
83
|
+
),
|
|
84
|
+
inverse: tokenToHex(lightThemeTokens.colour.icon.inverse.$value),
|
|
85
|
+
inverseHover: tokenToHex(
|
|
86
|
+
lightThemeTokens.colour.icon['inverse-hover'].$value
|
|
87
|
+
),
|
|
88
|
+
brandInverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.icon['brand-inverse-secondary'].$value),
|
|
89
|
+
inverseTertiary: tokenToHex(
|
|
90
|
+
lightThemeTokens.colour.icon['inverse-tertiary'].$value
|
|
91
|
+
),
|
|
92
|
+
inverseDisabled: tokenToHex(
|
|
93
|
+
lightThemeTokens.colour.icon['inverse-disabled'].$value
|
|
94
|
+
),
|
|
95
|
+
critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.icon.critical.$value),
|
|
96
|
+
criticalOnBgFill: color.base.red80, // tokenToHex(lightThemeTokens.colour.icon['critical-on-bg-fill'].$value),
|
|
97
|
+
success: color.system.green70, // tokenToHex(lightThemeTokens.colour.icon.success.$value),
|
|
98
|
+
successOnBgFill: tokenToHex(
|
|
99
|
+
lightThemeTokens.colour.icon['success-on-bg-fill'].$value
|
|
100
|
+
),
|
|
101
|
+
warning: tokenToHex(lightThemeTokens.colour.icon.warning.$value),
|
|
102
|
+
warningOnBgFill: tokenToHex(
|
|
103
|
+
lightThemeTokens.colour.icon['warning-on-bg-fill'].$value
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const surface = {
|
|
108
|
+
default: tokenToHex(lightThemeTokens.colour.surface.default.$value),
|
|
109
|
+
primary: tokenToHex(lightThemeTokens.colour.surface.primary.$value),
|
|
110
|
+
secondary: tokenToHex(lightThemeTokens.colour.surface.secondary.$value),
|
|
111
|
+
brand: color.base.blue15, // tokenToHex(lightThemeTokens.colour.surface.brand.$value),
|
|
112
|
+
brandHover: color.interaction.blue10, // tokenToHex(lightThemeTokens.colour.surface['brand-hover'].$value),
|
|
113
|
+
brandSelected: color.interaction.blue10, // tokenToHex(lightThemeTokens.colour.surface['brand-selected'].$value),
|
|
114
|
+
warning: color.system.orange10, // tokenToHex(lightThemeTokens.colour.surface.warning.$value),
|
|
115
|
+
success: color.system.green10, // tokenToHex(lightThemeTokens.colour.surface.success.$value),
|
|
116
|
+
critical: color.system.red10, // tokenToHex(lightThemeTokens.colour.surface.critical.$value),
|
|
117
|
+
hover: tokenToHex(lightThemeTokens.colour.surface.hover.$value),
|
|
118
|
+
selected: tokenToHex(lightThemeTokens.colour.surface.selected.$value),
|
|
119
|
+
disabled: tokenToHex(lightThemeTokens.colour.surface.disabled.$value),
|
|
120
|
+
tertiary: tokenToHex(lightThemeTokens.colour.surface.tertiary.$value),
|
|
121
|
+
inverseBrand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.surface['inverse-brand'].$value),
|
|
122
|
+
inverseBrandPrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.surface['inverse-brand-primary'].$value),
|
|
123
|
+
backdrop: tokenToHex(lightThemeTokens.colour.surface.backdrop.$value),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const text = {
|
|
127
|
+
default: tokenToHex(lightThemeTokens.colour.text.default.$value),
|
|
128
|
+
secondary: tokenToHex(lightThemeTokens.colour.text.secondary.$value),
|
|
129
|
+
tertiary: tokenToHex(lightThemeTokens.colour.text.tertiary.$value),
|
|
130
|
+
disabled: tokenToHex(lightThemeTokens.colour.text.disabled.$value),
|
|
131
|
+
inverse: tokenToHex(lightThemeTokens.colour.text.inverse.$value),
|
|
132
|
+
onBgFillDisabled: tokenToHex(
|
|
133
|
+
lightThemeTokens.colour.text['on-bg-fill-disabled'].$value
|
|
134
|
+
),
|
|
135
|
+
brand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.text.brand.$value),
|
|
136
|
+
brandAccent: tokenToHex(lightThemeTokens.colour.text['brand-accent'].$value),
|
|
137
|
+
brandHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.text['brand-hover'].$value),
|
|
138
|
+
brandInverse: tokenToHex(
|
|
139
|
+
lightThemeTokens.colour.text['brand-inverse'].$value
|
|
140
|
+
),
|
|
141
|
+
brandInverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.text['brand-inverse-secondary'].$value),
|
|
142
|
+
brandPrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.text['brand-primary'].$value),
|
|
143
|
+
critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.text.critical.$value),
|
|
144
|
+
warningOnBgFill: tokenToHex(
|
|
145
|
+
lightThemeTokens.colour.text['warning-on-bg-fill'].$value
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const link = {
|
|
150
|
+
default: tokenToHex(lightThemeTokens.colour.link.default.$value),
|
|
151
|
+
brand: color.interaction.blue70, // tokenToHex(lightThemeTokens.colour.link.brand.$value),
|
|
152
|
+
brandHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.link['brand-hover'].$value),
|
|
153
|
+
visited: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.link.visited.$value),
|
|
154
|
+
primary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.link.primary.$value),
|
|
155
|
+
primaryHover: color.interaction.blue80, // tokenToHex(lightThemeTokens.colour.link['primary-hover'].$value),
|
|
156
|
+
disabled: tokenToHex(lightThemeTokens.colour.link.disabled.$value),
|
|
157
|
+
inverse: tokenToHex(lightThemeTokens.colour.link.inverse.$value),
|
|
158
|
+
inverseVisited: color.base.blue15, // tokenToHex(lightThemeTokens.colour.link['inverse-visited'].$value),
|
|
159
|
+
inverseDisabled: tokenToHex(
|
|
160
|
+
lightThemeTokens.colour.link['inverse-disabled'].$value
|
|
161
|
+
),
|
|
162
|
+
inverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.link['inverse-secondary'].$value),
|
|
163
|
+
inverseTertiary: tokenToHex(
|
|
164
|
+
lightThemeTokens.colour.link['inverse-tertiary'].$value
|
|
165
|
+
),
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const speciality = {
|
|
169
|
+
inputDefault: tokenToHex(
|
|
170
|
+
lightThemeTokens.colour.speciality['input-default'].$value
|
|
171
|
+
),
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const colour = {
|
|
175
|
+
bg,
|
|
176
|
+
border,
|
|
177
|
+
fill,
|
|
178
|
+
icon,
|
|
179
|
+
surface,
|
|
180
|
+
text,
|
|
181
|
+
link,
|
|
182
|
+
speciality,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default colour;
|
package/lib/theme/useTheme.tsx
CHANGED
|
@@ -1,24 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
import { createContext, useState, useContext, ReactNode } from 'react';
|
|
2
|
+
import { Global, css } from '@emotion/react';
|
|
3
|
+
import { ThemeType } from './original/defaultTheme';
|
|
4
|
+
import theme from './original/defaultTheme';
|
|
5
|
+
import { uikitFontUrls } from './fonts';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
useState,
|
|
6
|
-
useContext,
|
|
7
|
-
ReactNode,
|
|
8
|
-
} from 'react';
|
|
7
|
+
const useThemeState = (initialTheme: ThemeType = theme as ThemeType) =>
|
|
8
|
+
useState(initialTheme);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const ThemeContext = createContext<ReturnType<typeof useThemeState> | null>(
|
|
11
|
+
null
|
|
12
|
+
);
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const fontFaces = css`
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'DM Sans';
|
|
17
|
+
src: url(${uikitFontUrls.dmSansNormal}) format('woff2');
|
|
18
|
+
font-weight: 100 1000;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-display: swap;
|
|
21
|
+
}
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: 'DM Sans';
|
|
24
|
+
src: url(${uikitFontUrls.dmSansItalic}) format('woff2');
|
|
25
|
+
font-weight: 100 1000;
|
|
26
|
+
font-style: italic;
|
|
27
|
+
font-display: swap;
|
|
28
|
+
}
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: 'DM Mono';
|
|
31
|
+
src: url(${uikitFontUrls.dmMonoItalic}) format('woff2');
|
|
32
|
+
font-weight: 400;
|
|
33
|
+
font-style: italic;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
}
|
|
36
|
+
@font-face {
|
|
37
|
+
font-family: 'DM Mono';
|
|
38
|
+
src: url(${uikitFontUrls.dmMonoLight}) format('woff2');
|
|
39
|
+
font-weight: 300;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-display: swap;
|
|
42
|
+
}
|
|
43
|
+
@font-face {
|
|
44
|
+
font-family: 'DM Mono';
|
|
45
|
+
src: url(${uikitFontUrls.dmMonoLightItalic}) format('woff2');
|
|
46
|
+
font-weight: 300;
|
|
47
|
+
font-style: italic;
|
|
48
|
+
font-display: swap;
|
|
49
|
+
}
|
|
50
|
+
@font-face {
|
|
51
|
+
font-family: 'DM Mono';
|
|
52
|
+
src: url(${uikitFontUrls.dmMonoMedium}) format('woff2');
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-display: swap;
|
|
56
|
+
}
|
|
57
|
+
@font-face {
|
|
58
|
+
font-family: 'DM Mono';
|
|
59
|
+
src: url(${uikitFontUrls.dmMonoMediumItalic}) format('woff2');
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-style: italic;
|
|
62
|
+
font-display: swap;
|
|
63
|
+
}
|
|
64
|
+
@font-face {
|
|
65
|
+
font-family: 'DM Mono';
|
|
66
|
+
src: url(${uikitFontUrls.dmMonoRegular}) format('woff2');
|
|
67
|
+
font-weight: 400;
|
|
68
|
+
font-style: normal;
|
|
69
|
+
font-display: swap;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
17
72
|
|
|
18
73
|
export const ThemeContextProvider: React.FC<{
|
|
19
74
|
children: ReactNode;
|
|
20
|
-
|
|
21
|
-
|
|
75
|
+
initialTheme?: ThemeType;
|
|
76
|
+
}> = ({ children, initialTheme }) => (
|
|
77
|
+
<ThemeContext.Provider value={useThemeState(initialTheme)}>
|
|
78
|
+
<Global styles={fontFaces} />
|
|
22
79
|
{children}
|
|
23
80
|
</ThemeContext.Provider>
|
|
24
81
|
);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import announce, { __resetForTesting } from '../announce';
|
|
4
|
+
|
|
5
|
+
describe('announce (ARIA live region)', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
// Reset DOM before each test
|
|
8
|
+
document.body.innerHTML = '';
|
|
9
|
+
__resetForTesting();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
vi.useRealTimers();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('creates a live region on first announce', async () => {
|
|
17
|
+
announce('Hello world');
|
|
18
|
+
|
|
19
|
+
const region = await screen.findByTestId('aria-live-region');
|
|
20
|
+
|
|
21
|
+
expect(region).toBeTruthy();
|
|
22
|
+
expect(region.getAttribute('aria-live')).toBe('polite');
|
|
23
|
+
expect(region.getAttribute('aria-atomic')).toBe('true');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('visually hides the live region but keeps it accessible', async () => {
|
|
27
|
+
announce('Hidden message');
|
|
28
|
+
|
|
29
|
+
const region = await screen.findByTestId('aria-live-region');
|
|
30
|
+
|
|
31
|
+
expect(region.style.position).toBe('absolute');
|
|
32
|
+
expect(region.style.left).toBe('-9999px');
|
|
33
|
+
expect(region.style.width).toBe('1px');
|
|
34
|
+
expect(region.style.height).toBe('1px');
|
|
35
|
+
expect(region.style.overflow).toBe('hidden');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('clears text and sets message after timeout', async () => {
|
|
39
|
+
announce('This is an announcement');
|
|
40
|
+
|
|
41
|
+
const region = await screen.findByTestId('aria-live-region');
|
|
42
|
+
|
|
43
|
+
await waitFor(() => {
|
|
44
|
+
expect(region.textContent).toBe('This is an announcement');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('reuses the same live region on multiple announcements', async () => {
|
|
49
|
+
announce('First message');
|
|
50
|
+
|
|
51
|
+
const region = await screen.findByTestId('aria-live-region');
|
|
52
|
+
|
|
53
|
+
expect(region).toBeTruthy();
|
|
54
|
+
|
|
55
|
+
announce('Second message');
|
|
56
|
+
|
|
57
|
+
// Query all instances
|
|
58
|
+
const allRegions = await screen.findAllByTestId('aria-live-region');
|
|
59
|
+
|
|
60
|
+
expect(allRegions.length).toBe(1);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('queues multiple announcements and processes sequentially', async () => {
|
|
64
|
+
vi.useFakeTimers();
|
|
65
|
+
|
|
66
|
+
announce('First message');
|
|
67
|
+
announce('Second message');
|
|
68
|
+
|
|
69
|
+
// Query the live region
|
|
70
|
+
const region = document.querySelector(
|
|
71
|
+
'[data-testid="aria-live-region"]'
|
|
72
|
+
) as HTMLElement;
|
|
73
|
+
|
|
74
|
+
// Initially empty
|
|
75
|
+
expect(region.textContent).toBe('');
|
|
76
|
+
|
|
77
|
+
// After 100ms, first message appears
|
|
78
|
+
vi.advanceTimersByTime(100);
|
|
79
|
+
expect(region.textContent).toBe('First message');
|
|
80
|
+
|
|
81
|
+
// Second message should NOT appear yet (need to wait 1000ms + 100ms more)
|
|
82
|
+
vi.advanceTimersByTime(500);
|
|
83
|
+
expect(region.textContent).toBe('First message');
|
|
84
|
+
|
|
85
|
+
// After remaining 500ms of the 1000ms delay, queue processes but text is cleared
|
|
86
|
+
vi.advanceTimersByTime(500);
|
|
87
|
+
expect(region.textContent).toBe('');
|
|
88
|
+
|
|
89
|
+
// After another 100ms, second message appears
|
|
90
|
+
vi.advanceTimersByTime(100);
|
|
91
|
+
expect(region.textContent).toBe('Second message');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('duplicate prevention while currently announcing', async () => {
|
|
95
|
+
vi.useFakeTimers();
|
|
96
|
+
|
|
97
|
+
announce('Processing');
|
|
98
|
+
announce('Processing'); // Duplicate - should be ignored
|
|
99
|
+
announce('Processing'); // Duplicate - should be ignored
|
|
100
|
+
announce('Done'); // Different message - should be queued
|
|
101
|
+
|
|
102
|
+
const region = document.querySelector(
|
|
103
|
+
'[data-testid="aria-live-region"]'
|
|
104
|
+
) as HTMLElement;
|
|
105
|
+
|
|
106
|
+
// First message appears
|
|
107
|
+
vi.advanceTimersByTime(100);
|
|
108
|
+
expect(region.textContent).toBe('Processing');
|
|
109
|
+
|
|
110
|
+
// Complete first message, next should be "Done" (duplicates were ignored)
|
|
111
|
+
vi.advanceTimersByTime(1000);
|
|
112
|
+
vi.advanceTimersByTime(100);
|
|
113
|
+
expect(region.textContent).toBe('Done');
|
|
114
|
+
|
|
115
|
+
// No more messages in queue
|
|
116
|
+
vi.advanceTimersByTime(1000);
|
|
117
|
+
vi.advanceTimersByTime(100);
|
|
118
|
+
// Still "Done" - nothing else was queued
|
|
119
|
+
expect(region.textContent).toBe('Done');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const tokenToHex = (token: { hex: string; alpha?: number }) => {
|
|
2
|
+
|
|
3
|
+
const { hex, alpha } = token;
|
|
4
|
+
|
|
5
|
+
const effectiveAlpha = alpha ?? 1;
|
|
6
|
+
|
|
7
|
+
if (isNaN(effectiveAlpha) || effectiveAlpha === 1) {
|
|
8
|
+
return hex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const clean = hex.replace('#', '');
|
|
12
|
+
|
|
13
|
+
// Convert #RGB to #RRGGBB
|
|
14
|
+
const normalized =
|
|
15
|
+
clean.length === 3
|
|
16
|
+
? clean.split('').map((c) => c + c).join('')
|
|
17
|
+
: clean.slice(0, 6);
|
|
18
|
+
|
|
19
|
+
if (!effectiveAlpha || effectiveAlpha === 1) return `#${normalized}`;
|
|
20
|
+
|
|
21
|
+
const alphaHex = Math.round(effectiveAlpha * 255)
|
|
22
|
+
.toString(16)
|
|
23
|
+
.padStart(2, '0')
|
|
24
|
+
.toUpperCase();
|
|
25
|
+
|
|
26
|
+
return `#${normalized}${alphaHex}`;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default tokenToHex;
|