@cruk/cruk-react-components 6.2.3 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -7
- package/lib/index.css +4248 -0
- package/lib/index.css.map +1 -0
- package/lib/node_modules/tslib/tslib.es6.js +1 -1
- package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
- package/lib/src/components/AddressLookup/index.d.ts +8 -9
- package/lib/src/components/AddressLookup/index.js +1 -1
- package/lib/src/components/AddressLookup/index.js.map +1 -1
- package/lib/src/components/AllThemesWrapper.d.ts +3 -3
- package/lib/src/components/Avatar/index.d.ts +10 -8
- package/lib/src/components/Avatar/index.js +1 -1
- package/lib/src/components/Avatar/index.js.map +1 -1
- package/lib/src/components/Badge/index.d.ts +12 -16
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Badge/index.js.map +1 -1
- package/lib/src/components/Box/index.d.ts +7 -7
- package/lib/src/components/Box/index.js +1 -1
- package/lib/src/components/Box/index.js.map +1 -1
- package/lib/src/components/Button/index.d.ts +7 -16
- package/lib/src/components/Button/index.js +1 -1
- package/lib/src/components/Button/index.js.map +1 -1
- package/lib/src/components/Carousel/Dots.js +1 -1
- package/lib/src/components/Carousel/Dots.js.map +1 -1
- package/lib/src/components/Carousel/index.d.ts +23 -13
- package/lib/src/components/Carousel/index.js +1 -1
- package/lib/src/components/Carousel/index.js.map +1 -1
- package/lib/src/components/Checkbox/index.d.ts +7 -8
- package/lib/src/components/Checkbox/index.js +1 -1
- package/lib/src/components/Checkbox/index.js.map +1 -1
- package/lib/src/components/Collapse/index.d.ts +2 -2
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/Collapse/index.js.map +1 -1
- package/lib/src/components/DateField/index.d.ts +5 -6
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/src/components/ErrorText/index.d.ts +7 -6
- package/lib/src/components/ErrorText/index.js +1 -1
- package/lib/src/components/ErrorText/index.js.map +1 -1
- package/lib/src/components/Footer/index.d.ts +8 -6
- package/lib/src/components/Footer/index.js +1 -1
- package/lib/src/components/Footer/index.js.map +1 -1
- package/lib/src/components/Header/index.d.ts +19 -18
- package/lib/src/components/Header/index.js +1 -1
- package/lib/src/components/Header/index.js.map +1 -1
- package/lib/src/components/Heading/index.d.ts +5 -17
- package/lib/src/components/Heading/index.js +1 -1
- package/lib/src/components/Heading/index.js.map +1 -1
- package/lib/src/components/IconFa/index.d.ts +9 -9
- package/lib/src/components/IconFa/index.js +1 -1
- package/lib/src/components/IconFa/index.js.map +1 -1
- package/lib/src/components/InfoBox/index.d.ts +13 -16
- package/lib/src/components/InfoBox/index.js +1 -1
- package/lib/src/components/InfoBox/index.js.map +1 -1
- package/lib/src/components/LabelWrapper/index.js +1 -1
- package/lib/src/components/LabelWrapper/index.js.map +1 -1
- package/lib/src/components/LegendWrapper/index.js +1 -1
- package/lib/src/components/LegendWrapper/index.js.map +1 -1
- package/lib/src/components/Link/index.d.ts +6 -10
- package/lib/src/components/Link/index.js +1 -1
- package/lib/src/components/Link/index.js.map +1 -1
- package/lib/src/components/Loader/index.js +1 -1
- package/lib/src/components/Loader/index.js.map +1 -1
- package/lib/src/components/Modal/TestModalWithContent.d.ts +3 -1
- package/lib/src/components/Modal/TestModalWithState.d.ts +3 -1
- package/lib/src/components/Modal/index.d.ts +14 -17
- package/lib/src/components/Modal/index.js +1 -1
- package/lib/src/components/Modal/index.js.map +1 -1
- package/lib/src/components/Pagination/index.js +1 -1
- package/lib/src/components/Pagination/index.js.map +1 -1
- package/lib/src/components/PopOver/index.d.ts +1 -1
- package/lib/src/components/PopOver/index.js +1 -1
- package/lib/src/components/PopOver/index.js.map +1 -1
- package/lib/src/components/ProgressBar/index.d.ts +1 -1
- package/lib/src/components/ProgressBar/index.js +1 -1
- package/lib/src/components/ProgressBar/index.js.map +1 -1
- package/lib/src/components/Radio/index.js +1 -1
- package/lib/src/components/Radio/index.js.map +1 -1
- package/lib/src/components/RadioConsent/index.d.ts +8 -9
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js.map +1 -1
- package/lib/src/components/Select/index.js +1 -1
- package/lib/src/components/Select/index.js.map +1 -1
- package/lib/src/components/Step/index.d.ts +7 -8
- package/lib/src/components/Step/index.js +1 -1
- package/lib/src/components/Step/index.js.map +1 -1
- package/lib/src/components/Text/index.d.ts +7 -27
- package/lib/src/components/Text/index.js +1 -1
- package/lib/src/components/Text/index.js.map +1 -1
- package/lib/src/components/TextAreaField/index.d.ts +5 -6
- package/lib/src/components/TextAreaField/index.js +1 -1
- package/lib/src/components/TextAreaField/index.js.map +1 -1
- package/lib/src/components/TextField/index.d.ts +3 -1
- package/lib/src/components/TextField/index.js +1 -1
- package/lib/src/components/TextField/index.js.map +1 -1
- package/lib/src/components/Totaliser/index.d.ts +5 -6
- package/lib/src/components/Totaliser/index.js +1 -1
- package/lib/src/components/Totaliser/index.js.map +1 -1
- package/lib/src/components/UserBlock/index.d.ts +3 -1
- package/lib/src/components/UserBlock/index.js +1 -1
- package/lib/src/components/UserBlock/index.js.map +1 -1
- package/lib/src/components/index.d.ts +34 -10
- package/lib/src/components/index.js +1 -1
- package/lib/src/types.d.ts +45 -172
- package/lib/src/types.js +2 -0
- package/lib/src/types.js.map +1 -0
- package/lib/src/utils/Helper.d.ts +3 -0
- package/lib/src/utils/Helper.js +1 -1
- package/lib/src/utils/Helper.js.map +1 -1
- package/lib/src/utils/themeUtils.d.ts +4 -3
- package/lib/src/utils/themeUtils.js +1 -1
- package/lib/src/utils/themeUtils.js.map +1 -1
- package/package.json +11 -9
- package/lib/src/components/AddressLookup/styles.d.ts +0 -17
- package/lib/src/components/AddressLookup/styles.js +0 -2
- package/lib/src/components/AddressLookup/styles.js.map +0 -1
- package/lib/src/components/Avatar/styles.d.ts +0 -6
- package/lib/src/components/Avatar/styles.js +0 -2
- package/lib/src/components/Avatar/styles.js.map +0 -1
- package/lib/src/components/Badge/styles.d.ts +0 -10
- package/lib/src/components/Badge/styles.js +0 -2
- package/lib/src/components/Badge/styles.js.map +0 -1
- package/lib/src/components/Box/styles.d.ts +0 -9
- package/lib/src/components/Box/styles.js +0 -2
- package/lib/src/components/Box/styles.js.map +0 -1
- package/lib/src/components/Button/styles.d.ts +0 -13
- package/lib/src/components/Button/styles.js +0 -2
- package/lib/src/components/Button/styles.js.map +0 -1
- package/lib/src/components/Carousel/styles.d.ts +0 -30
- package/lib/src/components/Carousel/styles.js +0 -2
- package/lib/src/components/Carousel/styles.js.map +0 -1
- package/lib/src/components/Checkbox/styles.d.ts +0 -17
- package/lib/src/components/Checkbox/styles.js +0 -2
- package/lib/src/components/Checkbox/styles.js.map +0 -1
- package/lib/src/components/Collapse/styles.d.ts +0 -26
- package/lib/src/components/Collapse/styles.js +0 -2
- package/lib/src/components/Collapse/styles.js.map +0 -1
- package/lib/src/components/DateField/styles.d.ts +0 -25
- package/lib/src/components/DateField/styles.js +0 -2
- package/lib/src/components/DateField/styles.js.map +0 -1
- package/lib/src/components/Divider.d.ts +0 -5
- package/lib/src/components/Divider.js +0 -2
- package/lib/src/components/Divider.js.map +0 -1
- package/lib/src/components/ErrorText/styles.d.ts +0 -16
- package/lib/src/components/ErrorText/styles.js +0 -2
- package/lib/src/components/ErrorText/styles.js.map +0 -1
- package/lib/src/components/Flex.d.ts +0 -8
- package/lib/src/components/Flex.js +0 -2
- package/lib/src/components/Flex.js.map +0 -1
- package/lib/src/components/Fontface.d.ts +0 -4
- package/lib/src/components/Fontface.js +0 -2
- package/lib/src/components/Fontface.js.map +0 -1
- package/lib/src/components/Footer/styles.d.ts +0 -16
- package/lib/src/components/Footer/styles.js +0 -2
- package/lib/src/components/Footer/styles.js.map +0 -1
- package/lib/src/components/GlobalStyle.d.ts +0 -2
- package/lib/src/components/GlobalStyle.js +0 -2
- package/lib/src/components/GlobalStyle.js.map +0 -1
- package/lib/src/components/GlobalStyleNoFontFace.d.ts +0 -2
- package/lib/src/components/GlobalStyleNoFontFace.js +0 -2
- package/lib/src/components/GlobalStyleNoFontFace.js.map +0 -1
- package/lib/src/components/Header/styles.d.ts +0 -33
- package/lib/src/components/Header/styles.js +0 -2
- package/lib/src/components/Header/styles.js.map +0 -1
- package/lib/src/components/Heading/styles.d.ts +0 -17
- package/lib/src/components/Heading/styles.js +0 -2
- package/lib/src/components/Heading/styles.js.map +0 -1
- package/lib/src/components/IconFa/styles.d.ts +0 -7
- package/lib/src/components/IconFa/styles.js +0 -2
- package/lib/src/components/IconFa/styles.js.map +0 -1
- package/lib/src/components/InfoBox/styles.d.ts +0 -13
- package/lib/src/components/InfoBox/styles.js +0 -2
- package/lib/src/components/InfoBox/styles.js.map +0 -1
- package/lib/src/components/LabelWrapper/styles.d.ts +0 -16
- package/lib/src/components/LabelWrapper/styles.js +0 -2
- package/lib/src/components/LabelWrapper/styles.js.map +0 -1
- package/lib/src/components/LegendWrapper/styles.d.ts +0 -15
- package/lib/src/components/LegendWrapper/styles.js +0 -2
- package/lib/src/components/LegendWrapper/styles.js.map +0 -1
- package/lib/src/components/Link/styles.d.ts +0 -20
- package/lib/src/components/Link/styles.js +0 -2
- package/lib/src/components/Link/styles.js.map +0 -1
- package/lib/src/components/Loader/styles.d.ts +0 -7
- package/lib/src/components/Loader/styles.js +0 -2
- package/lib/src/components/Loader/styles.js.map +0 -1
- package/lib/src/components/Modal/styles.d.ts +0 -32
- package/lib/src/components/Modal/styles.js +0 -2
- package/lib/src/components/Modal/styles.js.map +0 -1
- package/lib/src/components/Pagination/styles.d.ts +0 -12
- package/lib/src/components/Pagination/styles.js +0 -2
- package/lib/src/components/Pagination/styles.js.map +0 -1
- package/lib/src/components/PopOver/styles.d.ts +0 -11
- package/lib/src/components/PopOver/styles.js +0 -2
- package/lib/src/components/PopOver/styles.js.map +0 -1
- package/lib/src/components/ProgressBar/styles.d.ts +0 -32
- package/lib/src/components/ProgressBar/styles.js +0 -2
- package/lib/src/components/ProgressBar/styles.js.map +0 -1
- package/lib/src/components/Radio/styles.d.ts +0 -21
- package/lib/src/components/Radio/styles.js +0 -2
- package/lib/src/components/Radio/styles.js.map +0 -1
- package/lib/src/components/RadioConsent/styles.d.ts +0 -10
- package/lib/src/components/RadioConsent/styles.js +0 -2
- package/lib/src/components/RadioConsent/styles.js.map +0 -1
- package/lib/src/components/Select/styles.d.ts +0 -9
- package/lib/src/components/Select/styles.js +0 -2
- package/lib/src/components/Select/styles.js.map +0 -1
- package/lib/src/components/Spacing/index.d.ts +0 -68
- package/lib/src/components/Spacing/index.js +0 -2
- package/lib/src/components/Spacing/index.js.map +0 -1
- package/lib/src/components/Step/styles.d.ts +0 -16
- package/lib/src/components/Step/styles.js +0 -2
- package/lib/src/components/Step/styles.js.map +0 -1
- package/lib/src/components/Text/styles.d.ts +0 -15
- package/lib/src/components/Text/styles.js +0 -2
- package/lib/src/components/Text/styles.js.map +0 -1
- package/lib/src/components/TextAreaField/styles.d.ts +0 -10
- package/lib/src/components/TextAreaField/styles.js +0 -2
- package/lib/src/components/TextAreaField/styles.js.map +0 -1
- package/lib/src/components/TextField/styles.d.ts +0 -18
- package/lib/src/components/TextField/styles.js +0 -2
- package/lib/src/components/TextField/styles.js.map +0 -1
- package/lib/src/components/ThemeCheatSheet.d.ts +0 -7
- package/lib/src/components/Totaliser/styles.d.ts +0 -27
- package/lib/src/components/Totaliser/styles.js +0 -2
- package/lib/src/components/Totaliser/styles.js.map +0 -1
- package/lib/src/components/UserBlock/styles.d.ts +0 -9
- package/lib/src/components/UserBlock/styles.js +0 -2
- package/lib/src/components/UserBlock/styles.js.map +0 -1
- package/lib/src/themes/bowelbabe.d.ts +0 -14
- package/lib/src/themes/bowelbabe.js +0 -2
- package/lib/src/themes/bowelbabe.js.map +0 -1
- package/lib/src/themes/cruk.d.ts +0 -14
- package/lib/src/themes/cruk.js +0 -2
- package/lib/src/themes/cruk.js.map +0 -1
- package/lib/src/themes/rfl.d.ts +0 -14
- package/lib/src/themes/rfl.js +0 -2
- package/lib/src/themes/rfl.js.map +0 -1
- package/lib/src/themes/su2c.d.ts +0 -14
- package/lib/src/themes/su2c.js +0 -2
- package/lib/src/themes/su2c.js.map +0 -1
- package/lib/vite.config.d.ts +0 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React, { type HTMLAttributes } from "react";
|
|
2
|
-
import { type SpacingProps } from "
|
|
3
|
-
export type ErrorTextProps = SpacingProps & HTMLAttributes<HTMLElement> & {
|
|
4
|
-
as?: React.ElementType;
|
|
5
|
-
};
|
|
1
|
+
import React, { type Ref, type HTMLAttributes } from "react";
|
|
2
|
+
import { type SpacingProps, type TextProps, type ColourProps } from "../../types";
|
|
6
3
|
/**
|
|
7
4
|
*
|
|
8
5
|
* To be used in forms for inline validation. Applies styling and accessibility attribute so that it will be read by screen readers.
|
|
9
6
|
*
|
|
10
7
|
* Please be aware that some input components already have this component built in and can be passed an "errorMessage" prop
|
|
11
8
|
*/
|
|
12
|
-
export declare function ErrorText({
|
|
9
|
+
export declare function ErrorText({ textColor, backgroundColor, margin, marginTop, marginRight, marginBottom, marginLeft, marginVertical, marginHorizontal, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingVertical, paddingHorizontal, textSize, textAlign, textWeight, textFontFamily, wordBreak, overflowWrap, as, children, ref, ...htmlAttributes }: SpacingProps & TextProps & ColourProps & HTMLAttributes<HTMLElement> & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
as?: "span" | "div" | "p";
|
|
12
|
+
ref?: Ref<HTMLSpanElement | HTMLDivElement | HTMLParagraphElement>;
|
|
13
|
+
}): React.JSX.Element;
|
|
13
14
|
export default ErrorText;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as t,__assign as a}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{faTriangleExclamation as e}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as o}from"../IconFa/index.js";import{Box as n}from"../Box/index.js";import{removeEmpty as i}from"../../utils/Helper.js";function d(d){var l=d.textColor,p=d.backgroundColor,g=d.margin,m=d.marginTop,s=d.marginRight,c=d.marginBottom,f=d.marginLeft,x=d.marginVertical,h=d.marginHorizontal,u=d.padding,z=d.paddingTop,v=d.paddingRight,w=d.paddingBottom,b=d.paddingLeft,j=d.paddingVertical,B=d.paddingHorizontal,E=d.textSize,F=d.textAlign,k=d.textWeight,H=d.textFontFamily,R=d.wordBreak,y=d.overflowWrap,C=d.as,L=d.children,T=d.ref,V=t(d,["textColor","backgroundColor","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","textSize","textAlign","textWeight","textFontFamily","wordBreak","overflowWrap","as","children","ref"]),W=i({"data-color":l,"data-bg-color":p,"data-text-size":E,"data-text-align":F,"data-text-weight":k,"data-text-font-family":H,"data-word-break":R,"data-overflow-wrap":y,"data-margin":g,"data-margin-top":m,"data-margin-right":s,"data-margin-bottom":c,"data-margin-left":f,"data-margin-vertical":x,"data-margin-horizontal":h,"data-padding":u,"data-padding-top":z,"data-padding-right":v,"data-padding-bottom":w,"data-padding-left":b,"data-padding-vertical":j,"data-padding-horizontal":B}),N="string"==typeof L&&L.length,A=r.createElement(r.Fragment,null,N?r.createElement(n,{as:"span",marginRight:"xxs"},r.createElement(o,{faIcon:e,size:"1em"})):null,L);return r.createElement(r.Fragment,null,C&&"span"!==C?null:r.createElement("span",a({className:["component-error-text","text-props","spacing-props","color-props"].join(" "),ref:T},V,W,{role:"alert"}),A),"div"===C?r.createElement("div",a({className:["component-error-text","text-props","spacing-props","color-props"].join(" "),ref:T},V,W,{role:"alert"}),A):null,"p"===C?r.createElement("p",a({className:["component-error-text","text-props","spacing-props","color-props"].join(" "),ref:T},V,W,{role:"alert"}),A):null)}export{d as ErrorText,d as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ErrorText/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ErrorText/index.tsx"],"sourcesContent":["import React, { type Ref, type HTMLAttributes } from \"react\";\nimport { faTriangleExclamation } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\nimport { Box } from \"../Box\";\n\nimport { removeEmpty } from \"../../utils/Helper\";\n\nimport {\n type SpacingProps,\n type TextProps,\n type ColourProps,\n} from \"../../types\";\n\n/**\n *\n * To be used in forms for inline validation. Applies styling and accessibility attribute so that it will be read by screen readers.\n *\n * Please be aware that some input components already have this component built in and can be passed an \"errorMessage\" prop\n */\nexport function ErrorText({\n textColor,\n backgroundColor,\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n marginVertical,\n marginHorizontal,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n paddingVertical,\n paddingHorizontal,\n textSize,\n textAlign,\n textWeight,\n textFontFamily,\n wordBreak,\n overflowWrap,\n as,\n children,\n ref,\n ...htmlAttributes\n}: SpacingProps &\n TextProps &\n ColourProps &\n HTMLAttributes<HTMLElement> & {\n children?: React.ReactNode;\n as?: \"span\" | \"div\" | \"p\";\n ref?: Ref<HTMLSpanElement | HTMLDivElement | HTMLParagraphElement>;\n }) {\n const convertedProps = {\n \"data-color\": textColor,\n \"data-bg-color\": backgroundColor,\n \"data-text-size\": textSize,\n \"data-text-align\": textAlign,\n \"data-text-weight\": textWeight,\n \"data-text-font-family\": textFontFamily,\n \"data-word-break\": wordBreak,\n \"data-overflow-wrap\": overflowWrap,\n \"data-margin\": margin,\n \"data-margin-top\": marginTop,\n \"data-margin-right\": marginRight,\n \"data-margin-bottom\": marginBottom,\n \"data-margin-left\": marginLeft,\n \"data-margin-vertical\": marginVertical,\n \"data-margin-horizontal\": marginHorizontal,\n \"data-padding\": padding,\n \"data-padding-top\": paddingTop,\n \"data-padding-right\": paddingRight,\n \"data-padding-bottom\": paddingBottom,\n \"data-padding-left\": paddingLeft,\n \"data-padding-vertical\": paddingVertical,\n \"data-padding-horizontal\": paddingHorizontal,\n };\n\n const convertedPropsFiltered = removeEmpty(convertedProps);\n\n const shouldShowIcon = typeof children === \"string\" && children.length;\n\n const innerContent = (\n <>\n {shouldShowIcon ? (\n <Box as=\"span\" marginRight=\"xxs\">\n <IconFa faIcon={faTriangleExclamation} size=\"1em\" />\n </Box>\n ) : null}\n {children}\n </>\n );\n return (\n <>\n {!as || as === \"span\" ? (\n <span\n className={[\n \"component-error-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLSpanElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n role=\"alert\"\n >\n {innerContent}\n </span>\n ) : null}\n {as === \"div\" ? (\n <div\n className={[\n \"component-error-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLDivElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n role=\"alert\"\n >\n {innerContent}\n </div>\n ) : null}\n {as === \"p\" ? (\n <p\n className={[\n \"component-error-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLParagraphElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n role=\"alert\"\n >\n {innerContent}\n </p>\n ) : null}\n </>\n );\n}\n\nexport default ErrorText;\n"],"names":["ErrorText","_a","textColor","backgroundColor","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","textSize","textAlign","textWeight","textFontFamily","wordBreak","overflowWrap","as","children","ref","htmlAttributes","__rest","convertedPropsFiltered","removeEmpty","shouldShowIcon","length","innerContent","React","createElement","Fragment","Box","IconFa","faIcon","faTriangleExclamation","size","__assign","className","join","role"],"mappings":"oVAoBM,SAAUA,EAAUC,GACxB,IAAAC,EAASD,EAAAC,UACTC,EAAeF,EAAAE,gBACfC,EAAMH,EAAAG,OACNC,cACAC,EAAWL,EAAAK,YACXC,EAAYN,EAAAM,aACZC,EAAUP,EAAAO,WACVC,EAAcR,EAAAQ,eACdC,qBACAC,EAAOV,EAAAU,QACPC,EAAUX,EAAAW,WACVC,EAAYZ,EAAAY,aACZC,EAAab,EAAAa,cACbC,EAAWd,EAAAc,YACXC,EAAef,EAAAe,gBACfC,sBACAC,EAAQjB,EAAAiB,SACRC,EAASlB,EAAAkB,UACTC,EAAUnB,EAAAmB,WACVC,EAAcpB,EAAAoB,eACdC,cACAC,EAAYtB,EAAAsB,aACZC,EAAEvB,EAAAuB,GACFC,EAAQxB,EAAAwB,SACRC,EAAGzB,EAAAyB,IACAC,EAAcC,EAAA3B,EA1BO,oVA4DlB4B,EAAyBC,EAzBR,CACrB,aAAc5B,EACd,gBAAiBC,EACjB,iBAAkBe,EAClB,kBAAmBC,EACnB,mBAAoBC,EACpB,wBAAyBC,EACzB,kBAAmBC,EACnB,qBAAsBC,EACtB,cAAenB,EACf,kBAAmBC,EACnB,oBAAqBC,EACrB,qBAAsBC,EACtB,mBAAoBC,EACpB,uBAAwBC,EACxB,yBAA0BC,EAC1B,eAAgBC,EAChB,mBAAoBC,EACpB,qBAAsBC,EACtB,sBAAuBC,EACvB,oBAAqBC,EACrB,wBAAyBC,EACzB,0BAA2BC,IAKvBc,EAAqC,iBAAbN,GAAyBA,EAASO,OAE1DC,EACJC,EAAAC,cAAAD,EAAAE,SAAA,KACGL,EACCG,EAAAC,cAACE,EAAG,CAACb,GAAG,OAAOlB,YAAY,OACzB4B,EAAAC,cAACG,EAAM,CAACC,OAAQC,EAAuBC,KAAK,SAE5C,KACHhB,GAGL,OACES,EAAAC,cAAAD,EAAAE,SAAA,KACIZ,GAAa,SAAPA,EAeJ,KAdFU,EAAAC,cAAA,OAAAO,EAAA,CACEC,UAAW,CACT,uBACA,aACA,gBACA,eACAC,KAAK,KACPlB,IAAKA,GACDC,EACAE,EAAsB,CAC1BgB,KAAK,UAEJZ,GAGG,QAAPT,EACCU,EAAAC,cAAA,MAAAO,EAAA,CACEC,UAAW,CACT,uBACA,aACA,gBACA,eACAC,KAAK,KACPlB,IAAKA,GACDC,EACAE,EAAsB,CAC1BgB,KAAK,UAEJZ,GAED,KACI,MAAPT,EACCU,EAAAC,cAAA,IAAAO,EAAA,CACEC,UAAW,CACT,uBACA,aACA,gBACA,eACAC,KAAK,KACPlB,IAAKA,GACDC,EACAE,EAAsB,CAC1BgB,KAAK,UAEJZ,GAED,KAGV"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { type ReactNode, type HTMLAttributes } from "react";
|
|
2
|
-
|
|
3
|
-
/** used to customise text in middle section, it could also be react element, this is not to be confused with the component children which is primarily for the links in the footer */
|
|
4
|
-
middleSection?: ReactNode;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
};
|
|
2
|
+
import { type ThemeNameType } from "../../types";
|
|
7
3
|
/**
|
|
8
4
|
* There should be only one footer component at the bottom of the body of each page. Links can be passed as children
|
|
9
5
|
* */
|
|
10
|
-
export declare function Footer({ children,
|
|
6
|
+
export declare function Footer({ children, themeName, footerText, }: HTMLAttributes<HTMLElement> & {
|
|
7
|
+
/** used to customise text in middle section, it could also be react element, this is not to be confused with the component children which is primarily for the links in the footer */
|
|
8
|
+
middleSection?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
themeName?: ThemeNameType;
|
|
11
|
+
footerText?: string;
|
|
12
|
+
}): React.JSX.Element;
|
|
11
13
|
export default Footer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{Text as a}from"../Text/index.js";function t(t){var n=t.children,r=t.themeName,s=void 0===r?"cruk":r,o=t.footerText,c=e.Children.toArray(n);return e.createElement("footer",{className:"component-footer"},e.createElement("div",{className:"footer-bar"}),e.createElement("div",{className:"footer-wrapper"},e.createElement("div",{className:"footer-section"},e.createElement("nav",{className:"footer-nav","aria-label":"footer links"},e.createElement("ul",{className:"footer-ul"},c.length?c.map(function(a,t){var n="footerLink".concat(t);return e.createElement("li",{key:n,className:"footer-li"},a)}):null))),e.createElement("div",{className:"footer-section"},e.createElement("img",{className:"footer-regulator-logo",width:130,height:40,alt:"Registered with Fundraising Regulator",src:"https://rcl.assets.cancerresearchuk.org/images/logos/fundreg.png"})),e.createElement("div",{className:"footer-section"},o?e.createElement(a,{textSize:"m"},o):e.createElement(e.Fragment,null,e.createElement(a,{textSize:"m",as:"span"},function(e){switch(e){case"su2c":return"Stand Up To Cancer and Stand Up To Cancer Brand Marks are registered trademarks of the Entertainment Industry Foundation. Cancer Research UK is a registered charity in England and Wales (1089464), Scotland(SC041666), the Isle of Man (1103) and Jersey (247). A company limited by guarantee. Registered company in England and Wales (4325234) and the Isle of Man (5713F). Registered address: 2 Redman Place, London, E20 1JQ. Donations will be made to Cancer Research UK in support of the Stand Up To Cancer campaign.";case"bowelbabe":return"The Bowelbabe Fund for Cancer Research UK, raises money to fund clinical trials, research and cancer information and awareness, as well as other initiatives to combat cancer and support those affected by cancer. The Bowelbabe Fund is a restricted fund within Cancer Research UK. Cancer Research UK is a registered charity in England and Wales (1089464), Scotland (SC041666), the Isle of Man (1103) and Jersey (247) and is registered with the Fundraising Regulator.";default:return"Cancer Research UK is a registered charity in England and Wales (1089464), Scotland (SC041666), the Isle of Man (1103) and Jersey (247). A company limited by guarantee. Registered company in England and Wales(4325234) and the Isle of Man (5713F)."}}(s)," Registered address:"),e.createElement("address",{className:"footer-address"},e.createElement(a,{textSize:"m",as:"span"}," ","2 Redman Place, London, E20 1JQ"))))))}export{t as Footer,t as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Footer/index.tsx"],"sourcesContent":["import React, { type ReactNode, type HTMLAttributes } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Footer/index.tsx"],"sourcesContent":["import React, { type ReactNode, type HTMLAttributes } from \"react\";\nimport { Text } from \"../Text\";\n\nimport { type ThemeNameType } from \"../../types\";\n\nconst footerTextCruk =\n \"Cancer Research UK is a registered charity in England and Wales (1089464), Scotland (SC041666), the Isle of Man (1103) and Jersey (247). A company limited by guarantee. Registered company in England and Wales(4325234) and the Isle of Man (5713F).\";\nconst footerTextSu2c =\n \"Stand Up To Cancer and Stand Up To Cancer Brand Marks are registered trademarks of the Entertainment Industry Foundation. Cancer Research UK is a registered charity in England and Wales (1089464), Scotland(SC041666), the Isle of Man (1103) and Jersey (247). A company limited by guarantee. Registered company in England and Wales (4325234) and the Isle of Man (5713F). Registered address: 2 Redman Place, London, E20 1JQ. Donations will be made to Cancer Research UK in support of the Stand Up To Cancer campaign.\";\nconst footerTextBowelBabe =\n \"The Bowelbabe Fund for Cancer Research UK, raises money to fund clinical trials, research and cancer information and awareness, as well as other initiatives to combat cancer and support those affected by cancer. The Bowelbabe Fund is a restricted fund within Cancer Research UK. Cancer Research UK is a registered charity in England and Wales (1089464), Scotland (SC041666), the Isle of Man (1103) and Jersey (247) and is registered with the Fundraising Regulator.\";\n\nfunction footerTextForTheme(themeName: string): string {\n switch (themeName) {\n case \"su2c\":\n return footerTextSu2c;\n case \"bowelbabe\":\n return footerTextBowelBabe;\n default:\n return footerTextCruk;\n }\n}\n\n/**\n * There should be only one footer component at the bottom of the body of each page. Links can be passed as children\n * */\nexport function Footer({\n children,\n themeName = \"cruk\",\n footerText,\n}: HTMLAttributes<HTMLElement> & {\n /** used to customise text in middle section, it could also be react element, this is not to be confused with the component children which is primarily for the links in the footer */\n middleSection?: ReactNode;\n children?: ReactNode;\n themeName?: ThemeNameType;\n footerText?: string;\n}) {\n const childArray = React.Children.toArray(children);\n\n return (\n <footer className=\"component-footer\">\n <div className=\"footer-bar\" />\n <div className=\"footer-wrapper\">\n <div className=\"footer-section\">\n <nav className=\"footer-nav\" aria-label=\"footer links\">\n <ul className=\"footer-ul\">\n {childArray.length\n ? childArray.map((child, index) => {\n const footerLinkKey = `footerLink${index}`;\n return (\n <li key={footerLinkKey} className=\"footer-li\">\n {child}\n </li>\n );\n })\n : null}\n </ul>\n </nav>\n </div>\n <div className=\"footer-section\">\n <img\n className=\"footer-regulator-logo\"\n width={130}\n height={40}\n alt=\"Registered with Fundraising Regulator\"\n src=\"https://rcl.assets.cancerresearchuk.org/images/logos/fundreg.png\"\n />\n </div>\n <div className=\"footer-section\">\n {footerText ? (\n <Text textSize=\"m\">{footerText}</Text>\n ) : (\n <>\n <Text textSize=\"m\" as=\"span\">\n {footerTextForTheme(themeName)} Registered address:\n </Text>\n <address className=\"footer-address\">\n <Text textSize=\"m\" as=\"span\">\n {\" \"}\n 2 Redman Place, London, E20 1JQ\n </Text>\n </address>\n </>\n )}\n </div>\n </div>\n </footer>\n );\n}\n\nexport default Footer;\n"],"names":["Footer","_a","children","_b","themeName","footerText","childArray","React","Children","toArray","createElement","className","length","map","child","index","footerLinkKey","concat","key","width","height","alt","src","Text","textSize","Fragment","as","footerTextForTheme"],"mappings":"6DA0BM,SAAUA,EAAOC,OACrBC,EAAQD,EAAAC,SACRC,EAAAF,EAAAG,UAAAA,aAAY,OAAMD,EAClBE,EAAUJ,EAAAI,WAQJC,EAAaC,EAAMC,SAASC,QAAQP,GAE1C,OACEK,EAAAG,cAAA,SAAA,CAAQC,UAAU,oBAChBJ,EAAAG,cAAA,MAAA,CAAKC,UAAU,eACfJ,EAAAG,cAAA,MAAA,CAAKC,UAAU,kBACbJ,EAAAG,cAAA,MAAA,CAAKC,UAAU,kBACbJ,EAAAG,cAAA,MAAA,CAAKC,UAAU,aAAY,aAAY,gBACrCJ,EAAAG,cAAA,KAAA,CAAIC,UAAU,aACXL,EAAWM,OACRN,EAAWO,IAAI,SAACC,EAAOC,GACrB,IAAMC,EAAgB,aAAAC,OAAaF,GACnC,OACER,EAAAG,cAAA,KAAA,CAAIQ,IAAKF,EAAeL,UAAU,aAC/BG,EAGP,GACA,QAIVP,EAAAG,cAAA,MAAA,CAAKC,UAAU,kBACbJ,EAAAG,cAAA,MAAA,CACEC,UAAU,wBACVQ,MAAO,IACPC,OAAQ,GACRC,IAAI,wCACJC,IAAI,sEAGRf,EAAAG,cAAA,MAAA,CAAKC,UAAU,kBACZN,EACCE,EAAAG,cAACa,GAAKC,SAAS,KAAKnB,GAEpBE,EAAAG,cAAAH,EAAAkB,SAAA,KACElB,EAAAG,cAACa,GAAKC,SAAS,IAAIE,GAAG,QA7DpC,SAA4BtB,GAC1B,OAAQA,GACN,IAAK,OACH,MAPJ,ogBAQE,IAAK,YACH,MAPJ,mdAQE,QACE,MAbJ,yPAeF,CAqDiBuB,CAAmBvB,GACf,wBACPG,EAAAG,cAAA,UAAA,CAASC,UAAU,kBACjBJ,EAAAG,cAACa,GAAKC,SAAS,IAAIE,GAAG,QACnB,IAEI,uCAQvB"}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import React, { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
/** flag which make header fixed to the top even when scrolling */
|
|
4
|
-
isSticky?: boolean;
|
|
5
|
-
/** text in the middle of the header */
|
|
6
|
-
siteSlogan?: string;
|
|
7
|
-
/** text to explain the content of the icon for a11y usually a description of where the link will take you */
|
|
8
|
-
logoAltText?: string;
|
|
9
|
-
/** header logo image url */
|
|
10
|
-
logoImageSrc?: string;
|
|
11
|
-
/** title of the header image component, this is mainly for the tooltip text on hover */
|
|
12
|
-
logoLinkTitle?: string;
|
|
13
|
-
/** the url of the logo link */
|
|
14
|
-
logoLinkUrl?: string;
|
|
15
|
-
/** instead of the contents of the header being centered to max width as defined in theme it is 100% width fo viewport */
|
|
16
|
-
fullWidth?: boolean;
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
};
|
|
2
|
+
import { type ThemeNameType } from "../../types";
|
|
19
3
|
/**
|
|
20
4
|
* There should be only one header component near or at the top of the body of each page.
|
|
21
5
|
*
|
|
@@ -33,5 +17,22 @@ export type HeaderProps = HTMLAttributes<HTMLElement> & {
|
|
|
33
17
|
* 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.
|
|
34
18
|
*
|
|
35
19
|
*/
|
|
36
|
-
export declare function Header({ isSticky, siteSlogan, logoAltText, logoImageSrc, logoLinkTitle, logoLinkUrl, fullWidth, children, }:
|
|
20
|
+
export declare function Header({ themeName, isSticky, siteSlogan, logoAltText, logoImageSrc, logoLinkTitle, logoLinkUrl, fullWidth, children, }: HTMLAttributes<HTMLElement> & {
|
|
21
|
+
themeName: ThemeNameType;
|
|
22
|
+
/** flag which make header fixed to the top even when scrolling */
|
|
23
|
+
isSticky?: boolean;
|
|
24
|
+
/** text in the middle of the header */
|
|
25
|
+
siteSlogan?: string;
|
|
26
|
+
/** text to explain the content of the icon for a11y usually a description of where the link will take you */
|
|
27
|
+
logoAltText?: string;
|
|
28
|
+
/** header logo image url */
|
|
29
|
+
logoImageSrc?: string;
|
|
30
|
+
/** title of the header image component, this is mainly for the tooltip text on hover */
|
|
31
|
+
logoLinkTitle?: string;
|
|
32
|
+
/** the url of the logo link */
|
|
33
|
+
logoLinkUrl?: string;
|
|
34
|
+
/** instead of the contents of the header being centered to max width as defined in theme it is 100% width fo viewport */
|
|
35
|
+
fullWidth?: boolean;
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}): React.JSX.Element;
|
|
37
38
|
export default Header;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useState as a}from"react";import t from"../../hooks/useScrollPosition.js";function l(l){var r=l.themeName,s=l.isSticky,c=l.siteSlogan,n=l.logoAltText,o=l.logoImageSrc,i=l.logoLinkTitle,m=l.logoLinkUrl,d=l.fullWidth,g=l.children,h=a(!1),u=h[0],p=h[1],f="undefined"!=typeof window;t(function(e){var a=e.currPos,t=!!f&&a.y>240;t!==u&&p(t)},[u],null,!0,50);var k=function(e){switch(e){case"su2c":return"https://rcl.assets.cancerresearchuk.org/images/logos/su2c-160.png";case"bowelbabe":return"https://rcl.assets.cancerresearchuk.org/images/logos/bowelbabe-logo-160.png";case"rfl":return"https://rcl.assets.cancerresearchuk.org/images/logos/rfl.svg";default:return"https://rcl.assets.cancerresearchuk.org/images/logos/cruk.svg"}}(r);return e.createElement("header",{className:"component-header","data-is-sticky":s||!1,"data-is-small":u||!1,"data-full-width":d||!1},e.createElement("div",{className:"header-sticky-placeholder"},e.createElement("div",{className:"header-sticky-container","data-testid":"header-sticky-container"},e.createElement("a",{className:"skip-to-main",href:"#main"},"Skip to main content"),e.createElement("div",{className:"header-main-content","data-$full-width":d},e.createElement("a",{className:"header-logo-link",href:null!=m?m:"/",title:null!=i?i:"Home"},e.createElement("div",{className:"logo-wrapper"},e.createElement("img",{className:"logo",width:160,height:80,src:null!=o?o:k,alt:null!=n?n:"Cancer Research UK Giving Pages"}))),c?e.createElement("p",{className:"tagline"},c):null,e.createElement("div",{className:"child-wrapper"},e.createElement("div",{className:"child-inner"},g))))))}export{l as Header,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Header/index.tsx"],"sourcesContent":["import React, { useState, type HTMLAttributes, type ReactNode } from \"react\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Header/index.tsx"],"sourcesContent":["import React, { useState, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { useScrollPosition } from \"../../hooks/useScrollPosition\";\n\nimport { type ThemeNameType } from \"../../types\";\n\nconst HEADER_SCROLL_THRESHOLD = 240;\n\nconst crukLogoUrl =\n \"https://rcl.assets.cancerresearchuk.org/images/logos/cruk.svg\";\nconst rflLogoUrl =\n \"https://rcl.assets.cancerresearchuk.org/images/logos/rfl.svg\";\nconst su2cLogoUrl =\n \"https://rcl.assets.cancerresearchuk.org/images/logos/su2c-160.png\";\nconst bowelbabeLogoUrl =\n \"https://rcl.assets.cancerresearchuk.org/images/logos/bowelbabe-logo-160.png\";\n\nfunction getLogoFromThemeName(themeName: ThemeNameType) {\n switch (themeName) {\n case \"su2c\":\n return su2cLogoUrl;\n case \"bowelbabe\":\n return bowelbabeLogoUrl;\n case \"rfl\":\n return rflLogoUrl;\n default:\n return crukLogoUrl;\n }\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 themeName,\n isSticky,\n siteSlogan,\n logoAltText,\n logoImageSrc,\n logoLinkTitle,\n logoLinkUrl,\n fullWidth,\n children,\n}: HTMLAttributes<HTMLElement> & {\n themeName: ThemeNameType;\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 const [isSmall, setIsSmall] = useState(false);\n const isBrowser = typeof window !== `undefined`;\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 const logoUrl = getLogoFromThemeName(themeName);\n\n return (\n <header\n className=\"component-header\"\n data-is-sticky={isSticky || false}\n data-is-small={isSmall || false}\n data-full-width={fullWidth || false}\n >\n <div className=\"header-sticky-placeholder\">\n <div\n className=\"header-sticky-container\"\n data-testid=\"header-sticky-container\"\n >\n <a className=\"skip-to-main\" href=\"#main\">\n Skip to main content\n </a>\n <div className=\"header-main-content\" data-$full-width={fullWidth}>\n <a\n className=\"header-logo-link\"\n href={logoLinkUrl ?? \"/\"}\n title={logoLinkTitle ?? \"Home\"}\n >\n <div className=\"logo-wrapper\">\n <img\n className=\"logo\"\n width={160}\n height={80}\n src={logoImageSrc ?? logoUrl}\n alt={logoAltText ?? \"Cancer Research UK Giving Pages\"}\n />\n </div>\n </a>\n {siteSlogan ? <p className=\"tagline\">{siteSlogan}</p> : null}\n <div className=\"child-wrapper\">\n <div className=\"child-inner\">{children}</div>\n </div>\n </div>\n </div>\n </div>\n </header>\n );\n}\n\nexport default Header;\n"],"names":["Header","_a","themeName","isSticky","siteSlogan","logoAltText","logoImageSrc","logoLinkTitle","logoLinkUrl","fullWidth","children","_b","useState","isSmall","setIsSmall","isBrowser","window","useScrollPosition","currPos","shouldShrink","y","logoUrl","getLogoFromThemeName","React","createElement","className","href","title","width","height","src","alt"],"mappings":"oFA+CM,SAAUA,EAAOC,OACrBC,EAASD,EAAAC,UACTC,EAAQF,EAAAE,SACRC,EAAUH,EAAAG,WACVC,EAAWJ,EAAAI,YACXC,iBACAC,EAAaN,EAAAM,cACbC,EAAWP,EAAAO,YACXC,EAASR,EAAAQ,UACTC,EAAQT,EAAAS,SAoBFC,EAAwBC,GAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAA8B,oBAAXC,OAEzBC,EACE,SAAChB,GACC,IAAAiB,EAAOjB,EAAAiB,QAKDC,IAAeJ,GACjBG,EAAQE,EAjFc,IAmFtBD,IAAiBN,GACnBC,EAAWK,EAEf,EACA,CAACN,GACD,MACA,EACA,IAGF,IAAMQ,EAlFR,SAA8BnB,GAC5B,OAAQA,GACN,IAAK,OACH,MAPJ,oEAQE,IAAK,YACH,MAPJ,8EAQE,IAAK,MACH,MAbJ,+DAcE,QACE,MAjBJ,gEAmBF,CAuEkBoB,CAAqBpB,GAErC,OACEqB,EAAAC,cAAA,SAAA,CACEC,UAAU,oCACMtB,IAAY,EAAK,gBAClBU,IAAW,EAAK,kBACdJ,IAAa,GAE9Bc,EAAAC,cAAA,MAAA,CAAKC,UAAU,6BACbF,EAAAC,cAAA,MAAA,CACEC,UAAU,0BAAyB,cACvB,2BAEZF,EAAAC,cAAA,IAAA,CAAGC,UAAU,eAAeC,KAAK,SAAO,wBAGxCH,EAAAC,cAAA,MAAA,CAAKC,UAAU,sBAAqB,mBAAmBhB,GACrDc,EAAAC,cAAA,IAAA,CACEC,UAAU,mBACVC,KAAMlB,QAAAA,EAAe,IACrBmB,MAAOpB,QAAAA,EAAiB,QAExBgB,EAAAC,cAAA,MAAA,CAAKC,UAAU,gBACbF,EAAAC,cAAA,MAAA,CACEC,UAAU,OACVG,MAAO,IACPC,OAAQ,GACRC,IAAKxB,QAAAA,EAAgBe,EACrBU,IAAK1B,QAAAA,EAAe,sCAIzBD,EAAamB,EAAAC,cAAA,IAAA,CAAGC,UAAU,WAAWrB,GAAkB,KACxDmB,EAAAC,cAAA,MAAA,CAAKC,UAAU,iBACbF,EAAAC,cAAA,MAAA,CAAKC,UAAU,eAAef,OAO5C"}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import React, { type HTMLAttributes
|
|
2
|
-
import { type SpacingProps } from "
|
|
3
|
-
|
|
4
|
-
export type HeadingProps = SpacingProps & HTMLAttributes<HTMLElement> & {
|
|
1
|
+
import React, { type HTMLAttributes } from "react";
|
|
2
|
+
import { type SpacingProps, type TextProps, type ColourProps } from "../../types";
|
|
3
|
+
export type HeadingProps = SpacingProps & TextProps & ColourProps & HTMLAttributes<HTMLElement> & {
|
|
5
4
|
h1?: boolean;
|
|
6
5
|
h2?: boolean;
|
|
7
6
|
h3?: boolean;
|
|
8
7
|
h4?: boolean;
|
|
9
8
|
h5?: boolean;
|
|
10
9
|
h6?: boolean;
|
|
11
|
-
|
|
12
|
-
textSize?: FontSizeType;
|
|
13
|
-
/** horizontal alignment of text */
|
|
14
|
-
textAlign?: "left" | "right" | "center";
|
|
15
|
-
/** color of text */
|
|
16
|
-
textColor?: string;
|
|
17
|
-
/** word-break behavior */
|
|
18
|
-
wordBreak?: WordBreakType;
|
|
19
|
-
/** overflow-wrap behavior */
|
|
20
|
-
overflowWrap?: OverflowWrapType;
|
|
21
|
-
/** styled-component polymorphic feature so you take the styling of a header and cast the component to be a "span" for example */
|
|
22
|
-
as?: ElementType;
|
|
10
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "legend";
|
|
23
11
|
};
|
|
24
12
|
/**
|
|
25
13
|
*
|
|
@@ -28,5 +16,5 @@ Markup headings semantically using the appropriate <h#> level HTML element and
|
|
|
28
16
|
use the corresponding heading class (h1, h2, h3, ....). Write all headings in sentence case. Heading differs from the Text component by using a different font-family and it changes the font size according to the screen width breakpoints.
|
|
29
17
|
*
|
|
30
18
|
*/
|
|
31
|
-
export declare function Heading({ textSize, textAlign,
|
|
19
|
+
export declare function Heading({ textColor, backgroundColor, textSize, textAlign, textWeight, textFontFamily, wordBreak, overflowWrap, margin, marginTop, marginRight, marginBottom, marginLeft, marginVertical, marginHorizontal, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingVertical, paddingHorizontal, h1, h2, h3, h4, h5, h6, as, ...htmlProps }: HeadingProps): React.JSX.Element;
|
|
32
20
|
export default Heading;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as a,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import e from"react";function n(n){var o=n.textColor,p=n.backgroundColor,r=n.textSize,i=n.textAlign,d=n.textWeight,l=n.textFontFamily,g=n.wordBreak,s=n.overflowWrap,c=n.margin,m=n.marginTop,h=n.marginRight,x=n.marginBottom,u=n.marginLeft,f=n.marginVertical,j=n.marginHorizontal,E=n.padding,z=n.paddingTop,N=n.paddingRight,b=n.paddingBottom,w=n.paddingLeft,v=n.paddingVertical,B=n.paddingHorizontal,k=n.h1,F=n.h2,C=n.h3,H=n.h4,L=n.h5,R=n.h6,T=n.as,V=a(n,["textColor","backgroundColor","textSize","textAlign","textWeight","textFontFamily","wordBreak","overflowWrap","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","h1","h2","h3","h4","h5","h6","as"]),W=k?"h1":F?"h2":C?"h3":H?"h4":L?"h5":R?"h6":"h2",y=T||W,A={"data-color":o,"data-bg-color":p,"data-text-size":r,"data-text-align":i,"data-text-weight":d,"data-text-font-family":l,"data-word-break":g,"data-overflow-wrap":s,"data-margin":c,"data-margin-top":m,"data-margin-right":h,"data-margin-bottom":x,"data-margin-left":u,"data-margin-vertical":f,"data-margin-horizontal":j,"data-padding":E,"data-padding-top":z,"data-padding-right":N,"data-padding-bottom":b,"data-padding-left":w,"data-padding-vertical":v,"data-padding-horizontal":B};return e.createElement(e.Fragment,null,"h1"===y?e.createElement("h1",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"h2"===y?e.createElement("h2",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"h3"===y?e.createElement("h3",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"h4"===y?e.createElement("h4",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"h5"===y?e.createElement("h5",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"h6"===y?e.createElement("h6",t({className:["component-heading","color-props","spacing-props","text-props"].join(" "),"data-appearance":W},A,V)):null,"p"===y?e.createElement("p",t({className:["component-heading","color-props","spacing-props","text-props"].join(" ")},A,V)):null,"span"===y?e.createElement("span",t({className:["component-heading","color-props","spacing-props","text-props"].join(" ")},A,V)):null,"legend"===y?e.createElement("legend",t({className:["component-heading","color-props","spacing-props","text-props"].join(" ")},A,V)):null)}export{n as Heading,n as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Heading/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Heading/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes } from \"react\";\n\nimport {\n type SpacingProps,\n type TextProps,\n type ColourProps,\n} from \"../../types\";\n\nexport type HeadingProps = SpacingProps &\n TextProps &\n ColourProps &\n HTMLAttributes<HTMLElement> & {\n h1?: boolean;\n h2?: boolean;\n h3?: boolean;\n h4?: boolean;\n h5?: boolean;\n h6?: boolean;\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"p\" | \"span\" | \"legend\";\n };\n\n/**\n * \n * Use headings consistently to create a clear hierarchy throughout your service.\nMarkup headings semantically using the appropriate <h#> level HTML element and\nuse the corresponding heading class (h1, h2, h3, ....). Write all headings in sentence case. Heading differs from the Text component by using a different font-family and it changes the font size according to the screen width breakpoints.\n * \n */\nexport function Heading({\n textColor,\n backgroundColor,\n textSize,\n textAlign,\n textWeight,\n textFontFamily,\n wordBreak,\n overflowWrap,\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n marginVertical,\n marginHorizontal,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n paddingVertical,\n paddingHorizontal,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n as,\n ...htmlProps\n}: HeadingProps) {\n const calculatedHTag = h1\n ? \"h1\"\n : h2\n ? \"h2\"\n : h3\n ? \"h3\"\n : h4\n ? \"h4\"\n : h5\n ? \"h5\"\n : h6\n ? \"h6\"\n : \"h2\";\n // as can be explicitly set or inferred from h1-h6 props\n const calculatedAs = as ? as : calculatedHTag;\n\n const convertedProps = {\n \"data-color\": textColor,\n \"data-bg-color\": backgroundColor,\n \"data-text-size\": textSize,\n \"data-text-align\": textAlign,\n \"data-text-weight\": textWeight,\n \"data-text-font-family\": textFontFamily,\n \"data-word-break\": wordBreak,\n \"data-overflow-wrap\": overflowWrap,\n \"data-margin\": margin,\n \"data-margin-top\": marginTop,\n \"data-margin-right\": marginRight,\n \"data-margin-bottom\": marginBottom,\n \"data-margin-left\": marginLeft,\n \"data-margin-vertical\": marginVertical,\n \"data-margin-horizontal\": marginHorizontal,\n \"data-padding\": padding,\n \"data-padding-top\": paddingTop,\n \"data-padding-right\": paddingRight,\n \"data-padding-bottom\": paddingBottom,\n \"data-padding-left\": paddingLeft,\n \"data-padding-vertical\": paddingVertical,\n \"data-padding-horizontal\": paddingHorizontal,\n };\n\n return (\n <>\n {calculatedAs === \"h1\" ? (\n <h1\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"h2\" ? (\n <h2\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"h3\" ? (\n <h3\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"h4\" ? (\n <h4\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"h5\" ? (\n <h5\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"h6\" ? (\n <h6\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n data-appearance={calculatedHTag}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"p\" ? (\n <p\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n\n {calculatedAs === \"span\" ? (\n <span\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n {calculatedAs === \"legend\" ? (\n <legend\n className={[\n \"component-heading\",\n \"color-props\",\n \"spacing-props\",\n \"text-props\",\n ].join(\" \")}\n {...convertedProps}\n {...htmlProps}\n />\n ) : null}\n </>\n );\n}\n\nexport default Heading;\n"],"names":["Heading","_a","textColor","backgroundColor","textSize","textAlign","textWeight","textFontFamily","wordBreak","overflowWrap","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","h1","h2","h3","h4","h5","h6","as","htmlProps","__rest","calculatedHTag","calculatedAs","convertedProps","React","createElement","Fragment","__assign","className","join"],"mappings":"qGA4BM,SAAUA,EAAQC,GACtB,IAAAC,EAASD,EAAAC,UACTC,EAAeF,EAAAE,gBACfC,EAAQH,EAAAG,SACRC,EAASJ,EAAAI,UACTC,EAAUL,EAAAK,WACVC,EAAcN,EAAAM,eACdC,EAASP,EAAAO,UACTC,EAAYR,EAAAQ,aACZC,EAAMT,EAAAS,OACNC,EAASV,EAAAU,UACTC,EAAWX,EAAAW,YACXC,EAAYZ,EAAAY,aACZC,EAAUb,EAAAa,WACVC,EAAcd,EAAAc,eACdC,EAAgBf,EAAAe,iBAChBC,EAAOhB,EAAAgB,QACPC,EAAUjB,EAAAiB,WACVC,EAAYlB,EAAAkB,aACZC,EAAanB,EAAAmB,cACbC,EAAWpB,EAAAoB,YACXC,EAAerB,EAAAqB,gBACfC,EAAiBtB,EAAAsB,kBACjBC,EAAEvB,EAAAuB,GACFC,EAAExB,EAAAwB,GACFC,EAAEzB,EAAAyB,GACFC,EAAE1B,EAAA0B,GACFC,EAAE3B,EAAA2B,GACFC,EAAE5B,EAAA4B,GACFC,EAAE7B,EAAA6B,GACCC,EAASC,EAAA/B,EA9BU,iWAgChBgC,EAAiBT,EACnB,KACAC,EACE,KACAC,EACE,KACAC,EACE,KACAC,EACE,KACAC,EACE,KACA,KAERK,EAAeJ,GAAUG,EAEzBE,EAAiB,CACrB,aAAcjC,EACd,gBAAiBC,EACjB,iBAAkBC,EAClB,kBAAmBC,EACnB,mBAAoBC,EACpB,wBAAyBC,EACzB,kBAAmBC,EACnB,qBAAsBC,EACtB,cAAeC,EACf,kBAAmBC,EACnB,oBAAqBC,EACrB,qBAAsBC,EACtB,mBAAoBC,EACpB,uBAAwBC,EACxB,yBAA0BC,EAC1B,eAAgBC,EAChB,mBAAoBC,EACpB,qBAAsBC,EACtB,sBAAuBC,EACvB,oBAAqBC,EACrB,wBAAyBC,EACzB,0BAA2BC,GAG7B,OACEa,EAAAC,cAAAD,EAAAE,SAAA,KACoB,OAAjBJ,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,OAAjBG,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,OAAjBG,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,OAAjBG,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,OAAjBG,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,OAAjBG,EACCE,EAAAC,cAAA,KAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,uBACUR,GACbE,EACAJ,IAEJ,KAEc,MAAjBG,EACCE,EAAAC,cAAA,IAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,MACHN,EACAJ,IAEJ,KAEc,SAAjBG,EACCE,EAAAC,cAAA,OAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,MACHN,EACAJ,IAEJ,KACc,WAAjBG,EACCE,EAAAC,cAAA,SAAAE,EAAA,CACEC,UAAW,CACT,oBACA,cACA,gBACA,cACAC,KAAK,MACHN,EACAJ,IAEJ,KAGV"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type IconDefinition } from "@fortawesome/fontawesome-common-types";
|
|
3
|
-
|
|
4
|
-
/** imported icon definition from "@fortawesome/free-solid-svg-icons" or "@fortawesome/free-brands-svg-icons" */
|
|
5
|
-
faIcon: IconDefinition;
|
|
6
|
-
/** color of icon, inherits current text colour by default */
|
|
7
|
-
color?: string;
|
|
8
|
-
/** size of ion 1.1em by default */
|
|
9
|
-
size?: string;
|
|
10
|
-
};
|
|
3
|
+
import { type spaces, type colours } from "src/types";
|
|
11
4
|
/**
|
|
12
5
|
* The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.
|
|
13
6
|
*
|
|
14
7
|
* This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size
|
|
15
8
|
* */
|
|
16
|
-
export declare function IconFa({ faIcon, color,
|
|
9
|
+
export declare function IconFa({ faIcon, size, color, }: {
|
|
10
|
+
/** imported icon definition from "@fortawesome/free-solid-svg-icons" or "@fortawesome/free-brands-svg-icons" */
|
|
11
|
+
faIcon: IconDefinition;
|
|
12
|
+
/** size of ion 1.1em by default */
|
|
13
|
+
size?: (typeof spaces)[number] | "full" | string;
|
|
14
|
+
/** color of icon */
|
|
15
|
+
color?: string | (typeof colours)[number];
|
|
16
|
+
}): React.JSX.Element;
|
|
17
17
|
export default IconFa;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import{themeSpacingSizeOrString as t,themeColorOrString as o}from"../../utils/themeUtils.js";function c(c){var r=c.faIcon,a=c.size,n=c.color,i=r.icon,s=i[0],l=i[1],m=i[4],f=o(n),p=t(a||"xs");return e.createElement("svg",{className:"component-icon-fa",role:"presentation",viewBox:"0 0 ".concat(s," ").concat(l),style:{color:f,height:p,width:p}},m&&e.createElement("path",{d:m}))}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 {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\n\nimport {\n themeColorOrString,\n themeSpacingSizeOrString,\n} from \"../../utils/themeUtils\";\n\nimport { type spaces, type colours } from \"src/types\";\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({\n faIcon,\n size,\n color,\n}: {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** size of ion 1.1em by default */\n size?: (typeof spaces)[number] | \"full\" | string;\n /** color of icon */\n color?: string | (typeof colours)[number];\n}) {\n const [width, height, , , svgPathData] = faIcon.icon;\n\n const themeColorOrStringValue = themeColorOrString(color);\n const themeSizeValueOrString = themeSpacingSizeOrString(size || \"xs\");\n\n return (\n <svg\n className={\"component-icon-fa\"}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n style={{\n color: themeColorOrStringValue,\n height: themeSizeValueOrString,\n width: themeSizeValueOrString,\n }}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </svg>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","_a","faIcon","size","color","_b","icon","width","height","svgPathData","themeColorOrStringValue","themeColorOrString","themeSizeValueOrString","themeSpacingSizeOrString","React","createElement","className","role","viewBox","concat","style","d"],"mappings":"kHAeM,SAAUA,EAAOC,GACrB,IAAAC,WACAC,EAAIF,EAAAE,KACJC,EAAKH,EAAAG,MASCC,EAAmCH,EAAOI,KAAzCC,EAAKF,EAAA,GAAEG,EAAMH,EAAA,GAAMI,OAEpBC,EAA0BC,EAAmBP,GAC7CQ,EAAyBC,EAAyBV,GAAQ,MAEhE,OACEW,EAAAC,cAAA,MAAA,CACEC,UAAW,oBACXC,KAAK,eACLC,QAAS,cAAOX,EAAK,KAAAY,OAAIX,GACzBY,MAAO,CACLhB,MAAOM,EACPF,OAAQI,EACRL,MAAOK,IAGRH,GAAeK,EAAAC,cAAA,OAAA,CAAMM,EAAGZ,IAG/B"}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import React, { type HTMLAttributes, type Ref, type ReactNode
|
|
2
|
-
import { type SpacingProps } from "
|
|
3
|
-
|
|
1
|
+
import React, { type HTMLAttributes, type Ref, type ReactNode } from "react";
|
|
2
|
+
import { type ColourVariableType, type SpacingProps } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Box is used to wrap other components to add margin and padding. The values will be in the t-shirt sizes specified in the theme sizes.
|
|
5
|
+
|
|
6
|
+
The more specific the the target the higher priority the css will have. For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.
|
|
7
|
+
*/
|
|
8
|
+
export declare const InfoBox: ({ children, titleText, titleTextColor, descriptionText, descriptionTextColor, icon, backgroundColor, ref, ...spacingAndHTMLElementProps }: SpacingProps & HTMLAttributes<HTMLElement> & {
|
|
4
9
|
/** background color of wrapping element, this will add default padding */
|
|
5
|
-
backgroundColor?:
|
|
10
|
+
backgroundColor?: ColourVariableType;
|
|
6
11
|
/** Title text */
|
|
7
12
|
titleText: string;
|
|
8
13
|
/** Title text colour */
|
|
9
|
-
titleTextColor?:
|
|
14
|
+
titleTextColor?: ColourVariableType;
|
|
10
15
|
/** Description text */
|
|
11
16
|
descriptionText: string;
|
|
12
17
|
/** Description text colour */
|
|
13
|
-
descriptionTextColor?:
|
|
18
|
+
descriptionTextColor?: ColourVariableType;
|
|
14
19
|
/** Space for extra element underneath description */
|
|
15
20
|
children?: ReactNode;
|
|
16
21
|
/** Icon in left column usually 2em squared */
|
|
17
22
|
icon?: ReactNode;
|
|
18
|
-
ref?: Ref<
|
|
19
|
-
|
|
20
|
-
as?: ElementType;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Box is used to wrap other components to add margin and padding. The values will be in the t-shirt sizes specified in the theme sizes.
|
|
24
|
-
|
|
25
|
-
The more specific the the target the higher priority the css will have. For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.
|
|
26
|
-
*/
|
|
27
|
-
export declare const InfoBox: ({ children, titleText, titleTextColor, descriptionText, descriptionTextColor, icon, ref, ...spacingAndHTMLElementProps }: InfoBoxProps) => React.JSX.Element;
|
|
23
|
+
ref?: Ref<HTMLDivElement>;
|
|
24
|
+
}) => React.JSX.Element;
|
|
28
25
|
export default InfoBox;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{
|
|
1
|
+
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{Box as r}from"../Box/index.js";import{Text as i}from"../Text/index.js";import{Heading as n}from"../Heading/index.js";var l=function(l){var a=l.children,m=l.titleText,c=l.titleTextColor,d=l.descriptionText,s=l.descriptionTextColor,x=l.icon,p=l.backgroundColor,f=l.ref,g=e(l,["children","titleText","titleTextColor","descriptionText","descriptionTextColor","icon","backgroundColor","ref"]);return o.createElement("div",t({className:["component-info-box","spacing-props","color-props"].join(" ")},g,{"data-bg-color":p||"background-mid",ref:f}),x&&o.createElement(r,{marginRight:"s"},x),o.createElement("div",null,m&&o.createElement(n,{as:"p",margin:"none",h4:!0,marginBottom:"xxs",textColor:c||"text-dark"},m),d&&o.createElement(i,{textColor:s||"text-dark",marginBottom:"none"},d),a))};export{l as InfoBox,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/InfoBox/index.tsx"],"sourcesContent":["import React, {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/InfoBox/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes, type Ref, type ReactNode } from \"react\";\n\nimport { Box } from \"../Box\";\nimport { Text } from \"../Text\";\nimport { Heading } from \"../Heading\";\n\nimport { type ColourVariableType, type SpacingProps } from \"../../types\";\n\n/**\n * Box is used to wrap other components to add margin and padding. The values will be in the t-shirt sizes specified in the theme sizes.\n \n The more specific the the target the higher priority the css will have. For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const InfoBox = ({\n children,\n titleText,\n titleTextColor,\n descriptionText,\n descriptionTextColor,\n icon,\n backgroundColor,\n ref,\n ...spacingAndHTMLElementProps\n}: SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of wrapping element, this will add default padding */\n backgroundColor?: ColourVariableType;\n /** Title text */\n titleText: string;\n /** Title text colour */\n titleTextColor?: ColourVariableType;\n /** Description text */\n descriptionText: string;\n /** Description text colour */\n descriptionTextColor?: ColourVariableType;\n /** Space for extra element underneath description */\n children?: ReactNode;\n /** Icon in left column usually 2em squared */\n icon?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n }) => {\n return (\n <div\n className={[\"component-info-box\", \"spacing-props\", \"color-props\"].join(\n \" \",\n )}\n {...spacingAndHTMLElementProps}\n data-bg-color={backgroundColor || \"background-mid\"}\n ref={ref}\n >\n {icon && <Box marginRight=\"s\">{icon}</Box>}\n <div>\n {titleText && (\n <Heading\n as=\"p\"\n margin=\"none\"\n h4\n marginBottom=\"xxs\"\n textColor={titleTextColor || \"text-dark\"}\n >\n {titleText}\n </Heading>\n )}\n {descriptionText && (\n <Text\n textColor={descriptionTextColor || \"text-dark\"}\n marginBottom=\"none\"\n >\n {descriptionText}\n </Text>\n )}\n {children}\n </div>\n </div>\n );\n};\n\nexport default InfoBox;\n"],"names":["InfoBox","_a","children","titleText","titleTextColor","descriptionText","descriptionTextColor","icon","backgroundColor","ref","spacingAndHTMLElementProps","__rest","React","createElement","__assign","className","join","Box","marginRight","Heading","as","margin","h4","marginBottom","textColor","Text"],"mappings":"iOAaO,IAAMA,EAAU,SAACC,GACtB,IAAAC,EAAQD,EAAAC,SACRC,EAASF,EAAAE,UACTC,EAAcH,EAAAG,eACdC,EAAeJ,EAAAI,gBACfC,EAAoBL,EAAAK,qBACpBC,EAAIN,EAAAM,KACJC,EAAeP,EAAAO,gBACfC,EAAGR,EAAAQ,IACAC,EAA0BC,EAAAV,EATP,CAAA,WAAA,YAAA,iBAAA,kBAAA,uBAAA,OAAA,kBAAA,QA4BtB,OACEW,EAAAC,cAAA,MAAAC,EAAA,CACEC,UAAW,CAAC,qBAAsB,gBAAiB,eAAeC,KAChE,MAEEN,EAA0B,CAAA,gBACfF,GAAmB,iBAClCC,IAAKA,IAEJF,GAAQK,gBAACK,EAAG,CAACC,YAAY,KAAKX,GAC/BK,EAAAC,cAAA,MAAA,KACGV,GACCS,EAAAC,cAACM,EAAO,CACNC,GAAG,IACHC,OAAO,OACPC,IAAE,EACFC,aAAa,MACbC,UAAWpB,GAAkB,aAE5BD,GAGJE,GACCO,EAAAC,cAACY,EAAI,CACHD,UAAWlB,GAAwB,YACnCiB,aAAa,QAEZlB,GAGJH,GAIT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import n from"react";function a(a){var l=a.label,i=a.hintText,r=a.required,m=void 0!==r&&r,o=a.hideRequiredIndicationInLabel,c=void 0!==o&&o,d=a.children,s=e(a,["label","hintText","required","hideRequiredIndicationInLabel","children"]),u=i&&("string"==typeof i&&i.length||"number"==typeof i)?n.createElement("span",{className:"hint-text"},i):i;return n.createElement(n.Fragment,null,l?n.createElement("label",t({className:"label-component"},s),n.createElement("span",{className:"label-text","data-hintext":!!i},l,!m&&!c&&n.createElement("span",{className:"required-indication-text"}," (optional)")),u,d):n.createElement(n.Fragment,null,d))}export{a as LabelWrapper,a 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\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/LabelWrapper/index.tsx"],"sourcesContent":["import React, { type LabelHTMLAttributes, type ReactNode } from \"react\";\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 hintTextElement =\n !!hintText &&\n ((typeof hintText === \"string\" && hintText.length) ||\n typeof hintText === \"number\") ? (\n <span className=\"hint-text\">{hintText}</span>\n ) : (\n hintText\n );\n\n return (\n <>\n {label ? (\n <label className=\"label-component\" {...otherHTMLLabelProps}>\n <span className=\"label-text\" data-hintext={!!hintText}>\n {label}\n {!required && !hideRequiredIndicationInLabel && (\n <span className=\"required-indication-text\">{` (optional)`}</span>\n )}\n </span>\n {hintTextElement}\n {children}\n </label>\n ) : (\n <>{children}</>\n )}\n </>\n );\n}\n\nexport default LabelWrapper;\n"],"names":["LabelWrapper","_a","label","hintText","_b","required","_c","hideRequiredIndicationInLabel","children","otherHTMLLabelProps","__rest","hintTextElement","length","React","createElement","className","Fragment","__assign"],"mappings":"qGAcM,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,EACFR,IACoB,iBAAbA,GAAyBA,EAASS,QACrB,iBAAbT,GACPU,EAAAC,cAAA,OAAA,CAAMC,UAAU,aAAaZ,GAAgB,EAKjD,OACEU,EAAAC,cAAAD,EAAAG,SAAA,KACGd,EACCW,EAAAC,cAAA,QAAAG,EAAA,CAAOF,UAAU,mBAAsBN,GACrCI,EAAAC,cAAA,OAAA,CAAMC,UAAU,aAAY,iBAAiBZ,GAC1CD,GACCG,IAAaE,GACbM,EAAAC,cAAA,OAAA,CAAMC,UAAU,4BAA4B,gBAG/CJ,EACAH,GAGHK,EAAAC,cAAAD,EAAAG,SAAA,KAAGR,GAIX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as
|
|
1
|
+
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{ErrorText as a}from"../ErrorText/index.js";function n(n){var s=n.children,i=n.legendText,o=n.required,l=n.errorMessage,m=n.hasError,d=n.hintText,c=e(n,["children","legendText","required","errorMessage","hasError","hintText"]);return r.createElement("fieldset",{className:"component-legend-wrapper","data-has-error":m||!!l||!1,"data-has-hint-text":!!d},i&&r.createElement("legend",t({},c),r.createElement("span",{className:"legend-span","data-has-hint-text":!!d},i," ",!o&&r.createElement("span",{className:"required-indication-text"},"(optional)")),!d||"string"!=typeof d&&"number"!=typeof d?d:r.createElement("span",{className:"hint-text"},d)),s,!!l&&r.createElement(a,{marginTop:"xxs"},l))}export{n as LegendWrapper,n as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|