@oaknational/oak-components 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/npm/cjs/index.js +7949 -0
- package/dist/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,103 @@
|
|
|
1
|
+
import { __read } from 'tslib';
|
|
2
|
+
import React, { createContext, useReducer, useCallback, useContext } from 'react';
|
|
3
|
+
import { cookieConsentReducer, getInitialState } from './cookieConsentReducer.js';
|
|
4
|
+
|
|
5
|
+
function getDefaultContextState() {
|
|
6
|
+
return {
|
|
7
|
+
isSettingsModalOpen: false,
|
|
8
|
+
policyConsents: [],
|
|
9
|
+
showBanner: function () { },
|
|
10
|
+
hideBanner: function () { },
|
|
11
|
+
openSettings: function () { },
|
|
12
|
+
closeSettings: function () { },
|
|
13
|
+
rejectModalConsents: function () { },
|
|
14
|
+
confirmModalConsents: function () { },
|
|
15
|
+
acceptModalConsents: function () { },
|
|
16
|
+
rejectBannerConsents: function () { },
|
|
17
|
+
acceptBannerConsents: function () { },
|
|
18
|
+
bannerState: "initial",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var OakCookieConsentContext = createContext(getDefaultContextState());
|
|
22
|
+
/**
|
|
23
|
+
* Internal hook for consuming the OakCookieConsentContext.
|
|
24
|
+
*
|
|
25
|
+
* This should not be exported from the package.
|
|
26
|
+
*/
|
|
27
|
+
function useInternalCookieConsent() {
|
|
28
|
+
return useContext(OakCookieConsentContext);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Enables opening of the cookie settings modal and showing the cookie consent banner.
|
|
32
|
+
*/
|
|
33
|
+
function useCookieConsent() {
|
|
34
|
+
var _a = useContext(OakCookieConsentContext), showBanner = _a.showBanner, openSettings = _a.openSettings;
|
|
35
|
+
return { showBanner: showBanner, openSettings: openSettings };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Provides a context through which the cookie consent UI can be configured and controlled
|
|
39
|
+
*
|
|
40
|
+
* Intended to be used with `OakCookieConsent`
|
|
41
|
+
*/
|
|
42
|
+
var OakCookieConsentProvider = function (_a) {
|
|
43
|
+
var children = _a.children, policyConsents = _a.policyConsents, onConsentChange = _a.onConsentChange;
|
|
44
|
+
var _b = __read(useReducer(cookieConsentReducer, null, getInitialState), 2), cookieConsentState = _b[0], dispatch = _b[1];
|
|
45
|
+
var closeSettings = useCallback(function () { return dispatch({ type: "closeModal" }); }, []);
|
|
46
|
+
var acceptConsents = useCallback(function () {
|
|
47
|
+
onConsentChange(policyConsents.map(function (_a) {
|
|
48
|
+
var policyId = _a.policyId;
|
|
49
|
+
return ({
|
|
50
|
+
policyId: policyId,
|
|
51
|
+
consentState: "granted",
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
54
|
+
}, [onConsentChange, policyConsents]);
|
|
55
|
+
var rejectConsents = useCallback(function () {
|
|
56
|
+
onConsentChange(policyConsents.map(function (_a) {
|
|
57
|
+
var policyId = _a.policyId, isStrictlyNecessary = _a.isStrictlyNecessary;
|
|
58
|
+
return ({
|
|
59
|
+
policyId: policyId,
|
|
60
|
+
consentState: isStrictlyNecessary ? "granted" : "denied",
|
|
61
|
+
});
|
|
62
|
+
}));
|
|
63
|
+
}, [onConsentChange, policyConsents]);
|
|
64
|
+
var hideBanner = useCallback(function () { return dispatch({ type: "hideBanner" }); }, []);
|
|
65
|
+
var showBanner = useCallback(function () { return dispatch({ type: "showBanner" }); }, []);
|
|
66
|
+
var openSettings = useCallback(function () { return dispatch({ type: "openModal" }); }, []);
|
|
67
|
+
var acceptBannerConsents = useCallback(function () {
|
|
68
|
+
acceptConsents();
|
|
69
|
+
dispatch({ type: "acceptBannerConsents" });
|
|
70
|
+
}, [acceptConsents]);
|
|
71
|
+
var rejectBannerConsents = useCallback(function () {
|
|
72
|
+
rejectConsents();
|
|
73
|
+
dispatch({ type: "rejectBannerConsents" });
|
|
74
|
+
}, [rejectConsents]);
|
|
75
|
+
var acceptModalConsents = useCallback(function () {
|
|
76
|
+
acceptConsents();
|
|
77
|
+
dispatch({ type: "acceptModalConsents" });
|
|
78
|
+
}, [acceptConsents, hideBanner]);
|
|
79
|
+
var rejectModalConsents = useCallback(function () {
|
|
80
|
+
rejectConsents();
|
|
81
|
+
dispatch({ type: "rejectModalConsents" });
|
|
82
|
+
}, [rejectConsents, hideBanner]);
|
|
83
|
+
var confirmModalConsents = useCallback(function (consents) {
|
|
84
|
+
onConsentChange(consents);
|
|
85
|
+
dispatch({ type: "confirmModalConsents" });
|
|
86
|
+
}, [onConsentChange, hideBanner]);
|
|
87
|
+
return (React.createElement(OakCookieConsentContext.Provider, { value: {
|
|
88
|
+
isSettingsModalOpen: cookieConsentState.isSettingsModalOpen,
|
|
89
|
+
bannerState: cookieConsentState.bannerState,
|
|
90
|
+
policyConsents: policyConsents,
|
|
91
|
+
showBanner: showBanner,
|
|
92
|
+
hideBanner: hideBanner,
|
|
93
|
+
openSettings: openSettings,
|
|
94
|
+
closeSettings: closeSettings,
|
|
95
|
+
confirmModalConsents: confirmModalConsents,
|
|
96
|
+
acceptBannerConsents: acceptBannerConsents,
|
|
97
|
+
rejectBannerConsents: rejectBannerConsents,
|
|
98
|
+
acceptModalConsents: acceptModalConsents,
|
|
99
|
+
rejectModalConsents: rejectModalConsents,
|
|
100
|
+
} }, children));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { OakCookieConsentContext, OakCookieConsentProvider, getDefaultContextState, useCookieConsent, useInternalCookieConsent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
|
|
3
|
+
function cookieConsentReducer(currentState, action) {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case "confirmModalConsents":
|
|
6
|
+
case "acceptModalConsents":
|
|
7
|
+
case "rejectModalConsents":
|
|
8
|
+
return __assign(__assign({}, currentState), { isSettingsModalOpen: false, bannerState: "hidden" });
|
|
9
|
+
case "acceptBannerConsents":
|
|
10
|
+
return __assign(__assign({}, currentState), { bannerState: "accepted" });
|
|
11
|
+
case "rejectBannerConsents":
|
|
12
|
+
return __assign(__assign({}, currentState), { bannerState: "rejected" });
|
|
13
|
+
case "openModal":
|
|
14
|
+
return __assign(__assign({}, currentState), { isSettingsModalOpen: true });
|
|
15
|
+
case "closeModal":
|
|
16
|
+
return __assign(__assign({}, currentState), { isSettingsModalOpen: false });
|
|
17
|
+
case "showBanner":
|
|
18
|
+
return __assign(__assign({}, currentState), { bannerState: "initial" });
|
|
19
|
+
case "hideBanner":
|
|
20
|
+
return __assign(__assign({}, currentState), { bannerState: "hidden" });
|
|
21
|
+
default:
|
|
22
|
+
return currentState;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getInitialState() {
|
|
26
|
+
return {
|
|
27
|
+
isSettingsModalOpen: false,
|
|
28
|
+
bannerState: "hidden",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { cookieConsentReducer, getInitialState };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakAccordion } from '../../layout-and-structure/OakAccordion/OakAccordion.js';
|
|
4
|
+
import { OakCheckBox } from '../../form-elements/OakCheckBox/OakCheckBox.js';
|
|
5
|
+
import { OakInformativeModal } from '../../messaging-and-feedback/OakInformativeModal/OakInformativeModal.js';
|
|
6
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
7
|
+
import { OakInformativeModalFooter } from '../../messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js';
|
|
8
|
+
import { OakLink } from '../../navigation/OakLink/OakLink.js';
|
|
9
|
+
import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
|
|
10
|
+
import { OakSecondaryButton } from '../../buttons/OakSecondaryButton/OakSecondaryButton.js';
|
|
11
|
+
import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
|
|
12
|
+
import { OakP } from '../../typography/OakP/OakP.js';
|
|
13
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
14
|
+
import { OakUL } from '../../typography/OakUL/OakUL.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Modal for managing cookie consent settings.
|
|
18
|
+
*/
|
|
19
|
+
var OakCookieSettingsModal = function (_a) {
|
|
20
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, onReject = _a.onReject, onConfirm = _a.onConfirm, onAccept = _a.onAccept, policyURL = _a.policyURL, policyConsents = _a.policyConsents, zIndex = _a.zIndex;
|
|
21
|
+
var handleSubmit = function (event) {
|
|
22
|
+
var e_1, _a, e_2, _b;
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
var formData = new FormData(event.currentTarget);
|
|
25
|
+
var newConsents = {};
|
|
26
|
+
try {
|
|
27
|
+
for (var policyConsents_1 = __values(policyConsents), policyConsents_1_1 = policyConsents_1.next(); !policyConsents_1_1.done; policyConsents_1_1 = policyConsents_1.next()) {
|
|
28
|
+
var _c = policyConsents_1_1.value, policyId = _c.policyId, isStrictlyNecessary = _c.isStrictlyNecessary;
|
|
29
|
+
newConsents[policyId] = {
|
|
30
|
+
policyId: policyId,
|
|
31
|
+
consentState: isStrictlyNecessary ? "granted" : "denied",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
36
|
+
finally {
|
|
37
|
+
try {
|
|
38
|
+
if (policyConsents_1_1 && !policyConsents_1_1.done && (_a = policyConsents_1.return)) _a.call(policyConsents_1);
|
|
39
|
+
}
|
|
40
|
+
finally { if (e_1) throw e_1.error; }
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
for (var _d = __values(formData.getAll("consent")), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
44
|
+
var policyId = _e.value;
|
|
45
|
+
newConsents[policyId.toString()] = {
|
|
46
|
+
policyId: policyId.toString(),
|
|
47
|
+
consentState: "granted",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
52
|
+
finally {
|
|
53
|
+
try {
|
|
54
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
55
|
+
}
|
|
56
|
+
finally { if (e_2) throw e_2.error; }
|
|
57
|
+
}
|
|
58
|
+
onConfirm(Object.values(newConsents));
|
|
59
|
+
};
|
|
60
|
+
return (React.createElement(OakInformativeModal, { isOpen: isOpen, isLeftHandSide: true, onClose: onClose, zIndex: zIndex, footerSlot: React.createElement(OakInformativeModalFooter, null,
|
|
61
|
+
React.createElement(OakSecondaryButton, { onClick: onReject, width: "100%" }, "Reject non-essential cookies"),
|
|
62
|
+
React.createElement(OakPrimaryButton, { type: "submit", form: "cookie-settings-form", width: "100%" }, "Confirm my choices")) },
|
|
63
|
+
React.createElement(OakBox, { "$pa": "spacing-20" },
|
|
64
|
+
React.createElement(OakHeading, { tag: "h2", "$font": "heading-5", "$mb": "spacing-16" }, "This site uses cookies to store information on your computer."),
|
|
65
|
+
React.createElement(OakP, { "$mb": "spacing-24" }, "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."),
|
|
66
|
+
React.createElement(OakP, { "$mb": "spacing-48" },
|
|
67
|
+
"For more information, view our",
|
|
68
|
+
" ",
|
|
69
|
+
React.createElement(OakLink, { href: policyURL, target: "_blank" }, "cookie policy"),
|
|
70
|
+
"."),
|
|
71
|
+
React.createElement(OakBox, { "$mb": "spacing-56" },
|
|
72
|
+
React.createElement(OakPrimaryButton, { onClick: onAccept, width: "spacing-180" }, "Allow all")),
|
|
73
|
+
React.createElement(OakBox, { "$ph": "spacing-8", as: "form", id: "cookie-settings-form", onSubmit: handleSubmit },
|
|
74
|
+
React.createElement(OakHeading, { tag: "h3", "$font": "heading-6", "$mb": "spacing-24" }, "Manage consent preferences"),
|
|
75
|
+
policyConsents.map(function (policy) {
|
|
76
|
+
return (React.createElement(OakAccordion, { key: policy.policyId, header: React.createElement(OakSpan, { id: "cookie-settings-".concat(policy.policyId, "-label") }, policy.policyLabel), headerTag: "h4", id: "cookies-settings-".concat(policy.policyId, "-accordion"), headerAfterSlot: React.createElement(OakCheckBox, { id: "cookies-settings-".concat(policy.policyId, "-checkbox"), name: "consent", displayValue: "", value: policy.policyId, defaultChecked: policy.isStrictlyNecessary ||
|
|
77
|
+
policy.consentState === "granted", disabled: policy.isStrictlyNecessary, "aria-labelledby": "cookie-settings-".concat(policy.policyId, "-label") }) },
|
|
78
|
+
React.createElement(OakP, { "$mb": "spacing-32" }, policy.policyDescription),
|
|
79
|
+
React.createElement(OakBox, { as: "dl", "$pl": "spacing-16" },
|
|
80
|
+
policy.policyParties.length > 0 && (React.createElement(React.Fragment, null,
|
|
81
|
+
React.createElement("dt", null, "Who do we share data with?"),
|
|
82
|
+
React.createElement(OakBox, { as: "dd", "$font": "body-3-bold", "$mb": "spacing-16" },
|
|
83
|
+
React.createElement(OakUL, { "$reset": true }, policy.policyParties.map(function (party, index, all) { return (React.createElement(OakBox, { as: "li", key: index, "$display": "inline" },
|
|
84
|
+
React.createElement(OakLink, { variant: "secondary", href: party.url, target: "_blank", rel: "external nofollow" }, party.name),
|
|
85
|
+
index < all.length - 1 && ", ")); }))))),
|
|
86
|
+
React.createElement("dt", null, "Does this policy need cookies to work?"),
|
|
87
|
+
React.createElement(OakBox, { as: "dd", "$font": "body-3-bold" }, "Yes."))));
|
|
88
|
+
})))));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { OakCookieSettingsModal };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { __rest, __read, __assign } from 'tslib';
|
|
2
|
+
import React, { createContext, useState } from 'react';
|
|
3
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
4
|
+
import { OakLabel } from '../OakLabel/OakLabel.js';
|
|
5
|
+
|
|
6
|
+
var RadioContext = createContext({
|
|
7
|
+
currentValue: "default",
|
|
8
|
+
name: "default",
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* A react context supporting a list of mutually exclusive options rendered as buttons.
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
*
|
|
16
|
+
* the nested items should be OakSecondaryButtonAsRadio or implement the same logic.
|
|
17
|
+
* use the callback onChange to get the value of the clicked button.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var OakButtonAsRadioGroup = function (props) {
|
|
21
|
+
var name = props.name, children = props.children, label = props.label, ariaLabel = props.ariaLabel, ariaLabelledby = props.ariaLabelledby, onChange = props.onChange, _a = props.$font, $font = _a === void 0 ? "body-1-bold" : _a, _b = props.$gap, $gap = _b === void 0 ? "spacing-16" : _b, disabled = props.disabled, value = props.value, _c = props.defaultValue, defaultValue = _c === void 0 ? "" : _c, rest = __rest(props, ["name", "children", "label", "ariaLabel", "ariaLabelledby", "onChange", "$font", "$gap", "disabled", "value", "defaultValue"]);
|
|
22
|
+
var _d = __read(useState(defaultValue), 2), currentValue = _d[0], setCurrentValue = _d[1];
|
|
23
|
+
if (!label && !ariaLabel && !ariaLabelledby) {
|
|
24
|
+
throw new Error("OakButtonAsRadioGroup: At least one of label, ariaLabel or ariaLabelledby is required");
|
|
25
|
+
}
|
|
26
|
+
var handleValueUpdated = function (newValue) {
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
setCurrentValue(newValue);
|
|
29
|
+
}
|
|
30
|
+
if (onChange) {
|
|
31
|
+
onChange(newValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (React.createElement(OakFlex, __assign({ role: "radiogroup", "$gap": $gap }, rest, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby }),
|
|
35
|
+
label && React.createElement(OakLabel, { "$font": $font }, label),
|
|
36
|
+
React.createElement(RadioContext.Provider, { value: {
|
|
37
|
+
currentValue: value !== null && value !== void 0 ? value : currentValue,
|
|
38
|
+
name: name,
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
onValueUpdated: handleValueUpdated,
|
|
41
|
+
} }, children)));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { OakButtonAsRadioGroup, RadioContext };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { InternalCheckBoxHoverFocus } from '../../internal-components/InternalCheckBox/InternalCheckBox.js';
|
|
4
|
+
import { InternalCheckBoxLabel } from '../../internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js';
|
|
5
|
+
import { InternalCheckBoxWrapper } from '../../internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* Default checkbox which can be extended to create specialised checkboxes.
|
|
10
|
+
* - if provided, displayValue is used to display a different value to the value prop.
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* ## Events
|
|
14
|
+
* The following callbacks are available for tracking focus events:
|
|
15
|
+
*
|
|
16
|
+
* ### onChange
|
|
17
|
+
* onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
+
*
|
|
19
|
+
* ### onFocus
|
|
20
|
+
* onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
*
|
|
22
|
+
* ### onBlur
|
|
23
|
+
* onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
24
|
+
*
|
|
25
|
+
* ### onHovered
|
|
26
|
+
* `onHovered?: (id, value, duration: number) => void;`<br>
|
|
27
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
var OakCheckBox = function (props) {
|
|
32
|
+
var id = props.id, value = props.value, _a = props.displayValue, displayValue = _a === void 0 ? value : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.iconPadding, iconPadding = _c === void 0 ? "spacing-0" : _c, _d = props.hoverBorderRadius, hoverBorderRadius = _d === void 0 ? "border-radius-xs" : _d, _e = props.checkboxSize, checkboxSize = _e === void 0 ? "spacing-24" : _e, _f = props.checkboxBorder, checkboxBorder = _f === void 0 ? "border-solid-m" : _f, _g = props.checkboxBorderRadius, checkboxBorderRadius = _g === void 0 ? "border-radius-xs" : _g, _h = props.defaultColor, defaultColor = _h === void 0 ? "text-primary" : _h,
|
|
33
|
+
/**
|
|
34
|
+
* The outer border color of the checkbox when unchecked.
|
|
35
|
+
*/
|
|
36
|
+
_j = props.uncheckedBorderColor,
|
|
37
|
+
/**
|
|
38
|
+
* The outer border color of the checkbox when unchecked.
|
|
39
|
+
*/
|
|
40
|
+
uncheckedBorderColor = _j === void 0 ? "border-neutral" : _j,
|
|
41
|
+
/**
|
|
42
|
+
* The outer border color of the checkbox when checked.
|
|
43
|
+
*/
|
|
44
|
+
_k = props.checkedBorderColor,
|
|
45
|
+
/**
|
|
46
|
+
* The outer border color of the checkbox when checked.
|
|
47
|
+
*/
|
|
48
|
+
checkedBorderColor = _k === void 0 ? "border-primary" : _k, _l = props.disabledColor, disabledColor = _l === void 0 ? "text-disabled" : _l, _m = props.labelGap, labelGap = _m === void 0 ? "spacing-16" : _m, _o = props.labelAlignItems, labelAlignItems = _o === void 0 ? "center" : _o, _p = props.checkedBackgroundFill, checkedBackgroundFill = _p === void 0 ? true : _p, checkedIcon = props.checkedIcon, dataTestId = props["data-testid"], rest = __rest(props, ["id", "value", "displayValue", "disabled", "defaultChecked", "checked", "onChange", "onFocus", "onBlur", "onHovered", "iconPadding", "hoverBorderRadius", "checkboxSize", "checkboxBorder", "checkboxBorderRadius", "defaultColor", "uncheckedBorderColor", "checkedBorderColor", "disabledColor", "labelGap", "labelAlignItems", "checkedBackgroundFill", "checkedIcon", "data-testid"]);
|
|
49
|
+
var hoverStart = useRef(Date.now());
|
|
50
|
+
var handleMouseEnter = function () {
|
|
51
|
+
hoverStart.current = Date.now();
|
|
52
|
+
};
|
|
53
|
+
var handleMouseLeave = function () {
|
|
54
|
+
var delta = Date.now() - hoverStart.current;
|
|
55
|
+
if (onHovered) {
|
|
56
|
+
onHovered(value, id, delta);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var currentColor = disabled ? disabledColor : defaultColor;
|
|
60
|
+
var currentCheckedBackgroundFill = disabled
|
|
61
|
+
? disabledColor
|
|
62
|
+
: checkedBorderColor;
|
|
63
|
+
var currentCheckedBorderColor = disabled
|
|
64
|
+
? disabledColor
|
|
65
|
+
: checkedBorderColor;
|
|
66
|
+
return (React.createElement(InternalCheckBoxLabel, { htmlFor: id, labelGap: labelGap, labelAlignItems: labelAlignItems, "$color": currentColor, disabled: disabled, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
|
|
67
|
+
React.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React.createElement(InternalCheckBoxHoverFocus, __assign({ id: id, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": checkboxBorder, "$borderRadius": checkboxBorderRadius, "$borderColor": defaultColor, "$checkedBackground": checkedBackgroundFill ? currentCheckedBackgroundFill : null, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": uncheckedBorderColor, "$hoverBorderRadius": hoverBorderRadius, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: disabled, "data-testid": dataTestId }, rest)), checkedIcon: checkedIcon, iconPadding: iconPadding }),
|
|
68
|
+
displayValue));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { OakCheckBox };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
3
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
4
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* OakFieldError renders a error message when passed children.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
var OakFieldError = function (props) {
|
|
12
|
+
var children = props.children;
|
|
13
|
+
if (!children) {
|
|
14
|
+
/**
|
|
15
|
+
* Return early to avoid unwanted whitespace when there's no error
|
|
16
|
+
*/
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement(OakFlex, { "$alignItems": "center", "$flexDirection": "row" },
|
|
20
|
+
React.createElement(OakFlex, { "$alignSelf": "flex-start", "$mr": "spacing-16" },
|
|
21
|
+
React.createElement(OakIcon, { alt: "Error", iconName: "content-guidance", "$colorFilter": "icon-error" })),
|
|
22
|
+
React.createElement(OakSpan, { "$color": "text-error" }, children)));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { OakFieldError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OakFieldset renders a custom `fieldset` component, removes default styling of fieldset.
|
|
7
|
+
color, opacity, margin, padding, border and typography styles can be passed in also.
|
|
8
|
+
*/
|
|
9
|
+
var OakFieldset = styled.fieldset(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 0;\n margin: 0;\n padding: 0;\n ", ";\n"], ["\n border: 0;\n margin: 0;\n padding: 0;\n ", ";\n"])), oakBoxCss);
|
|
10
|
+
var templateObject_1;
|
|
11
|
+
|
|
12
|
+
export { OakFieldset };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* OakForm extends OakBox by taking the same props and style but applying them to a form element.
|
|
8
|
+
*
|
|
9
|
+
* ⚠️ To be deprecated
|
|
10
|
+
* Use `<OakBox as="form">` instead
|
|
11
|
+
* @deprecated Use `<OakBox as="form">` instead
|
|
12
|
+
*/
|
|
13
|
+
var OakForm = styled.form(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), oakBoxCss);
|
|
14
|
+
var templateObject_1;
|
|
15
|
+
|
|
16
|
+
export { OakForm };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
5
|
+
import { InternalTextInput } from '../../internal-components/InternalTextInput/InternalTextInput.js';
|
|
6
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
+
|
|
8
|
+
var StyledTextInputWrapper = styled(OakFlex)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n cursor: text;\n }\n\n background: ", ";\n\n &:focus-within {\n border-color: ", ";\n background: ", ";\n }\n\n ", "\n\n ", "\n"], ["\n &:hover {\n cursor: text;\n }\n\n background: ", ";\n\n &:focus-within {\n border-color: ", ";\n background: ", ";\n }\n\n ", "\n\n ", "\n"])), function (props) { return parseColor(props.$background); }, function (props) { return parseColor(props.$focusBorderColor); }, function (props) { return parseColor(props.$focusBackgroundColor); }, function (props) {
|
|
9
|
+
return !props.$disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @media (hover: hover) {\n &:hover:not(:focus-within) {\n background: ", ";\n border-color: ", ";\n }\n }\n "], ["\n @media (hover: hover) {\n &:hover:not(:focus-within) {\n background: ", ";\n border-color: ", ";\n }\n }\n "])), parseColor(props.$hoverBackground), parseColor(props.$hoverBorderColor));
|
|
10
|
+
}, function (props) {
|
|
11
|
+
return props.$disabled && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n border-color: ", ";\n color: ", ";\n &:hover {\n cursor: not-allowed;\n }\n "], ["\n background: ", ";\n border-color: ", ";\n color: ", ";\n &:hover {\n cursor: not-allowed;\n }\n "])), parseColor(props.$disabledBackgroundColor), parseColor(props.$disabledBorderColor), parseColor(props.$disabledColor));
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Default input which can be extended to create specialised inputs.
|
|
15
|
+
*/
|
|
16
|
+
var OakFormInput = function (_a) {
|
|
17
|
+
var _b = _a.type, type = _b === void 0 ? "text" : _b, _c = _a.borderColor, borderColor = _c === void 0 ? "border-neutral-lighter" : _c, _d = _a.focusBorderColor, focusBorderColor = _d === void 0 ? "border-primary" : _d, _e = _a.focusBackgroundColor, focusBackgroundColor = _e === void 0 ? "bg-primary" : _e, _f = _a.background, background = _f === void 0 ? "bg-primary" : _f, _g = _a.hoverBackground, hoverBackground = _g === void 0 ? "bg-neutral" : _g, _h = _a.hoverBorderColor, hoverBorderColor = _h === void 0 ? "border-neutral" : _h, _j = _a.disabledBackgroundColor, disabledBackgroundColor = _j === void 0 ? "bg-neutral" : _j, _k = _a.color, color = _k === void 0 ? "text-primary" : _k, _l = _a.disabledBorderColor, disabledBorderColor = _l === void 0 ? "border-neutral-lighter" : _l, _m = _a.disabledColor, disabledColor = _m === void 0 ? "text-disabled" : _m, _o = _a.invalid, invalid = _o === void 0 ? false : _o, _p = _a.invalidBorderColor, invalidBorderColor = _p === void 0 ? "border-error" : _p, wrapperWidth = _a.wrapperWidth, wrapperMaxWidth = _a.wrapperMaxWidth, props = __rest(_a, ["type", "borderColor", "focusBorderColor", "focusBackgroundColor", "background", "hoverBackground", "hoverBorderColor", "disabledBackgroundColor", "color", "disabledBorderColor", "disabledColor", "invalid", "invalidBorderColor", "wrapperWidth", "wrapperMaxWidth"]);
|
|
18
|
+
return (React.createElement(StyledTextInputWrapper, { "$height": "fit-content", "$width": wrapperWidth, "$maxWidth": wrapperMaxWidth, "$borderRadius": "border-radius-m", "$ba": "border-solid-m", "$alignItems": "center", "$position": "relative", "$pa": "spacing-8", "$font": "body-2", "$color": color, "$borderColor": invalid ? invalidBorderColor : borderColor, "$background": background, "$hoverBackground": hoverBackground, "$hoverBorderColor": hoverBorderColor, "$disabledColor": disabledColor, "$disabledBackgroundColor": disabledBackgroundColor, "$disabledBorderColor": disabledBorderColor, "$focusBorderColor": focusBorderColor, "$focusBackgroundColor": focusBackgroundColor, "$disabled": !!props.disabled, onClick: function (event) {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = event.currentTarget.querySelector("input")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21
|
+
} },
|
|
22
|
+
React.createElement(InternalTextInput, __assign({ type: type, "$width": "100%", "aria-invalid": invalid }, props))));
|
|
23
|
+
};
|
|
24
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
25
|
+
|
|
26
|
+
export { OakFormInput };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
4
|
+
|
|
5
|
+
var OakJauntyAngleLabel = function (props) {
|
|
6
|
+
var label = props.label, oakBoxProps = __rest(props, ["label"]);
|
|
7
|
+
return (React.createElement(OakBox, __assign({ "$borderRadius": "border-radius-m", "$ph": "spacing-8", "$pv": "spacing-4", "$font": ["heading-7", "heading-6"], "$transform": "rotate(-1.5deg)" }, oakBoxProps), label));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { OakJauntyAngleLabel };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { typographyStyle } from '../../../styles/utils/typographyStyle.js';
|
|
4
|
+
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Label renders a `label` element, exposing all the typography props.
|
|
8
|
+
* ## Usage
|
|
9
|
+
* Use this component when you want to apply styles to a label, likely within
|
|
10
|
+
* a form.
|
|
11
|
+
*/
|
|
12
|
+
var OakLabel = styled.label(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), typographyStyle, colorStyle);
|
|
13
|
+
var templateObject_1;
|
|
14
|
+
|
|
15
|
+
export { OakLabel };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __read, __assign } from 'tslib';
|
|
2
|
+
import React, { forwardRef, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { getInternalPadding } from '../../../styles/helpers/getInternalPadding.js';
|
|
5
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
6
|
+
import { OakTextArea } from '../OakTextArea/OakTextArea.js';
|
|
7
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
8
|
+
import { OakLabel } from '../OakLabel/OakLabel.js';
|
|
9
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
10
|
+
import { OakGrid } from '../../layout-and-structure/OakGrid/OakGrid.js';
|
|
11
|
+
import { OakGridArea } from '../../layout-and-structure/OakGridArea/OakGridArea.js';
|
|
12
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
13
|
+
import { useMediaQuery } from '../../../hooks/useMediaQuery.js';
|
|
14
|
+
import '../../../styles/utils/responsiveStyle.js';
|
|
15
|
+
|
|
16
|
+
var StyledOakTextArea = styled(OakTextArea)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:focus-visible {\n border-color: ", ";\n }\n\n &:hover {\n background: ", ";\n border-color: ", ";\n }\n\n ::placeholder {\n color: ", ";\n }\n"], ["\n &:focus-visible {\n border-color: ", ";\n }\n\n &:hover {\n background: ", ";\n border-color: ", ";\n }\n\n ::placeholder {\n color: ", ";\n }\n"])), parseColor("border-primary"), parseColor("bg-btn-secondary-hover"), function (props) {
|
|
17
|
+
return props.disabled ? "" : parseColor("border-neutral");
|
|
18
|
+
}, parseColor("text-subdued"));
|
|
19
|
+
var UnstyledComponent = forwardRef(function (_a, ref) {
|
|
20
|
+
var _b;
|
|
21
|
+
var charLimit = _a.charLimit, placeholder = _a.placeholder, disabled = _a.disabled, errors = _a.errors, ariaLabel = _a.ariaLabel, value = _a.value, initialValue = _a.initialValue, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, label = _a.label, id = _a.id, name = _a.name, _c = _a.$height, $height = _c === void 0 ? ["spacing-240", "spacing-80", "spacing-56"] : _c, _d = _a.$overflowX, $overflowX = _d === void 0 ? [null, null, "auto"] : _d, _e = _a.$overflowY, $overflowY = _e === void 0 ? ["auto", "auto", null] : _e, _f = _a.$whiteSpace, $whiteSpace = _f === void 0 ? ["wrap", "wrap", "nowrap"] : _f, textAreaProps = __rest(_a, ["charLimit", "placeholder", "disabled", "errors", "ariaLabel", "value", "initialValue", "onChange", "onBlur", "onFocus", "label", "id", "name", "$height", "$overflowX", "$overflowY", "$whiteSpace"]);
|
|
22
|
+
var _g = __read(useState(false), 2), showCharCount = _g[0], setShowCharCount = _g[1];
|
|
23
|
+
var _h = __read(useState(initialValue), 2), internalValue = _h[0], setInternalValue = _h[1];
|
|
24
|
+
var isControlled = value !== undefined;
|
|
25
|
+
var charCountWidth = charLimit > 99 ? "spacing-56" : "spacing-48";
|
|
26
|
+
var charCount = isControlled
|
|
27
|
+
? value === null || value === void 0 ? void 0 : value.toString().length
|
|
28
|
+
: ((_b = internalValue === null || internalValue === void 0 ? void 0 : internalValue.length) !== null && _b !== void 0 ? _b : 0);
|
|
29
|
+
var handleFocus = function (e) {
|
|
30
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
31
|
+
setShowCharCount(true);
|
|
32
|
+
};
|
|
33
|
+
var handleBlur = function (e) {
|
|
34
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
35
|
+
setShowCharCount(false);
|
|
36
|
+
};
|
|
37
|
+
var handleChange = function (e) {
|
|
38
|
+
if (!isControlled) {
|
|
39
|
+
setInternalValue(e.target.value);
|
|
40
|
+
}
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
42
|
+
};
|
|
43
|
+
var heightForDevice = useDevice($height);
|
|
44
|
+
var textAreaPadding = getInternalPadding(heightForDevice);
|
|
45
|
+
return (React.createElement(OakFlex, { "$flexDirection": ["column"], "$gap": ["spacing-8", null], "$width": "100%" },
|
|
46
|
+
label && (React.createElement(OakLabel, { htmlFor: id, "$font": "body-2-bold" }, label)),
|
|
47
|
+
React.createElement(StyledOakTextArea, __assign({ ref: ref, id: id, name: name, value: isControlled ? value : internalValue, onFocus: handleFocus, onChange: handleChange, onBlur: handleBlur, maxLength: charLimit, placeholder: placeholder, disabled: disabled, "aria-label": ariaLabel, "$background": disabled ? "bg-neutral" : "bg-primary", "$color": "text-primary", "$borderRadius": "border-radius-m", "$ba": "border-solid-m", style: { padding: textAreaPadding, overscrollBehavior: "none" }, "$borderColor": errors && (errors === null || errors === void 0 ? void 0 : errors.length) > 0
|
|
48
|
+
? "border-error"
|
|
49
|
+
: "border-neutral-lighter", "$height": $height, "$overflowX": $overflowX, "$overflowY": $overflowY, "$whiteSpace": $whiteSpace, "$width": "100%", "aria-describedby": "".concat(name, "-invalid-error") }, textAreaProps)),
|
|
50
|
+
React.createElement(OakGrid, { "$minWidth": [charCountWidth, null], "$pb": ["spacing-20"], "$position": ["relative", null] },
|
|
51
|
+
errors && errors.length > 0 && (React.createElement(OakGridArea, { "$colSpan": 10, "$position": "relative" },
|
|
52
|
+
React.createElement(OakFlex, { "$flexDirection": "row", "$position": "absolute", "$top": "spacing-0", "$left": "spacing-0" },
|
|
53
|
+
React.createElement(OakIcon, { iconName: "warning", "$colorFilter": "icon-error", "$width": "spacing-16", "$height": "spacing-16" }),
|
|
54
|
+
React.createElement(OakSpan, { "$overflowY": "auto", "$overflowX": "auto", "$font": "body-4", "$color": "text-error", id: "".concat(name, "-invalid-error"), "$pl": "spacing-4" }, errors.join(". "))))),
|
|
55
|
+
React.createElement(OakGridArea, { "$colSpan": 2 }, showCharCount && (React.createElement(OakSpan, { "aria-label": "character count", "$font": "body-4", "$color": "text-subdued", "$position": ["absolute", null], "$top": ["spacing-0", null], "$right": ["spacing-0", null] },
|
|
56
|
+
charCount,
|
|
57
|
+
"/",
|
|
58
|
+
charLimit))))));
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* This component wraps OakTextArea and provides the following functionality
|
|
63
|
+
* - Displays errors passed in as a prop
|
|
64
|
+
* - Displays and updates character count on focus only
|
|
65
|
+
* - Passes stored text to onChange and onBlur callbacks
|
|
66
|
+
* - Allows state to be controlled either internally or externally
|
|
67
|
+
*
|
|
68
|
+
* ### Callbacks
|
|
69
|
+
*
|
|
70
|
+
* onBlur
|
|
71
|
+
* onChange
|
|
72
|
+
* onFocus: display character count
|
|
73
|
+
*
|
|
74
|
+
* ### Notes
|
|
75
|
+
* - Current method of clearing the component is to reset its key in the parent component
|
|
76
|
+
* - useImperativeHandle could be used to expose a clear method
|
|
77
|
+
*/
|
|
78
|
+
var OakMultilineText = UnstyledComponent;
|
|
79
|
+
// TODO use common hook when implemented
|
|
80
|
+
function useDevice(values) {
|
|
81
|
+
var isDesktop = useMediaQuery("desktop");
|
|
82
|
+
var isTablet = useMediaQuery("tablet");
|
|
83
|
+
if (Array.isArray(values)) {
|
|
84
|
+
if (isDesktop) {
|
|
85
|
+
return values[0];
|
|
86
|
+
}
|
|
87
|
+
if (isTablet) {
|
|
88
|
+
return values[1] || values[0];
|
|
89
|
+
}
|
|
90
|
+
return values[2] || values[0];
|
|
91
|
+
}
|
|
92
|
+
return values;
|
|
93
|
+
}
|
|
94
|
+
var templateObject_1;
|
|
95
|
+
|
|
96
|
+
export { OakMultilineText, useDevice };
|