@oaknational/oak-components 2.45.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/npm/cjs/index.js +7949 -0
- package/dist/{types.d.ts → npm/cjs/types.d.ts} +2 -16
- package/dist/npm/es/animation/usePrefersReducedMotion.js +16 -0
- package/dist/npm/es/components/OakGlobalStyle/OakGlobalStyle.js +14 -0
- package/dist/npm/es/components/OakThemeProvider/OakThemeProvider.js +14 -0
- package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js +105 -0
- package/dist/npm/es/components/buttons/OakCloseButton/OakCloseButton.js +18 -0
- package/dist/npm/es/components/buttons/OakLeftAlignedButton/OakLeftAlignedButton.js +57 -0
- package/dist/npm/es/components/buttons/OakPrimaryButton/OakPrimaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSecondaryButton/OakSecondaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js +20 -0
- package/dist/npm/es/components/buttons/OakSmallPrimaryButton/OakSmallPrimaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryButton/OakSmallSecondaryButton.js +23 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js +20 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryToggleButton/OakSmallSecondaryToggleButton.js +37 -0
- package/dist/npm/es/components/buttons/OakSmallTertiaryInvertedButton/OakSmallTertiaryInvertedButton.js +23 -0
- package/dist/npm/es/components/buttons/OakTertiaryButton/OakTertiaryButton.js +14 -0
- package/dist/npm/es/components/buttons/OakTertiaryInvertedButton/OakTertiaryInvertedButton.js +14 -0
- package/dist/npm/es/components/cookies/OakCookieBanner/OakCookieBanner.js +62 -0
- package/dist/npm/es/components/cookies/OakCookieConsent/OakCookieConsent.js +17 -0
- package/dist/npm/es/components/cookies/OakCookieConsentProvider/OakCookieConsentProvider.js +103 -0
- package/dist/npm/es/components/cookies/OakCookieConsentProvider/cookieConsentReducer.js +32 -0
- package/dist/npm/es/components/cookies/OakCookieSettingsModal/OakCookieSettingsModal.js +91 -0
- package/dist/npm/es/components/form-elements/OakButtonAsRadioGroup/OakButtonAsRadioGroup.js +44 -0
- package/dist/npm/es/components/form-elements/OakCheckBox/OakCheckBox.js +71 -0
- package/dist/npm/es/components/form-elements/OakFieldError/OakFieldError.js +25 -0
- package/dist/npm/es/components/form-elements/OakFieldset/OakFieldset.js +12 -0
- package/dist/npm/es/components/form-elements/OakForm/OakForm.js +16 -0
- package/dist/npm/es/components/form-elements/OakFormInput/OakFormInput.js +26 -0
- package/dist/npm/es/components/form-elements/OakJauntyAngleLabel/OakJauntyAngleLabel.js +10 -0
- package/dist/npm/es/components/form-elements/OakLabel/OakLabel.js +15 -0
- package/dist/npm/es/components/form-elements/OakMultilineText/OakMultilineText.js +96 -0
- package/dist/npm/es/components/form-elements/OakRadioAsButton/OakRadioAsButton.js +96 -0
- package/dist/npm/es/components/form-elements/OakRadioButton/OakRadioButton.js +31 -0
- package/dist/npm/es/components/form-elements/OakRadioGroup/OakRadioGroup.js +44 -0
- package/dist/npm/es/components/form-elements/OakSearchFilterCheckBox/OakSearchFilterCheckBox.js +64 -0
- package/dist/npm/es/components/form-elements/OakSecondaryButtonAsRadio/OakSecondaryButtonAsRadio.js +25 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeLegend.js +9 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeOptGroup.js +7 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeOption.js +22 -0
- package/dist/npm/es/components/form-elements/OakSelect/NativeSelect.js +23 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakOptGroup.js +12 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakOption.js +12 -0
- package/dist/npm/es/components/form-elements/OakSelect/OakSelect.js +44 -0
- package/dist/npm/es/components/form-elements/OakTextArea/OakTextArea.js +23 -0
- package/dist/npm/es/components/form-elements/OakTextInput/OakTextInput.js +59 -0
- package/dist/npm/es/components/house-cat/OakCaptionCard/OakCaptionCard.js +81 -0
- package/dist/npm/es/components/house-cat/OakCaptionSearch/OakCaptionSearch.js +24 -0
- package/dist/npm/es/components/house-cat/utils.js +33 -0
- package/dist/npm/es/components/images-and-icons/OakAspectRatio/OakAspectRatio.js +39 -0
- package/dist/npm/es/components/images-and-icons/OakIcon/OakIcon.js +38 -0
- package/dist/npm/es/components/images-and-icons/OakImage/OakImage.js +51 -0
- package/dist/npm/es/components/images-and-icons/OakImage/useShowPlaceholder.js +29 -0
- package/dist/npm/es/components/images-and-icons/OakRoundIcon/OakRoundIcon.js +17 -0
- package/dist/npm/es/components/images-and-icons/OakSvg/OakSvg.js +47 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordion.js +36 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordionProvider.js +24 -0
- package/dist/npm/es/components/internal-components/InternalAccordion/useAccordionContext.js +12 -0
- package/dist/npm/es/components/internal-components/InternalButton/InternalButton.js +48 -0
- package/dist/npm/es/components/internal-components/InternalCard/InternalCard.js +19 -0
- package/dist/npm/es/components/internal-components/InternalCardWithBackgroundElement/InternalCardWithBackgroundElement.js +22 -0
- package/dist/npm/es/components/internal-components/InternalCheckBox/InternalCheckBox.js +82 -0
- package/dist/npm/es/components/internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js +16 -0
- package/dist/npm/es/components/internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js +24 -0
- package/dist/npm/es/components/internal-components/InternalChevronAccordion/InternalChevronAccordion.js +83 -0
- package/dist/npm/es/components/internal-components/InternalClientPortal/InternalClientPortal.js +13 -0
- package/dist/npm/es/components/internal-components/InternalDndContext/InternalDndContext.js +28 -0
- package/dist/npm/es/components/internal-components/InternalLink/InternalLink.js +54 -0
- package/dist/npm/es/components/internal-components/InternalModalTransition/InternalModalTransition.js +31 -0
- package/dist/npm/es/components/internal-components/InternalRadio/InternalRadio.js +82 -0
- package/dist/npm/es/components/internal-components/InternalRadioWrapper/InternalRadioWrapper.js +36 -0
- package/dist/npm/es/components/internal-components/InternalReviewAccordion/InternalReviewAccordion.js +38 -0
- package/dist/npm/es/components/internal-components/InternalShadowIconButton/InternalShadowIconButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalShadowRectButton/InternalShadowRectButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js +56 -0
- package/dist/npm/es/components/internal-components/InternalSlideInFlex/InternalSlideInFlex.js +30 -0
- package/dist/npm/es/components/internal-components/InternalStyledSvg/InternalStyledSvg.js +14 -0
- package/dist/npm/es/components/internal-components/InternalTextInput/InternalTextInput.js +50 -0
- package/dist/npm/es/components/internal-components/InternalTooltip/InternalTooltip.js +36 -0
- package/dist/npm/es/components/layout-and-structure/OakAccordion/OakAccordion.js +39 -0
- package/dist/npm/es/components/layout-and-structure/OakBasicAccordion/OakBasicAccordion.js +10 -0
- package/dist/npm/es/components/layout-and-structure/OakBox/OakBox.js +41 -0
- package/dist/npm/es/components/layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js +23 -0
- package/dist/npm/es/components/layout-and-structure/OakFlex/OakFlex.js +18 -0
- package/dist/npm/es/components/layout-and-structure/OakGrid/OakGrid.js +16 -0
- package/dist/npm/es/components/layout-and-structure/OakGridArea/OakGridArea.js +51 -0
- package/dist/npm/es/components/layout-and-structure/OakMaxWidth/OakMaxWidth.js +23 -0
- package/dist/npm/es/components/messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js +38 -0
- package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js +22 -0
- package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/SubHandDrawnFocusUnderline.js +17 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModal.js +41 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalBody.js +14 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js +16 -0
- package/dist/npm/es/components/messaging-and-feedback/OakInlineBanner/OakInlineBanner.js +129 -0
- package/dist/npm/es/components/messaging-and-feedback/OakKbd/OakKbd.js +12 -0
- package/dist/npm/es/components/messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js +34 -0
- package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenter.js +106 -0
- package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenterBody.js +36 -0
- package/dist/npm/es/components/messaging-and-feedback/OakScreenReader/OakScreenReader.js +15 -0
- package/dist/npm/es/components/messaging-and-feedback/OakTagFunctional/OakTagFunctional.js +18 -0
- package/dist/npm/es/components/messaging-and-feedback/OakToast/OakToast.js +96 -0
- package/dist/npm/es/components/messaging-and-feedback/OakTooltip/OakTooltip.js +122 -0
- package/dist/npm/es/components/navigation/OakAnchorTarget/OakAnchorTarget.js +20 -0
- package/dist/npm/es/components/navigation/OakBreadcrumbs/OakBreadcrumbs.js +46 -0
- package/dist/npm/es/components/navigation/OakCard/OakCard.js +64 -0
- package/dist/npm/es/components/navigation/OakHoverLink/OakHoverLink.js +23 -0
- package/dist/npm/es/components/navigation/OakLink/OakLink.js +17 -0
- package/dist/npm/es/components/navigation/OakLink/config.js +18 -0
- package/dist/npm/es/components/navigation/OakPagination/OakPagination.js +106 -0
- package/dist/npm/es/components/navigation/OakPagination/utils.js +19 -0
- package/dist/npm/es/components/navigation/OakPrimaryNav/OakPrimaryNav.js +22 -0
- package/dist/npm/es/components/navigation/OakPrimaryNavItem/OakPrimaryNavItem.js +23 -0
- package/dist/npm/es/components/navigation/OakSecondaryLink/OakSecondaryLink.js +25 -0
- package/dist/npm/es/components/navigation/OakTabs/OakTabs.js +47 -0
- package/dist/npm/es/components/owa/OakBackLink/OakBackLink.js +28 -0
- package/dist/npm/es/components/owa/OakBulletList/OakBulletList.js +17 -0
- package/dist/npm/es/components/owa/OakCardWithHandDrawnBorder/OakCardWithHandDrawnBorder.js +17 -0
- package/dist/npm/es/components/owa/OakCloudinaryImage/OakCloudinaryImage.js +35 -0
- package/dist/npm/es/components/owa/OakCloudinaryImage/cloudinary.js +17 -0
- package/dist/npm/es/components/owa/OakCodeRenderer/OakCodeRenderer.js +135 -0
- package/dist/npm/es/components/owa/OakCopyLinkButton/OakCopyLinkButton.js +42 -0
- package/dist/npm/es/components/owa/OakDownloadCard/OakDownloadCard.js +72 -0
- package/dist/npm/es/components/owa/OakDownloadsJourneyChildSubjectTierSelector/OakDownloadsJourneyChildSubjectTierSelector.js +54 -0
- package/dist/npm/es/components/owa/OakDragAndDropInstructions/OakDragAndDropInstructions.js +41 -0
- package/dist/npm/es/components/owa/OakDraggable/OakDraggable.js +30 -0
- package/dist/npm/es/components/owa/OakDraggableFeedback/OakDraggableFeedback.js +13 -0
- package/dist/npm/es/components/owa/OakDroppable/OakDroppable.js +45 -0
- package/dist/npm/es/components/owa/OakFilterDrawer/OakFilterDrawer.js +43 -0
- package/dist/npm/es/components/owa/OakFormInputWithLabels/OakFormInputWithLabels.js +18 -0
- package/dist/npm/es/components/owa/OakHandDrawnCard/OakHandDrawnCard.js +17 -0
- package/dist/npm/es/components/owa/OakHandDrawnCardWithIcon/OakHandDrawnCardWithIcon.js +15 -0
- package/dist/npm/es/components/owa/OakHandDrawnHR/HandDrawnHRSvg.js +11 -0
- package/dist/npm/es/components/owa/OakHandDrawnHR/OakHandDrawnHR.js +22 -0
- package/dist/npm/es/components/owa/OakHeaderHero/OakHeaderHero.js +45 -0
- package/dist/npm/es/components/owa/OakHomepageTabButton/OakHomepageTabButton.js +35 -0
- package/dist/npm/es/components/owa/OakInfo/OakInfo.js +22 -0
- package/dist/npm/es/components/owa/OakInfoButton/OakInfoButton.js +20 -0
- package/dist/npm/es/components/owa/OakLessonInfoCard/OakLessonInfoCard.js +33 -0
- package/dist/npm/es/components/owa/OakLinkCard/OakLinkCard.js +42 -0
- package/dist/npm/es/components/owa/OakListItem/OakListItem.js +93 -0
- package/dist/npm/es/components/owa/OakMediaClip/OakMediaClip.js +90 -0
- package/dist/npm/es/components/owa/OakMediaClipList/OakMediaClipList.js +26 -0
- package/dist/npm/es/components/owa/OakMediaClipListAccordion/OakMediaClipListAccordion.js +29 -0
- package/dist/npm/es/components/owa/OakMediaClipStackListItem/OakMediaClipStackListItem.js +41 -0
- package/dist/npm/es/components/owa/OakOutlineAccordion/OakOutlineAccordion.js +21 -0
- package/dist/npm/es/components/owa/OakPromoTag/OakPromoTag.js +22 -0
- package/dist/npm/es/components/owa/OakRadioTile/OakRadioTile.js +40 -0
- package/dist/npm/es/components/owa/OakSaveCount/OakSaveCount.js +33 -0
- package/dist/npm/es/components/owa/OakScaleImageButton/OakScaleImageButton.js +19 -0
- package/dist/npm/es/components/owa/OakSideMenuNav/OakSideMenuNav.js +24 -0
- package/dist/npm/es/components/owa/OakSideMenuNavLink/OakSideMenuNavLink.js +48 -0
- package/dist/npm/es/components/owa/OakSignLanguageButton/OakSignLanguageButton.js +23 -0
- package/dist/npm/es/components/owa/OakSubjectIcon/OakSubjectIcon.js +20 -0
- package/dist/npm/es/components/owa/OakSubjectIconButton/OakSubjectIconButton.js +44 -0
- package/dist/npm/es/components/owa/OakTimer/OakTimer.js +26 -0
- package/dist/npm/es/components/owa/OakVideoTranscript/OakVideoTranscript.js +32 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListItem/OakUnitListItem.js +63 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItem/OakUnitListOptionalityItem.js +57 -0
- package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItemCard/OakUnitListOptionalityItemCard.js +36 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyContentGuidance/OakPupilJourneyContentGuidance.js +44 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyHeader/OakPupilJourneyHeader.js +29 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyLayout/OakPupilJourneyLayout.js +62 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyList/OakPupilJourneyList.js +46 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListCounter/OakPupilJourneyListCounter.js +12 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItem/OakPupilJourneyListItem.js +45 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItemSubheading/OakPupilJourneyListItemSubheading.js +20 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityButton/OakPupilJourneyOptionalityButton.js +35 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityItem/OakPupilJourneyOptionalityItem.js +23 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyProgrammeOptions/OakPupilJourneyProgrammeOptions.js +27 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyUnitsFilter/OakPupilJourneyUnitsFilter.js +42 -0
- package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyYearButton/OakPupilJourneyYearButton.js +31 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonBottomNav/OakLessonBottomNav.js +34 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonLayout/OakLessonLayout.js +153 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonNavItem/OakLessonNavItem.js +167 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewIntroVideo/OakPupilLessonReviewIntroVideo.js +30 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewItem/OakPupilLessonReviewItem.js +106 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewQuiz/OakPupilLessonReviewQuiz.js +56 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonTopNav/OakLessonTopNav.js +58 -0
- package/dist/npm/es/components/owa/pupil/lesson/OakLessonVideoTranscript/OakLessonVideoTranscript.js +27 -0
- package/dist/npm/es/components/owa/pupil/quiz/InternalDroppableHoldingPen/InternalDroppableHoldingPen.js +60 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakHintButton/OakHintButton.js +27 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizCheckBox/OakQuizCheckBox.js +58 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizCounter/OakQuizCounter.js +33 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizFeedback/OakQuizFeedback.js +31 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizHint/OakQuizHint.js +28 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizMatch/OakQuizMatch.js +121 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizOrder/OakQuizOrder.js +88 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableHeader/OakQuizPrintableHeader.js +29 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableSubHeader/OakQuizPrintableSubHeader.js +28 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizRadioButton/OakQuizRadioButton.js +78 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizResultItem/OakQuizResultItem.js +70 -0
- package/dist/npm/es/components/owa/pupil/quiz/OakQuizTextInput/OakQuizTextInput.js +28 -0
- package/dist/npm/es/components/owa/teacher/OakDownloadsAccordion/OakDownloadsAccordion.js +56 -0
- package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/OakInlineRegistrationBanner.js +62 -0
- package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/SurfingStudentSVG.js +15 -0
- package/dist/npm/es/components/owa/teacher/OakTeacherNotesInline/OakTeacherNotesInline.js +16 -0
- package/dist/npm/es/components/owa/teacher/OakTeacherNotesModal/OakTeacherNotesModal.js +72 -0
- package/dist/npm/es/components/owa/teacher/OakTertiaryOLNav/OakTertiaryOLNav.js +34 -0
- package/dist/npm/es/components/presentational/OakCarousel/OakCarousel.js +39 -0
- package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionControl.js +12 -0
- package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionIndicator.js +17 -0
- package/dist/npm/es/components/presentational/OakQuote/OakQuote.js +34 -0
- package/dist/npm/es/components/typography/OakHeading/OakHeading.js +33 -0
- package/dist/npm/es/components/typography/OakLI/OakLI.js +23 -0
- package/dist/npm/es/components/typography/OakOL/OakOL.js +22 -0
- package/dist/npm/es/components/typography/OakP/OakP.js +17 -0
- package/dist/npm/es/components/typography/OakSpan/OakSpan.js +18 -0
- package/dist/npm/es/components/typography/OakTypography/OakTypography.js +16 -0
- package/dist/npm/es/components/typography/OakUL/OakUL.js +19 -0
- package/dist/npm/es/components/unstyled/UnstyledChevronAccordion/UnstyledChevronAccordion.js +55 -0
- package/dist/npm/es/hooks/useBreakpoint.js +38 -0
- package/dist/npm/es/hooks/useIsScrolled.js +30 -0
- package/dist/npm/es/hooks/useMediaQuery.js +20 -0
- package/dist/npm/es/hooks/useMounted.js +12 -0
- package/dist/npm/es/image-map.js +205 -0
- package/dist/npm/es/index.js +196 -0
- package/dist/npm/es/styles/global/oak.styles.js +17 -0
- package/dist/npm/es/styles/global/reset.styles.js +11 -0
- package/dist/npm/es/styles/helpers/getFontSize.js +9 -0
- package/dist/npm/es/styles/helpers/getInternalPadding.js +15 -0
- package/dist/npm/es/styles/helpers/parseBorder.js +13 -0
- package/dist/npm/es/styles/helpers/parseBorderRadius.js +13 -0
- package/dist/npm/es/styles/helpers/parseBorderWidth.js +15 -0
- package/dist/npm/es/styles/helpers/parseColor.js +19 -0
- package/dist/npm/es/styles/helpers/parseColorFilter.js +19 -0
- package/dist/npm/es/styles/helpers/parseDropShadow.js +15 -0
- package/dist/npm/es/styles/helpers/parseOpacity.js +12 -0
- package/dist/npm/es/styles/helpers/parseSpacing.js +29 -0
- package/dist/npm/es/styles/helpers/parseTransitions.js +12 -0
- package/dist/npm/es/styles/helpers/parseTypography.js +36 -0
- package/dist/npm/es/styles/helpers/parseZIndex.js +13 -0
- package/dist/npm/es/styles/helpers/pxToRem.js +7 -0
- package/dist/npm/es/styles/helpers/truthy.js +13 -0
- package/dist/npm/es/styles/theme/borders.js +22 -0
- package/dist/npm/es/styles/theme/color.js +207 -0
- package/dist/npm/es/styles/theme/dark.theme.js +99 -0
- package/dist/npm/es/styles/theme/default.theme.js +99 -0
- package/dist/npm/es/styles/theme/dropShadow.js +13 -0
- package/dist/npm/es/styles/theme/opacity.js +8 -0
- package/dist/npm/es/styles/theme/spacing.js +48 -0
- package/dist/npm/es/styles/theme/transitions.js +6 -0
- package/dist/npm/es/styles/theme/typography.js +73 -0
- package/dist/npm/es/styles/theme/zIndex.js +17 -0
- package/dist/npm/es/styles/utils/borderStyle.js +27 -0
- package/dist/npm/es/styles/utils/colorFilterStyle.js +9 -0
- package/dist/npm/es/styles/utils/colorStyle.js +9 -0
- package/dist/npm/es/styles/utils/displayStyle.js +8 -0
- package/dist/npm/es/styles/utils/dropShadowStyle.js +9 -0
- package/dist/npm/es/styles/utils/flexStyle.js +9 -0
- package/dist/npm/es/styles/utils/listStyle.js +8 -0
- package/dist/npm/es/styles/utils/opacityStyle.js +9 -0
- package/dist/npm/es/styles/utils/positionStyle.js +9 -0
- package/dist/npm/es/styles/utils/responsiveStyle.js +69 -0
- package/dist/npm/es/styles/utils/scrollSnapStyle.js +11 -0
- package/dist/npm/es/styles/utils/sizeStyle.js +9 -0
- package/dist/npm/es/styles/utils/spacingStyle.js +25 -0
- package/dist/npm/es/styles/utils/transformStyle.js +8 -0
- package/dist/npm/es/styles/utils/transitionStyle.js +9 -0
- package/dist/npm/es/styles/utils/typographyStyle.js +9 -0
- package/dist/npm/es/styles/utils/zIndexStyle.js +9 -0
- package/dist/npm/es/svgs/button-border-bottom.js +6 -0
- package/dist/npm/es/svgs/button-border-left.js +6 -0
- package/dist/npm/es/svgs/button-border-right.js +6 -0
- package/dist/npm/es/svgs/button-border-top.js +6 -0
- package/dist/npm/es/svgs/header-underline.js +6 -0
- package/dist/npm/es/svgs/horizontal-rule.js +6 -0
- package/dist/npm/es/svgs/icon-background.js +6 -0
- package/dist/npm/es/svgs/scribble.js +11 -0
- package/dist/npm/es/svgs/underline-3.js +6 -0
- package/dist/npm/es/svgs/underline.js +6 -0
- package/dist/npm/es/test-helpers/colorConversion.js +14 -0
- package/dist/npm/es/test-helpers/mockIntersectionObserver.js +50 -0
- package/dist/npm/es/test-helpers/mockResizeObserver.js +25 -0
- package/dist/npm/es/types.d.ts +5249 -0
- package/package.json +28 -12
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js +0 -15
- package/dist/esm/index.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __rest, __assign, __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React, { forwardRef, useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { parseBorderRadius } from '../../../styles/helpers/parseBorderRadius.js';
|
|
5
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
6
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
7
|
+
import { borderStyle } from '../../../styles/utils/borderStyle.js';
|
|
8
|
+
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
9
|
+
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
10
|
+
import { spacingStyle } from '../../../styles/utils/spacingStyle.js';
|
|
11
|
+
|
|
12
|
+
var BaseCheckBox = forwardRef(function (props, ref) {
|
|
13
|
+
var onHovered = props.onHovered, rest = __rest(props, ["onHovered"]);
|
|
14
|
+
var hoverStart = useRef(Date.now());
|
|
15
|
+
var handleMouseEnter = function () {
|
|
16
|
+
hoverStart.current = Date.now();
|
|
17
|
+
};
|
|
18
|
+
var handleMouseLeave = function () {
|
|
19
|
+
var delta = Date.now() - hoverStart.current;
|
|
20
|
+
if (onHovered) {
|
|
21
|
+
onHovered(props.value, props.id, delta);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return (React.createElement("input", __assign({ ref: ref, type: "checkbox", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, name: props.id }, rest)));
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* These components can be used with InternalCheckBoxWrapper which allows for customisable icons
|
|
29
|
+
*
|
|
30
|
+
* Several flavours of checkbox are created here:
|
|
31
|
+
* - Default
|
|
32
|
+
* - Hover decorations
|
|
33
|
+
* - Focus decorations
|
|
34
|
+
* - Hover + Focus decorations
|
|
35
|
+
*
|
|
36
|
+
* NB. Hover decorations must be wrapped in a box with position relative to allow for the hover effect to work
|
|
37
|
+
*
|
|
38
|
+
* As they are styled components they can be further customised in implementation. Alternatively additional
|
|
39
|
+
* components can be created here.
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* ## Events
|
|
43
|
+
* The following callbacks are available for tracking focus events:
|
|
44
|
+
*
|
|
45
|
+
* ### onChange
|
|
46
|
+
* onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
47
|
+
*
|
|
48
|
+
* ### onFocus
|
|
49
|
+
* onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
50
|
+
*
|
|
51
|
+
* ### onBlur
|
|
52
|
+
* onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
53
|
+
*
|
|
54
|
+
* ### onHovered
|
|
55
|
+
* `onHovered?: (id, value, duration: number) => void;`<br>
|
|
56
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
var internalCheckBoxDefaults = {
|
|
61
|
+
$borderRadius: "border-radius-xs",
|
|
62
|
+
$ba: "border-solid-m",
|
|
63
|
+
$borderColor: "text-primary",
|
|
64
|
+
$checkedBackground: "text-primary",
|
|
65
|
+
};
|
|
66
|
+
var InternalCheckBox = styled(BaseCheckBox).attrs(function (_a) {
|
|
67
|
+
_a.theme; var props = __rest(_a, ["theme"]);
|
|
68
|
+
return (__assign(__assign({}, internalCheckBoxDefaults), props));
|
|
69
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* removing default appearance */\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n margin: 0;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n\n border-color: ", ";\n\n &:checked {\n ", ";\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n @media (hover: hover) {\n &:hover:not(:disabled) {\n border-color: ", ";\n }\n }\n"], ["\n /* removing default appearance */\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n margin: 0;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n\n border-color: ", ";\n\n &:checked {\n ", ";\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n @media (hover: hover) {\n &:hover:not(:disabled) {\n border-color: ", ";\n }\n }\n"])), borderStyle, colorStyle, spacingStyle, sizeStyle, function (props) { return parseColor(props.$uncheckedBorderColor); }, function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border-color: ", ";\n "], ["\n background: ", ";\n border-color: ", ";\n "])), parseColor(props.$checkedBackground), parseColor(props.$checkedBorderColor)); }, function (props) { return parseColor(props.$checkedBackground); });
|
|
70
|
+
var internalCheckBoxHoverDefaults = {
|
|
71
|
+
$hoverBorderRadius: "border-radius-xs",
|
|
72
|
+
};
|
|
73
|
+
var InternalCheckBoxHover = styled(InternalCheckBox).attrs(function (_a) {
|
|
74
|
+
_a.theme; var props = __rest(_a, ["theme"]);
|
|
75
|
+
return (__assign(__assign({}, internalCheckBoxHoverDefaults), props));
|
|
76
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /* @media wrapper is required to prevent hover effect on iOS Safari */\n\n @media (hover: hover) {\n &:hover:not(&:checked):not(&:disabled)::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 60%;\n transform: translate(-50%, -50%);\n border-radius: ", ";\n background: ", ";\n }\n }\n"], ["\n /* @media wrapper is required to prevent hover effect on iOS Safari */\n\n @media (hover: hover) {\n &:hover:not(&:checked):not(&:disabled)::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 60%;\n transform: translate(-50%, -50%);\n border-radius: ", ";\n background: ", ";\n }\n }\n"])), function (props) { return parseBorderRadius(props.$hoverBorderRadius); }, function (props) { return parseColor(props.$checkedBackground); });
|
|
77
|
+
var focusStyle = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &:focus-visible {\n box-shadow: ", ";\n }\n"], ["\n &:focus-visible {\n box-shadow: ", ";\n }\n"])), parseDropShadow("drop-shadow-centered-lemon"));
|
|
78
|
+
styled(InternalCheckBox)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), focusStyle);
|
|
79
|
+
var InternalCheckBoxHoverFocus = styled(InternalCheckBoxHover)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), focusStyle);
|
|
80
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
81
|
+
|
|
82
|
+
export { InternalCheckBox, InternalCheckBoxHover, InternalCheckBoxHoverFocus, internalCheckBoxDefaults, internalCheckBoxHoverDefaults };
|
package/dist/npm/es/components/internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { OakLabel } from '../../form-elements/OakLabel/OakLabel.js';
|
|
4
|
+
import { responsiveStyle } from '../../../styles/utils/responsiveStyle.js';
|
|
5
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* Specialised Label Component can be used and extended to create various different versions of CheckboxLabels
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
var InternalCheckBoxLabel = styled(OakLabel)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n ", "\n ", "\n"], ["\n display: flex;\n align-items: center;\n ", "\n ", "\n"])), responsiveStyle("gap", function (props) { return props.labelGap; }, parseSpacing), responsiveStyle("align-items", function (props) { return props.labelAlignItems; }));
|
|
13
|
+
var InternalCheckBoxLabelHoverDecor = styled(InternalCheckBoxLabel)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n @media (hover: hover) {\n &:hover {\n text-decoration: ", ";\n }\n }\n"], ["\n ", "\n @media (hover: hover) {\n &:hover {\n text-decoration: ", ";\n }\n }\n"])), function (props) { return "\n ".concat(props.pointerEvents ? "pointer-events: ".concat(props.pointerEvents, ";") : "", "\n ").concat(props.disabled ? "pointer-events: none;" : "cursor: pointer;", "\n "); }, function (props) { return (props.disabled ? "none" : "underline"); });
|
|
14
|
+
var templateObject_1, templateObject_2;
|
|
15
|
+
|
|
16
|
+
export { InternalCheckBoxLabel, InternalCheckBoxLabelHoverDecor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
5
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
6
|
+
|
|
7
|
+
var StyledIconContainer = styled(OakBox)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: none;\n opacity: 0;\n\n input:checked + & {\n opacity: 1;\n }\n"], ["\n pointer-events: none;\n opacity: 0;\n\n input:checked + & {\n opacity: 1;\n }\n"])));
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* This component is a wrapper for the InternalCheckBox component. It allows for customisable icons.
|
|
11
|
+
*
|
|
12
|
+
* NB. size must have the same value as the InternalCheckBox width and height
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
var InternalCheckBoxWrapper = function (props) {
|
|
17
|
+
var _a = props.size, size = _a === void 0 ? "spacing-24" : _a, _b = props.iconPadding, iconPadding = _b === void 0 ? "spacing-0" : _b, internalCheckbox = props.internalCheckbox, _c = props.checkedIcon, checkedIcon = _c === void 0 ? (React.createElement(OakIcon, { iconName: "tick", "$width": "100%", "$height": "100%", "$colorFilter": "icon-inverted" })) : _c;
|
|
18
|
+
return (React.createElement(OakBox, { "$position": "relative", "$width": size, "$height": size },
|
|
19
|
+
internalCheckbox,
|
|
20
|
+
React.createElement(StyledIconContainer, { "$position": "absolute", "$top": "spacing-0", "$left": "spacing-0", "$pa": iconPadding, "$width": size, "$height": size }, checkedIcon)));
|
|
21
|
+
};
|
|
22
|
+
var templateObject_1;
|
|
23
|
+
|
|
24
|
+
export { InternalCheckBoxWrapper };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign, __read } from 'tslib';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { OakHandDrawnFocusUnderline } from '../../messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js';
|
|
5
|
+
import { oakBoxCss, OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
8
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
9
|
+
import { InternalAccordionButton, InternalAccordionContent } from '../InternalAccordion/InternalAccordion.js';
|
|
10
|
+
import useAccordionContext from '../InternalAccordion/useAccordionContext.js';
|
|
11
|
+
import { InternalAccordionProvider } from '../InternalAccordion/InternalAccordionProvider.js';
|
|
12
|
+
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
13
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
14
|
+
import { parseOpacity } from '../../../styles/helpers/parseOpacity.js';
|
|
15
|
+
|
|
16
|
+
var StyledAccordionUnderline = styled(OakHandDrawnFocusUnderline)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: 100%;\n bottom: -", ";\n"], ["\n position: absolute;\n width: 100%;\n bottom: -", ";\n"])), parseSpacing("spacing-4"));
|
|
17
|
+
var StyledAccordionButton = styled(InternalAccordionButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n position: relative;\n &:hover {\n text-decoration: underline;\n }\n &:focus-visible {\n .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n }\n"], ["\n ", "\n ", "\n position: relative;\n &:hover {\n text-decoration: underline;\n }\n &:focus-visible {\n .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n }\n"])), flexStyle, oakBoxCss, parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"));
|
|
18
|
+
var StyledContainer = styled(OakFlex)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", " {\n visibility: hidden;\n }\n ", ":focus-visible ~ ", " {\n visibility: visible;\n }\n ", "\n ", "\n"], ["\n ", " {\n visibility: hidden;\n }\n ", ":focus-visible ~ ", " {\n visibility: visible;\n }\n ", "\n ", "\n"])), StyledAccordionUnderline, StyledAccordionButton, StyledAccordionUnderline, oakBoxCss, flexStyle);
|
|
19
|
+
var BottomBoxShadow = styled(OakBox)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n bottom: 0;\n width: 100%;\n height: 50px;\n opacity: ", ";\n z-index: 100;\n -webkit-box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n -moz-box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n padding: 2px;\n"], ["\n position: absolute;\n bottom: 0;\n width: 100%;\n height: 50px;\n opacity: ", ";\n z-index: 100;\n -webkit-box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n -moz-box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n box-shadow: inset 0px -55px 30px -30px rgba(255, 255, 255, 1);\n padding: 2px;\n"])), function (props) {
|
|
20
|
+
return props.shouldDisplayShadow
|
|
21
|
+
? parseOpacity("opaque")
|
|
22
|
+
: parseOpacity("transparent");
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* An accordion component that can be used to show/hide content
|
|
26
|
+
*/
|
|
27
|
+
var Accordion = function (_a) {
|
|
28
|
+
var header = _a.header, children = _a.children, id = _a.id, subheading = _a.subheading, styleProps = __rest(_a, ["header", "children", "id", "subheading"]);
|
|
29
|
+
var _b = __read(useState(false), 2), shouldDisplayShadow = _b[0], setShouldDisplayShadow = _b[1];
|
|
30
|
+
var scrollBox = useRef(null);
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
var scrollHeight = (_a = scrollBox.current) === null || _a === void 0 ? void 0 : _a.scrollHeight;
|
|
34
|
+
var clientHeight = (_b = scrollBox.current) === null || _b === void 0 ? void 0 : _b.clientHeight;
|
|
35
|
+
if (scrollHeight && clientHeight && scrollHeight > clientHeight) {
|
|
36
|
+
setShouldDisplayShadow(true);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
setShouldDisplayShadow(false);
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
var handleScroll = function () {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
var scrollHeight = (_a = scrollBox.current) === null || _a === void 0 ? void 0 : _a.scrollHeight;
|
|
45
|
+
var scrollTop = (_b = scrollBox.current) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
|
46
|
+
var clientHeight = (_c = scrollBox.current) === null || _c === void 0 ? void 0 : _c.clientHeight;
|
|
47
|
+
if (scrollHeight && scrollTop) {
|
|
48
|
+
var bottom = scrollHeight - scrollTop === clientHeight;
|
|
49
|
+
if (bottom) {
|
|
50
|
+
setShouldDisplayShadow(false);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setShouldDisplayShadow(true);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var isOpen = useAccordionContext().isOpen;
|
|
58
|
+
return (React.createElement(StyledContainer, __assign({ "$position": "relative", "$pv": "spacing-12", "$flexDirection": "column", "$gap": "spacing-4" }, styleProps),
|
|
59
|
+
React.createElement(StyledAccordionButton, { id: id, "$width": "100%", "$justifyContent": "space-between", "$alignItems": "center" },
|
|
60
|
+
header,
|
|
61
|
+
React.createElement(OakBox, { "$position": "relative", "$mr": "spacing-12" },
|
|
62
|
+
React.createElement(OakBox, { className: "shadow", "$position": "absolute", "$borderRadius": "border-radius-s", "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
|
|
63
|
+
React.createElement(OakIcon, { iconName: "chevron-down", "$width": "spacing-32", "$height": "spacing-32", alt: "An arrow to indicate whether the item is open or closed", style: {
|
|
64
|
+
transform: isOpen ? "rotate(180deg)" : "none",
|
|
65
|
+
transition: "all 0.3s ease 0s",
|
|
66
|
+
} }))),
|
|
67
|
+
!isOpen && subheading,
|
|
68
|
+
React.createElement(OakBox, { ref: scrollBox, "$position": "relative", "$overflow": "auto", onScroll: handleScroll, "data-testid": "scrollable-content" },
|
|
69
|
+
React.createElement(InternalAccordionContent, { "aria-labelledby": id }, children)),
|
|
70
|
+
React.createElement(StyledAccordionUnderline, { "$fill": "border-decorative5-stronger" }),
|
|
71
|
+
isOpen && (React.createElement(BottomBoxShadow, { shouldDisplayShadow: shouldDisplayShadow, "data-testid": "bottom-box-shadow", "$pointerEvents": "none" }))));
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* InternalChevronAccordion has a chevron icon that rotates when the accordion is open
|
|
75
|
+
*/
|
|
76
|
+
var InternalChevronAccordion = function (_a) {
|
|
77
|
+
var _b = _a.initialOpen, initialOpen = _b === void 0 ? false : _b, props = __rest(_a, ["initialOpen"]);
|
|
78
|
+
return (React.createElement(InternalAccordionProvider, { isInitialOpen: initialOpen },
|
|
79
|
+
React.createElement(Accordion, __assign({ initialOpen: true }, props))));
|
|
80
|
+
};
|
|
81
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
82
|
+
|
|
83
|
+
export { BottomBoxShadow, InternalChevronAccordion, StyledAccordionButton };
|
package/dist/npm/es/components/internal-components/InternalClientPortal/InternalClientPortal.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
|
|
4
|
+
var InternalClientPortal = function (_a) {
|
|
5
|
+
var children = _a.children, show = _a.show;
|
|
6
|
+
var ref = useRef(null);
|
|
7
|
+
useEffect(function () {
|
|
8
|
+
ref.current = document.body;
|
|
9
|
+
}, []);
|
|
10
|
+
return show && ref.current ? createPortal(children, ref.current) : null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { InternalClientPortal };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
import { DndContext } from '@dnd-kit/core';
|
|
3
|
+
import React, { createContext, useContext, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Facilitates DI for the DndContext
|
|
7
|
+
*/
|
|
8
|
+
var injectDndContext = createContext(DndContext);
|
|
9
|
+
/**
|
|
10
|
+
* Wraps dnd-kit's `DndContext` to normalise scroll behaviour and enable dependency injection
|
|
11
|
+
*/
|
|
12
|
+
var InternalDndContext = function (props) {
|
|
13
|
+
var DndContext = useContext(injectDndContext);
|
|
14
|
+
/**
|
|
15
|
+
* Disable smooth scrolling during drag to ensure that the dragged item is always visible
|
|
16
|
+
*/
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var originalScrollingBehaviour = document.documentElement.style.scrollBehavior;
|
|
19
|
+
document.documentElement.style.scrollBehavior = "auto";
|
|
20
|
+
return function () {
|
|
21
|
+
document.documentElement.style.scrollBehavior =
|
|
22
|
+
originalScrollingBehaviour;
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return React.createElement(DndContext, __assign({}, props));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { InternalDndContext, injectDndContext };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { OakLoadingSpinner } from '../../messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js';
|
|
5
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
6
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
7
|
+
import { parseBorderRadius } from '../../../styles/helpers/parseBorderRadius.js';
|
|
8
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
9
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
10
|
+
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
11
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
12
|
+
import { parseColorFilter } from '../../../styles/helpers/parseColorFilter.js';
|
|
13
|
+
import { typographyStyle } from '../../../styles/utils/typographyStyle.js';
|
|
14
|
+
|
|
15
|
+
var StyledOakIcon = styled(OakIcon)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 1.25em;\n min-width: 1.25em;\n height: 1.25em;\n min-height: 1.25em;\n"], ["\n width: 1.25em;\n min-width: 1.25em;\n height: 1.25em;\n min-height: 1.25em;\n"])));
|
|
16
|
+
var StyledOakLoadingSpinner = styled(OakLoadingSpinner)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n --width: 1.25em;\n"], ["\n --width: 1.25em;\n"])));
|
|
17
|
+
var StyledLink = styled.a(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline;\n align-items: center;\n gap: ", ";\n outline: none;\n border-radius: ", ";\n padding: ", ";\n margin: -", ";\n appearance: none;\n ", "\n background: none;\n border: none;\n text-decoration: ", ";\n cursor: pointer;\n color: ", ";\n overflow-wrap: break-word;\n\n ", " {\n filter: ", ";\n display: inline-block;\n vertical-align: text-top;\n }\n\n &:focus-visible {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:visited {\n color: ", ";\n\n ", " {\n filter: ", ";\n }\n }\n\n @media (hover: hover) {\n &:hover,\n &:visited:hover {\n color: ", ";\n ", " {\n filter: ", ";\n }\n text-decoration: underline;\n text-decoration-thickness: 18%;\n }\n }\n\n &:active {\n color: ", ";\n outline: 1px solid ", ";\n ", " {\n filter: ", ";\n }\n }\n\n &[disabled] {\n cursor: not-allowed;\n color: ", ";\n\n ", " {\n filter: ", ";\n }\n }\n"], ["\n display: inline;\n align-items: center;\n gap: ", ";\n outline: none;\n border-radius: ", ";\n padding: ", ";\n margin: -", ";\n appearance: none;\n ", "\n background: none;\n border: none;\n text-decoration: ", ";\n cursor: pointer;\n color: ", ";\n overflow-wrap: break-word;\n\n ", " {\n filter: ", ";\n display: inline-block;\n vertical-align: text-top;\n }\n\n &:focus-visible {\n box-shadow:\n ", ",\n ", ";\n }\n\n &:visited {\n color: ", ";\n\n ", " {\n filter: ", ";\n }\n }\n\n @media (hover: hover) {\n &:hover,\n &:visited:hover {\n color: ", ";\n ", " {\n filter: ", ";\n }\n text-decoration: underline;\n text-decoration-thickness: 18%;\n }\n }\n\n &:active {\n color: ", ";\n outline: 1px solid ", ";\n ", " {\n filter: ", ";\n }\n }\n\n &[disabled] {\n cursor: not-allowed;\n color: ", ";\n\n ", " {\n filter: ", ";\n }\n }\n"])), parseSpacing("spacing-4"), parseBorderRadius("border-radius-m"), parseSpacing("spacing-4"), parseSpacing("spacing-4"), function (props) { return (props.$font ? typographyStyle : "font: inherit;"); }, function (props) { return props.$textDecoration; }, function (props) { return parseColor(props.$color); }, StyledOakIcon, function (props) { return parseColorFilter(props.$color); }, parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), function (props) { return parseColor(props.$visitedColor); }, StyledOakIcon, function (props) { return parseColorFilter(props.$visitedColor); }, function (props) { return parseColor(props.$hoverColor); }, StyledOakIcon, function (props) { return parseColorFilter(props.$hoverColor); }, function (props) { return parseColor(props.$activeColor); }, function (props) { return parseColor(props.$activeColor); }, StyledOakIcon, function (props) { return parseColorFilter(props.$activeColor); }, function (props) { return parseColor(props.$disabledColor); }, StyledOakIcon, function (props) { return parseColorFilter(props.$disabledColor); });
|
|
18
|
+
/**
|
|
19
|
+
* A link with an optional icon and loading state.
|
|
20
|
+
*
|
|
21
|
+
* Defaulting to a `HTMLAnchorElement` this component is polymorphic and can be rendered as a button or any other element.
|
|
22
|
+
*/
|
|
23
|
+
var InternalLink = forwardRef(function (props, ref) {
|
|
24
|
+
var _a = props.element, element = _a === void 0 ? "a" : _a, iconName = props.iconName, isTrailingIcon = props.isTrailingIcon, children = props.children, isLoading = props.isLoading, color = props.color, disabledColor = props.disabledColor, visitedColor = props.visitedColor, hoverColor = props.hoverColor, activeColor = props.activeColor, _b = props.textDecoration, textDecoration = _b === void 0 ? "underline" : _b, rest = __rest(props, ["element", "iconName", "isTrailingIcon", "children", "isLoading", "color", "disabledColor", "visitedColor", "hoverColor", "activeColor", "textDecoration"]);
|
|
25
|
+
var icon = (function () {
|
|
26
|
+
switch (true) {
|
|
27
|
+
case isLoading:
|
|
28
|
+
return (React.createElement(OakBox, { "$pl": isTrailingIcon ? "spacing-4" : undefined, "$pr": isTrailingIcon ? undefined : "spacing-4", "$display": "inline-block" },
|
|
29
|
+
React.createElement(StyledOakLoadingSpinner, { "$color": "icon-primary" })));
|
|
30
|
+
case !!iconName:
|
|
31
|
+
return (React.createElement(OakBox, { "$pl": isTrailingIcon ? "spacing-4" : undefined, "$pr": isTrailingIcon ? undefined : "spacing-4", "$display": "inline-block" },
|
|
32
|
+
React.createElement(StyledOakIcon, { iconName: iconName })));
|
|
33
|
+
default:
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
var disabled = (function () {
|
|
38
|
+
switch (true) {
|
|
39
|
+
case "disabled" in rest:
|
|
40
|
+
return rest.disabled;
|
|
41
|
+
case isLoading:
|
|
42
|
+
return true;
|
|
43
|
+
default:
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
return (React.createElement(StyledLink, __assign({ as: element, ref: ref, disabled: disabled, "$color": color, "$disabledColor": disabledColor, "$visitedColor": visitedColor, "$hoverColor": hoverColor, "$activeColor": activeColor, "$textDecoration": textDecoration }, rest),
|
|
48
|
+
!isTrailingIcon && icon,
|
|
49
|
+
React.createElement(OakSpan, null, children),
|
|
50
|
+
isTrailingIcon && icon));
|
|
51
|
+
});
|
|
52
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
53
|
+
|
|
54
|
+
export { InternalLink };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FocusOn } from 'react-focus-on';
|
|
4
|
+
import { Transition } from 'react-transition-group';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import InternalSlideInFlex from '../InternalSlideInFlex/InternalSlideInFlex.js';
|
|
7
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
8
|
+
import { parseOpacity } from '../../../styles/helpers/parseOpacity.js';
|
|
9
|
+
|
|
10
|
+
var FadeOutBox = styled(OakBox)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: ", ";\n background-color: black;\n position: fixed;\n inset: 0;\n transition: ease;\n"], ["\n opacity: ", ";\n background-color: black;\n position: fixed;\n inset: 0;\n transition: ease;\n"])), function (_a) {
|
|
11
|
+
var $state = _a.$state;
|
|
12
|
+
switch ($state) {
|
|
13
|
+
case "entered":
|
|
14
|
+
case "entering":
|
|
15
|
+
return parseOpacity("semi-transparent");
|
|
16
|
+
default:
|
|
17
|
+
return parseOpacity("transparent");
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var InternalModalTransition = function (_a) {
|
|
21
|
+
var children = _a.children, isOpen = _a.isOpen, transitionRef = _a.transitionRef, onClose = _a.onClose, finalZIndex = _a.finalZIndex, isLeftHandSide = _a.isLeftHandSide, _b = _a.closeOnBackgroundClick, closeOnBackgroundClick = _b === void 0 ? false : _b, largeScreenMaxWidth = _a.largeScreenMaxWidth, rest = __rest(_a, ["children", "isOpen", "transitionRef", "onClose", "finalZIndex", "isLeftHandSide", "closeOnBackgroundClick", "largeScreenMaxWidth"]);
|
|
22
|
+
return (React.createElement(Transition, { in: isOpen, nodeRef: transitionRef, addEndListener: function (done) {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = transitionRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("transitionend", done);
|
|
25
|
+
}, timeout: 500, mountOnEnter: true, unmountOnExit: true }, function (state) { return (React.createElement(FocusOn, { onEscapeKey: onClose, returnFocus: true, autoFocus: true, preventScrollOnFocus: true },
|
|
26
|
+
React.createElement(FadeOutBox, { "$zIndex": finalZIndex, "$state": state, onClick: closeOnBackgroundClick ? onClose : undefined }),
|
|
27
|
+
React.createElement(InternalSlideInFlex, __assign({ isLeftHandSide: isLeftHandSide, ref: transitionRef, "$zIndex": finalZIndex, "$state": state, "aria-modal": true, largeScreenMaxWidth: largeScreenMaxWidth }, rest), children))); }));
|
|
28
|
+
};
|
|
29
|
+
var templateObject_1;
|
|
30
|
+
|
|
31
|
+
export { InternalModalTransition as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __rest, __assign, __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React, { forwardRef, useRef } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { parseBorderRadius } from '../../../styles/helpers/parseBorderRadius.js';
|
|
5
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
6
|
+
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
7
|
+
import { borderStyle } from '../../../styles/utils/borderStyle.js';
|
|
8
|
+
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
9
|
+
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
10
|
+
import { spacingStyle } from '../../../styles/utils/spacingStyle.js';
|
|
11
|
+
|
|
12
|
+
var BaseRadio = forwardRef(function (props, ref) {
|
|
13
|
+
var onHovered = props.onHovered, rest = __rest(props, ["onHovered"]);
|
|
14
|
+
var hoverStart = useRef(Date.now());
|
|
15
|
+
var handleMouseEnter = function () {
|
|
16
|
+
hoverStart.current = Date.now();
|
|
17
|
+
};
|
|
18
|
+
var handleMouseLeave = function () {
|
|
19
|
+
var delta = Date.now() - hoverStart.current;
|
|
20
|
+
if (onHovered) {
|
|
21
|
+
onHovered(props.value, props.id, delta);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return (React.createElement("input", __assign({ ref: ref, type: "radio", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, rest)));
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* These components can be used with InternalRadioWrapper which allows for customisable icons
|
|
29
|
+
*
|
|
30
|
+
* Several flavours of Radio are created here:
|
|
31
|
+
* - Default
|
|
32
|
+
* - Hover decorations
|
|
33
|
+
* - Focus decorations
|
|
34
|
+
* - Hover + Focus decorations
|
|
35
|
+
*
|
|
36
|
+
* NB. Hover decorations must be wrapped in a box with position relative to allow for the hover effect to work
|
|
37
|
+
*
|
|
38
|
+
* As they are styled components they can be further customised in implementation. Alternatively additional
|
|
39
|
+
* components can be created here.
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* ## Events
|
|
43
|
+
* The following callbacks are available for tracking focus events:
|
|
44
|
+
*
|
|
45
|
+
* ### onChange
|
|
46
|
+
* onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
47
|
+
*
|
|
48
|
+
* ### onFocus
|
|
49
|
+
* onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
50
|
+
*
|
|
51
|
+
* ### onBlur
|
|
52
|
+
* onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
53
|
+
*
|
|
54
|
+
* ### onHovered
|
|
55
|
+
* `onHovered?: (id, value, duration: number) => void;`<br>
|
|
56
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
var internalRadioDefaults = {
|
|
61
|
+
$borderRadius: "border-radius-xs",
|
|
62
|
+
$ba: "border-solid-m",
|
|
63
|
+
$borderColor: "text-primary",
|
|
64
|
+
$checkedBackground: "text-primary",
|
|
65
|
+
};
|
|
66
|
+
var InternalRadio = styled(BaseRadio).attrs(function (_a) {
|
|
67
|
+
_a.theme; var props = __rest(_a, ["theme"]);
|
|
68
|
+
return (__assign(__assign({}, internalRadioDefaults), props));
|
|
69
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* removing default appearance */\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n margin: 0;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n\n border-color: ", ";\n\n &:checked {\n ", ";\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n @media (hover: hover) {\n &:hover:not(:disabled) {\n border-color: ", ";\n }\n }\n"], ["\n /* removing default appearance */\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n margin: 0;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n\n border-color: ", ";\n\n &:checked {\n ", ";\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n @media (hover: hover) {\n &:hover:not(:disabled) {\n border-color: ", ";\n }\n }\n"])), borderStyle, colorStyle, spacingStyle, sizeStyle, function (props) { return parseColor(props.$uncheckedBorderColor); }, function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n border-color: ", ";\n "], ["\n background: ", ";\n border-color: ", ";\n "])), parseColor(props.$checkedBackground), parseColor(props.$checkedBorderColor)); }, function (props) { return parseColor(props.$checkedBackground); });
|
|
70
|
+
var internalRadioHoverDefaults = {
|
|
71
|
+
$hoverBorderRadius: "border-radius-xs",
|
|
72
|
+
};
|
|
73
|
+
var InternalRadioHover = styled(InternalRadio).attrs(function (_a) {
|
|
74
|
+
_a.theme; var props = __rest(_a, ["theme"]);
|
|
75
|
+
return (__assign(__assign({}, internalRadioHoverDefaults), props));
|
|
76
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n /* @media wrapper is required to prevent hover effect on iOS Safari */\n\n @media (hover: hover) {\n &:hover:not(&:checked):not(&:disabled)::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 60%;\n transform: translate(-50%, -50%);\n border-radius: ", ";\n background: ", ";\n }\n }\n"], ["\n /* @media wrapper is required to prevent hover effect on iOS Safari */\n\n @media (hover: hover) {\n &:hover:not(&:checked):not(&:disabled)::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 60%;\n transform: translate(-50%, -50%);\n border-radius: ", ";\n background: ", ";\n }\n }\n"])), function (props) { return parseBorderRadius(props.$hoverBorderRadius); }, function (props) { return parseColor(props.$checkedBackground); });
|
|
77
|
+
var focusStyle = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &:focus-visible {\n box-shadow: ", ";\n }\n"], ["\n &:focus-visible {\n box-shadow: ", ";\n }\n"])), parseDropShadow("drop-shadow-centered-lemon"));
|
|
78
|
+
styled(InternalRadio)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), focusStyle);
|
|
79
|
+
styled(InternalRadioHover)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), focusStyle);
|
|
80
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
81
|
+
|
|
82
|
+
export { InternalRadio, InternalRadioHover, internalRadioDefaults, internalRadioHoverDefaults };
|
package/dist/npm/es/components/internal-components/InternalRadioWrapper/InternalRadioWrapper.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __makeTemplateObject } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { InternalRadio } from '../InternalRadio/InternalRadio.js';
|
|
5
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
6
|
+
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
7
|
+
import { parseBorder } from '../../../styles/helpers/parseBorder.js';
|
|
8
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
9
|
+
|
|
10
|
+
// Extracted from <./src/components/molecules/OakRadioButton/OakRadioButton.tsx>
|
|
11
|
+
var VisibleRadioButtonInput = styled(OakFlex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 50%;\n\n ", "\n\n ", ":checked ~ &::after {\n content: \"\";\n height: ", ";\n width: ", ";\n background: ", ";\n position: absolute;\n border-radius: 50%;\n border: ", " ", ";\n }\n"], ["\n border-radius: 50%;\n\n ", "\n\n ", ":checked ~ &::after {\n content: \"\";\n height: ", ";\n width: ", ";\n background: ", ";\n position: absolute;\n border-radius: 50%;\n border: ", " ", ";\n }\n"])), function (props) {
|
|
12
|
+
return !props.$disableFocusRing && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ":focus-visible ~ &::before {\n content: \"\";\n height: ", ";\n width: ", ";\n background: transparent;\n display: block;\n position: absolute;\n border-radius: 50%;\n border: ", "\n ", ";\n box-shadow: inset 0 0 0 0.13rem ", ";\n }\n "], ["\n ", ":focus-visible ~ &::before {\n content: \"\";\n height: ", ";\n width: ", ";\n background: transparent;\n display: block;\n position: absolute;\n border-radius: 50%;\n border: ", "\n ", ";\n box-shadow: inset 0 0 0 0.13rem ", ";\n }\n "])), InternalRadio, parseSpacing("spacing-32"), parseSpacing("spacing-32"), parseBorder("border-solid-m"), parseColor("border-neutral-stronger"), parseColor("bg-decorative5-main"));
|
|
13
|
+
}, InternalRadio, function (props) { return parseSpacing(props.$radioInnerSize); }, function (props) { return parseSpacing(props.$radioInnerSize); }, parseColor("bg-inverted"), parseBorder("border-solid-m"), parseColor("border-inverted"));
|
|
14
|
+
// Extracted from <./src/components/molecules/OakRadioButton/OakRadioButton.tsx>
|
|
15
|
+
// This is a hack to force React to rerender when the disabled prop is changed. Otherwise the pseudo element is not updated.
|
|
16
|
+
var DisabledVisibleRadioButtonInput = styled(VisibleRadioButtonInput)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ":checked ~ &::after {\n content: \"\";\n height: ", ";\n width: ", ";\n background: ", ";\n position: absolute;\n border-radius: 50%;\n border: ", " ", ";\n }\n"], ["\n ", ":checked ~ &::after {\n content: \"\";\n height: ", ";\n width: ", ";\n background: ", ";\n position: absolute;\n border-radius: 50%;\n border: ", " ", ";\n }\n"])), InternalRadio, function (props) { return parseSpacing(props.$radioInnerSize); }, function (props) { return parseSpacing(props.$radioInnerSize); }, parseColor("bg-btn-primary-disabled"), parseBorder("border-solid-m"), parseColor("border-inverted"));
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* This component is a wrapper for the InternalRadio component. It allows for customisable icons.
|
|
20
|
+
*
|
|
21
|
+
* NB. size must have the same value as the InternalRadio width and height
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
var InternalRadioWrapper = function (props) {
|
|
26
|
+
var _a = props.size, size = _a === void 0 ? "spacing-24" : _a, internalRadio = props.internalRadio, disabled = props.disabled, _b = props.disableFocusRing, disableFocusRing = _b === void 0 ? false : _b, _c = props.radioInnerSize, radioInnerSize = _c === void 0 ? "spacing-16" : _c, _d = props.radioOuterSize, radioOuterSize = _d === void 0 ? "spacing-24" : _d, _e = props.radioBorderWidth, radioBorderWidth = _e === void 0 ? "border-solid-m" : _e, _f = props.radioBorderColor, radioBorderColor = _f === void 0 ? "border-primary" : _f, _g = props.radioBackground, radioBackground = _g === void 0 ? "bg-primary" : _g, _h = props.checkedRadioBorderWidth, checkedRadioBorderWidth = _h === void 0 ? "border-solid-m" : _h, checked = props.checked;
|
|
27
|
+
var finalRadioBorderWidth = checked
|
|
28
|
+
? checkedRadioBorderWidth
|
|
29
|
+
: radioBorderWidth;
|
|
30
|
+
return (React.createElement(OakFlex, { "$position": "relative", "$width": size, "$height": size, "$flexShrink": 0, "$justifyContent": "center", "$alignItems": "center" },
|
|
31
|
+
internalRadio,
|
|
32
|
+
!disabled ? (React.createElement(VisibleRadioButtonInput, { "$height": radioOuterSize, "$width": radioOuterSize, "$ba": finalRadioBorderWidth, "$borderColor": radioBorderColor, "$flexGrow": 0, "$flexShrink": 0, "$alignItems": "center", "$justifyContent": "center", "$background": radioBackground, "$disableFocusRing": !!disableFocusRing, "$radioInnerSize": radioInnerSize, "$position": "absolute", "$top": "spacing-0", "$left": "spacing-0" })) : (React.createElement(DisabledVisibleRadioButtonInput, { "$height": radioOuterSize, "$width": radioOuterSize, "$ba": finalRadioBorderWidth, "$borderColor": "bg-btn-primary-disabled", "$flexGrow": 0, "$flexShrink": 0, "$alignItems": "center", "$justifyContent": "center", "$background": radioBackground, "$disableFocusRing": !!disableFocusRing, "$radioInnerSize": radioInnerSize, "$position": "absolute", "$top": "spacing-0", "$left": "spacing-0" }))));
|
|
33
|
+
};
|
|
34
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
35
|
+
|
|
36
|
+
export { InternalRadioWrapper };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __makeTemplateObject, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
5
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
6
|
+
import { InternalAccordionContent } from '../InternalAccordion/InternalAccordion.js';
|
|
7
|
+
import useAccordionContext from '../InternalAccordion/useAccordionContext.js';
|
|
8
|
+
import { InternalAccordionProvider } from '../InternalAccordion/InternalAccordionProvider.js';
|
|
9
|
+
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
10
|
+
import { InternalShadowRoundButton } from '../InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
11
|
+
|
|
12
|
+
var StyledAccordionContent = styled(InternalAccordionContent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
|
|
13
|
+
var StyledAccordionButton = styled(InternalShadowRoundButton)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n ", "\n .icon-container img {\n ", ";\n }\n"], ["\n ", "\n ", "\n .icon-container img {\n ", ";\n }\n"])), flexStyle, oakBoxCss, function (props) { return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform: ", ";\n transition: all 0.3s ease 0s;\n "], ["\n transform: ", ";\n transition: all 0.3s ease 0s;\n "])), props.$isOpen ? "rotate(180deg)" : "none"); });
|
|
14
|
+
/**
|
|
15
|
+
* An accordion component that can be used to show/hide content
|
|
16
|
+
*/
|
|
17
|
+
var Accordion = function (_a) {
|
|
18
|
+
var children = _a.children, id = _a.id, toggleButtonAriaLabel = _a.toggleButtonAriaLabel;
|
|
19
|
+
var _b = useAccordionContext(), isOpen = _b.isOpen, setOpen = _b.setOpen;
|
|
20
|
+
return (React.createElement(React.Fragment, null,
|
|
21
|
+
React.createElement(OakFlex, { "$flexDirection": "column", "$alignItems": "flex-end", "$justifyContent": "center", "$pt": ["spacing-20", "spacing-0"] },
|
|
22
|
+
React.createElement(StyledAccordionButton, { "$isOpen": isOpen, onClick: function () { return setOpen(!isOpen); }, "aria-expanded": isOpen, "aria-label": toggleButtonAriaLabel, id: id, iconName: "chevron-down", defaultTextColor: "text-primary", hoverTextColor: "text-primary", disabledTextColor: "text-disabled", defaultIconBackground: "icon-primary", hoverIconBackground: "icon-primary", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-32", iconSize: "spacing-24", defaultIconColor: "icon-inverted", isTrailingIcon: true }, "Results")),
|
|
23
|
+
React.createElement(StyledAccordionContent, { "aria-labelledby": id },
|
|
24
|
+
React.createElement(OakFlex, { "$background": "bg-primary", "$borderRadius": "border-radius-l", "$pv": "spacing-40", "$ph": "spacing-24", "$minWidth": "100%", "$mt": "spacing-24" }, children))));
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* use this component in the expandableReviewItemSlot on the OakPupilLessonReviewItem component
|
|
29
|
+
*
|
|
30
|
+
* The children of this component is the is the results from the quiz.
|
|
31
|
+
*/
|
|
32
|
+
var InternalReviewAccordion = function (props) {
|
|
33
|
+
return (React.createElement(InternalAccordionProvider, { isInitialOpen: props.initialOpen },
|
|
34
|
+
React.createElement(Accordion, __assign({}, props))));
|
|
35
|
+
};
|
|
36
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
37
|
+
|
|
38
|
+
export { InternalReviewAccordion, StyledAccordionButton, StyledAccordionContent };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __makeTemplateObject, __rest, __assign } from 'tslib';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { parseColorFilter } from '../../../styles/helpers/parseColorFilter.js';
|
|
5
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
+
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
8
|
+
import { InternalButton } from '../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 display: inline-block;\n ", "\n ", "\n ", "\n"], ["\n display: inline-block;\n ", "\n ", "\n ", "\n"])), positionStyle, sizeStyle, function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n text-decoration: underline;\n color: ", ";\n\n &:not(:active) [data-icon-for=\"button\"] img {\n filter: ", ";\n }\n }\n &:active {\n color: ", ";\n }\n &:disabled {\n color: ", ";\n }\n "], ["\n &:hover {\n text-decoration: underline;\n color: ", ";\n\n &:not(:active) [data-icon-for=\"button\"] img {\n filter: ", ";\n }\n }\n &:active {\n color: ", ";\n }\n &:disabled {\n color: ", ";\n }\n "])), parseColor(props.$hoverTextColor), props.$hoverIconColor
|
|
17
|
+
? parseColorFilter(props.$hoverIconColor)
|
|
18
|
+
: undefined, parseColor(props.$defaultTextColor), parseColor(props.$disabledTextColor)); });
|
|
19
|
+
var StyledButtonWrapper = styled(OakFlex)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n > :first-child:hover .highlight {\n display: block;\n }\n > :first-child:active .highlight {\n display: block;\n }\n > :first-child:active .shadow {\n display: block;\n }\n > :first-child:focus-visible {\n box-shadow:\n ", ",\n ", ";\n background: white;\n }\n"], ["\n > :first-child:hover .highlight {\n display: block;\n }\n > :first-child:active .highlight {\n display: block;\n }\n > :first-child:active .shadow {\n display: block;\n }\n > :first-child:focus-visible {\n box-shadow:\n ", ",\n ", ";\n background: white;\n }\n"])), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"));
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* A styled button with round icons, not intended to be used directly.
|
|
23
|
+
* Instead used by OakSmallTertiaryInvertedButton.
|
|
24
|
+
*
|
|
25
|
+
* The following callbacks are available for tracking focus events:
|
|
26
|
+
*
|
|
27
|
+
* ### onClick
|
|
28
|
+
* `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
|
|
29
|
+
|
|
30
|
+
* ### onHovered
|
|
31
|
+
* `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
|
|
32
|
+
* called after a mouseEnter and mouseLeave event has happened
|
|
33
|
+
*/
|
|
34
|
+
var InternalShadowIconButton = function (props) {
|
|
35
|
+
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, maxWidth = props.maxWidth, hoverIconColor = props.hoverIconColor, disabledTextColor = props.disabledTextColor, defaultIconColor = props.defaultIconColor, disabledIconColor = props.disabledIconColor, defaultTextColor = props.defaultTextColor, hoverTextColor = props.hoverTextColor, className = props.className, $justifyContent = props.$justifyContent, rest = __rest(props, ["element", "children", "iconName", "isTrailingIcon", "isLoading", "disabled", "width", "maxWidth", "hoverIconColor", "disabledTextColor", "defaultIconColor", "disabledIconColor", "defaultTextColor", "hoverTextColor", "className", "$justifyContent"]);
|
|
36
|
+
var icon = iconName && (React.createElement(OakBox, { "$position": "relative" },
|
|
37
|
+
React.createElement(OakIcon, { iconName: iconName, "$width": "spacing-24", "$height": "spacing-24", "$colorFilter": props.disabled ? disabledIconColor : "icon-subdued", "$position": "absolute", "$top": "spacing-4", "$left": "spacing-4", "$display": "none", className: "shadow", alt: "" }),
|
|
38
|
+
React.createElement(OakIcon, { iconName: iconName, "$width": "spacing-24", "$height": "spacing-24", "$colorFilter": props.disabled ? disabledIconColor : "icon-promo", "$position": "absolute", "$display": "none", "$top": "spacing-2", "$left": "spacing-2", className: "highlight", alt: "" }),
|
|
39
|
+
React.createElement(OakIcon, { iconName: iconName, "$width": "spacing-24", "$height": "spacing-24", "$colorFilter": props.disabled
|
|
40
|
+
? disabledIconColor
|
|
41
|
+
: defaultIconColor
|
|
42
|
+
? defaultIconColor
|
|
43
|
+
: null, "data-icon-for": "button", alt: "" })));
|
|
44
|
+
var loader = (React.createElement(OakBox, { "$width": "spacing-24", "$height": "spacing-24" },
|
|
45
|
+
React.createElement(OakLoadingSpinner, { "$width": "spacing-24", "$color": "text-disabled" })));
|
|
46
|
+
var iconLogic = (isLoading || icon) && (React.createElement(OakFlex, { className: "icon-container", "$background": props.defaultIconBackground, "$color": props.defaultTextColor, "$borderRadius": "border-radius-circle", "$position": "relative", "$alignItems": "center", "$justifyContent": "center" }, isLoading && !disabled ? loader : icon));
|
|
47
|
+
return (React.createElement(StyledButtonWrapper, { className: className, "$position": "relative", "$width": width, "$maxWidth": maxWidth, "$justifyContent": $justifyContent },
|
|
48
|
+
React.createElement(StyledInternalButton, __assign({ element: element !== null && element !== void 0 ? element : "button" }, rest, { "$hoverTextColor": hoverTextColor, "$hoverIconColor": hoverIconColor, "$defaultTextColor": defaultTextColor, "$disabledTextColor": disabledTextColor, "$color": defaultTextColor, "$position": "relative", "$borderRadius": "border-radius-s", disabled: disabled || isLoading }),
|
|
49
|
+
React.createElement(OakFlex, { "$flexDirection": "row", "$alignItems": "center", "$gap": children ? "spacing-4" : "spacing-0", "$justifyContent": "center", "$pl": isTrailingIcon ? "spacing-8" : "spacing-0", "$pr": isTrailingIcon ? "spacing-0" : "spacing-8" },
|
|
50
|
+
!isTrailingIcon && iconLogic,
|
|
51
|
+
React.createElement(OakSpan, { "$font": "heading-light-7" }, children),
|
|
52
|
+
isTrailingIcon && iconLogic))));
|
|
53
|
+
};
|
|
54
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
55
|
+
|
|
56
|
+
export { InternalShadowIconButton };
|