@cruk/cruk-react-components 6.1.1 → 6.2.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 (170) hide show
  1. package/lib/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -1
  2. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
  3. package/lib/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -1
  4. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
  5. package/lib/node_modules/@babel/runtime/helpers/esm/typeof.js.map +1 -1
  6. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js +3 -3
  7. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -1
  8. package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -1
  9. package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -1
  10. package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js.map +1 -1
  11. package/lib/node_modules/focus-lock/dist/es2015/focusables.js.map +1 -1
  12. package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -1
  13. package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -1
  14. package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -1
  15. package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -1
  16. package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -1
  17. package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js.map +1 -1
  18. package/lib/node_modules/focus-lock/dist/es2015/utils/array.js.map +1 -1
  19. package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -1
  20. package/lib/node_modules/focus-lock/dist/es2015/utils/correctFocus.js.map +1 -1
  21. package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -1
  22. package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -1
  23. package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -1
  24. package/lib/node_modules/focus-lock/dist/es2015/utils/safe.js.map +1 -1
  25. package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -1
  26. package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -1
  27. package/lib/node_modules/react-clientside-effect/lib/index.es.js.map +1 -1
  28. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
  29. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
  30. package/lib/node_modules/react-intersection-observer/dist/index.js +1 -1
  31. package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -1
  32. package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
  33. package/lib/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -1
  34. package/lib/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -1
  35. package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
  36. package/lib/src/components/AddressLookup/index.js.map +1 -1
  37. package/lib/src/components/Box/styles.js.map +1 -1
  38. package/lib/src/components/Button/index.js.map +1 -1
  39. package/lib/src/components/Carousel/Dots.js.map +1 -1
  40. package/lib/src/components/Carousel/index.js.map +1 -1
  41. package/lib/src/components/Carousel/styles.js +1 -1
  42. package/lib/src/components/Carousel/styles.js.map +1 -1
  43. package/lib/src/components/Checkbox/styles.js +1 -1
  44. package/lib/src/components/Checkbox/styles.js.map +1 -1
  45. package/lib/src/components/Collapse/index.js.map +1 -1
  46. package/lib/src/components/Collapse/styles.d.ts +1 -1
  47. package/lib/src/components/DateField/index.js +1 -1
  48. package/lib/src/components/DateField/index.js.map +1 -1
  49. package/lib/src/components/DateField/styles.d.ts +6 -3
  50. package/lib/src/components/DateField/styles.js +1 -1
  51. package/lib/src/components/DateField/styles.js.map +1 -1
  52. package/lib/src/components/ErrorText/styles.d.ts +3 -3
  53. package/lib/src/components/Flex.js.map +1 -1
  54. package/lib/src/components/Fontface.js.map +1 -1
  55. package/lib/src/components/GlobalStyle.js +1 -1
  56. package/lib/src/components/GlobalStyle.js.map +1 -1
  57. package/lib/src/components/Header/index.js.map +1 -1
  58. package/lib/src/components/Heading/styles.js.map +1 -1
  59. package/lib/src/components/IconFa/index.js +1 -1
  60. package/lib/src/components/IconFa/index.js.map +1 -1
  61. package/lib/src/components/IconFa/styles.js +1 -1
  62. package/lib/src/components/IconFa/styles.js.map +1 -1
  63. package/lib/src/components/LabelWrapper/index.js +1 -1
  64. package/lib/src/components/LabelWrapper/index.js.map +1 -1
  65. package/lib/src/components/LabelWrapper/styles.d.ts +3 -0
  66. package/lib/src/components/LabelWrapper/styles.js +1 -1
  67. package/lib/src/components/LabelWrapper/styles.js.map +1 -1
  68. package/lib/src/components/LegendWrapper/index.js +1 -1
  69. package/lib/src/components/LegendWrapper/index.js.map +1 -1
  70. package/lib/src/components/LegendWrapper/styles.d.ts +3 -0
  71. package/lib/src/components/LegendWrapper/styles.js +1 -1
  72. package/lib/src/components/LegendWrapper/styles.js.map +1 -1
  73. package/lib/src/components/Link/styles.d.ts +3 -3
  74. package/lib/src/components/Modal/index.js.map +1 -1
  75. package/lib/src/components/Modal/styles.d.ts +1 -1
  76. package/lib/src/components/Pagination/index.js.map +1 -1
  77. package/lib/src/components/Pagination/styles.js.map +1 -1
  78. package/lib/src/components/PopOver/index.js.map +1 -1
  79. package/lib/src/components/ProgressBar/styles.js.map +1 -1
  80. package/lib/src/components/Radio/styles.js +1 -1
  81. package/lib/src/components/Radio/styles.js.map +1 -1
  82. package/lib/src/components/RadioConsent/index.js.map +1 -1
  83. package/lib/src/components/RadioConsent/styles.js +1 -1
  84. package/lib/src/components/RadioConsent/styles.js.map +1 -1
  85. package/lib/src/components/Select/styles.js +1 -1
  86. package/lib/src/components/Select/styles.js.map +1 -1
  87. package/lib/src/components/Step/styles.js +1 -1
  88. package/lib/src/components/Step/styles.js.map +1 -1
  89. package/lib/src/components/Text/styles.js.map +1 -1
  90. package/lib/src/components/TextAreaField/styles.js +1 -1
  91. package/lib/src/components/TextAreaField/styles.js.map +1 -1
  92. package/lib/src/components/TextField/styles.js +1 -1
  93. package/lib/src/components/TextField/styles.js.map +1 -1
  94. package/lib/src/components/Totaliser/styles.js +1 -1
  95. package/lib/src/components/Totaliser/styles.js.map +1 -1
  96. package/lib/src/hooks/useScrollPosition.js.map +1 -1
  97. package/lib/src/themes/cruk.js +1 -1
  98. package/lib/src/themes/cruk.js.map +1 -1
  99. package/lib/src/themes/rfl.js +1 -1
  100. package/lib/src/themes/rfl.js.map +1 -1
  101. package/lib/src/themes/su2c.js +1 -1
  102. package/lib/src/themes/su2c.js.map +1 -1
  103. package/lib/src/types.d.ts +3 -1
  104. package/lib/src/utils/Helper.js.map +1 -1
  105. package/lib/src/utils/debounce.js.map +1 -1
  106. package/package.json +18 -17
  107. package/lib/playwright/index.d.ts +0 -1
  108. package/lib/playwright/utils.d.ts +0 -19
  109. package/lib/src/components/AddressLookup/AddressLookup.spec.d.ts +0 -1
  110. package/lib/src/components/AddressLookup/AddressLookup.stories.d.ts +0 -24
  111. package/lib/src/components/Avatar/Avatar.spec.d.ts +0 -1
  112. package/lib/src/components/Avatar/Avatar.stories.d.ts +0 -20
  113. package/lib/src/components/Badge/Badge.spec.d.ts +0 -1
  114. package/lib/src/components/Badge/Badge.stories.d.ts +0 -17
  115. package/lib/src/components/Box/Box.spec.d.ts +0 -1
  116. package/lib/src/components/Box/Box.stories.d.ts +0 -14
  117. package/lib/src/components/Button/Button.spec.d.ts +0 -1
  118. package/lib/src/components/Button/Button.stories.d.ts +0 -23
  119. package/lib/src/components/Carousel/Carousel.spec.d.ts +0 -1
  120. package/lib/src/components/Carousel/Carousel.stories.d.ts +0 -14
  121. package/lib/src/components/Checkbox/Checkbox.spec.d.ts +0 -1
  122. package/lib/src/components/Checkbox/Checkbox.stories.d.ts +0 -19
  123. package/lib/src/components/Collapse/Collapse.spec.d.ts +0 -1
  124. package/lib/src/components/Collapse/Collapse.stories.d.ts +0 -18
  125. package/lib/src/components/DateField/DateField.spec.d.ts +0 -1
  126. package/lib/src/components/DateField/DateField.stories.d.ts +0 -27
  127. package/lib/src/components/ErrorText/ErrorText.spec.d.ts +0 -1
  128. package/lib/src/components/ErrorText/ErrorText.stories.d.ts +0 -13
  129. package/lib/src/components/Footer/Footer.spec.d.ts +0 -1
  130. package/lib/src/components/Footer/Footer.stories.d.ts +0 -12
  131. package/lib/src/components/Header/Header.spec.d.ts +0 -1
  132. package/lib/src/components/Header/Header.stories.d.ts +0 -19
  133. package/lib/src/components/Heading/Heading.spec.d.ts +0 -1
  134. package/lib/src/components/Heading/Heading.stories.d.ts +0 -19
  135. package/lib/src/components/IconFa/IconFa.spec.d.ts +0 -1
  136. package/lib/src/components/IconFa/IconFa.stories.d.ts +0 -13
  137. package/lib/src/components/InfoBox/InfoBox.spec.d.ts +0 -1
  138. package/lib/src/components/InfoBox/InfoBox.stories.d.ts +0 -20
  139. package/lib/src/components/LegendWrapper/LegendWrapper.spec.d.ts +0 -1
  140. package/lib/src/components/LegendWrapper/LegendWrapper.stories.d.ts +0 -17
  141. package/lib/src/components/Link/Link.spec.d.ts +0 -1
  142. package/lib/src/components/Link/Link.stories.d.ts +0 -24
  143. package/lib/src/components/Loader/Loader.spec.d.ts +0 -1
  144. package/lib/src/components/Loader/Loader.stories.d.ts +0 -11
  145. package/lib/src/components/Modal/Modal.spec.d.ts +0 -1
  146. package/lib/src/components/Modal/Modal.stories.d.ts +0 -11
  147. package/lib/src/components/Pagination/Pagination.spec.d.ts +0 -1
  148. package/lib/src/components/Pagination/Pagination.stories.d.ts +0 -18
  149. package/lib/src/components/PopOver/PopOver.spec.d.ts +0 -1
  150. package/lib/src/components/PopOver/Popover.stories.d.ts +0 -17
  151. package/lib/src/components/ProgressBar/ProgressBar.spec.d.ts +0 -1
  152. package/lib/src/components/ProgressBar/ProgressBar.stories.d.ts +0 -15
  153. package/lib/src/components/Radio/Radio.spec.d.ts +0 -1
  154. package/lib/src/components/Radio/Radio.stories.d.ts +0 -19
  155. package/lib/src/components/RadioConsent/Radio.stories.d.ts +0 -18
  156. package/lib/src/components/RadioConsent/RadioConsent.spec.d.ts +0 -1
  157. package/lib/src/components/Select/Select.spec.d.ts +0 -1
  158. package/lib/src/components/Select/Selelct.stories.d.ts +0 -20
  159. package/lib/src/components/Step/Step.spec.d.ts +0 -1
  160. package/lib/src/components/Step/Step.stories.d.ts +0 -14
  161. package/lib/src/components/Text/Text.spec.d.ts +0 -1
  162. package/lib/src/components/Text/Text.stories.d.ts +0 -15
  163. package/lib/src/components/TextAreaField/TextAreaField.spec.d.ts +0 -1
  164. package/lib/src/components/TextAreaField/TextAreaField.stories.d.ts +0 -23
  165. package/lib/src/components/TextField/TextField.spec.d.ts +0 -1
  166. package/lib/src/components/TextField/TextField.stories.d.ts +0 -25
  167. package/lib/src/components/Totaliser/Totaliser.spec.d.ts +0 -1
  168. package/lib/src/components/Totaliser/Totaliser.stories.d.ts +0 -19
  169. package/lib/src/components/UserBlock/UserBlock.spec.d.ts +0 -1
  170. package/lib/src/components/UserBlock/UserBlock.stories.d.ts +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/Checkbox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst CHECK_BOX_SIZE = \"1.5rem\";\nconst BUTTON_HEIGHT = \"3em\";\nconst BORDER_THICKNESS = \"2px\";\n\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\n display: inline-block;\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n position: absolute;\n top: calc(50% - (${CHECK_BOX_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<{\n theme: ThemeType;\n}>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n`;\n\nexport const StyledLabel = styled.label<{\n $checked: boolean;\n $disabled: boolean;\n $hasError: boolean;\n theme: ThemeType;\n}>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n position: relative;\n\n cursor: ${({ $disabled }) => ($disabled ? \"not-allowed\" : \"pointer\")};\n display: block;\n\n color: ${({ theme, $disabled }) =>\n $disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n &:focus ~ ${CheckWrapper} ${Check} {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ${({ theme, $disabled }) => $disabled && theme.colors.disabled};\n }\n }\n\n ${({ theme, $disabled, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${\n $disabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder\n };\n }\n\n &:hover ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${\n $disabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder\n }\n `}\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\n\n// TODO when we get rid of bootstrap remove !important.\nexport const StyledInput = styled.input<{\n theme: ThemeType;\n}>`\n margin-right: 5px !important;\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n /* This hides the original input */\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ ${CheckWrapper} svg path {\n transform: rotateY(0deg);\n }\n `}\n`;\n"],"names":["CHECK_BOX_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","templateObject_2","colors","selectionBorder","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","$disabled","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","$checked","$hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","SelectedBorder","templateObject_5","StyledInput","input","templateObject_8","templateObject_6","s","templateObject_7","xxs"],"mappings":"2HAGA,oBAAMA,EAAiB,SAIVC,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,eAAA,gDAAA,oBAAA,OAAA,CAEpC,yCAEwB,eACD,gDAEU,oBAKzB,SAREL,EACDA,EAEUA,EACX,SAACM,GAIH,OAFWA,EAAAC,MAAAC,QAAAC,EAEX,GAGKC,EAAQR,EAAOS,KAAIC,IAAAA,EAAAP,EAAA,CAAA,mEAAA,gB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,OAAAzB,EAAMoB,UAAUM,uBACZ,KACAC,EAAGC,IAAAA,EAAA9B,EAAA,CAAA,8CAAA,IAAA,iCAAA,mBAAA,uCAAA,IAAA,iCAAA,iBAAA,cAAA,CAAA,8CAGa,IAAS,iCACW,mBAS9B,uCAGkB,IAAS,iCACG,iBAShC,gBAvBAJ,EAAgBS,EArFH,MAwFTa,EACIhB,EAAMM,OAAOW,SACbQ,EACEzB,EAAMM,OAAOuB,OACbL,EACExB,EAAMM,OAAOwB,MACb9B,EAAMM,OAAOyB,YAIjBrC,EAAgBS,EAlGX,MAqGXa,EACIhB,EAAMM,OAAOW,SACbQ,EACEzB,EAAMM,OAAOuB,OACbL,EACExB,EAAMM,OAAOwB,MACb9B,EAAMM,OAAOyB,YA3B/B,GAgCSC,EAAiBrC,EAAOC,IAAGqC,IAAAA,EAAAnC,EAAA,CAAA,qFAAA,CAAA,wFAS3BoC,EAAcvC,EAAOwC,MAAKC,IAAAA,EAAAtC,EAAA,CAAA,0CAAA,MAAA,CAErC,0CA6BO,QA1BL,SAACC,GAAE,IAAAC,EAAKD,EAAAC,MACR,OAAAA,EAAMoB,UAAUM,uBACZC,EAAGU,IAAAA,EAAAvC,EAAA,CAAA,qMAAA,eAAA,CAAA,qMAOsB,iBAAfE,EAAMC,QAAQqC,GAExBX,EAAGY,IAAAA,EAAAzC,EAAA,CAAA,mGAAA,mDAAA,sFAAA,8GAAA,6EAAA,CAAA,mGAGwB,mDAGC,sFAE8B,8GAI9B,+EATlBE,EAAMC,QAAQuC,IAGVR,EAEoBhC,EAAMM,OAAOyB,YAI/BrC,EAtBpB"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Checkbox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst CHECK_BOX_SIZE = \"1.5rem\";\nconst BUTTON_HEIGHT = \"3em\";\nconst BORDER_THICKNESS = \"2px\";\n\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\n display: inline-block;\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n position: absolute;\n top: calc(50% - (${CHECK_BOX_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<{\n theme: ThemeType;\n}>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n // do not increase font size of check icon at this breakpoint\n @media (min-width: ${({ theme }) => theme.breakpoint.desktopLarge}) {\n font-size: ${({ theme }) => theme.fontSizes.m};\n }\n\n svg {\n vertical-align: baseline;\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n`;\n\nexport const StyledLabel = styled.label<{\n $checked: boolean;\n $disabled: boolean;\n $hasError: boolean;\n theme: ThemeType;\n}>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n // increase font size for desktop\n @media (min-width: ${({ theme }) => theme.breakpoint.desktopLarge}) {\n font-size: ${({ theme }) => theme.fontSizes.ml};\n }\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n position: relative;\n\n cursor: ${({ $disabled }) => ($disabled ? \"not-allowed\" : \"pointer\")};\n display: block;\n\n color: ${({ theme, $disabled }) =>\n $disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n &:focus ~ ${CheckWrapper} ${Check} {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ${({ theme, $disabled }) => $disabled && theme.colors.disabled};\n }\n }\n\n ${({ theme, $disabled, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n }\n &:hover ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n }\n `}\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\n\n// TODO when we get rid of bootstrap remove !important.\nexport const StyledInput = styled.input<{\n theme: ThemeType;\n}>`\n margin-right: 5px !important;\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n /* This hides the original input */\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ ${CheckWrapper} svg path {\n transform: rotateY(0deg);\n }\n `}\n`;\n"],"names":["CHECK_BOX_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","colors","selectionBorder","breakpoint","desktopLarge","fontSizes","m","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","ml","backgroundLight","$disabled","disabled","textDark","concat","utilities","inputBorderWidth","xl","$checked","$hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","SelectedBorder","templateObject_5","StyledInput","input","templateObject_8","templateObject_6","s","templateObject_7","xxs"],"mappings":"2HAGA,oBAAMA,EAAiB,SAIVC,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,eAAA,gDAAA,oBAAA,OAAA,CAEpC,yCAEwB,eACD,gDAEU,oBAKzB,SAREL,EACDA,EAEUA,EACX,SAACM,GAIH,OAFWA,EAAAC,MAAAC,QAAAC,EAEX,GAGKC,EAAQR,EAAOS,shBAE1B,mEAG+D,gBACvC,eACD,oNAS0C,uBAClB,4LAZ3B,SAACL,GAAc,OAAPA,EAAAC,MAAaK,OAAOC,eAAb,EACzBb,EACDA,EASY,SAACM,GAAc,OAAPA,EAAAC,MAAaO,WAAWC,YAAjB,EACrB,SAACT,GAAc,OAAPA,EAAAC,MAAaS,UAAUC,CAAhB,GAanBC,EAAchB,EAAOiB,MAAKC,IAAAA,EAAAf,EAAA,CAAA,iHAAA,mBAAA,qBAAA,kEAAA,uBAAA,iCAAA,yCAAA,oCAAA,iBAAA,kBAAA,IAAA,+JAAA,sBAAA,MAAA,CAKrC,iHAOyD,mBACA,qBACI,kEAGI,uBACjB,iCAGe,yCAGK,oCAIT,iBAEyM,kBAC5O,IAAS,+JAOuC,sBA6BjE,QAvDQ,SAACC,GAAc,OAAPA,EAAAC,MAAac,WAAWC,UAAjB,EACjB,SAAChB,GAAc,OAAPA,EAAAC,MAAac,WAAWE,YAAjB,EACb,SAACjB,GAAc,OAAPA,EAAAC,MAAac,WAAWG,cAAjB,EAGT,SAAClB,GAAc,OAAPA,EAAAC,MAAaO,WAAWC,YAAjB,EACrB,SAACT,GAAc,OAAPA,EAAAC,MAAaS,UAAUS,EAAhB,EAGV,SAACnB,GAAc,OAAPA,EAAAC,MAAaK,OA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AAA,CAAA,wFAS3BuC,EAAc1C,EAAO2C,MAAKC,IAAAA,EAAAzC,EAAA,CAAA,0CAAA,MAAA,CAErC,0CA6BO,QA1BL,SAACC,GAAE,IAAAC,EAAKD,EAAAC,MACR,OAAAA,EAAMwB,UAAUK,uBACZC,EAAGU,IAAAA,EAAA1C,EAAA,CAAA,qMAAA,eAAA,CAAA,qMAOsB,iBAAfE,EAAMC,QAAQwC,GAExBX,EAAGY,IAAAA,EAAA5C,EAAA,CAAA,mGAAA,mDAAA,sFAAA,8GAAA,6EAAA,CAAA,mGAGwB,mDAGC,sFAE8B,8GAI9B,+EATlBE,EAAMC,QAAQ0C,IAGVR,EAEoBnC,EAAMK,OAAO6B,YAI/BxC,EAtBpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Collapse/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n type HTMLAttributes,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { faChevronDown } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { IconFa } from \"../IconFa\";\n\nimport { type FontSizeType, type ThemeType } from \"../../types\";\nimport {\n CustomHeader,\n DefaultHeader,\n FlippingIcon,\n CollapseContent,\n transitionDurationSeconds,\n} from \"./styles\";\n\nexport type CollapseProps = HTMLAttributes<HTMLElement> & {\n /** id is required for a11y reasons as we use aria attributes which depends on an id */\n id: string;\n /** text of collapse header, even if there is a custom header component this prop is still used for aria attributes */\n headerTitleText: string;\n /** collapse header text colour */\n headerTitleTextColor?: string;\n /** collapse header text size */\n headerTitleTextSize?: FontSizeType;\n /** collapse header font family */\n headerTitleTextFontFamily?: string;\n /** custom collapse header component */\n headerComponent?: ReactNode;\n /** flag to indicate */\n startOpen?: boolean;\n /** callback function that is passed isOpen flag */\n onOpenChange?: (isOpen: boolean) => void;\n /** children */\n children?: ReactNode;\n};\n\n/**\n *\n * Use a collapse component to show and hide content. It has a default view; however, it can be overwritten by passing a custom component as a prop.\n *\n */\nexport function Collapse({\n id,\n headerTitleText,\n headerTitleTextColor,\n headerTitleTextSize,\n headerTitleTextFontFamily,\n headerComponent,\n startOpen,\n onOpenChange,\n children,\n}: CollapseProps) {\n const [openStatus, setOpenStatus] = useState(startOpen || false);\n const [contentHeight, setContentHeight] = useState(\n startOpen ? \"initial\" : \"0\",\n );\n const content = useRef<HTMLDivElement>(null);\n const transitionTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const foundTheme = useTheme();\n const theme: ThemeType = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const toggleCollapse = () => {\n const { current } = content;\n if (transitionTimer?.current) clearTimeout(transitionTimer?.current);\n const newOpenState = !openStatus;\n setOpenStatus(newOpenState);\n\n if (current !== null) {\n setContentHeight(`${current.scrollHeight}px`);\n }\n\n if (newOpenState === false) {\n // Allow height to be rendered before setting to 0 for animation.\n setTimeout(() => setContentHeight(\"0\"), 10);\n } else {\n transitionTimer.current = setTimeout(\n () => setContentHeight(\"initial\"),\n transitionDurationSeconds * 1000,\n );\n }\n if (onOpenChange !== undefined) {\n onOpenChange(newOpenState);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === \"Enter\" ||\n event.key === \" \" ||\n event.key === \"Spacebar\"\n ) {\n event.preventDefault();\n toggleCollapse();\n }\n };\n\n useEffect(() => {\n setOpenStatus(startOpen || false);\n // if start open changes then we want to set the height without animation\n if (startOpen) {\n setContentHeight(\"initial\");\n } else {\n setContentHeight(\"0\");\n }\n }, [startOpen]);\n\n return (\n <div id={id}>\n {headerComponent ? (\n <CustomHeader\n theme={theme}\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n aria-disabled={false}\n aria-label={headerTitleText}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n >\n {headerComponent}\n </CustomHeader>\n ) : (\n <DefaultHeader\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n theme={theme}\n type=\"button\"\n appearance=\"tertiary\"\n $textColor={headerTitleTextColor}\n $textSize={headerTitleTextSize}\n $textFontFamily={headerTitleTextFontFamily}\n >\n {headerTitleText}\n <FlippingIcon $open={openStatus}>\n <IconFa faIcon={faChevronDown} />\n </FlippingIcon>\n </DefaultHeader>\n )}\n <CollapseContent\n theme={theme}\n id={`${id}-content`}\n ref={content}\n role=\"region\"\n aria-hidden={!openStatus}\n aria-labelledby={`${id}-header`}\n $contentHeight={contentHeight}\n $openStatus={openStatus}\n >\n {children}\n </CollapseContent>\n </div>\n );\n}\n\nexport default Collapse;\n"],"names":["Collapse","_a","id","headerTitleText","headerTitleTextColor","headerTitleTextSize","headerTitleTextFontFamily","headerComponent","startOpen","onOpenChange","children","_b","useState","openStatus","setOpenStatus","_c","contentHeight","setContentHeight","content","useRef","transitionTimer","foundTheme","useTheme","theme","__assign","defaultTheme","toggleCollapse","current","clearTimeout","newOpenState","concat","scrollHeight","setTimeout","transitionDurationSeconds","undefined","useEffect","React","createElement","CustomHeader","onClick","onKeyDown","event","key","preventDefault","role","tabIndex","DefaultHeader","type","appearance","$textColor","$textSize","FlippingIcon","IconFa","faIcon","faChevronDown","CollapseContent","ref","$contentHeight","$openStatus"],"mappings":"kfAiDM,SAAUA,EAASC,OACvBC,EAAED,EAAAC,GACFC,EAAeF,EAAAE,gBACfC,EAAoBH,EAAAG,qBACpBC,EAAmBJ,EAAAI,oBACnBC,8BACAC,EAAeN,EAAAM,gBACfC,EAASP,EAAAO,UACTC,EAAYR,EAAAQ,aACZC,EAAQT,EAAAS,SAEFC,EAA8BC,EAASJ,IAAa,GAAnDK,EAAUF,EAAA,GAAEG,OACbC,EAAoCH,EACxCJ,EAAY,UAAY,KADnBQ,OAAeC,OAGhBC,EAAUC,EAAuB,MACjCC,EAAkBD,EAA6C,MAC/DE,EAAaC,IACbC,E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,YAChB7C,GAEZH,GAIT"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Collapse/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n type HTMLAttributes,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { faChevronDown } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { IconFa } from \"../IconFa\";\n\nimport { type FontSizeType, type ThemeType } from \"../../types\";\nimport {\n CustomHeader,\n DefaultHeader,\n FlippingIcon,\n CollapseContent,\n transitionDurationSeconds,\n} from \"./styles\";\n\nexport type CollapseProps = HTMLAttributes<HTMLElement> & {\n /** id is required for a11y reasons as we use aria attributes which depends on an id */\n id: string;\n /** text of collapse header, even if there is a custom header component this prop is still used for aria attributes */\n headerTitleText: string;\n /** collapse header text colour */\n headerTitleTextColor?: string;\n /** collapse header text size */\n headerTitleTextSize?: FontSizeType;\n /** collapse header font family */\n headerTitleTextFontFamily?: string;\n /** custom collapse header component */\n headerComponent?: ReactNode;\n /** flag to indicate */\n startOpen?: boolean;\n /** callback function that is passed isOpen flag */\n onOpenChange?: (isOpen: boolean) => void;\n /** children */\n children?: ReactNode;\n};\n\n/**\n *\n * Use a collapse component to show and hide content. It has a default view; however, it can be overwritten by passing a custom component as a prop.\n *\n */\nexport function Collapse({\n id,\n headerTitleText,\n headerTitleTextColor,\n headerTitleTextSize,\n headerTitleTextFontFamily,\n headerComponent,\n startOpen,\n onOpenChange,\n children,\n}: CollapseProps) {\n const [openStatus, setOpenStatus] = useState(startOpen || false);\n const [contentHeight, setContentHeight] = useState(\n startOpen ? \"initial\" : \"0\",\n );\n const content = useRef<HTMLDivElement>(null);\n const transitionTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const foundTheme = useTheme();\n const theme: ThemeType = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const toggleCollapse = () => {\n const { current } = content;\n if (transitionTimer?.current) clearTimeout(transitionTimer?.current);\n const newOpenState = !openStatus;\n setOpenStatus(newOpenState);\n\n if (current !== null) {\n setContentHeight(`${current.scrollHeight}px`);\n }\n\n if (newOpenState === false) {\n // Allow height to be rendered before setting to 0 for animation.\n setTimeout(() => setContentHeight(\"0\"), 10);\n } else {\n transitionTimer.current = setTimeout(\n () => setContentHeight(\"initial\"),\n transitionDurationSeconds * 1000,\n );\n }\n if (onOpenChange !== undefined) {\n onOpenChange(newOpenState);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === \"Enter\" ||\n event.key === \" \" ||\n event.key === \"Spacebar\"\n ) {\n event.preventDefault();\n toggleCollapse();\n }\n };\n\n useEffect(() => {\n setOpenStatus(startOpen || false);\n // if start open changes then we want to set the height without animation\n if (startOpen) {\n setContentHeight(\"initial\");\n } else {\n setContentHeight(\"0\");\n }\n }, [startOpen]);\n\n return (\n <div id={id}>\n {headerComponent ? (\n <CustomHeader\n theme={theme}\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n aria-disabled={false}\n aria-label={headerTitleText}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n >\n {headerComponent}\n </CustomHeader>\n ) : (\n <DefaultHeader\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n theme={theme}\n type=\"button\"\n appearance=\"tertiary\"\n $textColor={headerTitleTextColor}\n $textSize={headerTitleTextSize}\n $textFontFamily={headerTitleTextFontFamily}\n >\n {headerTitleText}\n <FlippingIcon $open={openStatus}>\n <IconFa faIcon={faChevronDown} />\n </FlippingIcon>\n </DefaultHeader>\n )}\n <CollapseContent\n theme={theme}\n id={`${id}-content`}\n ref={content}\n role=\"region\"\n aria-hidden={!openStatus}\n aria-labelledby={`${id}-header`}\n $contentHeight={contentHeight}\n $openStatus={openStatus}\n >\n {children}\n </CollapseContent>\n </div>\n );\n}\n\nexport default Collapse;\n"],"names":["Collapse","_a","id","headerTitleText","headerTitleTextColor","headerTitleTextSize","headerTitleTextFontFamily","headerComponent","startOpen","onOpenChange","children","_b","useState","openStatus","setOpenStatus","_c","contentHeight","setContentHeight","content","useRef","transitionTimer","foundTheme","useTheme","theme","__assign","defaultTheme","toggleCollapse","current","clearTimeout","newOpenState","concat","scrollHeight","setTimeout","transitionDurationSeconds","undefined","useEffect","React","createElement","CustomHeader","onClick","onKeyDown","event","key","preventDefault","role","tabIndex","DefaultHeader","type","appearance","$textColor","$textSize","FlippingIcon","IconFa","faIcon","faChevronDown","CollapseContent","ref","$contentHeight","$openStatus"],"mappings":"kfAiDM,SAAUA,EAASC,OACvBC,EAAED,EAAAC,GACFC,EAAeF,EAAAE,gBACfC,EAAoBH,EAAAG,qBACpBC,EAAmBJ,EAAAI,oBACnBC,8BACAC,EAAeN,EAAAM,gBACfC,EAASP,EAAAO,UACTC,EAAYR,EAAAQ,aACZC,EAAQT,EAAAS,SAEFC,EAA8BC,EAASJ,IAAa,GAAnDK,EAAUF,EAAA,GAAEG,OACbC,EAAoCH,EACxCJ,EAAY,UAAY,KADnBQ,OAAeC,OAGhBC,EAAUC,EAAuB,MACjCC,EAAkBD,EAA6C,MAC/DE,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAGCK,EAAiB,WACb,IAAAC,EAAYT,EAAOS,SACvBP,aAAe,EAAfA,EAAiBO,UAASC,aAAaR,eAAAA,EAAiBO,SAC5D,IAAME,GAAgBhB,EACtBC,EAAce,GAEE,OAAZF,GACFV,EAAiB,GAAAa,OAAGH,EAAQI,aAAY,QAGrB,IAAjBF,EAEFG,WAAW,WAAM,OAAAf,EAAiB,IAAjB,EAAuB,IAExCG,EAAgBO,QAAUK,WACxB,WAAM,OAAAf,EAAiB,UAAjB,EACsB,IAA5BgB,QAGiBC,IAAjBzB,GACFA,EAAaoB,EAEjB,EAuBA,OAVAM,EAAU,WACRrB,EAAcN,IAAa,GAGzBS,EADET,EACe,UAEA,IAErB,EAAG,CAACA,IAGF4B,EAAAC,cAAA,MAAA,CAAKnC,GAAIA,GACNK,EACC6B,EAAAC,cAACC,GACCf,MAAOA,EAAK,gBACG,UAAGrB,EAAE,2BACLW,EACfX,GAAI,GAAA4B,OAAG5B,EAAE,WACTqC,QAASb,EAAc,iBACR,eACHvB,EACZqC,UAhCc,SAACC,GAEL,UAAdA,EAAMC,KACQ,MAAdD,EAAMC,KACQ,aAAdD,EAAMC,MAEND,EAAME,iBACNjB,IAEJ,EAwBQkB,KAAK,SACLC,SAAU,GAETtC,GAGH6B,gBAACU,EAAa,CAAA,gBACG,GAAAhB,OAAG5B,aAAW,gBACdW,EACfX,GAAI,UAAGA,EAAE,WACTqC,QAASb,EACTH,MAAOA,EACPwB,KAAK,SACLC,WAAW,WAAUC,WACT7C,EAAoB8C,UACrB7C,kBACMC,GAEhBH,EACDiC,EAAAC,cAACc,SAAoBtC,GACnBuB,EAAAC,cAACe,GAAOC,OAAQC,MAItBlB,EAAAC,cAACkB,EAAe,CACdhC,MAAOA,EACPrB,GAAI,GAAA4B,OAAG5B,EAAE,YACTsD,IAAKtC,EACL0B,KAAK,wBACS/B,EAAU,kBACP,GAAAiB,OAAG5B,EAAE,WAASuD,eACfzC,EAAa0C,YAChB7C,GAEZH,GAIT"}
@@ -4,7 +4,7 @@ export declare const FlippingIcon: import("styled-components/dist/types").IStyle
4
4
  $open: boolean;
5
5
  }>> & string;
6
6
  export declare const DefaultHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").ButtonHTMLAttributes<HTMLElement> & {
7
- appearance?: import("../../types").ButtonAppearanceType;
7
+ appearance?: import("..").ButtonAppearanceType;
8
8
  full?: boolean;
9
9
  href?: string;
10
10
  size?: "m" | "l";
@@ -1,2 +1,2 @@
1
- import e from"react";import{useTheme as t}from"styled-components";import{ErrorText as n}from"../ErrorText/index.js";import{Text as a}from"../Text/index.js";import{TextField as r}from"../TextField/index.js";import{Fieldset as o,DateTextFieldWrapper as l,LargeDateTextFieldWrapper as i,ErrorTextWrapper as m}from"./styles.js";function d(d){var u=d.label,s=d.hintText,p=d.day,c=d.month,y=d.year,h=d.dayName,x=void 0===h?"day":h,E=d.monthName,g=void 0===E?"month":E,b=d.yearName,f=void 0===b?"year":b,v=d.dayHasError,F=d.monthHasError,L=d.yearHasError,q=d.errorMessage,C=d.onChange,B=void 0===C?function(){}:C,I=d.onBlur,M=void 0===I?function(){}:I,T=d.onFocus,j=void 0===T?function(){}:T,W=d.disabled,H=d.required,N=t();return e.createElement(o,null,e.createElement(a,{as:"legend",textWeight:N.typography.fontWeightLabels||700,marginBottom:"xxs",textFontFamily:N.typography.fontFamilyLabel},u,!H&&e.createElement("span",{style:{fontWeight:N.typography.fontWeightBase}}," (optional)")),s&&e.createElement(a,null,s),e.createElement(l,null,e.createElement(r,{label:"Day",type:"text",name:x,required:!!H,hideRequiredIndicationInLabel:!0,maxLength:2,autoComplete:"bday-day",pattern:"[0-9]*",inputMode:"numeric",value:p,onChange:B,onBlur:M,onFocus:j,hasError:v,disabled:W})),e.createElement(l,null,e.createElement(r,{label:"Month",type:"text",name:g,required:!!H,hideRequiredIndicationInLabel:!0,maxLength:2,autoComplete:"bday-month",pattern:"[0-9]*",inputMode:"numeric",value:c,onChange:B,onBlur:M,onFocus:j,hasError:F,disabled:W})),e.createElement(i,null,e.createElement(r,{label:"Year",type:"text",name:f,required:!!H,hideRequiredIndicationInLabel:!0,maxLength:4,autoComplete:"bday-year",pattern:"[0-9]*",inputMode:"numeric",value:y,onChange:B,onBlur:M,onFocus:j,hasError:L,disabled:W})),q&&e.createElement(m,null,e.createElement(n,{marginTop:"xxs"},q)))}export{d as DateField,d as default};
1
+ import e from"react";import{useTheme as t}from"styled-components";import{ErrorText as n}from"../ErrorText/index.js";import{Text as r}from"../Text/index.js";import{TextField as a}from"../TextField/index.js";import{Fieldset as o,LegendText as l,DateTextFieldWrapper as i,LargeDateTextFieldWrapper as m,ErrorTextWrapper as d}from"./styles.js";function u(u){var s=u.label,c=u.hintText,p=u.day,h=u.month,y=u.year,E=u.dayName,x=void 0===E?"day":E,b=u.monthName,f=void 0===b?"month":b,g=u.yearName,v=void 0===g?"year":g,C=u.dayHasError,q=u.monthHasError,I=u.yearHasError,L=u.errorMessage,M=u.onChange,B=void 0===M?function(){}:M,F=u.onBlur,T=void 0===F?function(){}:F,j=u.onFocus,H=void 0===j?function(){}:j,N=u.disabled,R=u.required,W=t();return e.createElement(o,null,e.createElement(l,null,s,!R&&e.createElement("span",{style:{fontWeight:W.typography.fontWeightBase}}," (optional)")),c&&e.createElement(r,{textColor:W.colors.textMid},c),e.createElement(i,null,e.createElement(a,{label:"Day",type:"text",name:x,required:!!R,hideRequiredIndicationInLabel:!0,maxLength:2,autoComplete:"bday-day",pattern:"[0-9]*",inputMode:"numeric",value:p,onChange:B,onBlur:T,onFocus:H,hasError:C,disabled:N})),e.createElement(i,null,e.createElement(a,{label:"Month",type:"text",name:f,required:!!R,hideRequiredIndicationInLabel:!0,maxLength:2,autoComplete:"bday-month",pattern:"[0-9]*",inputMode:"numeric",value:h,onChange:B,onBlur:T,onFocus:H,hasError:q,disabled:N})),e.createElement(m,null,e.createElement(a,{label:"Year",type:"text",name:v,required:!!R,hideRequiredIndicationInLabel:!0,maxLength:4,autoComplete:"bday-year",pattern:"[0-9]*",inputMode:"numeric",value:y,onChange:B,onBlur:T,onFocus:H,hasError:I,disabled:N})),L&&e.createElement(d,null,e.createElement(n,{marginTop:"xxs"},L)))}export{u as DateField,u as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/DateField/index.tsx"],"sourcesContent":["import React, { type InputHTMLAttributes } from \"react\";\n\nimport { useTheme } from \"styled-components\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\nimport { TextField } from \"../TextField\";\n\nimport {\n Fieldset,\n DateTextFieldWrapper,\n LargeDateTextFieldWrapper,\n ErrorTextWrapper,\n} from \"./styles\";\nimport { type ThemeType } from \"../../types\";\n\nexport type DateFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n /** label text */\n label: string;\n /** hind text */\n hintText?: string;\n /** day field text value */\n day: string;\n /** month field text value */\n month: string;\n /** year field text value */\n year: string;\n /** name passed to day field input element */\n dayName?: string;\n /** name passed to month field input element */\n monthName?: string;\n /** name passed to year field input element */\n yearName?: string;\n /** flag of error styling on day field */\n dayHasError?: boolean;\n /** flag of error styling on month field */\n monthHasError?: boolean;\n /** flag of error styling on year field */\n yearHasError?: boolean;\n /** error message text */\n errorMessage?: string;\n};\n\n/**\n * To be used in forms entering dates like date of birth which are known dates and would take too long to get to with a date picker\n * */\nexport function DateField({\n label,\n hintText,\n day,\n month,\n year,\n dayName = \"day\",\n monthName = \"month\",\n yearName = \"year\",\n dayHasError,\n monthHasError,\n yearHasError,\n errorMessage,\n onChange = () => {\n // no op\n },\n onBlur = () => {\n // no op\n },\n onFocus = () => {\n // no op\n },\n disabled,\n required,\n}: DateFieldProps) {\n const theme = useTheme();\n const typedTheme = theme as ThemeType;\n return (\n <Fieldset>\n <Text\n as=\"legend\"\n textWeight={typedTheme.typography.fontWeightLabels || 700}\n marginBottom=\"xxs\"\n textFontFamily={typedTheme.typography.fontFamilyLabel}\n >\n {label}\n {!required && (\n <span\n style={{\n fontWeight: typedTheme.typography.fontWeightBase,\n }}\n >\n {` (optional)`}\n </span>\n )}\n </Text>\n {hintText && <Text>{hintText}</Text>}\n <DateTextFieldWrapper>\n <TextField\n label=\"Day\"\n type=\"text\"\n name={dayName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={2}\n autoComplete=\"bday-day\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={day}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={dayHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <DateTextFieldWrapper>\n <TextField\n label=\"Month\"\n type=\"text\"\n name={monthName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={2}\n autoComplete=\"bday-month\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={month}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={monthHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <LargeDateTextFieldWrapper>\n <TextField\n label=\"Year\"\n type=\"text\"\n name={yearName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={4}\n autoComplete=\"bday-year\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={year}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={yearHasError}\n disabled={disabled}\n />\n </LargeDateTextFieldWrapper>\n {errorMessage && (\n <ErrorTextWrapper>\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n </ErrorTextWrapper>\n )}\n </Fieldset>\n );\n}\n\nexport default DateField;\n"],"names":["DateField","_a","label","hintText","day","month","year","_b","dayName","_c","monthName","_d","yearName","dayHasError","monthHasError","yearHasError","errorMessage","_e","onChange","_f","onBlur","_g","onFocus","disabled","required","typedTheme","useTheme","React","Fieldset","createElement","Text","as","textWeight","typography","fontWeightLabels","marginBottom","textFontFamily","fontFamilyLabel","style","fontWeight","fontWeightBase","DateTextFieldWrapper","TextField","type","name","hideRequiredIndicationInLabel","maxLength","autoComplete","pattern","inputMode","value","hasError","LargeDateTextFieldWrapper","ErrorTextWrapper","ErrorText","marginTop"],"mappings":"oUA6CM,SAAUA,EAAUC,OACxBC,EAAKD,EAAAC,MACLC,EAAQF,EAAAE,SACRC,EAAGH,EAAAG,IACHC,EAAKJ,EAAAI,MACLC,EAAIL,EAAAK,KACJC,EAAAN,EAAAO,QAAAA,OAAO,IAAAD,EAAG,MAAKA,EACfE,EAAAR,EAAAS,UAAAA,OAAS,IAAAD,EAAG,QAAOA,EACnBE,aAAAC,aAAW,OAAMD,EACjBE,EAAWZ,EAAAY,YACXC,EA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AQ,SACRC,UAAU,UACVC,MAAO5C,EACPY,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT6B,SAAUpC,EACVQ,SAAUA,KAGbP,GACCW,EAAAE,cAACwB,EAAgB,KACf1B,EAAAE,cAACyB,EAAS,CAACC,UAAU,OAAOvC,IAKtC"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/DateField/index.tsx"],"sourcesContent":["import React, { type InputHTMLAttributes } from \"react\";\n\nimport { useTheme } from \"styled-components\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\nimport { TextField } from \"../TextField\";\n\nimport {\n Fieldset,\n DateTextFieldWrapper,\n LargeDateTextFieldWrapper,\n ErrorTextWrapper,\n LegendText,\n} from \"./styles\";\nimport { type ThemeType } from \"../../types\";\n\nexport type DateFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n /** label text */\n label: string;\n /** hind text */\n hintText?: string;\n /** day field text value */\n day: string;\n /** month field text value */\n month: string;\n /** year field text value */\n year: string;\n /** name passed to day field input element */\n dayName?: string;\n /** name passed to month field input element */\n monthName?: string;\n /** name passed to year field input element */\n yearName?: string;\n /** flag of error styling on day field */\n dayHasError?: boolean;\n /** flag of error styling on month field */\n monthHasError?: boolean;\n /** flag of error styling on year field */\n yearHasError?: boolean;\n /** error message text */\n errorMessage?: string;\n};\n\n/**\n * To be used in forms entering dates like date of birth which are known dates and would take too long to get to with a date picker\n * */\nexport function DateField({\n label,\n hintText,\n day,\n month,\n year,\n dayName = \"day\",\n monthName = \"month\",\n yearName = \"year\",\n dayHasError,\n monthHasError,\n yearHasError,\n errorMessage,\n onChange = () => {\n // no op\n },\n onBlur = () => {\n // no op\n },\n onFocus = () => {\n // no op\n },\n disabled,\n required,\n}: DateFieldProps) {\n const theme = useTheme();\n const typedTheme = theme as ThemeType;\n return (\n <Fieldset>\n <LegendText>\n {label}\n {!required && (\n <span\n style={{\n fontWeight: typedTheme.typography.fontWeightBase,\n }}\n >\n {` (optional)`}\n </span>\n )}\n </LegendText>\n {hintText && (\n <Text textColor={typedTheme.colors.textMid}>{hintText}</Text>\n )}\n <DateTextFieldWrapper>\n <TextField\n label=\"Day\"\n type=\"text\"\n name={dayName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={2}\n autoComplete=\"bday-day\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={day}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={dayHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <DateTextFieldWrapper>\n <TextField\n label=\"Month\"\n type=\"text\"\n name={monthName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={2}\n autoComplete=\"bday-month\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={month}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={monthHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <LargeDateTextFieldWrapper>\n <TextField\n label=\"Year\"\n type=\"text\"\n name={yearName}\n required={!!required}\n hideRequiredIndicationInLabel\n maxLength={4}\n autoComplete=\"bday-year\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={year}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={yearHasError}\n disabled={disabled}\n />\n </LargeDateTextFieldWrapper>\n {errorMessage && (\n <ErrorTextWrapper>\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n </ErrorTextWrapper>\n )}\n </Fieldset>\n );\n}\n\nexport default DateField;\n"],"names":["DateField","_a","label","hintText","day","month","year","_b","dayName","_c","monthName","_d","yearName","dayHasError","monthHasError","yearHasError","errorMessage","_e","onChange","_f","onBlur","_g","onFocus","disabled","required","typedTheme","useTheme","React","Fieldset","createElement","LegendText","style","fontWeight","typography","fontWeightBase","Text","textColor","colors","textMid","DateTextFieldWrapper","TextField","type","name","hideRequiredIndicationInLabel","maxLength","autoComplete","pattern","inputMode","value","hasError","LargeDateTextFieldWrapper","Er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AQ,SACRC,UAAU,UACVC,MAAO3C,EACPa,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT2B,SAAUnC,EACVS,SAAUA,KAGdI,EAAAE,cAACqB,EAAyB,KACxBvB,EAAAE,cAACW,EAAS,CACRtC,MAAM,OACNuC,KAAK,OACLC,KAAM9B,EACNY,WAAYA,EACZmB,+BAA6B,EAC7BC,UAAW,EACXC,aAAa,YACbC,QAAQ,SACRC,UAAU,UACVC,MAAO1C,EACPY,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT2B,SAAUlC,EACVQ,SAAUA,KAGbP,GACCW,EAAAE,cAACsB,EAAgB,KACfxB,EAAAE,cAACuB,EAAS,CAACC,UAAU,OAAOrC,IAKtC"}
@@ -1,14 +1,17 @@
1
1
  import { type ThemeType } from "../../types";
2
2
  export declare const Fieldset: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
3
+ export declare const LegendText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, {
4
+ theme: ThemeType;
5
+ }>> & string;
3
6
  export declare const TextAsLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("../Spacing").SpacingProps & import("react").HTMLAttributes<HTMLElement> & {
4
7
  textColor?: string;
5
8
  textAlign?: "left" | "right" | "center" | "justify";
6
- textSize?: import("../../types").FontSizeType;
9
+ textSize?: import("..").FontSizeType;
7
10
  textWeight?: number | string;
8
11
  textFontFamily?: string;
9
12
  as?: import("react").ElementType;
10
- wordBreak?: import("../../types").WordBreakType;
11
- overflowWrap?: import("../../types").OverflowWrapType;
13
+ wordBreak?: import("..").WordBreakType;
14
+ overflowWrap?: import("..").OverflowWrapType;
12
15
  ref?: import("react").Ref<HTMLElement>;
13
16
  }, {
14
17
  theme: ThemeType;
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";import{Text as o}from"../Text/index.js";var r=i.fieldset(e||(e=n(["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"],["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"])));i(o)(t||(t=n(["\n font-family: ",";\n"],["\n font-family: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel});var e,t,a,s,b,m=i.div(a||(a=n(["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"],["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"])),function(n){return n.theme.spacing.xs},function(n){return n.theme.typography.fontWeightBase}),d=i(m)(s||(s=n(["\n width: 80px;\n"],["\n width: 80px;\n"]))),g=i.div(b||(b=n(["\n clear: left;\n"],["\n clear: left;\n"])));export{m as DateTextFieldWrapper,g as ErrorTextWrapper,r as Fieldset,d as LargeDateTextFieldWrapper};
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t from"styled-components";import{Text as i}from"../Text/index.js";var e=t.fieldset(r||(r=n(["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"],["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"]))),o=t.legend(a||(a=n(["\n font-family: ",";\n font-weight: ",";\n margin-bottom: ",";\n\n // do not increase font size of check icon at this breakpoint\n @media (min-width: ",") {\n font-size: ",";\n }\n"],["\n font-family: ",";\n font-weight: ",";\n margin-bottom: ",";\n\n // do not increase font size of check icon at this breakpoint\n @media (min-width: ",") {\n font-size: ",";\n }\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightLabels||500},function(n){return n.theme.spacing.xxs},function(n){return n.theme.breakpoint.desktopLarge},function(n){return n.theme.fontSizes.ml});t(i)(m||(m=n(["\n font-family: ",";\n"],["\n font-family: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel});var r,a,m,s,f,b,g=t.div(s||(s=n(["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"],["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"])),function(n){return n.theme.spacing.xs},function(n){return n.theme.typography.fontWeightBase}),h=t(g)(f||(f=n(["\n width: 80px;\n"],["\n width: 80px;\n"]))),d=t.div(b||(b=n(["\n clear: left;\n"],["\n clear: left;\n"])));export{g as DateTextFieldWrapper,d as ErrorTextWrapper,e as Fieldset,h as LargeDateTextFieldWrapper,o as LegendText};
2
2
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/DateField/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\nimport Text from \"../Text\";\n\nexport const Fieldset = styled.fieldset`\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n`;\n\nexport const TextAsLabel = styled(Text)<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<{ theme: ThemeType }>`\n display: inline-block;\n width: 60px;\n margin-right: ${({ theme }) => theme.spacing.xs};\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const LargeDateTextFieldWrapper = styled(DateTextFieldWrapper)`\n width: 80px;\n`;\n\nexport const ErrorTextWrapper = styled.div`\n clear: left;\n`;\n"],"names":["Fieldset","styled","fieldset","templateObject_1","__makeTemplateObject","Text","templateObject_2","_a","theme","typography","fontFamilyLabel","DateTextFieldWrapper","div","templateObject_3","spacing","xs","fontWeightBase","LargeDateTextFieldWrapper","templateObject_4","ErrorTextWrapper","templateObject_5"],"mappings":"yJAIO,IAAMA,EAAWC,EAAOC,SAAQC,IAAAA,EAAAC,EAAA,CAAA,0LAAA,CAAA,6LAaZH,EAAOI,EAAPJ,CAAYK,IAAAA,EAAAF,EAAA,CAAA,oBAAA,OAAA,CAAsB,oBACG,SAA/C,SAACG,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,GAGzB,cAAMC,EAAuBV,EAAOW,IAAGC,IAAAA,EAAAT,EAAA,CAAA,+DAAA,kGAAA,YAAA,CAAsB,+DAGnB,kGAGgB,cAH/C,SAACG,GAAc,OAAPA,EAAAC,MAAaM,QAAQC,EAAd,EAGd,SAACR,GAAc,OAAPA,EAAAC,MAAaC,WAAWO,cAAjB,GAIrBC,EAA4BhB,EAAOU,EAAPV,CAA4BiB,IAAAA,EAAAd,EAAA,CAAA,sBAAA,CAAA,yBAIxDe,EAAmBlB,EAAOW,IAAGQ,IAAAA,EAAAhB,EAAA,CAAA,sBAAA,CAAA"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/DateField/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\nimport Text from \"../Text\";\n\nexport const Fieldset = styled.fieldset`\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n`;\n\nexport const LegendText = styled.legend<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels || 500};\n margin-bottom: ${({ theme }) => theme.spacing.xxs};\n\n // do not increase font size of check icon at this breakpoint\n @media (min-width: ${({ theme }) => theme.breakpoint.desktopLarge}) {\n font-size: ${({ theme }) => theme.fontSizes.ml};\n }\n`;\n\nexport const TextAsLabel = styled(Text)<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<{ theme: ThemeType }>`\n display: inline-block;\n width: 60px;\n margin-right: ${({ theme }) => theme.spacing.xs};\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const LargeDateTextFieldWrapper = styled(DateTextFieldWrapper)`\n width: 80px;\n`;\n\nexport const ErrorTextWrapper = styled.div`\n clear: left;\n`;\n"],"names":["Fieldset","styled","fieldset","templateObject_1","__makeTemplateObject","LegendText","legend","_a","theme","typography","fontFamilyLabel","fontWeightLabels","spacing","xxs","breakpoint","desktopLarge","fontSizes","ml","Text","templateObject_3","DateTextFieldWrapper","div","templateObject_4","xs","fontWeightBase","LargeDateTextFieldWrapper","templateObject_5","ErrorTextWrapper","templateObject_6"],"mappings":"yJAIO,IAAMA,EAAWC,EAAOC,SAAQC,IAAAA,EAAAC,EAAA,CAAA,0LAAA,CAAA,6LAa1BC,EAAaJ,EAAOK,kNAA4B,oBACG,qBACQ,uBACrB,8FAGgB,uBACjB,cANjC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWE,kBAAoB,GAArC,EACb,SAACJ,GAAc,OAAPA,EAAAC,MAAaI,QAAQC,GAAd,EAGX,SAACN,GAAc,OAAPA,EAAAC,MAAaM,WAAWC,YAAjB,EACrB,SAACR,GAAc,OAAPA,EAAAC,MAAaQ,UAAUC,EAAhB,GAILhB,EAAOiB,EAAPjB,CAAYkB,IAAAA,EAAAf,EAAA,CAAA,oBAAA,OAAA,CAAsB,oBACG,SAA/C,SAACG,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,GAGzB,gBAAMU,EAAuBnB,EAAOoB,IAAGC,IAAAA,EAAAlB,EAAA,CAAA,+DAAA,kGAAA,YAAA,CAAsB,+DAGnB,kGAGgB,cAH/C,SAACG,GAAc,OAAPA,EAAAC,MAAaI,QAAQW,EAAd,EAGd,SAAChB,GAAc,OAAPA,EAAAC,MAAaC,WAAWe,cAAjB,GAIrBC,EAA4BxB,EAAOmB,EAAPnB,CAA4ByB,IAAAA,EAAAtB,EAAA,CAAA,sBAAA,CAAA,yBAIxDuB,EAAmB1B,EAAOoB,IAAGO,IAAAA,EAAAxB,EAAA,CAAA,sBAAA,CAAA"}
@@ -5,12 +5,12 @@ type ThemeProps = {
5
5
  export declare const StyledErrorText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("../Spacing").SpacingProps & import("react").HTMLAttributes<HTMLElement> & {
6
6
  textColor?: string;
7
7
  textAlign?: "left" | "right" | "center" | "justify";
8
- textSize?: import("../../types").FontSizeType;
8
+ textSize?: import("..").FontSizeType;
9
9
  textWeight?: number | string;
10
10
  textFontFamily?: string;
11
11
  as?: import("react").ElementType;
12
- wordBreak?: import("../../types").WordBreakType;
13
- overflowWrap?: import("../../types").OverflowWrapType;
12
+ wordBreak?: import("..").WordBreakType;
13
+ overflowWrap?: import("..").OverflowWrapType;
14
14
  ref?: import("react").Ref<HTMLElement>;
15
15
  }, ThemeProps>> & string & Omit<(props: import("../Text").TextProps) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
16
16
  export default StyledErrorText;
@@ -1 +1 @@
1
- {"version":3,"file":"Flex.js","sources":["../../../src/components/Flex.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"styled-components\";\nimport {\n spacing,\n type SpacingPropsInternal,\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"./Spacing\";\nimport { type ThemeType } from \"../types\";\n\ntype StyledProps = SpacingPropsInternal & {\n theme: ThemeType;\n};\n\nconst FlexStyled = styled.div<StyledProps>`\n display: block;\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: flex;\n }\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\ntype Props = SpacingProps & {\n theme: ThemeType;\n};\nexport function Flex(props: Props) {\n const spacingProps = spacingPropsToSpacingPropsInternal(props);\n\n return <FlexStyled theme={props.theme} {...spacingProps} />;\n}\n\nexport default Flex;\n"],"names":["FlexStyled","styled","div","templateObject_1","__makeTemplateObject","_a","theme","breakpoint","tablet","props","spacing","Flex","spacingProps","spacingPropsToSpacingPropsInternal","React","createElement","__assign"],"mappings":"sOAcA,MAAMA,EAAaC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,6CAAA,mCAAA,MAAA,CAAa,6CAEmB,mCAGN,QAHhC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,MAAjB,EAGlC,SAACC,GAAU,OAAAC,EAAQD,EAAOA,EAAMH,SAM9B,SAAUK,EAAKF,GACnB,IAAMG,EAAeC,EAAmCJ,GAExD,OAAOK,EAAAC,cAACf,EAAUgB,EAAA,CAACV,MAAOG,EAAMH,OAAWM,GAC7C"}
1
+ {"version":3,"file":"Flex.js","sources":["../../../src/components/Flex.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"styled-components\";\nimport {\n spacing,\n type SpacingPropsInternal,\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"./Spacing\";\nimport { type ThemeType } from \"../types\";\n\ntype StyledProps = SpacingPropsInternal & {\n theme: ThemeType;\n};\n\nconst FlexStyled = styled.div<StyledProps>`\n display: block;\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: flex;\n }\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\ntype Props = SpacingProps & {\n theme: ThemeType;\n};\nexport function Flex(props: Props) {\n const spacingProps = spacingPropsToSpacingPropsInternal(props);\n\n return <FlexStyled theme={props.theme} {...spacingProps} />;\n}\n\nexport default Flex;\n"],"names":["FlexStyled","styled","div","templateObject_1","__makeTemplateObject","_a","theme","breakpoint","tablet","props","spacing","Flex","spacingProps","spacingPropsToSpacingPropsInternal","React","createElement","__assign"],"mappings":"sOAcA,MAAMA,EAAaC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,6CAAA,mCAAA,MAAA,CAAa,6CAEmB,mCAGN,QAHhC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,MAAjB,EAGlC,SAACC,GAAU,OAAAC,EAAQD,EAAOA,EAAMH,MAArB,GAMT,SAAUK,EAAKF,GACnB,IAAMG,EAAeC,EAAmCJ,GAExD,OAAOK,EAAAC,cAACf,EAAUgB,EAAA,CAACV,MAAOG,EAAMH,OAAWM,GAC7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Fontface.js","sources":["../../../src/components/Fontface.ts"],"sourcesContent":["import { type CustomFontType } from \"../types\";\nimport { crukTheme } from \"../themes/cruk\";\nimport { rflTheme } from \"../themes/rfl\";\nimport { su2cTheme } from \"../themes/su2c\";\nimport { bowelbabeTheme } from \"../themes/bowelbabe\";\n\n// font-display fall back to stop font's flickering on SSR rehydration\nexport const buildCustomFonts = (customFonts: CustomFontType[]) =>\n customFonts\n .map(\n (font) => `\n @font-face {\n font-family: ${font.family};\n src: ${\n font?.urlWoff2 ? `url(\"${font.urlWoff2}\") format('woff2')` : \"\"\n }${!!font.urlWoff && !!font?.urlWoff2 ? \", \" : \"\"}\n ${font?.urlWoff ? `url(\"${font.urlWoff}\") format('woff')` : \"\"};\n font-weight: ${font.fontWeight || \"normal\"};\n font-style: normal;\n font-display: fallback;\n }\n `,\n )\n .join(\"\");\n\nexport const Fontface = `\n${buildCustomFonts(crukTheme.typography.customFonts)}\n${buildCustomFonts(rflTheme.typography.customFonts)}\n${buildCustomFonts(su2cTheme.typography.customFonts)}\n${buildCustomFonts(bowelbabeTheme.typography.customFonts)}\n`;\n\nexport default Fontface;\n"],"names":["buildCustomFonts","customFonts","map","font","concat","family","urlWoff2","urlWoff","fontWeight","join","Fontface","crukTheme","typography","rflTheme","su2cTheme","bowelbabeTheme"],"mappings":"gMAOO,IAAMA,EAAmB,SAACC,GAC/B,OAAAA,EACGC,IACC,SAACC,GAAS,MAAA,kDAAAC,OAESD,EAAKE,OAAM,sBAAAD,QAExBD,eAAAA,EAAMG,UAAW,QAAAF,OAAQD,EAAKG,gCAA+B,IAAEF,OAC5DD,EAAKI,UAAaJ,aAAI,EAAJA,EAAMG,UAAW,KAAO,2BAC7CH,aAAI,EAAJA,EAAMI,SAAU,QAAAH,OAAQD,EAAKI,QAAO,sBAAsB,GAAE,8BAAAH,OAC/CD,EAAKK,YAAc,SAAQ,yFAI7C,GAEFC,KAAK,GAfR,EAiBWC,EAAW,KAAAN,OACtBJ,EAAiBW,EAAUC,WAAWX,aAAY,MAAAG,OAClDJ,EAAiBa,EAASD,WAAWX,0BACrCD,EAAiBc,EAAUF,WAAWX,0BACtCD,EAAiBe,EAAeH,WAAWX"}
1
+ {"version":3,"file":"Fontface.js","sources":["../../../src/components/Fontface.ts"],"sourcesContent":["import { type CustomFontType } from \"../types\";\nimport { crukTheme } from \"../themes/cruk\";\nimport { rflTheme } from \"../themes/rfl\";\nimport { su2cTheme } from \"../themes/su2c\";\nimport { bowelbabeTheme } from \"../themes/bowelbabe\";\n\n// font-display fall back to stop font's flickering on SSR rehydration\nexport const buildCustomFonts = (customFonts: CustomFontType[]) =>\n customFonts\n .map(\n (font) => `\n @font-face {\n font-family: ${font.family};\n src: ${\n font?.urlWoff2 ? `url(\"${font.urlWoff2}\") format('woff2')` : \"\"\n }${!!font.urlWoff && !!font?.urlWoff2 ? \", \" : \"\"}\n ${font?.urlWoff ? `url(\"${font.urlWoff}\") format('woff')` : \"\"};\n font-weight: ${font.fontWeight || \"normal\"};\n font-style: normal;\n font-display: fallback;\n }\n `,\n )\n .join(\"\");\n\nexport const Fontface = `\n${buildCustomFonts(crukTheme.typography.customFonts)}\n${buildCustomFonts(rflTheme.typography.customFonts)}\n${buildCustomFonts(su2cTheme.typography.customFonts)}\n${buildCustomFonts(bowelbabeTheme.typography.customFonts)}\n`;\n\nexport default Fontface;\n"],"names":["buildCustomFonts","customFonts","map","font","concat","family","urlWoff2","urlWoff","fontWeight","join","Fontface","crukTheme","typography","rflTheme","su2cTheme","bowelbabeTheme"],"mappings":"gMAOO,IAAMA,EAAmB,SAACC,GAC/B,OAAAA,EACGC,IACC,SAACC,GAAS,MAAA,kDAAAC,OAESD,EAAKE,OAAM,sBAAAD,QAExBD,eAAAA,EAAMG,UAAW,QAAAF,OAAQD,EAAKG,gCAA+B,IAAEF,OAC5DD,EAAKI,UAAaJ,aAAI,EAAJA,EAAMG,UAAW,KAAO,2BAC7CH,aAAI,EAAJA,EAAMI,SAAU,QAAAH,OAAQD,EAAKI,QAAO,sBAAsB,GAAE,8BAAAH,OAC/CD,EAAKK,YAAc,SAAQ,yFAPpC,GAaXC,KAAK,GAfR,EAiBWC,EAAW,KAAAN,OACtBJ,EAAiBW,EAAUC,WAAWX,aAAY,MAAAG,OAClDJ,EAAiBa,EAASD,WAAWX,0BACrCD,EAAiBc,EAAUF,WAAWX,0BACtCD,EAAiBe,EAAeH,WAAWX"}
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as n,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{withTheme as t,createGlobalStyle as e}from"styled-components";import{crukTheme as i}from"../themes/cruk.js";var r,a=t(e(r||(r=n(["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"],["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"])),function(n){var t,e=o(o({},i),n.theme);return"\n ".concat((t=e.typography.customFonts,t.map(function(n){return"\n @font-face {\n font-family: ".concat(n.family,";\n src: ").concat((null==n?void 0:n.urlWoff2)?'url("'.concat(n.urlWoff2,"\") format('woff2')"):"").concat(n.urlWoff&&(null==n?void 0:n.urlWoff2)?", ":"","\n ").concat((null==n?void 0:n.urlWoff)?'url("'.concat(n.urlWoff,"\") format('woff')"):"",";\n font-weight: ").concat(null==n?void 0:n.fontWeight,";\n font-style: normal;\n font-display: fallback;\n }\n ")}).join("")),"\n html {\n font-size: ").concat(e.typography.fontSizeBase,";\n font-family: ").concat(e.typography.fontFamilyBase,";\n line-height: ").concat(e.typography.lineHeight,";\n }\n body {\n background-color: ").concat(e.colors.backgroundMidLight,";\n color: ").concat(e.colors.textDark,";\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n -webkit-text-size-adjust: 100%;\n -moz-text-size-adjust: none;\n -ms-text-size-adjust: 100%;\n }\n ")}));export{a as GlobalStyle,a as default};
1
+ import{__makeTemplateObject as n,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{withTheme as t,createGlobalStyle as e}from"styled-components";import{crukTheme as i}from"../themes/cruk.js";var r,a=t(e(r||(r=n(["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"],["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"])),function(n){var t,e=o(o({},i),n.theme);return"\n ".concat((t=e.typography.customFonts,t.map(function(n){return"\n @font-face {\n font-family: ".concat(n.family,";\n src: ").concat((null==n?void 0:n.urlWoff2)?'url("'.concat(n.urlWoff2,"\") format('woff2')"):"").concat(n.urlWoff&&(null==n?void 0:n.urlWoff2)?", ":"","\n ").concat((null==n?void 0:n.urlWoff)?'url("'.concat(n.urlWoff,"\") format('woff')"):"",";\n font-weight: ").concat(null==n?void 0:n.fontWeight,";\n font-style: normal;\n font-display: fallback;\n }\n ")}).join("")),"\n html {\n font-size: ").concat(e.typography.fontSizeBase,";\n font-family: ").concat(e.typography.fontFamilyBase,";\n line-height: ").concat(e.typography.lineHeight,";\n }\n body {\n background-color: ").concat(e.colors.backgroundMidLight,";\n color: ").concat(e.colors.textDark,';\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n -webkit-text-size-adjust: 100%;\n -moz-text-size-adjust: none;\n -ms-text-size-adjust: 100%;\n font-feature-settings: "kern";\n text-rendering: optimizeLegibility;\n font-smoothing: antialiased;\n }\n ')}));export{a as GlobalStyle,a as default};
2
2
  //# sourceMappingURL=GlobalStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStyle.js","sources":["../../../src/components/GlobalStyle.tsx"],"sourcesContent":["import { createGlobalStyle, withTheme } from \"styled-components\";\nimport { type CustomFontType } from \"../types\";\nimport { crukTheme as defaultTheme } from \"../themes/cruk\";\n\n// font-display fall back to stop font's flickering on SSR rehydration\nconst buildCustomFonts = (customFonts: CustomFontType[]) =>\n customFonts\n .map(\n (font) => `\n @font-face {\n font-family: ${font.family};\n src: ${\n font?.urlWoff2 ? `url(\"${font.urlWoff2}\") format('woff2')` : \"\"\n }${!!font.urlWoff && !!font?.urlWoff2 ? \", \" : \"\"}\n ${font?.urlWoff ? `url(\"${font.urlWoff}\") format('woff')` : \"\"};\n font-weight: ${font?.fontWeight};\n font-style: normal;\n font-display: fallback;\n }\n `,\n )\n .join(\"\");\n\nexport const GlobalStyle = withTheme(createGlobalStyle`\n ${(props) => {\n const theme = {\n ...defaultTheme,\n ...props.theme,\n };\n return `\n ${buildCustomFonts(theme.typography.customFonts)}\n html {\n font-size: ${theme.typography.fontSizeBase};\n font-family: ${theme.typography.fontFamilyBase};\n line-height: ${theme.typography.lineHeight};\n }\n body {\n background-color: ${theme.colors.backgroundMidLight};\n color: ${theme.colors.textDark};\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n -webkit-text-size-adjust: 100%;\n -moz-text-size-adjust: none;\n -ms-text-size-adjust: 100%;\n }\n `;\n }}\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n`);\n\nexport default GlobalStyle;\n"],"names":["GlobalStyle","withTheme","createGlobalStyle","templateObject_1","__makeTemplateObject","props","customFonts","theme","defaultTheme","typography","map","font","concat","family","urlWoff2","urlWoff","fontWeight","join","fontSizeBase","fontFamilyBase","lineHeight","colors","backgroundMidLight","textDark"],"mappings":"8MAKA,MAkBaA,EAAcC,EAAUC,EAAiBC,IAAAA,EAAAC,EAAA,CAAA,OAAA,4sBAAA,CAAA,OAwBnD,8sBAvBC,SAACC,GACD,IApBsBC,EAoBhBC,SACDC,GACAH,EAAME,OAEX,MAAO,mBAxBeD,EAyBDC,EAAME,WAAWH,YAxBxCA,EACGI,IACC,SAACC,GAAS,MAAA,kDAAAC,OAESD,EAAKE,qCAElBF,aAAI,EAAJA,EAAMG,UAAW,QAAAF,OAAQD,EAAKG,SAAQ,uBAAuB,IAAEF,OAC5DD,EAAKI,UAAaJ,aAAI,EAAJA,EAAMG,UAAW,KAAO,GAAE,gBAAAF,QAC/CD,eAAAA,EAAMI,SAAU,QAAAH,OAAQD,EAAKI,8BAA6B,GAAE,8BAAAH,OAC/CD,eAAAA,EAAMK,WAAU,yFAIlC,GAEFC,KAAK,KAS4C,uCAAAL,OAEjCL,EAAME,WAAWS,aAAY,4BAAAN,OAC3BL,EAAME,WAAWU,eAAc,4BAAAP,OAC/BL,EAAME,WAAWW,WAAU,wDAAAR,OAGtBL,EAAMc,OAAOC,gDACxBf,EAAMc,OAAOE,sNAS5B"}
1
+ {"version":3,"file":"GlobalStyle.js","sources":["../../../src/components/GlobalStyle.tsx"],"sourcesContent":["import { createGlobalStyle, withTheme } from \"styled-components\";\nimport { type CustomFontType } from \"../types\";\nimport { crukTheme as defaultTheme } from \"../themes/cruk\";\n\n// font-display fall back to stop font's flickering on SSR rehydration\nconst buildCustomFonts = (customFonts: CustomFontType[]) =>\n customFonts\n .map(\n (font) => `\n @font-face {\n font-family: ${font.family};\n src: ${\n font?.urlWoff2 ? `url(\"${font.urlWoff2}\") format('woff2')` : \"\"\n }${!!font.urlWoff && !!font?.urlWoff2 ? \", \" : \"\"}\n ${font?.urlWoff ? `url(\"${font.urlWoff}\") format('woff')` : \"\"};\n font-weight: ${font?.fontWeight};\n font-style: normal;\n font-display: fallback;\n }\n `,\n )\n .join(\"\");\n\nexport const GlobalStyle = withTheme(createGlobalStyle`\n ${(props) => {\n const theme = {\n ...defaultTheme,\n ...props.theme,\n };\n return `\n ${buildCustomFonts(theme.typography.customFonts)}\n html {\n font-size: ${theme.typography.fontSizeBase};\n font-family: ${theme.typography.fontFamilyBase};\n line-height: ${theme.typography.lineHeight};\n }\n body {\n background-color: ${theme.colors.backgroundMidLight};\n color: ${theme.colors.textDark};\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n -webkit-text-size-adjust: 100%;\n -moz-text-size-adjust: none;\n -ms-text-size-adjust: 100%;\n font-feature-settings: \"kern\";\n text-rendering: optimizeLegibility;\n font-smoothing: antialiased;\n }\n `;\n }}\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n`);\n\nexport default GlobalStyle;\n"],"names":["GlobalStyle","withTheme","createGlobalStyle","templateObject_1","__makeTemplateObject","props","customFonts","theme","defaultTheme","typography","map","font","concat","family","urlWoff2","urlWoff","fontWeight","join","fontSizeBase","fontFamilyBase","lineHeight","colors","backgroundMidLight","textDark"],"mappings":"8MAKA,MAkBaA,EAAcC,EAAUC,EAAiBC,IAAAA,EAAAC,EAAA,CAAA,OAAA,4sBAAA,CAAA,OA2BnD,8sBA1BC,SAACC,GACD,IApBsBC,EAoBhBC,SACDC,GACAH,EAAME,OAEX,MAAO,mBAxBeD,EAyBDC,EAAME,WAAWH,YAxBxCA,EACGI,IACC,SAACC,GAAS,MAAA,kDAAAC,OAESD,EAAKE,qCAElBF,aAAI,EAAJA,EAAMG,UAAW,QAAAF,OAAQD,EAAKG,SAAQ,uBAAuB,IAAEF,OAC5DD,EAAKI,UAAaJ,aAAI,EAAJA,EAAMG,UAAW,KAAO,GAAE,gBAAAF,QAC/CD,eAAAA,EAAMI,SAAU,QAAAH,OAAQD,EAAKI,8BAA6B,GAAE,8BAAAH,OAC/CD,eAAAA,EAAMK,WAAU,yFAPzB,GAaXC,KAAK,KAS4C,uCAAAL,OAEjCL,EAAME,WAAWS,aAAY,4BAAAN,OAC3BL,EAAME,WAAWU,eAAc,4BAAAP,OAC/BL,EAAME,WAAWW,WAAU,wDAAAR,OAGtBL,EAAMc,OAAOC,gDACxBf,EAAMc,OAAOE,iVAY5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Header/index.tsx"],"sourcesContent":["import React, { useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { useScrollPosition } from \"../../hooks/useScrollPosition\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport {\n StyledHeader,\n HeaderStickyContainer,\n HeaderStickyPlaceHolder,\n HeaderMainContent,\n SkipToMain,\n StyledLink,\n Logo,\n LogoWrapper,\n Tagline,\n ChildWrapper,\n ChildInner,\n} from \"./styles\";\n\nconst HEADER_SCROLL_THRESHOLD = 240;\n\nexport type HeaderProps = HTMLAttributes<HTMLElement> & {\n /** flag which make header fixed to the top even when scrolling */\n isSticky?: boolean;\n /** text in the middle of the header */\n siteSlogan?: string;\n /** text to explain the content of the icon for a11y usually a description of where the link will take you */\n logoAltText?: string;\n /** header logo image url */\n logoImageSrc?: string;\n /** title of the header image component, this is mainly for the tooltip text on hover */\n logoLinkTitle?: string;\n /** the url of the logo link */\n logoLinkUrl?: string;\n /** instead of the contents of the header being centered to max width as defined in theme it is 100% width fo viewport */\n fullWidth?: boolean;\n\n children?: ReactNode;\n};\n\n/**\n * There should be only one header component near or at the top of the body of each page.\n *\n * ### Logos\n * It is recommended that logo images are at least 80px high if they are not SVGs and that the logo is still clearly legible when reduced to 40px high for mobile.\n * It is also recommended that the logo width doesn't exceed 350px. If you need a wide logo that is shorter than 80px to keep the aspect ratio please make sure that the logo is centered with transparent space at the top and bottom and still 80px high.\n *\n * ### Site Slogan Text (optional)\n * This is a single line of text and the character limit depends on the theme, logo and children width. This is only visible on desktop at the top of the page\n *\n * ### Right section (optional)\n * This has been kept quite open you can place any child elements in here but ideally it is narrow and its height is 50px or smaller.\n *\n * ### Accessability\n * There is a hidden skip link in the header which will only reveals itself on the first tab and to screen readers. This link helps users skip to the main page content, however this will only work with there is an element with an id of 'main' which the developer should create for every page.\n *\n */\nexport function Header({\n isSticky,\n siteSlogan,\n logoAltText,\n logoImageSrc,\n logoLinkTitle,\n logoLinkUrl,\n fullWidth,\n children,\n}: HeaderProps) {\n const [isSmall, setIsSmall] = useState(false);\n const isBrowser = typeof window !== `undefined`;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n useScrollPosition(\n ({\n currPos,\n }: {\n prevPos: { x: number; y: number };\n currPos: { x: number; y: number };\n }) => {\n const shouldShrink = isBrowser\n ? currPos.y > HEADER_SCROLL_THRESHOLD\n : false;\n if (shouldShrink !== isSmall) {\n setIsSmall(shouldShrink);\n }\n },\n [isSmall],\n null,\n true,\n 50,\n );\n\n return (\n <ThemeProvider theme={theme}>\n <StyledHeader>\n <HeaderStickyPlaceHolder>\n <HeaderStickyContainer\n data-testid=\"header-sticky-container\"\n $isSmall={isSmall}\n $isSticky={isSticky}\n >\n <SkipToMain href=\"#main\">Skip to main content</SkipToMain>\n <HeaderMainContent $fullWidth={fullWidth}>\n <StyledLink\n href={logoLinkUrl ?? theme.siteConfig.logoUrl}\n title={logoLinkTitle ?? \"Home\"}\n >\n <LogoWrapper $isSmall={isSmall} $isSticky={isSticky}>\n <Logo\n height={80}\n src={logoImageSrc ?? theme.siteConfig.logoSrc}\n alt={logoAltText ?? theme.siteConfig.logoAlt}\n />\n </LogoWrapper>\n </StyledLink>\n {siteSlogan ? (\n <Tagline $isSmall={isSmall} $isSticky={isSticky}>\n {siteSlogan}\n </Tagline>\n ) : null}\n <ChildWrapper>\n <ChildInner>{children}</ChildInner>\n </ChildWrapper>\n </HeaderMainContent>\n </HeaderStickyContainer>\n </HeaderStickyPlaceHolder>\n </StyledHeader>\n </ThemeProvider>\n );\n}\n\nexport default Header;\n"],"names":["Header","_a","isSticky","siteSlogan","logoAltText","logoImageSrc","logoLinkTitle","logoLinkUrl","fullWidth","children","_b","useState","isSmall","setIsSmall","isBrowser","window","foundTheme","useTheme","theme","__assign","defaultTheme","useScrollPosition","currPos","shouldShrink","y","React","createElement","ThemeProvider","StyledHeader","HeaderStickyPlaceHolder","HeaderStickyContainer","$isSmall","SkipToMain","href","HeaderMainContent","StyledLink","siteConfig","logoUrl","title","LogoWrapper","$isSticky","Logo","height","src","logoSrc","alt","logoAlt","Tagline","ChildWrapper","ChildInner"],"mappings":"6eA0DM,SAAUA,EAAOC,OACrBC,EAAQD,EAAAC,SACRC,EAAUF,EAAAE,WACVC,EAAWH,EAAAG,YACXC,EAAYJ,EAAAI,aACZC,EAAaL,EAAAK,cACbC,EAAWN,EAAAM,YACXC,EAASP,EAAAO,UACTC,EAAQR,EAAAQ,SAEFC,EAAwBC,GAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAA8B,oBAAXC,OACnBC,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAuBL,OApBAK,EACE,SAACpB,GACC,IAAAqB,EAAOrB,EAAAqB,QAKDC,IAAeT,GACjBQ,EAAQE,EAhEc,IAkEtBD,IAAiBX,GACnBC,EAAWU,IAGf,CAACX,GACD,MACA,EACA,IAIAa,EAAAC,cAACC,EAAa,CAACT,MAAOA,GACpBO,EAAAC,cAACE,EAAY,KACXH,EAAAC,cAACG,EAAuB,KACtBJ,EAAAC,cAACI,EAAqB,CAAA,cACR,0BAAyBC,SAC3BnB,YACCV,GAEXuB,EAAAC,cAACM,EAAU,CAACC,KAAK,SAAO,wBACxBR,EAAAC,cAACQ,cAA8B1B,GAC7BiB,EAAAC,cAACS,EAAU,CACTF,KAAM1B,QAAAA,EAAeW,EAAMkB,WAAWC,QACtCC,MAAOhC,QAAAA,EAAiB,QAExBmB,EAAAC,cAACa,EAAW,CAAAR,SAAWnB,EAAO4B,UAAatC,GACzCuB,EAAAC,cAACe,EAAI,CACHC,OAAQ,GACRC,IAAKtC,QAAAA,EAAgBa,EAAMkB,WAAWQ,QACtCC,IAAKzC,QAAAA,EAAec,EAAMkB,WAAWU,YAI1C3C,EACCsB,EAAAC,cAACqB,EAAO,CAAAhB,SAAWnB,EAAO4B,UAAatC,GACpCC,GAED,KACJsB,EAAAC,cAACsB,EAAY,KACXvB,EAAAC,cAACuB,EAAU,KAAExC,QAQ7B"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Header/index.tsx"],"sourcesContent":["import React, { useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { useScrollPosition } from \"../../hooks/useScrollPosition\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport {\n StyledHeader,\n HeaderStickyContainer,\n HeaderStickyPlaceHolder,\n HeaderMainContent,\n SkipToMain,\n StyledLink,\n Logo,\n LogoWrapper,\n Tagline,\n ChildWrapper,\n ChildInner,\n} from \"./styles\";\n\nconst HEADER_SCROLL_THRESHOLD = 240;\n\nexport type HeaderProps = HTMLAttributes<HTMLElement> & {\n /** flag which make header fixed to the top even when scrolling */\n isSticky?: boolean;\n /** text in the middle of the header */\n siteSlogan?: string;\n /** text to explain the content of the icon for a11y usually a description of where the link will take you */\n logoAltText?: string;\n /** header logo image url */\n logoImageSrc?: string;\n /** title of the header image component, this is mainly for the tooltip text on hover */\n logoLinkTitle?: string;\n /** the url of the logo link */\n logoLinkUrl?: string;\n /** instead of the contents of the header being centered to max width as defined in theme it is 100% width fo viewport */\n fullWidth?: boolean;\n\n children?: ReactNode;\n};\n\n/**\n * There should be only one header component near or at the top of the body of each page.\n *\n * ### Logos\n * It is recommended that logo images are at least 80px high if they are not SVGs and that the logo is still clearly legible when reduced to 40px high for mobile.\n * It is also recommended that the logo width doesn't exceed 350px. If you need a wide logo that is shorter than 80px to keep the aspect ratio please make sure that the logo is centered with transparent space at the top and bottom and still 80px high.\n *\n * ### Site Slogan Text (optional)\n * This is a single line of text and the character limit depends on the theme, logo and children width. This is only visible on desktop at the top of the page\n *\n * ### Right section (optional)\n * This has been kept quite open you can place any child elements in here but ideally it is narrow and its height is 50px or smaller.\n *\n * ### Accessability\n * There is a hidden skip link in the header which will only reveals itself on the first tab and to screen readers. This link helps users skip to the main page content, however this will only work with there is an element with an id of 'main' which the developer should create for every page.\n *\n */\nexport function Header({\n isSticky,\n siteSlogan,\n logoAltText,\n logoImageSrc,\n logoLinkTitle,\n logoLinkUrl,\n fullWidth,\n children,\n}: HeaderProps) {\n const [isSmall, setIsSmall] = useState(false);\n const isBrowser = typeof window !== `undefined`;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n useScrollPosition(\n ({\n currPos,\n }: {\n prevPos: { x: number; y: number };\n currPos: { x: number; y: number };\n }) => {\n const shouldShrink = isBrowser\n ? currPos.y > HEADER_SCROLL_THRESHOLD\n : false;\n if (shouldShrink !== isSmall) {\n setIsSmall(shouldShrink);\n }\n },\n [isSmall],\n null,\n true,\n 50,\n );\n\n return (\n <ThemeProvider theme={theme}>\n <StyledHeader>\n <HeaderStickyPlaceHolder>\n <HeaderStickyContainer\n data-testid=\"header-sticky-container\"\n $isSmall={isSmall}\n $isSticky={isSticky}\n >\n <SkipToMain href=\"#main\">Skip to main content</SkipToMain>\n <HeaderMainContent $fullWidth={fullWidth}>\n <StyledLink\n href={logoLinkUrl ?? theme.siteConfig.logoUrl}\n title={logoLinkTitle ?? \"Home\"}\n >\n <LogoWrapper $isSmall={isSmall} $isSticky={isSticky}>\n <Logo\n height={80}\n src={logoImageSrc ?? theme.siteConfig.logoSrc}\n alt={logoAltText ?? theme.siteConfig.logoAlt}\n />\n </LogoWrapper>\n </StyledLink>\n {siteSlogan ? (\n <Tagline $isSmall={isSmall} $isSticky={isSticky}>\n {siteSlogan}\n </Tagline>\n ) : null}\n <ChildWrapper>\n <ChildInner>{children}</ChildInner>\n </ChildWrapper>\n </HeaderMainContent>\n </HeaderStickyContainer>\n </HeaderStickyPlaceHolder>\n </StyledHeader>\n </ThemeProvider>\n );\n}\n\nexport default Header;\n"],"names":["Header","_a","isSticky","siteSlogan","logoAltText","logoImageSrc","logoLinkTitle","logoLinkUrl","fullWidth","children","_b","useState","isSmall","setIsSmall","isBrowser","window","foundTheme","useTheme","theme","__assign","defaultTheme","useScrollPosition","currPos","shouldShrink","y","React","createElement","ThemeProvider","StyledHeader","HeaderStickyPlaceHolder","HeaderStickyContainer","$isSmall","SkipToMain","href","HeaderMainContent","StyledLink","siteConfig","logoUrl","title","LogoWrapper","$isSticky","Logo","height","src","logoSrc","alt","logoAlt","Tagline","ChildWrapper","ChildInner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../../src/components/Heading/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\n\nimport {\n type ThemeType,\n type FontSizeType,\n type ColorKeyType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\n\ntype StyledHeadingProps = SpacingPropsInternal & {\n theme: ThemeType;\n $textSize?: FontSizeType;\n $textAlign?: \"left\" | \"right\" | \"center\";\n $textColor?: string;\n $wordBreak?: WordBreakType;\n $overflowWrap?: OverflowWrapType;\n};\n\nconst StyledHeading = (props: StyledHeadingProps) => css`\n font-family: ${props.theme.typography.fontFamilyHeadings};\n font-weight: ${props.theme.typography.fontWeightHeadings};\n word-break: ${props.$wordBreak || \"normal\"};\n overflow-wrap: ${props.$overflowWrap || \"break-word\"};\n color: ${props.$textColor &&\n typeof props.theme.colors[props.$textColor as ColorKeyType] !== \"undefined\"\n ? props.theme.colors[props.$textColor as ColorKeyType]\n : props.$textColor || props.theme.colors.textHeaderDefault};\n line-height: ${props.theme.typography.headerLineHeight};\n text-transform: ${props.theme.typography.headerTextTransform};\n margin-top: ${props.theme.spacing.m};\n margin-bottom: ${props.theme.spacing.s};\n max-width: 100%;\n text-align: ${props.$textAlign || \"left\"};\n\n &:first-child {\n margin-top: 0;\n }\n\n ${() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { theme, ...propsWithoutTheme } = props;\n\n return spacing(propsWithoutTheme, props.theme);\n }}\n`;\n\nconst desktopFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.xl;\n case \"xxl\":\n return theme.fontSizes.xxl;\n case \"xxxl\":\n return theme.fontSizes.xxxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down a size on the typography scale\nconst tabletFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.xl;\n case \"xxxl\":\n return theme.fontSizes.xxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down two sizes on the typography scale\nconst mobileFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.l;\n case \"xxxl\":\n return theme.fontSizes.xl;\n case \"xxxxl\":\n return theme.fontSizes.xxl;\n\n default:\n return defaultFontSize;\n }\n};\n\nexport const H1 = styled.h1<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxxl, theme)};\n }\n`;\n\nexport const H2 = styled.h2<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n`;\n\nexport const H3 = styled.h3<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n`;\n\nexport const H4 = styled.h4<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n`;\n\nexport const H5 = styled.h5<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n`;\n\nexport const H6 = styled.h6<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.m, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n`;\n"],"names":["StyledHeading","props","css","templateObject_1","__makeTemplateObject","theme","typography","fontFamilyHeadings","fontWeightHeadings","$wordBreak","$overflowWrap","$textColor","colors","textHeaderDefault","headerLineHeight","headerTextTransform","spacing","m","s","$textAlign","propsWithoutTheme","__rest","desktopFontSize","$textSize","defaultFontSize","fontSizes","l","xl","xxl","xxxl","xxxxl","tabletFontSize","mobileFontSize","H1","styled","h1","templateObject_2","_a","breakpoint","tablet","desktop","H2","h2","templateObject_3","H3","h3","templateObject_4","H4","h4","templateObject_5","H5","h5","templateObject_6","H6","h6","templateObject_7"],"mappings":"qLAqBA,kBAAMA,EAAgB,SAACC,GAA8B,OAAAC,EAAGC,IAAAA,EAAAC,EAAA,CAAA,oBAAA,qBAAA,oBAAA,uBAAA,eAAA,qBAAA,wBAAA,oBAAA,uBAAA,wCAAA,wDAAA,MAAA,CAAA,oBACE,qBACA,oBACd,uBACU,eAIQ,qBACN,wBACM,oBACzB,uBACG,wCAEE,wDAWvC,QAxBcH,EAAMI,MAAMC,WAAWC,mBACvBN,EAAMI,MAAMC,WAAWE,mBACxBP,EAAMQ,YAAc,SACjBR,EAAMS,eAAiB,aAC/BT,EAAMU,iBACiD,IAAzDV,EAAMI,MAAMO,OAAOX,EAAMU,YAC5BV,EAAMI,MAAMO,OAAOX,EAAMU,YACzBV,EAAMU,YAAcV,EAAMI,MAAMO,OAAOC,kBAC5BZ,EAAMI,MAAMC,WAAWQ,iBACpBb,EAAMI,MAAMC,WAAWS,oBAC3Bd,EAAMI,MAAMW,QAAQC,EACjBhB,EAAMI,MAAMW,QAAQE,EAEvBjB,EAAMkB,YAAc,OAMhC,WAEwClB,EAAKI,MAAhC,IAAKe,EAAiBC,EAAKpB,EAAlC,CAAA,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AhC,MAAaiC,WAAWE,OAAjB,EACrB,SAACH,OAAEhC,EAAKgC,EAAAhC,MAAEkB,EAASc,EAAAd,UAC9B,OAAAD,EAAgBC,GAAa,KAAMlB,EAAMoB,UAAUR,EAAGZ,EAAtD"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Heading/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\n\nimport {\n type ThemeType,\n type FontSizeType,\n type ColorKeyType,\n type WordBreakType,\n type OverflowWrapType,\n} from \"../../types\";\n\ntype StyledHeadingProps = SpacingPropsInternal & {\n theme: ThemeType;\n $textSize?: FontSizeType;\n $textAlign?: \"left\" | \"right\" | \"center\";\n $textColor?: string;\n $wordBreak?: WordBreakType;\n $overflowWrap?: OverflowWrapType;\n};\n\nconst StyledHeading = (props: StyledHeadingProps) => css`\n font-family: ${props.theme.typography.fontFamilyHeadings};\n font-weight: ${props.theme.typography.fontWeightHeadings};\n word-break: ${props.$wordBreak || \"normal\"};\n overflow-wrap: ${props.$overflowWrap || \"break-word\"};\n color: ${props.$textColor &&\n typeof props.theme.colors[props.$textColor as ColorKeyType] !== \"undefined\"\n ? props.theme.colors[props.$textColor as ColorKeyType]\n : props.$textColor || props.theme.colors.textHeaderDefault};\n line-height: ${props.theme.typography.headerLineHeight};\n text-transform: ${props.theme.typography.headerTextTransform};\n margin-top: ${props.theme.spacing.m};\n margin-bottom: ${props.theme.spacing.s};\n max-width: 100%;\n text-align: ${props.$textAlign || \"left\"};\n\n &:first-child {\n margin-top: 0;\n }\n\n ${() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { theme, ...propsWithoutTheme } = props;\n\n return spacing(propsWithoutTheme, props.theme);\n }}\n`;\n\nconst desktopFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.xl;\n case \"xxl\":\n return theme.fontSizes.xxl;\n case \"xxxl\":\n return theme.fontSizes.xxxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down a size on the typography scale\nconst tabletFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.xl;\n case \"xxxl\":\n return theme.fontSizes.xxl;\n case \"xxxxl\":\n return theme.fontSizes.xxxl;\n\n default:\n return defaultFontSize;\n }\n};\n\n// everything drops down two sizes on the typography scale\nconst mobileFontSize = (\n $textSize: FontSizeType | null,\n defaultFontSize: string,\n theme: ThemeType,\n) => {\n switch ($textSize) {\n case \"m\":\n return theme.fontSizes.m;\n case \"l\":\n return theme.fontSizes.l;\n case \"xl\":\n return theme.fontSizes.l;\n case \"xxl\":\n return theme.fontSizes.l;\n case \"xxxl\":\n return theme.fontSizes.xl;\n case \"xxxxl\":\n return theme.fontSizes.xxl;\n\n default:\n return defaultFontSize;\n }\n};\n\nexport const H1 = styled.h1<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxxl, theme)};\n }\n`;\n\nexport const H2 = styled.h2<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.xl, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxxl, theme)};\n }\n`;\n\nexport const H3 = styled.h3<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xxl, theme)};\n }\n`;\n\nexport const H4 = styled.h4<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.xl, theme)};\n }\n`;\n\nexport const H5 = styled.h5<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.l, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.l, theme)};\n }\n`;\n\nexport const H6 = styled.h6<StyledHeadingProps>`\n ${(props) => StyledHeading(props)}\n\n font-size: ${({ theme, $textSize }) =>\n mobileFontSize($textSize || null, theme.fontSizes.m, theme)};\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n font-size: ${({ theme, $textSize }) =>\n tabletFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n font-size: ${({ theme, $textSize }) =>\n desktopFontSize($textSize || null, theme.fontSizes.m, theme)};\n }\n`;\n"],"names":["StyledHeading","props","css","templateObject_1","__makeTemplateObject","theme","typography","fontFamilyHeadings","fontWeightHeadings","$wordBreak","$overflowWrap","$textColor","colors","textHeaderDefault","headerLineHeight","headerTextTransform","spacing","m","s","$textAlign","propsWithoutTheme","__rest","desktopFontSize","$textSize","defaultFontSize","fontSizes","l","xl","xxl","xxxl","xxxxl","tabletFontSize","mobileFontSize","H1","styled","h1","templateObject_2","_a","breakpoint","tablet","desktop","H2","h2","templateObject_3","H3","h3","templateObject_4","H4","h4","templateObject_5","H5","h5","templateObject_6","H6","h6","templateObject_7"],"mappings":"qLAqBA,kBAAMA,EAAgB,SAACC,GAA8B,OAAAC,EAAGC,IAAAA,EAAAC,EAAA,CAAA,oBAAA,qBAAA,oBAAA,uBAAA,eAAA,qBAAA,wBAAA,oBAAA,uBAAA,wCAAA,wDAAA,MAAA,CAAA,oBACE,qBACA,oBACd,uBACU,eAIQ,qBACN,wBACM,oBACzB,uBACG,wCAEE,wDAWvC,QAxBcH,EAAMI,MAAMC,WAAWC,mBACvBN,EAAMI,MAAMC,WAAWE,mBACxBP,EAAMQ,YAAc,SACjBR,EAAMS,eAAiB,aAC/BT,EAAMU,iBACiD,IAAzDV,EAAMI,MAAMO,OAAOX,EAAMU,YAC5BV,EAAMI,MAAMO,OAAOX,EAAMU,YACzBV,EAAMU,YAAcV,EAAMI,MAAMO,OAAOC,kBAC5BZ,EAAMI,MAAMC,WAAW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AhC,MAAaiC,WAAWC,MAAjB,EACrB,SAACF,OAAEhC,EAAKgC,EAAAhC,MAAEkB,EAASc,EAAAd,UAC9B,OAAAQ,EAAeR,GAAa,KAAMlB,EAAMoB,UAAUR,EAAGZ,EAArD,EAEiB,SAACgC,GAAc,OAAPA,EAAAhC,MAAaiC,WAAWE,OAAjB,EACrB,SAACH,OAAEhC,EAAKgC,EAAAhC,MAAEkB,EAASc,EAAAd,UAC9B,OAAAD,EAAgBC,GAAa,KAAMlB,EAAMoB,UAAUR,EAAGZ,EAAtD"}
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{useTheme as t}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{StyledIcon as m}from"./styles.js";import{themeColorOrString as s,themeSizeOrString as i}from"../../utils/themeUtils.js";function c(c){var n=c.faIcon,l=c.color,a=c.size,p=void 0===a?"1.1rem":a,f=t(),d=e(e({},r),f),u=n.icon,h=u[0],j=u[1],v=u[4];return o.createElement(m,{theme:d,role:"presentation",viewBox:"0 0 ".concat(h," ").concat(j),$size:i(p,d),$color:s(l,d)},v&&o.createElement("path",{d:v}))}export{c as IconFa,c as default};
1
+ import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{useTheme as t}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{StyledIcon as m}from"./styles.js";import{themeColorOrString as s,themeSizeOrString as i}from"../../utils/themeUtils.js";function c(c){var n=c.faIcon,l=c.color,a=c.size,p=void 0===a?"1rem":a,f=t(),d=e(e({},r),f),u=n.icon,h=u[0],j=u[1],v=u[4];return o.createElement(m,{theme:d,role:"presentation",viewBox:"0 0 ".concat(h," ").concat(j),$size:i(p,d),$color:s(l,d)},v&&o.createElement("path",{d:v}))}export{c as IconFa,c as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\nimport { themeColorOrString, themeSizeOrString } from \"../../utils/themeUtils\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({ faIcon, color, size = \"1.1rem\" }: IconFaProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const [width, height, , , svgPathData] = faIcon.icon;\n\n return (\n <StyledIcon\n theme={theme}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n $size={themeSizeOrString(size, theme)}\n $color={themeColorOrString(color, theme)}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </StyledIcon>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","_a","faIcon","color","_b","size","foundTheme","useTheme","theme","__assign","defaultTheme","_c","icon","width","height","svgPathData","React","createElement","StyledIcon","role","viewBox","concat","$size","themeSizeOrString","$color","themeColorOrString","d"],"mappings":"sTAsBM,SAAUA,EAAOC,OAAEC,EAAMD,EAAAC,OAAEC,EAAKF,EAAAE,MAAEC,SAAAC,OAAI,IAAAD,EAAG,SAAQA,EAC/CE,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAECK,EAAmCT,EAAOU,KAAzCC,EAAKF,EAAA,GAAEG,EAAMH,EAAA,GAAMI,OAE1B,OACEC,EAAAC,cAACC,GACCV,MAAOA,EACPW,KAAK,eACLC,QAAS,OAAAC,OAAOR,EAAK,KAAAQ,OAAIP,GAAQQ,MAC1BC,EAAkBlB,EAAMG,GAAMgB,OAC7BC,EAAmBtB,EAAOK,IAEjCO,GAAeC,wBAAMU,EAAGX,IAG/B"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\nimport { themeColorOrString, themeSizeOrString } from \"../../utils/themeUtils\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({ faIcon, color, size = \"1rem\" }: IconFaProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const [width, height, , , svgPathData] = faIcon.icon;\n\n return (\n <StyledIcon\n theme={theme}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n $size={themeSizeOrString(size, theme)}\n $color={themeColorOrString(color, theme)}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </StyledIcon>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","_a","faIcon","color","_b","size","foundTheme","useTheme","theme","__assign","defaultTheme","_c","icon","width","height","svgPathData","React","createElement","StyledIcon","role","viewBox","concat","$size","themeSizeOrString","$color","themeColorOrString","d"],"mappings":"sTAsBM,SAAUA,EAAOC,OAAEC,EAAMD,EAAAC,OAAEC,EAAKF,EAAAE,MAAEC,SAAAC,OAAI,IAAAD,EAAG,OAAMA,EAC7CE,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAECK,EAAmCT,EAAOU,KAAzCC,EAAKF,EAAA,GAAEG,EAAMH,EAAA,GAAMI,OAE1B,OACEC,EAAAC,cAACC,GACCV,MAAOA,EACPW,KAAK,eACLC,QAAS,OAAAC,OAAOR,EAAK,KAAAQ,OAAIP,GAAQQ,MAC1BC,EAAkBlB,EAAMG,GAAMgB,OAC7BC,EAAmBtB,EAAOK,IAEjCO,GAAeC,wBAAMU,EAAGX,IAG/B"}
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";var t,e=i.svg(t||(t=n(["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"],["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"])),function(n){return n.$size},function(n){return n.$size},function(n){return n.$color});export{e as StyledIcon,e as default};
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";var l,t=i.svg(l||(l=n(["\n display: inline-block;\n vertical-align: middle;\n height: ",";\n width: ",";\n path {\n fill: ",";\n }\n"],["\n display: inline-block;\n vertical-align: middle;\n height: ",";\n width: ",";\n path {\n fill: ",";\n }\n"])),function(n){return n.$size},function(n){return n.$size},function(n){return n.$color});export{t as StyledIcon,t as default};
2
2
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const StyledIcon = styled.svg<{\n theme: ThemeType;\n $color?: string;\n $size: string;\n}>`\n display: inline-block;\n height: ${({ $size }) => $size};\n margin-top: -0.2em;\n vertical-align: middle;\n width: ${({ $size }) => $size};\n path {\n fill: ${({ $color }) => $color};\n }\n`;\n\nexport default StyledIcon;\n"],"names":["StyledIcon","styled","svg","templateObject_1","__makeTemplateObject","_a","$size","$color"],"mappings":"iHAGO,MAAMA,EAAaC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,iEAAA,0BAAA,YAAA,CAIlC,yCAE8B,iEAGD,0BAEG,cALtB,SAACC,GAAc,OAAPA,EAAAC,KAAO,EAGhB,SAACD,GAAc,OAAPA,EAAAC,KAAO,EAEd,SAACD,GAAe,OAAPA,EAAAE,MAAO"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const StyledIcon = styled.svg<{\n theme: ThemeType;\n $color?: string;\n $size: string;\n}>`\n display: inline-block;\n vertical-align: middle;\n height: ${({ $size }) => $size};\n width: ${({ $size }) => $size};\n path {\n fill: ${({ $color }) => $color};\n }\n`;\n\nexport default StyledIcon;\n"],"names":["StyledIcon","styled","svg","templateObject_1","__makeTemplateObject","_a","$size","$color"],"mappings":"iHAGO,MAAMA,EAAaC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,oEAAA,eAAA,0BAAA,YAAA,CAIlC,oEAG8B,eACD,0BAEG,cAHtB,SAACC,GAAc,OAAPA,EAAAC,KAAO,EAChB,SAACD,GAAc,OAAPA,EAAAC,KAAO,EAEd,SAACD,GAAe,OAAPA,EAAAE,MAAO"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{useTheme as n,ThemeProvider as i}from"styled-components";import{Text as l}from"../Text/index.js";import{crukTheme as o}from"../../themes/cruk.js";import{Label as m,LabelText as a,RequiredIndicationText as d}from"./styles.js";function s(s){var c=s.label,u=s.hintText,p=s.required,f=void 0!==p&&p,h=s.hideRequiredIndicationInLabel,b=void 0!==h&&h,x=s.children,E=e(s,["label","hintText","required","hideRequiredIndicationInLabel","children"]),j=n(),q=t(t({},o),j),y=u&&("string"==typeof u&&u.length||"number"==typeof u)?r.createElement(l,null,u):u;return r.createElement(i,{theme:q},c?r.createElement(m,t({},E),r.createElement(a,{$hasHintText:!!u},c,!f&&!b&&r.createElement(d,null," (optional)")),y,x):r.createElement(r.Fragment,null,x))}export{s as LabelWrapper,s as default};
1
+ import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{useTheme as n,ThemeProvider as l}from"styled-components";import{crukTheme as i}from"../../themes/cruk.js";import{HintText as o,Label as m,LabelText as a,RequiredIndicationText as d}from"./styles.js";function s(s){var c=s.label,u=s.hintText,h=s.required,p=void 0!==h&&h,f=s.hideRequiredIndicationInLabel,b=void 0!==f&&f,E=s.children,q=e(s,["label","hintText","required","hideRequiredIndicationInLabel","children"]),x=n(),y=t(t({},i),x),I=u&&("string"==typeof u&&u.length||"number"==typeof u)?r.createElement(o,null,u):u;return r.createElement(l,{theme:y},c?r.createElement(m,t({},q),r.createElement(a,{$hasHintText:!!u},c,!p&&!b&&r.createElement(d,null," (optional)")),I,E):r.createElement(r.Fragment,null,E))}export{s as LabelWrapper,s as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/LabelWrapper/index.tsx"],"sourcesContent":["import React, { type LabelHTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { Text } from \"../Text\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { LabelText, Label, RequiredIndicationText } from \"./styles\";\n\ntype LabelWrapperProps = LabelHTMLAttributes<HTMLLabelElement> & {\n /** label text */\n label: string;\n /** hint text or react element in it's place */\n hintText?: ReactNode;\n /** if field is required, when not required (optional) appears in label */\n required?: boolean;\n /** flag to stop (optional) appearing in label, useful for compound form components like DateInput */\n hideRequiredIndicationInLabel?: boolean;\n children?: ReactNode;\n};\n\nexport function LabelWrapper({\n label,\n hintText,\n required = false,\n hideRequiredIndicationInLabel = false,\n children,\n ...otherHTMLLabelProps\n}: LabelWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n ((typeof hintText === \"string\" && hintText.length) ||\n typeof hintText === \"number\") ? (\n <Text>{hintText}</Text>\n ) : (\n hintText\n );\n\n return (\n <ThemeProvider theme={theme}>\n {label ? (\n <Label {...otherHTMLLabelProps}>\n <LabelText $hasHintText={!!hintText}>\n {label}\n {!required && !hideRequiredIndicationInLabel && (\n <RequiredIndicationText>{` (optional)`}</RequiredIndicationText>\n )}\n </LabelText>\n {hintTextElement}\n {children}\n </Label>\n ) : (\n <>{children}</>\n )}\n </ThemeProvider>\n );\n}\n\nexport default LabelWrapper;\n"],"names":["LabelWrapper","_a","label","hintText","_b","required","_c","hideRequiredIndicationInLabel","children","otherHTMLLabelProps","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","hintTextElement","length","React","createElement","Text","ThemeProvider","Label","LabelText","$hasHintText","RequiredIndicationText","Fragment"],"mappings":"6UAoBM,SAAUA,EAAaC,GAC3B,IAAAC,EAAKD,EAAAC,MACLC,EAAQF,EAAAE,SACRC,EAAAH,EAAAI,SAAAA,OAAQ,IAAAD,GAAQA,EAChBE,kCAAAC,OAA6B,IAAAD,GAAQA,EACrCE,EAAQP,EAAAO,SACLC,EAAmBC,EAAAT,EANK,CAAA,QAAA,WAAA,WAAA,gCAAA,aAQrBU,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAGCK,EACFb,IACoB,iBAAbA,GAAyBA,EAASc,QACrB,iBAAbd,GACPe,EAAAC,cAACC,OAAMjB,GAAgB,EAK3B,OACEe,EAAAC,cAACE,EAAa,CAACR,MAAOA,GACnBX,EACCgB,EAAAC,cAACG,OAAUb,GACTS,EAAAC,cAACI,EAAS,CAAAC,eAAiBrB,GACxBD,GACCG,IAAaE,GACbW,EAAAC,cAACM,EAAsB,KAAE,gBAG5BT,EACAR,GAGHU,EAAAC,cAAAD,EAAAQ,SAAA,KAAGlB,GAIX"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/LabelWrapper/index.tsx"],"sourcesContent":["import React, { type LabelHTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { LabelText, Label, RequiredIndicationText, HintText } from \"./styles\";\n\ntype LabelWrapperProps = LabelHTMLAttributes<HTMLLabelElement> & {\n /** label text */\n label: string;\n /** hint text or react element in it's place */\n hintText?: ReactNode;\n /** if field is required, when not required (optional) appears in label */\n required?: boolean;\n /** flag to stop (optional) appearing in label, useful for compound form components like DateInput */\n hideRequiredIndicationInLabel?: boolean;\n children?: ReactNode;\n};\n\nexport function LabelWrapper({\n label,\n hintText,\n required = false,\n hideRequiredIndicationInLabel = false,\n children,\n ...otherHTMLLabelProps\n}: LabelWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n ((typeof hintText === \"string\" && hintText.length) ||\n typeof hintText === \"number\") ? (\n <HintText>{hintText}</HintText>\n ) : (\n hintText\n );\n\n return (\n <ThemeProvider theme={theme}>\n {label ? (\n <Label {...otherHTMLLabelProps}>\n <LabelText $hasHintText={!!hintText}>\n {label}\n {!required && !hideRequiredIndicationInLabel && (\n <RequiredIndicationText>{` (optional)`}</RequiredIndicationText>\n )}\n </LabelText>\n {hintTextElement}\n {children}\n </Label>\n ) : (\n <>{children}</>\n )}\n </ThemeProvider>\n );\n}\n\nexport default LabelWrapper;\n"],"names":["LabelWrapper","_a","label","hintText","_b","required","_c","hideRequiredIndicationInLabel","children","otherHTMLLabelProps","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","hintTextElement","length","React","createElement","HintText","ThemeProvider","Label","LabelText","$hasHintText","RequiredIndicationText","Fragment"],"mappings":"mTAmBM,SAAUA,EAAaC,GAC3B,IAAAC,EAAKD,EAAAC,MACLC,EAAQF,EAAAE,SACRC,EAAAH,EAAAI,SAAAA,OAAQ,IAAAD,GAAQA,EAChBE,kCAAAC,OAA6B,IAAAD,GAAQA,EACrCE,EAAQP,EAAAO,SACLC,EAAmBC,EAAAT,EANK,CAAA,QAAA,WAAA,WAAA,gCAAA,aAQrBU,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAGCK,EACFb,IACoB,iBAAbA,GAAyBA,EAASc,QACrB,iBAAbd,GACPe,EAAAC,cAACC,OAAUjB,GAAoB,EAKnC,OACEe,EAAAC,cAACE,EAAa,CAACR,MAAOA,GACnBX,EACCgB,EAAAC,cAACG,OAAUb,GACTS,EAAAC,cAACI,EAAS,CAAAC,eAAiBrB,GACxBD,GACCG,IAAaE,GACbW,EAAAC,cAACM,EAAsB,KAAE,gBAG5BT,EACAR,GAGHU,EAAAC,cAAAD,EAAAQ,SAAA,KAAGlB,GAIX"}
@@ -6,6 +6,9 @@ type LabelTextProp = {
6
6
  export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
7
7
  theme: ThemeType;
8
8
  }>> & string;
9
+ export declare const HintText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
10
+ theme: ThemeType;
11
+ }>> & string;
9
12
  export declare const RequiredIndicationText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
10
13
  theme: ThemeType;
11
14
  }>> & string;
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t from"styled-components";var o,e,i,a=t.label(o||(o=n(["\n position: relative;\n display: block;\n width: 100%;\n font-family: ",";\n font-weight: ",";\n"],["\n position: relative;\n display: block;\n width: 100%;\n font-family: ",";\n font-weight: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightLabels}),f=t.span(e||(e=n(["\n font-family: ",";\n font-weight: ",";\n"],["\n font-family: ",";\n font-weight: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightBase}),r=t.span(i||(i=n(["\n font-family: ",";\n font-weight: ",";\n display: block;\n margin-bottom: ",";\n"],["\n font-family: ",";\n font-weight: ",";\n display: block;\n margin-bottom: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightLabels},function(n){var t=n.$hasHintText,o=n.theme;return t?o.spacing.xxs:o.spacing.xs});export{a as Label,r as LabelText,f as RequiredIndicationText};
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t from"styled-components";var o,e,i,r,a=t.label(o||(o=n(["\n position: relative;\n display: block;\n width: 100%;\n font-family: ",";\n font-weight: ",";\n margin-bottom: ",";\n"],["\n position: relative;\n display: block;\n width: 100%;\n font-family: ",";\n font-weight: ",";\n margin-bottom: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightLabels},function(n){return n.theme.spacing.s}),f=t.span(e||(e=n(["\n font-family: ",";\n font-weight: ",";\n display: block;\n color: ",";\n margin-bottom: ",";\n"],["\n font-family: ",";\n font-weight: ",";\n display: block;\n color: ",";\n margin-bottom: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightBase},function(n){return n.theme.colors.textMid},function(n){return n.theme.spacing.xs}),m=t.span(i||(i=n(["\n font-family: ",";\n font-weight: ",";\n"],["\n font-family: ",";\n font-weight: ",";\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightBase}),l=t.span(r||(r=n(["\n font-family: ",";\n font-weight: ",";\n display: block;\n margin-bottom: ",";\n\n // increase font size for desktop\n @media (min-width: ",") {\n font-size: ",";\n }\n"],["\n font-family: ",";\n font-weight: ",";\n display: block;\n margin-bottom: ",";\n\n // increase font size for desktop\n @media (min-width: ",") {\n font-size: ",";\n }\n"])),function(n){return n.theme.typography.fontFamilyLabel},function(n){return n.theme.typography.fontWeightLabels},function(n){var t=n.$hasHintText,o=n.theme;return t?o.spacing.xxxs:o.spacing.xs},function(n){return n.theme.breakpoint.desktopLarge},function(n){return n.theme.fontSizes.ml});export{f as HintText,a as Label,l as LabelText,m as RequiredIndicationText};
2
2
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/LabelWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype LabelTextProp = {\n $hasHintText: boolean;\n theme: ThemeType;\n};\n\nexport const Label = styled.label<{ theme: ThemeType }>`\n position: relative;\n display: block;\n width: 100%;\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n`;\n\nexport const RequiredIndicationText = styled.span<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n`;\n\nexport const LabelText = styled.span<LabelTextProp>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n display: block;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxs : theme.spacing.xs};\n`;\n"],"names":["Label","styled","label","templateObject_1","__makeTemplateObject","_a","theme","typography","fontFamilyLabel","fontWeightLabels","RequiredIndicationText","span","templateObject_2","fontWeightBase","LabelText","templateObject_3","$hasHintText","spacing","xxs","xs"],"mappings":"iHAQO,UAAMA,EAAQC,EAAOC,MAAKC,IAAAA,EAAAC,EAAA,CAAA,8EAAA,qBAAA,OAAA,CAAsB,8EAIS,qBACC,SADhD,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWE,gBAAjB,GAGnBC,EAAyBT,EAAOU,KAAIC,IAAAA,EAAAR,EAAA,CAAA,oBAAA,qBAAA,OAAA,CAAsB,oBACP,qBACD,SAD9C,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWM,cAAjB,GAGnBC,EAAYb,EAAOU,KAAII,IAAAA,EAAAX,EAAA,CAAA,oBAAA,qBAAA,0CAAA,OAAA,CAAe,oBACa,qBACC,0CAGV,SAJtC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWE,gBAAjB,EAEb,SAACJ,OAAEW,EAAYX,EAAAW,aAAEV,EAAKD,EAAAC,MACrC,OAAAU,EAAeV,EAAMW,QAAQC,IAAMZ,EAAMW,QAAQE,EAAjD"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/LabelWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype LabelTextProp = {\n $hasHintText: boolean;\n theme: ThemeType;\n};\n\nexport const Label = styled.label<{ theme: ThemeType }>`\n position: relative;\n display: block;\n width: 100%;\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n margin-bottom: ${({ theme }) => theme.spacing.s};\n`;\n\nexport const HintText = styled.span<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n display: block;\n color: ${({ theme }) => theme.colors.textMid};\n margin-bottom: ${({ theme }) => theme.spacing.xs};\n`;\n\nexport const RequiredIndicationText = styled.span<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n`;\n\nexport const LabelText = styled.span<LabelTextProp>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n font-weight: ${({ theme }) => theme.typography.fontWeightLabels};\n display: block;\n margin-bottom: ${({ $hasHintText, theme }) =>\n $hasHintText ? theme.spacing.xxxs : theme.spacing.xs};\n\n // increase font size for desktop\n @media (min-width: ${({ theme }) => theme.breakpoint.desktopLarge}) {\n font-size: ${({ theme }) => theme.fontSizes.ml};\n }\n`;\n"],"names":["Label","styled","label","templateObject_1","__makeTemplateObject","_a","theme","typography","fontFamilyLabel","fontWeightLabels","spacing","s","HintText","span","templateObject_2","fontWeightBase","colors","textMid","xs","RequiredIndicationText","templateObject_3","LabelText","$hasHintText","xxxs","breakpoint","desktopLarge","fontSizes","ml"],"mappings":"iHAQO,YAAMA,EAAQC,EAAOC,MAAKC,IAAAA,EAAAC,EAAA,CAAA,8EAAA,qBAAA,uBAAA,OAAA,CAAsB,8EAIS,qBACC,uBAChB,SAFhC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWE,gBAAjB,EACb,SAACJ,GAAc,OAAPA,EAAAC,MAAaI,QAAQC,CAAd,GAGrBC,EAAWX,EAAOY,KAAIC,IAAAA,EAAAV,EAAA,CAAA,oBAAA,qBAAA,kCAAA,uBAAA,OAAA,CAAsB,oBACO,qBACD,kCAEjB,uBACI,SAJjC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWQ,cAAjB,EAErB,SAACV,GAAc,OAAPA,EAAAC,MAAaU,OAAOC,OAAb,EACP,SAACZ,GAAc,OAAPA,EAAAC,MAAaI,QAAQQ,EAAd,GAGrBC,EAAyBlB,EAAOY,KAAIO,IAAAA,EAAAhB,EAAA,CAAA,oBAAA,qBAAA,OAAA,CAAsB,oBACP,qBACD,SAD9C,SAACC,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWQ,cAAjB,GAGnBM,EAAYpB,EAAOY,uMAAmB,oBACa,qBACC,0CAGT,kEAGW,uBACjB,cARjC,SAACR,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,EACf,SAACH,GAAc,OAAPA,EAAAC,MAAaC,WAAWE,gBAAjB,EAEb,SAACJ,OAAEiB,EAAYjB,EAAAiB,aAAEhB,EAAKD,EAAAC,MACrC,OAAAgB,EAAehB,EAAMI,QAAQa,KAAOjB,EAAMI,QAAQQ,EAAlD,EAGmB,SAACb,GAAc,OAAPA,EAAAC,MAAakB,WAAWC,YAAjB,EACrB,SAACpB,GAAc,OAAPA,EAAAC,MAAaoB,UAAUC,EAAhB"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as n,ThemeProvider as o}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{ErrorText as m}from"../ErrorText/index.js";import{Text as a}from"../Text/index.js";import{StyledFieldset as i,LegendSpan as l}from"./styles.js";function p(p){var c=p.children,d=p.legendText,x=p.required,f=p.errorMessage,h=p.hasError,E=p.hintText,u=e(p,["children","legendText","required","errorMessage","hasError","hintText"]),T=n(),g=r(r({},s),T),j=!E||"string"!=typeof E&&"number"!=typeof E?E:t.createElement(a,{as:"span"},E);return t.createElement(o,{theme:g},t.createElement(i,{$hasError:h||!!f||!1,$hasHintText:!!E},d&&t.createElement("legend",r({},u),t.createElement(l,{$hasHintText:!!E},d," ",!x&&t.createElement("span",null,"(optional)")),j),c,!!f&&t.createElement(m,{marginTop:"xxs"},f)))}export{p as LegendWrapper,p as default};
1
+ import{__rest as e,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as n,ThemeProvider as o}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{ErrorText as m}from"../ErrorText/index.js";import{HintText as l,StyledFieldset as a,LegendSpan as i}from"./styles.js";function c(c){var p=c.children,d=c.legendText,h=c.required,x=c.errorMessage,E=c.hasError,f=c.hintText,u=e(c,["children","legendText","required","errorMessage","hasError","hintText"]),T=n(),g=r(r({},s),T),j=!f||"string"!=typeof f&&"number"!=typeof f?f:t.createElement(l,null,f);return t.createElement(o,{theme:g},t.createElement(a,{$hasError:E||!!x||!1,$hasHintText:!!f},d&&t.createElement("legend",r({},u),t.createElement(i,{$hasHintText:!!f},d," ",!h&&t.createElement("span",null,"(optional)")),j),p,!!x&&t.createElement(m,{marginTop:"xxs"},x)))}export{c as LegendWrapper,c as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/LegendWrapper/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\n\nimport { StyledFieldset, LegendSpan } from \"./styles\";\n\nexport type LegendWrapperProps = HTMLAttributes<HTMLLegendElement> & {\n children?: ReactNode;\n /** legend text */\n legendText: string;\n /** error message text */\n errorMessage?: string;\n /** flag for error styling */\n hasError?: boolean;\n /** if field is required, when not required (optional) appears in legend */\n required?: boolean;\n /** hint text */\n hintText?: ReactNode;\n};\n/**\n * LegendWrapper allows the user to add an outer label for a checkbox / group of checkboxes / radio buttons or a group of radio buttons.\n *\n * hasError and errorMessage props are just props that can be passed into the component.\n * There is no functionality checking if the children are valid/required etc this functionality will be needed to ne added outside of this component.\n */\nexport function LegendWrapper({\n children,\n legendText,\n required,\n errorMessage,\n hasError,\n hintText,\n ...restOfHTMLAttributes\n}: LegendWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n (typeof hintText === \"string\" || typeof hintText === \"number\") ? (\n <Text as=\"span\">{hintText}</Text>\n ) : (\n hintText\n );\n return (\n <ThemeProvider theme={theme}>\n <StyledFieldset\n $hasError={hasError || !!errorMessage || false}\n $hasHintText={!!hintText}\n >\n {legendText && (\n <legend {...restOfHTMLAttributes}>\n <LegendSpan $hasHintText={!!hintText}>\n {legendText} {!required && <span>(optional)</span>}\n </LegendSpan>\n {hintTextElement}\n </legend>\n )}\n {children}\n {!!errorMessage && (\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n )}\n </StyledFieldset>\n </ThemeProvider>\n );\n}\n\nexport default LegendWrapper;\n"],"names":["LegendWrapper","_a","children","legendText","required","errorMessage","hasError","hintText","restOfHTMLAttributes","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","hintTextElement","React","createElement","Text","as","ThemeProvider","StyledFieldset","$hasError","$hasHintText","LegendSpan","ErrorText","marginTop"],"mappings":"6WA4BM,SAAUA,EAAcC,GAC5B,IAAAC,aACAC,eACAC,aACAC,iBACAC,aACAC,aACGC,EAAoBC,EAAAR,EAPK,CAAA,WAAA,aAAA,WAAA,eAAA,WAAA,aAStBS,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAGCK,GACFR,GACmB,iBAAbA,GAA6C,iBAAbA,EACL,EAAjCS,EAAAC,cAACC,EAAI,CAACC,GAAG,QAAQZ,GAIrB,OACES,EAAAC,cAACG,EAAa,CAACR,MAAOA,GACpBI,EAAAC,cAACI,EAAc,CAAAC,UACFhB,KAAcD,IAAgB,EAAKkB,eAC9BhB,GAEfJ,GACCa,EAAAC,cAAA,SAAAJ,EAAA,CAAA,EAAYL,GACVQ,EAAAC,cAACO,EAAU,CAAAD,eAAiBhB,GACzBJ,OAAcC,GAAYY,EAAAC,cAAA,OAAA,KAAA,eAE5BF,GAGJb,IACEG,GACDW,EAAAC,cAACQ,EAAS,CAACC,UAAU,OAAOrB,IAKtC"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/LegendWrapper/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type ReactNode } from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\n\nimport { StyledFieldset, LegendSpan, HintText } from \"./styles\";\n\nexport type LegendWrapperProps = HTMLAttributes<HTMLLegendElement> & {\n children?: ReactNode;\n /** legend text */\n legendText: string;\n /** error message text */\n errorMessage?: string;\n /** flag for error styling */\n hasError?: boolean;\n /** if field is required, when not required (optional) appears in legend */\n required?: boolean;\n /** hint text */\n hintText?: ReactNode;\n};\n/**\n * LegendWrapper allows the user to add an outer label for a checkbox / group of checkboxes / radio buttons or a group of radio buttons.\n *\n * hasError and errorMessage props are just props that can be passed into the component.\n * There is no functionality checking if the children are valid/required etc this functionality will be needed to ne added outside of this component.\n */\nexport function LegendWrapper({\n children,\n legendText,\n required,\n errorMessage,\n hasError,\n hintText,\n ...restOfHTMLAttributes\n}: LegendWrapperProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const hintTextElement =\n !!hintText &&\n (typeof hintText === \"string\" || typeof hintText === \"number\") ? (\n <HintText>{hintText}</HintText>\n ) : (\n hintText\n );\n return (\n <ThemeProvider theme={theme}>\n <StyledFieldset\n $hasError={hasError || !!errorMessage || false}\n $hasHintText={!!hintText}\n >\n {legendText && (\n <legend {...restOfHTMLAttributes}>\n <LegendSpan $hasHintText={!!hintText}>\n {legendText} {!required && <span>(optional)</span>}\n </LegendSpan>\n {hintTextElement}\n </legend>\n )}\n {children}\n {!!errorMessage && (\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n )}\n </StyledFieldset>\n </ThemeProvider>\n );\n}\n\nexport default LegendWrapper;\n"],"names":["LegendWrapper","_a","children","legendText","required","errorMessage","hasError","hintText","restOfHTMLAttributes","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","hintTextElement","React","createElement","HintText","ThemeProvider","StyledFieldset","$hasError","$hasHintText","LegendSpan","ErrorText","marginTop"],"mappings":"mVA2BM,SAAUA,EAAcC,GAC5B,IAAAC,aACAC,eACAC,aACAC,iBACAC,aACAC,aACGC,EAAoBC,EAAAR,EAPK,CAAA,WAAA,aAAA,WAAA,eAAA,WAAA,aAStBS,EAAaC,IACbC,EAAKC,EAAAA,EAAA,CAAA,EACNC,GACAJ,GAGCK,GACFR,GACmB,iBAAbA,GAA6C,iBAAbA,EACP,EAA/BS,EAAAC,cAACC,EAAQ,KAAEX,GAIf,OACES,EAAAC,cAACE,EAAa,CAACP,MAAOA,GACpBI,EAAAC,cAACG,EAAc,CAAAC,UACFf,KAAcD,IAAgB,EAAKiB,eAC9Bf,GAEfJ,GACCa,EAAAC,cAAA,SAAAJ,EAAA,CAAA,EAAYL,GACVQ,EAAAC,cAACM,EAAU,CAAAD,eAAiBf,GACzBJ,OAAcC,GAAYY,EAAAC,cAAA,OAAA,KAAA,eAE5BF,GAGJb,IACEG,GACDW,EAAAC,cAACO,EAAS,CAACC,UAAU,OAAOpB,IAKtC"}
@@ -8,5 +8,8 @@ export declare const LegendSpan: import("styled-components/dist/types").IStyledC
8
8
  $hasHintText: boolean;
9
9
  theme: ThemeType;
10
10
  }>> & string;
11
+ export declare const HintText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
12
+ theme: ThemeType;
13
+ }>> & string;
11
14
  export declare const StyledFieldset: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, StyledFieldsetProps>> & string;
12
15
  export {};