@oaknational/oak-components 3.0.0 → 3.1.1
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/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
- /package/dist/{types.d.ts → npm/cjs/types.d.ts} +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakLoadingSpinner } from '../OakLoadingSpinner/OakLoadingSpinner.js';
|
|
4
|
+
import { InternalShadowRoundButton } from '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
5
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
+
import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
|
|
8
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
9
|
+
|
|
10
|
+
var bannerTypes = {
|
|
11
|
+
info: {
|
|
12
|
+
icon: "info",
|
|
13
|
+
iconColorFilter: "icon-primary",
|
|
14
|
+
backgroundColour: "bg-decorative3-very-subdued",
|
|
15
|
+
borderColour: "border-decorative3",
|
|
16
|
+
},
|
|
17
|
+
neutral: {
|
|
18
|
+
icon: "info",
|
|
19
|
+
iconColorFilter: "icon-primary",
|
|
20
|
+
backgroundColour: "bg-neutral",
|
|
21
|
+
borderColour: "border-neutral-lighter",
|
|
22
|
+
},
|
|
23
|
+
success: {
|
|
24
|
+
icon: "success",
|
|
25
|
+
iconColorFilter: "icon-primary",
|
|
26
|
+
backgroundColour: "bg-decorative1-very-subdued",
|
|
27
|
+
borderColour: "border-decorative1-stronger",
|
|
28
|
+
},
|
|
29
|
+
alert: {
|
|
30
|
+
icon: "bell",
|
|
31
|
+
iconColorFilter: "icon-primary",
|
|
32
|
+
backgroundColour: "bg-decorative5-very-subdued",
|
|
33
|
+
borderColour: "border-decorative5-stronger",
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
icon: "warning",
|
|
37
|
+
iconColorFilter: "icon-warning",
|
|
38
|
+
backgroundColour: "bg-decorative6-very-subdued",
|
|
39
|
+
borderColour: "border-decorative6",
|
|
40
|
+
},
|
|
41
|
+
error: {
|
|
42
|
+
icon: "error",
|
|
43
|
+
iconColorFilter: "icon-error",
|
|
44
|
+
backgroundColour: "bg-incorrect",
|
|
45
|
+
borderColour: "border-error",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
var bannerVariants = {
|
|
49
|
+
regular: {
|
|
50
|
+
defaultIconDimensions: {
|
|
51
|
+
$width: "spacing-32",
|
|
52
|
+
$height: "spacing-32",
|
|
53
|
+
},
|
|
54
|
+
loadingSpinnerDimensions: {
|
|
55
|
+
$width: "spacing-24",
|
|
56
|
+
},
|
|
57
|
+
heading: {
|
|
58
|
+
$font: ["heading-7"],
|
|
59
|
+
},
|
|
60
|
+
ctaWrapper: {
|
|
61
|
+
$mt: "spacing-12",
|
|
62
|
+
},
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
bannerPadding: "spacing-16",
|
|
65
|
+
textContentGap: "spacing-4",
|
|
66
|
+
},
|
|
67
|
+
large: {
|
|
68
|
+
defaultIconDimensions: {
|
|
69
|
+
$width: "spacing-40",
|
|
70
|
+
$height: "spacing-40",
|
|
71
|
+
},
|
|
72
|
+
loadingSpinnerDimensions: {
|
|
73
|
+
$width: "spacing-32",
|
|
74
|
+
},
|
|
75
|
+
heading: {
|
|
76
|
+
$font: ["heading-6"],
|
|
77
|
+
},
|
|
78
|
+
ctaWrapper: {
|
|
79
|
+
$mt: "spacing-8",
|
|
80
|
+
},
|
|
81
|
+
closeButtonWrapper: {
|
|
82
|
+
$position: "absolute",
|
|
83
|
+
$top: "spacing-0",
|
|
84
|
+
$right: "spacing-0",
|
|
85
|
+
},
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
bannerPadding: "spacing-24",
|
|
88
|
+
textContentGap: "spacing-16",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* A inline banner that can be used to display important information to the user.
|
|
93
|
+
*
|
|
94
|
+
* ## Props
|
|
95
|
+
*
|
|
96
|
+
* - **isOpen** \- If true the banner will be displayed
|
|
97
|
+
* - **title?** \- Optional title to display in the banner, without this the banner will be more compact
|
|
98
|
+
* - **message** \- Message to display in the banner
|
|
99
|
+
* - **type?** \- Optional type of banner to display (info, neutral, success, alert, error, warning) (default: info)
|
|
100
|
+
* - **icon?** \- Optional icon to display in the banner
|
|
101
|
+
* - **iconColorFilter?** \- Optional color filter to apply to the icon
|
|
102
|
+
* - **isLoading?** \- If true show a loading spinner instead of an icon
|
|
103
|
+
* - **cta?** \- Optional call to action to display in the banner (ReactNode)
|
|
104
|
+
* - **canDismiss?** \- If true the banner can be dismissed (show close icon) (default: false)
|
|
105
|
+
* - **onDismiss?** \- Function called when the banner is dismissed
|
|
106
|
+
* - **closeButtonOverrideProps?** \- Props to override the close button (aria-label, etc)
|
|
107
|
+
* - **variant?** \- The variant of the inline banner to display (regular, large) (default: regular)
|
|
108
|
+
* - **...rest** \- Other props to be passed to the wrapper OakFlex component (can be used to override styles of the banner)
|
|
109
|
+
*/
|
|
110
|
+
var OakInlineBanner = function (_a) {
|
|
111
|
+
var _b, _c, _d, _e, _f;
|
|
112
|
+
var isOpen = _a.isOpen, title = _a.title, message = _a.message, _g = _a.type, type = _g === void 0 ? "info" : _g, icon = _a.icon, iconColorFilter = _a.iconColorFilter, isLoading = _a.isLoading, cta = _a.cta, _h = _a.canDismiss, canDismiss = _h === void 0 ? false : _h, _j = _a.onDismiss, onDismiss = _j === void 0 ? function () { } : _j, closeButtonOverrideProps = _a.closeButtonOverrideProps, _k = _a.variant, variant = _k === void 0 ? "regular" : _k, _l = _a.titleTag, titleTag = _l === void 0 ? "h1" : _l, props = __rest(_a, ["isOpen", "title", "message", "type", "icon", "iconColorFilter", "isLoading", "cta", "canDismiss", "onDismiss", "closeButtonOverrideProps", "variant", "titleTag"]);
|
|
113
|
+
var iconElement = (React.createElement(OakBox, null,
|
|
114
|
+
React.createElement(OakIcon, __assign({ iconName: (_c = icon !== null && icon !== void 0 ? icon : (_b = bannerTypes[type]) === null || _b === void 0 ? void 0 : _b.icon) !== null && _c !== void 0 ? _c : "info", "$colorFilter": iconColorFilter !== null && iconColorFilter !== void 0 ? iconColorFilter : (_d = bannerTypes[type]) === null || _d === void 0 ? void 0 : _d.iconColorFilter }, bannerVariants[variant].defaultIconDimensions, { "data-testid": "inline-banner-icon" }))));
|
|
115
|
+
var loader = (React.createElement(OakFlex, __assign({}, bannerVariants[variant].defaultIconDimensions, { "$flexShrink": 0, "$justifyContent": "center", "$alignItems": "center" }),
|
|
116
|
+
React.createElement(OakLoadingSpinner, __assign({}, bannerVariants[variant].loadingSpinnerDimensions, { "data-testid": "inline-banner-loading-spinner" }))));
|
|
117
|
+
var iconLogic = isLoading ? loader : iconElement;
|
|
118
|
+
return (React.createElement(OakFlex, __assign({ "data-testid": "oak-inline-banner", "$alignItems": title ? "start" : "end", "$display": isOpen ? "flex" : "none", "$background": (_e = bannerTypes[type]) === null || _e === void 0 ? void 0 : _e.backgroundColour, "$pa": bannerVariants[variant].bannerPadding, "$borderRadius": "border-radius-m", "$ba": "border-solid-s", "$borderStyle": "solid", "$borderColor": (_f = bannerTypes[type]) === null || _f === void 0 ? void 0 : _f.borderColour, "$flexDirection": "column" }, props),
|
|
119
|
+
React.createElement(OakFlex, { "$position": "relative", "$flexDirection": bannerVariants[variant].flexDirection, "$justifyContent": "space-between", "$alignItems": title || variant === "large" ? "start" : "center", "$gap": "spacing-12", "$width": "100%" },
|
|
120
|
+
iconLogic,
|
|
121
|
+
canDismiss && (React.createElement(OakFlex, __assign({ "$order": 2 }, bannerVariants[variant].closeButtonWrapper),
|
|
122
|
+
React.createElement(InternalShadowRoundButton, __assign({ "aria-label": "Dismiss banner", defaultIconBackground: "transparent", defaultIconColor: "icon-primary", defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconBackground: "icon-primary", hoverIconColor: "icon-inverted", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-24", iconSize: "spacing-24", iconName: "cross", "data-testid": "inline-banner-close-button", onClick: onDismiss }, closeButtonOverrideProps)))),
|
|
123
|
+
React.createElement(OakFlex, { "$order": 1, "$width": "100%", "$flexDirection": title ? "column" : "row", "$justifyContent": title ? "center" : "space-between", "$alignItems": title ? "start" : "center", "$gap": bannerVariants[variant].textContentGap },
|
|
124
|
+
title && (React.createElement(OakHeading, __assign({ "data-testid": "inline-banner-title", tag: titleTag }, bannerVariants[variant].heading), title)),
|
|
125
|
+
React.createElement(OakBox, { "$font": "body-2", "data-testid": "inline-banner-message" }, message),
|
|
126
|
+
cta && (React.createElement(OakFlex, __assign({}, (title ? bannerVariants[variant].ctaWrapper : {})), cta))))));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { OakInlineBanner, bannerTypes, bannerVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents textual user input from a keyboard, voice input, or any other text entry device.
|
|
6
|
+
* */
|
|
7
|
+
var OakKbd = function (_a) {
|
|
8
|
+
var children = _a.children;
|
|
9
|
+
return (React.createElement(OakSpan, { "$font": "body-3-bold", as: "kbd", "$borderColor": "border-decorative3-stronger", "$background": "bg-primary", "$borderRadius": "border-radius-m", "$ba": "border-solid-m", "$ph": "spacing-8", "$pv": "spacing-4", "$whiteSpace": "nowrap" }, children));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { OakKbd };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { __makeTemplateObject, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
4
|
+
import { OakScreenReader } from '../OakScreenReader/OakScreenReader.js';
|
|
5
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
6
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
7
|
+
import { responsiveStyle } from '../../../styles/utils/responsiveStyle.js';
|
|
8
|
+
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
9
|
+
|
|
10
|
+
var SpinnerKeyframe = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
11
|
+
var DelayedShow = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"], ["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
|
|
12
|
+
var StyledLoadingSpinner = styled.span(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", "\n ", "\n --inner-width: calc(var(--width) / 10 * 8);\n --thickness: calc(var(--width) / 12);\n\n display: inline-flex;\n width: var(--width);\n height: var(--width);\n\n ::after {\n content: \" \";\n display: block;\n width: var(--inner-width);\n height: var(--inner-width);\n margin: var(--thickness);\n border-radius: 50%;\n border: var(--thickness) solid currentcolor;\n ", "\n animation: ", " 1.2s linear infinite;\n }\n ", "\n"], ["\n ", "\n ", "\n --inner-width: calc(var(--width) / 10 * 8);\n --thickness: calc(var(--width) / 12);\n\n display: inline-flex;\n width: var(--width);\n height: var(--width);\n\n ::after {\n content: \" \";\n display: block;\n width: var(--inner-width);\n height: var(--inner-width);\n margin: var(--thickness);\n border-radius: 50%;\n border: var(--thickness) solid currentcolor;\n ", "\n animation: ", " 1.2s linear infinite;\n }\n ", "\n"])), function (props) {
|
|
13
|
+
return props.$width
|
|
14
|
+
? responsiveStyle("--width", function (props) { return props.$width; }, parseSpacing)
|
|
15
|
+
: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n --width: 1.25rem;\n "], ["\n --width: 1.25rem;\n "])));
|
|
16
|
+
}, function (_a) {
|
|
17
|
+
var $delay = _a.$delay;
|
|
18
|
+
if ($delay) {
|
|
19
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n opacity: 0;\n animation: ", " 0s;\n animation-delay: ", "s;\n animation-fill-mode: forwards;\n "], ["\n opacity: 0;\n animation: ", " 0s;\n animation-delay: ", "s;\n animation-fill-mode: forwards;\n "])), DelayedShow, $delay / 1000);
|
|
20
|
+
}
|
|
21
|
+
}, function (props) {
|
|
22
|
+
return props.loaderColor
|
|
23
|
+
? css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-color: ", "\n ", " ", "\n transparent;\n "], ["\n border-color: ", "\n ", " ", "\n transparent;\n "])), parseColor(props.loaderColor), parseColor(props.loaderColor), parseColor(props.loaderColor)) : css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n border-color: currentcolor currentcolor currentcolor transparent;\n "], ["\n border-color: currentcolor currentcolor currentcolor transparent;\n "])));
|
|
24
|
+
}, SpinnerKeyframe, colorStyle);
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* A loading spinner of variable size.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
var OakLoadingSpinner = function (props) { return (React.createElement(StyledLoadingSpinner, __assign({}, props),
|
|
31
|
+
React.createElement(OakScreenReader, null, "Loading"))); };
|
|
32
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
33
|
+
|
|
34
|
+
export { OakLoadingSpinner };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { __makeTemplateObject, __read, __assign } from 'tslib';
|
|
2
|
+
import React, { useState, useRef, useCallback, useLayoutEffect, useEffect } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { FocusOn } from 'react-focus-on';
|
|
5
|
+
import { Transition } from 'react-transition-group';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { InternalShadowRoundButton } from '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
8
|
+
import { oakBoxCss, OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
9
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
10
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
11
|
+
|
|
12
|
+
var FocusOnBox = styled(FocusOn)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), oakBoxCss);
|
|
13
|
+
var BlurredOakBox = styled(OakBox)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n backdrop-filter: blur(3px);\n"], ["\n backdrop-filter: blur(3px);\n"])));
|
|
14
|
+
var FadeInFlex = styled(OakFlex)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n opacity: ", ";\n transition: opacity 0s;\n"], ["\n opacity: ", ";\n transition: opacity 0s;\n"])), function (_a) {
|
|
15
|
+
var $state = _a.$state;
|
|
16
|
+
switch ($state) {
|
|
17
|
+
case "entered":
|
|
18
|
+
case "entering":
|
|
19
|
+
return "1";
|
|
20
|
+
default:
|
|
21
|
+
return "0";
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Centered modal dialog with trapped focus, close button, backdrop click, and escape key handling.
|
|
26
|
+
*
|
|
27
|
+
* ## Props
|
|
28
|
+
*
|
|
29
|
+
* - **isOpen** \- If true the modal will be open, if false it will be closed
|
|
30
|
+
* - **onClose** \- Called when the modal is closed via the close button, backdrop click, or escape key
|
|
31
|
+
* - **children** \- The content of the modal. Use with `<OakModalCenterBody>` for best results.
|
|
32
|
+
* - **domContainer** \- The DOM container to render the modal portal into.
|
|
33
|
+
* - **disableBackdropClick?** \- If true, clicking the backdrop will not call onClose
|
|
34
|
+
* - **disableEscapeKey?** \- If true, pressing the escape key will not call onClose
|
|
35
|
+
* - **hideCloseButton?** \- If true, the close button will be hidden
|
|
36
|
+
* - **modalFlexProps?** \- Override HTMLAttributes & OakFlex props for the modal container
|
|
37
|
+
* - **modalOuterFlexProps?** \- Override HTMLAttributes & OakFlex props for the outer modal container
|
|
38
|
+
* - **modalInnerFlexProps?** \- Override HTMLAttributes & OakFlex props for the inner modal container
|
|
39
|
+
* - **backdropFlexProps?** \- Override HTMLAttributes & OakFlex props for the backdrop container
|
|
40
|
+
* - **footerSlot?** \- Fixed area at the bottom of the modal, this will remain fixed in view if the content is scrollable
|
|
41
|
+
*/
|
|
42
|
+
var OakModalCenter = function (_a) {
|
|
43
|
+
var children = _a.children, domContainer = _a.domContainer, isOpen = _a.isOpen, _b = _a.onClose, onClose = _b === void 0 ? function () { } : _b, _c = _a.disableBackdropClick, disableBackdropClick = _c === void 0 ? false : _c, _d = _a.disableEscapeKey, disableEscapeKey = _d === void 0 ? false : _d, _e = _a.hideCloseButton, hideCloseButton = _e === void 0 ? false : _e, modalFlexProps = _a.modalFlexProps, modalOuterFlexProps = _a.modalOuterFlexProps, modalInnerFlexProps = _a.modalInnerFlexProps, backdropFlexProps = _a.backdropFlexProps, footerSlot = _a.footerSlot, returnFocus = _a.returnFocus;
|
|
44
|
+
var _f = __read(useState({
|
|
45
|
+
top: false,
|
|
46
|
+
bottom: false,
|
|
47
|
+
}), 2), scrollBorders = _f[0], setScrollBorders = _f[1];
|
|
48
|
+
var transitionRef = useRef(null);
|
|
49
|
+
var scrollBoxRef = useRef(null);
|
|
50
|
+
var checkForScroll = useCallback(function () {
|
|
51
|
+
// To show some borders when the content is scrollable
|
|
52
|
+
var scrollBoxElem = scrollBoxRef.current;
|
|
53
|
+
if (!scrollBoxElem) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (scrollBoxElem.scrollHeight > scrollBoxElem.clientHeight) {
|
|
57
|
+
scrollBoxRef.current.tabIndex = 0;
|
|
58
|
+
}
|
|
59
|
+
setScrollBorders({
|
|
60
|
+
top: scrollBoxElem.scrollTop > 0,
|
|
61
|
+
bottom: scrollBoxElem.scrollHeight > scrollBoxElem.clientHeight,
|
|
62
|
+
});
|
|
63
|
+
}, []);
|
|
64
|
+
useLayoutEffect(function () {
|
|
65
|
+
var _a;
|
|
66
|
+
checkForScroll();
|
|
67
|
+
(_a = scrollBoxRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", checkForScroll);
|
|
68
|
+
return function () {
|
|
69
|
+
var _a;
|
|
70
|
+
(_a = scrollBoxRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", checkForScroll);
|
|
71
|
+
};
|
|
72
|
+
}, [isOpen]);
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
window.addEventListener("resize", checkForScroll);
|
|
75
|
+
return function () {
|
|
76
|
+
window.removeEventListener("resize", checkForScroll);
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
var isClientSide = typeof window !== "undefined";
|
|
80
|
+
var modal = (React.createElement(Transition, { in: isOpen, nodeRef: transitionRef, addEndListener: function (done) {
|
|
81
|
+
var _a;
|
|
82
|
+
(_a = transitionRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("transitionend", done);
|
|
83
|
+
}, timeout: 0, mountOnEnter: true, unmountOnExit: true }, function (state) { return (React.createElement(FadeInFlex, { ref: transitionRef, "$state": state, "$position": "fixed", "$inset": "spacing-0", "$justifyContent": "center", "$alignItems": "center", "$zIndex": "modal-dialog" },
|
|
84
|
+
React.createElement(BlurredOakBox, __assign({ "$position": "fixed", "$inset": "spacing-0", "$zIndex": "behind", "$background": "bg-inverted-semi-transparent", "data-testid": "backdrop" }, backdropFlexProps)),
|
|
85
|
+
React.createElement(OakFlex, __assign({ "$alignItems": "center", "$justifyContent": "center", "$maxWidth": "spacing-960", "$width": "100%", "$pa": "spacing-20" }, modalOuterFlexProps),
|
|
86
|
+
React.createElement(FocusOnBox, { onEscapeKey: function () { return !disableEscapeKey && onClose(); }, onClickOutside: function () { return !disableBackdropClick && onClose(); }, returnFocus: returnFocus !== null && returnFocus !== void 0 ? returnFocus : true, autoFocus: true, "$width": "100%" },
|
|
87
|
+
React.createElement(OakFlex, __assign({ "$flexDirection": "column", "$background": "bg-primary", "$borderRadius": "border-radius-l", "$width": "100%", "$position": "relative", role: "alertdialog", style: {
|
|
88
|
+
maxHeight: "calc(100vh - ".concat(parseSpacing("spacing-56"), " - ").concat(parseSpacing("spacing-56"), ")"),
|
|
89
|
+
} }, modalFlexProps),
|
|
90
|
+
React.createElement(OakBox, { "$minHeight": "spacing-56", "$position": "relative" }, !hideCloseButton && (React.createElement(OakBox, { "$position": "absolute", "$top": "spacing-12", "$right": "spacing-12" },
|
|
91
|
+
React.createElement(InternalShadowRoundButton, { onClick: onClose, "aria-label": "Close Modal", defaultIconBackground: "transparent", defaultIconColor: "icon-primary", defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconBackground: "icon-primary", hoverIconColor: "icon-inverted", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-32", iconSize: "spacing-32", iconName: "cross", "data-testid": "close-button" })))),
|
|
92
|
+
React.createElement("div", { style: { display: "contents" }, "data-autofocus-inside": true },
|
|
93
|
+
React.createElement(OakFlex, __assign({ ref: scrollBoxRef, "data-testid": "modal-main-content", "$overflow": "auto", "$flexDirection": "column", "$ph": "spacing-56", "$bt": scrollBorders.top ? "border-solid-s" : "border-solid-none", "$bb": scrollBorders.bottom
|
|
94
|
+
? "border-solid-s"
|
|
95
|
+
: "border-solid-none", "$borderColor": "border-neutral-lighter" }, modalInnerFlexProps), children),
|
|
96
|
+
footerSlot)))))); }));
|
|
97
|
+
if (domContainer && isClientSide) {
|
|
98
|
+
return createPortal(modal, domContainer);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return modal;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
105
|
+
|
|
106
|
+
export { OakModalCenter };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
4
|
+
import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
|
|
5
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
*
|
|
9
|
+
* FIXME: This component should either live in its own folder or
|
|
10
|
+
* or be renamed to SubModalCenterBody and be excluded from the exports
|
|
11
|
+
* as per the rules stated in src/docs/namingConventions.mdx
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Intended to be used within the `OakModalCenter` component
|
|
16
|
+
* it provides a consistent layout for the body of the modal
|
|
17
|
+
* It includes an icon, a title, and the children passed to it.
|
|
18
|
+
* The icon and title can be extended/overridden with the `iconOverride` and `headingOverride` props.
|
|
19
|
+
*
|
|
20
|
+
* ## Props
|
|
21
|
+
*
|
|
22
|
+
* - **iconName** \- The name of the icon to display. Accepts an icon name token
|
|
23
|
+
* - **title** \- The title of the modal
|
|
24
|
+
* - **children** \- The content of the modal body
|
|
25
|
+
* - **headingOverride** \- Override HTMLAttributes & OakHEading props for the heading
|
|
26
|
+
* - **iconOverride** \- Override HTMLAttributes & OakIcon props for the icon
|
|
27
|
+
*/
|
|
28
|
+
var OakModalCenterBody = function (_a) {
|
|
29
|
+
var children = _a.children, _b = _a.iconName, iconName = _b === void 0 ? "info" : _b, title = _a.title, headingOverride = _a.headingOverride, iconOverride = _a.iconOverride, hideIcon = _a.hideIcon;
|
|
30
|
+
return (React.createElement(OakFlex, { "$pb": "spacing-24", "$width": "100%", "$flexDirection": "column", "$alignItems": "center", "$justifyContent": "center" },
|
|
31
|
+
!hideIcon && (React.createElement(OakIcon, __assign({ iconName: iconName, "$width": "spacing-100", "$height": "spacing-100", "$mb": "spacing-32", "data-testid": "icon" }, iconOverride))),
|
|
32
|
+
React.createElement(OakHeading, __assign({ "$font": ["heading-5", "heading-5", "heading-4"], "data-testid": "OakHeading-id", tag: "h1", "$mb": "spacing-32", "$textAlign": "center" }, headingOverride), title),
|
|
33
|
+
children));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { OakModalCenterBody };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
var screenReaderStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n"], ["\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n"])));
|
|
5
|
+
/**
|
|
6
|
+
* This component will visually hide its contents but will still be available
|
|
7
|
+
* to screen readers, assitive technology, and scrapers.
|
|
8
|
+
* ## Usage
|
|
9
|
+
* Use this component in places where content shouldn't be visible, but should
|
|
10
|
+
* be accessible to assistive technology.
|
|
11
|
+
*/
|
|
12
|
+
var OakScreenReader = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), screenReaderStyle);
|
|
13
|
+
var templateObject_1, templateObject_2;
|
|
14
|
+
|
|
15
|
+
export { OakScreenReader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
4
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
5
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
6
|
+
|
|
7
|
+
var OakTagFunctional = function (props) {
|
|
8
|
+
var label = props.label, useSpan = props.useSpan, oakFlexProps = __rest(props, ["label", "useSpan"]);
|
|
9
|
+
var icon = props.iconName && (React.createElement(OakIcon, { "$height": "spacing-20", "$width": "spacing-20", iconName: props.iconName }));
|
|
10
|
+
var trailingIcon = props.isTrailingIcon && icon;
|
|
11
|
+
var leadingIcon = !props.isTrailingIcon && icon;
|
|
12
|
+
return (React.createElement(OakFlex, __assign({ "$borderRadius": "border-radius-m", "$ph": "spacing-8", "$pv": "spacing-4", "$font": "heading-light-7", "$gap": "spacing-8" }, oakFlexProps),
|
|
13
|
+
leadingIcon,
|
|
14
|
+
React.createElement(OakBox, { as: useSpan ? "span" : undefined }, label),
|
|
15
|
+
trailingIcon));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { OakTagFunctional };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __makeTemplateObject, __read } from 'tslib';
|
|
2
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Transition } from 'react-transition-group';
|
|
5
|
+
import { InternalShadowIconButton } from '../../internal-components/InternalShadowIconButton/InternalShadowIconButton.js';
|
|
6
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
+
import { parseOpacity } from '../../../styles/helpers/parseOpacity.js';
|
|
8
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
9
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
10
|
+
|
|
11
|
+
var SuccessIconBackground = styled(OakBox)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n top: 6px;\n left: 6px;\n"], ["\n top: 6px;\n left: 6px;\n"])));
|
|
12
|
+
var SuccessIcon = (React.createElement(OakBox, { "$position": "relative" },
|
|
13
|
+
React.createElement(SuccessIconBackground, { "$width": "spacing-20", "$height": "spacing-20", "$background": "bg-primary", "$borderRadius": "border-radius-circle", "$position": "absolute" }),
|
|
14
|
+
React.createElement(OakIcon, { iconName: "success", "$width": "spacing-32", "$height": "spacing-32" })));
|
|
15
|
+
var variants = {
|
|
16
|
+
green: {
|
|
17
|
+
background: "bg-decorative1-main",
|
|
18
|
+
icon: SuccessIcon,
|
|
19
|
+
color: "text-primary",
|
|
20
|
+
},
|
|
21
|
+
yellow: {
|
|
22
|
+
background: "bg-decorative5-main",
|
|
23
|
+
icon: SuccessIcon,
|
|
24
|
+
color: "text-primary",
|
|
25
|
+
},
|
|
26
|
+
pink: {
|
|
27
|
+
background: "bg-decorative4-main",
|
|
28
|
+
icon: SuccessIcon,
|
|
29
|
+
color: "text-primary",
|
|
30
|
+
},
|
|
31
|
+
blue: {
|
|
32
|
+
background: "bg-decorative3-main",
|
|
33
|
+
icon: SuccessIcon,
|
|
34
|
+
color: "text-primary",
|
|
35
|
+
},
|
|
36
|
+
aqua: {
|
|
37
|
+
background: "bg-decorative2-main",
|
|
38
|
+
icon: SuccessIcon,
|
|
39
|
+
color: "text-primary",
|
|
40
|
+
},
|
|
41
|
+
light: {
|
|
42
|
+
background: "bg-primary",
|
|
43
|
+
icon: SuccessIcon,
|
|
44
|
+
color: "text-primary",
|
|
45
|
+
},
|
|
46
|
+
dark: {
|
|
47
|
+
background: "bg-inverted",
|
|
48
|
+
icon: SuccessIcon,
|
|
49
|
+
color: "text-inverted",
|
|
50
|
+
},
|
|
51
|
+
error: {
|
|
52
|
+
background: "bg-error",
|
|
53
|
+
icon: (React.createElement(OakIcon, { iconName: "warning", "$colorFilter": "text-inverted", "$height": "spacing-32", "$width": "spacing-32" })),
|
|
54
|
+
color: "text-inverted",
|
|
55
|
+
},
|
|
56
|
+
success: {
|
|
57
|
+
background: "bg-success",
|
|
58
|
+
icon: SuccessIcon,
|
|
59
|
+
color: "text-inverted",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
var StyledFlex = styled(OakFlex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"], ["\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"])), function (_a) {
|
|
63
|
+
var $state = _a.$state;
|
|
64
|
+
switch ($state) {
|
|
65
|
+
case "exiting":
|
|
66
|
+
case "entering":
|
|
67
|
+
return parseOpacity("semi-transparent");
|
|
68
|
+
case "exited":
|
|
69
|
+
return parseOpacity("transparent");
|
|
70
|
+
case "entered":
|
|
71
|
+
return parseOpacity("opaque");
|
|
72
|
+
default:
|
|
73
|
+
return parseOpacity("transparent");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var OakToast = function (_a) {
|
|
77
|
+
var message = _a.message, variant = _a.variant, _b = _a.autoDismiss, autoDismiss = _b === void 0 ? false : _b, _c = _a.autoDismissDuration, autoDismissDuration = _c === void 0 ? 5000 : _c, showIcon = _a.showIcon, onClose = _a.onClose, id = _a.id, _d = _a.showClose, showClose = _d === void 0 ? false : _d;
|
|
78
|
+
var _e = __read(useState(true), 2), isVisible = _e[0], setIsVisible = _e[1];
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
if (autoDismiss && isVisible) {
|
|
81
|
+
var timer_1 = setTimeout(function () {
|
|
82
|
+
setIsVisible(false);
|
|
83
|
+
}, Math.max(5000, autoDismissDuration));
|
|
84
|
+
return function () { return clearTimeout(timer_1); };
|
|
85
|
+
}
|
|
86
|
+
}, [autoDismiss, autoDismissDuration, isVisible, id]);
|
|
87
|
+
var transitionRef = useRef(null);
|
|
88
|
+
var _f = variants[variant], background = _f.background, icon = _f.icon, color = _f.color;
|
|
89
|
+
return (React.createElement(Transition, { nodeRef: transitionRef, in: isVisible, timeout: 300, appear: true, onExited: onClose }, function (state) { return (React.createElement(StyledFlex, { "data-testid": "oak-toast", "$pa": "spacing-16", "$borderRadius": "border-radius-m2", "$background": background, "$state": state, "$width": "max-content", "$maxWidth": ["spacing-240", "spacing-360"], "$gap": "spacing-12", "$dropShadow": "drop-shadow-standard", "$alignItems": "center", "$font": "heading-light-7", "$color": color, "$position": "relative" },
|
|
90
|
+
showIcon && icon,
|
|
91
|
+
message,
|
|
92
|
+
(!autoDismiss || showClose) && (React.createElement(InternalShadowIconButton, { "aria-label": "Dismiss", defaultIconColor: color, defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconColor: color, iconName: "cross", onClick: function () { return setIsVisible(false); } })))); }));
|
|
93
|
+
};
|
|
94
|
+
var templateObject_1, templateObject_2;
|
|
95
|
+
|
|
96
|
+
export { OakToast };
|
|
@@ -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 };
|