@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,16 @@
|
|
|
1
|
+
import { __read } from 'tslib';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if the user has requested that the system minimize the amount of non-essential motion it uses.
|
|
6
|
+
*/
|
|
7
|
+
function usePrefersReducedMotion() {
|
|
8
|
+
var _a = __read(useState(false), 2), prefersReducedMotion = _a[0], setPrefersReducedMotion = _a[1];
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
var mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
11
|
+
setPrefersReducedMotion(mediaQuery.matches);
|
|
12
|
+
}, []);
|
|
13
|
+
return prefersReducedMotion;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { usePrefersReducedMotion };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import { createGlobalStyle } from 'styled-components';
|
|
3
|
+
import { resetGlobalCss } from '../../styles/global/reset.styles.js';
|
|
4
|
+
import { oakGlobalCss } from '../../styles/global/oak.styles.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Currently this is just for storybook as it is already applied in OWA
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
var OakGlobalStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), resetGlobalCss, oakGlobalCss);
|
|
12
|
+
var templateObject_1;
|
|
13
|
+
|
|
14
|
+
export { OakGlobalStyle };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeProvider } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* OakThemeProvider wraps Styled Components ThemeProvider allowing the use of the custom type OakTheme.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
var OakThemeProvider = function (_a) {
|
|
10
|
+
var theme = _a.theme, children = _a.children;
|
|
11
|
+
return React.createElement(ThemeProvider, { theme: theme }, children);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { OakThemeProvider };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __read, __rest, __assign } from 'tslib';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { OakSecondaryButton } from '../OakSecondaryButton/OakSecondaryButton.js';
|
|
4
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
5
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A shared component that provides dropdown functionality for any button type.
|
|
9
|
+
* Accepts the button component as a prop to eliminate code duplication.
|
|
10
|
+
*/
|
|
11
|
+
var OakButtonWithDropdown = function (_a) {
|
|
12
|
+
var primaryActionText = _a.primaryActionText, _b = _a.primaryActionIcon, primaryActionIcon = _b === void 0 ? "chevron-down" : _b, onPrimaryAction = _a.onPrimaryAction, children = _a.children, _c = _a.isLoading, isLoading = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, ariaLabel = _a.ariaLabel, ariaDescription = _a.ariaDescription, leadingButtonIcon = _a.leadingButtonIcon, dataTestId = _a["data-testid"], ButtonComponent = _a.buttonComponent, _e = _a.dropdownTopSpacing, dropdownTopSpacing = _e === void 0 ? "spacing-56" : _e, flexWidth = _a.flexWidth, closeOnChange = _a.closeOnChange;
|
|
13
|
+
var _f = __read(useState(false), 2), isOpen = _f[0], setIsOpen = _f[1];
|
|
14
|
+
var dropdownRef = useRef(null);
|
|
15
|
+
// Get all focusable elements within the dropdown
|
|
16
|
+
var getFocusableElements = function () {
|
|
17
|
+
if (!dropdownRef.current)
|
|
18
|
+
return [];
|
|
19
|
+
return Array.from(dropdownRef.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));
|
|
20
|
+
};
|
|
21
|
+
var handleCloseOnChange = function () {
|
|
22
|
+
if (closeOnChange) {
|
|
23
|
+
setIsOpen(false);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
// Handle clicks the dropdown to close it
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var handleKeyDown = function (event) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (!isOpen)
|
|
31
|
+
return;
|
|
32
|
+
var focusableElements = getFocusableElements();
|
|
33
|
+
var currentIndex = focusableElements.indexOf(document.activeElement);
|
|
34
|
+
switch (event.key) {
|
|
35
|
+
case "Escape": {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "ArrowDown": {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
if (focusableElements.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
var nextDownIndex = currentIndex >= focusableElements.length - 1 ? 0 : currentIndex + 1;
|
|
45
|
+
(_a = focusableElements[nextDownIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "ArrowUp": {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
if (focusableElements.length === 0)
|
|
51
|
+
return;
|
|
52
|
+
var nextUpIndex = currentIndex <= 0 ? focusableElements.length - 1 : currentIndex - 1;
|
|
53
|
+
(_b = focusableElements[nextUpIndex]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "Enter": {
|
|
57
|
+
handleCloseOnChange();
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case "Return": {
|
|
61
|
+
handleCloseOnChange();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case " ": {
|
|
65
|
+
handleCloseOnChange();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var handleClick = function (event) {
|
|
71
|
+
if (dropdownRef.current &&
|
|
72
|
+
(!dropdownRef.current.contains(event.target) || !!closeOnChange)) {
|
|
73
|
+
setIsOpen(false);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
if (isOpen) {
|
|
77
|
+
document.addEventListener("mousedown", handleClick);
|
|
78
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
79
|
+
}
|
|
80
|
+
return function () {
|
|
81
|
+
document.removeEventListener("mousedown", handleClick);
|
|
82
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
83
|
+
};
|
|
84
|
+
}, [isOpen, dataTestId]);
|
|
85
|
+
var handlePrimaryAction = function () {
|
|
86
|
+
setIsOpen(!isOpen);
|
|
87
|
+
onPrimaryAction === null || onPrimaryAction === void 0 ? void 0 : onPrimaryAction();
|
|
88
|
+
};
|
|
89
|
+
return (React.createElement(OakBox, { as: "section", "aria-label": ariaLabel, "aria-describedby": ariaDescription ? "".concat(dataTestId, "-description") : undefined, "data-testid": dataTestId, ref: dropdownRef, "$position": "relative" },
|
|
90
|
+
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-12" },
|
|
91
|
+
React.createElement(OakFlex, { "$width": flexWidth, "$gap": "spacing-12" },
|
|
92
|
+
React.createElement(ButtonComponent, { iconName: primaryActionIcon, isTrailingIcon: true, onClick: handlePrimaryAction, isLoading: isLoading, disabled: disabled, width: "max-content", "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": primaryActionText, "data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined },
|
|
93
|
+
React.createElement(OakFlex, { "$alignItems": "center" },
|
|
94
|
+
leadingButtonIcon,
|
|
95
|
+
primaryActionText))),
|
|
96
|
+
isOpen && (React.createElement(OakBox, { "$background": "bg-primary", "$borderRadius": "border-radius-s", "$ba": "border-solid-m", "$borderColor": "border-primary", "$pa": "spacing-8", "$position": "absolute", "$top": dropdownTopSpacing, "$zIndex": "modal-close-button", role: "menu", "aria-label": "Dropdown menu. Use arrow keys to navigate, Tab to cycle through items, Escape to close.", "data-testid": dataTestId ? "".concat(dataTestId, "-dropdown") : undefined },
|
|
97
|
+
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8" }, children))))));
|
|
98
|
+
};
|
|
99
|
+
OakButtonWithDropdown.Divider = function () { return (React.createElement(OakBox, { "$height": "spacing-0", "$width": "100%", "$bt": "border-solid-s", "$borderColor": "border-neutral-lighter", "aria-hidden": "true" })); };
|
|
100
|
+
OakButtonWithDropdown.Item = function (_a) {
|
|
101
|
+
var children = _a.children; _a.element; var rest = __rest(_a, ["children", "element"]);
|
|
102
|
+
return (React.createElement(OakSecondaryButton, __assign({ element: "a", role: "menuitem", isTrailingIcon: true }, rest), children));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { OakButtonWithDropdown };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRoundButton } from '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* An icon button that can be used for closing items such as in navigation menus and modals.
|
|
8
|
+
*
|
|
9
|
+
* Design system: <https://www.figma.com/design/YcWQMMhHPVVmc47cHHEEAl/Oak-Design-Kit?node-id=14493-15312>
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
function OakCloseButton(_a) {
|
|
14
|
+
var onClose = _a.onClose, rest = __rest(_a, ["onClose"]);
|
|
15
|
+
return (React.createElement(InternalShadowRoundButton, __assign({ onClick: onClose, "aria-label": "Close", defaultIconBackground: "transparent", defaultIconColor: "icon-primary", defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconBackground: "bg-neutral", hoverIconColor: "icon-primary", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-24", iconSize: "spacing-24", iconName: "cross", hoverDropShadow: null }, rest)));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { OakCloseButton };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
5
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
6
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
7
|
+
import { OakSvg } from '../../images-and-icons/OakSvg/OakSvg.js';
|
|
8
|
+
import { InternalButton } from '../../internal-components/InternalButton/InternalButton.js';
|
|
9
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
10
|
+
import { OakLoadingSpinner } from '../../messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js';
|
|
11
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
12
|
+
import { positionStyle } from '../../../styles/utils/positionStyle.js';
|
|
13
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
14
|
+
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
15
|
+
|
|
16
|
+
var StyledInternalButton = styled(InternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n display: inline-block;\n ", "\n"], ["\n ", "\n ", "\n display: inline-block;\n ", "\n"])), positionStyle, sizeStyle, function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n color: ", ";\n background: ", ";\n border-color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:active {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:disabled {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n "], ["\n &:hover {\n color: ", ";\n background: ", ";\n border-color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:active {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:disabled {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n "])), parseColor(props.$hoverTextColor), parseColor(props.$hoverBackground), parseColor(props.$hoverBorderColor), parseColor(props.$defaultBackground), parseColor(props.$defaultBorderColor), parseColor(props.$defaultTextColor), parseColor(props.$disabledBackground), parseColor(props.$disabledBorderColor), parseColor(props.$disabledTextColor)); });
|
|
17
|
+
var StyledOakSvg = styled(OakSvg)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n bottom: -3px;\n left: 0px;\n position: absolute;\n height: 5px;\n color: ", ";\n"], ["\n bottom: -3px;\n left: 0px;\n position: absolute;\n height: 5px;\n color: ", ";\n"])), parseColor("border-decorative1"));
|
|
18
|
+
var StyledButtonWrapper = styled(OakBox)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n .grey-shadow:has(+ * + .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:hover),\n .grey-shadow:has(+ * + .internal-button:hover) {\n box-shadow: none;\n }\n .grey-shadow:has(+ * + .internal-button:active) {\n box-shadow: ", ";\n }\n"], ["\n .grey-shadow:has(+ * + .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:hover),\n .grey-shadow:has(+ * + .internal-button:hover) {\n box-shadow: none;\n }\n .grey-shadow:has(+ * + .internal-button:active) {\n box-shadow: ", ";\n }\n"])), parseDropShadow("drop-shadow-centered-grey"), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-grey"));
|
|
19
|
+
/**
|
|
20
|
+
* A left-aligned button styled similarly to OakSmallPrimaryInvertedButton
|
|
21
|
+
* with configurable icon alignment.
|
|
22
|
+
*
|
|
23
|
+
* The following callbacks are available for tracking focus events:
|
|
24
|
+
*
|
|
25
|
+
* ### onClick
|
|
26
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
27
|
+
*
|
|
28
|
+
* ### onHovered
|
|
29
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`
|
|
30
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
31
|
+
*/
|
|
32
|
+
var OakLeftAlignedButton = function (props) {
|
|
33
|
+
var _a = props.element, element = _a === void 0 ? "button" : _a, children = props.children, iconName = props.iconName, isTrailingIcon = props.isTrailingIcon, isLoading = props.isLoading, disabled = props.disabled, _b = props.width, width = _b === void 0 ? "max-content" : _b, _c = props.height, height = _c === void 0 ? "auto" : _c, maxWidth = props.maxWidth, innerWidth = props.innerWidth, className = props.className, selected = props.selected, _d = props.rightAlignIcon, rightAlignIcon = _d === void 0 ? false : _d, rest = __rest(props, ["element", "children", "iconName", "isTrailingIcon", "isLoading", "disabled", "width", "height", "maxWidth", "innerWidth", "className", "selected", "rightAlignIcon"]);
|
|
34
|
+
var icon = iconName && (React.createElement(OakIcon, { iconName: iconName, "$width": "spacing-24", "$height": "spacing-24", "$colorFilter": disabled ? "text-disabled" : "text-primary" }));
|
|
35
|
+
var loader = (React.createElement(OakBox, { "$width": "spacing-20", "$height": "spacing-20" },
|
|
36
|
+
React.createElement(OakLoadingSpinner, { "$width": "spacing-20" })));
|
|
37
|
+
var iconLogic = isLoading && !disabled ? loader : icon;
|
|
38
|
+
// If the icon should be rightAligned, it must be trailing
|
|
39
|
+
var shouldTrailIcon = isTrailingIcon || rightAlignIcon;
|
|
40
|
+
return (React.createElement(StyledButtonWrapper, { className: className, "$position": "relative", "$width": width, "$height": height, "$maxWidth": maxWidth },
|
|
41
|
+
React.createElement(OakBox, { className: "grey-shadow", "$position": "absolute", "$borderRadius": "border-radius-s", "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
|
|
42
|
+
React.createElement(OakBox, { className: "yellow-shadow", "$position": "absolute", "$borderRadius": "border-radius-s", "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
|
|
43
|
+
React.createElement(StyledInternalButton, __assign({ element: element, className: "internal-button", "$ba": "border-solid-m", "$background": "bg-btn-secondary", "$borderColor": "bg-btn-secondary", "$color": "text-primary", "$pv": "spacing-4", "$ph": "spacing-8", "$borderRadius": "border-radius-s", "$position": "relative", disabled: disabled || isLoading, "$width": "100%", "$height": "100%", "$hoverTextColor": "text-primary", "$hoverBackground": "bg-btn-secondary-hover", "$hoverBorderColor": "bg-btn-secondary-hover", "$defaultTextColor": "text-primary", "$defaultBackground": "bg-btn-secondary", "$defaultBorderColor": "bg-btn-secondary", "$disabledTextColor": "text-disabled", "$disabledBackground": "bg-btn-secondary", "$disabledBorderColor": "bg-btn-secondary" }, rest),
|
|
44
|
+
React.createElement(OakFlex, { "data-testid": "left-aligned-btn-flex-container", "$flexDirection": "row", "$alignItems": "center", "$gap": "spacing-8", "$justifyContent": rightAlignIcon ? "space-between" : "start", "$width": innerWidth },
|
|
45
|
+
!shouldTrailIcon && iconLogic,
|
|
46
|
+
selected ? (React.createElement(TextWithUnderline, null, children)) : (React.createElement(OakSpan, { "$font": "body-3-bold", "$textAlign": "left" }, children)),
|
|
47
|
+
shouldTrailIcon && iconLogic))));
|
|
48
|
+
};
|
|
49
|
+
var TextWithUnderline = function (_a) {
|
|
50
|
+
var children = _a.children;
|
|
51
|
+
return (React.createElement(OakBox, { "$position": "relative", "$textAlign": "left" },
|
|
52
|
+
React.createElement(OakSpan, { "$font": "body-3-bold" }, children),
|
|
53
|
+
React.createElement(StyledOakSvg, { name: "underline", "data-state": "selected", "data-testid": "selected-underline" })));
|
|
54
|
+
};
|
|
55
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
56
|
+
|
|
57
|
+
export { OakLeftAlignedButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButtoną
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakPrimaryButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "bg-btn-primary", defaultBackground: "bg-btn-primary", defaultTextColor: "text-inverted", hoverBackground: "bg-btn-primary-hover", hoverBorderColor: "bg-btn-primary-hover", hoverTextColor: "text-inverted", hoverUnderline: true, disabledBackground: "bg-btn-primary-disabled", disabledBorderColor: "text-disabled", disabledTextColor: "text-inverted" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakPrimaryButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:ą
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakPrimaryInvertedButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "bg-btn-secondary", defaultBackground: "bg-btn-secondary", defaultTextColor: "text-primary", hoverBackground: "bg-btn-secondary-hover", hoverBorderColor: "bg-btn-secondary-hover", hoverTextColor: "text-primary", hoverUnderline: true, disabledBackground: "bg-btn-secondary", disabledBorderColor: "bg-btn-secondary", disabledTextColor: "text-disabled", hoverShadow: null }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakPrimaryInvertedButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakSecondaryButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "text-primary", defaultBackground: "bg-btn-secondary", defaultTextColor: "text-primary", hoverBackground: "bg-btn-secondary-hover", hoverBorderColor: "text-primary", hoverTextColor: "text-primary", hoverUnderline: true, disabledBackground: "bg-btn-secondary-disabled", disabledBorderColor: "text-disabled", disabledTextColor: "text-disabled" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakSecondaryButton };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __assign, __rest } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakPrimaryInvertedButton } from '../OakPrimaryInvertedButton/OakPrimaryInvertedButton.js';
|
|
4
|
+
import { OakSecondaryButton } from '../OakSecondaryButton/OakSecondaryButton.js';
|
|
5
|
+
import { OakButtonWithDropdown } from '../OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A secondary button that takes custom menu items or .Item and .Divider compound components as children.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
var OakSecondaryButtonWithDropdown = function (props) {
|
|
12
|
+
return (React.createElement(OakButtonWithDropdown, __assign({}, props, { buttonComponent: OakSecondaryButton, dropdownTopSpacing: "spacing-56" })));
|
|
13
|
+
};
|
|
14
|
+
OakSecondaryButtonWithDropdown.Divider = function () { return (React.createElement(OakButtonWithDropdown.Divider, null)); };
|
|
15
|
+
OakSecondaryButtonWithDropdown.Item = function (_a) {
|
|
16
|
+
var children = _a.children; _a.element; var rest = __rest(_a, ["children", "element"]);
|
|
17
|
+
return (React.createElement(OakPrimaryInvertedButton, __assign({ element: "a", role: "menuitem", isTrailingIcon: true }, rest), children));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { OakSecondaryButtonWithDropdown };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakSmallPrimaryButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "bg-btn-primary", defaultBackground: "bg-btn-primary", defaultTextColor: "text-inverted", hoverBackground: "bg-btn-primary-hover", hoverBorderColor: "bg-btn-primary-hover", hoverTextColor: "text-inverted", disabledBackground: "bg-btn-primary-disabled", disabledBorderColor: "text-disabled", disabledTextColor: "text-inverted", font: "body-3-bold", pv: "spacing-4", ph: "spacing-8", loadingSpinnerSize: "spacing-20", iconGap: "spacing-4" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakSmallPrimaryButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakSmallPrimaryInvertedButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "bg-btn-secondary", defaultBackground: "bg-btn-secondary", defaultTextColor: "text-primary", hoverBackground: "bg-btn-secondary-hover", hoverBorderColor: "bg-btn-secondary-hover", hoverTextColor: "text-primary", disabledBackground: "bg-btn-secondary", disabledBorderColor: "bg-btn-secondary", disabledTextColor: "text-disabled", hoverShadow: null, font: "body-3-bold", pv: "spacing-4", ph: "spacing-8", loadingSpinnerSize: "spacing-20", iconGap: "spacing-4" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakSmallPrimaryInvertedButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakSmallSecondaryButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: "text-primary", defaultBackground: "bg-btn-secondary", defaultTextColor: "text-primary", hoverBackground: "bg-btn-secondary-hover", hoverBorderColor: "text-primary", hoverTextColor: "text-primary", disabledBackground: "bg-btn-secondary-disabled", disabledBorderColor: "text-disabled", disabledTextColor: "text-disabled", font: "body-3-bold", pv: "spacing-4", ph: "spacing-8", loadingSpinnerSize: "spacing-24", iconGap: "spacing-4" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakSmallSecondaryButton };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __assign, __rest } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakSmallSecondaryButton } from '../OakSmallSecondaryButton/OakSmallSecondaryButton.js';
|
|
4
|
+
import { OakButtonWithDropdown } from '../OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
5
|
+
import { OakSmallPrimaryInvertedButton } from '../OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A secondary button that allows children to be passed in as a dropdown menu.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
var OakSmallSecondaryButtonWithDropdown = function (props) {
|
|
12
|
+
return (React.createElement(OakButtonWithDropdown, __assign({}, props, { buttonComponent: OakSmallSecondaryButton, dropdownTopSpacing: "spacing-40", flexWidth: ["100%"] })));
|
|
13
|
+
};
|
|
14
|
+
OakSmallSecondaryButtonWithDropdown.Divider = function () { return (React.createElement(OakButtonWithDropdown.Divider, null)); };
|
|
15
|
+
OakSmallSecondaryButtonWithDropdown.Item = function (_a) {
|
|
16
|
+
var children = _a.children; _a.element; var rest = __rest(_a, ["children", "element"]);
|
|
17
|
+
return (React.createElement(OakSmallPrimaryInvertedButton, __assign({ element: "a", role: "menuitem", isTrailingIcon: true }, rest), children));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { OakSmallSecondaryButtonWithDropdown };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRectButton } from '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalRectButton which can be displayed in two different states using the toggleOn prop
|
|
8
|
+
*
|
|
9
|
+
* This button does not manage its own state but could be adapted to do so at some point in the future
|
|
10
|
+
*
|
|
11
|
+
* The following callbacks are available for tracking focus events:
|
|
12
|
+
*
|
|
13
|
+
* ### onClick
|
|
14
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
15
|
+
*
|
|
16
|
+
* ### onHovered
|
|
17
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
18
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
19
|
+
*/
|
|
20
|
+
var OakSmallSecondaryToggleButton = function (_a) {
|
|
21
|
+
var element = _a.element, toggleOn = _a.toggleOn, rest = __rest(_a, ["element", "toggleOn"]);
|
|
22
|
+
var defaultBorderColor = toggleOn ? "bg-btn-primary" : "text-primary";
|
|
23
|
+
var defaultBackground = toggleOn ? "bg-btn-primary" : "bg-btn-secondary";
|
|
24
|
+
var defaultTextColor = toggleOn ? "text-inverted" : "text-primary";
|
|
25
|
+
var hoverBackground = toggleOn
|
|
26
|
+
? "bg-btn-primary-hover"
|
|
27
|
+
: "bg-btn-secondary-hover";
|
|
28
|
+
var hoverBorderColor = toggleOn ? "bg-btn-primary-hover" : "text-primary";
|
|
29
|
+
var hoverTextColor = toggleOn ? "text-inverted" : "text-primary";
|
|
30
|
+
var disabledBackground = toggleOn
|
|
31
|
+
? "bg-btn-primary-disabled"
|
|
32
|
+
: "bg-btn-secondary-disabled";
|
|
33
|
+
var disabledTextColor = toggleOn ? "text-inverted" : "text-disabled";
|
|
34
|
+
return (React.createElement(InternalShadowRectButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultBorderColor: defaultBorderColor, defaultBackground: defaultBackground, defaultTextColor: defaultTextColor, hoverBackground: hoverBackground, hoverBorderColor: hoverBorderColor, hoverTextColor: hoverTextColor, disabledBackground: disabledBackground, disabledBorderColor: "text-disabled", disabledTextColor: disabledTextColor, font: "body-3-bold", pv: "spacing-4", ph: "spacing-8", loadingSpinnerSize: "spacing-20", iconGap: "spacing-4", "aria-pressed": toggleOn }, rest)));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { OakSmallSecondaryToggleButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowIconButton } from '../../internal-components/InternalShadowIconButton/InternalShadowIconButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* A specific implementation of InternalShadowIconButton
|
|
8
|
+
*
|
|
9
|
+
* The following callbacks are available for tracking focus events:
|
|
10
|
+
*
|
|
11
|
+
* ### onClick
|
|
12
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
13
|
+
*
|
|
14
|
+
* ### onHovered
|
|
15
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
16
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
17
|
+
*/
|
|
18
|
+
var OakSmallTertiaryInvertedButton = function (_a) {
|
|
19
|
+
var element = _a.element, rest = __rest(_a, ["element"]);
|
|
20
|
+
return (React.createElement(InternalShadowIconButton, __assign({ element: element !== null && element !== void 0 ? element : "button", defaultTextColor: "text-primary", hoverTextColor: "text-primary", disabledTextColor: "text-disabled", disabledIconColor: "text-disabled" }, rest)));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { OakSmallTertiaryInvertedButton };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRoundButton } from '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An implementation of InternalShadowRoundButton, its a subtle button with no border and a round icon.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
var OakTertiaryButton = function (_a) {
|
|
10
|
+
var element = _a.element, isTrailingIcon = _a.isTrailingIcon, iconName = _a.iconName, children = _a.children, props = __rest(_a, ["element", "isTrailingIcon", "iconName", "children"]);
|
|
11
|
+
return (React.createElement(InternalShadowRoundButton, __assign({ element: element !== null && element !== void 0 ? element : "button" }, props, { isTrailingIcon: isTrailingIcon, iconName: iconName, defaultIconColor: "icon-inverted", disabledIconColor: "icon-inverted", disabledIconBackground: "bg-btn-primary-disabled", defaultIconBackground: "icon-primary", hoverIconBackground: "bg-btn-primary-hover", defaultTextColor: "text-primary", hoverTextColor: "bg-btn-primary-hover", disabledTextColor: "text-disabled", iconBackgroundSize: "spacing-32", iconSize: "spacing-24" }), children));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { OakTertiaryButton };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { InternalShadowRoundButton } from '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An implementation of InternalShadowRoundButton, its a subtle button with no border and a round icon.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
var OakTertiaryInvertedButton = function (_a) {
|
|
10
|
+
var element = _a.element, isTrailingIcon = _a.isTrailingIcon, iconName = _a.iconName, children = _a.children, props = __rest(_a, ["element", "isTrailingIcon", "iconName", "children"]);
|
|
11
|
+
return (React.createElement(InternalShadowRoundButton, __assign({ element: element !== null && element !== void 0 ? element : "button" }, props, { isTrailingIcon: isTrailingIcon, iconName: iconName, defaultIconColor: "text-primary", disabledIconColor: "icon-disabled", disabledIconBackground: "bg-btn-secondary-disabled", defaultIconBackground: "bg-btn-secondary", defaultIconBorderColor: "bg-btn-primary", disabledIconBorderColor: "border-neutral", hoverIconBackground: "bg-btn-secondary", defaultTextColor: "text-primary", hoverTextColor: "text-subdued", disabledTextColor: "text-disabled", iconBackgroundSize: "spacing-32", iconSize: "spacing-24" }), children));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { OakTertiaryInvertedButton };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
3
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
4
|
+
import '../../typography/OakHeading/OakHeading.js';
|
|
5
|
+
import '../../typography/OakLI/OakLI.js';
|
|
6
|
+
import '../../typography/OakOL/OakOL.js';
|
|
7
|
+
import '../../typography/OakP/OakP.js';
|
|
8
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
9
|
+
import '../../typography/OakTypography/OakTypography.js';
|
|
10
|
+
import '../../typography/OakUL/OakUL.js';
|
|
11
|
+
import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
|
|
12
|
+
import { OakSecondaryButton } from '../../buttons/OakSecondaryButton/OakSecondaryButton.js';
|
|
13
|
+
import { OakLink } from '../../navigation/OakLink/OakLink.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A banner presenting the user with options to accept or reject cookies.
|
|
17
|
+
*/
|
|
18
|
+
var OakCookieBanner = function (_a) {
|
|
19
|
+
var state = _a.state, innerMaxWidth = _a.innerMaxWidth, onOpenSettings = _a.onOpenSettings, onHide = _a.onHide, onAccept = _a.onAccept, onReject = _a.onReject, _b = _a.isFixed, isFixed = _b === void 0 ? false : _b, zIndex = _a.zIndex;
|
|
20
|
+
var finalZIndex = (function () {
|
|
21
|
+
if (typeof zIndex === "number") {
|
|
22
|
+
return zIndex;
|
|
23
|
+
}
|
|
24
|
+
if (isFixed) {
|
|
25
|
+
return "banner";
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
return (React.createElement(OakBox, { "$background": "bg-neutral", "$bt": "border-solid-s", "$borderColor": "border-neutral", "$position": isFixed ? "fixed" : undefined, "$bottom": isFixed ? "spacing-0" : undefined, "$right": isFixed ? "spacing-0" : undefined, "$left": isFixed ? "spacing-0" : undefined, "$zIndex": finalZIndex, "$color": "text-primary", "data-testid": "cookie-banner" },
|
|
29
|
+
React.createElement(OakBox, { "$maxWidth": innerMaxWidth, "$mh": "auto" },
|
|
30
|
+
React.createElement(OakFlex, { "$alignItems": ["flex-start", "flex-start", "center"], "$flexDirection": ["column", "column", "row"], "$mh": ["spacing-16", "spacing-24", "spacing-56"], "$pv": "spacing-24", "$gap": ["spacing-24", "spacing-24", "spacing-32"] }, (function () {
|
|
31
|
+
switch (state) {
|
|
32
|
+
case "accepted":
|
|
33
|
+
case "rejected":
|
|
34
|
+
return (React.createElement(React.Fragment, null,
|
|
35
|
+
React.createElement(OakBox, { "$font": ["body-3", "body-2", "heading-light-7"] },
|
|
36
|
+
"You've",
|
|
37
|
+
" ",
|
|
38
|
+
React.createElement(OakSpan, { as: "strong", "$font": ["body-3-bold", "body-2-bold", "heading-7"] }, state),
|
|
39
|
+
" ",
|
|
40
|
+
"additional cookies. You can",
|
|
41
|
+
" ",
|
|
42
|
+
React.createElement(OakLink, { variant: "secondary", element: "button", onClick: onOpenSettings }, "change your cookie settings"),
|
|
43
|
+
" ",
|
|
44
|
+
"at any time."),
|
|
45
|
+
React.createElement(OakFlex, { "$justifyContent": "flex-end", "$flexGrow": 1 },
|
|
46
|
+
React.createElement(OakSecondaryButton, { onClick: onHide }, "Hide this message"))));
|
|
47
|
+
default:
|
|
48
|
+
return (React.createElement(React.Fragment, null,
|
|
49
|
+
React.createElement(OakBox, { "$font": ["body-3", "body-2"] },
|
|
50
|
+
React.createElement(OakSpan, { as: "strong", "$font": ["body-3-bold", "body-2-bold"] }, "This site uses cookies to store information on your computer."),
|
|
51
|
+
" ",
|
|
52
|
+
"Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."),
|
|
53
|
+
React.createElement(OakFlex, { "$gap": ["spacing-12", "spacing-32"], "$justifyContent": "flex-end", "$flexDirection": ["column", "row"], "$flexWrap": ["wrap", "wrap", "nowrap"], "$flexGrow": 1 },
|
|
54
|
+
React.createElement(OakFlex, { "$whiteSpace": "nowrap", "$alignItems": "center" },
|
|
55
|
+
React.createElement(OakLink, { variant: "secondary", "$font": "heading-7", element: "button", type: "button", onClick: onReject, "data-testid": "cookie-banner-reject" }, "Reject non-essential cookies")),
|
|
56
|
+
React.createElement(OakSecondaryButton, { onClick: onOpenSettings }, "Cookie settings"),
|
|
57
|
+
React.createElement(OakPrimaryButton, { onClick: onAccept, "data-testid": "cookie-banner-accept" }, "Accept all cookies"))));
|
|
58
|
+
}
|
|
59
|
+
})()))));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { OakCookieBanner };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OakCookieSettingsModal } from '../OakCookieSettingsModal/OakCookieSettingsModal.js';
|
|
3
|
+
import { useInternalCookieConsent } from '../OakCookieConsentProvider/OakCookieConsentProvider.js';
|
|
4
|
+
import { OakCookieBanner } from '../OakCookieBanner/OakCookieBanner.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Connects `OakCookieBanner` and `OakCookieSettingsModal` to `OakCookieConsentProvider`.
|
|
8
|
+
*/
|
|
9
|
+
var OakCookieConsent = function (_a) {
|
|
10
|
+
var policyURL = _a.policyURL, isFixed = _a.isFixed, innerMaxWidth = _a.innerMaxWidth, zIndex = _a.zIndex;
|
|
11
|
+
var _b = useInternalCookieConsent(), policyConsents = _b.policyConsents, acceptModalConsents = _b.acceptModalConsents, rejectModalConsents = _b.rejectModalConsents, confirmModalConsents = _b.confirmModalConsents, hideBanner = _b.hideBanner, openSettings = _b.openSettings, closeSettings = _b.closeSettings, isSettingsModalOpen = _b.isSettingsModalOpen, acceptBannerConsents = _b.acceptBannerConsents, rejectBannerConsents = _b.rejectBannerConsents, bannerState = _b.bannerState;
|
|
12
|
+
return (React.createElement(React.Fragment, null,
|
|
13
|
+
bannerState !== "hidden" && (React.createElement(OakCookieBanner, { onHide: hideBanner, onAccept: acceptBannerConsents, onReject: rejectBannerConsents, onOpenSettings: openSettings, state: bannerState, isFixed: isFixed, innerMaxWidth: innerMaxWidth, zIndex: zIndex })),
|
|
14
|
+
React.createElement(OakCookieSettingsModal, { policyURL: policyURL, policyConsents: policyConsents, isOpen: isSettingsModalOpen, onClose: closeSettings, onReject: rejectModalConsents, onConfirm: confirmModalConsents, onAccept: acceptModalConsents, zIndex: zIndex })));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { OakCookieConsent };
|