@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,24 @@
1
+ import React from 'react';
2
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
3
+ import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
4
+ import { OakFormInputWithLabels } from '../../owa/OakFormInputWithLabels/OakFormInputWithLabels.js';
5
+
6
+ var OakCaptionSearch = function (_a) {
7
+ var onSearch = _a.onSearch, hasError = _a.hasError, errorText = _a.errorText, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, defaultValue = _a.defaultValue;
8
+ var handleFormSubmit = function (event) {
9
+ // NB. we don't handle caption ID validation here to remain decoupled from the application logic
10
+ event.preventDefault();
11
+ // get the input value from the form
12
+ var form = event.target;
13
+ var input = form.querySelector('input[name="caption-id"]');
14
+ var captionIdString = input.value.trim();
15
+ if (onSearch) {
16
+ onSearch(captionIdString);
17
+ }
18
+ };
19
+ return (React.createElement(OakFlex, { as: "form", "$flexDirection": "column", "$color": "text-primary", "$background": "bg-primary", "$pa": "spacing-24", "$gap": "spacing-24", "$borderRadius": "border-radius-s", onSubmit: handleFormSubmit },
20
+ React.createElement(OakFormInputWithLabels, { label: "Caption ID", inputName: "caption-id", helperText: "Enter on or more IDs (separated by commas).", invalid: hasError, invalidText: errorText, disabled: isLoading, defaultValue: defaultValue, required: true }),
21
+ React.createElement(OakPrimaryButton, { type: "submit", iconName: "search", isTrailingIcon: true, isLoading: isLoading }, "Search")));
22
+ };
23
+
24
+ export { OakCaptionSearch };
@@ -0,0 +1,33 @@
1
+ function getTimeText(timestamp) {
2
+ var date = new Date(timestamp);
3
+ if (isNaN(date.getTime())) {
4
+ return "at an unknown time";
5
+ }
6
+ var now = Date.now();
7
+ var diff = now - date.getTime();
8
+ var seconds = Math.floor(diff / 1000);
9
+ if (seconds < 1) {
10
+ return "just now";
11
+ }
12
+ if (seconds < 60) {
13
+ return "".concat(seconds, " secs ago");
14
+ }
15
+ if (seconds < 3600) {
16
+ return "".concat(Math.floor(seconds / 60), " mins ago");
17
+ }
18
+ if (seconds < 86400) {
19
+ return "".concat(Math.floor(seconds / 3600), " hrs ago");
20
+ }
21
+ if (seconds < 604800) {
22
+ return "".concat(Math.floor(seconds / 86400), " days ago");
23
+ }
24
+ if (seconds < 2592000) {
25
+ return "".concat(Math.floor(seconds / 604800), " weeks ago");
26
+ }
27
+ if (seconds < 31536000) {
28
+ return "".concat(Math.floor(seconds / 2592000), " months ago");
29
+ }
30
+ return "".concat(Math.floor(seconds / 31536000), " years ago");
31
+ }
32
+
33
+ export { getTimeText };
@@ -0,0 +1,39 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import { responsiveStyle } from '../../../styles/utils/responsiveStyle.js';
5
+
6
+ var oakAspectRatioPercentage = {
7
+ "16:9": 56.25,
8
+ "3:2": 66.66,
9
+ "1:1": 100,
10
+ "2:3": 150,
11
+ "7:8": 114,
12
+ };
13
+ var parseRatioToPercentage = function (ratio) {
14
+ return ratio ? "".concat(oakAspectRatioPercentage[ratio], "%") : undefined;
15
+ };
16
+ var OakAspectRatioOuter = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n height: 0;\n position: relative;\n ", "\n"], ["\n width: 100%;\n height: 0;\n position: relative;\n ", "\n"])), responsiveStyle("padding-top", function (props) { return props.ratio; }, parseRatioToPercentage));
17
+ var OakAspectRatioInner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n position: absolute;\n right: 0;\n bottom: 0;\n left: 0;\n top: 0;\n"], ["\n display: flex;\n position: absolute;\n right: 0;\n bottom: 0;\n left: 0;\n top: 0;\n"])));
18
+ /**
19
+ *
20
+ * AspectRatio provides a container of fixed aspect ratio
21
+ *
22
+ * ⚠️ To be deprecated
23
+ * @deprecated
24
+ *
25
+ * ## Usage
26
+ * Use this component when you want to ensure a box has a certain aspect ratio.
27
+ * Wrap with component with <code>position: relative</code> and a width or min-width
28
+ * The 'ratio' prop is responsive, so you can pass an array e.g. <code>["3:2", "16:9"]</code>
29
+ * which will result in different aspect ratios on different screen widths.
30
+ * For an example usage, see the <code>CardImage</code> component.
31
+ */
32
+ var OakAspectRatio = function (props) {
33
+ var children = props.children, ratio = props.ratio, htmlAttrs = __rest(props, ["children", "ratio"]);
34
+ return (React.createElement(OakAspectRatioOuter, __assign({ ratio: ratio }, htmlAttrs),
35
+ React.createElement(OakAspectRatioInner, null, children)));
36
+ };
37
+ var templateObject_1, templateObject_2;
38
+
39
+ export { OakAspectRatio };
@@ -0,0 +1,38 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import { icons } from '../../../image-map.js';
4
+ import { OakImage } from '../OakImage/OakImage.js';
5
+
6
+ var oakIconNames = Object.keys(icons);
7
+ /**
8
+ * returns true if the given string is a valid `OakIconName`
9
+ */
10
+ function isValidIconName(iconName) {
11
+ return oakIconNames.includes(iconName);
12
+ }
13
+ /**
14
+ * returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
15
+ */
16
+ function generateOakIconURL(iconName) {
17
+ var urlPath = "https://".concat(process.env.NEXT_PUBLIC_OAK_ASSETS_HOST, "/").concat(process.env.NEXT_PUBLIC_OAK_ASSETS_PATH);
18
+ if (isValidIconName(iconName)) {
19
+ return "".concat(urlPath, "/").concat(icons[iconName]);
20
+ }
21
+ else if (iconName.includes("subject")) {
22
+ return "".concat(urlPath, "/").concat(icons["books"]);
23
+ }
24
+ else {
25
+ return "".concat(urlPath, "/").concat(icons["question-mark"]);
26
+ }
27
+ }
28
+ /**
29
+ * A wrapper around OakImage which uses the image-map.json file to map icon names to image paths.
30
+ */
31
+ var OakIcon = function (props) {
32
+ var iconName = props.iconName, alt = props.alt, iconWidth = props.iconWidth, iconHeight = props.iconHeight, _a = props.$width, $width = _a === void 0 ? iconWidth !== null && iconWidth !== void 0 ? iconWidth : "spacing-32" : _a, _b = props.$height, $height = _b === void 0 ? iconHeight !== null && iconHeight !== void 0 ? iconHeight : "spacing-32" : _b, _c = props.$minHeight, $minHeight = _c === void 0 ? $height : _c, _d = props.$minWidth, $minWidth = _d === void 0 ? $width : _d; props.imageProps; var rest = __rest(props, ["iconName", "alt", "iconWidth", "iconHeight", "$width", "$height", "$minHeight", "$minWidth", "imageProps"]);
33
+ return (React.createElement(OakImage, __assign({ src: generateOakIconURL(iconName), alt: alt !== null && alt !== void 0 ? alt : "", "$width": $width, "$height": $height, "$minHeight": $minHeight, "$minWidth": $minWidth, placeholder: "empty",
34
+ // Icons should not be optimised since the SVG is already as small as it can be and should be served directly
35
+ unoptimized: true }, rest)));
36
+ };
37
+
38
+ export { OakIcon, generateOakIconURL, isValidIconName, oakIconNames };
@@ -0,0 +1,51 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import Image from 'next/image';
4
+ import styled, { css } from 'styled-components';
5
+ import { useShowPlaceholder } from './useShowPlaceholder.js';
6
+ import { colorFilterStyle } from '../../../styles/utils/colorFilterStyle.js';
7
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
8
+ import { parseColor } from '../../../styles/helpers/parseColor.js';
9
+ import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
10
+
11
+ var oakPlaceholder = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHBhdGggZmlsbD0iIzIyMiIgZD0iTTI4Ljc3OSAxOS4xNzZhMjcuMTkxIDI3LjE5MSAwIDAgMC0zLjggMS42IDE2LjcgMTYuNyAwIDAgMC03LjEgOC40YzAgLjEtLjEuMi0uMS4zLS43IDIuNC0uNiAyIDEuMyAyLjMgMS45LjMgMSAuNSAxIDEuMy0uMSA4LjggNC4xIDE1LjEgMTEuNCAxOS42YTEuNSAxLjUgMCAwIDAgMS43LjJjNS43LTIuNiA5LjMtNyAxMC4zLTEzLjJhMSAxIDAgMCAxIDEtMWwzLS4yYy44IDAgMS4zLjIgMS4yIDEuMmExNy45IDE3LjkgMCAwIDEtMy4yIDkuMiAyMy43IDIzLjcgMCAwIDEtMTAuOSA5LjEgNS40MDEgNS40MDEgMCAwIDEtNC41LS4yIDI2LjI5OCAyNi4yOTggMCAwIDEtOC41LTYuNiAyNS45IDI1LjkgMCAwIDEtNi40LTE0LjRjMC0uNi0uMi0uNy0uOC0uOC0yLjUtLjQtMi41LS4xLTIuMy0yLjlhMTkuMyAxOS4zIDAgMCAxIDEwLjgtMTYuNiAzOC45OTkgMzguOTk5IDAgMCAxIDUuNy0yLjEgMi4xIDIuMSAwIDAgMCAuOS0xLjMgMTQuMSAxNC4xIDAgMCAxIDMuNS02LjNsLjMtLjNjMS45LTIgMi42LTIgNC4zLjJsLjQuNWMxLjEgMS4xIDEgMS41LS4xIDIuNmExMS45IDExLjkgMCAwIDAtMy4yIDQuNCAxNi45IDE2LjkgMCAwIDEgNy41IDIuM2M1LjcgMy41IDkuMiA4LjMgOS45IDE1IC4wMTYuOTAxLS4wMTcgMS44MDItLjEgMi43IDAgLjgtLjYgMS0xLjIgMS4yYTE2LjEgMTYuMSAwIDAgMS0xMS0uNyAxNy45MDEgMTcuOTAxIDAgMCAxLTEwLjktMTMuNiA5Ljc5NiA5Ljc5NiAwIDAgMS0uMS0xLjlabTE4LjEgMTIuMmMuNC01LjUtNi45LTEyLjYtMTMtMTIuMS41IDYuNSA3LjYgMTIuOCAxMyAxMi4xWiIgb3BhY2l0eT0iLjEiLz48L3N2Zz4=";
12
+ var clickStyles = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
13
+ /* onClick might be passed in the useClickableCard pattern */
14
+ return props.onClick && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n :hover {\n cursor: pointer;\n }\n "], ["\n :hover {\n cursor: pointer;\n }\n "])));
15
+ });
16
+ var placeholderStyles = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
17
+ return props.$showOakPlaceholder && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-image: url(", ");\n background-color: ", ";\n background-size: ", ";\n background-position: center;\n background-repeat: no-repeat;\n "], ["\n background-image: url(", ");\n background-color: ", ";\n background-size: ", ";\n background-position: center;\n background-repeat: no-repeat;\n "])), oakPlaceholder, parseColor("bg-decorative2-very-subdued"), parseSpacing("spacing-64"));
18
+ });
19
+ var StyledFillImage = styled(Image)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n ", "\n"])), colorFilterStyle, clickStyles, placeholderStyles, function (props) { return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n object-fit: ", ";\n "], ["\n object-fit: ", ";\n "])), props.$objectFit ? props.$objectFit : "contain"); });
20
+ var StyledResponsiveImage = styled(Image)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n width: 100%;\n height: auto;\n"], ["\n ", "\n ", "\n ", "\n width: 100%;\n height: auto;\n"])), colorFilterStyle, clickStyles, placeholderStyles);
21
+ /**
22
+ * A wrapper for NextJs's Image component.
23
+ *
24
+ * Use this for all image types as well as icons.
25
+ * Can accept remote urls provided they are whitelisted in next.config.js and relative urls for local images provided they begin with a "/".
26
+ * Set the width and height of the image through the `$width` and `$height` props when the aspect ratio is not known. This will letterbox the image to avoid stretching.
27
+ * Alternatively pass `width` and `height` props when the aspect ratio is known and use $minWidth to set the rendered width, avoiding letter-boxing.
28
+ * NB. for letterboxed images, $background controls the color of the letterbox not the image.
29
+ * `positionStyle` and `spacingStyle` props are also exposed for container.
30
+ * sizes is exposed for further optimisation read Next docs for more info.
31
+ *
32
+ */
33
+ var OakImage = function (_a) {
34
+ var props = __rest(_a, []);
35
+ var as = props.as, src = props.src, alt = props.alt, width = props.width, height = props.height, sizes = props.sizes, _b = props.$width, $width = _b === void 0 ? "100%" : _b, _c = props.$position, $position = _c === void 0 ? "relative" : _c, $colorFilter = props.$colorFilter, _d = props.placeholder, placeholder = _d === void 0 ? "oak" : _d, unoptimized = props.unoptimized, imageProps = props.imageProps, $objectFit = props.$objectFit, onLoad = props.onLoad, onError = props.onError, rest = __rest(props, ["as", "src", "alt", "width", "height", "sizes", "$width", "$position", "$colorFilter", "placeholder", "unoptimized", "imageProps", "$objectFit", "onLoad", "onError"]);
36
+ var finalPlaceholder = placeholder === "oak" ? undefined : placeholder;
37
+ var _e = useShowPlaceholder(), showPlaceholder = _e.showPlaceholder, handleComplete = _e.handleComplete, setImg = _e.setImg;
38
+ // We don't know the aspect ratio of the image, so we must use fill and letterbox it to avoid stretching
39
+ // Use $width and $height to set the width and height of the image container
40
+ if (!width || !height) {
41
+ return (React.createElement(OakBox, __assign({ as: "span", "$display": "block", "$position": $position, "$width": $width }, rest),
42
+ React.createElement(StyledFillImage, __assign({ ref: setImg, as: as !== null && as !== void 0 ? as : Image, src: src, alt: alt, sizes: sizes, fill: true, "$colorFilter": $colorFilter, placeholder: finalPlaceholder, "$showOakPlaceholder": placeholder === "oak" && showPlaceholder, unoptimized: unoptimized, onLoad: handleComplete(onLoad), onError: handleComplete(onError), "$objectFit": $objectFit }, imageProps))));
43
+ }
44
+ // When we know the aspect ratio, we can use Image's repsonsive layout
45
+ // Use $minWidth to set the width with auto height
46
+ return (React.createElement(OakBox, __assign({ as: "span", "$display": "block", "$maxWidth": "spacing-0", "$position": $position }, rest),
47
+ React.createElement(StyledResponsiveImage, __assign({ ref: setImg, as: as !== null && as !== void 0 ? as : Image, src: src, alt: alt, width: width, height: height, sizes: sizes, unoptimized: unoptimized, "$colorFilter": $colorFilter, placeholder: finalPlaceholder, "$showOakPlaceholder": placeholder === "oak" && showPlaceholder, onLoad: handleComplete(onLoad), onError: handleComplete(onError) }, imageProps))));
48
+ };
49
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
50
+
51
+ export { OakImage, oakPlaceholder, placeholderStyles };
@@ -0,0 +1,29 @@
1
+ import { __read } from 'tslib';
2
+ import { useState, useCallback } from 'react';
3
+
4
+ function useShowPlaceholder() {
5
+ // Default to false so that we don't show the placeholder if the image is already complete
6
+ var _a = __read(useState(false), 2), showPlaceholder = _a[0], setShowPlaceholder = _a[1];
7
+ var setImg = useCallback(function (img) {
8
+ // the `load` or `error` event may never be called if the image is coming from the cache
9
+ // so we need to check the `complete` property as well as listen to the `onLoad` and `onError` events
10
+ img && setShowPlaceholder(!img.complete);
11
+ }, []);
12
+ return {
13
+ showPlaceholder: showPlaceholder,
14
+ setImg: setImg,
15
+ /**
16
+ * Wraps the `onLoad` and `onError` events to set the placeholder state
17
+ */
18
+ handleComplete: function (originalHandler) {
19
+ return function (event) {
20
+ if (originalHandler) {
21
+ originalHandler(event);
22
+ }
23
+ setShowPlaceholder(false);
24
+ };
25
+ },
26
+ };
27
+ }
28
+
29
+ export { useShowPlaceholder };
@@ -0,0 +1,17 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
4
+ import { OakIcon } from '../OakIcon/OakIcon.js';
5
+ import { OakImage } from '../OakImage/OakImage.js';
6
+
7
+ /**
8
+ * A wrapper around `OakIcon` which applies a rounded background.
9
+ * Supports either an icon name or an image src
10
+ */
11
+ var OakRoundIcon = function (_a) {
12
+ var _b = _a.$background, $background = _b === void 0 ? "bg-decorative5-main" : _b, _c = _a.$borderRadius, $borderRadius = _c === void 0 ? "border-radius-circle" : _c, _d = _a.$width, $width = _d === void 0 ? "spacing-48" : _d, _e = _a.$height, $height = _e === void 0 ? "spacing-48" : _e, _f = _a.$pa, $pa = _f === void 0 ? "spacing-4" : _f, className = _a.className, rest = __rest(_a, ["$background", "$borderRadius", "$width", "$height", "$pa", "className"]);
13
+ var icon = rest.iconName ? (React.createElement(OakIcon, __assign({}, rest, { "$height": "100%", "$width": "100%" }))) : (React.createElement(OakImage, __assign({}, rest, { "$height": "100%", "$width": "100%" })));
14
+ return (React.createElement(OakBox, { className: className, "$background": $background, "$borderRadius": $borderRadius, "$width": $width, "$height": $height, "$pa": $pa }, icon));
15
+ };
16
+
17
+ export { OakRoundIcon };
@@ -0,0 +1,47 @@
1
+ import { __makeTemplateObject, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
5
+ import { Underline } from '../../../svgs/underline.js';
6
+ import { HorizontalRule } from '../../../svgs/horizontal-rule.js';
7
+ import { HeaderUnderline } from '../../../svgs/header-underline.js';
8
+ import { Underline3 } from '../../../svgs/underline-3.js';
9
+ import { ButtonBorderTop } from '../../../svgs/button-border-top.js';
10
+ import { ButtonBorderBottom } from '../../../svgs/button-border-bottom.js';
11
+ import { ButtonBorderLeft } from '../../../svgs/button-border-left.js';
12
+ import { ButtonBorderRight } from '../../../svgs/button-border-right.js';
13
+ import { IconBackground } from '../../../svgs/icon-background.js';
14
+ import { Scribble } from '../../../svgs/scribble.js';
15
+
16
+ /**
17
+ * Map of the svg names to the actual svg components
18
+ * Only components that are used in the OakSvg component should be added here
19
+ * Should be used only in cases where OakIcon can't be used and if this list grows much bigger in the future we should consider refactoring
20
+ */
21
+ var svgMap = {
22
+ "header-underline": HeaderUnderline,
23
+ underline: Underline,
24
+ "horizontal-rule": HorizontalRule,
25
+ "underline-3": Underline3,
26
+ "button-border-top": ButtonBorderTop,
27
+ "button-border-bottom": ButtonBorderBottom,
28
+ "button-border-left": ButtonBorderLeft,
29
+ "button-border-right": ButtonBorderRight,
30
+ "icon-background": IconBackground,
31
+ scribble: Scribble,
32
+ };
33
+ var StyledSvg = styled.svg(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n transition: all 0.3s ease;\n"], ["\n ", ";\n transition: all 0.3s ease;\n"])), oakBoxCss);
34
+ /**
35
+ * This is component used for rendering SVGs that don't belong to be rendered with OakIcon component
36
+ * ie. UI elements that are not icons/illustratons but are part of the design system (underline, etc)
37
+ */
38
+ var OakSvg = function (props) {
39
+ var getSvgByName = function (name) {
40
+ var SvgComponent = svgMap[name];
41
+ return React.createElement(SvgComponent, null);
42
+ };
43
+ return (React.createElement(StyledSvg, __assign({ "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%" }, props), getSvgByName(props.name)));
44
+ };
45
+ var templateObject_1;
46
+
47
+ export { OakSvg };
@@ -0,0 +1,36 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import useAccordionContext from './useAccordionContext.js';
5
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
6
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
7
+
8
+ var FlexWithReset = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font: inherit;\n color: inherit;\n border: none;\n background: none;\n appearance: none;\n outline: none;\n padding: 0;\n"], ["\n font: inherit;\n color: inherit;\n border: none;\n background: none;\n appearance: none;\n outline: none;\n padding: 0;\n"])));
9
+ /**
10
+ *
11
+ * Content which will appear and disappear
12
+ *
13
+ * Must appear as a sibling of InternalAccordionButton
14
+ *
15
+ */
16
+ var InternalAccordionContent = function (_a) {
17
+ var children = _a.children, onScroll = _a.onScroll, ref = _a.ref, rest = __rest(_a, ["children", "onScroll", "ref"]);
18
+ var isOpen = useAccordionContext().isOpen;
19
+ return (React.createElement(OakBox, __assign({ hidden: !isOpen, role: "region" }, rest, { onScroll: onScroll, ref: ref }), children));
20
+ };
21
+ /**
22
+ *
23
+ * User interface to toggle visibility of InternalAccordionContent
24
+ *
25
+ * Must appear as a sibling of InternalAccordionContent
26
+ *
27
+ */
28
+ var AccordionButton = function (props) {
29
+ var children = props.children, id = props.id, rest = __rest(props, ["children", "id"]);
30
+ var _a = useAccordionContext(), isOpen = _a.isOpen, setOpen = _a.setOpen;
31
+ return (React.createElement(FlexWithReset, __assign({ as: "button", type: "button", onClick: function () { return setOpen(!isOpen); }, "$flexGrow": 1, "aria-expanded": isOpen, id: id }, rest), children));
32
+ };
33
+ var InternalAccordionButton = styled(AccordionButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
34
+ var templateObject_1, templateObject_2;
35
+
36
+ export { InternalAccordionButton, InternalAccordionContent };
@@ -0,0 +1,24 @@
1
+ import { __read } from 'tslib';
2
+ import React, { createContext, useState } from 'react';
3
+
4
+ var accordionContext = createContext(null);
5
+ /**
6
+ *
7
+ * Decomposed component comprising InternalAccordionButton and InternalAccordionContent wrapped by InternalAccordionProvider
8
+ *
9
+ * - InternalAccordionButton will toggle InternalAccordionContent visibility
10
+ * - It is up to the user to arrange the InternalAccordionButton and InternalAccordionContent components in the desired order
11
+ *
12
+ */
13
+ var InternalAccordionProvider = function (_a) {
14
+ var children = _a.children, isInitialOpen = _a.isInitialOpen;
15
+ var _b = __read(useState(isInitialOpen), 2), isOpen = _b[0], setOpen = _b[1];
16
+ var accordionValue = {
17
+ isOpen: isOpen,
18
+ setOpen: setOpen,
19
+ isInitialOpen: false,
20
+ };
21
+ return (React.createElement(accordionContext.Provider, { value: accordionValue }, children));
22
+ };
23
+
24
+ export { InternalAccordionProvider, accordionContext, InternalAccordionProvider as default };
@@ -0,0 +1,12 @@
1
+ import { useContext } from 'react';
2
+ import { accordionContext } from './InternalAccordionProvider.js';
3
+
4
+ var useAccordionContext = function () {
5
+ var accordionValue = useContext(accordionContext);
6
+ if (!accordionValue) {
7
+ throw new Error("useAccordionContext() called outside of menu provider");
8
+ }
9
+ return accordionValue;
10
+ };
11
+
12
+ export { useAccordionContext as default };
@@ -0,0 +1,48 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React, { useRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { colorStyle } from '../../../styles/utils/colorStyle.js';
5
+ import { displayStyle } from '../../../styles/utils/displayStyle.js';
6
+ import { spacingStyle } from '../../../styles/utils/spacingStyle.js';
7
+ import { typographyStyle } from '../../../styles/utils/typographyStyle.js';
8
+ import { dropShadowStyle } from '../../../styles/utils/dropShadowStyle.js';
9
+ import { borderStyle } from '../../../styles/utils/borderStyle.js';
10
+
11
+ var internalButtonCss = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n text-align: left;\n font-family: unset;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n &:disabled {\n pointer-events: none;\n cursor: default;\n }\n"], ["\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n cursor: pointer;\n text-align: left;\n font-family: unset;\n outline: none;\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n &:disabled {\n pointer-events: none;\n cursor: default;\n }\n"])), typographyStyle, colorStyle, spacingStyle, displayStyle, borderStyle, dropShadowStyle);
12
+ var UnstyledInternalButton = function (props) {
13
+ var onClick = props.onClick, onHovered = props.onHovered, _a = props.element, Component = _a === void 0 ? "button" : _a, rest = __rest(props, ["onClick", "onHovered", "element"]);
14
+ var hoverStart = useRef(Date.now());
15
+ var handleClick = function (event) {
16
+ if (onClick) {
17
+ onClick(event);
18
+ }
19
+ };
20
+ var handleMouseEnter = function () {
21
+ hoverStart.current = Date.now();
22
+ };
23
+ var handleMouseLeave = function (event) {
24
+ var delta = Date.now() - hoverStart.current;
25
+ if (onHovered) {
26
+ onHovered(event, delta);
27
+ }
28
+ };
29
+ return (React.createElement(Component, __assign({}, rest, { onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave })));
30
+ };
31
+ /**
32
+ *
33
+ * An unstyled button to be used as a basis for all UI button components.
34
+ * The following callbacks are available for tracking focus events:
35
+ *
36
+ * ### onClick
37
+ * `onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;`
38
+
39
+ * ### onHovered
40
+ * `onHovered?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;`<br>
41
+ * called after a mouseEnter and mouseLeave event has happened
42
+ *
43
+ * NB. We must export a styled component for it to be inheritable
44
+ */
45
+ var InternalButton = styled(UnstyledInternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), internalButtonCss);
46
+ var templateObject_1, templateObject_2;
47
+
48
+ export { InternalButton };
@@ -0,0 +1,19 @@
1
+ import { __assign, __makeTemplateObject } from 'tslib';
2
+ import styled from 'styled-components';
3
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
4
+
5
+ var internalCardDefaults = {
6
+ $pa: "spacing-24",
7
+ $flexDirection: "column",
8
+ $flexGrow: 1,
9
+ $position: "relative",
10
+ };
11
+ /**
12
+ *
13
+ * InternalCard extends OakFlex. It has all the props of OakFlex, but applies default styles for consistency.
14
+ *
15
+ */
16
+ var InternalCard = styled(OakFlex).attrs(function (props) { return (__assign(__assign({}, internalCardDefaults), props)); })(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
17
+ var templateObject_1;
18
+
19
+ export { InternalCard, internalCardDefaults };
@@ -0,0 +1,22 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import { InternalCard } from '../InternalCard/InternalCard.js';
5
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
6
+
7
+ /**
8
+ * The `backgroundElement` should be sized to fit the entire card
9
+ */
10
+ var StyledBackgroundBox = styled(OakBox)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n & > * {\n width: 100%;\n height: 100%;\n }\n"], ["\n & > * {\n width: 100%;\n height: 100%;\n }\n"])));
11
+ /**
12
+ * A flexed card with a presentational background element positioned behind the card contents.
13
+ */
14
+ var InternalCardWithBackgroundElement = function (_a) {
15
+ var backgroundElement = _a.backgroundElement, children = _a.children, props = __rest(_a, ["backgroundElement", "children"]);
16
+ return (React.createElement(InternalCard, __assign({}, props),
17
+ React.createElement(StyledBackgroundBox, { "$position": "absolute", "$inset": "spacing-0", "aria-hidden": true }, backgroundElement),
18
+ React.createElement(OakBox, { "$position": "relative" }, children)));
19
+ };
20
+ var templateObject_1;
21
+
22
+ export { InternalCardWithBackgroundElement };
@@ -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 };
@@ -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 };