@oaknational/oak-components 2.45.1 → 3.1.0
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/dist/npm/cjs/index.js +7949 -0
- package/dist/{types.d.ts → npm/cjs/types.d.ts} +2 -16
- package/dist/npm/es/animation/usePrefersReducedMotion.js +16 -0
- package/dist/npm/es/components/OakGlobalStyle/OakGlobalStyle.js +14 -0
- package/dist/npm/es/components/OakThemeProvider/OakThemeProvider.js +14 -0
- package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js +105 -0
- package/dist/npm/es/components/buttons/OakCloseButton/OakCloseButton.js +18 -0
- package/dist/npm/es/components/buttons/OakLeftAlignedButton/OakLeftAlignedButton.js +57 -0
- package/dist/npm/es/components/buttons/OakPrimaryButton/OakPrimaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSecondaryButton/OakSecondaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js +20 -0
- package/dist/npm/es/components/buttons/OakSmallPrimaryButton/OakSmallPrimaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryButton/OakSmallSecondaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js +20 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryToggleButton/OakSmallSecondaryToggleButton.js +37 -0
- package/dist/npm/es/components/buttons/OakSmallTertiaryInvertedButton/OakSmallTertiaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakTertiaryButton/OakTertiaryButton.js +14 -0
- package/dist/npm/es/components/buttons/OakTertiaryInvertedButton/OakTertiaryInvertedButton.js +14 -0
- package/dist/npm/es/components/cookies/OakCookieBanner/OakCookieBanner.js +62 -0
- package/dist/npm/es/components/cookies/OakCookieConsent/OakCookieConsent.js +17 -0
- package/dist/npm/es/components/cookies/OakCookieConsentProvider/OakCookieConsentProvider.js +103 -0
- package/dist/npm/es/components/cookies/OakCookieConsentProvider/cookieConsentReducer.js +32 -0
- package/dist/npm/es/components/cookies/OakCookieSettingsModal/OakCookieSettingsModal.js +91 -0
- package/dist/npm/es/components/form-elements/OakButtonAsRadioGroup/OakButtonAsRadioGroup.js +44 -0
- package/dist/npm/es/components/form-elements/OakCheckBox/OakCheckBox.js +71 -0
- package/dist/npm/es/components/form-elements/OakFieldError/OakFieldError.js +25 -0
- package/dist/npm/es/components/form-elements/OakFieldset/OakFieldset.js +12 -0
- package/dist/npm/es/components/form-elements/OakForm/OakForm.js +16 -0
- package/dist/npm/es/components/form-elements/OakFormInput/OakFormInput.js +26 -0
- package/dist/npm/es/components/form-elements/OakJauntyAngleLabel/OakJauntyAngleLabel.js +10 -0
- package/dist/npm/es/components/form-elements/OakLabel/OakLabel.js +15 -0
- package/dist/npm/es/components/form-elements/OakMultilineText/OakMultilineText.js +96 -0
- package/dist/npm/es/components/form-elements/OakRadioAsButton/OakRadioAsButton.js +96 -0
- package/dist/npm/es/components/form-elements/OakRadioButton/OakRadioButton.js +31 -0
- package/dist/npm/es/components/form-elements/OakRadioGroup/OakRadioGroup.js +44 -0
- package/dist/npm/es/components/form-elements/OakSearchFilterCheckBox/OakSearchFilterCheckBox.js +64 -0
- package/dist/npm/es/components/form-elements/OakSecondaryButtonAsRadio/OakSecondaryButtonAsRadio.js +25 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeLegend.js +9 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeOptGroup.js +7 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeOption.js +22 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeSelect.js +23 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakOptGroup.js +12 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakOption.js +12 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakSelect.js +44 -0
- package/dist/npm/es/components/form-elements/OakTextArea/OakTextArea.js +23 -0
- package/dist/npm/es/components/form-elements/OakTextInput/OakTextInput.js +59 -0
- package/dist/npm/es/components/house-cat/OakCaptionCard/OakCaptionCard.js +81 -0
- package/dist/npm/es/components/house-cat/OakCaptionSearch/OakCaptionSearch.js +24 -0
- package/dist/npm/es/components/house-cat/utils.js +33 -0
- package/dist/npm/es/components/images-and-icons/OakAspectRatio/OakAspectRatio.js +39 -0
- package/dist/npm/es/components/images-and-icons/OakIcon/OakIcon.js +38 -0
- package/dist/npm/es/components/images-and-icons/OakImage/OakImage.js +51 -0
- package/dist/npm/es/components/images-and-icons/OakImage/useShowPlaceholder.js +29 -0
- package/dist/npm/es/components/images-and-icons/OakRoundIcon/OakRoundIcon.js +17 -0
- package/dist/npm/es/components/images-and-icons/OakSvg/OakSvg.js +47 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordion.js +36 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordionProvider.js +24 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/useAccordionContext.js +12 -0
- package/dist/npm/es/components/internal-components/InternalButton/InternalButton.js +48 -0
- package/dist/npm/es/components/internal-components/InternalCard/InternalCard.js +19 -0
- package/dist/npm/es/components/internal-components/InternalCardWithBackgroundElement/InternalCardWithBackgroundElement.js +22 -0
- package/dist/npm/es/components/internal-components/InternalCheckBox/InternalCheckBox.js +82 -0
- package/dist/npm/es/components/internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js +16 -0
- package/dist/npm/es/components/internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js +24 -0
- package/dist/npm/es/components/internal-components/InternalChevronAccordion/InternalChevronAccordion.js +83 -0
- package/dist/npm/es/components/internal-components/InternalClientPortal/InternalClientPortal.js +13 -0
- package/dist/npm/es/components/internal-components/InternalDndContext/InternalDndContext.js +28 -0
- package/dist/npm/es/components/internal-components/InternalLink/InternalLink.js +54 -0
- package/dist/npm/es/components/internal-components/InternalModalTransition/InternalModalTransition.js +31 -0
- package/dist/npm/es/components/internal-components/InternalRadio/InternalRadio.js +82 -0
- package/dist/npm/es/components/internal-components/InternalRadioWrapper/InternalRadioWrapper.js +36 -0
- package/dist/npm/es/components/internal-components/InternalReviewAccordion/InternalReviewAccordion.js +38 -0
- package/dist/npm/es/components/internal-components/InternalShadowIconButton/InternalShadowIconButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalShadowRectButton/InternalShadowRectButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalSlideInFlex/InternalSlideInFlex.js +30 -0
- package/dist/npm/es/components/internal-components/InternalStyledSvg/InternalStyledSvg.js +14 -0
- package/dist/npm/es/components/internal-components/InternalTextInput/InternalTextInput.js +50 -0
- package/dist/npm/es/components/internal-components/InternalTooltip/InternalTooltip.js +36 -0
- package/dist/npm/es/components/layout-and-structure/OakAccordion/OakAccordion.js +39 -0
- package/dist/npm/es/components/layout-and-structure/OakBasicAccordion/OakBasicAccordion.js +10 -0
- package/dist/npm/es/components/layout-and-structure/OakBox/OakBox.js +41 -0
- package/dist/npm/es/components/layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js +23 -0
- package/dist/npm/es/components/layout-and-structure/OakFlex/OakFlex.js +18 -0
- package/dist/npm/es/components/layout-and-structure/OakGrid/OakGrid.js +16 -0
- package/dist/npm/es/components/layout-and-structure/OakGridArea/OakGridArea.js +51 -0
- package/dist/npm/es/components/layout-and-structure/OakMaxWidth/OakMaxWidth.js +23 -0
- package/dist/npm/es/components/messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js +38 -0
- package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js +22 -0
- package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/SubHandDrawnFocusUnderline.js +17 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModal.js +41 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalBody.js +14 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js +16 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInlineBanner/OakInlineBanner.js +129 -0
- package/dist/npm/es/components/messaging-and-feedback/OakKbd/OakKbd.js +12 -0
- package/dist/npm/es/components/messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js +34 -0
- package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenter.js +106 -0
- package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenterBody.js +36 -0
- package/dist/npm/es/components/messaging-and-feedback/OakScreenReader/OakScreenReader.js +15 -0
- package/dist/npm/es/components/messaging-and-feedback/OakTagFunctional/OakTagFunctional.js +18 -0
- package/dist/npm/es/components/messaging-and-feedback/OakToast/OakToast.js +96 -0
- package/dist/npm/es/components/messaging-and-feedback/OakTooltip/OakTooltip.js +122 -0
- package/dist/npm/es/components/navigation/OakAnchorTarget/OakAnchorTarget.js +20 -0
- package/dist/npm/es/components/navigation/OakBreadcrumbs/OakBreadcrumbs.js +46 -0
- package/dist/npm/es/components/navigation/OakCard/OakCard.js +64 -0
- package/dist/npm/es/components/navigation/OakHoverLink/OakHoverLink.js +23 -0
- package/dist/npm/es/components/navigation/OakLink/OakLink.js +17 -0
- package/dist/npm/es/components/navigation/OakLink/config.js +18 -0
- package/dist/npm/es/components/navigation/OakPagination/OakPagination.js +106 -0
- package/dist/npm/es/components/navigation/OakPagination/utils.js +19 -0
- package/dist/npm/es/components/navigation/OakPrimaryNav/OakPrimaryNav.js +22 -0
- package/dist/npm/es/components/navigation/OakPrimaryNavItem/OakPrimaryNavItem.js +23 -0
- package/dist/npm/es/components/navigation/OakSecondaryLink/OakSecondaryLink.js +25 -0
- package/dist/npm/es/components/navigation/OakTabs/OakTabs.js +47 -0
- package/dist/npm/es/components/owa/OakBackLink/OakBackLink.js +28 -0
- package/dist/npm/es/components/owa/OakBulletList/OakBulletList.js +17 -0
- package/dist/npm/es/components/owa/OakCardWithHandDrawnBorder/OakCardWithHandDrawnBorder.js +17 -0
- package/dist/npm/es/components/owa/OakCloudinaryImage/OakCloudinaryImage.js +35 -0
- package/dist/npm/es/components/owa/OakCloudinaryImage/cloudinary.js +17 -0
- package/dist/npm/es/components/owa/OakCodeRenderer/OakCodeRenderer.js +135 -0
- package/dist/npm/es/components/owa/OakCopyLinkButton/OakCopyLinkButton.js +42 -0
- package/dist/npm/es/components/owa/OakDownloadCard/OakDownloadCard.js +72 -0
- package/dist/npm/es/components/owa/OakDownloadsJourneyChildSubjectTierSelector/OakDownloadsJourneyChildSubjectTierSelector.js +54 -0
- package/dist/npm/es/components/owa/OakDragAndDropInstructions/OakDragAndDropInstructions.js +41 -0
- package/dist/npm/es/components/owa/OakDraggable/OakDraggable.js +30 -0
- package/dist/npm/es/components/owa/OakDraggableFeedback/OakDraggableFeedback.js +13 -0
- package/dist/npm/es/components/owa/OakDroppable/OakDroppable.js +45 -0
- package/dist/npm/es/components/owa/OakFilterDrawer/OakFilterDrawer.js +43 -0
- package/dist/npm/es/components/owa/OakFormInputWithLabels/OakFormInputWithLabels.js +18 -0
- package/dist/npm/es/components/owa/OakHandDrawnCard/OakHandDrawnCard.js +17 -0
- package/dist/npm/es/components/owa/OakHandDrawnCardWithIcon/OakHandDrawnCardWithIcon.js +15 -0
- package/dist/npm/es/components/owa/OakHandDrawnHR/HandDrawnHRSvg.js +11 -0
- package/dist/npm/es/components/owa/OakHandDrawnHR/OakHandDrawnHR.js +22 -0
- package/dist/npm/es/components/owa/OakHeaderHero/OakHeaderHero.js +45 -0
- package/dist/npm/es/components/owa/OakHomepageTabButton/OakHomepageTabButton.js +35 -0
- package/dist/npm/es/components/owa/OakInfo/OakInfo.js +22 -0
- package/dist/npm/es/components/owa/OakInfoButton/OakInfoButton.js +20 -0
- package/dist/npm/es/components/owa/OakLessonInfoCard/OakLessonInfoCard.js +33 -0
- package/dist/npm/es/components/owa/OakLinkCard/OakLinkCard.js +42 -0
- package/dist/npm/es/components/owa/OakListItem/OakListItem.js +93 -0
- package/dist/npm/es/components/owa/OakMediaClip/OakMediaClip.js +90 -0
- package/dist/npm/es/components/owa/OakMediaClipList/OakMediaClipList.js +26 -0
- package/dist/npm/es/components/owa/OakMediaClipListAccordion/OakMediaClipListAccordion.js +29 -0
- package/dist/npm/es/components/owa/OakMediaClipStackListItem/OakMediaClipStackListItem.js +41 -0
- package/dist/npm/es/components/owa/OakOutlineAccordion/OakOutlineAccordion.js +21 -0
- package/dist/npm/es/components/owa/OakPromoTag/OakPromoTag.js +22 -0
- package/dist/npm/es/components/owa/OakRadioTile/OakRadioTile.js +40 -0
- package/dist/npm/es/components/owa/OakSaveCount/OakSaveCount.js +33 -0
- package/dist/npm/es/components/owa/OakScaleImageButton/OakScaleImageButton.js +19 -0
- package/dist/npm/es/components/owa/OakSideMenuNav/OakSideMenuNav.js +24 -0
- package/dist/npm/es/components/owa/OakSideMenuNavLink/OakSideMenuNavLink.js +48 -0
- package/dist/npm/es/components/owa/OakSignLanguageButton/OakSignLanguageButton.js +23 -0
- package/dist/npm/es/components/owa/OakSubjectIcon/OakSubjectIcon.js +20 -0
- package/dist/npm/es/components/owa/OakSubjectIconButton/OakSubjectIconButton.js +44 -0
- package/dist/npm/es/components/owa/OakTimer/OakTimer.js +26 -0
- package/dist/npm/es/components/owa/OakVideoTranscript/OakVideoTranscript.js +32 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListItem/OakUnitListItem.js +63 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItem/OakUnitListOptionalityItem.js +57 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItemCard/OakUnitListOptionalityItemCard.js +36 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyContentGuidance/OakPupilJourneyContentGuidance.js +44 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyHeader/OakPupilJourneyHeader.js +29 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyLayout/OakPupilJourneyLayout.js +62 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyList/OakPupilJourneyList.js +46 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListCounter/OakPupilJourneyListCounter.js +12 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItem/OakPupilJourneyListItem.js +45 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItemSubheading/OakPupilJourneyListItemSubheading.js +20 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityButton/OakPupilJourneyOptionalityButton.js +35 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityItem/OakPupilJourneyOptionalityItem.js +23 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyProgrammeOptions/OakPupilJourneyProgrammeOptions.js +27 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyUnitsFilter/OakPupilJourneyUnitsFilter.js +42 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyYearButton/OakPupilJourneyYearButton.js +31 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonBottomNav/OakLessonBottomNav.js +34 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonLayout/OakLessonLayout.js +153 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonNavItem/OakLessonNavItem.js +167 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewIntroVideo/OakPupilLessonReviewIntroVideo.js +30 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewItem/OakPupilLessonReviewItem.js +106 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewQuiz/OakPupilLessonReviewQuiz.js +56 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonTopNav/OakLessonTopNav.js +58 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonVideoTranscript/OakLessonVideoTranscript.js +27 -0
- package/dist/npm/es/components/owa/pupil/quiz/InternalDroppableHoldingPen/InternalDroppableHoldingPen.js +60 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakHintButton/OakHintButton.js +27 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizCheckBox/OakQuizCheckBox.js +58 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizCounter/OakQuizCounter.js +33 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizFeedback/OakQuizFeedback.js +31 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizHint/OakQuizHint.js +28 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizMatch/OakQuizMatch.js +121 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizOrder/OakQuizOrder.js +88 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableHeader/OakQuizPrintableHeader.js +29 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableSubHeader/OakQuizPrintableSubHeader.js +28 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizRadioButton/OakQuizRadioButton.js +78 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizResultItem/OakQuizResultItem.js +70 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizTextInput/OakQuizTextInput.js +28 -0
- package/dist/npm/es/components/owa/teacher/OakDownloadsAccordion/OakDownloadsAccordion.js +56 -0
- package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/OakInlineRegistrationBanner.js +62 -0
- package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/SurfingStudentSVG.js +15 -0
- package/dist/npm/es/components/owa/teacher/OakTeacherNotesInline/OakTeacherNotesInline.js +16 -0
- package/dist/npm/es/components/owa/teacher/OakTeacherNotesModal/OakTeacherNotesModal.js +72 -0
- package/dist/npm/es/components/owa/teacher/OakTertiaryOLNav/OakTertiaryOLNav.js +34 -0
- package/dist/npm/es/components/presentational/OakCarousel/OakCarousel.js +39 -0
- package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionControl.js +12 -0
- package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionIndicator.js +17 -0
- package/dist/npm/es/components/presentational/OakQuote/OakQuote.js +34 -0
- package/dist/npm/es/components/typography/OakHeading/OakHeading.js +33 -0
- package/dist/npm/es/components/typography/OakLI/OakLI.js +23 -0
- package/dist/npm/es/components/typography/OakOL/OakOL.js +22 -0
- package/dist/npm/es/components/typography/OakP/OakP.js +17 -0
- package/dist/npm/es/components/typography/OakSpan/OakSpan.js +18 -0
- package/dist/npm/es/components/typography/OakTypography/OakTypography.js +16 -0
- package/dist/npm/es/components/typography/OakUL/OakUL.js +19 -0
- package/dist/npm/es/components/unstyled/UnstyledChevronAccordion/UnstyledChevronAccordion.js +55 -0
- package/dist/npm/es/hooks/useBreakpoint.js +38 -0
- package/dist/npm/es/hooks/useIsScrolled.js +30 -0
- package/dist/npm/es/hooks/useMediaQuery.js +20 -0
- package/dist/npm/es/hooks/useMounted.js +12 -0
- package/dist/npm/es/image-map.js +205 -0
- package/dist/npm/es/index.js +196 -0
- package/dist/npm/es/styles/global/oak.styles.js +17 -0
- package/dist/npm/es/styles/global/reset.styles.js +11 -0
- package/dist/npm/es/styles/helpers/getFontSize.js +9 -0
- package/dist/npm/es/styles/helpers/getInternalPadding.js +15 -0
- package/dist/npm/es/styles/helpers/parseBorder.js +13 -0
- package/dist/npm/es/styles/helpers/parseBorderRadius.js +13 -0
- package/dist/npm/es/styles/helpers/parseBorderWidth.js +15 -0
- package/dist/npm/es/styles/helpers/parseColor.js +19 -0
- package/dist/npm/es/styles/helpers/parseColorFilter.js +19 -0
- package/dist/npm/es/styles/helpers/parseDropShadow.js +15 -0
- package/dist/npm/es/styles/helpers/parseOpacity.js +12 -0
- package/dist/npm/es/styles/helpers/parseSpacing.js +29 -0
- package/dist/npm/es/styles/helpers/parseTransitions.js +12 -0
- package/dist/npm/es/styles/helpers/parseTypography.js +36 -0
- package/dist/npm/es/styles/helpers/parseZIndex.js +13 -0
- package/dist/npm/es/styles/helpers/pxToRem.js +7 -0
- package/dist/npm/es/styles/helpers/truthy.js +13 -0
- package/dist/npm/es/styles/theme/borders.js +22 -0
- package/dist/npm/es/styles/theme/color.js +207 -0
- package/dist/npm/es/styles/theme/dark.theme.js +99 -0
- package/dist/npm/es/styles/theme/default.theme.js +99 -0
- package/dist/npm/es/styles/theme/dropShadow.js +13 -0
- package/dist/npm/es/styles/theme/opacity.js +8 -0
- package/dist/npm/es/styles/theme/spacing.js +48 -0
- package/dist/npm/es/styles/theme/transitions.js +6 -0
- package/dist/npm/es/styles/theme/typography.js +73 -0
- package/dist/npm/es/styles/theme/zIndex.js +17 -0
- package/dist/npm/es/styles/utils/borderStyle.js +27 -0
- package/dist/npm/es/styles/utils/colorFilterStyle.js +9 -0
- package/dist/npm/es/styles/utils/colorStyle.js +9 -0
- package/dist/npm/es/styles/utils/displayStyle.js +8 -0
- package/dist/npm/es/styles/utils/dropShadowStyle.js +9 -0
- package/dist/npm/es/styles/utils/flexStyle.js +9 -0
- package/dist/npm/es/styles/utils/listStyle.js +8 -0
- package/dist/npm/es/styles/utils/opacityStyle.js +9 -0
- package/dist/npm/es/styles/utils/positionStyle.js +9 -0
- package/dist/npm/es/styles/utils/responsiveStyle.js +69 -0
- package/dist/npm/es/styles/utils/scrollSnapStyle.js +11 -0
- package/dist/npm/es/styles/utils/sizeStyle.js +9 -0
- package/dist/npm/es/styles/utils/spacingStyle.js +25 -0
- package/dist/npm/es/styles/utils/transformStyle.js +8 -0
- package/dist/npm/es/styles/utils/transitionStyle.js +9 -0
- package/dist/npm/es/styles/utils/typographyStyle.js +9 -0
- package/dist/npm/es/styles/utils/zIndexStyle.js +9 -0
- package/dist/npm/es/svgs/button-border-bottom.js +6 -0
- package/dist/npm/es/svgs/button-border-left.js +6 -0
- package/dist/npm/es/svgs/button-border-right.js +6 -0
- package/dist/npm/es/svgs/button-border-top.js +6 -0
- package/dist/npm/es/svgs/header-underline.js +6 -0
- package/dist/npm/es/svgs/horizontal-rule.js +6 -0
- package/dist/npm/es/svgs/icon-background.js +6 -0
- package/dist/npm/es/svgs/scribble.js +11 -0
- package/dist/npm/es/svgs/underline-3.js +6 -0
- package/dist/npm/es/svgs/underline.js +6 -0
- package/dist/npm/es/test-helpers/colorConversion.js +14 -0
- package/dist/npm/es/test-helpers/mockIntersectionObserver.js +50 -0
- package/dist/npm/es/test-helpers/mockResizeObserver.js +25 -0
- package/dist/npm/es/types.d.ts +5249 -0
- package/package.json +28 -12
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js +0 -15
- package/dist/esm/index.js.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { __rest, __read, __assign } from 'tslib';
|
|
2
|
+
import React, { useState, useLayoutEffect } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { InternalTooltip } from '../../internal-components/InternalTooltip/InternalTooltip.js';
|
|
5
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A tooltip with oven-ready styling and positioning.
|
|
10
|
+
*/
|
|
11
|
+
var OakTooltip = function (_a) {
|
|
12
|
+
var _b;
|
|
13
|
+
var tooltipPosition = _a.tooltipPosition, children = _a.children, tooltip = _a.tooltip, isOpen = _a.isOpen, domContainer = _a.domContainer, props = __rest(_a, ["tooltipPosition", "children", "tooltip", "isOpen", "domContainer"]);
|
|
14
|
+
var _c = __read(useState(null), 2), targetElement = _c[0], setTargetElement = _c[1];
|
|
15
|
+
var _d = __read(useState(true), 2), isIntersecting = _d[0], setIsIntersecting = _d[1];
|
|
16
|
+
var _e = __read(useState(domContainer), 2), domContainerState = _e[0], setDomContainerState = _e[1];
|
|
17
|
+
var isVisible = isOpen && isIntersecting;
|
|
18
|
+
/**
|
|
19
|
+
* The overlay is positioned on top of the target element in a portal.
|
|
20
|
+
* It tracks the target's size and position.
|
|
21
|
+
*
|
|
22
|
+
* we use it to position the tooltip relative to the target element without interfering
|
|
23
|
+
* with the page layout
|
|
24
|
+
*/
|
|
25
|
+
var _f = __read(useState(), 2), overlayStyle = _f[0], setOverlayStyle = _f[1];
|
|
26
|
+
var squaredCornerRadiusProp = (function () {
|
|
27
|
+
switch (tooltipPosition) {
|
|
28
|
+
case "bottom-right":
|
|
29
|
+
return "$btrr";
|
|
30
|
+
case "top-right":
|
|
31
|
+
return "$bbrr";
|
|
32
|
+
case "top-left":
|
|
33
|
+
return "$bblr";
|
|
34
|
+
default:
|
|
35
|
+
return "$btlr";
|
|
36
|
+
}
|
|
37
|
+
})();
|
|
38
|
+
var borderRadiusProps = (_b = {
|
|
39
|
+
$borderRadius: "border-radius-m"
|
|
40
|
+
},
|
|
41
|
+
_b[squaredCornerRadiusProp] = "border-radius-square",
|
|
42
|
+
_b);
|
|
43
|
+
useLayoutEffect(function () {
|
|
44
|
+
if (!targetElement) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
var ticking = false;
|
|
48
|
+
var updateOverlayStyle = function () {
|
|
49
|
+
if (!ticking) {
|
|
50
|
+
requestAnimationFrame(function () {
|
|
51
|
+
ticking = false;
|
|
52
|
+
var rect = targetElement.getBoundingClientRect();
|
|
53
|
+
setOverlayStyle({
|
|
54
|
+
top: rect.top,
|
|
55
|
+
left: rect.left,
|
|
56
|
+
width: rect.width,
|
|
57
|
+
height: rect.height,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
ticking = true;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// We use an intersection observer to detect when the target element is no longer visible
|
|
64
|
+
var intersection = new IntersectionObserver(function (entries) {
|
|
65
|
+
setIsIntersecting(entries.every(function (entry) { return entry.isIntersecting; }));
|
|
66
|
+
});
|
|
67
|
+
intersection.observe(targetElement);
|
|
68
|
+
// We use a resize observer to detect when the target element's size changes
|
|
69
|
+
var resize = new ResizeObserver(updateOverlayStyle);
|
|
70
|
+
resize.observe(targetElement);
|
|
71
|
+
// Update the overlay position on scroll and resize
|
|
72
|
+
window.addEventListener("scroll", updateOverlayStyle, true);
|
|
73
|
+
window.addEventListener("resize", updateOverlayStyle);
|
|
74
|
+
return function () {
|
|
75
|
+
resize.disconnect();
|
|
76
|
+
intersection.disconnect();
|
|
77
|
+
window.removeEventListener("scroll", updateOverlayStyle, true);
|
|
78
|
+
window.removeEventListener("resize", updateOverlayStyle);
|
|
79
|
+
};
|
|
80
|
+
}, [targetElement]);
|
|
81
|
+
useLayoutEffect(function () {
|
|
82
|
+
if (domContainerState) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setDomContainerState(document.body);
|
|
86
|
+
}, [domContainerState]);
|
|
87
|
+
return (React.createElement(React.Fragment, null,
|
|
88
|
+
domContainerState &&
|
|
89
|
+
createPortal(isVisible && (React.createElement(OakBox, { "$position": "fixed", style: overlayStyle, "$pointerEvents": "none", "$zIndex": "modal-dialog" },
|
|
90
|
+
React.createElement(OakBox, __assign({ "$width": "fit-content", "$height": "fit-content", "$position": "absolute" }, getTooltipPositionProps(tooltipPosition)),
|
|
91
|
+
React.createElement(InternalTooltip, __assign({ "$background": "bg-decorative5-main", "$color": "text-primary", "$pv": "spacing-16", "$ph": "spacing-24", "$font": "heading-light-7", tooltipPosition: tooltipPosition, "aria-expanded": isVisible }, borderRadiusProps, props), tooltip)))), domContainerState),
|
|
92
|
+
React.createElement("div", { ref: function (domElement) {
|
|
93
|
+
var _a;
|
|
94
|
+
setTargetElement((_a = domElement === null || domElement === void 0 ? void 0 : domElement.firstElementChild) !== null && _a !== void 0 ? _a : null);
|
|
95
|
+
}, style: { display: "contents" } }, children)));
|
|
96
|
+
};
|
|
97
|
+
function getTooltipPositionProps(tooltipPosition) {
|
|
98
|
+
var props = {};
|
|
99
|
+
switch (tooltipPosition) {
|
|
100
|
+
case "top-left":
|
|
101
|
+
case "top-right":
|
|
102
|
+
props.$top = "spacing-0";
|
|
103
|
+
props.$transform = "translateY(calc(-100% - ".concat(parseSpacing("spacing-16"), "))");
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
props.$bottom = "spacing-0";
|
|
107
|
+
props.$transform = "translateY(calc(100% + ".concat(parseSpacing("spacing-16"), "))");
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
switch (tooltipPosition) {
|
|
111
|
+
case "top-left":
|
|
112
|
+
case "bottom-left":
|
|
113
|
+
props.$left = "spacing-0";
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
props.$right = "spacing-0";
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
return props;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { OakTooltip };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
4
|
+
import { responsiveStyle } from '../../../styles/utils/responsiveStyle.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* * AnchorTarget is a component to enable in-page linking to a particular section
|
|
8
|
+
*
|
|
9
|
+
* Styled `span` component.
|
|
10
|
+
*
|
|
11
|
+
* ## Usage
|
|
12
|
+
*
|
|
13
|
+
* Drop AnchorTarget inside a relative or absolulely positioned element without content, passing
|
|
14
|
+
* it a unique 'id'. Then link it elsewhere using `<a href='#${id}' />`.
|
|
15
|
+
*
|
|
16
|
+
* */
|
|
17
|
+
var OakAnchorTarget = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n ", "\n"], ["\n position: absolute;\n top: 0;\n ", "\n"])), responsiveStyle("scroll-margin-top", function (props) { return props.$pt; }, parseSpacing));
|
|
18
|
+
var templateObject_1;
|
|
19
|
+
|
|
20
|
+
export { OakAnchorTarget };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __makeTemplateObject, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import '../../images-and-icons/OakAspectRatio/OakAspectRatio.js';
|
|
5
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
6
|
+
import '../../images-and-icons/OakImage/OakImage.js';
|
|
7
|
+
import '../../images-and-icons/OakSvg/OakSvg.js';
|
|
8
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
9
|
+
import '../../../styles/theme/color.js';
|
|
10
|
+
import '../../../styles/theme/typography.js';
|
|
11
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
12
|
+
import { parseFontSize } from '../../../styles/helpers/parseTypography.js';
|
|
13
|
+
import '../../../styles/utils/responsiveStyle.js';
|
|
14
|
+
import '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
15
|
+
import '../../layout-and-structure/OakGrid/OakGrid.js';
|
|
16
|
+
import '../../layout-and-structure/OakGridArea/OakGridArea.js';
|
|
17
|
+
import '../../layout-and-structure/OakMaxWidth/OakMaxWidth.js';
|
|
18
|
+
import '../../layout-and-structure/OakAccordion/OakAccordion.js';
|
|
19
|
+
import '../../internal-components/InternalChevronAccordion/InternalChevronAccordion.js';
|
|
20
|
+
import '../../layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js';
|
|
21
|
+
import { OakLink } from '../OakLink/OakLink.js';
|
|
22
|
+
|
|
23
|
+
var BreadcrumbsUl = styled("ul")(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: ", ";\n padding: ", ";\n list-style: none;\n display: flex;\n gap: ", ";\n align-items: center;\n font-size: ", ";\n font-weight: ", ";\n flex-wrap: wrap;\n"], ["\n margin: ", ";\n padding: ", ";\n list-style: none;\n display: flex;\n gap: ", ";\n align-items: center;\n font-size: ", ";\n font-weight: ", ";\n flex-wrap: wrap;\n"])), parseSpacing("spacing-0"), parseSpacing("spacing-0"), parseSpacing("spacing-8"), parseFontSize("body-2"), parseFontSize("body-2"));
|
|
24
|
+
var BreadcrumbsLi = styled("li")(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: ", ";\n align-items: center;\n flex: 0;\n max-width: 100%;\n"], ["\n display: flex;\n gap: ", ";\n align-items: center;\n flex: 0;\n max-width: 100%;\n"])), parseSpacing("spacing-8"));
|
|
25
|
+
function OakBreadcrumbText(props) {
|
|
26
|
+
return (React.createElement(OakBox, __assign({ "$whiteSpace": "nowrap", "$textOverflow": "ellipsis", "$minWidth": "spacing-0", "$overflow": "hidden" }, props), props.children));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The breadcrumb component helps users to understand where they are within a website’s structure and move between levels.
|
|
30
|
+
*/
|
|
31
|
+
var OakBreadcrumbs = function (_a) {
|
|
32
|
+
var breadcrumbs = _a.breadcrumbs;
|
|
33
|
+
return (React.createElement(OakBox, { as: "nav", "aria-label": "Breadcrumb", "$color": "text-primary" },
|
|
34
|
+
React.createElement(BreadcrumbsUl, null, breadcrumbs.map(function (breadcrumb, breadcrumbIndex) {
|
|
35
|
+
// Last element doesn't have a "href" because it's the current page (typesafe)
|
|
36
|
+
var isLast = !("href" in breadcrumb);
|
|
37
|
+
return (React.createElement(BreadcrumbsLi, { key: "".concat(breadcrumb.text) },
|
|
38
|
+
breadcrumbIndex > 0 && (React.createElement(OakIcon, { "$height": "spacing-20", "$width": "spacing-20", iconName: "chevron-right" })),
|
|
39
|
+
isLast && (React.createElement(OakBreadcrumbText, { "aria-current": "page" }, breadcrumb.text)),
|
|
40
|
+
!isLast && (React.createElement(OakLink, { variant: "secondary", href: breadcrumb.href, style: { overflow: "hidden" } },
|
|
41
|
+
React.createElement(OakBreadcrumbText, null, breadcrumb.text)))));
|
|
42
|
+
}))));
|
|
43
|
+
};
|
|
44
|
+
var templateObject_1, templateObject_2;
|
|
45
|
+
|
|
46
|
+
export { OakBreadcrumbs };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { __makeTemplateObject, __read } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
5
|
+
import { OakFocusIndicator } from '../../messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js';
|
|
6
|
+
import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
|
|
7
|
+
import { OakImage } from '../../images-and-icons/OakImage/OakImage.js';
|
|
8
|
+
import { OakP } from '../../typography/OakP/OakP.js';
|
|
9
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
10
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
11
|
+
import { OakTagFunctional } from '../../messaging-and-feedback/OakTagFunctional/OakTagFunctional.js';
|
|
12
|
+
import '../../../styles/theme/color.js';
|
|
13
|
+
import '../../../styles/theme/typography.js';
|
|
14
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
15
|
+
import { getBreakpoint } from '../../../styles/utils/responsiveStyle.js';
|
|
16
|
+
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
17
|
+
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
18
|
+
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
19
|
+
import { borderStyle } from '../../../styles/utils/borderStyle.js';
|
|
20
|
+
|
|
21
|
+
var CardContent = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
22
|
+
var StyledOakImage = styled(OakImage)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n\n img {\n border-radius: inherit;\n object-fit: cover;\n }\n"], ["\n ", "\n ", "\n ", "\n\n img {\n border-radius: inherit;\n object-fit: cover;\n }\n"])), sizeStyle, colorStyle, borderStyle);
|
|
23
|
+
var rowStyles = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n\n ", " {\n height: ", ";\n }\n\n ", " {\n height: auto;\n padding-top: ", ";\n padding-bottom: ", ";\n }\n"], ["\n flex-direction: row;\n\n ", " {\n height: ", ";\n }\n\n ", " {\n height: auto;\n padding-top: ", ";\n padding-bottom: ", ";\n }\n"])), StyledOakImage, parseSpacing("spacing-240"), CardContent, parseSpacing("spacing-24"), parseSpacing("spacing-24"));
|
|
24
|
+
var columnStyles = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex-direction: column;\n\n ", " {\n height: auto;\n }\n\n ", " {\n height: 100%;\n padding-top: ", ";\n padding-bottom: ", ";\n }\n"], ["\n flex-direction: column;\n\n ", " {\n height: auto;\n }\n\n ", " {\n height: 100%;\n padding-top: ", ";\n padding-bottom: ", ";\n }\n"])), StyledOakImage, CardContent, parseSpacing("spacing-0"), parseSpacing("spacing-0"));
|
|
25
|
+
var getCardOrientationStyles = function (orientation) {
|
|
26
|
+
return orientation === "row" ? rowStyles : columnStyles;
|
|
27
|
+
};
|
|
28
|
+
var getResponsiveCardOrientationStyles = function (cardOrientation) {
|
|
29
|
+
if (!Array.isArray(cardOrientation)) {
|
|
30
|
+
return getCardOrientationStyles(cardOrientation);
|
|
31
|
+
}
|
|
32
|
+
var _a = __read(cardOrientation, 2), smallOrientation = _a[0], largeOrientation = _a[1];
|
|
33
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "], ["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "])), getCardOrientationStyles(smallOrientation), getBreakpoint("small"), getCardOrientationStyles(largeOrientation));
|
|
34
|
+
};
|
|
35
|
+
var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
36
|
+
var $cardOrientation = _a.$cardOrientation;
|
|
37
|
+
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
41
|
+
*
|
|
42
|
+
* It can also display an image, subcopy, a tag, and a link with an icon.
|
|
43
|
+
*
|
|
44
|
+
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
45
|
+
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
46
|
+
*/
|
|
47
|
+
var OakCard = function (_a) {
|
|
48
|
+
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k;
|
|
49
|
+
return (React.createElement(OakFocusIndicator, { as: as, "$background": "bg-primary", hoverBackground: hoverBackground, "$height": "100%", "$width": cardWidth, "$borderRadius": "border-radius-m2" },
|
|
50
|
+
React.createElement(StyledOakFlex, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
51
|
+
imageSrc && (React.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" })),
|
|
52
|
+
React.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
|
53
|
+
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-16" },
|
|
54
|
+
React.createElement(OakHeading, { tag: headingLevel, "$font": "heading-6" }, heading),
|
|
55
|
+
subCopy && React.createElement(OakP, { "$color": subCopyColor }, subCopy)),
|
|
56
|
+
React.createElement(OakFlex, { "$flexDirection": "row", "$justifyContent": tagName ? "space-between" : "flex-end", "$gap": "spacing-16" },
|
|
57
|
+
tagName && (React.createElement(OakTagFunctional, { label: tagName, "$background": tagBackground })),
|
|
58
|
+
linkText && (React.createElement(OakFlex, { "$alignItems": "center" },
|
|
59
|
+
React.createElement(OakSpan, { "$font": "heading-light-7" }, linkText),
|
|
60
|
+
React.createElement(OakIcon, { iconName: linkIconName, alt: "", "$width": "spacing-24", "$height": "spacing-24" }))))))));
|
|
61
|
+
};
|
|
62
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
63
|
+
|
|
64
|
+
export { OakCard };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __makeTemplateObject, __assign } from 'tslib';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { InternalLink } from '../../internal-components/InternalLink/InternalLink.js';
|
|
5
|
+
|
|
6
|
+
var StyleInternalLink = styled(InternalLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n"], ["\n display: inline-flex;\n align-items: center;\n"])));
|
|
7
|
+
/**
|
|
8
|
+
* deprecated - use `<OakLink />` instead
|
|
9
|
+
* @deprecated
|
|
10
|
+
*
|
|
11
|
+
* A link with an optional icon where underline is shown on hover.
|
|
12
|
+
*
|
|
13
|
+
* Defaulting to a `HTMLAnchorElement` this component is polymorphic and can be rendered as a button or any other element.
|
|
14
|
+
* A linkDisabled prop is also available to disable the link even when it is not a button.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
var OakHoverLink = forwardRef(function (props, ref) {
|
|
18
|
+
var color = props.displayDisabled ? "text-disabled" : "text-primary";
|
|
19
|
+
return (React.createElement(StyleInternalLink, __assign({ color: color, hoverColor: color, activeColor: color, disabledColor: color, visitedColor: color, textDecoration: "none" }, props, { ref: ref })));
|
|
20
|
+
});
|
|
21
|
+
var templateObject_1;
|
|
22
|
+
|
|
23
|
+
export { OakHoverLink };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { variantConfig } from './config.js';
|
|
4
|
+
import { InternalLink } from '../../internal-components/InternalLink/InternalLink.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A link with an optional icon and loading state.
|
|
8
|
+
*
|
|
9
|
+
* Defaulting to a `HTMLAnchorElement` this component is polymorphic and can be rendered as a button or any other element.
|
|
10
|
+
*/
|
|
11
|
+
var OakLink = forwardRef(function (props, ref) {
|
|
12
|
+
var _a = props.variant, variant = _a === void 0 ? "primary" : _a;
|
|
13
|
+
var variantDefinition = variantConfig[variant];
|
|
14
|
+
return (React.createElement(InternalLink, __assign({ color: variantDefinition.color, hoverColor: variantDefinition.hoverColor, activeColor: variantDefinition.activeColor, visitedColor: variantDefinition.visitedColor, textDecoration: variantDefinition.textDecoration, disabledColor: "text-disabled" }, props, { ref: ref })));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { OakLink };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var variantConfig = {
|
|
2
|
+
primary: {
|
|
3
|
+
color: "text-link-active",
|
|
4
|
+
hoverColor: "text-link-hover",
|
|
5
|
+
activeColor: "text-link-pressed",
|
|
6
|
+
visitedColor: "text-link-visited",
|
|
7
|
+
textDecoration: "underline",
|
|
8
|
+
},
|
|
9
|
+
secondary: {
|
|
10
|
+
color: "text-primary",
|
|
11
|
+
hoverColor: "text-primary",
|
|
12
|
+
activeColor: "text-primary",
|
|
13
|
+
visitedColor: "text-primary",
|
|
14
|
+
textDecoration: "none",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { variantConfig };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { generatePageNumbers } from './utils.js';
|
|
5
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
6
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
7
|
+
import { OakLI } from '../../typography/OakLI/OakLI.js';
|
|
8
|
+
import { OakUL } from '../../typography/OakUL/OakUL.js';
|
|
9
|
+
import { InternalButton } from '../../internal-components/InternalButton/InternalButton.js';
|
|
10
|
+
import { parseColorFilter } from '../../../styles/helpers/parseColorFilter.js';
|
|
11
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
12
|
+
import { OakLink } from '../OakLink/OakLink.js';
|
|
13
|
+
import { typographyStyle } from '../../../styles/utils/typographyStyle.js';
|
|
14
|
+
|
|
15
|
+
var StyledChevronButton = styled(OakLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n ", "\n"], ["\n display: inline-block;\n ", "\n"])), function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:disabled {\n color: ", ";\n cursor: pointer;\n }\n "], ["\n &:disabled {\n color: ", ";\n cursor: pointer;\n }\n "])), props.disabledColor); });
|
|
16
|
+
var StyledIcon = styled(OakIcon)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
17
|
+
if (props.disabled) {
|
|
18
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n filter: ", ";\n "], ["\n filter: ", ";\n "])), parseColorFilter("icon-disabled"));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var StyledNumberButton = styled(OakLink)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n height: 30px;\n width: 30px;\n border-radius: 100px;\n display: flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n ", "\n color: ", ";\n\n ", ";\n\n ", "\n\n &:hover {\n text-decoration: underline;\n ", "\n }\n"], ["\n height: 30px;\n width: 30px;\n border-radius: 100px;\n display: flex;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n ", "\n color: ", ";\n\n ", ";\n\n ", "\n\n &:hover {\n text-decoration: underline;\n ", "\n }\n"])), typographyStyle, parseColor("text-primary"), function (props) { return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), props.selected
|
|
22
|
+
? parseColor("icon-primary")
|
|
23
|
+
: parseColor("icon-inverted")); }, function (props) {
|
|
24
|
+
return props.selected && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n &:visited {\n color: ", ";\n }\n "], ["\n color: ", ";\n &:visited {\n color: ", ";\n }\n "])), parseColor("text-inverted"), parseColor("text-inverted"));
|
|
25
|
+
}, function (props) {
|
|
26
|
+
return props.selected && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n @media (hover: hover) {\n &:hover:not(:disabled) {\n color: ", ";\n }\n "], ["\n color: ", ";\n @media (hover: hover) {\n &:hover:not(:disabled) {\n color: ", ";\n }\n "])), parseColor("text-inverted"), parseColor("text-inverted"));
|
|
27
|
+
});
|
|
28
|
+
var StyledEllipsis = styled(InternalButton)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n &:disabled {\n cursor: pointer;\n }\n"], ["\n &:disabled {\n cursor: pointer;\n }\n"])));
|
|
29
|
+
var OakPageNumber = function (_a) {
|
|
30
|
+
var currentPage = _a.currentPage, pageNumber = _a.pageNumber, onClick = _a.onClick, href = _a.href, pageName = _a.pageName;
|
|
31
|
+
var isActive = currentPage === pageNumber;
|
|
32
|
+
return (React.createElement(StyledNumberButton, { "data-testid": "page-number-component", "aria-label": "".concat(pageName, " page ").concat(pageNumber), "aria-current": isActive ? "page" : false, "$font": "heading-7", onClick: onClick, selected: isActive, href: href }, pageNumber));
|
|
33
|
+
};
|
|
34
|
+
var OakEllipsis = function () {
|
|
35
|
+
return (React.createElement(StyledEllipsis, { "$color": "text-primary", "$font": "heading-7", "$background": "bg-primary", "aria-label": "Hidden page numbers", disabled: true }, "..."));
|
|
36
|
+
};
|
|
37
|
+
var OakPagination = function (_a) {
|
|
38
|
+
var totalPages = _a.totalPages, nextHref = _a.nextHref, prevHref = _a.prevHref, paginationHref = _a.paginationHref, pageName = _a.pageName, onPageChange = _a.onPageChange, currentPage = _a.currentPage;
|
|
39
|
+
var pages = generatePageNumbers(currentPage, totalPages);
|
|
40
|
+
var isFirstPage = currentPage <= 1;
|
|
41
|
+
var isLastPage = currentPage >= totalPages;
|
|
42
|
+
var handleNumberClick = function (num, event) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
onPageChange(num);
|
|
45
|
+
};
|
|
46
|
+
var handleChevronClick = function (direction, event) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
var newPage = currentPage + (direction === "backwards" ? -1 : 1);
|
|
49
|
+
onPageChange(newPage);
|
|
50
|
+
};
|
|
51
|
+
if (currentPage === 1 && totalPages < 2) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return (React.createElement("nav", { "aria-label": "pagination", "data-testid": "pagination" },
|
|
55
|
+
React.createElement(OakFlex, { "$alignItems": "center", "$justifyContent": "center", "$width": "100%", "$gap": ["spacing-8", "spacing-16", "spacing-16"] },
|
|
56
|
+
React.createElement(StyledChevronButton, { element: isFirstPage ? "button" : "a", rel: "prev", href: prevHref, "data-testid": "backwards-button", onClick: function (e) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
handleChevronClick("backwards", e);
|
|
59
|
+
}, onKeyDown: function (e) {
|
|
60
|
+
if (e.key === "Enter") {
|
|
61
|
+
handleChevronClick("backwards", e);
|
|
62
|
+
}
|
|
63
|
+
}, tabIndex: isFirstPage ? -1 : 0, "aria-disabled": isFirstPage, disabled: isFirstPage, "aria-label": isFirstPage ? "No previous pages" : "Go to previous page" },
|
|
64
|
+
React.createElement(StyledIcon, { disabled: isFirstPage, iconName: "chevron-left" })),
|
|
65
|
+
React.createElement(OakUL, { "$reset": true, "$display": "flex" }, pages.map(function (page, i) {
|
|
66
|
+
if (typeof page === "number") {
|
|
67
|
+
return (React.createElement(OakLI, { key: "".concat(page, " ").concat(i), "$mh": ["spacing-4", "spacing-8", "spacing-8"] },
|
|
68
|
+
React.createElement(OakPageNumber, { pageName: pageName, key: page, pageNumber: page + 1, currentPage: currentPage, href: "".concat(paginationHref, "?page=").concat(page + 1), onClick: function (e) {
|
|
69
|
+
return handleNumberClick(page + 1, e);
|
|
70
|
+
} })));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return (React.createElement(OakLI, { "$mh": ["spacing-4", "spacing-8", "spacing-8"], key: "".concat(page, " ").concat(i) },
|
|
74
|
+
React.createElement(OakFlex, { "$height": "100%", "$alignSelf": "center" },
|
|
75
|
+
React.createElement(OakEllipsis, null))));
|
|
76
|
+
}
|
|
77
|
+
})),
|
|
78
|
+
React.createElement(StyledChevronButton, { element: isLastPage ? "button" : "a", rel: "next", tabIndex: isLastPage ? -1 : 0, "data-testid": "forwards-button", href: nextHref, onClick: function (e) {
|
|
79
|
+
handleChevronClick("forwards", e);
|
|
80
|
+
}, onKeyDown: function (e) {
|
|
81
|
+
if (e.key === "Enter") {
|
|
82
|
+
handleChevronClick("forwards", e);
|
|
83
|
+
}
|
|
84
|
+
}, "aria-disabled": isLastPage, disabled: isLastPage, "aria-label": isLastPage ? "No further pages" : "Go to next page" },
|
|
85
|
+
React.createElement(StyledIcon, { disabled: isLastPage, iconName: "chevron-right" })))));
|
|
86
|
+
};
|
|
87
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* Add the description of the component here and it will appear on the story for the component
|
|
91
|
+
* The following callbacks are available for tracking focus events:
|
|
92
|
+
*
|
|
93
|
+
* Pagination component for navigating through pages
|
|
94
|
+
*
|
|
95
|
+
* @param router - Next.js router object
|
|
96
|
+
* @param currentPage - Current page number
|
|
97
|
+
* @param totalPages - Total number of pages
|
|
98
|
+
* @param nextHref - URL for the next page
|
|
99
|
+
* @param prevHref - URL for the previous page
|
|
100
|
+
* @param paginationHref - Base URL for the pagination
|
|
101
|
+
* @param pageName - Name of the page
|
|
102
|
+
* @param onPageChange - Callback function for iterating through pages
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
export { OakPagination };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var generatePageNumbers = function (activePage, totalPages) {
|
|
2
|
+
var pageNumbers = [];
|
|
3
|
+
if (totalPages <= 7) {
|
|
4
|
+
return Array.from({ length: totalPages }, function (_, i) { return i; });
|
|
5
|
+
}
|
|
6
|
+
pageNumbers.push(0);
|
|
7
|
+
if (activePage <= 3) {
|
|
8
|
+
pageNumbers.push(1, 2, 3, "...", totalPages - 1);
|
|
9
|
+
}
|
|
10
|
+
else if (activePage >= 4 && activePage < totalPages - 3) {
|
|
11
|
+
pageNumbers.push("...", activePage - 1, activePage, "...", totalPages - 1);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
pageNumbers.push("...", totalPages - 4, totalPages - 3, totalPages - 2, totalPages - 1);
|
|
15
|
+
}
|
|
16
|
+
return pageNumbers;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { generatePageNumbers };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
3
|
+
import { OakLI } from '../../typography/OakLI/OakLI.js';
|
|
4
|
+
import { OakPrimaryNavItem } from '../OakPrimaryNavItem/OakPrimaryNavItem.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A row of buttons for navigating between different sections
|
|
8
|
+
*
|
|
9
|
+
* ⚠️ To be deprecated
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
12
|
+
var OakPrimaryNav = function (_a) {
|
|
13
|
+
var ariaLabel = _a.ariaLabel, navItems = _a.navItems;
|
|
14
|
+
return (React.createElement("nav", { "aria-label": ariaLabel },
|
|
15
|
+
React.createElement(OakFlex, { as: "ul", "$flexDirection": ["row"], "$gap": "spacing-24", "$mh": "spacing-0", "$mv": "spacing-0", "$ph": "spacing-0" }, navItems.map(function (_a, index) {
|
|
16
|
+
var href = _a.href, isCurrent = _a.isCurrent, children = _a.children;
|
|
17
|
+
return (React.createElement(OakLI, { "$listStyle": "none", key: index },
|
|
18
|
+
React.createElement(OakPrimaryNavItem, { href: href, isCurrent: isCurrent }, children)));
|
|
19
|
+
}))));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { OakPrimaryNav };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Link from 'next/link';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
|
|
6
|
+
import { OakPrimaryInvertedButton } from '../../buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js';
|
|
7
|
+
|
|
8
|
+
var OakPrimaryButtonWithoutPointerEvents = styled(OakPrimaryButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: none;\n"], ["\n pointer-events: none;\n"])));
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* A specific implementation of OakPrimaryButton and OakPrimaryInvertedButton rendering
|
|
12
|
+
* relevant view depending on isCurrent prop
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ To be deprecated
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
var OakPrimaryNavItem = function (_a) {
|
|
18
|
+
var href = _a.href, _b = _a.isCurrent, isCurrent = _b === void 0 ? false : _b, _c = _a.shallow, shallow = _c === void 0 ? true : _c, children = _a.children;
|
|
19
|
+
return isCurrent ? (React.createElement(OakPrimaryButtonWithoutPointerEvents, { element: "span", "aria-current": "page" }, children)) : (React.createElement(OakPrimaryInvertedButton, { element: Link, href: href, shallow: shallow, isTrailingIcon: true }, children));
|
|
20
|
+
};
|
|
21
|
+
var templateObject_1;
|
|
22
|
+
|
|
23
|
+
export { OakPrimaryNavItem };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { InternalLink } from '../../internal-components/InternalLink/InternalLink.js';
|
|
5
|
+
|
|
6
|
+
// we do this to avoid type errors when spreading props
|
|
7
|
+
var StyledInternalLink = styled(InternalLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
8
|
+
/**
|
|
9
|
+
* deprecated - use `<OakLink variant="secondary"/>` instead
|
|
10
|
+
* @deprecated
|
|
11
|
+
*
|
|
12
|
+
* A black link with an optional icon and loading state.
|
|
13
|
+
*
|
|
14
|
+
* Defaulting to a `HTMLAnchorElement` this component is polymorphic and can be rendered as a button or any other element.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
var OakSecondaryLink = forwardRef(function (props, ref) {
|
|
18
|
+
var displayDisabled = props.displayDisabled, restProps = __rest(props, ["displayDisabled"]);
|
|
19
|
+
var color = displayDisabled ? "text-disabled" : "text-primary";
|
|
20
|
+
var visitedColor = displayDisabled ? "text-disabled" : "text-primary";
|
|
21
|
+
return (React.createElement(StyledInternalLink, __assign({ color: color, hoverColor: color, activeColor: color, disabledColor: "text-disabled", visitedColor: visitedColor, textDecoration: "none" }, restProps, { ref: ref })));
|
|
22
|
+
});
|
|
23
|
+
var templateObject_1;
|
|
24
|
+
|
|
25
|
+
export { OakSecondaryLink };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
6
|
+
import { parseBorderRadius } from '../../../styles/helpers/parseBorderRadius.js';
|
|
7
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
8
|
+
import { InternalButton } from '../../internal-components/InternalButton/InternalButton.js';
|
|
9
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
10
|
+
import '../../layout-and-structure/OakBox/OakBox.js';
|
|
11
|
+
import '../../layout-and-structure/OakGrid/OakGrid.js';
|
|
12
|
+
import '../../layout-and-structure/OakGridArea/OakGridArea.js';
|
|
13
|
+
import '../../layout-and-structure/OakMaxWidth/OakMaxWidth.js';
|
|
14
|
+
import '../../layout-and-structure/OakAccordion/OakAccordion.js';
|
|
15
|
+
import '../../internal-components/InternalChevronAccordion/InternalChevronAccordion.js';
|
|
16
|
+
import '../../layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js';
|
|
17
|
+
import '../../typography/OakHeading/OakHeading.js';
|
|
18
|
+
import { OakLI } from '../../typography/OakLI/OakLI.js';
|
|
19
|
+
import '../../typography/OakOL/OakOL.js';
|
|
20
|
+
import '../../typography/OakP/OakP.js';
|
|
21
|
+
import '../../typography/OakSpan/OakSpan.js';
|
|
22
|
+
import '../../typography/OakTypography/OakTypography.js';
|
|
23
|
+
import { OakUL } from '../../typography/OakUL/OakUL.js';
|
|
24
|
+
|
|
25
|
+
var StyledFocusOutline = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
26
|
+
var StyledTabButton = styled(InternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"], ["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"])), parseBorderRadius("border-radius-circle"), function (props) { return parseColor(props.$hoverColor); }, function (props) { return parseColor(props.$hoverBackground); }, parseDropShadow("drop-shadow-centered-grey"), StyledFocusOutline, parseDropShadow("drop-shadow-centered-lemon"));
|
|
27
|
+
function OakTabs(props) {
|
|
28
|
+
var colorVariant = props.colorVariant, sizeVariant = props.sizeVariant, tabs = props.tabs, activeTab = props.activeTab, onTabClick = props.onTabClick;
|
|
29
|
+
var backgroundColor = colorVariant === "black" ? "bg-inverted" : "bg-primary";
|
|
30
|
+
var textColor = colorVariant === "black" ? "text-inverted" : "text-primary";
|
|
31
|
+
var hoverBackground = colorVariant === "black" ? "bg-btn-primary-hover" : "bg-neutral-stronger";
|
|
32
|
+
var hoverText = colorVariant === "black" ? "text-inverted" : "text-primary";
|
|
33
|
+
return (React.createElement(OakUL, { "$display": "flex", "$justifyContent": "space-around", "$height": sizeVariant === "compact" ? "spacing-40" : "spacing-56", "$background": backgroundColor, "$borderRadius": "border-radius-circle", "$gap": "spacing-8", "$pa": "spacing-8", "$alignItems": "center", "$font": sizeVariant === "compact" ? "body-3" : "heading-light-7", "$ba": "border-solid-s", "$borderColor": colorVariant === "white" ? "border-neutral-lighter" : backgroundColor }, tabs.map(function (tab) {
|
|
34
|
+
var label = tab.label, type = tab.type;
|
|
35
|
+
var isSelected = activeTab === label;
|
|
36
|
+
return (React.createElement(OakLI, { "$listStyle": "none", "$width": "100%", "$height": "100%", "$display": "flex", key: label },
|
|
37
|
+
React.createElement(StyledTabButton, { element: type === "link" ? Link : undefined, href: type === "link" ? tab.href : undefined, "aria-current": type === "link" && isSelected ? "page" : undefined, "$background": isSelected ? "bg-decorative1-main" : backgroundColor, "$color": isSelected ? "text-primary" : textColor, "$hoverColor": isSelected ? "text-primary" : hoverText, "$hoverBackground": isSelected ? "bg-decorative1-main" : hoverBackground, "$ba": "border-solid-s", "$borderColor": isSelected ? "border-decorative1-stronger" : backgroundColor, onClick: function (event) {
|
|
38
|
+
if (onTabClick) {
|
|
39
|
+
onTabClick(label, event);
|
|
40
|
+
}
|
|
41
|
+
} },
|
|
42
|
+
React.createElement(StyledFocusOutline, { "$width": "100%", "$height": "100%", "$borderRadius": "border-radius-circle", "$pa": "spacing-4", "$alignItems": "center", "$justifyContent": "center", "$whiteSpace": "nowrap" }, label))));
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
var templateObject_1, templateObject_2;
|
|
46
|
+
|
|
47
|
+
export { OakTabs };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
5
|
+
import { parseColorFilter } from '../../../styles/helpers/parseColorFilter.js';
|
|
6
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
7
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
8
|
+
|
|
9
|
+
var StyledBackLink = styled.a(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 50%;\n display: flex;\n width: fit-content;\n height: fit-content;\n border: none;\n padding: 0;\n outline: none;\n\n img {\n pointer-events: none;\n }\n\n &:not(:disabled) {\n cursor: pointer;\n }\n\n &:active {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:hover,\n &:focus-visible {\n background: ", ";\n\n img {\n filter: ", ";\n }\n }\n\n &:focus-visible {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:disabled {\n background: ", ";\n\n img {\n filter: ", ";\n }\n }\n"], ["\n border-radius: 50%;\n display: flex;\n width: fit-content;\n height: fit-content;\n border: none;\n padding: 0;\n outline: none;\n\n img {\n pointer-events: none;\n }\n\n &:not(:disabled) {\n cursor: pointer;\n }\n\n &:active {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:hover,\n &:focus-visible {\n background: ", ";\n\n img {\n filter: ", ";\n }\n }\n\n &:focus-visible {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:disabled {\n background: ", ";\n\n img {\n filter: ", ";\n }\n }\n"])), parseDropShadow("drop-shadow-lemon"), parseDropShadow("drop-shadow-grey"), parseColor("bg-btn-primary"), parseColorFilter("text-inverted"), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), parseColor("bg-btn-primary-disabled"), parseColorFilter("text-inverted"));
|
|
10
|
+
/**
|
|
11
|
+
* Used to navigate the user back to the previous page in the app.
|
|
12
|
+
*
|
|
13
|
+
* Polymorphic rendering as any HTML element or component using `as` — defaults to `a`.
|
|
14
|
+
*
|
|
15
|
+
* E.g.
|
|
16
|
+
*
|
|
17
|
+
* * Default (Anchor) `<OakBackLink href="https://www.thenational.academy/" />`
|
|
18
|
+
* * Button `<OakBackLink as="button" onClick={() => goBack(-1)} />`
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
var OakBackLink = function (_a) {
|
|
22
|
+
var as = _a.as, _b = _a.label, label = _b === void 0 ? "Back" : _b, props = __rest(_a, ["as", "label"]);
|
|
23
|
+
return (React.createElement(StyledBackLink, __assign({ as: as !== null && as !== void 0 ? as : "a", "aria-label": label }, props),
|
|
24
|
+
React.createElement(OakIcon, { alt: "", iconName: "chevron-left", "$width": "spacing-40", "$objectFit": "cover", "$height": "spacing-40" })));
|
|
25
|
+
};
|
|
26
|
+
var templateObject_1;
|
|
27
|
+
|
|
28
|
+
export { OakBackLink };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An inline bulleted list
|
|
7
|
+
*/
|
|
8
|
+
var OakBulletList = function (props) {
|
|
9
|
+
var listItems = props.listItems, rest = __rest(props, ["listItems"]);
|
|
10
|
+
return (React.createElement(OakSpan, __assign({}, rest), listItems.map(function (item, i) {
|
|
11
|
+
return (React.createElement(OakSpan, { key: i },
|
|
12
|
+
i !== 0 && React.createElement(OakSpan, null, " \u2022 "),
|
|
13
|
+
React.createElement(OakSpan, null, item)));
|
|
14
|
+
})));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { OakBulletList };
|