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,40 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { cx } from '@emotion/css';
|
|
3
|
+
import IconButton, { IconButtonProps } from '../../IconButton';
|
|
4
|
+
import { useAppMenu } from '../Menu.context';
|
|
5
|
+
import { Icon } from '../..';
|
|
6
|
+
|
|
7
|
+
export const NAME = 'ucl-uikit-menu__trigger--icon';
|
|
8
|
+
export const DEFAULT_ARIA_LABEL = 'Menu button';
|
|
9
|
+
|
|
10
|
+
export interface IconMenuTriggerProps extends IconButtonProps {
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const IconMenuTrigger = ({
|
|
15
|
+
id = 'menu-trigger',
|
|
16
|
+
ariaLabel = DEFAULT_ARIA_LABEL,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: IconMenuTriggerProps) => {
|
|
20
|
+
const { toggleMenu, isOpen, triggerRef } = useAppMenu();
|
|
21
|
+
|
|
22
|
+
const style = cx(NAME, className);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<IconButton
|
|
26
|
+
id={id}
|
|
27
|
+
ref={triggerRef}
|
|
28
|
+
className={style}
|
|
29
|
+
onClick={toggleMenu}
|
|
30
|
+
aria-label={ariaLabel}
|
|
31
|
+
aria-haspopup='true'
|
|
32
|
+
aria-expanded={isOpen ? 'true' : 'false'}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
<Icon.Menu/>
|
|
36
|
+
</IconButton>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default memo(IconMenuTrigger);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { useArgs } from '@storybook/preview-api';
|
|
3
|
+
import NativeDatepicker from './NativeDatepicker';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/NativeDatepicker',
|
|
7
|
+
component: NativeDatepicker,
|
|
8
|
+
parameters: { layout: 'padded' },
|
|
9
|
+
argTypes: {
|
|
10
|
+
value: { control: { type: 'date' } },
|
|
11
|
+
minDate: { control: { type: 'date' } },
|
|
12
|
+
maxDate: { control: { type: 'date' } },
|
|
13
|
+
disabled: { control: { type: 'boolean' } },
|
|
14
|
+
},
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
} satisfies Meta<typeof NativeDatepicker>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => {
|
|
23
|
+
const [args, updateArgs] = useArgs();
|
|
24
|
+
|
|
25
|
+
// Storybook controls provide UNIX timestamps for dates, need to convert
|
|
26
|
+
// https://storybook.js.org/docs/essentials/controls#annotation
|
|
27
|
+
args.value = args.value ? new Date(args.value) : null;
|
|
28
|
+
args.minDate = args.minDate
|
|
29
|
+
? new Date(args.minDate).toLocaleDateString('sv-SE')
|
|
30
|
+
: null;
|
|
31
|
+
args.maxDate = args.maxDate
|
|
32
|
+
? new Date(args.maxDate).toLocaleDateString('sv-SE')
|
|
33
|
+
: null;
|
|
34
|
+
|
|
35
|
+
const onValueChange = (value: Date | null) => updateArgs({ value: value });
|
|
36
|
+
return (
|
|
37
|
+
<NativeDatepicker
|
|
38
|
+
{...args}
|
|
39
|
+
onValueChange={onValueChange}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Disabled: Story = {
|
|
46
|
+
name: 'Disabled',
|
|
47
|
+
args: {
|
|
48
|
+
disabled: true,
|
|
49
|
+
value: new Date(2025, 2, 10),
|
|
50
|
+
},
|
|
51
|
+
render: (args) => <NativeDatepicker {...args} />,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const WithMinMaxDates: Story = {
|
|
55
|
+
name: 'With min and max dates',
|
|
56
|
+
args: {
|
|
57
|
+
// Initialise min date as 5 days into the current month
|
|
58
|
+
minDate: (() => {
|
|
59
|
+
const now = new Date();
|
|
60
|
+
return new Date(now.getFullYear(), now.getMonth(), 5).toLocaleDateString(
|
|
61
|
+
'sv-SE'
|
|
62
|
+
);
|
|
63
|
+
})(),
|
|
64
|
+
// Initialise max date as 5 days before the last day of the current month
|
|
65
|
+
maxDate: (() => {
|
|
66
|
+
const now = new Date();
|
|
67
|
+
const lastDay = new Date(
|
|
68
|
+
now.getFullYear(),
|
|
69
|
+
now.getMonth() + 1,
|
|
70
|
+
0
|
|
71
|
+
).getDate();
|
|
72
|
+
return new Date(
|
|
73
|
+
now.getFullYear(),
|
|
74
|
+
now.getMonth(),
|
|
75
|
+
lastDay - 5
|
|
76
|
+
).toLocaleDateString('sv-SE');
|
|
77
|
+
})(),
|
|
78
|
+
},
|
|
79
|
+
render: () => {
|
|
80
|
+
const [args, updateArgs] = useArgs();
|
|
81
|
+
|
|
82
|
+
// Storybook controls provide UNIX timestamps for dates, need to convert
|
|
83
|
+
// https://storybook.js.org/docs/essentials/controls#annotation
|
|
84
|
+
args.value = args.value ? new Date(args.value) : null;
|
|
85
|
+
args.minDate = args.minDate
|
|
86
|
+
? new Date(args.minDate).toLocaleDateString('sv-SE')
|
|
87
|
+
: null;
|
|
88
|
+
args.maxDate = args.maxDate
|
|
89
|
+
? new Date(args.maxDate).toLocaleDateString('sv-SE')
|
|
90
|
+
: null;
|
|
91
|
+
|
|
92
|
+
const onValueChange = (value: Date | null) => updateArgs({ value: value });
|
|
93
|
+
return (
|
|
94
|
+
<NativeDatepicker
|
|
95
|
+
{...args}
|
|
96
|
+
onValueChange={onValueChange}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { css, cx } from '@emotion/css';
|
|
2
|
-
import { theme } from '
|
|
2
|
+
import { theme } from '../../theme';
|
|
3
|
+
import { dateToLocaleISOString } from './utils';
|
|
4
|
+
import type { NativeDatepickerProps } from './NativeDatepicker.types';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
-
testId?: string;
|
|
7
|
-
ref?: React.RefObject<HTMLInputElement>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const NAME = 'ucl-uikit-datepicker--native';
|
|
6
|
+
const NAME = 'ucl-uikit-native-datepicker';
|
|
11
7
|
|
|
12
8
|
const NativeDatepicker = ({
|
|
13
9
|
value,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
onValueChange,
|
|
11
|
+
minDate,
|
|
12
|
+
maxDate,
|
|
17
13
|
className,
|
|
18
14
|
disabled,
|
|
19
15
|
testId = NAME,
|
|
@@ -54,10 +50,13 @@ const NativeDatepicker = ({
|
|
|
54
50
|
return (
|
|
55
51
|
<input
|
|
56
52
|
type='date'
|
|
57
|
-
value={value}
|
|
58
|
-
onChange={
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
value={dateToLocaleISOString(value) ?? ''}
|
|
54
|
+
onChange={(event) => {
|
|
55
|
+
const dateString = event.target.value;
|
|
56
|
+
onValueChange?.(dateString ? new Date(dateString) : null, event);
|
|
57
|
+
}}
|
|
58
|
+
min={minDate || undefined}
|
|
59
|
+
max={maxDate || undefined}
|
|
61
60
|
disabled={disabled}
|
|
62
61
|
className={style}
|
|
63
62
|
data-testid={testId}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type DatepickerValue = Date | null;
|
|
4
|
+
|
|
5
|
+
export interface NativeDatepickerProps
|
|
6
|
+
extends Omit<
|
|
7
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
8
|
+
'value' | 'onChange' | 'min' | 'max'
|
|
9
|
+
> {
|
|
10
|
+
value?: DatepickerValue;
|
|
11
|
+
onValueChange?: (
|
|
12
|
+
value: DatepickerValue,
|
|
13
|
+
event?: React.SyntheticEvent
|
|
14
|
+
) => void;
|
|
15
|
+
minDate?: string | null;
|
|
16
|
+
maxDate?: string | null;
|
|
17
|
+
testId?: string;
|
|
18
|
+
ref?: RefObject<HTMLInputElement>;
|
|
19
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a Date object to a `YYYY-MM-DD` string based on the user's local timezone.
|
|
3
3
|
*
|
|
4
|
-
* Used for passing dates to <NativeDatepicker>
|
|
4
|
+
* Used for passing dates to <NativeDatepicker>
|
|
5
5
|
*
|
|
6
6
|
* This function uses the Swedish (`sv-SE`) locale with `toLocaleDateString`
|
|
7
7
|
* as it conveniently defaults to the ISO 8601 `YYYY-MM-DD` format, while respecting
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as dateToLocaleISOString } from './dateToLocaleISOString/dateToLocaleISOString';
|
|
@@ -4,12 +4,12 @@ import useTheme from '../../theme/useTheme';
|
|
|
4
4
|
import { PaginationContext } from './Pagination';
|
|
5
5
|
import Button from '../Button';
|
|
6
6
|
import getPaginationButtons from './getPaginationButtons';
|
|
7
|
+
import { useMediaQuery } from '../../hooks';
|
|
7
8
|
|
|
8
9
|
export const NAME = 'ucl-ukit-pagination__controls';
|
|
9
10
|
export const DEFAULT_MAX_BUTTONS = 9;
|
|
10
11
|
|
|
11
|
-
export interface PaginationControlsProps
|
|
12
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
export interface PaginationControlsProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
13
|
maxNumberButtons?: number;
|
|
14
14
|
testId?: string;
|
|
15
15
|
}
|
|
@@ -21,6 +21,10 @@ const PaginationControls = ({
|
|
|
21
21
|
}: PaginationControlsProps) => {
|
|
22
22
|
const [theme] = useTheme();
|
|
23
23
|
|
|
24
|
+
const isTabletPlus = useMediaQuery(
|
|
25
|
+
`(min-width: ${theme.breakpoints.tablet}px)`
|
|
26
|
+
);
|
|
27
|
+
|
|
24
28
|
const contextValue = useContext(PaginationContext);
|
|
25
29
|
|
|
26
30
|
const handlePageChange = useCallback(
|
|
@@ -48,7 +52,7 @@ const PaginationControls = ({
|
|
|
48
52
|
const paginationButtons = getPaginationButtons(
|
|
49
53
|
currentPage,
|
|
50
54
|
totalPages,
|
|
51
|
-
maxNumberButtons
|
|
55
|
+
isTabletPlus ? maxNumberButtons : 5
|
|
52
56
|
);
|
|
53
57
|
|
|
54
58
|
const baseStyle = css``;
|
|
@@ -61,37 +65,72 @@ const PaginationControls = ({
|
|
|
61
65
|
display: flex;
|
|
62
66
|
justify-content: center;
|
|
63
67
|
align-items: center;
|
|
64
|
-
gap: ${theme.margin.m8};
|
|
65
68
|
list-style: none;
|
|
66
|
-
|
|
69
|
+
gap: ${theme.margin.m4};
|
|
70
|
+
flex-wrap: nowrap;
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
@media (min-width: ${theme.breakpoints.tablet}px) {
|
|
73
|
+
gap: ${theme.margin.m8};
|
|
74
|
+
}
|
|
70
75
|
`;
|
|
71
76
|
|
|
72
|
-
const
|
|
73
|
-
|
|
77
|
+
const buttonBaseStyle = css`
|
|
78
|
+
@media (max-width: ${theme.breakpoints.tablet}px) {
|
|
79
|
+
gap: ${theme.margin.m4};
|
|
80
|
+
}
|
|
74
81
|
`;
|
|
75
82
|
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
const previousButtonStyle = cx(
|
|
84
|
+
buttonBaseStyle,
|
|
85
|
+
css`
|
|
86
|
+
margin-right: ${theme.margin.m16};
|
|
87
|
+
display: none;
|
|
88
|
+
|
|
89
|
+
@media (min-width: ${theme.breakpoints.tablet}px) {
|
|
90
|
+
display: inline-block;
|
|
91
|
+
}
|
|
92
|
+
`
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const nextButtonStyle = cx(
|
|
96
|
+
buttonBaseStyle,
|
|
97
|
+
css`
|
|
98
|
+
margin-left: ${theme.margin.m16};
|
|
99
|
+
display: none;
|
|
100
|
+
|
|
101
|
+
@media (min-width: ${theme.breakpoints.tablet}px) {
|
|
102
|
+
display: inline-block;
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const pageNumberButtonBaseStyle = cx(
|
|
108
|
+
buttonBaseStyle,
|
|
109
|
+
css`
|
|
110
|
+
height: 40px;
|
|
111
|
+
min-width: 40px;
|
|
112
|
+
padding: 0;
|
|
113
|
+
|
|
114
|
+
@media (min-width: ${theme.breakpoints.tablet}px) {
|
|
115
|
+
height: 48px;
|
|
116
|
+
min-width: 48px;
|
|
117
|
+
}
|
|
118
|
+
`
|
|
119
|
+
);
|
|
81
120
|
|
|
82
121
|
const pageNumberButtonStyle = cx(
|
|
83
122
|
pageNumberButtonBaseStyle,
|
|
84
123
|
css`
|
|
85
124
|
border: none;
|
|
86
|
-
color: ${theme.
|
|
125
|
+
color: ${theme.colour.text.secondary};
|
|
87
126
|
`
|
|
88
127
|
);
|
|
89
128
|
|
|
90
129
|
const currentPageNumberButtonStyle = cx(
|
|
91
130
|
pageNumberButtonBaseStyle,
|
|
92
131
|
css`
|
|
93
|
-
color: ${theme.
|
|
94
|
-
border-color: ${theme.
|
|
132
|
+
color: ${theme.colour.text.brand};
|
|
133
|
+
border-color: ${theme.colour.border.brand};
|
|
95
134
|
`
|
|
96
135
|
);
|
|
97
136
|
|
|
@@ -110,6 +149,7 @@ const PaginationControls = ({
|
|
|
110
149
|
<Button
|
|
111
150
|
className={previousButtonStyle}
|
|
112
151
|
variant='tertiary'
|
|
152
|
+
size={isTabletPlus ? 'default' : 'small'}
|
|
113
153
|
aria-label='Go to previous page'
|
|
114
154
|
onClick={() => handlePageChange(currentPage - 1)}
|
|
115
155
|
disabled={currentPage === 1}
|
|
@@ -128,6 +168,7 @@ const PaginationControls = ({
|
|
|
128
168
|
<Button
|
|
129
169
|
className={pageNumberButtonStyle}
|
|
130
170
|
variant='secondary'
|
|
171
|
+
size={isTabletPlus ? 'default' : 'small'}
|
|
131
172
|
aria-label={`Page ${page}`}
|
|
132
173
|
onClick={() => handlePageChange(page)}
|
|
133
174
|
>
|
|
@@ -138,6 +179,7 @@ const PaginationControls = ({
|
|
|
138
179
|
<Button
|
|
139
180
|
className={currentPageNumberButtonStyle}
|
|
140
181
|
variant='secondary'
|
|
182
|
+
size={isTabletPlus ? 'default' : 'small'}
|
|
141
183
|
aria-label={`Page ${page}, current page`}
|
|
142
184
|
aria-current='page'
|
|
143
185
|
disabled
|
|
@@ -5,8 +5,7 @@ import { PaginationContext } from './Pagination';
|
|
|
5
5
|
|
|
6
6
|
export const NAME = 'ucl-uikit-pagination__info';
|
|
7
7
|
|
|
8
|
-
export interface PaginationInfoProps
|
|
9
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
export interface PaginationInfoProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
9
|
format?: 'pages' | 'items';
|
|
11
10
|
itemsPluralName?: string;
|
|
12
11
|
testId?: string;
|
|
@@ -40,11 +39,15 @@ const PaginationInfo = ({
|
|
|
40
39
|
}[format];
|
|
41
40
|
|
|
42
41
|
const baseStyle = css`
|
|
43
|
-
margin: ${theme.margin.
|
|
42
|
+
margin: ${theme.margin.m16} 0;
|
|
44
43
|
text-align: center;
|
|
45
|
-
color: ${theme.
|
|
44
|
+
color: ${theme.colour.text.secondary};
|
|
46
45
|
font-family: ${theme.font.family.primary};
|
|
47
46
|
font-size: ${theme.font.size.f16};
|
|
47
|
+
|
|
48
|
+
@media (min-width: ${theme.breakpoints.tablet}px) {
|
|
49
|
+
margin: ${theme.margin.m24} 0;
|
|
50
|
+
}
|
|
48
51
|
`;
|
|
49
52
|
|
|
50
53
|
const style = cx(NAME, baseStyle, className);
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { memo, HTMLAttributes, JSX } from 'react';
|
|
2
|
+
import { css, cx } from '@emotion/css';
|
|
3
|
+
import useTheme from '../../theme/useTheme';
|
|
4
|
+
import marginsStyle, { MarginProps } from '../common/marginsStyle';
|
|
5
|
+
|
|
6
|
+
export const NAME = 'ucl-uikit-paragrah';
|
|
7
|
+
|
|
8
|
+
export type ParagraphLevel =
|
|
9
|
+
| 'lg'
|
|
10
|
+
| 'lg-medium'
|
|
11
|
+
| 'lg-semibold'
|
|
12
|
+
| 'lg-bold'
|
|
13
|
+
| 'md'
|
|
14
|
+
| 'md-medium'
|
|
15
|
+
| 'md-semibold'
|
|
16
|
+
| 'md-semibold'
|
|
17
|
+
| 'md-medium-numeric'
|
|
18
|
+
| 'sm'
|
|
19
|
+
| 'sm-medium'
|
|
20
|
+
| 'sm-semibold'
|
|
21
|
+
| 'xs'
|
|
22
|
+
| 'xs-medium';
|
|
23
|
+
|
|
24
|
+
export interface ParagraphBaseProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
25
|
+
level?: ParagraphLevel;
|
|
26
|
+
as?: 'p' | 'div' | 'span';
|
|
27
|
+
testId?: string;
|
|
28
|
+
ref?: React.Ref<HTMLParagraphElement>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type ParagraphProps = ParagraphBaseProps & MarginProps;
|
|
32
|
+
|
|
33
|
+
const Paragraph = ({
|
|
34
|
+
level = 'md',
|
|
35
|
+
as = 'p',
|
|
36
|
+
testId = NAME,
|
|
37
|
+
className,
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
}: ParagraphProps) => {
|
|
41
|
+
const [theme] = useTheme();
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
typography: {
|
|
45
|
+
body: {
|
|
46
|
+
lg,
|
|
47
|
+
lgMedium,
|
|
48
|
+
lgSemibold,
|
|
49
|
+
lgBold,
|
|
50
|
+
md,
|
|
51
|
+
mdMedium,
|
|
52
|
+
mdSemibold,
|
|
53
|
+
mdMediumNumeric,
|
|
54
|
+
sm,
|
|
55
|
+
smMedium,
|
|
56
|
+
smSemibold,
|
|
57
|
+
xs,
|
|
58
|
+
xsMedium,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
} = theme;
|
|
62
|
+
|
|
63
|
+
const baseStyle = css`
|
|
64
|
+
font-family: ${md.fontFamily};
|
|
65
|
+
font-feature-settings: ${md.fontSettings};
|
|
66
|
+
color: ${theme.colour.text.default};
|
|
67
|
+
margin: 0;
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const lgStyle = css`
|
|
71
|
+
font-size: ${lg.fontSize}px;
|
|
72
|
+
font-weight: ${lg.fontWeight};
|
|
73
|
+
line-height: ${lg.lineHeight}%;
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
const lgMediumStyle = css`
|
|
77
|
+
font-size: ${lgMedium.fontSize}px;
|
|
78
|
+
font-weight: ${lgMedium.fontWeight};
|
|
79
|
+
line-height: ${lgMedium.lineHeight}%;
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
const lgSemiboldStyle = css`
|
|
83
|
+
font-size: ${lgSemibold.fontSize}px;
|
|
84
|
+
font-weight: ${lgSemibold.fontWeight};
|
|
85
|
+
line-height: ${lgSemibold.lineHeight}%;
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const lgBoldStyle = css`
|
|
89
|
+
font-size: ${lgBold.fontSize}px;
|
|
90
|
+
font-weight: ${lgBold.fontWeight};
|
|
91
|
+
line-height: ${lgBold.lineHeight}%;
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
const mdStyle = css`
|
|
95
|
+
font-size: ${md.fontSize}px;
|
|
96
|
+
font-weight: ${md.fontWeight};
|
|
97
|
+
line-height: ${md.lineHeight}%;
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
const mdMediumStyle = css`
|
|
101
|
+
font-size: ${mdMedium.fontSize}px;
|
|
102
|
+
font-weight: ${mdMedium.fontWeight};
|
|
103
|
+
line-height: ${mdMedium.lineHeight}%;
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const mdSemiboldStyle = css`
|
|
107
|
+
font-size: ${mdSemibold.fontSize}px;
|
|
108
|
+
font-weight: ${mdSemibold.fontWeight};
|
|
109
|
+
line-height: ${mdSemibold.lineHeight}%;
|
|
110
|
+
`;
|
|
111
|
+
|
|
112
|
+
const mdMediumNumericStyle = css`
|
|
113
|
+
font-size: ${mdMediumNumeric.fontSize}px;
|
|
114
|
+
font-weight: ${mdMediumNumeric.fontWeight};
|
|
115
|
+
line-height: ${mdMediumNumeric.lineHeight}%;
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
const smStyle = css`
|
|
119
|
+
font-size: ${sm.fontSize}px;
|
|
120
|
+
font-weight: ${sm.fontWeight};
|
|
121
|
+
line-height: ${sm.lineHeight}%;
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
const smMediumStyle = css`
|
|
125
|
+
font-size: ${smMedium.fontSize}px;
|
|
126
|
+
font-weight: ${smMedium.fontWeight};
|
|
127
|
+
line-height: ${smMedium.lineHeight}%;
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
const smSemiboldStyle = css`
|
|
131
|
+
font-size: ${smSemibold.fontSize}px;
|
|
132
|
+
font-weight: ${smSemibold.fontWeight};
|
|
133
|
+
line-height: ${smSemibold.lineHeight}%;
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
const xsStyle = css`
|
|
137
|
+
font-size: ${xs.fontSize}px;
|
|
138
|
+
font-weight: ${xs.fontWeight};
|
|
139
|
+
line-height: ${xs.lineHeight}%;
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
const xsMediumStyle = css`
|
|
143
|
+
font-size: ${xsMedium.fontSize}px;
|
|
144
|
+
font-weight: ${xsMedium.fontWeight};
|
|
145
|
+
line-height: ${xsMedium.lineHeight}%;
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
const style = cx(
|
|
149
|
+
NAME,
|
|
150
|
+
baseStyle,
|
|
151
|
+
level === 'lg' && lgStyle,
|
|
152
|
+
level === 'lg-medium' && lgMediumStyle,
|
|
153
|
+
level === 'lg-semibold' && lgSemiboldStyle,
|
|
154
|
+
level === 'lg-bold' && lgBoldStyle,
|
|
155
|
+
level === 'md' && mdStyle,
|
|
156
|
+
level === 'md-medium' && mdMediumStyle,
|
|
157
|
+
level === 'md-semibold' && mdSemiboldStyle,
|
|
158
|
+
level === 'md-medium-numeric' && mdMediumNumericStyle,
|
|
159
|
+
level === 'sm' && smStyle,
|
|
160
|
+
level === 'sm-medium' && smMediumStyle,
|
|
161
|
+
level === 'sm-semibold' && smSemiboldStyle,
|
|
162
|
+
level === 'xs' && xsStyle,
|
|
163
|
+
level === 'xs-medium' && xsMediumStyle,
|
|
164
|
+
marginsStyle(props, theme),
|
|
165
|
+
className
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const paragraphTag = as as keyof JSX.IntrinsicElements;
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
{paragraphTag === 'p' && (
|
|
173
|
+
<p
|
|
174
|
+
ref={ref}
|
|
175
|
+
className={style}
|
|
176
|
+
data-testid={testId}
|
|
177
|
+
{...props}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
180
|
+
{paragraphTag === 'div' && (
|
|
181
|
+
<div
|
|
182
|
+
ref={ref as React.Ref<HTMLDivElement>}
|
|
183
|
+
className={style}
|
|
184
|
+
data-testid={testId}
|
|
185
|
+
{...props}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
{paragraphTag === 'span' && (
|
|
189
|
+
<span
|
|
190
|
+
ref={ref as React.Ref<HTMLSpanElement>}
|
|
191
|
+
className={style}
|
|
192
|
+
data-testid={testId}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
196
|
+
</>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export default memo(Paragraph);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './Paragraph';
|
|
2
|
+
export type { ParagraphProps } from './Paragraph';
|
|
3
|
+
// TODO: Remove aliased export in future breaking release
|
|
4
|
+
// <Paragraph> will be used in place of <Text> in the future
|
|
5
|
+
export { default as Text } from './Paragraph';
|
|
6
|
+
export type { ParagraphProps as TextProps } from './Paragraph';
|
|
@@ -64,19 +64,19 @@ const Radio = forwardRef<Ref, RadioProps>(
|
|
|
64
64
|
`;
|
|
65
65
|
|
|
66
66
|
const checkedStyle = css`
|
|
67
|
-
background-color: ${theme.
|
|
68
|
-
border-color: ${theme.
|
|
69
|
-
color: ${theme.
|
|
67
|
+
background-color: ${theme.colour.icon.brand};
|
|
68
|
+
border-color: ${theme.colour.icon.brand};
|
|
69
|
+
color: ${theme.colour.icon.inverse};
|
|
70
70
|
`;
|
|
71
71
|
|
|
72
72
|
const uncheckedStyle = css`
|
|
73
|
-
background-color: ${theme.
|
|
74
|
-
border-color: ${theme.
|
|
73
|
+
background-color: ${theme.colour.icon.inverse};
|
|
74
|
+
border-color: ${theme.colour.speciality.inputDefault};
|
|
75
75
|
`;
|
|
76
76
|
|
|
77
77
|
const disabledStyle = css`
|
|
78
|
-
background-color: ${theme.
|
|
79
|
-
border-color: ${theme.
|
|
78
|
+
background-color: ${theme.colour.icon.disabled};
|
|
79
|
+
border-color: ${theme.colour.icon.disabled};
|
|
80
80
|
cursor: not-allowed;
|
|
81
81
|
`;
|
|
82
82
|
|
|
@@ -112,7 +112,7 @@ const Radio = forwardRef<Ref, RadioProps>(
|
|
|
112
112
|
width: 12px;
|
|
113
113
|
height: 12px;
|
|
114
114
|
border-radius: 50%;
|
|
115
|
-
background-color: ${theme.
|
|
115
|
+
background-color: ${theme.colour.icon.inverse};
|
|
116
116
|
user-select: none;
|
|
117
117
|
pointer-events: none;
|
|
118
118
|
`;
|