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
|
@@ -11,6 +11,7 @@ exports[`Alert > snapshot: type=error 1`] = `
|
|
|
11
11
|
class="ucl-uikit-icon css-nysdxe"
|
|
12
12
|
data-testid="ucl-uikit-icon"
|
|
13
13
|
fill="none"
|
|
14
|
+
focusable="false"
|
|
14
15
|
height="24"
|
|
15
16
|
stroke="currentColor"
|
|
16
17
|
stroke-linecap="round"
|
|
@@ -25,17 +26,8 @@ exports[`Alert > snapshot: type=error 1`] = `
|
|
|
25
26
|
cy="12"
|
|
26
27
|
r="10"
|
|
27
28
|
/>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
x2="9"
|
|
31
|
-
y1="9"
|
|
32
|
-
y2="15"
|
|
33
|
-
/>
|
|
34
|
-
<line
|
|
35
|
-
x1="9"
|
|
36
|
-
x2="15"
|
|
37
|
-
y1="9"
|
|
38
|
-
y2="15"
|
|
29
|
+
<path
|
|
30
|
+
d="m15 9-6 6m0-6 6 6"
|
|
39
31
|
/>
|
|
40
32
|
</svg>
|
|
41
33
|
<div>
|
|
@@ -57,7 +49,7 @@ exports[`Alert > snapshot: type=error 1`] = `
|
|
|
57
49
|
|
|
58
50
|
exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
59
51
|
<div
|
|
60
|
-
class="ucl-uikit-alert css-
|
|
52
|
+
class="ucl-uikit-alert css-153fxq6"
|
|
61
53
|
data-testid="ucl-uikit-alert"
|
|
62
54
|
role="alert"
|
|
63
55
|
>
|
|
@@ -66,6 +58,7 @@ exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
|
66
58
|
class="ucl-uikit-icon css-1oh4ubr"
|
|
67
59
|
data-testid="ucl-uikit-icon"
|
|
68
60
|
fill="none"
|
|
61
|
+
focusable="false"
|
|
69
62
|
height="24"
|
|
70
63
|
stroke="currentColor"
|
|
71
64
|
stroke-linecap="round"
|
|
@@ -80,17 +73,8 @@ exports[`Alert > snapshot: type=info, no title 1`] = `
|
|
|
80
73
|
cy="12"
|
|
81
74
|
r="10"
|
|
82
75
|
/>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
x2="12"
|
|
86
|
-
y1="16"
|
|
87
|
-
y2="12"
|
|
88
|
-
/>
|
|
89
|
-
<line
|
|
90
|
-
x1="12"
|
|
91
|
-
x2="12.01"
|
|
92
|
-
y1="8"
|
|
93
|
-
y2="8"
|
|
76
|
+
<path
|
|
77
|
+
d="M12 16v-4m0-4h.01"
|
|
94
78
|
/>
|
|
95
79
|
</svg>
|
|
96
80
|
<div>
|
|
@@ -115,6 +99,7 @@ exports[`Alert > snapshot: type=success 1`] = `
|
|
|
115
99
|
class="ucl-uikit-icon css-4xbsfp"
|
|
116
100
|
data-testid="ucl-uikit-icon"
|
|
117
101
|
fill="none"
|
|
102
|
+
focusable="false"
|
|
118
103
|
height="24"
|
|
119
104
|
stroke="currentColor"
|
|
120
105
|
stroke-linecap="round"
|
|
@@ -127,8 +112,8 @@ exports[`Alert > snapshot: type=success 1`] = `
|
|
|
127
112
|
<path
|
|
128
113
|
d="M22 11.08V12a10 10 0 1 1-5.93-9.14"
|
|
129
114
|
/>
|
|
130
|
-
<
|
|
131
|
-
|
|
115
|
+
<path
|
|
116
|
+
d="M22 4 12 14.01l-3-3"
|
|
132
117
|
/>
|
|
133
118
|
</svg>
|
|
134
119
|
<div>
|
|
@@ -156,9 +141,10 @@ exports[`Alert > snapshot: type=warning 1`] = `
|
|
|
156
141
|
>
|
|
157
142
|
<svg
|
|
158
143
|
aria-label="Warning"
|
|
159
|
-
class="ucl-uikit-icon css-
|
|
144
|
+
class="ucl-uikit-icon css-1k868z9"
|
|
160
145
|
data-testid="ucl-uikit-icon"
|
|
161
146
|
fill="none"
|
|
147
|
+
focusable="false"
|
|
162
148
|
height="24"
|
|
163
149
|
stroke="currentColor"
|
|
164
150
|
stroke-linecap="round"
|
|
@@ -169,19 +155,7 @@ exports[`Alert > snapshot: type=warning 1`] = `
|
|
|
169
155
|
xmlns="http://www.w3.org/2000/svg"
|
|
170
156
|
>
|
|
171
157
|
<path
|
|
172
|
-
d="M10.29 3.
|
|
173
|
-
/>
|
|
174
|
-
<line
|
|
175
|
-
x1="12"
|
|
176
|
-
x2="12"
|
|
177
|
-
y1="9"
|
|
178
|
-
y2="13"
|
|
179
|
-
/>
|
|
180
|
-
<line
|
|
181
|
-
x1="12"
|
|
182
|
-
x2="12.01"
|
|
183
|
-
y1="17"
|
|
184
|
-
y2="17"
|
|
158
|
+
d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0M12 9v4m0 4h.01"
|
|
185
159
|
/>
|
|
186
160
|
</svg>
|
|
187
161
|
<div>
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { memo, HTMLAttributes } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import { useTheme } from '../../../lib';
|
|
4
|
-
import AppHeaderTop, {
|
|
5
|
-
HEIGHT as APP_HEADER_TOP_HEIGHT,
|
|
6
|
-
} from './AppHeaderTop';
|
|
4
|
+
import AppHeaderTop, { HEIGHT as APP_HEADER_TOP_HEIGHT } from './AppHeaderTop';
|
|
7
5
|
import AppHeaderBottom, {
|
|
8
6
|
HEIGHT as APP_HEADER_BOTTOM_HEIGHT,
|
|
9
7
|
} from './AppHeaderBottom';
|
|
10
8
|
import AppHeaderNav from './AppHeaderNav';
|
|
11
9
|
|
|
12
|
-
export const NAME = 'ucl-
|
|
10
|
+
export const NAME = 'ucl-uikit-app-header';
|
|
13
11
|
|
|
14
12
|
export const Z_INDEX = 3;
|
|
15
13
|
|
|
16
|
-
export const HEIGHT =
|
|
17
|
-
APP_HEADER_TOP_HEIGHT + APP_HEADER_BOTTOM_HEIGHT;
|
|
14
|
+
export const HEIGHT = APP_HEADER_TOP_HEIGHT + APP_HEADER_BOTTOM_HEIGHT;
|
|
18
15
|
|
|
19
|
-
export interface AppHeaderProps
|
|
20
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
17
|
fixed?: boolean;
|
|
22
18
|
sticky?: boolean;
|
|
23
19
|
testId?: string;
|
|
@@ -79,9 +75,8 @@ export interface IHeaderSubComponents {
|
|
|
79
75
|
Nav: typeof AppHeaderNav;
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
const AppHeaderWithSubComponents =
|
|
83
|
-
|
|
84
|
-
IHeaderSubComponents;
|
|
78
|
+
const AppHeaderWithSubComponents = MemoAppHeader as typeof MemoAppHeader &
|
|
79
|
+
IHeaderSubComponents;
|
|
85
80
|
|
|
86
81
|
AppHeaderWithSubComponents.Top = AppHeaderTop;
|
|
87
82
|
AppHeaderWithSubComponents.Bottom = AppHeaderBottom;
|
|
@@ -2,12 +2,11 @@ import { memo, HTMLAttributes } from 'react';
|
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import { useTheme } from '../../../lib';
|
|
4
4
|
|
|
5
|
-
export const NAME = 'ucl-
|
|
5
|
+
export const NAME = 'ucl-uikit-app-header__bottom';
|
|
6
6
|
|
|
7
7
|
export const HEIGHT = 48;
|
|
8
8
|
|
|
9
|
-
export interface AppHeaderBottomProps
|
|
10
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
export interface AppHeaderBottomProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
10
|
testId?: string;
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { memo, HTMLAttributes } from 'react';
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
|
|
4
|
-
export const NAME = 'ucl-
|
|
4
|
+
export const NAME = 'ucl-uikit-app-header__nav';
|
|
5
5
|
|
|
6
|
-
export interface AppHeaderNavProps
|
|
7
|
-
extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
export interface AppHeaderNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
7
|
testId?: string;
|
|
9
8
|
}
|
|
10
9
|
|
|
@@ -2,7 +2,7 @@ import { memo, HTMLAttributes } from 'react';
|
|
|
2
2
|
import { css, cx } from '@emotion/css';
|
|
3
3
|
import { UclLogo, useTheme } from '../../';
|
|
4
4
|
|
|
5
|
-
export const NAME = 'ucl-
|
|
5
|
+
export const NAME = 'ucl-uikit-app-header__top';
|
|
6
6
|
|
|
7
7
|
export const HEIGHT = 56;
|
|
8
8
|
|
|
@@ -19,6 +19,7 @@ exports[`AppMenu > snapshot: defaultOpen prop 1`] = `
|
|
|
19
19
|
class="ucl-uikit-icon css-148hpxb"
|
|
20
20
|
data-testid="ucl-uikit-icon"
|
|
21
21
|
fill="none"
|
|
22
|
+
focusable="false"
|
|
22
23
|
height="24"
|
|
23
24
|
stroke="currentColor"
|
|
24
25
|
stroke-linecap="round"
|
|
@@ -28,23 +29,8 @@ exports[`AppMenu > snapshot: defaultOpen prop 1`] = `
|
|
|
28
29
|
width="24"
|
|
29
30
|
xmlns="http://www.w3.org/2000/svg"
|
|
30
31
|
>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
x2="21"
|
|
34
|
-
y1="12"
|
|
35
|
-
y2="12"
|
|
36
|
-
/>
|
|
37
|
-
<line
|
|
38
|
-
x1="3"
|
|
39
|
-
x2="21"
|
|
40
|
-
y1="6"
|
|
41
|
-
y2="6"
|
|
42
|
-
/>
|
|
43
|
-
<line
|
|
44
|
-
x1="3"
|
|
45
|
-
x2="21"
|
|
46
|
-
y1="18"
|
|
47
|
-
y2="18"
|
|
32
|
+
<path
|
|
33
|
+
d="M3 12h18M3 6h18M3 18h18"
|
|
48
34
|
/>
|
|
49
35
|
</svg>
|
|
50
36
|
</button>
|
|
@@ -71,6 +57,7 @@ exports[`AppMenu > snapshot: defaultOpen prop 1`] = `
|
|
|
71
57
|
class="ucl-uikit-icon css-148hpxb"
|
|
72
58
|
data-testid="ucl-uikit-icon"
|
|
73
59
|
fill="none"
|
|
60
|
+
focusable="false"
|
|
74
61
|
height="24"
|
|
75
62
|
stroke="currentColor"
|
|
76
63
|
stroke-linecap="round"
|
|
@@ -80,8 +67,8 @@ exports[`AppMenu > snapshot: defaultOpen prop 1`] = `
|
|
|
80
67
|
width="24"
|
|
81
68
|
xmlns="http://www.w3.org/2000/svg"
|
|
82
69
|
>
|
|
83
|
-
<
|
|
84
|
-
|
|
70
|
+
<path
|
|
71
|
+
d="m15 18-6-6 6-6"
|
|
85
72
|
/>
|
|
86
73
|
</svg>
|
|
87
74
|
</span>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as AvatarStories from "./Avatar.stories";
|
|
2
|
+
import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/blocks";
|
|
3
|
+
|
|
4
|
+
export const usage = {
|
|
5
|
+
image: `<Avatar
|
|
6
|
+
variant="image"
|
|
7
|
+
imageUrl="/sample-avatar-photo.jpg"
|
|
8
|
+
name="Jane Doe"
|
|
9
|
+
/>`,
|
|
10
|
+
initials: `<Avatar variant="initials" name="Beverley Haggis" />`,
|
|
11
|
+
icon: `<Avatar variant="icon" aria-label="Default avatar" />`,
|
|
12
|
+
size: `<Avatar
|
|
13
|
+
variant="image"
|
|
14
|
+
imageUrl="/sample-avatar-photo.jpg"
|
|
15
|
+
name="Avatar size"
|
|
16
|
+
size={72}
|
|
17
|
+
/>`,
|
|
18
|
+
disabled: `<Avatar
|
|
19
|
+
variant="image"
|
|
20
|
+
imageUrl="/sample-avatar-photo.jpg"
|
|
21
|
+
name="Disabled avatar"
|
|
22
|
+
disabled
|
|
23
|
+
/>`,
|
|
24
|
+
fallback: `<Avatar
|
|
25
|
+
variant="image"
|
|
26
|
+
imageUrl="https://example.com/does-not-exist.jpg"
|
|
27
|
+
name="Fallback to initials"
|
|
28
|
+
/>`,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
<Meta of={AvatarStories} />
|
|
32
|
+
<Title />
|
|
33
|
+
<Subtitle>A circular avatar with graceful fallbacks for images, initials, and icons.</Subtitle>
|
|
34
|
+
|
|
35
|
+
Use `<Avatar>` anywhere you need a compact visual identifier for a user or entity. The component renders a button for easy focus styling and clickability, and progressively falls back from an image to initials to icon, based on the props you provide.
|
|
36
|
+
|
|
37
|
+
Key points:
|
|
38
|
+
- `variant="image"` tries to render `imageUrl` first, then initials (from `name`) if the image fails.
|
|
39
|
+
- `variant="initials"` renders initials from `name`; if none are found, it falls back to the icon.
|
|
40
|
+
- `variant="icon"` always renders the default icon.
|
|
41
|
+
- Fixed size options (`48 | 56 | 72 | 80`).
|
|
42
|
+
- Disabled state mutes colors and blocks interaction.
|
|
43
|
+
|
|
44
|
+
## Variants
|
|
45
|
+
|
|
46
|
+
### Image (default)
|
|
47
|
+
Renders a photo when `imageUrl` is available. If the image fails to load, initials are shown instead.
|
|
48
|
+
|
|
49
|
+
<Canvas
|
|
50
|
+
of={AvatarStories.Image}
|
|
51
|
+
sourceState="shown"
|
|
52
|
+
source={{ code: usage.image }}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
### Initials
|
|
56
|
+
Pass a `name` to derive initials (up to two characters). Use when you don't have a photo or want to avoid loading images.
|
|
57
|
+
|
|
58
|
+
<Canvas
|
|
59
|
+
of={AvatarStories.Initials}
|
|
60
|
+
sourceState="shown"
|
|
61
|
+
source={{ code: usage.initials }}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
### Icon
|
|
65
|
+
Always displays the default avatar icon. Helpful as a generic placeholder.
|
|
66
|
+
|
|
67
|
+
<Canvas
|
|
68
|
+
of={AvatarStories.Icon}
|
|
69
|
+
sourceState="shown"
|
|
70
|
+
source={{ code: usage.icon }}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
## Sizes
|
|
74
|
+
Pick from the supported sizes to match your layout. Larger sizes are useful for profile headers; smaller for lists or chips.
|
|
75
|
+
|
|
76
|
+
<Canvas
|
|
77
|
+
of={AvatarStories.Sizes}
|
|
78
|
+
sourceState="shown"
|
|
79
|
+
source={{ code: usage.size }}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
## Disabled
|
|
83
|
+
Prevents interaction and applies muted colors while keeping layout intact.
|
|
84
|
+
|
|
85
|
+
<Canvas
|
|
86
|
+
of={AvatarStories.Disabled}
|
|
87
|
+
sourceState="shown"
|
|
88
|
+
source={{ code: usage.disabled }}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
## Fallback behaviour
|
|
92
|
+
Image errors are handled gracefully: the component logs an error, then switches to initials. If no initials are available, it renders the icon.
|
|
93
|
+
|
|
94
|
+
<Canvas
|
|
95
|
+
of={AvatarStories.BrokenImageFallback}
|
|
96
|
+
sourceState="shown"
|
|
97
|
+
source={{ code: usage.fallback }}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
## Accessibility
|
|
101
|
+
- Under the hood, the avatar is a `<button>`. It can receive focus and `onClick` if provided.
|
|
102
|
+
- Provide a meaningful `aria-label` when no visible text is present (e.g. the icon variant).
|
|
103
|
+
- `alt` text on the image defaults to `name` for screen readers.
|
|
104
|
+
- Sizes remain square circles; focus styles come from the theme for keyboard visibility.
|
|
105
|
+
|
|
106
|
+
## Props
|
|
107
|
+
|
|
108
|
+
Full props specification for `<Avatar>` is below.
|
|
109
|
+
|
|
110
|
+
<Canvas
|
|
111
|
+
of={AvatarStories.Default}
|
|
112
|
+
sourceState="hidden"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
You can use these controls to manipulate the `<Avatar>` component above.
|
|
116
|
+
|
|
117
|
+
<Controls of={AvatarStories.Default} />
|
|
@@ -1,10 +1,81 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import Avatar from './Avatar';
|
|
3
|
+
import Avatar, { type AvatarProps } from './Avatar';
|
|
3
4
|
import sampleAvatarPhoto from '../../../public/sample-avatar-photo.jpg';
|
|
4
5
|
|
|
6
|
+
type AvatarSize = NonNullable<AvatarProps['size']>;
|
|
7
|
+
const avatarSizes: AvatarSize[] = [48, 56, 72, 80];
|
|
8
|
+
|
|
9
|
+
const avatarRowStyle: CSSProperties = {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
gap: 16,
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
flexWrap: 'wrap',
|
|
14
|
+
};
|
|
15
|
+
|
|
5
16
|
const meta = {
|
|
6
|
-
title: 'Components/
|
|
17
|
+
title: 'Components/Avatar',
|
|
7
18
|
component: Avatar,
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
variant: {
|
|
24
|
+
description: 'Controls which representation to render',
|
|
25
|
+
options: ['image', 'initials', 'icon'],
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
table: { type: { summary: "'image' | 'initials' | 'icon'" } },
|
|
28
|
+
},
|
|
29
|
+
imageUrl: {
|
|
30
|
+
description: 'Image source used when `variant` is `image`',
|
|
31
|
+
control: { type: 'text' },
|
|
32
|
+
table: { type: { summary: 'string' } },
|
|
33
|
+
},
|
|
34
|
+
name: {
|
|
35
|
+
description:
|
|
36
|
+
'Name used for initials and as the fallback alt text for the image',
|
|
37
|
+
control: { type: 'text' },
|
|
38
|
+
table: { type: { summary: 'string' } },
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
description: 'Diameter of the avatar in pixels',
|
|
42
|
+
options: avatarSizes,
|
|
43
|
+
control: { type: 'inline-radio' },
|
|
44
|
+
table: { type: { summary: avatarSizes.join(' | ') } },
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
description: 'Disable interaction and mute colors',
|
|
48
|
+
control: { type: 'boolean' },
|
|
49
|
+
table: { type: { summary: 'boolean' } },
|
|
50
|
+
},
|
|
51
|
+
testId: {
|
|
52
|
+
description: 'Applied to the button for testing',
|
|
53
|
+
control: { type: 'text' },
|
|
54
|
+
table: { type: { summary: 'string' } },
|
|
55
|
+
},
|
|
56
|
+
className: {
|
|
57
|
+
description: 'Custom className for the root element',
|
|
58
|
+
control: { type: 'text' },
|
|
59
|
+
table: { type: { summary: 'string' } },
|
|
60
|
+
},
|
|
61
|
+
onClick: {
|
|
62
|
+
description: 'Click handler forwarded to the underlying button',
|
|
63
|
+
action: 'clicked',
|
|
64
|
+
table: {
|
|
65
|
+
type: {
|
|
66
|
+
summary: '(event: React.MouseEvent<HTMLButtonElement>) => void',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
args: {
|
|
72
|
+
variant: 'image',
|
|
73
|
+
imageUrl: sampleAvatarPhoto,
|
|
74
|
+
name: 'Jane Doe',
|
|
75
|
+
size: 56,
|
|
76
|
+
disabled: false,
|
|
77
|
+
},
|
|
78
|
+
tags: ['autodocs'],
|
|
8
79
|
} satisfies Meta<typeof Avatar>;
|
|
9
80
|
|
|
10
81
|
export default meta;
|
|
@@ -29,5 +100,42 @@ export const Initials: Story = {
|
|
|
29
100
|
export const Icon: Story = {
|
|
30
101
|
args: {
|
|
31
102
|
variant: 'icon',
|
|
103
|
+
name: 'Icon avatar',
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const Sizes: Story = {
|
|
108
|
+
name: 'Sizes',
|
|
109
|
+
args: {
|
|
110
|
+
imageUrl: sampleAvatarPhoto,
|
|
111
|
+
name: 'Avatar size',
|
|
112
|
+
},
|
|
113
|
+
render: (args) => (
|
|
114
|
+
<div style={avatarRowStyle}>
|
|
115
|
+
{avatarSizes.map((size) => (
|
|
116
|
+
<Avatar
|
|
117
|
+
key={size}
|
|
118
|
+
{...args}
|
|
119
|
+
size={size}
|
|
120
|
+
aria-label={`Avatar ${size}`}
|
|
121
|
+
/>
|
|
122
|
+
))}
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const Disabled: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
disabled: true,
|
|
130
|
+
name: 'Disabled avatar',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const BrokenImageFallback: Story = {
|
|
135
|
+
name: 'Broken image fallback',
|
|
136
|
+
args: {
|
|
137
|
+
variant: 'image',
|
|
138
|
+
imageUrl: 'https://example.com/does-not-exist.jpg',
|
|
139
|
+
name: 'Fallback to initials',
|
|
32
140
|
},
|
|
33
141
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
1
|
import { css, cx } from '@emotion/css';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const NAME = 'ucl-timetable-breadcrumb';
|
|
6
|
-
const ACTIVE_NAME = 'ucl-timetable-breadcrumb--active';
|
|
7
|
-
const INACTIVE_NAME = 'ucl-timetable-breadcrumb--inactive';
|
|
2
|
+
import Link, { LinkProps } from '../Link';
|
|
3
|
+
import { memo } from 'react';
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
export interface BreadcrumbProps extends Omit<LinkProps<any>, 'href' | 'to'> {
|
|
11
7
|
uri: string;
|
|
12
8
|
isActive?: boolean;
|
|
13
9
|
}
|
|
14
10
|
|
|
11
|
+
const NAME = 'ucl-uikit-breadcrumb';
|
|
12
|
+
const ACTIVE_NAME = 'ucl-uikit-breadcrumb--active';
|
|
13
|
+
const INACTIVE_NAME = 'ucl-uikit-breadcrumb--inactive';
|
|
14
|
+
|
|
15
15
|
const Breadcrumb = ({
|
|
16
16
|
testId = NAME,
|
|
17
17
|
uri,
|
|
18
18
|
className,
|
|
19
19
|
children,
|
|
20
20
|
isActive,
|
|
21
|
+
component,
|
|
21
22
|
...props
|
|
22
23
|
}: BreadcrumbProps) => {
|
|
23
24
|
const activeBreadcrumb =
|
|
@@ -56,23 +57,36 @@ const Breadcrumb = ({
|
|
|
56
57
|
<span
|
|
57
58
|
className={activeBreadcrumbStyle}
|
|
58
59
|
data-testid={testId}
|
|
59
|
-
{...props}
|
|
60
60
|
>
|
|
61
61
|
{children}
|
|
62
62
|
</span>
|
|
63
63
|
);
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (component) {
|
|
65
67
|
return (
|
|
66
68
|
<Link
|
|
69
|
+
component={component}
|
|
67
70
|
className={inactiveBreadcrumbStyle}
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
testId={testId}
|
|
72
|
+
to={uri}
|
|
70
73
|
{...props}
|
|
71
74
|
>
|
|
72
75
|
{children}
|
|
73
76
|
</Link>
|
|
74
77
|
);
|
|
75
78
|
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Link
|
|
82
|
+
className={inactiveBreadcrumbStyle}
|
|
83
|
+
testId={testId}
|
|
84
|
+
href={uri}
|
|
85
|
+
{...props}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</Link>
|
|
89
|
+
);
|
|
76
90
|
};
|
|
77
91
|
|
|
78
92
|
export default memo(Breadcrumb);
|
|
@@ -4,7 +4,7 @@ import { Icon } from '../';
|
|
|
4
4
|
import Breadcrumb from './Breadcrumb';
|
|
5
5
|
import { useTheme } from '../../theme';
|
|
6
6
|
|
|
7
|
-
const NAME = 'ucl-
|
|
7
|
+
const NAME = 'ucl-uikit-breadcrumbs';
|
|
8
8
|
|
|
9
9
|
export interface BreadcrumbsProps extends HTMLAttributes<HTMLElement> {
|
|
10
10
|
testId?: string;
|
|
@@ -10,9 +10,7 @@ describe('Breadcrumbs', () => {
|
|
|
10
10
|
const renderResult = render(
|
|
11
11
|
<ThemeContextProvider>
|
|
12
12
|
<Breadcrumbs>
|
|
13
|
-
<Breadcrumbs.Breadcrumb uri='/'>
|
|
14
|
-
Home
|
|
15
|
-
</Breadcrumbs.Breadcrumb>
|
|
13
|
+
<Breadcrumbs.Breadcrumb uri='/'>Home</Breadcrumbs.Breadcrumb>
|
|
16
14
|
<Breadcrumbs.Breadcrumb uri='/showcase'>
|
|
17
15
|
Timetable
|
|
18
16
|
</Breadcrumbs.Breadcrumb>
|
|
@@ -22,9 +20,7 @@ describe('Breadcrumbs', () => {
|
|
|
22
20
|
</Breadcrumbs>
|
|
23
21
|
</ThemeContextProvider>
|
|
24
22
|
);
|
|
25
|
-
expect(
|
|
26
|
-
renderResult.container.firstChild
|
|
27
|
-
).toMatchSnapshot();
|
|
23
|
+
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
28
24
|
});
|
|
29
25
|
|
|
30
26
|
test('snapshot: Custom Test ID', () => {
|
|
@@ -52,9 +48,7 @@ describe('Breadcrumbs', () => {
|
|
|
52
48
|
</Breadcrumbs>
|
|
53
49
|
</ThemeContextProvider>
|
|
54
50
|
);
|
|
55
|
-
expect(
|
|
56
|
-
renderResult.container.firstChild
|
|
57
|
-
).toMatchSnapshot();
|
|
51
|
+
expect(renderResult.container.firstChild).toMatchSnapshot();
|
|
58
52
|
});
|
|
59
53
|
|
|
60
54
|
// Interaction tests
|
|
@@ -63,9 +57,7 @@ describe('Breadcrumbs', () => {
|
|
|
63
57
|
render(
|
|
64
58
|
<ThemeContextProvider>
|
|
65
59
|
<Breadcrumbs>
|
|
66
|
-
<Breadcrumbs.Breadcrumb uri='/'>
|
|
67
|
-
Home
|
|
68
|
-
</Breadcrumbs.Breadcrumb>
|
|
60
|
+
<Breadcrumbs.Breadcrumb uri='/'>Home</Breadcrumbs.Breadcrumb>
|
|
69
61
|
<Breadcrumbs.Breadcrumb uri='/showcase'>
|
|
70
62
|
Timetable
|
|
71
63
|
</Breadcrumbs.Breadcrumb>
|
|
@@ -75,12 +67,8 @@ describe('Breadcrumbs', () => {
|
|
|
75
67
|
</Breadcrumbs>
|
|
76
68
|
</ThemeContextProvider>
|
|
77
69
|
);
|
|
78
|
-
const breadcrumbs = screen.getByTestId(
|
|
79
|
-
|
|
80
|
-
);
|
|
81
|
-
const breadcrumb = screen.getAllByTestId(
|
|
82
|
-
'ucl-timetable-breadcrumb'
|
|
83
|
-
);
|
|
70
|
+
const breadcrumbs = screen.getByTestId('ucl-uikit-breadcrumbs');
|
|
71
|
+
const breadcrumb = screen.getAllByTestId('ucl-uikit-breadcrumb');
|
|
84
72
|
expect(breadcrumbs).toBeDefined();
|
|
85
73
|
expect(breadcrumb).toBeDefined();
|
|
86
74
|
});
|
|
@@ -111,15 +99,9 @@ describe('Breadcrumbs', () => {
|
|
|
111
99
|
</ThemeContextProvider>
|
|
112
100
|
);
|
|
113
101
|
const breadcrumbs = screen.getByTestId('custom-testid');
|
|
114
|
-
const breadcrumb1 = screen.getByTestId(
|
|
115
|
-
|
|
116
|
-
);
|
|
117
|
-
const breadcrumb2 = screen.getByTestId(
|
|
118
|
-
'custom-testid-2'
|
|
119
|
-
);
|
|
120
|
-
const breadcrumb3 = screen.getByTestId(
|
|
121
|
-
'custom-testid-3'
|
|
122
|
-
);
|
|
102
|
+
const breadcrumb1 = screen.getByTestId('custom-testid-1');
|
|
103
|
+
const breadcrumb2 = screen.getByTestId('custom-testid-2');
|
|
104
|
+
const breadcrumb3 = screen.getByTestId('custom-testid-3');
|
|
123
105
|
expect(breadcrumbs).toBeDefined();
|
|
124
106
|
expect(breadcrumb1).toBeDefined();
|
|
125
107
|
expect(breadcrumb2).toBeDefined();
|