@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.
Files changed (281) hide show
  1. package/dist/npm/cjs/index.js +7949 -0
  2. package/dist/npm/es/animation/usePrefersReducedMotion.js +16 -0
  3. package/dist/npm/es/components/OakGlobalStyle/OakGlobalStyle.js +14 -0
  4. package/dist/npm/es/components/OakThemeProvider/OakThemeProvider.js +14 -0
  5. package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js +105 -0
  6. package/dist/npm/es/components/buttons/OakCloseButton/OakCloseButton.js +18 -0
  7. package/dist/npm/es/components/buttons/OakLeftAlignedButton/OakLeftAlignedButton.js +57 -0
  8. package/dist/npm/es/components/buttons/OakPrimaryButton/OakPrimaryButton.js +23 -0
  9. package/dist/npm/es/components/buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js +23 -0
  10. package/dist/npm/es/components/buttons/OakSecondaryButton/OakSecondaryButton.js +23 -0
  11. package/dist/npm/es/components/buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js +20 -0
  12. package/dist/npm/es/components/buttons/OakSmallPrimaryButton/OakSmallPrimaryButton.js +23 -0
  13. package/dist/npm/es/components/buttons/OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js +23 -0
  14. package/dist/npm/es/components/buttons/OakSmallSecondaryButton/OakSmallSecondaryButton.js +23 -0
  15. package/dist/npm/es/components/buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js +20 -0
  16. package/dist/npm/es/components/buttons/OakSmallSecondaryToggleButton/OakSmallSecondaryToggleButton.js +37 -0
  17. package/dist/npm/es/components/buttons/OakSmallTertiaryInvertedButton/OakSmallTertiaryInvertedButton.js +23 -0
  18. package/dist/npm/es/components/buttons/OakTertiaryButton/OakTertiaryButton.js +14 -0
  19. package/dist/npm/es/components/buttons/OakTertiaryInvertedButton/OakTertiaryInvertedButton.js +14 -0
  20. package/dist/npm/es/components/cookies/OakCookieBanner/OakCookieBanner.js +62 -0
  21. package/dist/npm/es/components/cookies/OakCookieConsent/OakCookieConsent.js +17 -0
  22. package/dist/npm/es/components/cookies/OakCookieConsentProvider/OakCookieConsentProvider.js +103 -0
  23. package/dist/npm/es/components/cookies/OakCookieConsentProvider/cookieConsentReducer.js +32 -0
  24. package/dist/npm/es/components/cookies/OakCookieSettingsModal/OakCookieSettingsModal.js +91 -0
  25. package/dist/npm/es/components/form-elements/OakButtonAsRadioGroup/OakButtonAsRadioGroup.js +44 -0
  26. package/dist/npm/es/components/form-elements/OakCheckBox/OakCheckBox.js +71 -0
  27. package/dist/npm/es/components/form-elements/OakFieldError/OakFieldError.js +25 -0
  28. package/dist/npm/es/components/form-elements/OakFieldset/OakFieldset.js +12 -0
  29. package/dist/npm/es/components/form-elements/OakForm/OakForm.js +16 -0
  30. package/dist/npm/es/components/form-elements/OakFormInput/OakFormInput.js +26 -0
  31. package/dist/npm/es/components/form-elements/OakJauntyAngleLabel/OakJauntyAngleLabel.js +10 -0
  32. package/dist/npm/es/components/form-elements/OakLabel/OakLabel.js +15 -0
  33. package/dist/npm/es/components/form-elements/OakMultilineText/OakMultilineText.js +96 -0
  34. package/dist/npm/es/components/form-elements/OakRadioAsButton/OakRadioAsButton.js +96 -0
  35. package/dist/npm/es/components/form-elements/OakRadioButton/OakRadioButton.js +31 -0
  36. package/dist/npm/es/components/form-elements/OakRadioGroup/OakRadioGroup.js +44 -0
  37. package/dist/npm/es/components/form-elements/OakSearchFilterCheckBox/OakSearchFilterCheckBox.js +64 -0
  38. package/dist/npm/es/components/form-elements/OakSecondaryButtonAsRadio/OakSecondaryButtonAsRadio.js +25 -0
  39. package/dist/npm/es/components/form-elements/OakSelect/NativeLegend.js +9 -0
  40. package/dist/npm/es/components/form-elements/OakSelect/NativeOptGroup.js +7 -0
  41. package/dist/npm/es/components/form-elements/OakSelect/NativeOption.js +22 -0
  42. package/dist/npm/es/components/form-elements/OakSelect/NativeSelect.js +23 -0
  43. package/dist/npm/es/components/form-elements/OakSelect/OakOptGroup.js +12 -0
  44. package/dist/npm/es/components/form-elements/OakSelect/OakOption.js +12 -0
  45. package/dist/npm/es/components/form-elements/OakSelect/OakSelect.js +44 -0
  46. package/dist/npm/es/components/form-elements/OakTextArea/OakTextArea.js +23 -0
  47. package/dist/npm/es/components/form-elements/OakTextInput/OakTextInput.js +59 -0
  48. package/dist/npm/es/components/house-cat/OakCaptionCard/OakCaptionCard.js +81 -0
  49. package/dist/npm/es/components/house-cat/OakCaptionSearch/OakCaptionSearch.js +24 -0
  50. package/dist/npm/es/components/house-cat/utils.js +33 -0
  51. package/dist/npm/es/components/images-and-icons/OakAspectRatio/OakAspectRatio.js +39 -0
  52. package/dist/npm/es/components/images-and-icons/OakIcon/OakIcon.js +38 -0
  53. package/dist/npm/es/components/images-and-icons/OakImage/OakImage.js +51 -0
  54. package/dist/npm/es/components/images-and-icons/OakImage/useShowPlaceholder.js +29 -0
  55. package/dist/npm/es/components/images-and-icons/OakRoundIcon/OakRoundIcon.js +17 -0
  56. package/dist/npm/es/components/images-and-icons/OakSvg/OakSvg.js +47 -0
  57. package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordion.js +36 -0
  58. package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordionProvider.js +24 -0
  59. package/dist/npm/es/components/internal-components/InternalAccordion/useAccordionContext.js +12 -0
  60. package/dist/npm/es/components/internal-components/InternalButton/InternalButton.js +48 -0
  61. package/dist/npm/es/components/internal-components/InternalCard/InternalCard.js +19 -0
  62. package/dist/npm/es/components/internal-components/InternalCardWithBackgroundElement/InternalCardWithBackgroundElement.js +22 -0
  63. package/dist/npm/es/components/internal-components/InternalCheckBox/InternalCheckBox.js +82 -0
  64. package/dist/npm/es/components/internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js +16 -0
  65. package/dist/npm/es/components/internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js +24 -0
  66. package/dist/npm/es/components/internal-components/InternalChevronAccordion/InternalChevronAccordion.js +83 -0
  67. package/dist/npm/es/components/internal-components/InternalClientPortal/InternalClientPortal.js +13 -0
  68. package/dist/npm/es/components/internal-components/InternalDndContext/InternalDndContext.js +28 -0
  69. package/dist/npm/es/components/internal-components/InternalLink/InternalLink.js +54 -0
  70. package/dist/npm/es/components/internal-components/InternalModalTransition/InternalModalTransition.js +31 -0
  71. package/dist/npm/es/components/internal-components/InternalRadio/InternalRadio.js +82 -0
  72. package/dist/npm/es/components/internal-components/InternalRadioWrapper/InternalRadioWrapper.js +36 -0
  73. package/dist/npm/es/components/internal-components/InternalReviewAccordion/InternalReviewAccordion.js +38 -0
  74. package/dist/npm/es/components/internal-components/InternalShadowIconButton/InternalShadowIconButton.js +56 -0
  75. package/dist/npm/es/components/internal-components/InternalShadowRectButton/InternalShadowRectButton.js +56 -0
  76. package/dist/npm/es/components/internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js +56 -0
  77. package/dist/npm/es/components/internal-components/InternalSlideInFlex/InternalSlideInFlex.js +30 -0
  78. package/dist/npm/es/components/internal-components/InternalStyledSvg/InternalStyledSvg.js +14 -0
  79. package/dist/npm/es/components/internal-components/InternalTextInput/InternalTextInput.js +50 -0
  80. package/dist/npm/es/components/internal-components/InternalTooltip/InternalTooltip.js +36 -0
  81. package/dist/npm/es/components/layout-and-structure/OakAccordion/OakAccordion.js +39 -0
  82. package/dist/npm/es/components/layout-and-structure/OakBasicAccordion/OakBasicAccordion.js +10 -0
  83. package/dist/npm/es/components/layout-and-structure/OakBox/OakBox.js +41 -0
  84. package/dist/npm/es/components/layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js +23 -0
  85. package/dist/npm/es/components/layout-and-structure/OakFlex/OakFlex.js +18 -0
  86. package/dist/npm/es/components/layout-and-structure/OakGrid/OakGrid.js +16 -0
  87. package/dist/npm/es/components/layout-and-structure/OakGridArea/OakGridArea.js +51 -0
  88. package/dist/npm/es/components/layout-and-structure/OakMaxWidth/OakMaxWidth.js +23 -0
  89. package/dist/npm/es/components/messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js +38 -0
  90. package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js +22 -0
  91. package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/SubHandDrawnFocusUnderline.js +17 -0
  92. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModal.js +41 -0
  93. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalBody.js +14 -0
  94. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js +16 -0
  95. package/dist/npm/es/components/messaging-and-feedback/OakInlineBanner/OakInlineBanner.js +129 -0
  96. package/dist/npm/es/components/messaging-and-feedback/OakKbd/OakKbd.js +12 -0
  97. package/dist/npm/es/components/messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js +34 -0
  98. package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenter.js +106 -0
  99. package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenterBody.js +36 -0
  100. package/dist/npm/es/components/messaging-and-feedback/OakScreenReader/OakScreenReader.js +15 -0
  101. package/dist/npm/es/components/messaging-and-feedback/OakTagFunctional/OakTagFunctional.js +18 -0
  102. package/dist/npm/es/components/messaging-and-feedback/OakToast/OakToast.js +96 -0
  103. package/dist/npm/es/components/messaging-and-feedback/OakTooltip/OakTooltip.js +122 -0
  104. package/dist/npm/es/components/navigation/OakAnchorTarget/OakAnchorTarget.js +20 -0
  105. package/dist/npm/es/components/navigation/OakBreadcrumbs/OakBreadcrumbs.js +46 -0
  106. package/dist/npm/es/components/navigation/OakCard/OakCard.js +64 -0
  107. package/dist/npm/es/components/navigation/OakHoverLink/OakHoverLink.js +23 -0
  108. package/dist/npm/es/components/navigation/OakLink/OakLink.js +17 -0
  109. package/dist/npm/es/components/navigation/OakLink/config.js +18 -0
  110. package/dist/npm/es/components/navigation/OakPagination/OakPagination.js +106 -0
  111. package/dist/npm/es/components/navigation/OakPagination/utils.js +19 -0
  112. package/dist/npm/es/components/navigation/OakPrimaryNav/OakPrimaryNav.js +22 -0
  113. package/dist/npm/es/components/navigation/OakPrimaryNavItem/OakPrimaryNavItem.js +23 -0
  114. package/dist/npm/es/components/navigation/OakSecondaryLink/OakSecondaryLink.js +25 -0
  115. package/dist/npm/es/components/navigation/OakTabs/OakTabs.js +47 -0
  116. package/dist/npm/es/components/owa/OakBackLink/OakBackLink.js +28 -0
  117. package/dist/npm/es/components/owa/OakBulletList/OakBulletList.js +17 -0
  118. package/dist/npm/es/components/owa/OakCardWithHandDrawnBorder/OakCardWithHandDrawnBorder.js +17 -0
  119. package/dist/npm/es/components/owa/OakCloudinaryImage/OakCloudinaryImage.js +35 -0
  120. package/dist/npm/es/components/owa/OakCloudinaryImage/cloudinary.js +17 -0
  121. package/dist/npm/es/components/owa/OakCodeRenderer/OakCodeRenderer.js +135 -0
  122. package/dist/npm/es/components/owa/OakCopyLinkButton/OakCopyLinkButton.js +42 -0
  123. package/dist/npm/es/components/owa/OakDownloadCard/OakDownloadCard.js +72 -0
  124. package/dist/npm/es/components/owa/OakDownloadsJourneyChildSubjectTierSelector/OakDownloadsJourneyChildSubjectTierSelector.js +54 -0
  125. package/dist/npm/es/components/owa/OakDragAndDropInstructions/OakDragAndDropInstructions.js +41 -0
  126. package/dist/npm/es/components/owa/OakDraggable/OakDraggable.js +30 -0
  127. package/dist/npm/es/components/owa/OakDraggableFeedback/OakDraggableFeedback.js +13 -0
  128. package/dist/npm/es/components/owa/OakDroppable/OakDroppable.js +45 -0
  129. package/dist/npm/es/components/owa/OakFilterDrawer/OakFilterDrawer.js +43 -0
  130. package/dist/npm/es/components/owa/OakFormInputWithLabels/OakFormInputWithLabels.js +18 -0
  131. package/dist/npm/es/components/owa/OakHandDrawnCard/OakHandDrawnCard.js +17 -0
  132. package/dist/npm/es/components/owa/OakHandDrawnCardWithIcon/OakHandDrawnCardWithIcon.js +15 -0
  133. package/dist/npm/es/components/owa/OakHandDrawnHR/HandDrawnHRSvg.js +11 -0
  134. package/dist/npm/es/components/owa/OakHandDrawnHR/OakHandDrawnHR.js +22 -0
  135. package/dist/npm/es/components/owa/OakHeaderHero/OakHeaderHero.js +45 -0
  136. package/dist/npm/es/components/owa/OakHomepageTabButton/OakHomepageTabButton.js +35 -0
  137. package/dist/npm/es/components/owa/OakInfo/OakInfo.js +22 -0
  138. package/dist/npm/es/components/owa/OakInfoButton/OakInfoButton.js +20 -0
  139. package/dist/npm/es/components/owa/OakLessonInfoCard/OakLessonInfoCard.js +33 -0
  140. package/dist/npm/es/components/owa/OakLinkCard/OakLinkCard.js +42 -0
  141. package/dist/npm/es/components/owa/OakListItem/OakListItem.js +93 -0
  142. package/dist/npm/es/components/owa/OakMediaClip/OakMediaClip.js +90 -0
  143. package/dist/npm/es/components/owa/OakMediaClipList/OakMediaClipList.js +26 -0
  144. package/dist/npm/es/components/owa/OakMediaClipListAccordion/OakMediaClipListAccordion.js +29 -0
  145. package/dist/npm/es/components/owa/OakMediaClipStackListItem/OakMediaClipStackListItem.js +41 -0
  146. package/dist/npm/es/components/owa/OakOutlineAccordion/OakOutlineAccordion.js +21 -0
  147. package/dist/npm/es/components/owa/OakPromoTag/OakPromoTag.js +22 -0
  148. package/dist/npm/es/components/owa/OakRadioTile/OakRadioTile.js +40 -0
  149. package/dist/npm/es/components/owa/OakSaveCount/OakSaveCount.js +33 -0
  150. package/dist/npm/es/components/owa/OakScaleImageButton/OakScaleImageButton.js +19 -0
  151. package/dist/npm/es/components/owa/OakSideMenuNav/OakSideMenuNav.js +24 -0
  152. package/dist/npm/es/components/owa/OakSideMenuNavLink/OakSideMenuNavLink.js +48 -0
  153. package/dist/npm/es/components/owa/OakSignLanguageButton/OakSignLanguageButton.js +23 -0
  154. package/dist/npm/es/components/owa/OakSubjectIcon/OakSubjectIcon.js +20 -0
  155. package/dist/npm/es/components/owa/OakSubjectIconButton/OakSubjectIconButton.js +44 -0
  156. package/dist/npm/es/components/owa/OakTimer/OakTimer.js +26 -0
  157. package/dist/npm/es/components/owa/OakVideoTranscript/OakVideoTranscript.js +32 -0
  158. package/dist/npm/es/components/owa/pupil/OakUnitListItem/OakUnitListItem.js +63 -0
  159. package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItem/OakUnitListOptionalityItem.js +57 -0
  160. package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItemCard/OakUnitListOptionalityItemCard.js +36 -0
  161. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyContentGuidance/OakPupilJourneyContentGuidance.js +44 -0
  162. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyHeader/OakPupilJourneyHeader.js +29 -0
  163. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyLayout/OakPupilJourneyLayout.js +62 -0
  164. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyList/OakPupilJourneyList.js +46 -0
  165. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListCounter/OakPupilJourneyListCounter.js +12 -0
  166. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItem/OakPupilJourneyListItem.js +45 -0
  167. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItemSubheading/OakPupilJourneyListItemSubheading.js +20 -0
  168. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityButton/OakPupilJourneyOptionalityButton.js +35 -0
  169. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityItem/OakPupilJourneyOptionalityItem.js +23 -0
  170. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyProgrammeOptions/OakPupilJourneyProgrammeOptions.js +27 -0
  171. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyUnitsFilter/OakPupilJourneyUnitsFilter.js +42 -0
  172. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyYearButton/OakPupilJourneyYearButton.js +31 -0
  173. package/dist/npm/es/components/owa/pupil/lesson/OakLessonBottomNav/OakLessonBottomNav.js +34 -0
  174. package/dist/npm/es/components/owa/pupil/lesson/OakLessonLayout/OakLessonLayout.js +153 -0
  175. package/dist/npm/es/components/owa/pupil/lesson/OakLessonNavItem/OakLessonNavItem.js +167 -0
  176. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewIntroVideo/OakPupilLessonReviewIntroVideo.js +30 -0
  177. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewItem/OakPupilLessonReviewItem.js +106 -0
  178. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewQuiz/OakPupilLessonReviewQuiz.js +56 -0
  179. package/dist/npm/es/components/owa/pupil/lesson/OakLessonTopNav/OakLessonTopNav.js +58 -0
  180. package/dist/npm/es/components/owa/pupil/lesson/OakLessonVideoTranscript/OakLessonVideoTranscript.js +27 -0
  181. package/dist/npm/es/components/owa/pupil/quiz/InternalDroppableHoldingPen/InternalDroppableHoldingPen.js +60 -0
  182. package/dist/npm/es/components/owa/pupil/quiz/OakHintButton/OakHintButton.js +27 -0
  183. package/dist/npm/es/components/owa/pupil/quiz/OakQuizCheckBox/OakQuizCheckBox.js +58 -0
  184. package/dist/npm/es/components/owa/pupil/quiz/OakQuizCounter/OakQuizCounter.js +33 -0
  185. package/dist/npm/es/components/owa/pupil/quiz/OakQuizFeedback/OakQuizFeedback.js +31 -0
  186. package/dist/npm/es/components/owa/pupil/quiz/OakQuizHint/OakQuizHint.js +28 -0
  187. package/dist/npm/es/components/owa/pupil/quiz/OakQuizMatch/OakQuizMatch.js +121 -0
  188. package/dist/npm/es/components/owa/pupil/quiz/OakQuizOrder/OakQuizOrder.js +88 -0
  189. package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableHeader/OakQuizPrintableHeader.js +29 -0
  190. package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableSubHeader/OakQuizPrintableSubHeader.js +28 -0
  191. package/dist/npm/es/components/owa/pupil/quiz/OakQuizRadioButton/OakQuizRadioButton.js +78 -0
  192. package/dist/npm/es/components/owa/pupil/quiz/OakQuizResultItem/OakQuizResultItem.js +70 -0
  193. package/dist/npm/es/components/owa/pupil/quiz/OakQuizTextInput/OakQuizTextInput.js +28 -0
  194. package/dist/npm/es/components/owa/teacher/OakDownloadsAccordion/OakDownloadsAccordion.js +56 -0
  195. package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/OakInlineRegistrationBanner.js +62 -0
  196. package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/SurfingStudentSVG.js +15 -0
  197. package/dist/npm/es/components/owa/teacher/OakTeacherNotesInline/OakTeacherNotesInline.js +16 -0
  198. package/dist/npm/es/components/owa/teacher/OakTeacherNotesModal/OakTeacherNotesModal.js +72 -0
  199. package/dist/npm/es/components/owa/teacher/OakTertiaryOLNav/OakTertiaryOLNav.js +34 -0
  200. package/dist/npm/es/components/presentational/OakCarousel/OakCarousel.js +39 -0
  201. package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionControl.js +12 -0
  202. package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionIndicator.js +17 -0
  203. package/dist/npm/es/components/presentational/OakQuote/OakQuote.js +34 -0
  204. package/dist/npm/es/components/typography/OakHeading/OakHeading.js +33 -0
  205. package/dist/npm/es/components/typography/OakLI/OakLI.js +23 -0
  206. package/dist/npm/es/components/typography/OakOL/OakOL.js +22 -0
  207. package/dist/npm/es/components/typography/OakP/OakP.js +17 -0
  208. package/dist/npm/es/components/typography/OakSpan/OakSpan.js +18 -0
  209. package/dist/npm/es/components/typography/OakTypography/OakTypography.js +16 -0
  210. package/dist/npm/es/components/typography/OakUL/OakUL.js +19 -0
  211. package/dist/npm/es/components/unstyled/UnstyledChevronAccordion/UnstyledChevronAccordion.js +55 -0
  212. package/dist/npm/es/hooks/useBreakpoint.js +38 -0
  213. package/dist/npm/es/hooks/useIsScrolled.js +30 -0
  214. package/dist/npm/es/hooks/useMediaQuery.js +20 -0
  215. package/dist/npm/es/hooks/useMounted.js +12 -0
  216. package/dist/npm/es/image-map.js +205 -0
  217. package/dist/npm/es/index.js +196 -0
  218. package/dist/npm/es/styles/global/oak.styles.js +17 -0
  219. package/dist/npm/es/styles/global/reset.styles.js +11 -0
  220. package/dist/npm/es/styles/helpers/getFontSize.js +9 -0
  221. package/dist/npm/es/styles/helpers/getInternalPadding.js +15 -0
  222. package/dist/npm/es/styles/helpers/parseBorder.js +13 -0
  223. package/dist/npm/es/styles/helpers/parseBorderRadius.js +13 -0
  224. package/dist/npm/es/styles/helpers/parseBorderWidth.js +15 -0
  225. package/dist/npm/es/styles/helpers/parseColor.js +19 -0
  226. package/dist/npm/es/styles/helpers/parseColorFilter.js +19 -0
  227. package/dist/npm/es/styles/helpers/parseDropShadow.js +15 -0
  228. package/dist/npm/es/styles/helpers/parseOpacity.js +12 -0
  229. package/dist/npm/es/styles/helpers/parseSpacing.js +29 -0
  230. package/dist/npm/es/styles/helpers/parseTransitions.js +12 -0
  231. package/dist/npm/es/styles/helpers/parseTypography.js +36 -0
  232. package/dist/npm/es/styles/helpers/parseZIndex.js +13 -0
  233. package/dist/npm/es/styles/helpers/pxToRem.js +7 -0
  234. package/dist/npm/es/styles/helpers/truthy.js +13 -0
  235. package/dist/npm/es/styles/theme/borders.js +22 -0
  236. package/dist/npm/es/styles/theme/color.js +207 -0
  237. package/dist/npm/es/styles/theme/dark.theme.js +99 -0
  238. package/dist/npm/es/styles/theme/default.theme.js +99 -0
  239. package/dist/npm/es/styles/theme/dropShadow.js +13 -0
  240. package/dist/npm/es/styles/theme/opacity.js +8 -0
  241. package/dist/npm/es/styles/theme/spacing.js +48 -0
  242. package/dist/npm/es/styles/theme/transitions.js +6 -0
  243. package/dist/npm/es/styles/theme/typography.js +73 -0
  244. package/dist/npm/es/styles/theme/zIndex.js +17 -0
  245. package/dist/npm/es/styles/utils/borderStyle.js +27 -0
  246. package/dist/npm/es/styles/utils/colorFilterStyle.js +9 -0
  247. package/dist/npm/es/styles/utils/colorStyle.js +9 -0
  248. package/dist/npm/es/styles/utils/displayStyle.js +8 -0
  249. package/dist/npm/es/styles/utils/dropShadowStyle.js +9 -0
  250. package/dist/npm/es/styles/utils/flexStyle.js +9 -0
  251. package/dist/npm/es/styles/utils/listStyle.js +8 -0
  252. package/dist/npm/es/styles/utils/opacityStyle.js +9 -0
  253. package/dist/npm/es/styles/utils/positionStyle.js +9 -0
  254. package/dist/npm/es/styles/utils/responsiveStyle.js +69 -0
  255. package/dist/npm/es/styles/utils/scrollSnapStyle.js +11 -0
  256. package/dist/npm/es/styles/utils/sizeStyle.js +9 -0
  257. package/dist/npm/es/styles/utils/spacingStyle.js +25 -0
  258. package/dist/npm/es/styles/utils/transformStyle.js +8 -0
  259. package/dist/npm/es/styles/utils/transitionStyle.js +9 -0
  260. package/dist/npm/es/styles/utils/typographyStyle.js +9 -0
  261. package/dist/npm/es/styles/utils/zIndexStyle.js +9 -0
  262. package/dist/npm/es/svgs/button-border-bottom.js +6 -0
  263. package/dist/npm/es/svgs/button-border-left.js +6 -0
  264. package/dist/npm/es/svgs/button-border-right.js +6 -0
  265. package/dist/npm/es/svgs/button-border-top.js +6 -0
  266. package/dist/npm/es/svgs/header-underline.js +6 -0
  267. package/dist/npm/es/svgs/horizontal-rule.js +6 -0
  268. package/dist/npm/es/svgs/icon-background.js +6 -0
  269. package/dist/npm/es/svgs/scribble.js +11 -0
  270. package/dist/npm/es/svgs/underline-3.js +6 -0
  271. package/dist/npm/es/svgs/underline.js +6 -0
  272. package/dist/npm/es/test-helpers/colorConversion.js +14 -0
  273. package/dist/npm/es/test-helpers/mockIntersectionObserver.js +50 -0
  274. package/dist/npm/es/test-helpers/mockResizeObserver.js +25 -0
  275. package/dist/npm/es/types.d.ts +5249 -0
  276. package/package.json +28 -12
  277. package/dist/cjs/index.js +0 -15
  278. package/dist/cjs/index.js.map +0 -1
  279. package/dist/esm/index.js +0 -15
  280. package/dist/esm/index.js.map +0 -1
  281. /package/dist/{types.d.ts → npm/cjs/types.d.ts} +0 -0
@@ -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 };
@@ -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 };
@@ -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 };
@@ -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 { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
5
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
6
+ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
7
+ import { OakSvg } from '../../images-and-icons/OakSvg/OakSvg.js';
8
+ import { InternalButton } from '../InternalButton/InternalButton.js';
9
+ import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
10
+ import { OakLoadingSpinner } from '../../messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js';
11
+ import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
12
+ import { positionStyle } from '../../../styles/utils/positionStyle.js';
13
+ import { parseColor } from '../../../styles/helpers/parseColor.js';
14
+ import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
15
+
16
+ var StyledInternalButton = styled(InternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n"])), positionStyle, sizeStyle, function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n text-decoration: ", ";\n color: ", ";\n background: ", ";\n border-color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:active {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:disabled {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n "], ["\n &:hover {\n text-decoration: ", ";\n color: ", ";\n background: ", ";\n border-color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:active {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n &:disabled {\n background: ", ";\n border-color: ", ";\n color: ", ";\n [data-state=\"selected\"] {\n display: none;\n }\n }\n "])), props.$hoverUnderline ? "underline" : "none", parseColor(props.$hoverTextColor), parseColor(props.$hoverBackground), parseColor(props.$hoverBorderColor), parseColor(props.$defaultBackground), parseColor(props.$defaultBorderColor), parseColor(props.$defaultTextColor), parseColor(props.$disabledBackground), parseColor(props.$disabledBorderColor), parseColor(props.$disabledTextColor)); });
17
+ var StyledOakSvg = styled(OakSvg)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n bottom: -3px;\n left: 0px;\n position: absolute;\n height: 5px;\n color: ", ";\n"], ["\n bottom: -3px;\n left: 0px;\n position: absolute;\n height: 5px;\n color: ", ";\n"])), parseColor("border-decorative1"));
18
+ var StyledButtonWrapper = styled(OakBox)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n .grey-shadow:has(+ * + .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:hover),\n .yellow-shadow:has(+ .internal-button:hover:not(:focus-visible, :active)) {\n box-shadow: ", ";\n }\n .grey-shadow:has(+ * + .internal-button:hover) {\n box-shadow: none;\n }\n .grey-shadow:has(+ * + .internal-button:active) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:active) {\n box-shadow: ", ";\n }\n"], ["\n .grey-shadow:has(+ * + .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:focus-visible) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:hover),\n .yellow-shadow:has(+ .internal-button:hover:not(:focus-visible, :active)) {\n box-shadow: ", ";\n }\n .grey-shadow:has(+ * + .internal-button:hover) {\n box-shadow: none;\n }\n .grey-shadow:has(+ * + .internal-button:active) {\n box-shadow: ", ";\n }\n .yellow-shadow:has(+ .internal-button:active) {\n box-shadow: ", ";\n }\n"])), parseDropShadow("drop-shadow-centered-grey"), parseDropShadow("drop-shadow-centered-lemon"), function (props) { return parseDropShadow(props.$hoverShadow); }, parseDropShadow("drop-shadow-grey"), parseDropShadow("drop-shadow-lemon"));
19
+ /**
20
+ *
21
+ * A styled rectangular button, not intended to be used directly.
22
+ * Instead used by OakPrimaryButton and OakSecondaryButton.
23
+ *
24
+ * The following callbacks are available for tracking focus events:
25
+ *
26
+ * ### onClick
27
+ * `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
28
+
29
+ * ### onHovered
30
+ * `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
31
+ * called after a mouseEnter and mouseLeave event has happened
32
+ */
33
+ var InternalShadowRectButton = function (props) {
34
+ var _a = props.element, element = _a === void 0 ? "button" : _a, children = props.children, iconName = props.iconName, iconAriaHidden = props.iconAriaHidden, isTrailingIcon = props.isTrailingIcon, isLoading = props.isLoading, disabled = props.disabled, _b = props.width, width = _b === void 0 ? "max-content" : _b, _c = props.height, height = _c === void 0 ? "auto" : _c, maxWidth = props.maxWidth, innerWidth = props.innerWidth, defaultBackground = props.defaultBackground, defaultBorderColor = props.defaultBorderColor, defaultTextColor = props.defaultTextColor, disabledTextColor = props.disabledTextColor, hoverTextColor = props.hoverTextColor, hoverBackground = props.hoverBackground, hoverBorderColor = props.hoverBorderColor, hoverUnderline = props.hoverUnderline, disabledBackground = props.disabledBackground, disabledBorderColor = props.disabledBorderColor, className = props.className, _d = props.hoverShadow, hoverShadow = _d === void 0 ? "drop-shadow-lemon" : _d, _e = props.pv, pv = _e === void 0 ? "spacing-12" : _e, _f = props.ph, ph = _f === void 0 ? "spacing-16" : _f, pt = props.pt, pb = props.pb, pl = props.pl, pr = props.pr, _g = props.iconLayout, iconLayout = _g === void 0 ? "row" : _g, _h = props.iconGap, iconGap = _h === void 0 ? "spacing-8" : _h, iconOverride = props.iconOverride, _j = props.font, font = _j === void 0 ? "heading-7" : _j, _k = props.textAlign, textAlign = _k === void 0 ? "left" : _k, _l = props.loadingSpinnerSize, loadingSpinnerSize = _l === void 0 ? "spacing-24" : _l, _m = props.display, display = _m === void 0 ? "inline-block" : _m, selected = props.selected, rest = __rest(props, ["element", "children", "iconName", "iconAriaHidden", "isTrailingIcon", "isLoading", "disabled", "width", "height", "maxWidth", "innerWidth", "defaultBackground", "defaultBorderColor", "defaultTextColor", "disabledTextColor", "hoverTextColor", "hoverBackground", "hoverBorderColor", "hoverUnderline", "disabledBackground", "disabledBorderColor", "className", "hoverShadow", "pv", "ph", "pt", "pb", "pl", "pr", "iconLayout", "iconGap", "iconOverride", "font", "textAlign", "loadingSpinnerSize", "display", "selected"]);
35
+ var icon = iconOverride !== null && iconOverride !== void 0 ? iconOverride : (React.createElement(React.Fragment, null, iconName && (React.createElement(OakIcon, { iconName: iconName, "$width": "spacing-24", "$height": "spacing-24", "$colorFilter": props.disabled ? disabledTextColor : defaultTextColor, "aria-hidden": iconAriaHidden }))));
36
+ var loader = (React.createElement(OakBox, { "$width": loadingSpinnerSize, "$height": loadingSpinnerSize },
37
+ React.createElement(OakLoadingSpinner, { "$width": loadingSpinnerSize })));
38
+ var iconLogic = React.createElement(React.Fragment, null, isLoading && !disabled ? loader : icon);
39
+ return (React.createElement(StyledButtonWrapper, { className: className, "$position": "relative", "$width": width, "$height": height, "$maxWidth": maxWidth, "$hoverShadow": hoverShadow },
40
+ React.createElement(OakBox, { className: "grey-shadow", "$position": "absolute", "$borderRadius": "border-radius-s", "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
41
+ React.createElement(OakBox, { className: "yellow-shadow", "$position": "absolute", "$borderRadius": "border-radius-s", "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
42
+ React.createElement(StyledInternalButton, __assign({ element: element, className: "internal-button", "$ba": "border-solid-m", "$background": defaultBackground, "$borderColor": defaultBorderColor, "$color": defaultTextColor, "$pv": pv, "$ph": ph, "$pt": pt, "$pb": pb, "$pl": pl, "$pr": pr, "$borderRadius": "border-radius-s", "$position": "relative", disabled: disabled || isLoading, "$width": "100%", "$height": "100%", "$hoverTextColor": hoverTextColor, "$hoverBackground": hoverBackground, "$hoverBorderColor": hoverBorderColor, "$hoverUnderline": hoverUnderline, "$defaultTextColor": defaultTextColor, "$defaultBackground": defaultBackground, "$defaultBorderColor": defaultBorderColor, "$disabledTextColor": disabledTextColor, "$disabledBackground": disabledBackground, "$disabledBorderColor": disabledBorderColor, "$display": display }, rest),
43
+ React.createElement(OakFlex, { "$flexDirection": iconLayout, "$alignItems": "center", "$gap": iconGap, "$justifyContent": "center", "$width": innerWidth },
44
+ !isTrailingIcon && iconLogic,
45
+ selected ? (React.createElement(TextWithUnderline, { font: font }, children)) : (React.createElement(OakSpan, { "$font": font, "$textAlign": textAlign }, children)),
46
+ isTrailingIcon && iconLogic))));
47
+ };
48
+ var TextWithUnderline = function (_a) {
49
+ var textAlign = _a.textAlign, font = _a.font, children = _a.children;
50
+ return (React.createElement(OakBox, { "$position": "relative", "$textAlign": textAlign },
51
+ React.createElement(OakSpan, { "$font": font }, children),
52
+ React.createElement(StyledOakSvg, { name: "underline", "data-state": "selected", "data-testid": "selected-underline" })));
53
+ };
54
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
55
+
56
+ export { InternalShadowRectButton, StyledButtonWrapper };
@@ -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_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), function (props) { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n > :first-child:focus-visible .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n > :first-child:hover .shadow {\n box-shadow: ", ";\n }\n > :first-child:active .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n "], ["\n > :first-child:focus-visible .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n > :first-child:hover .shadow {\n box-shadow: ", ";\n }\n > :first-child:active .shadow {\n box-shadow:\n ", ",\n ", ";\n }\n "])), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), parseDropShadow(props.$hoverDropShadow /*"drop-shadow-lemon"*/), parseDropShadow("drop-shadow-lemon"), parseDropShadow("drop-shadow-grey")); }, function (props) { return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n > :first-child:disabled .icon-container {\n background: ", ";\n }\n > :first-child:hover .icon-container {\n background: ", ";\n }\n > :first-child:active .icon-container {\n background: ", ";\n }\n "], ["\n > :first-child:disabled .icon-container {\n background: ", ";\n }\n > :first-child:hover .icon-container {\n background: ", ";\n }\n > :first-child:active .icon-container {\n background: ", ";\n }\n "])), parseColor(props.$disabledIconBackground), parseColor(props.$hoverIconBackground), parseColor(props.$defaultIconBackground)); });
20
+ /**
21
+ *
22
+ * A styled button with round icons, not intended to be used directly.
23
+ * Instead used by OakTertiaryButton and OakHintButton.
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 InternalShadowRoundButton = 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, iconBackgroundSize = props.iconBackgroundSize, iconSize = props.iconSize, disabledIconBackground = props.disabledIconBackground, hoverIconColor = props.hoverIconColor, disabledTextColor = props.disabledTextColor, defaultIconColor = props.defaultIconColor, hoverIconBackground = props.hoverIconBackground, defaultIconBackground = props.defaultIconBackground, defaultIconBorderColor = props.defaultIconBorderColor, disabledIconBorderColor = props.disabledIconBorderColor, disabledIconColor = props.disabledIconColor, defaultTextColor = props.defaultTextColor, hoverTextColor = props.hoverTextColor, _c = props.hoverDropShadow, hoverDropShadow = _c === void 0 ? "drop-shadow-lemon" : _c, className = props.className, rest = __rest(props, ["element", "children", "iconName", "isTrailingIcon", "isLoading", "disabled", "width", "maxWidth", "iconBackgroundSize", "iconSize", "disabledIconBackground", "hoverIconColor", "disabledTextColor", "defaultIconColor", "hoverIconBackground", "defaultIconBackground", "defaultIconBorderColor", "disabledIconBorderColor", "disabledIconColor", "defaultTextColor", "hoverTextColor", "hoverDropShadow", "className"]);
36
+ var icon = iconName && (React.createElement(OakIcon, { iconName: iconName, "$width": iconSize, "$height": iconSize, "$colorFilter": props.disabled
37
+ ? disabledIconColor
38
+ : defaultIconColor
39
+ ? defaultIconColor
40
+ : null, "data-icon-for": "button" }));
41
+ var loader = (React.createElement(OakBox, { "$width": iconSize, "$height": iconSize },
42
+ React.createElement(OakLoadingSpinner, { "$width": iconSize, loaderColor: "bg-primary" })));
43
+ var iconBorderColor = disabled || isLoading ? disabledIconBorderColor : defaultIconBorderColor;
44
+ var iconLogic = (isLoading || icon) && (React.createElement(OakFlex, { className: "icon-container", "$background": props.defaultIconBackground, "$color": props.defaultTextColor, "$borderRadius": "border-radius-circle", "$position": "relative", "$width": iconBackgroundSize, "$height": iconBackgroundSize, "$alignItems": "center", "$justifyContent": "center", "$minWidth": iconBackgroundSize },
45
+ React.createElement(OakBox, { className: "shadow", "$position": "absolute", "$borderRadius": "border-radius-circle", "$borderColor": iconBorderColor, "$ba": iconBorderColor ? "border-solid-m" : undefined, "$width": "100%", "$height": "100%", "$top": "spacing-0" }),
46
+ isLoading && !disabled ? loader : icon));
47
+ return (React.createElement(StyledButtonWrapper, { className: className, "$position": "relative", "$width": width, "$maxWidth": maxWidth, "$disabledIconBackground": disabledIconBackground, "$hoverIconBackground": hoverIconBackground, "$defaultIconBackground": defaultIconBackground, "$hoverDropShadow": hoverDropShadow },
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", disabled: disabled || isLoading }),
49
+ React.createElement(OakFlex, { "$flexDirection": "row", "$alignItems": "center", "$gap": children ? "spacing-12" : "spacing-0", "$justifyContent": "center" },
50
+ !isTrailingIcon && iconLogic,
51
+ React.createElement(OakSpan, { "$font": "heading-7" }, children),
52
+ isTrailingIcon && iconLogic))));
53
+ };
54
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
55
+
56
+ export { InternalShadowRoundButton };