@oaknational/oak-components 2.45.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/npm/cjs/index.js +7949 -0
  2. package/dist/{types.d.ts → npm/cjs/types.d.ts} +2 -16
  3. package/dist/npm/es/animation/usePrefersReducedMotion.js +16 -0
  4. package/dist/npm/es/components/OakGlobalStyle/OakGlobalStyle.js +14 -0
  5. package/dist/npm/es/components/OakThemeProvider/OakThemeProvider.js +14 -0
  6. package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js +105 -0
  7. package/dist/npm/es/components/buttons/OakCloseButton/OakCloseButton.js +18 -0
  8. package/dist/npm/es/components/buttons/OakLeftAlignedButton/OakLeftAlignedButton.js +57 -0
  9. package/dist/npm/es/components/buttons/OakPrimaryButton/OakPrimaryButton.js +23 -0
  10. package/dist/npm/es/components/buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js +23 -0
  11. package/dist/npm/es/components/buttons/OakSecondaryButton/OakSecondaryButton.js +23 -0
  12. package/dist/npm/es/components/buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js +20 -0
  13. package/dist/npm/es/components/buttons/OakSmallPrimaryButton/OakSmallPrimaryButton.js +23 -0
  14. package/dist/npm/es/components/buttons/OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js +23 -0
  15. package/dist/npm/es/components/buttons/OakSmallSecondaryButton/OakSmallSecondaryButton.js +23 -0
  16. package/dist/npm/es/components/buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js +20 -0
  17. package/dist/npm/es/components/buttons/OakSmallSecondaryToggleButton/OakSmallSecondaryToggleButton.js +37 -0
  18. package/dist/npm/es/components/buttons/OakSmallTertiaryInvertedButton/OakSmallTertiaryInvertedButton.js +23 -0
  19. package/dist/npm/es/components/buttons/OakTertiaryButton/OakTertiaryButton.js +14 -0
  20. package/dist/npm/es/components/buttons/OakTertiaryInvertedButton/OakTertiaryInvertedButton.js +14 -0
  21. package/dist/npm/es/components/cookies/OakCookieBanner/OakCookieBanner.js +62 -0
  22. package/dist/npm/es/components/cookies/OakCookieConsent/OakCookieConsent.js +17 -0
  23. package/dist/npm/es/components/cookies/OakCookieConsentProvider/OakCookieConsentProvider.js +103 -0
  24. package/dist/npm/es/components/cookies/OakCookieConsentProvider/cookieConsentReducer.js +32 -0
  25. package/dist/npm/es/components/cookies/OakCookieSettingsModal/OakCookieSettingsModal.js +91 -0
  26. package/dist/npm/es/components/form-elements/OakButtonAsRadioGroup/OakButtonAsRadioGroup.js +44 -0
  27. package/dist/npm/es/components/form-elements/OakCheckBox/OakCheckBox.js +71 -0
  28. package/dist/npm/es/components/form-elements/OakFieldError/OakFieldError.js +25 -0
  29. package/dist/npm/es/components/form-elements/OakFieldset/OakFieldset.js +12 -0
  30. package/dist/npm/es/components/form-elements/OakForm/OakForm.js +16 -0
  31. package/dist/npm/es/components/form-elements/OakFormInput/OakFormInput.js +26 -0
  32. package/dist/npm/es/components/form-elements/OakJauntyAngleLabel/OakJauntyAngleLabel.js +10 -0
  33. package/dist/npm/es/components/form-elements/OakLabel/OakLabel.js +15 -0
  34. package/dist/npm/es/components/form-elements/OakMultilineText/OakMultilineText.js +96 -0
  35. package/dist/npm/es/components/form-elements/OakRadioAsButton/OakRadioAsButton.js +96 -0
  36. package/dist/npm/es/components/form-elements/OakRadioButton/OakRadioButton.js +31 -0
  37. package/dist/npm/es/components/form-elements/OakRadioGroup/OakRadioGroup.js +44 -0
  38. package/dist/npm/es/components/form-elements/OakSearchFilterCheckBox/OakSearchFilterCheckBox.js +64 -0
  39. package/dist/npm/es/components/form-elements/OakSecondaryButtonAsRadio/OakSecondaryButtonAsRadio.js +25 -0
  40. package/dist/npm/es/components/form-elements/OakSelect/NativeLegend.js +9 -0
  41. package/dist/npm/es/components/form-elements/OakSelect/NativeOptGroup.js +7 -0
  42. package/dist/npm/es/components/form-elements/OakSelect/NativeOption.js +22 -0
  43. package/dist/npm/es/components/form-elements/OakSelect/NativeSelect.js +23 -0
  44. package/dist/npm/es/components/form-elements/OakSelect/OakOptGroup.js +12 -0
  45. package/dist/npm/es/components/form-elements/OakSelect/OakOption.js +12 -0
  46. package/dist/npm/es/components/form-elements/OakSelect/OakSelect.js +44 -0
  47. package/dist/npm/es/components/form-elements/OakTextArea/OakTextArea.js +23 -0
  48. package/dist/npm/es/components/form-elements/OakTextInput/OakTextInput.js +59 -0
  49. package/dist/npm/es/components/house-cat/OakCaptionCard/OakCaptionCard.js +81 -0
  50. package/dist/npm/es/components/house-cat/OakCaptionSearch/OakCaptionSearch.js +24 -0
  51. package/dist/npm/es/components/house-cat/utils.js +33 -0
  52. package/dist/npm/es/components/images-and-icons/OakAspectRatio/OakAspectRatio.js +39 -0
  53. package/dist/npm/es/components/images-and-icons/OakIcon/OakIcon.js +38 -0
  54. package/dist/npm/es/components/images-and-icons/OakImage/OakImage.js +51 -0
  55. package/dist/npm/es/components/images-and-icons/OakImage/useShowPlaceholder.js +29 -0
  56. package/dist/npm/es/components/images-and-icons/OakRoundIcon/OakRoundIcon.js +17 -0
  57. package/dist/npm/es/components/images-and-icons/OakSvg/OakSvg.js +47 -0
  58. package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordion.js +36 -0
  59. package/dist/npm/es/components/internal-components/InternalAccordion/InternalAccordionProvider.js +24 -0
  60. package/dist/npm/es/components/internal-components/InternalAccordion/useAccordionContext.js +12 -0
  61. package/dist/npm/es/components/internal-components/InternalButton/InternalButton.js +48 -0
  62. package/dist/npm/es/components/internal-components/InternalCard/InternalCard.js +19 -0
  63. package/dist/npm/es/components/internal-components/InternalCardWithBackgroundElement/InternalCardWithBackgroundElement.js +22 -0
  64. package/dist/npm/es/components/internal-components/InternalCheckBox/InternalCheckBox.js +82 -0
  65. package/dist/npm/es/components/internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js +16 -0
  66. package/dist/npm/es/components/internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js +24 -0
  67. package/dist/npm/es/components/internal-components/InternalChevronAccordion/InternalChevronAccordion.js +83 -0
  68. package/dist/npm/es/components/internal-components/InternalClientPortal/InternalClientPortal.js +13 -0
  69. package/dist/npm/es/components/internal-components/InternalDndContext/InternalDndContext.js +28 -0
  70. package/dist/npm/es/components/internal-components/InternalLink/InternalLink.js +54 -0
  71. package/dist/npm/es/components/internal-components/InternalModalTransition/InternalModalTransition.js +31 -0
  72. package/dist/npm/es/components/internal-components/InternalRadio/InternalRadio.js +82 -0
  73. package/dist/npm/es/components/internal-components/InternalRadioWrapper/InternalRadioWrapper.js +36 -0
  74. package/dist/npm/es/components/internal-components/InternalReviewAccordion/InternalReviewAccordion.js +38 -0
  75. package/dist/npm/es/components/internal-components/InternalShadowIconButton/InternalShadowIconButton.js +56 -0
  76. package/dist/npm/es/components/internal-components/InternalShadowRectButton/InternalShadowRectButton.js +56 -0
  77. package/dist/npm/es/components/internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js +56 -0
  78. package/dist/npm/es/components/internal-components/InternalSlideInFlex/InternalSlideInFlex.js +30 -0
  79. package/dist/npm/es/components/internal-components/InternalStyledSvg/InternalStyledSvg.js +14 -0
  80. package/dist/npm/es/components/internal-components/InternalTextInput/InternalTextInput.js +50 -0
  81. package/dist/npm/es/components/internal-components/InternalTooltip/InternalTooltip.js +36 -0
  82. package/dist/npm/es/components/layout-and-structure/OakAccordion/OakAccordion.js +39 -0
  83. package/dist/npm/es/components/layout-and-structure/OakBasicAccordion/OakBasicAccordion.js +10 -0
  84. package/dist/npm/es/components/layout-and-structure/OakBox/OakBox.js +41 -0
  85. package/dist/npm/es/components/layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js +23 -0
  86. package/dist/npm/es/components/layout-and-structure/OakFlex/OakFlex.js +18 -0
  87. package/dist/npm/es/components/layout-and-structure/OakGrid/OakGrid.js +16 -0
  88. package/dist/npm/es/components/layout-and-structure/OakGridArea/OakGridArea.js +51 -0
  89. package/dist/npm/es/components/layout-and-structure/OakMaxWidth/OakMaxWidth.js +23 -0
  90. package/dist/npm/es/components/messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js +38 -0
  91. package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js +22 -0
  92. package/dist/npm/es/components/messaging-and-feedback/OakHandDrawnFocusUnderline/SubHandDrawnFocusUnderline.js +17 -0
  93. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModal.js +41 -0
  94. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalBody.js +14 -0
  95. package/dist/npm/es/components/messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js +16 -0
  96. package/dist/npm/es/components/messaging-and-feedback/OakInlineBanner/OakInlineBanner.js +129 -0
  97. package/dist/npm/es/components/messaging-and-feedback/OakKbd/OakKbd.js +12 -0
  98. package/dist/npm/es/components/messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js +34 -0
  99. package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenter.js +106 -0
  100. package/dist/npm/es/components/messaging-and-feedback/OakModalCenter/OakModalCenterBody.js +36 -0
  101. package/dist/npm/es/components/messaging-and-feedback/OakScreenReader/OakScreenReader.js +15 -0
  102. package/dist/npm/es/components/messaging-and-feedback/OakTagFunctional/OakTagFunctional.js +18 -0
  103. package/dist/npm/es/components/messaging-and-feedback/OakToast/OakToast.js +96 -0
  104. package/dist/npm/es/components/messaging-and-feedback/OakTooltip/OakTooltip.js +122 -0
  105. package/dist/npm/es/components/navigation/OakAnchorTarget/OakAnchorTarget.js +20 -0
  106. package/dist/npm/es/components/navigation/OakBreadcrumbs/OakBreadcrumbs.js +46 -0
  107. package/dist/npm/es/components/navigation/OakCard/OakCard.js +64 -0
  108. package/dist/npm/es/components/navigation/OakHoverLink/OakHoverLink.js +23 -0
  109. package/dist/npm/es/components/navigation/OakLink/OakLink.js +17 -0
  110. package/dist/npm/es/components/navigation/OakLink/config.js +18 -0
  111. package/dist/npm/es/components/navigation/OakPagination/OakPagination.js +106 -0
  112. package/dist/npm/es/components/navigation/OakPagination/utils.js +19 -0
  113. package/dist/npm/es/components/navigation/OakPrimaryNav/OakPrimaryNav.js +22 -0
  114. package/dist/npm/es/components/navigation/OakPrimaryNavItem/OakPrimaryNavItem.js +23 -0
  115. package/dist/npm/es/components/navigation/OakSecondaryLink/OakSecondaryLink.js +25 -0
  116. package/dist/npm/es/components/navigation/OakTabs/OakTabs.js +47 -0
  117. package/dist/npm/es/components/owa/OakBackLink/OakBackLink.js +28 -0
  118. package/dist/npm/es/components/owa/OakBulletList/OakBulletList.js +17 -0
  119. package/dist/npm/es/components/owa/OakCardWithHandDrawnBorder/OakCardWithHandDrawnBorder.js +17 -0
  120. package/dist/npm/es/components/owa/OakCloudinaryImage/OakCloudinaryImage.js +35 -0
  121. package/dist/npm/es/components/owa/OakCloudinaryImage/cloudinary.js +17 -0
  122. package/dist/npm/es/components/owa/OakCodeRenderer/OakCodeRenderer.js +135 -0
  123. package/dist/npm/es/components/owa/OakCopyLinkButton/OakCopyLinkButton.js +42 -0
  124. package/dist/npm/es/components/owa/OakDownloadCard/OakDownloadCard.js +72 -0
  125. package/dist/npm/es/components/owa/OakDownloadsJourneyChildSubjectTierSelector/OakDownloadsJourneyChildSubjectTierSelector.js +54 -0
  126. package/dist/npm/es/components/owa/OakDragAndDropInstructions/OakDragAndDropInstructions.js +41 -0
  127. package/dist/npm/es/components/owa/OakDraggable/OakDraggable.js +30 -0
  128. package/dist/npm/es/components/owa/OakDraggableFeedback/OakDraggableFeedback.js +13 -0
  129. package/dist/npm/es/components/owa/OakDroppable/OakDroppable.js +45 -0
  130. package/dist/npm/es/components/owa/OakFilterDrawer/OakFilterDrawer.js +43 -0
  131. package/dist/npm/es/components/owa/OakFormInputWithLabels/OakFormInputWithLabels.js +18 -0
  132. package/dist/npm/es/components/owa/OakHandDrawnCard/OakHandDrawnCard.js +17 -0
  133. package/dist/npm/es/components/owa/OakHandDrawnCardWithIcon/OakHandDrawnCardWithIcon.js +15 -0
  134. package/dist/npm/es/components/owa/OakHandDrawnHR/HandDrawnHRSvg.js +11 -0
  135. package/dist/npm/es/components/owa/OakHandDrawnHR/OakHandDrawnHR.js +22 -0
  136. package/dist/npm/es/components/owa/OakHeaderHero/OakHeaderHero.js +45 -0
  137. package/dist/npm/es/components/owa/OakHomepageTabButton/OakHomepageTabButton.js +35 -0
  138. package/dist/npm/es/components/owa/OakInfo/OakInfo.js +22 -0
  139. package/dist/npm/es/components/owa/OakInfoButton/OakInfoButton.js +20 -0
  140. package/dist/npm/es/components/owa/OakLessonInfoCard/OakLessonInfoCard.js +33 -0
  141. package/dist/npm/es/components/owa/OakLinkCard/OakLinkCard.js +42 -0
  142. package/dist/npm/es/components/owa/OakListItem/OakListItem.js +93 -0
  143. package/dist/npm/es/components/owa/OakMediaClip/OakMediaClip.js +90 -0
  144. package/dist/npm/es/components/owa/OakMediaClipList/OakMediaClipList.js +26 -0
  145. package/dist/npm/es/components/owa/OakMediaClipListAccordion/OakMediaClipListAccordion.js +29 -0
  146. package/dist/npm/es/components/owa/OakMediaClipStackListItem/OakMediaClipStackListItem.js +41 -0
  147. package/dist/npm/es/components/owa/OakOutlineAccordion/OakOutlineAccordion.js +21 -0
  148. package/dist/npm/es/components/owa/OakPromoTag/OakPromoTag.js +22 -0
  149. package/dist/npm/es/components/owa/OakRadioTile/OakRadioTile.js +40 -0
  150. package/dist/npm/es/components/owa/OakSaveCount/OakSaveCount.js +33 -0
  151. package/dist/npm/es/components/owa/OakScaleImageButton/OakScaleImageButton.js +19 -0
  152. package/dist/npm/es/components/owa/OakSideMenuNav/OakSideMenuNav.js +24 -0
  153. package/dist/npm/es/components/owa/OakSideMenuNavLink/OakSideMenuNavLink.js +48 -0
  154. package/dist/npm/es/components/owa/OakSignLanguageButton/OakSignLanguageButton.js +23 -0
  155. package/dist/npm/es/components/owa/OakSubjectIcon/OakSubjectIcon.js +20 -0
  156. package/dist/npm/es/components/owa/OakSubjectIconButton/OakSubjectIconButton.js +44 -0
  157. package/dist/npm/es/components/owa/OakTimer/OakTimer.js +26 -0
  158. package/dist/npm/es/components/owa/OakVideoTranscript/OakVideoTranscript.js +32 -0
  159. package/dist/npm/es/components/owa/pupil/OakUnitListItem/OakUnitListItem.js +63 -0
  160. package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItem/OakUnitListOptionalityItem.js +57 -0
  161. package/dist/npm/es/components/owa/pupil/OakUnitListOptionalityItemCard/OakUnitListOptionalityItemCard.js +36 -0
  162. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyContentGuidance/OakPupilJourneyContentGuidance.js +44 -0
  163. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyHeader/OakPupilJourneyHeader.js +29 -0
  164. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyLayout/OakPupilJourneyLayout.js +62 -0
  165. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyList/OakPupilJourneyList.js +46 -0
  166. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListCounter/OakPupilJourneyListCounter.js +12 -0
  167. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItem/OakPupilJourneyListItem.js +45 -0
  168. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyListItemSubheading/OakPupilJourneyListItemSubheading.js +20 -0
  169. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityButton/OakPupilJourneyOptionalityButton.js +35 -0
  170. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyOptionalityItem/OakPupilJourneyOptionalityItem.js +23 -0
  171. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyProgrammeOptions/OakPupilJourneyProgrammeOptions.js +27 -0
  172. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyUnitsFilter/OakPupilJourneyUnitsFilter.js +42 -0
  173. package/dist/npm/es/components/owa/pupil/browse/OakPupilJourneyYearButton/OakPupilJourneyYearButton.js +31 -0
  174. package/dist/npm/es/components/owa/pupil/lesson/OakLessonBottomNav/OakLessonBottomNav.js +34 -0
  175. package/dist/npm/es/components/owa/pupil/lesson/OakLessonLayout/OakLessonLayout.js +153 -0
  176. package/dist/npm/es/components/owa/pupil/lesson/OakLessonNavItem/OakLessonNavItem.js +167 -0
  177. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewIntroVideo/OakPupilLessonReviewIntroVideo.js +30 -0
  178. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewItem/OakPupilLessonReviewItem.js +106 -0
  179. package/dist/npm/es/components/owa/pupil/lesson/OakLessonReviewQuiz/OakPupilLessonReviewQuiz.js +56 -0
  180. package/dist/npm/es/components/owa/pupil/lesson/OakLessonTopNav/OakLessonTopNav.js +58 -0
  181. package/dist/npm/es/components/owa/pupil/lesson/OakLessonVideoTranscript/OakLessonVideoTranscript.js +27 -0
  182. package/dist/npm/es/components/owa/pupil/quiz/InternalDroppableHoldingPen/InternalDroppableHoldingPen.js +60 -0
  183. package/dist/npm/es/components/owa/pupil/quiz/OakHintButton/OakHintButton.js +27 -0
  184. package/dist/npm/es/components/owa/pupil/quiz/OakQuizCheckBox/OakQuizCheckBox.js +58 -0
  185. package/dist/npm/es/components/owa/pupil/quiz/OakQuizCounter/OakQuizCounter.js +33 -0
  186. package/dist/npm/es/components/owa/pupil/quiz/OakQuizFeedback/OakQuizFeedback.js +31 -0
  187. package/dist/npm/es/components/owa/pupil/quiz/OakQuizHint/OakQuizHint.js +28 -0
  188. package/dist/npm/es/components/owa/pupil/quiz/OakQuizMatch/OakQuizMatch.js +121 -0
  189. package/dist/npm/es/components/owa/pupil/quiz/OakQuizOrder/OakQuizOrder.js +88 -0
  190. package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableHeader/OakQuizPrintableHeader.js +29 -0
  191. package/dist/npm/es/components/owa/pupil/quiz/OakQuizPrintableSubHeader/OakQuizPrintableSubHeader.js +28 -0
  192. package/dist/npm/es/components/owa/pupil/quiz/OakQuizRadioButton/OakQuizRadioButton.js +78 -0
  193. package/dist/npm/es/components/owa/pupil/quiz/OakQuizResultItem/OakQuizResultItem.js +70 -0
  194. package/dist/npm/es/components/owa/pupil/quiz/OakQuizTextInput/OakQuizTextInput.js +28 -0
  195. package/dist/npm/es/components/owa/teacher/OakDownloadsAccordion/OakDownloadsAccordion.js +56 -0
  196. package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/OakInlineRegistrationBanner.js +62 -0
  197. package/dist/npm/es/components/owa/teacher/OakInlineRegistrationBanner/SurfingStudentSVG.js +15 -0
  198. package/dist/npm/es/components/owa/teacher/OakTeacherNotesInline/OakTeacherNotesInline.js +16 -0
  199. package/dist/npm/es/components/owa/teacher/OakTeacherNotesModal/OakTeacherNotesModal.js +72 -0
  200. package/dist/npm/es/components/owa/teacher/OakTertiaryOLNav/OakTertiaryOLNav.js +34 -0
  201. package/dist/npm/es/components/presentational/OakCarousel/OakCarousel.js +39 -0
  202. package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionControl.js +12 -0
  203. package/dist/npm/es/components/presentational/OakCarousel/SubCarouselPositionIndicator.js +17 -0
  204. package/dist/npm/es/components/presentational/OakQuote/OakQuote.js +34 -0
  205. package/dist/npm/es/components/typography/OakHeading/OakHeading.js +33 -0
  206. package/dist/npm/es/components/typography/OakLI/OakLI.js +23 -0
  207. package/dist/npm/es/components/typography/OakOL/OakOL.js +22 -0
  208. package/dist/npm/es/components/typography/OakP/OakP.js +17 -0
  209. package/dist/npm/es/components/typography/OakSpan/OakSpan.js +18 -0
  210. package/dist/npm/es/components/typography/OakTypography/OakTypography.js +16 -0
  211. package/dist/npm/es/components/typography/OakUL/OakUL.js +19 -0
  212. package/dist/npm/es/components/unstyled/UnstyledChevronAccordion/UnstyledChevronAccordion.js +55 -0
  213. package/dist/npm/es/hooks/useBreakpoint.js +38 -0
  214. package/dist/npm/es/hooks/useIsScrolled.js +30 -0
  215. package/dist/npm/es/hooks/useMediaQuery.js +20 -0
  216. package/dist/npm/es/hooks/useMounted.js +12 -0
  217. package/dist/npm/es/image-map.js +205 -0
  218. package/dist/npm/es/index.js +196 -0
  219. package/dist/npm/es/styles/global/oak.styles.js +17 -0
  220. package/dist/npm/es/styles/global/reset.styles.js +11 -0
  221. package/dist/npm/es/styles/helpers/getFontSize.js +9 -0
  222. package/dist/npm/es/styles/helpers/getInternalPadding.js +15 -0
  223. package/dist/npm/es/styles/helpers/parseBorder.js +13 -0
  224. package/dist/npm/es/styles/helpers/parseBorderRadius.js +13 -0
  225. package/dist/npm/es/styles/helpers/parseBorderWidth.js +15 -0
  226. package/dist/npm/es/styles/helpers/parseColor.js +19 -0
  227. package/dist/npm/es/styles/helpers/parseColorFilter.js +19 -0
  228. package/dist/npm/es/styles/helpers/parseDropShadow.js +15 -0
  229. package/dist/npm/es/styles/helpers/parseOpacity.js +12 -0
  230. package/dist/npm/es/styles/helpers/parseSpacing.js +29 -0
  231. package/dist/npm/es/styles/helpers/parseTransitions.js +12 -0
  232. package/dist/npm/es/styles/helpers/parseTypography.js +36 -0
  233. package/dist/npm/es/styles/helpers/parseZIndex.js +13 -0
  234. package/dist/npm/es/styles/helpers/pxToRem.js +7 -0
  235. package/dist/npm/es/styles/helpers/truthy.js +13 -0
  236. package/dist/npm/es/styles/theme/borders.js +22 -0
  237. package/dist/npm/es/styles/theme/color.js +207 -0
  238. package/dist/npm/es/styles/theme/dark.theme.js +99 -0
  239. package/dist/npm/es/styles/theme/default.theme.js +99 -0
  240. package/dist/npm/es/styles/theme/dropShadow.js +13 -0
  241. package/dist/npm/es/styles/theme/opacity.js +8 -0
  242. package/dist/npm/es/styles/theme/spacing.js +48 -0
  243. package/dist/npm/es/styles/theme/transitions.js +6 -0
  244. package/dist/npm/es/styles/theme/typography.js +73 -0
  245. package/dist/npm/es/styles/theme/zIndex.js +17 -0
  246. package/dist/npm/es/styles/utils/borderStyle.js +27 -0
  247. package/dist/npm/es/styles/utils/colorFilterStyle.js +9 -0
  248. package/dist/npm/es/styles/utils/colorStyle.js +9 -0
  249. package/dist/npm/es/styles/utils/displayStyle.js +8 -0
  250. package/dist/npm/es/styles/utils/dropShadowStyle.js +9 -0
  251. package/dist/npm/es/styles/utils/flexStyle.js +9 -0
  252. package/dist/npm/es/styles/utils/listStyle.js +8 -0
  253. package/dist/npm/es/styles/utils/opacityStyle.js +9 -0
  254. package/dist/npm/es/styles/utils/positionStyle.js +9 -0
  255. package/dist/npm/es/styles/utils/responsiveStyle.js +69 -0
  256. package/dist/npm/es/styles/utils/scrollSnapStyle.js +11 -0
  257. package/dist/npm/es/styles/utils/sizeStyle.js +9 -0
  258. package/dist/npm/es/styles/utils/spacingStyle.js +25 -0
  259. package/dist/npm/es/styles/utils/transformStyle.js +8 -0
  260. package/dist/npm/es/styles/utils/transitionStyle.js +9 -0
  261. package/dist/npm/es/styles/utils/typographyStyle.js +9 -0
  262. package/dist/npm/es/styles/utils/zIndexStyle.js +9 -0
  263. package/dist/npm/es/svgs/button-border-bottom.js +6 -0
  264. package/dist/npm/es/svgs/button-border-left.js +6 -0
  265. package/dist/npm/es/svgs/button-border-right.js +6 -0
  266. package/dist/npm/es/svgs/button-border-top.js +6 -0
  267. package/dist/npm/es/svgs/header-underline.js +6 -0
  268. package/dist/npm/es/svgs/horizontal-rule.js +6 -0
  269. package/dist/npm/es/svgs/icon-background.js +6 -0
  270. package/dist/npm/es/svgs/scribble.js +11 -0
  271. package/dist/npm/es/svgs/underline-3.js +6 -0
  272. package/dist/npm/es/svgs/underline.js +6 -0
  273. package/dist/npm/es/test-helpers/colorConversion.js +14 -0
  274. package/dist/npm/es/test-helpers/mockIntersectionObserver.js +50 -0
  275. package/dist/npm/es/test-helpers/mockResizeObserver.js +25 -0
  276. package/dist/npm/es/types.d.ts +5249 -0
  277. package/package.json +28 -12
  278. package/dist/cjs/index.js +0 -15
  279. package/dist/cjs/index.js.map +0 -1
  280. package/dist/esm/index.js +0 -15
  281. package/dist/esm/index.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
3
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
4
+ import '../../typography/OakHeading/OakHeading.js';
5
+ import '../../typography/OakLI/OakLI.js';
6
+ import '../../typography/OakOL/OakOL.js';
7
+ import '../../typography/OakP/OakP.js';
8
+ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
9
+ import '../../typography/OakTypography/OakTypography.js';
10
+ import '../../typography/OakUL/OakUL.js';
11
+ import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
12
+ import { OakSecondaryButton } from '../../buttons/OakSecondaryButton/OakSecondaryButton.js';
13
+ import { OakLink } from '../../navigation/OakLink/OakLink.js';
14
+
15
+ /**
16
+ * A banner presenting the user with options to accept or reject cookies.
17
+ */
18
+ var OakCookieBanner = function (_a) {
19
+ var state = _a.state, innerMaxWidth = _a.innerMaxWidth, onOpenSettings = _a.onOpenSettings, onHide = _a.onHide, onAccept = _a.onAccept, onReject = _a.onReject, _b = _a.isFixed, isFixed = _b === void 0 ? false : _b, zIndex = _a.zIndex;
20
+ var finalZIndex = (function () {
21
+ if (typeof zIndex === "number") {
22
+ return zIndex;
23
+ }
24
+ if (isFixed) {
25
+ return "banner";
26
+ }
27
+ })();
28
+ return (React.createElement(OakBox, { "$background": "bg-neutral", "$bt": "border-solid-s", "$borderColor": "border-neutral", "$position": isFixed ? "fixed" : undefined, "$bottom": isFixed ? "spacing-0" : undefined, "$right": isFixed ? "spacing-0" : undefined, "$left": isFixed ? "spacing-0" : undefined, "$zIndex": finalZIndex, "$color": "text-primary", "data-testid": "cookie-banner" },
29
+ React.createElement(OakBox, { "$maxWidth": innerMaxWidth, "$mh": "auto" },
30
+ React.createElement(OakFlex, { "$alignItems": ["flex-start", "flex-start", "center"], "$flexDirection": ["column", "column", "row"], "$mh": ["spacing-16", "spacing-24", "spacing-56"], "$pv": "spacing-24", "$gap": ["spacing-24", "spacing-24", "spacing-32"] }, (function () {
31
+ switch (state) {
32
+ case "accepted":
33
+ case "rejected":
34
+ return (React.createElement(React.Fragment, null,
35
+ React.createElement(OakBox, { "$font": ["body-3", "body-2", "heading-light-7"] },
36
+ "You've",
37
+ " ",
38
+ React.createElement(OakSpan, { as: "strong", "$font": ["body-3-bold", "body-2-bold", "heading-7"] }, state),
39
+ " ",
40
+ "additional cookies. You can",
41
+ " ",
42
+ React.createElement(OakLink, { variant: "secondary", element: "button", onClick: onOpenSettings }, "change your cookie settings"),
43
+ " ",
44
+ "at any time."),
45
+ React.createElement(OakFlex, { "$justifyContent": "flex-end", "$flexGrow": 1 },
46
+ React.createElement(OakSecondaryButton, { onClick: onHide }, "Hide this message"))));
47
+ default:
48
+ return (React.createElement(React.Fragment, null,
49
+ React.createElement(OakBox, { "$font": ["body-3", "body-2"] },
50
+ React.createElement(OakSpan, { as: "strong", "$font": ["body-3-bold", "body-2-bold"] }, "This site uses cookies to store information on your computer."),
51
+ " ",
52
+ "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."),
53
+ React.createElement(OakFlex, { "$gap": ["spacing-12", "spacing-32"], "$justifyContent": "flex-end", "$flexDirection": ["column", "row"], "$flexWrap": ["wrap", "wrap", "nowrap"], "$flexGrow": 1 },
54
+ React.createElement(OakFlex, { "$whiteSpace": "nowrap", "$alignItems": "center" },
55
+ React.createElement(OakLink, { variant: "secondary", "$font": "heading-7", element: "button", type: "button", onClick: onReject, "data-testid": "cookie-banner-reject" }, "Reject non-essential cookies")),
56
+ React.createElement(OakSecondaryButton, { onClick: onOpenSettings }, "Cookie settings"),
57
+ React.createElement(OakPrimaryButton, { onClick: onAccept, "data-testid": "cookie-banner-accept" }, "Accept all cookies"))));
58
+ }
59
+ })()))));
60
+ };
61
+
62
+ export { OakCookieBanner };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { OakCookieSettingsModal } from '../OakCookieSettingsModal/OakCookieSettingsModal.js';
3
+ import { useInternalCookieConsent } from '../OakCookieConsentProvider/OakCookieConsentProvider.js';
4
+ import { OakCookieBanner } from '../OakCookieBanner/OakCookieBanner.js';
5
+
6
+ /**
7
+ * Connects `OakCookieBanner` and `OakCookieSettingsModal` to `OakCookieConsentProvider`.
8
+ */
9
+ var OakCookieConsent = function (_a) {
10
+ var policyURL = _a.policyURL, isFixed = _a.isFixed, innerMaxWidth = _a.innerMaxWidth, zIndex = _a.zIndex;
11
+ var _b = useInternalCookieConsent(), policyConsents = _b.policyConsents, acceptModalConsents = _b.acceptModalConsents, rejectModalConsents = _b.rejectModalConsents, confirmModalConsents = _b.confirmModalConsents, hideBanner = _b.hideBanner, openSettings = _b.openSettings, closeSettings = _b.closeSettings, isSettingsModalOpen = _b.isSettingsModalOpen, acceptBannerConsents = _b.acceptBannerConsents, rejectBannerConsents = _b.rejectBannerConsents, bannerState = _b.bannerState;
12
+ return (React.createElement(React.Fragment, null,
13
+ bannerState !== "hidden" && (React.createElement(OakCookieBanner, { onHide: hideBanner, onAccept: acceptBannerConsents, onReject: rejectBannerConsents, onOpenSettings: openSettings, state: bannerState, isFixed: isFixed, innerMaxWidth: innerMaxWidth, zIndex: zIndex })),
14
+ React.createElement(OakCookieSettingsModal, { policyURL: policyURL, policyConsents: policyConsents, isOpen: isSettingsModalOpen, onClose: closeSettings, onReject: rejectModalConsents, onConfirm: confirmModalConsents, onAccept: acceptModalConsents, zIndex: zIndex })));
15
+ };
16
+
17
+ export { OakCookieConsent };
@@ -0,0 +1,103 @@
1
+ import { __read } from 'tslib';
2
+ import React, { createContext, useReducer, useCallback, useContext } from 'react';
3
+ import { cookieConsentReducer, getInitialState } from './cookieConsentReducer.js';
4
+
5
+ function getDefaultContextState() {
6
+ return {
7
+ isSettingsModalOpen: false,
8
+ policyConsents: [],
9
+ showBanner: function () { },
10
+ hideBanner: function () { },
11
+ openSettings: function () { },
12
+ closeSettings: function () { },
13
+ rejectModalConsents: function () { },
14
+ confirmModalConsents: function () { },
15
+ acceptModalConsents: function () { },
16
+ rejectBannerConsents: function () { },
17
+ acceptBannerConsents: function () { },
18
+ bannerState: "initial",
19
+ };
20
+ }
21
+ var OakCookieConsentContext = createContext(getDefaultContextState());
22
+ /**
23
+ * Internal hook for consuming the OakCookieConsentContext.
24
+ *
25
+ * This should not be exported from the package.
26
+ */
27
+ function useInternalCookieConsent() {
28
+ return useContext(OakCookieConsentContext);
29
+ }
30
+ /**
31
+ * Enables opening of the cookie settings modal and showing the cookie consent banner.
32
+ */
33
+ function useCookieConsent() {
34
+ var _a = useContext(OakCookieConsentContext), showBanner = _a.showBanner, openSettings = _a.openSettings;
35
+ return { showBanner: showBanner, openSettings: openSettings };
36
+ }
37
+ /**
38
+ * Provides a context through which the cookie consent UI can be configured and controlled
39
+ *
40
+ * Intended to be used with `OakCookieConsent`
41
+ */
42
+ var OakCookieConsentProvider = function (_a) {
43
+ var children = _a.children, policyConsents = _a.policyConsents, onConsentChange = _a.onConsentChange;
44
+ var _b = __read(useReducer(cookieConsentReducer, null, getInitialState), 2), cookieConsentState = _b[0], dispatch = _b[1];
45
+ var closeSettings = useCallback(function () { return dispatch({ type: "closeModal" }); }, []);
46
+ var acceptConsents = useCallback(function () {
47
+ onConsentChange(policyConsents.map(function (_a) {
48
+ var policyId = _a.policyId;
49
+ return ({
50
+ policyId: policyId,
51
+ consentState: "granted",
52
+ });
53
+ }));
54
+ }, [onConsentChange, policyConsents]);
55
+ var rejectConsents = useCallback(function () {
56
+ onConsentChange(policyConsents.map(function (_a) {
57
+ var policyId = _a.policyId, isStrictlyNecessary = _a.isStrictlyNecessary;
58
+ return ({
59
+ policyId: policyId,
60
+ consentState: isStrictlyNecessary ? "granted" : "denied",
61
+ });
62
+ }));
63
+ }, [onConsentChange, policyConsents]);
64
+ var hideBanner = useCallback(function () { return dispatch({ type: "hideBanner" }); }, []);
65
+ var showBanner = useCallback(function () { return dispatch({ type: "showBanner" }); }, []);
66
+ var openSettings = useCallback(function () { return dispatch({ type: "openModal" }); }, []);
67
+ var acceptBannerConsents = useCallback(function () {
68
+ acceptConsents();
69
+ dispatch({ type: "acceptBannerConsents" });
70
+ }, [acceptConsents]);
71
+ var rejectBannerConsents = useCallback(function () {
72
+ rejectConsents();
73
+ dispatch({ type: "rejectBannerConsents" });
74
+ }, [rejectConsents]);
75
+ var acceptModalConsents = useCallback(function () {
76
+ acceptConsents();
77
+ dispatch({ type: "acceptModalConsents" });
78
+ }, [acceptConsents, hideBanner]);
79
+ var rejectModalConsents = useCallback(function () {
80
+ rejectConsents();
81
+ dispatch({ type: "rejectModalConsents" });
82
+ }, [rejectConsents, hideBanner]);
83
+ var confirmModalConsents = useCallback(function (consents) {
84
+ onConsentChange(consents);
85
+ dispatch({ type: "confirmModalConsents" });
86
+ }, [onConsentChange, hideBanner]);
87
+ return (React.createElement(OakCookieConsentContext.Provider, { value: {
88
+ isSettingsModalOpen: cookieConsentState.isSettingsModalOpen,
89
+ bannerState: cookieConsentState.bannerState,
90
+ policyConsents: policyConsents,
91
+ showBanner: showBanner,
92
+ hideBanner: hideBanner,
93
+ openSettings: openSettings,
94
+ closeSettings: closeSettings,
95
+ confirmModalConsents: confirmModalConsents,
96
+ acceptBannerConsents: acceptBannerConsents,
97
+ rejectBannerConsents: rejectBannerConsents,
98
+ acceptModalConsents: acceptModalConsents,
99
+ rejectModalConsents: rejectModalConsents,
100
+ } }, children));
101
+ };
102
+
103
+ export { OakCookieConsentContext, OakCookieConsentProvider, getDefaultContextState, useCookieConsent, useInternalCookieConsent };
@@ -0,0 +1,32 @@
1
+ import { __assign } from 'tslib';
2
+
3
+ function cookieConsentReducer(currentState, action) {
4
+ switch (action.type) {
5
+ case "confirmModalConsents":
6
+ case "acceptModalConsents":
7
+ case "rejectModalConsents":
8
+ return __assign(__assign({}, currentState), { isSettingsModalOpen: false, bannerState: "hidden" });
9
+ case "acceptBannerConsents":
10
+ return __assign(__assign({}, currentState), { bannerState: "accepted" });
11
+ case "rejectBannerConsents":
12
+ return __assign(__assign({}, currentState), { bannerState: "rejected" });
13
+ case "openModal":
14
+ return __assign(__assign({}, currentState), { isSettingsModalOpen: true });
15
+ case "closeModal":
16
+ return __assign(__assign({}, currentState), { isSettingsModalOpen: false });
17
+ case "showBanner":
18
+ return __assign(__assign({}, currentState), { bannerState: "initial" });
19
+ case "hideBanner":
20
+ return __assign(__assign({}, currentState), { bannerState: "hidden" });
21
+ default:
22
+ return currentState;
23
+ }
24
+ }
25
+ function getInitialState() {
26
+ return {
27
+ isSettingsModalOpen: false,
28
+ bannerState: "hidden",
29
+ };
30
+ }
31
+
32
+ export { cookieConsentReducer, getInitialState };
@@ -0,0 +1,91 @@
1
+ import { __values } from 'tslib';
2
+ import React from 'react';
3
+ import { OakAccordion } from '../../layout-and-structure/OakAccordion/OakAccordion.js';
4
+ import { OakCheckBox } from '../../form-elements/OakCheckBox/OakCheckBox.js';
5
+ import { OakInformativeModal } from '../../messaging-and-feedback/OakInformativeModal/OakInformativeModal.js';
6
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
7
+ import { OakInformativeModalFooter } from '../../messaging-and-feedback/OakInformativeModal/OakInformativeModalFooter.js';
8
+ import { OakLink } from '../../navigation/OakLink/OakLink.js';
9
+ import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
10
+ import { OakSecondaryButton } from '../../buttons/OakSecondaryButton/OakSecondaryButton.js';
11
+ import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
12
+ import { OakP } from '../../typography/OakP/OakP.js';
13
+ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
14
+ import { OakUL } from '../../typography/OakUL/OakUL.js';
15
+
16
+ /**
17
+ * Modal for managing cookie consent settings.
18
+ */
19
+ var OakCookieSettingsModal = function (_a) {
20
+ var isOpen = _a.isOpen, onClose = _a.onClose, onReject = _a.onReject, onConfirm = _a.onConfirm, onAccept = _a.onAccept, policyURL = _a.policyURL, policyConsents = _a.policyConsents, zIndex = _a.zIndex;
21
+ var handleSubmit = function (event) {
22
+ var e_1, _a, e_2, _b;
23
+ event.preventDefault();
24
+ var formData = new FormData(event.currentTarget);
25
+ var newConsents = {};
26
+ try {
27
+ for (var policyConsents_1 = __values(policyConsents), policyConsents_1_1 = policyConsents_1.next(); !policyConsents_1_1.done; policyConsents_1_1 = policyConsents_1.next()) {
28
+ var _c = policyConsents_1_1.value, policyId = _c.policyId, isStrictlyNecessary = _c.isStrictlyNecessary;
29
+ newConsents[policyId] = {
30
+ policyId: policyId,
31
+ consentState: isStrictlyNecessary ? "granted" : "denied",
32
+ };
33
+ }
34
+ }
35
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
36
+ finally {
37
+ try {
38
+ if (policyConsents_1_1 && !policyConsents_1_1.done && (_a = policyConsents_1.return)) _a.call(policyConsents_1);
39
+ }
40
+ finally { if (e_1) throw e_1.error; }
41
+ }
42
+ try {
43
+ for (var _d = __values(formData.getAll("consent")), _e = _d.next(); !_e.done; _e = _d.next()) {
44
+ var policyId = _e.value;
45
+ newConsents[policyId.toString()] = {
46
+ policyId: policyId.toString(),
47
+ consentState: "granted",
48
+ };
49
+ }
50
+ }
51
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
52
+ finally {
53
+ try {
54
+ if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
55
+ }
56
+ finally { if (e_2) throw e_2.error; }
57
+ }
58
+ onConfirm(Object.values(newConsents));
59
+ };
60
+ return (React.createElement(OakInformativeModal, { isOpen: isOpen, isLeftHandSide: true, onClose: onClose, zIndex: zIndex, footerSlot: React.createElement(OakInformativeModalFooter, null,
61
+ React.createElement(OakSecondaryButton, { onClick: onReject, width: "100%" }, "Reject non-essential cookies"),
62
+ React.createElement(OakPrimaryButton, { type: "submit", form: "cookie-settings-form", width: "100%" }, "Confirm my choices")) },
63
+ React.createElement(OakBox, { "$pa": "spacing-20" },
64
+ React.createElement(OakHeading, { tag: "h2", "$font": "heading-5", "$mb": "spacing-16" }, "This site uses cookies to store information on your computer."),
65
+ React.createElement(OakP, { "$mb": "spacing-24" }, "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."),
66
+ React.createElement(OakP, { "$mb": "spacing-48" },
67
+ "For more information, view our",
68
+ " ",
69
+ React.createElement(OakLink, { href: policyURL, target: "_blank" }, "cookie policy"),
70
+ "."),
71
+ React.createElement(OakBox, { "$mb": "spacing-56" },
72
+ React.createElement(OakPrimaryButton, { onClick: onAccept, width: "spacing-180" }, "Allow all")),
73
+ React.createElement(OakBox, { "$ph": "spacing-8", as: "form", id: "cookie-settings-form", onSubmit: handleSubmit },
74
+ React.createElement(OakHeading, { tag: "h3", "$font": "heading-6", "$mb": "spacing-24" }, "Manage consent preferences"),
75
+ policyConsents.map(function (policy) {
76
+ return (React.createElement(OakAccordion, { key: policy.policyId, header: React.createElement(OakSpan, { id: "cookie-settings-".concat(policy.policyId, "-label") }, policy.policyLabel), headerTag: "h4", id: "cookies-settings-".concat(policy.policyId, "-accordion"), headerAfterSlot: React.createElement(OakCheckBox, { id: "cookies-settings-".concat(policy.policyId, "-checkbox"), name: "consent", displayValue: "", value: policy.policyId, defaultChecked: policy.isStrictlyNecessary ||
77
+ policy.consentState === "granted", disabled: policy.isStrictlyNecessary, "aria-labelledby": "cookie-settings-".concat(policy.policyId, "-label") }) },
78
+ React.createElement(OakP, { "$mb": "spacing-32" }, policy.policyDescription),
79
+ React.createElement(OakBox, { as: "dl", "$pl": "spacing-16" },
80
+ policy.policyParties.length > 0 && (React.createElement(React.Fragment, null,
81
+ React.createElement("dt", null, "Who do we share data with?"),
82
+ React.createElement(OakBox, { as: "dd", "$font": "body-3-bold", "$mb": "spacing-16" },
83
+ React.createElement(OakUL, { "$reset": true }, policy.policyParties.map(function (party, index, all) { return (React.createElement(OakBox, { as: "li", key: index, "$display": "inline" },
84
+ React.createElement(OakLink, { variant: "secondary", href: party.url, target: "_blank", rel: "external nofollow" }, party.name),
85
+ index < all.length - 1 && ", ")); }))))),
86
+ React.createElement("dt", null, "Does this policy need cookies to work?"),
87
+ React.createElement(OakBox, { as: "dd", "$font": "body-3-bold" }, "Yes."))));
88
+ })))));
89
+ };
90
+
91
+ export { OakCookieSettingsModal };
@@ -0,0 +1,44 @@
1
+ import { __rest, __read, __assign } from 'tslib';
2
+ import React, { createContext, useState } from 'react';
3
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
4
+ import { OakLabel } from '../OakLabel/OakLabel.js';
5
+
6
+ var RadioContext = createContext({
7
+ currentValue: "default",
8
+ name: "default",
9
+ });
10
+ /**
11
+ *
12
+ * A react context supporting a list of mutually exclusive options rendered as buttons.
13
+ *
14
+ * ## Usage
15
+ *
16
+ * the nested items should be OakSecondaryButtonAsRadio or implement the same logic.
17
+ * use the callback onChange to get the value of the clicked button.
18
+ *
19
+ */
20
+ var OakButtonAsRadioGroup = function (props) {
21
+ var name = props.name, children = props.children, label = props.label, ariaLabel = props.ariaLabel, ariaLabelledby = props.ariaLabelledby, onChange = props.onChange, _a = props.$font, $font = _a === void 0 ? "body-1-bold" : _a, _b = props.$gap, $gap = _b === void 0 ? "spacing-16" : _b, disabled = props.disabled, value = props.value, _c = props.defaultValue, defaultValue = _c === void 0 ? "" : _c, rest = __rest(props, ["name", "children", "label", "ariaLabel", "ariaLabelledby", "onChange", "$font", "$gap", "disabled", "value", "defaultValue"]);
22
+ var _d = __read(useState(defaultValue), 2), currentValue = _d[0], setCurrentValue = _d[1];
23
+ if (!label && !ariaLabel && !ariaLabelledby) {
24
+ throw new Error("OakButtonAsRadioGroup: At least one of label, ariaLabel or ariaLabelledby is required");
25
+ }
26
+ var handleValueUpdated = function (newValue) {
27
+ if (value === undefined) {
28
+ setCurrentValue(newValue);
29
+ }
30
+ if (onChange) {
31
+ onChange(newValue);
32
+ }
33
+ };
34
+ return (React.createElement(OakFlex, __assign({ role: "radiogroup", "$gap": $gap }, rest, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby }),
35
+ label && React.createElement(OakLabel, { "$font": $font }, label),
36
+ React.createElement(RadioContext.Provider, { value: {
37
+ currentValue: value !== null && value !== void 0 ? value : currentValue,
38
+ name: name,
39
+ disabled: disabled,
40
+ onValueUpdated: handleValueUpdated,
41
+ } }, children)));
42
+ };
43
+
44
+ export { OakButtonAsRadioGroup, RadioContext };
@@ -0,0 +1,71 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React, { useRef } from 'react';
3
+ import { InternalCheckBoxHoverFocus } from '../../internal-components/InternalCheckBox/InternalCheckBox.js';
4
+ import { InternalCheckBoxLabel } from '../../internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js';
5
+ import { InternalCheckBoxWrapper } from '../../internal-components/InternalCheckBoxWrapper/InternalCheckBoxWrapper.js';
6
+
7
+ /**
8
+ *
9
+ * Default checkbox which can be extended to create specialised checkboxes.
10
+ * - if provided, displayValue is used to display a different value to the value prop.
11
+ *
12
+ *
13
+ * ## Events
14
+ * The following callbacks are available for tracking focus events:
15
+ *
16
+ * ### onChange
17
+ * onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
18
+ *
19
+ * ### onFocus
20
+ * onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
21
+ *
22
+ * ### onBlur
23
+ * onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
24
+ *
25
+ * ### onHovered
26
+ * `onHovered?: (id, value, duration: number) => void;`<br>
27
+ * called after a mouseEnter and mouseLeave event has happened
28
+ *
29
+ *
30
+ */
31
+ var OakCheckBox = function (props) {
32
+ var id = props.id, value = props.value, _a = props.displayValue, displayValue = _a === void 0 ? value : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.iconPadding, iconPadding = _c === void 0 ? "spacing-0" : _c, _d = props.hoverBorderRadius, hoverBorderRadius = _d === void 0 ? "border-radius-xs" : _d, _e = props.checkboxSize, checkboxSize = _e === void 0 ? "spacing-24" : _e, _f = props.checkboxBorder, checkboxBorder = _f === void 0 ? "border-solid-m" : _f, _g = props.checkboxBorderRadius, checkboxBorderRadius = _g === void 0 ? "border-radius-xs" : _g, _h = props.defaultColor, defaultColor = _h === void 0 ? "text-primary" : _h,
33
+ /**
34
+ * The outer border color of the checkbox when unchecked.
35
+ */
36
+ _j = props.uncheckedBorderColor,
37
+ /**
38
+ * The outer border color of the checkbox when unchecked.
39
+ */
40
+ uncheckedBorderColor = _j === void 0 ? "border-neutral" : _j,
41
+ /**
42
+ * The outer border color of the checkbox when checked.
43
+ */
44
+ _k = props.checkedBorderColor,
45
+ /**
46
+ * The outer border color of the checkbox when checked.
47
+ */
48
+ checkedBorderColor = _k === void 0 ? "border-primary" : _k, _l = props.disabledColor, disabledColor = _l === void 0 ? "text-disabled" : _l, _m = props.labelGap, labelGap = _m === void 0 ? "spacing-16" : _m, _o = props.labelAlignItems, labelAlignItems = _o === void 0 ? "center" : _o, _p = props.checkedBackgroundFill, checkedBackgroundFill = _p === void 0 ? true : _p, checkedIcon = props.checkedIcon, dataTestId = props["data-testid"], rest = __rest(props, ["id", "value", "displayValue", "disabled", "defaultChecked", "checked", "onChange", "onFocus", "onBlur", "onHovered", "iconPadding", "hoverBorderRadius", "checkboxSize", "checkboxBorder", "checkboxBorderRadius", "defaultColor", "uncheckedBorderColor", "checkedBorderColor", "disabledColor", "labelGap", "labelAlignItems", "checkedBackgroundFill", "checkedIcon", "data-testid"]);
49
+ var hoverStart = useRef(Date.now());
50
+ var handleMouseEnter = function () {
51
+ hoverStart.current = Date.now();
52
+ };
53
+ var handleMouseLeave = function () {
54
+ var delta = Date.now() - hoverStart.current;
55
+ if (onHovered) {
56
+ onHovered(value, id, delta);
57
+ }
58
+ };
59
+ var currentColor = disabled ? disabledColor : defaultColor;
60
+ var currentCheckedBackgroundFill = disabled
61
+ ? disabledColor
62
+ : checkedBorderColor;
63
+ var currentCheckedBorderColor = disabled
64
+ ? disabledColor
65
+ : checkedBorderColor;
66
+ return (React.createElement(InternalCheckBoxLabel, { htmlFor: id, labelGap: labelGap, labelAlignItems: labelAlignItems, "$color": currentColor, disabled: disabled, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
67
+ React.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React.createElement(InternalCheckBoxHoverFocus, __assign({ id: id, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": checkboxBorder, "$borderRadius": checkboxBorderRadius, "$borderColor": defaultColor, "$checkedBackground": checkedBackgroundFill ? currentCheckedBackgroundFill : null, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": uncheckedBorderColor, "$hoverBorderRadius": hoverBorderRadius, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: disabled, "data-testid": dataTestId }, rest)), checkedIcon: checkedIcon, iconPadding: iconPadding }),
68
+ displayValue));
69
+ };
70
+
71
+ export { OakCheckBox };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
3
+ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
4
+ import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
5
+
6
+ /**
7
+ *
8
+ * OakFieldError renders a error message when passed children.
9
+ *
10
+ */
11
+ var OakFieldError = function (props) {
12
+ var children = props.children;
13
+ if (!children) {
14
+ /**
15
+ * Return early to avoid unwanted whitespace when there's no error
16
+ */
17
+ return null;
18
+ }
19
+ return (React.createElement(OakFlex, { "$alignItems": "center", "$flexDirection": "row" },
20
+ React.createElement(OakFlex, { "$alignSelf": "flex-start", "$mr": "spacing-16" },
21
+ React.createElement(OakIcon, { alt: "Error", iconName: "content-guidance", "$colorFilter": "icon-error" })),
22
+ React.createElement(OakSpan, { "$color": "text-error" }, children)));
23
+ };
24
+
25
+ export { OakFieldError };
@@ -0,0 +1,12 @@
1
+ import { __makeTemplateObject } from 'tslib';
2
+ import styled from 'styled-components';
3
+ import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
4
+
5
+ /**
6
+ * OakFieldset renders a custom `fieldset` component, removes default styling of fieldset.
7
+ color, opacity, margin, padding, border and typography styles can be passed in also.
8
+ */
9
+ var OakFieldset = styled.fieldset(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 0;\n margin: 0;\n padding: 0;\n ", ";\n"], ["\n border: 0;\n margin: 0;\n padding: 0;\n ", ";\n"])), oakBoxCss);
10
+ var templateObject_1;
11
+
12
+ export { OakFieldset };
@@ -0,0 +1,16 @@
1
+ import { __makeTemplateObject } from 'tslib';
2
+ import styled from 'styled-components';
3
+ import { oakBoxCss } from '../../layout-and-structure/OakBox/OakBox.js';
4
+
5
+ /**
6
+ *
7
+ * OakForm extends OakBox by taking the same props and style but applying them to a form element.
8
+ *
9
+ * ⚠️ To be deprecated
10
+ * Use `<OakBox as="form">` instead
11
+ * @deprecated Use `<OakBox as="form">` instead
12
+ */
13
+ var OakForm = styled.form(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), oakBoxCss);
14
+ var templateObject_1;
15
+
16
+ export { OakForm };
@@ -0,0 +1,26 @@
1
+ import { __makeTemplateObject, __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { parseColor } from '../../../styles/helpers/parseColor.js';
5
+ import { InternalTextInput } from '../../internal-components/InternalTextInput/InternalTextInput.js';
6
+ import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
7
+
8
+ var StyledTextInputWrapper = styled(OakFlex)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n cursor: text;\n }\n\n background: ", ";\n\n &:focus-within {\n border-color: ", ";\n background: ", ";\n }\n\n ", "\n\n ", "\n"], ["\n &:hover {\n cursor: text;\n }\n\n background: ", ";\n\n &:focus-within {\n border-color: ", ";\n background: ", ";\n }\n\n ", "\n\n ", "\n"])), function (props) { return parseColor(props.$background); }, function (props) { return parseColor(props.$focusBorderColor); }, function (props) { return parseColor(props.$focusBackgroundColor); }, function (props) {
9
+ return !props.$disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @media (hover: hover) {\n &:hover:not(:focus-within) {\n background: ", ";\n border-color: ", ";\n }\n }\n "], ["\n @media (hover: hover) {\n &:hover:not(:focus-within) {\n background: ", ";\n border-color: ", ";\n }\n }\n "])), parseColor(props.$hoverBackground), parseColor(props.$hoverBorderColor));
10
+ }, function (props) {
11
+ return props.$disabled && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n border-color: ", ";\n color: ", ";\n &:hover {\n cursor: not-allowed;\n }\n "], ["\n background: ", ";\n border-color: ", ";\n color: ", ";\n &:hover {\n cursor: not-allowed;\n }\n "])), parseColor(props.$disabledBackgroundColor), parseColor(props.$disabledBorderColor), parseColor(props.$disabledColor));
12
+ });
13
+ /**
14
+ * Default input which can be extended to create specialised inputs.
15
+ */
16
+ var OakFormInput = function (_a) {
17
+ var _b = _a.type, type = _b === void 0 ? "text" : _b, _c = _a.borderColor, borderColor = _c === void 0 ? "border-neutral-lighter" : _c, _d = _a.focusBorderColor, focusBorderColor = _d === void 0 ? "border-primary" : _d, _e = _a.focusBackgroundColor, focusBackgroundColor = _e === void 0 ? "bg-primary" : _e, _f = _a.background, background = _f === void 0 ? "bg-primary" : _f, _g = _a.hoverBackground, hoverBackground = _g === void 0 ? "bg-neutral" : _g, _h = _a.hoverBorderColor, hoverBorderColor = _h === void 0 ? "border-neutral" : _h, _j = _a.disabledBackgroundColor, disabledBackgroundColor = _j === void 0 ? "bg-neutral" : _j, _k = _a.color, color = _k === void 0 ? "text-primary" : _k, _l = _a.disabledBorderColor, disabledBorderColor = _l === void 0 ? "border-neutral-lighter" : _l, _m = _a.disabledColor, disabledColor = _m === void 0 ? "text-disabled" : _m, _o = _a.invalid, invalid = _o === void 0 ? false : _o, _p = _a.invalidBorderColor, invalidBorderColor = _p === void 0 ? "border-error" : _p, wrapperWidth = _a.wrapperWidth, wrapperMaxWidth = _a.wrapperMaxWidth, props = __rest(_a, ["type", "borderColor", "focusBorderColor", "focusBackgroundColor", "background", "hoverBackground", "hoverBorderColor", "disabledBackgroundColor", "color", "disabledBorderColor", "disabledColor", "invalid", "invalidBorderColor", "wrapperWidth", "wrapperMaxWidth"]);
18
+ return (React.createElement(StyledTextInputWrapper, { "$height": "fit-content", "$width": wrapperWidth, "$maxWidth": wrapperMaxWidth, "$borderRadius": "border-radius-m", "$ba": "border-solid-m", "$alignItems": "center", "$position": "relative", "$pa": "spacing-8", "$font": "body-2", "$color": color, "$borderColor": invalid ? invalidBorderColor : borderColor, "$background": background, "$hoverBackground": hoverBackground, "$hoverBorderColor": hoverBorderColor, "$disabledColor": disabledColor, "$disabledBackgroundColor": disabledBackgroundColor, "$disabledBorderColor": disabledBorderColor, "$focusBorderColor": focusBorderColor, "$focusBackgroundColor": focusBackgroundColor, "$disabled": !!props.disabled, onClick: function (event) {
19
+ var _a;
20
+ (_a = event.currentTarget.querySelector("input")) === null || _a === void 0 ? void 0 : _a.focus();
21
+ } },
22
+ React.createElement(InternalTextInput, __assign({ type: type, "$width": "100%", "aria-invalid": invalid }, props))));
23
+ };
24
+ var templateObject_1, templateObject_2, templateObject_3;
25
+
26
+ export { OakFormInput };
@@ -0,0 +1,10 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React from 'react';
3
+ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
4
+
5
+ var OakJauntyAngleLabel = function (props) {
6
+ var label = props.label, oakBoxProps = __rest(props, ["label"]);
7
+ return (React.createElement(OakBox, __assign({ "$borderRadius": "border-radius-m", "$ph": "spacing-8", "$pv": "spacing-4", "$font": ["heading-7", "heading-6"], "$transform": "rotate(-1.5deg)" }, oakBoxProps), label));
8
+ };
9
+
10
+ export { OakJauntyAngleLabel };
@@ -0,0 +1,15 @@
1
+ import { __makeTemplateObject } from 'tslib';
2
+ import styled from 'styled-components';
3
+ import { typographyStyle } from '../../../styles/utils/typographyStyle.js';
4
+ import { colorStyle } from '../../../styles/utils/colorStyle.js';
5
+
6
+ /**
7
+ * Label renders a `label` element, exposing all the typography props.
8
+ * ## Usage
9
+ * Use this component when you want to apply styles to a label, likely within
10
+ * a form.
11
+ */
12
+ var OakLabel = styled.label(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), typographyStyle, colorStyle);
13
+ var templateObject_1;
14
+
15
+ export { OakLabel };