@cruk/cruk-react-components 7.0.0 → 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 +138 -9
- package/lib/index.css +4247 -1
- package/lib/index.css.map +1 -1
- 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/Avatar/index.d.ts +2 -1
- 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 +7 -10
- 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 +6 -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.js +1 -1
- package/lib/src/components/Footer/index.js.map +1 -1
- 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 -17
- 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/index.d.ts +14 -18
- 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.js +1 -1
- package/lib/src/components/Totaliser/index.js.map +1 -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 +33 -2
- package/lib/src/components/index.js +1 -1
- package/lib/src/types.d.ts +40 -3
- package/lib/src/types.js +1 -1
- package/lib/src/types.js.map +1 -1
- 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.js +1 -1
- package/lib/src/utils/themeUtils.js.map +1 -1
- package/package.json +3 -6
- package/lib/src/components/AddressLookup/styles.d.ts +0 -12
- 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 -4
- 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 -9
- 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 -8
- 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 -10
- 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 -24
- 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 -9
- 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 -24
- 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 -16
- 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 -12
- package/lib/src/components/ErrorText/styles.js +0 -2
- package/lib/src/components/ErrorText/styles.js.map +0 -1
- package/lib/src/components/Footer/styles.d.ts +0 -9
- package/lib/src/components/Footer/styles.js +0 -2
- package/lib/src/components/Footer/styles.js.map +0 -1
- package/lib/src/components/Header/styles.d.ts +0 -22
- 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 -16
- 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 -5
- 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 -11
- 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 -6
- 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 -10
- 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 -18
- 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.module.css.js +0 -2
- package/lib/src/components/Loader/styles.module.css.js.map +0 -1
- package/lib/src/components/Modal/styles.d.ts +0 -27
- 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 -8
- 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 -10
- 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 -23
- 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 -12
- 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 -3
- 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 -4
- 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 -10
- 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 -14
- 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 -7
- 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 -13
- package/lib/src/components/TextField/styles.js +0 -2
- package/lib/src/components/TextField/styles.js.map +0 -1
- package/lib/src/components/Totaliser/styles.d.ts +0 -14
- 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 -4
- package/lib/src/components/UserBlock/styles.js +0 -2
- package/lib/src/components/UserBlock/styles.js.map +0 -1
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import React, { type
|
|
2
|
-
import { type SpacingProps } from "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** text colour */
|
|
9
|
-
textColor?: (typeof colours)[number] | string;
|
|
10
|
-
/** text horizontal alignment */
|
|
11
|
-
textAlign?: "left" | "right" | "center" | "justify";
|
|
12
|
-
/** font size FontSizeType t-shirt sizes */
|
|
13
|
-
textSize?: FontSizeType;
|
|
14
|
-
/** font weight theme.typography{fontWeightHeavy/fontWeightNormal/fontWeightMedium/fontWeightLight/fontWeightVLight} is better than a random number */
|
|
15
|
-
textWeight?: number | string;
|
|
16
|
-
/** font family theme.typography{fontFamilyBase/fontFamilyHeadings} is better than a random string */
|
|
17
|
-
textFontFamily?: string;
|
|
18
|
-
/** styled-components polymorphism where you can set this to "span", "p" or "h2" it default to "p" */
|
|
19
|
-
as?: ElementType;
|
|
20
|
-
/** word-break behaviour */
|
|
21
|
-
wordBreak?: WordBreakType;
|
|
22
|
-
/** overflow-wrap behaviour */
|
|
23
|
-
overflowWrap?: OverflowWrapType;
|
|
24
|
-
/** react reference to the DOM element sometime used to scroll to or set focus after an error */
|
|
25
|
-
ref?: Ref<HTMLElement>;
|
|
26
|
-
};
|
|
27
|
-
export declare const Text: (props: TextProps) => React.JSX.Element;
|
|
1
|
+
import React, { type Ref, type HTMLAttributes } from "react";
|
|
2
|
+
import { type ColourProps, type SpacingProps, type TextProps } from "../../types";
|
|
3
|
+
export declare const Text: ({ textColor, backgroundColor, textAlign, textSize, textWeight, textFontFamily, wordBreak, overflowWrap, margin, marginTop, marginRight, marginBottom, marginLeft, marginVertical, marginHorizontal, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, paddingVertical, paddingHorizontal, as, ref, ...htmlAttributes }: HTMLAttributes<HTMLElement> & ColourProps & SpacingProps & TextProps & {
|
|
4
|
+
as?: "span" | "div" | "p" | "address";
|
|
5
|
+
ref?: Ref<HTMLSpanElement | HTMLDivElement | HTMLParagraphElement>;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}) => React.JSX.Element;
|
|
28
8
|
export default Text;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as a,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{removeEmpty as r}from"../../utils/Helper.js";var e=function(e){var i=e.textColor,n=e.backgroundColor,d=e.textAlign,p=e.textSize,g=e.textWeight,m=e.textFontFamily,l=e.wordBreak,s=e.overflowWrap,c=e.margin,x=e.marginTop,f=e.marginRight,h=e.marginBottom,v=e.marginLeft,z=e.marginVertical,b=e.marginHorizontal,u=e.padding,w=e.paddingTop,j=e.paddingRight,B=e.paddingBottom,k=e.paddingLeft,E=e.paddingVertical,F=e.paddingHorizontal,H=e.as,C=e.ref,L=a(e,["textColor","backgroundColor","textAlign","textSize","textWeight","textFontFamily","wordBreak","overflowWrap","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","as","ref"]),N=r({"data-color":i,"data-bg-color":n,"data-text-size":p,"data-text-align":d,"data-text-weight":g,"data-text-font-family":m,"data-word-break":l,"data-overflow-wrap":s,"data-margin":c,"data-margin-top":x,"data-margin-right":f,"data-margin-bottom":h,"data-margin-left":v,"data-margin-vertical":z,"data-margin-horizontal":b,"data-padding":u,"data-padding-top":w,"data-padding-right":j,"data-padding-bottom":B,"data-padding-left":k,"data-padding-vertical":E,"data-padding-horizontal":F});return o.createElement(o.Fragment,null,(!H||"p"===H)&&o.createElement("p",t({className:["component-text","text-props","spacing-props","color-props"].join(" "),ref:C},L,N)),"div"===H&&o.createElement("div",t({className:["component-text","text-props","spacing-props","color-props"].join(" "),ref:C},L,N)),"span"===H&&o.createElement("span",t({className:["component-text","text-props","spacing-props","color-props"].join(" "),ref:C},L,N)),"address"===H&&o.createElement("address",t({className:["component-text","text-props","spacing-props","color-props"].join(" "),ref:C},L,N)))};export{e as Text,e as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Text/index.tsx"],"sourcesContent":["import React, { type
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Text/index.tsx"],"sourcesContent":["import React, { type Ref, type HTMLAttributes } from \"react\";\n\nimport { removeEmpty } from \"../../utils/Helper\";\n\nimport {\n type ColourProps,\n type SpacingProps,\n type TextProps,\n} from \"../../types\";\n\nexport const Text = ({\n textColor,\n backgroundColor,\n textAlign,\n textSize,\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 as,\n ref,\n ...htmlAttributes\n}: HTMLAttributes<HTMLElement> &\n ColourProps &\n SpacingProps &\n TextProps & {\n as?: \"span\" | \"div\" | \"p\" | \"address\";\n ref?: Ref<HTMLSpanElement | HTMLDivElement | HTMLParagraphElement>;\n style?: React.CSSProperties;\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 return (\n <>\n {(!as || as === \"p\") && (\n <p\n className={[\n \"component-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLParagraphElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n />\n )}\n {as === \"div\" && (\n <div\n className={[\n \"component-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLDivElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n />\n )}\n {as === \"span\" && (\n <span\n className={[\n \"component-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLSpanElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n />\n )}\n {as === \"address\" && (\n <address\n className={[\n \"component-text\",\n \"text-props\",\n \"spacing-props\",\n \"color-props\",\n ].join(\" \")}\n ref={ref as Ref<HTMLSpanElement>}\n {...htmlAttributes}\n {...convertedPropsFiltered}\n />\n )}\n </>\n );\n};\n\nexport default Text;\n"],"names":["Text","_a","textColor","backgroundColor","textAlign","textSize","textWeight","textFontFamily","wordBreak","overflowWrap","margin","marginTop","marginRight","marginBottom","marginLeft","marginVertical","marginHorizontal","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingVertical","paddingHorizontal","as","ref","htmlAttributes","__rest","convertedPropsFiltered","removeEmpty","React","createElement","Fragment","__assign","className","join"],"mappings":"yJAUO,IAAMA,EAAO,SAACC,GACnB,IAAAC,EAASD,EAAAC,UACTC,oBACAC,EAASH,EAAAG,UACTC,EAAQJ,EAAAI,SACRC,EAAUL,EAAAK,WACVC,EAAcN,EAAAM,eACdC,cACAC,EAAYR,EAAAQ,aACZC,EAAMT,EAAAS,OACNC,EAASV,EAAAU,UACTC,EAAWX,EAAAW,YACXC,iBACAC,EAAUb,EAAAa,WACVC,EAAcd,EAAAc,eACdC,EAAgBf,EAAAe,iBAChBC,EAAOhB,EAAAgB,QACPC,eACAC,EAAYlB,EAAAkB,aACZC,EAAanB,EAAAmB,cACbC,EAAWpB,EAAAoB,YACXC,EAAerB,EAAAqB,gBACfC,sBACAC,EAAEvB,EAAAuB,GACFC,EAAGxB,EAAAwB,IACAC,EAAcC,EAAA1B,EAzBE,yUA2Db2B,EAAyBC,EAzBR,CACrB,aAAc3B,EACd,gBAAiBC,EACjB,iBAAkBE,EAClB,kBAAmBD,EACnB,mBAAoBE,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,IAK7B,OACEO,EAAAC,cAAAD,EAAAE,SAAA,OACKR,GAAa,MAAPA,IACPM,EAAAC,cAAA,IAAAE,EAAA,CACEC,UAAW,CACT,iBACA,aACA,gBACA,eACAC,KAAK,KACPV,IAAKA,GACDC,EACAE,IAGA,QAAPJ,GACCM,EAAAC,cAAA,MAAAE,EAAA,CACEC,UAAW,CACT,iBACA,aACA,gBACA,eACAC,KAAK,KACPV,IAAKA,GACDC,EACAE,IAGA,SAAPJ,GACCM,EAAAC,cAAA,OAAAE,EAAA,CACEC,UAAW,CACT,iBACA,aACA,gBACA,eACAC,KAAK,KACPV,IAAKA,GACDC,EACAE,IAGA,YAAPJ,GACCM,EAAAC,cAAA,UAAAE,EAAA,CACEC,UAAW,CACT,iBACA,aACA,gBACA,eACAC,KAAK,KACPV,IAAKA,GACDC,EACAE,IAKd"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { type ReactNode, type TextareaHTMLAttributes, type Ref } from "react";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* TextAreaField lets users enter and edit multiline text.
|
|
4
|
+
*/
|
|
5
|
+
export declare const TextAreaField: ({ errorMessage, hasError, hintText, label, resize, lineCount, ref, ...props }: TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
3
6
|
/** error message text */
|
|
4
7
|
errorMessage?: string;
|
|
5
8
|
/** flag for error styling */
|
|
@@ -14,9 +17,5 @@ export type TextAreaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
|
14
17
|
lineCount?: number;
|
|
15
18
|
/** react reference to the DOM element sometime used to scroll to or set focus after an error */
|
|
16
19
|
ref?: Ref<HTMLTextAreaElement>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* TextAreaField lets users enter and edit multiline text.
|
|
20
|
-
*/
|
|
21
|
-
export declare const TextAreaField: ({ errorMessage, hasError, hintText, label, resize, lineCount, ref, ...props }: TextAreaFieldProps) => React.JSX.Element;
|
|
20
|
+
}) => React.JSX.Element;
|
|
22
21
|
export default TextAreaField;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as e,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{ErrorText as i}from"../ErrorText/index.js";import{LabelWrapper as a}from"../LabelWrapper/index.js";var o=function(o){var n=o.errorMessage,s=o.hasError,l=o.hintText,d=o.label,m=o.resize,c=void 0===m?"vertical":m,p=o.lineCount,x=void 0===p?3:p,f=o.ref,u=e(o,["errorMessage","hasError","hintText","label","resize","lineCount","ref"]),h=s||!!(null==n?void 0:n.length);return t.createElement(a,{label:d,hintText:l,required:u.required||!1},t.createElement("textarea",r({className:"component-textarea-field"},u,{"aria-invalid":h,"aria-describedby":u.id&&n?"".concat(u.id,"-error"):void 0,style:{resize:c,height:"".concat(1.5*x,"em")},ref:f,"data-hj-suppress":!0})),!!n&&t.createElement(i,{marginTop:"xxs",id:u.id?"".concat(u.id,"-error"):void 0},n))};export{o as TextAreaField,o as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/TextAreaField/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type TextareaHTMLAttributes,\n type Ref,\n} from \"react\";\n\nimport { ErrorText } from \"../ErrorText\";\nimport { LabelWrapper } from \"../LabelWrapper\";\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/TextAreaField/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type TextareaHTMLAttributes,\n type Ref,\n} from \"react\";\n\nimport { ErrorText } from \"../ErrorText\";\nimport { LabelWrapper } from \"../LabelWrapper\";\n\n/**\n * TextAreaField lets users enter and edit multiline text.\n */\nexport const TextAreaField = ({\n errorMessage,\n hasError,\n hintText,\n label,\n resize = \"vertical\",\n lineCount = 3,\n ref,\n ...props\n}: TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** error message text */\n errorMessage?: string;\n /** flag for error styling */\n hasError?: boolean;\n /** hint text */\n hintText?: ReactNode;\n /** label text */\n label: string;\n /** resize behaviour using the resize button on the bottom right of the component */\n resize?: \"both\" | \"vertical\" | \"horizontal\" | \"none\";\n /** number of visible lines of text before scroll is required this affect the height of the input field */\n lineCount?: number;\n /** react reference to the DOM element sometime used to scroll to or set focus after an error */\n ref?: Ref<HTMLTextAreaElement>;\n}) => {\n const invalid = hasError || !!errorMessage?.length;\n return (\n <LabelWrapper\n label={label}\n hintText={hintText}\n required={props.required || false}\n >\n <textarea\n className=\"component-textarea-field\"\n {...props}\n aria-invalid={invalid}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : undefined\n }\n style={{\n resize: resize,\n height: `${lineCount * 1.5}em`,\n }}\n ref={ref}\n data-hj-suppress\n />\n {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </LabelWrapper>\n );\n};\n\nexport default TextAreaField;\n"],"names":["TextAreaField","_a","errorMessage","hasError","hintText","label","_b","resize","_c","lineCount","ref","props","__rest","invalid","length","React","createElement","LabelWrapper","required","__assign","className","id","concat","undefined","style","height","ErrorText","marginTop"],"mappings":"+MAYO,IAAMA,EAAgB,SAACC,GAC5B,IAAAC,EAAYD,EAAAC,aACZC,aACAC,EAAQH,EAAAG,SACRC,EAAKJ,EAAAI,MACLC,EAAAL,EAAAM,OAAAA,OAAM,IAAAD,EAAG,WAAUA,EACnBE,EAAAP,EAAAQ,UAAAA,aAAY,EAACD,EACbE,EAAGT,EAAAS,IACAC,EAAKC,EAAAX,EARoB,2EAyBtBY,EAAUV,MAAcD,aAAY,EAAZA,EAAcY,QAC5C,OACEC,EAAAC,cAACC,GACCZ,MAAOA,EACPD,SAAUA,EACVc,SAAUP,EAAMO,WAAY,GAE5BH,EAAAC,cAAA,WAAAG,EAAA,CACEC,UAAU,4BACNT,EAAK,CAAA,eACKE,EAAO,mBAEjBF,EAAMU,IAAQnB,EAAe,GAAAoB,OAAGX,EAAMU,GAAE,eAAWE,EAEvDC,MAAO,CACLjB,OAAQA,EACRkB,OAAQ,GAAAH,OAAe,IAAZb,EAAe,OAE5BC,IAAKA,EAAG,oBAAA,OAGPR,GACDa,gBAACW,EAAS,CACRC,UAAU,MACVN,GAAIV,EAAMU,GAAK,GAAAC,OAAGX,EAAMU,kBAAaE,GAEpCrB,GAKX"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { type InputHTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type fontSizes } from "../../types";
|
|
2
3
|
export type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
+
textSize?: (typeof fontSizes)[number];
|
|
3
5
|
/** error message text */
|
|
4
6
|
errorMessage?: string;
|
|
5
7
|
/** custom component/text that appears underneath the input field */
|
|
@@ -30,5 +32,5 @@ export type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
|
30
32
|
/**
|
|
31
33
|
* TextFields let users enter and edit text. For multiline text entry please consider using the TextAreaFieldComponent.
|
|
32
34
|
* */
|
|
33
|
-
export declare const TextField: ({ errorMessage, extraBottom, extraLeft, extraRight, extraTop, hasError, hintText, isValid, isValidVisible, isInvalidVisible, label, hideRequiredIndicationInLabel, ref, ...props }: TextFieldProps) => React.JSX.Element;
|
|
35
|
+
export declare const TextField: ({ textSize, errorMessage, extraBottom, extraLeft, extraRight, extraTop, hasError, hintText, isValid, isValidVisible, isInvalidVisible, label, hideRequiredIndicationInLabel, ref, ...props }: TextFieldProps) => React.JSX.Element;
|
|
34
36
|
export default TextField;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as
|
|
1
|
+
import{__rest as e,__assign as a}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{ErrorText as i}from"../ErrorText/index.js";import{LabelWrapper as r}from"../LabelWrapper/index.js";var l=function(l){var s=l.textSize,n=l.errorMessage,d=l.extraBottom,o=l.extraLeft,m=l.extraRight,c=l.extraTop,p=l.hasError,x=l.hintText,b=l.isValid,v=l.isValidVisible,u=l.isInvalidVisible,h=l.label,E=l.hideRequiredIndicationInLabel,f=l.ref,g=e(l,["textSize","errorMessage","extraBottom","extraLeft","extraRight","extraTop","hasError","hintText","isValid","isValidVisible","isInvalidVisible","label","hideRequiredIndicationInLabel","ref"]),I=void 0!==b?b:!p&&!(null==n?void 0:n.length),N=t.createElement(t.Fragment,null,!!o&&t.createElement("span",{className:["extra","extra-left"].join(" ")},o),t.createElement("span",{className:"input-wrapper","data-is-valid-visible":v||!1,"data-is-invalid-visible":u||!1},t.createElement("input",a({className:"input text-props","aria-invalid":!I,"aria-describedby":g.id&&n?"".concat(g.id,"-error"):void 0,"data-is-valid-visible":v||!1,"data-is-invalid-visible":u||!1,"data-text-size":s},g,{"data-hj-suppress":!0,ref:f}))),!!m&&t.createElement("span",{className:["extra-right","extra"].join(" ")},m));return t.createElement(r,{label:h,hintText:x,required:g.required||!1,hideRequiredIndicationInLabel:E},t.createElement("span",{className:"component-text-field"},!!c&&t.createElement("span",{className:"extra"},c),m||o?t.createElement("span",{className:"extra-wrapper"},N):N,!!d&&t.createElement("span",{className:"extra"},d),!!(null==n?void 0:n.length)&&t.createElement(i,{marginTop:"xxs",id:g.id?"".concat(g.id,"-error"):void 0},n)))};export{l as TextField,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/TextField/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { ErrorText } from \"../ErrorText\";\nimport { LabelWrapper } from \"../LabelWrapper\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/TextField/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { ErrorText } from \"../ErrorText\";\nimport { LabelWrapper } from \"../LabelWrapper\";\n\nimport { type fontSizes } from \"../../types\";\n\nexport type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n textSize?: (typeof fontSizes)[number];\n /** error message text */\n errorMessage?: string;\n /** custom component/text that appears underneath the input field */\n extraBottom?: ReactNode;\n /** custom component/text that appears to the left of the input field for example prefixes like \"£\" */\n extraLeft?: ReactNode;\n /** custom component/text that appears to the right of the input field for example a search button */\n extraRight?: ReactNode;\n /** custom component/text that appears above the input field for example a url domain */\n extraTop?: ReactNode;\n /** flag for error styling */\n hasError?: boolean;\n /** flag which controls the whether a cross icon or check icon is displayed to the right of the input field */\n isValid?: boolean;\n /** flag to hide or show the check icon when valid */\n isValidVisible?: boolean;\n /** flag to hide or show the cross icon when invalid */\n isInvalidVisible?: boolean;\n /** hint text */\n hintText?: ReactNode;\n /** label text */\n label: string;\n /** flag to stop (optional) appearing in label, useful for compound form components like DateInput */\n hideRequiredIndicationInLabel?: boolean;\n /** react reference to the DOM element sometime used to scroll to or set focus after an error */\n ref?: Ref<HTMLInputElement>;\n};\n\n/**\n * TextFields let users enter and edit text. For multiline text entry please consider using the TextAreaFieldComponent.\n * */\nexport const TextField = ({\n textSize,\n errorMessage,\n extraBottom,\n extraLeft,\n extraRight,\n extraTop,\n hasError,\n hintText,\n isValid,\n isValidVisible,\n isInvalidVisible,\n label,\n hideRequiredIndicationInLabel,\n ref,\n ...props\n}: TextFieldProps) => {\n const isValidCalculated =\n typeof isValid !== \"undefined\"\n ? isValid\n : !hasError && !errorMessage?.length;\n\n const renderContent = (\n <>\n {!!extraLeft && (\n <span className={[\"extra\", \"extra-left\"].join(\" \")}>{extraLeft}</span>\n )}\n <span\n className=\"input-wrapper\"\n data-is-valid-visible={isValidVisible || false}\n data-is-invalid-visible={isInvalidVisible || false}\n >\n <input\n className=\"input text-props\"\n aria-invalid={!isValidCalculated}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : undefined\n }\n data-is-valid-visible={isValidVisible || false}\n data-is-invalid-visible={isInvalidVisible || false}\n data-text-size={textSize}\n {...props}\n data-hj-suppress\n ref={ref}\n />\n </span>\n {!!extraRight && (\n <span className={[\"extra-right\", \"extra\"].join(\" \")}>{extraRight}</span>\n )}\n </>\n );\n\n return (\n <LabelWrapper\n label={label}\n hintText={hintText}\n required={props.required || false}\n hideRequiredIndicationInLabel={hideRequiredIndicationInLabel}\n >\n <span className=\"component-text-field\">\n {!!extraTop && <span className=\"extra\">{extraTop}</span>}\n {!!extraRight || !!extraLeft ? (\n <span className=\"extra-wrapper\">{renderContent}</span>\n ) : (\n renderContent\n )}\n {!!extraBottom && <span className=\"extra\">{extraBottom}</span>}\n {!!errorMessage?.length && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </span>\n </LabelWrapper>\n );\n};\n\nexport default TextField;\n"],"names":["TextField","_a","textSize","errorMessage","extraBottom","extraLeft","extraRight","extraTop","hasError","hintText","isValid","isValidVisible","isInvalidVisible","label","hideRequiredIndicationInLabel","ref","props","__rest","isValidCalculated","length","renderContent","React","createElement","Fragment","className","join","__assign","id","undefined","LabelWrapper","required","ErrorText","marginTop"],"mappings":"+MA4CO,IAAMA,EAAY,SAACC,GACxB,IAAAC,aACAC,iBACAC,gBACAC,cACAC,eACAC,aACAC,aACAC,aACAC,YACAC,mBACAC,qBACAC,UACAC,kCACAC,QACGC,EAAKC,EAAAhB,EAfgB,CAAA,WAAA,eAAA,cAAA,YAAA,aAAA,WAAA,WAAA,WAAA,UAAA,iBAAA,mBAAA,QAAA,gCAAA,QAiBlBiB,OACe,IAAZR,EACHA,GACCF,KAAaL,aAAY,EAAZA,EAAcgB,QAE5BC,EACJC,EAAAC,cAAAD,EAAAE,SAAA,OACKlB,GACDgB,wBAAMG,UAAW,CAAC,QAAS,cAAcC,KAAK,MAAOpB,GAEvDgB,EAAAC,cAAA,OAAA,CACEE,UAAU,gBAAe,wBACFb,IAAkB,EAAK,0BACrBC,IAAoB,GAE7CS,EAAAC,cAAA,QAAAI,EAAA,CACEF,UAAU,mBAAkB,gBACbN,EAAiB,mBAE5BF,EAAMW,IAAQxB,EAAe,UAAGa,EAAMW,GAAE,eAAWC,0BAEhCjB,IAAkB,EAAK,0BACrBC,IAAoB,EAAK,iBAClCV,GACZc,yBAEJD,IAAKA,QAGNT,GACDe,wBAAMG,UAAW,CAAC,cAAe,SAASC,KAAK,MAAOnB,IAK5D,OACEe,gBAACQ,EAAY,CACXhB,MAAOA,EACPJ,SAAUA,EACVqB,SAAUd,EAAMc,WAAY,EAC5BhB,8BAA+BA,GAE/BO,EAAAC,cAAA,OAAA,CAAME,UAAU,0BACXjB,GAAYc,EAAAC,cAAA,OAAA,CAAME,UAAU,SAASjB,GACrCD,GAAgBD,EACjBgB,EAAAC,cAAA,OAAA,CAAME,UAAU,iBAAiBJ,GAAqB,IAIrDhB,GAAeiB,EAAAC,cAAA,OAAA,CAAME,UAAU,SAASpB,MACxCD,aAAY,EAAZA,EAAcgB,SACfE,gBAACU,EAAS,CACRC,UAAU,MACVL,GAAIX,EAAMW,GAAK,UAAGX,EAAMW,GAAE,eAAWC,GAEpCzB,IAMb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{calculatePercentRounded as
|
|
1
|
+
import e from"react";import{calculatePercentRounded as a,formatMoneyWithCommas as t}from"../../utils/Helper.js";import{Text as r}from"../Text/index.js";import{Badge as m}from"../Badge/index.js";import{Box as n}from"../Box/index.js";import{ProgressBar as s}from"../ProgressBar/index.js";function l(l){var c=l.total,o=l.additionalAmount,i=l.giftAid,p=l.target,d=void 0===p?null:p,E=l.isCompact,g=l.summaryMessage,u=void 0===g?void 0:g,f=l.children,x=a(+c,d||0),N=a(o?+c+(o||0):0,d||0),v="".concat(x,"% of the £").concat(t(d||0)," target");return e.createElement("div",{className:"component-totaliser"},E?e.createElement(n,{marginHorizontal:"none",marginRight:"xxs",marginBottom:"none"},e.createElement(m,null,"£".concat(t(c)))):e.createElement("div",{className:"bubble-wrapper"},e.createElement("p",{className:"bubble-text"},"Total raised"),e.createElement("p",{className:"total"},"£",t(c)),e.createElement("p",{className:"gift-aid"},"+ £",t(i||0)," Gift Aid")),(!!d||!!u)&&e.createElement(e.Fragment,null,e.createElement("div",{className:"progress-bar-wrapper","data-is-compact":E||!1},e.createElement(s,{percentage:x,secondaryPercentage:N}),E?e.createElement("div",{className:"compact-wrapper"},null!==d&&e.createElement("span",{className:"summary"},e.createElement(r,{as:"span"},v))):u?e.createElement("span",{className:"summary"},u):e.createElement("span",{className:"summary"},e.createElement(r,{as:"span"},v)))),f)}export{l as Totaliser,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Totaliser/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\n\nimport {\n calculatePercentRounded,\n formatMoneyWithCommas,\n} from \"../../utils/Helper\";\n\nimport { Text } from \"../Text\";\nimport { Badge } from \"../Badge\";\nimport { Box } from \"../Box\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Totaliser/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\n\nimport {\n calculatePercentRounded,\n formatMoneyWithCommas,\n} from \"../../utils/Helper\";\n\nimport { Text } from \"../Text\";\nimport { Badge } from \"../Badge\";\nimport { Box } from \"../Box\";\n\nimport { ProgressBar } from \"../ProgressBar\";\n\n// TODO figure out how we want to handle AriaAttributes\n\n/**\n * Think Blue Peter, used to display total raised and if target prop is passed will display percentage of target reached.\n * */\nexport function Totaliser({\n total,\n additionalAmount,\n giftAid,\n target = null,\n isCompact,\n summaryMessage = undefined,\n children,\n}: {\n /** financial total as a number */\n total: number;\n /** additional donation amount as a number */\n additionalAmount?: number;\n /** git aid total as a number */\n giftAid?: number;\n /** money target as a number */\n target?: number | null;\n /** flag for low height compact appearance */\n isCompact?: boolean;\n /** component for custom summary message underneath total graph only visible if there is a target */\n summaryMessage?: ReactNode;\n /** component children */\n children?: ReactNode;\n}) {\n const percentageOfTotal = calculatePercentRounded(+total, target || 0);\n const withAdditionalPercentageOfTotal = calculatePercentRounded(\n additionalAmount ? +total + (additionalAmount || 0) : 0,\n target || 0,\n );\n\n const summaryString = `${percentageOfTotal}% of the £${formatMoneyWithCommas(\n target || 0,\n )} target`;\n\n return (\n <div className=\"component-totaliser\">\n {!isCompact ? (\n <div className=\"bubble-wrapper\">\n <p className=\"bubble-text\">Total raised</p>\n <p className=\"total\">£{formatMoneyWithCommas(total)}</p>\n <p className=\"gift-aid\">\n + £{formatMoneyWithCommas(giftAid || 0)} Gift Aid\n </p>\n </div>\n ) : (\n <Box marginHorizontal=\"none\" marginRight=\"xxs\" marginBottom=\"none\">\n <Badge>{`£${formatMoneyWithCommas(total)}`}</Badge>\n </Box>\n )}\n {/* We don't want to show the default summaryMessage if there is no target, because the summary is associated with the target progress bar */}\n {/* However, if we explicitly pass a summaryMessage string/component, then we want to always display it even if the target is zero */}\n\n {(!!target || !!summaryMessage) && (\n <>\n <div\n className=\"progress-bar-wrapper\"\n data-is-compact={isCompact || false}\n >\n <ProgressBar\n percentage={percentageOfTotal}\n secondaryPercentage={withAdditionalPercentageOfTotal}\n />\n {!isCompact ? (\n summaryMessage ? (\n <span className=\"summary\">{summaryMessage}</span>\n ) : (\n <span className=\"summary\">\n <Text as=\"span\">{summaryString}</Text>\n </span>\n )\n ) : (\n <div className=\"compact-wrapper\">\n {target !== null && (\n <span className=\"summary\">\n <Text as=\"span\">{summaryString}</Text>\n </span>\n )}\n </div>\n )}\n </div>\n </>\n )}\n {children}\n </div>\n );\n}\n\nexport default Totaliser;\n"],"names":["Totaliser","_a","total","additionalAmount","giftAid","_b","target","isCompact","_c","summaryMessage","undefined","children","percentageOfTotal","calculatePercentRounded","withAdditionalPercentageOfTotal","summaryString","concat","formatMoneyWithCommas","React","createElement","className","Box","marginHorizontal","marginRight","marginBottom","Badge","Fragment","ProgressBar","percentage","secondaryPercentage","Text","as"],"mappings":"8RAkBM,SAAUA,EAAUC,OACxBC,EAAKD,EAAAC,MACLC,EAAgBF,EAAAE,iBAChBC,EAAOH,EAAAG,QACPC,EAAAJ,EAAAK,OAAAA,OAAM,IAAAD,EAAG,OACTE,EAASN,EAAAM,UACTC,EAAAP,EAAAQ,eAAAA,OAAc,IAAAD,OAAGE,EAASF,EAC1BG,EAAQV,EAAAU,SAiBFC,EAAoBC,GAAyBX,EAAOI,GAAU,GAC9DQ,EAAkCD,EACtCV,GAAoBD,GAASC,GAAoB,GAAK,EACtDG,GAAU,GAGNS,EAAgB,GAAAC,OAAGJ,EAAiB,cAAAI,OAAaC,EACrDX,GAAU,GACX,WAED,OACEY,EAAAC,cAAA,MAAA,CAAKC,UAAU,uBACXb,EASAW,EAAAC,cAACE,EAAG,CAACC,iBAAiB,OAAOC,YAAY,MAAMC,aAAa,QAC1DN,EAAAC,cAACM,EAAK,KAAE,IAAAT,OAAIC,EAAsBf,MATpCgB,EAAAC,cAAA,MAAA,CAAKC,UAAU,kBACbF,EAAAC,cAAA,IAAA,CAAGC,UAAU,eAAa,gBAC1BF,EAAAC,cAAA,IAAA,CAAGC,UAAU,aAAUH,EAAsBf,IAC7CgB,EAAAC,cAAA,IAAA,CAAGC,UAAU,kBACPH,EAAsBb,GAAW,GACnC,iBAUJE,KAAYG,IACdS,EAAAC,cAAAD,EAAAQ,SAAA,KACER,EAAAC,cAAA,MAAA,CACEC,UAAU,uBAAsB,kBACfb,IAAa,GAE9BW,EAAAC,cAACQ,GACCC,WAAYhB,EACZiB,oBAAqBf,IAErBP,EASAW,EAAAC,cAAA,MAAA,CAAKC,UAAU,mBACD,OAAXd,GACCY,EAAAC,cAAA,OAAA,CAAMC,UAAU,WACdF,EAAAC,cAACW,EAAI,CAACC,GAAG,QAAQhB,KAXvBN,EACES,EAAAC,cAAA,OAAA,CAAMC,UAAU,WAAWX,GAE3BS,EAAAC,cAAA,OAAA,CAAMC,UAAU,WACdF,EAAAC,cAACW,EAAI,CAACC,GAAG,QAAQhB,MAe5BJ,EAGP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{Avatar as
|
|
1
|
+
import e from"react";import{Avatar as a}from"../Avatar/index.js";function t(t){var m=t.name,r=t.avatarName,n=t.avatarUrl,o=t.extra,s=t.size,l=void 0===s?"l":s,c=t.themeName,i=void 0===c?"cruk":c;return e.createElement("div",{className:"component-user-block"},e.createElement(a,{name:r||("string"==typeof m?m:"Anonymous"),url:n||void 0,size:l,themeName:i}),e.createElement("div",{className:"details"},e.createElement("p",{className:"name"},m||"Anonymous"),!!o&&e.createElement("p",{className:"extra"},o)))}export{t as UserBlock,t as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/UserBlock/index.tsx"],"sourcesContent":["import React, { type ReactNode, type HTMLAttributes } from \"react\";\n\nimport { Avatar } from \"../Avatar\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/UserBlock/index.tsx"],"sourcesContent":["import React, { type ReactNode, type HTMLAttributes } from \"react\";\n\nimport { Avatar } from \"../Avatar\";\n\nimport { type ThemeNameType } from \"../../types\";\n\nexport type UserBlockProps = HTMLAttributes<HTMLElement> & {\n /** name component or text */\n name?: ReactNode;\n /** string name used in avatar component */\n avatarName?: string | null;\n /** avatar image url */\n avatarUrl?: string | null;\n /** extra content component appears underneath name */\n extra?: ReactNode;\n /** size of avatar component */\n size?: \"s\" | \"m\" | \"l\" | \"xl\";\n themeName: ThemeNameType;\n};\n\n/**\n * Display an avatar with title and subtitle\n */\nexport function UserBlock({\n name,\n avatarName,\n avatarUrl,\n extra,\n size = \"l\",\n themeName = \"cruk\",\n}: UserBlockProps) {\n // name is a reserved html prop so we make sure we don't pass it into the styled component\n // or it will end up in the markup\n return (\n <div className=\"component-user-block\">\n <Avatar\n name={avatarName || (typeof name === \"string\" ? name : \"Anonymous\")}\n url={avatarUrl || undefined}\n size={size}\n themeName={themeName}\n />\n <div className=\"details\">\n <p className=\"name\">{name || \"Anonymous\"}</p>\n {!!extra && <p className=\"extra\">{extra}</p>}\n </div>\n </div>\n );\n}\n\nexport default UserBlock;\n"],"names":["UserBlock","_a","name","avatarName","avatarUrl","extra","_b","size","_c","themeName","React","createElement","className","Avatar","url","undefined"],"mappings":"iEAuBM,SAAUA,EAAUC,OACxBC,EAAID,EAAAC,KACJC,EAAUF,EAAAE,WACVC,EAASH,EAAAG,UACTC,EAAKJ,EAAAI,MACLC,SAAAC,OAAI,IAAAD,EAAG,IAAGA,EACVE,cAAAC,OAAS,IAAAD,EAAG,OAAMA,EAIlB,OACEE,EAAAC,cAAA,MAAA,CAAKC,UAAU,wBACbF,EAAAC,cAACE,EAAM,CACLX,KAAMC,IAA+B,iBAATD,EAAoBA,EAAO,aACvDY,IAAKV,QAAaW,EAClBR,KAAMA,EACNE,UAAWA,IAEbC,EAAAC,cAAA,MAAA,CAAKC,UAAU,WACbF,EAAAC,cAAA,IAAA,CAAGC,UAAU,QAAQV,GAAQ,eAC1BG,GAASK,EAAAC,cAAA,IAAA,CAAGC,UAAU,SAASP,IAI1C"}
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
import "./global-styles.css";
|
|
2
2
|
export { AddressLookup } from "./AddressLookup";
|
|
3
|
+
import "./AddressLookup/styles.css";
|
|
3
4
|
export { Avatar } from "./Avatar";
|
|
5
|
+
import "./Avatar/styles.css";
|
|
4
6
|
export { Badge } from "./Badge";
|
|
7
|
+
import "./Badge/styles.css";
|
|
5
8
|
export { Box } from "./Box";
|
|
9
|
+
import "./Box/styles.css";
|
|
6
10
|
export { Button } from "./Button";
|
|
11
|
+
import "./Button/styles.css";
|
|
7
12
|
export { Carousel } from "./Carousel";
|
|
13
|
+
import "./Carousel/styles.css";
|
|
8
14
|
export { Checkbox } from "./Checkbox";
|
|
15
|
+
import "./Checkbox/styles.css";
|
|
9
16
|
export { Collapse } from "./Collapse";
|
|
17
|
+
import "./Collapse/styles.css";
|
|
10
18
|
export { DateField } from "./DateField";
|
|
11
|
-
|
|
19
|
+
import "./DateField/styles.css";
|
|
12
20
|
export { ErrorText } from "./ErrorText";
|
|
21
|
+
import "./ErrorText/styles.css";
|
|
13
22
|
export { Footer } from "./Footer";
|
|
23
|
+
import "./Footer/styles.css";
|
|
14
24
|
export { Header } from "./Header";
|
|
25
|
+
import "./Header/styles.css";
|
|
15
26
|
export { Heading } from "./Heading";
|
|
27
|
+
import "./Heading/styles.css";
|
|
16
28
|
export { IconFa } from "./IconFa";
|
|
29
|
+
import "./IconFa/styles.css";
|
|
30
|
+
export { InfoBox } from "./InfoBox";
|
|
31
|
+
import "./InfoBox/styles.css";
|
|
17
32
|
export { LabelWrapper } from "./LabelWrapper";
|
|
33
|
+
import "./LabelWrapper/styles.css";
|
|
18
34
|
export { LegendWrapper } from "./LegendWrapper";
|
|
35
|
+
import "./LegendWrapper/styles.css";
|
|
19
36
|
export { Link } from "./Link";
|
|
37
|
+
import "./Link/styles.css";
|
|
20
38
|
export { Loader } from "./Loader";
|
|
39
|
+
import "./Loader/styles.css";
|
|
21
40
|
export { Modal } from "./Modal";
|
|
41
|
+
import "./Modal/styles.css";
|
|
22
42
|
export { Pagination } from "./Pagination";
|
|
43
|
+
import "./Pagination/styles.css";
|
|
23
44
|
export { PopOver } from "./PopOver";
|
|
45
|
+
import "./PopOver/styles.css";
|
|
24
46
|
export { ProgressBar } from "./ProgressBar";
|
|
47
|
+
import "./ProgressBar/styles.css";
|
|
25
48
|
export { Radio } from "./Radio";
|
|
49
|
+
import "./Radio/styles.css";
|
|
26
50
|
export { RadioConsent } from "./RadioConsent";
|
|
51
|
+
import "./RadioConsent/styles.css";
|
|
27
52
|
export { Select } from "./Select";
|
|
53
|
+
import "./Select/styles.css";
|
|
28
54
|
export { Step } from "./Step";
|
|
55
|
+
import "./Step/styles.css";
|
|
29
56
|
export { Text } from "./Text";
|
|
57
|
+
import "./Text/styles.css";
|
|
30
58
|
export { TextAreaField } from "./TextAreaField";
|
|
59
|
+
import "./TextAreaField/styles.css";
|
|
31
60
|
export { TextField } from "./TextField";
|
|
61
|
+
import "./TextField/styles.css";
|
|
32
62
|
export { Totaliser } from "./Totaliser";
|
|
63
|
+
import "./Totaliser/styles.css";
|
|
33
64
|
export { UserBlock } from "./UserBlock";
|
|
34
|
-
|
|
65
|
+
import "./UserBlock/styles.css";
|
|
35
66
|
export * from "../types";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{AddressLookup}from"./AddressLookup/index.js";export{Avatar}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Box}from"./Box/index.js";export{Button}from"./Button/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Collapse}from"./Collapse/index.js";export{DateField}from"./DateField/index.js";export{
|
|
1
|
+
export{AddressLookup}from"./AddressLookup/index.js";export{Avatar}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Box}from"./Box/index.js";export{Button}from"./Button/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Collapse}from"./Collapse/index.js";export{DateField}from"./DateField/index.js";export{ErrorText}from"./ErrorText/index.js";export{Footer}from"./Footer/index.js";export{Header}from"./Header/index.js";export{Heading}from"./Heading/index.js";export{IconFa}from"./IconFa/index.js";export{InfoBox}from"./InfoBox/index.js";export{LabelWrapper}from"./LabelWrapper/index.js";export{LegendWrapper}from"./LegendWrapper/index.js";export{Link}from"./Link/index.js";export{Loader}from"./Loader/index.js";export{Modal}from"./Modal/index.js";export{Pagination}from"./Pagination/index.js";export{PopOver}from"./PopOver/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{Radio}from"./Radio/index.js";export{RadioConsent}from"./RadioConsent/index.js";export{Select}from"./Select/index.js";export{Step}from"./Step/index.js";export{Text}from"./Text/index.js";export{TextAreaField}from"./TextAreaField/index.js";export{TextField}from"./TextField/index.js";export{Totaliser}from"./Totaliser/index.js";export{UserBlock}from"./UserBlock/index.js";export{colours,fontAligns,fontFamilyStyles,fontSizes,fontWeights,overflowWraps,spaces,themeNames,wordBreaks}from"../types.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/src/types.d.ts
CHANGED
|
@@ -12,6 +12,30 @@ export type BreakPointType = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare const spaces: readonly ["auto", "xxxs", "xxs", "xs", "s", "m", "l", "xl", "xxl", "none"];
|
|
14
14
|
export type SpaceType = (typeof spaces)[number];
|
|
15
|
+
export type SpacingProps = {
|
|
16
|
+
margin?: SpaceType;
|
|
17
|
+
marginTop?: SpaceType;
|
|
18
|
+
marginRight?: SpaceType;
|
|
19
|
+
marginBottom?: SpaceType;
|
|
20
|
+
marginLeft?: SpaceType;
|
|
21
|
+
marginVertical?: SpaceType;
|
|
22
|
+
marginHorizontal?: SpaceType;
|
|
23
|
+
padding?: SpaceType;
|
|
24
|
+
paddingTop?: SpaceType;
|
|
25
|
+
paddingRight?: SpaceType;
|
|
26
|
+
paddingBottom?: SpaceType;
|
|
27
|
+
paddingLeft?: SpaceType;
|
|
28
|
+
paddingVertical?: SpaceType;
|
|
29
|
+
paddingHorizontal?: SpaceType;
|
|
30
|
+
};
|
|
31
|
+
export type TextProps = {
|
|
32
|
+
textSize?: FontSizeType;
|
|
33
|
+
textAlign?: FontAlignType;
|
|
34
|
+
textWeight?: FontWeightType;
|
|
35
|
+
textFontFamily?: FontFamilyStylesType;
|
|
36
|
+
wordBreak?: WordBreakType;
|
|
37
|
+
overflowWrap?: OverflowWrapType;
|
|
38
|
+
};
|
|
15
39
|
export type ShadowsType = {
|
|
16
40
|
s: string;
|
|
17
41
|
m: string;
|
|
@@ -75,8 +99,17 @@ export type AddressDataType = {
|
|
|
75
99
|
SubBuilding: string;
|
|
76
100
|
Type: string;
|
|
77
101
|
};
|
|
78
|
-
export declare const colours: readonly ["primary", "secondary", "tertiary", "text-on-primary", "text-on-secondary", "text-on-tertiary", "
|
|
102
|
+
export declare const colours: readonly ["currentColor", "primary", "secondary", "tertiary", "text-on-primary", "text-on-secondary", "text-on-tertiary", "disabled", "danger", "warning", "success", "info", "sports-activity", "text-dark", "text-light", "text-mid", "background-light", "background-light-color", "background-mid", "background-mid-light"];
|
|
79
103
|
export type ColourVariableType = (typeof colours)[number];
|
|
104
|
+
export type ColourProps = {
|
|
105
|
+
textColor?: ColourVariableType;
|
|
106
|
+
backgroundColor?: ColourVariableType;
|
|
107
|
+
borderColor?: ColourVariableType;
|
|
108
|
+
};
|
|
109
|
+
export declare const fontFamilyStyles: readonly ["base", "headings", "links", "buttons", "label"];
|
|
110
|
+
export type FontFamilyStylesType = (typeof fontFamilyStyles)[number];
|
|
111
|
+
export declare const fontWeights: readonly ["base", "headings", "links", "buttons", "labels", "heavy", "medium", "normal", "light", "vlight"];
|
|
112
|
+
export type FontWeightType = (typeof fontWeights)[number];
|
|
80
113
|
export type AddressOptionsType = {
|
|
81
114
|
Description: string;
|
|
82
115
|
Type: string;
|
|
@@ -84,5 +117,9 @@ export type AddressOptionsType = {
|
|
|
84
117
|
Text: string;
|
|
85
118
|
Error?: Error;
|
|
86
119
|
};
|
|
87
|
-
export
|
|
88
|
-
export type
|
|
120
|
+
export declare const wordBreaks: readonly ["normal", "break-all", "keep-all", "break-word", "inherit", "initial", "unset"];
|
|
121
|
+
export type WordBreakType = (typeof wordBreaks)[number];
|
|
122
|
+
export declare const overflowWraps: readonly ["normal", "anywhere", "revert", "revert-layer", "break-word", "inherit", "initial", "unset"];
|
|
123
|
+
export type OverflowWrapType = (typeof overflowWraps)[number];
|
|
124
|
+
export declare const fontAligns: readonly ["left", "right", "center", "justify"];
|
|
125
|
+
export type FontAlignType = (typeof fontAligns)[number];
|
package/lib/src/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=["xs","s","m","ml","l","xl","xxl","xxxl","xxxxl"],r=["cruk","su2c","bowelbabe","rfl"],t=["auto","xxxs","xxs","xs","s","m","l","xl","xxl","none"],a=["currentColor","primary","secondary","tertiary","text-on-primary","text-on-secondary","text-on-tertiary","disabled","danger","warning","success","info","sports-activity","text-dark","text-light","text-mid","background-light","background-light-color","background-mid","background-mid-light"],l=["base","headings","links","buttons","label"],i=["base","headings","links","buttons","labels","heavy","medium","normal","light","vlight"],n=["normal","break-all","keep-all","break-word","inherit","initial","unset"],s=["normal","anywhere","revert","revert-layer","break-word","inherit","initial","unset"],x=["left","right","center","justify"];export{a as colours,x as fontAligns,l as fontFamilyStyles,e as fontSizes,i as fontWeights,s as overflowWraps,t as spaces,r as themeNames,n as wordBreaks};
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["export const fontSizes = [\n \"xs\",\n \"s\",\n \"m\",\n \"ml\",\n \"l\",\n \"xl\",\n \"xxl\",\n \"xxxl\",\n \"xxxxl\",\n] as const;\n\nexport type FontSizeType = (typeof fontSizes)[number];\n\nexport const themeNames = [\"cruk\", \"su2c\", \"bowelbabe\", \"rfl\"] as const;\nexport type ThemeNameType = (typeof themeNames)[number];\n\nexport type ButtonAppearanceType = \"primary\" | \"secondary\" | \"tertiary\";\n\nexport type PopOverPositionType =\n | \"top\"\n | \"topLeft\"\n | \"left\"\n | \"right\"\n | \"bottom\"\n | \"bottomLeft\";\n\nexport type BreakPointType = {\n mobile: string;\n tablet: string;\n desktop: string;\n desktopLarge: string;\n};\n\nexport const spaces = [\n \"auto\",\n \"xxxs\",\n \"xxs\",\n \"xs\",\n \"s\",\n \"m\",\n \"l\",\n \"xl\",\n \"xxl\",\n \"none\",\n] as const;\n\nexport type SpaceType = (typeof spaces)[number];\n\nexport type ShadowsType = {\n s: string;\n m: string;\n l: string;\n};\n\nexport type AddressDataType = {\n AdminAreaCode: string;\n AdminAreaName: string;\n Barcode: string;\n Block: string;\n BuildingName: string;\n BuildingNumber: string;\n City: string;\n Company: string;\n CountryIso2: string;\n CountryIso3: string;\n CountryIsoNumber: string;\n CountryName: string;\n DataLevel: string;\n Department: string;\n DomesticId: string;\n Field1: string;\n Field10: string;\n Field11: string;\n Field12: string;\n Field13: string;\n Field14: string;\n Field15: string;\n Field16: string;\n Field17: string;\n Field18: string;\n Field19: string;\n Field2: string;\n Field20: string;\n Field3: string;\n Field4: string;\n Field5: string;\n Field6: string;\n Field7: string;\n Field8: string;\n Field9: string;\n Id: string;\n Label: string;\n Language: string;\n LanguageAlternatives: string;\n Line1: string;\n Line2: string;\n Line3: string;\n Line4: string;\n Line5: string;\n Neighbourhood: string;\n POBoxNumber: string;\n PostalCode: string;\n Province: string;\n ProvinceCode: string;\n ProvinceName: string;\n SecondaryStreet: string;\n SortingNumber1: string;\n SortingNumber2: string;\n Street: string;\n SubBuilding: string;\n Type: string;\n};\n\nexport const colours = [\n \
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["export const fontSizes = [\n \"xs\",\n \"s\",\n \"m\",\n \"ml\",\n \"l\",\n \"xl\",\n \"xxl\",\n \"xxxl\",\n \"xxxxl\",\n] as const;\n\nexport type FontSizeType = (typeof fontSizes)[number];\n\nexport const themeNames = [\"cruk\", \"su2c\", \"bowelbabe\", \"rfl\"] as const;\nexport type ThemeNameType = (typeof themeNames)[number];\n\nexport type ButtonAppearanceType = \"primary\" | \"secondary\" | \"tertiary\";\n\nexport type PopOverPositionType =\n | \"top\"\n | \"topLeft\"\n | \"left\"\n | \"right\"\n | \"bottom\"\n | \"bottomLeft\";\n\nexport type BreakPointType = {\n mobile: string;\n tablet: string;\n desktop: string;\n desktopLarge: string;\n};\n\nexport const spaces = [\n \"auto\",\n \"xxxs\",\n \"xxs\",\n \"xs\",\n \"s\",\n \"m\",\n \"l\",\n \"xl\",\n \"xxl\",\n \"none\",\n] as const;\n\nexport type SpaceType = (typeof spaces)[number];\n\nexport type SpacingProps = {\n margin?: SpaceType;\n marginTop?: SpaceType;\n marginRight?: SpaceType;\n marginBottom?: SpaceType;\n marginLeft?: SpaceType;\n marginVertical?: SpaceType;\n marginHorizontal?: SpaceType;\n padding?: SpaceType;\n paddingTop?: SpaceType;\n paddingRight?: SpaceType;\n paddingBottom?: SpaceType;\n paddingLeft?: SpaceType;\n paddingVertical?: SpaceType;\n paddingHorizontal?: SpaceType;\n};\n\nexport type TextProps = {\n textSize?: FontSizeType;\n textAlign?: FontAlignType;\n textWeight?: FontWeightType;\n textFontFamily?: FontFamilyStylesType;\n wordBreak?: WordBreakType;\n overflowWrap?: OverflowWrapType;\n};\n\nexport type ShadowsType = {\n s: string;\n m: string;\n l: string;\n};\n\nexport type AddressDataType = {\n AdminAreaCode: string;\n AdminAreaName: string;\n Barcode: string;\n Block: string;\n BuildingName: string;\n BuildingNumber: string;\n City: string;\n Company: string;\n CountryIso2: string;\n CountryIso3: string;\n CountryIsoNumber: string;\n CountryName: string;\n DataLevel: string;\n Department: string;\n DomesticId: string;\n Field1: string;\n Field10: string;\n Field11: string;\n Field12: string;\n Field13: string;\n Field14: string;\n Field15: string;\n Field16: string;\n Field17: string;\n Field18: string;\n Field19: string;\n Field2: string;\n Field20: string;\n Field3: string;\n Field4: string;\n Field5: string;\n Field6: string;\n Field7: string;\n Field8: string;\n Field9: string;\n Id: string;\n Label: string;\n Language: string;\n LanguageAlternatives: string;\n Line1: string;\n Line2: string;\n Line3: string;\n Line4: string;\n Line5: string;\n Neighbourhood: string;\n POBoxNumber: string;\n PostalCode: string;\n Province: string;\n ProvinceCode: string;\n ProvinceName: string;\n SecondaryStreet: string;\n SortingNumber1: string;\n SortingNumber2: string;\n Street: string;\n SubBuilding: string;\n Type: string;\n};\n\nexport const colours = [\n // Generic colours\n\n \"currentColor\",\n \"primary\",\n \"secondary\",\n \"tertiary\",\n\n \"text-on-primary\",\n \"text-on-secondary\",\n \"text-on-tertiary\",\n\n \"disabled\",\n \"danger\",\n \"warning\",\n \"success\",\n \"info\",\n \"sports-activity\",\n\n \"text-dark\",\n \"text-light\",\n \"text-mid\",\n\n \"background-light\",\n \"background-light-color\",\n \"background-mid\",\n \"background-mid-light\",\n] as const;\n\nexport type ColourVariableType = (typeof colours)[number];\n\nexport type ColourProps = {\n textColor?: ColourVariableType;\n backgroundColor?: ColourVariableType;\n borderColor?: ColourVariableType;\n};\n\nexport const fontFamilyStyles = [\n \"base\",\n \"headings\",\n \"links\",\n \"buttons\",\n \"label\",\n] as const;\n\nexport type FontFamilyStylesType = (typeof fontFamilyStyles)[number];\n\nexport const fontWeights = [\n \"base\",\n \"headings\",\n\n \"links\",\n \"buttons\",\n \"labels\",\n\n \"heavy\",\n \"medium\",\n \"normal\",\n \"light\",\n \"vlight\",\n] as const;\n\nexport type FontWeightType = (typeof fontWeights)[number];\n\nexport type AddressOptionsType = {\n Description: string;\n Type: string;\n Id: string;\n Text: string;\n Error?: Error;\n};\n\nexport const wordBreaks = [\n \"normal\",\n \"break-all\",\n \"keep-all\",\n \"break-word\",\n \"inherit\",\n \"initial\",\n \"unset\",\n] as const;\n\nexport type WordBreakType = (typeof wordBreaks)[number];\n\nexport const overflowWraps = [\n \"normal\",\n \"anywhere\",\n \"revert\",\n \"revert-layer\",\n \"break-word\",\n \"inherit\",\n \"initial\",\n \"unset\",\n] as const;\n\nexport type OverflowWrapType = (typeof overflowWraps)[number];\n\nexport const fontAligns = [\"left\", \"right\", \"center\", \"justify\"] as const;\n\nexport type FontAlignType = (typeof fontAligns)[number];\n"],"names":["fontSizes","themeNames","spaces","colours","fontFamilyStyles","fontWeights","wordBreaks","overflowWraps","fontAligns"],"mappings":"AAAO,IAAMA,EAAY,CACvB,KACA,IACA,IACA,KACA,IACA,KACA,MACA,OACA,SAKWC,EAAa,CAAC,OAAQ,OAAQ,YAAa,OAoB3CC,EAAS,CACpB,OACA,OACA,MACA,KACA,IACA,IACA,IACA,KACA,MACA,QAgGWC,EAAU,CAGrB,eACA,UACA,YACA,WAEA,kBACA,oBACA,mBAEA,WACA,SACA,UACA,UACA,OACA,kBAEA,YACA,aACA,WAEA,mBACA,yBACA,iBACA,wBAWWC,EAAmB,CAC9B,OACA,WACA,QACA,UACA,SAKWC,EAAc,CACzB,OACA,WAEA,QACA,UACA,SAEA,QACA,SACA,SACA,QACA,UAaWC,EAAa,CACxB,SACA,YACA,WACA,aACA,UACA,UACA,SAKWC,EAAgB,CAC3B,SACA,WACA,SACA,eACA,aACA,UACA,UACA,SAKWC,EAAa,CAAC,OAAQ,QAAS,SAAU"}
|
|
@@ -5,3 +5,6 @@ export declare const numberWithCommas: (n?: number | string) => string;
|
|
|
5
5
|
export declare const formatMoneyWithCommas: (value: number) => string;
|
|
6
6
|
export declare const camelize: (str: string) => string;
|
|
7
7
|
export declare const removeCommasFromObjectStringValues: <T>(object: T) => T;
|
|
8
|
+
export declare function removeEmpty(obj: Record<string, unknown>): {
|
|
9
|
+
[k: string]: unknown;
|
|
10
|
+
};
|
package/lib/src/utils/Helper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as r}from"../../node_modules/tslib/tslib.es6.js";var t="undefined"!=typeof window,e=function(r,t){var e=r/t*100;return e===Number.POSITIVE_INFINITY||Number.isNaN(e)?0:Math.floor(e<1?Math.ceil(e):Math.floor(e))},n=function(r){if(!r)return"";var t=r.toString().split(".");return"".concat(t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")).concat(t[1]?".".concat(t[1]):"")},o=function(r){var t=Number.parseFloat((Math.round(100*r)/100).toString()).toFixed(2);return Number.isNaN(parseFloat(t))||Number.isNaN(r)?"0":n(t)},
|
|
1
|
+
import{__assign as r}from"../../node_modules/tslib/tslib.es6.js";var t="undefined"!=typeof window,e=function(r,t){var e=r/t*100;return e===Number.POSITIVE_INFINITY||Number.isNaN(e)?0:Math.floor(e<1?Math.ceil(e):Math.floor(e))},n=function(r){if(!r)return"";var t=r.toString().split(".");return"".concat(t[0].replace(/\B(?=(\d{3})+(?!\d))/g,",")).concat(t[1]?".".concat(t[1]):"")},o=function(r){var t=Number.parseFloat((Math.round(100*r)/100).toString()).toFixed(2);return Number.isNaN(parseFloat(t))||Number.isNaN(r)?"0":n(t)},i=function(t){return Object.entries(t).reduce(function(t,e){var n,o=e[0],i=e[1],u="string"==typeof i?i.replace(/,/g,""):i;return r(r({},t),((n={})[o]=u,n))},{})};function u(r){return Object.fromEntries(Object.entries(r).filter(function(r){return r[0],null!=r[1]}))}export{e as calculatePercentRounded,o as formatMoneyWithCommas,t as isBrowser,n as numberWithCommas,i as removeCommasFromObjectStringValues,u as removeEmpty};
|
|
2
2
|
//# sourceMappingURL=Helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Helper.js","sources":["../../../src/utils/Helper.ts"],"sourcesContent":["export const isBrowser = typeof window !== \"undefined\";\n\nexport const calculatePercentRounded = (\n value: number,\n target: number,\n): number => {\n const percent = (value / target) * 100;\n if (percent === Number.POSITIVE_INFINITY || Number.isNaN(percent)) {\n return 0;\n }\n return Math.floor(percent < 1 ? Math.ceil(percent) : Math.floor(percent));\n};\n\nexport const formatMoney = (value: number): string => {\n const parsed = Number.parseFloat(\n (Math.round(value * 100) / 100).toString(),\n ).toFixed(2);\n if (Number.isNaN(parseFloat(parsed)) || Number.isNaN(value)) {\n return \"0\";\n }\n return parsed;\n};\n\nexport const numberWithCommas = (n?: number | string): string => {\n if (!n) {\n return \"\";\n }\n const parts = n.toString().split(\".\");\n\n return `${parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}${\n parts[1] ? `.${parts[1]}` : \"\"\n }`;\n};\n\nexport const formatMoneyWithCommas = (value: number): string => {\n const parsed = Number.parseFloat(\n (Math.round(value * 100) / 100).toString(),\n ).toFixed(2);\n if (Number.isNaN(parseFloat(parsed)) || Number.isNaN(value)) {\n return \"0\";\n }\n return numberWithCommas(parsed);\n};\n\nexport const camelize = (str: string): string =>\n str\n .toString()\n .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (word: string, index: number) =>\n index === 0 ? word.toLowerCase() : word.toUpperCase(),\n )\n .replace(/\\s+/g, \"\");\n\nexport const removeCommasFromObjectStringValues = <T>(object: T) =>\n Object.entries(object as Record<string, unknown>).reduce((acc, [k, v]) => {\n const value = typeof v === \"string\" ? v.replace(/,/g, \"\") : v;\n return {\n ...acc,\n [k as keyof T]: value,\n };\n }, {} as T);\n"],"names":["isBrowser","window","calculatePercentRounded","value","target","percent","Number","POSITIVE_INFINITY","isNaN","Math","floor","ceil","numberWithCommas","n","parts","toString","split","concat","replace","formatMoneyWithCommas","parsed","parseFloat","round","toFixed","removeCommasFromObjectStringValues","object","Object","entries","reduce","acc","_a","k","v","__assign","_b"],"mappings":"qEAAaA,EAA8B,oBAAXC,OAEnBC,EAA0B,SACrCC,EACAC,GAEA,IAAMC,EAAWF,EAAQC,EAAU,IACnC,OAAIC,IAAYC,OAAOC,mBAAqBD,OAAOE,MAAMH,GAChD,EAEFI,KAAKC,MAAML,EAAU,EAAII,KAAKE,KAAKN,GAAWI,KAAKC,MAAML,GAClE,EAYaO,EAAmB,SAACC,GAC/B,IAAKA,EACH,MAAO,GAET,IAAMC,EAAQD,EAAEE,WAAWC,MAAM,KAEjC,MAAO,GAAAC,OAAGH,EAAM,GAAGI,QAAQ,wBAAyB,aAClDJ,EAAM,GAAK,IAAAG,OAAIH,EAAM,IAAO,GAEhC,EAEaK,EAAwB,SAAChB,GACpC,IAAMiB,EAASd,OAAOe,YACnBZ,KAAKa,MAAc,IAARnB,GAAe,KAAKY,YAChCQ,QAAQ,GACV,OAAIjB,OAAOE,MAAMa,WAAWD,KAAYd,OAAOE,MAAML,GAC5C,IAEFS,EAAiBQ,EAC1B,EAUaI,EAAqC,SAAIC,GACpD,OAAAC,OAAOC,QAAQF,GAAmCG,OAAO,SAACC,EAAKC,SAACC,EAACD,EAAA,GAAEE,EAACF,EAAA,GAC5D3B,EAAqB,iBAAN6B,EAAiBA,EAAEd,QAAQ,KAAM,IAAMc,EAC5D,OAAAC,EAAAA,EAAA,CAAA,EACKJ,KAAGK,EAAA,CAAA,GACLH,GAAe5B,EAAK+B,GAEzB,EAAG,CAAA,EANH"}
|
|
1
|
+
{"version":3,"file":"Helper.js","sources":["../../../src/utils/Helper.ts"],"sourcesContent":["export const isBrowser = typeof window !== \"undefined\";\n\nexport const calculatePercentRounded = (\n value: number,\n target: number,\n): number => {\n const percent = (value / target) * 100;\n if (percent === Number.POSITIVE_INFINITY || Number.isNaN(percent)) {\n return 0;\n }\n return Math.floor(percent < 1 ? Math.ceil(percent) : Math.floor(percent));\n};\n\nexport const formatMoney = (value: number): string => {\n const parsed = Number.parseFloat(\n (Math.round(value * 100) / 100).toString(),\n ).toFixed(2);\n if (Number.isNaN(parseFloat(parsed)) || Number.isNaN(value)) {\n return \"0\";\n }\n return parsed;\n};\n\nexport const numberWithCommas = (n?: number | string): string => {\n if (!n) {\n return \"\";\n }\n const parts = n.toString().split(\".\");\n\n return `${parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}${\n parts[1] ? `.${parts[1]}` : \"\"\n }`;\n};\n\nexport const formatMoneyWithCommas = (value: number): string => {\n const parsed = Number.parseFloat(\n (Math.round(value * 100) / 100).toString(),\n ).toFixed(2);\n if (Number.isNaN(parseFloat(parsed)) || Number.isNaN(value)) {\n return \"0\";\n }\n return numberWithCommas(parsed);\n};\n\nexport const camelize = (str: string): string =>\n str\n .toString()\n .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (word: string, index: number) =>\n index === 0 ? word.toLowerCase() : word.toUpperCase(),\n )\n .replace(/\\s+/g, \"\");\n\nexport const removeCommasFromObjectStringValues = <T>(object: T) =>\n Object.entries(object as Record<string, unknown>).reduce((acc, [k, v]) => {\n const value = typeof v === \"string\" ? v.replace(/,/g, \"\") : v;\n return {\n ...acc,\n [k as keyof T]: value,\n };\n }, {} as T);\n\n// Removes keys with undefined or null values from an object\n// this is useful for filtering props before passing them to an HTML element to keep the DOM minimal\nexport function removeEmpty(obj: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(obj).filter(([_, v]) => v != undefined),\n );\n}\n"],"names":["isBrowser","window","calculatePercentRounded","value","target","percent","Number","POSITIVE_INFINITY","isNaN","Math","floor","ceil","numberWithCommas","n","parts","toString","split","concat","replace","formatMoneyWithCommas","parsed","parseFloat","round","toFixed","removeCommasFromObjectStringValues","object","Object","entries","reduce","acc","_a","k","v","__assign","_b","removeEmpty","obj","fromEntries","filter","undefined"],"mappings":"qEAAaA,EAA8B,oBAAXC,OAEnBC,EAA0B,SACrCC,EACAC,GAEA,IAAMC,EAAWF,EAAQC,EAAU,IACnC,OAAIC,IAAYC,OAAOC,mBAAqBD,OAAOE,MAAMH,GAChD,EAEFI,KAAKC,MAAML,EAAU,EAAII,KAAKE,KAAKN,GAAWI,KAAKC,MAAML,GAClE,EAYaO,EAAmB,SAACC,GAC/B,IAAKA,EACH,MAAO,GAET,IAAMC,EAAQD,EAAEE,WAAWC,MAAM,KAEjC,MAAO,GAAAC,OAAGH,EAAM,GAAGI,QAAQ,wBAAyB,aAClDJ,EAAM,GAAK,IAAAG,OAAIH,EAAM,IAAO,GAEhC,EAEaK,EAAwB,SAAChB,GACpC,IAAMiB,EAASd,OAAOe,YACnBZ,KAAKa,MAAc,IAARnB,GAAe,KAAKY,YAChCQ,QAAQ,GACV,OAAIjB,OAAOE,MAAMa,WAAWD,KAAYd,OAAOE,MAAML,GAC5C,IAEFS,EAAiBQ,EAC1B,EAUaI,EAAqC,SAAIC,GACpD,OAAAC,OAAOC,QAAQF,GAAmCG,OAAO,SAACC,EAAKC,SAACC,EAACD,EAAA,GAAEE,EAACF,EAAA,GAC5D3B,EAAqB,iBAAN6B,EAAiBA,EAAEd,QAAQ,KAAM,IAAMc,EAC5D,OAAAC,EAAAA,EAAA,CAAA,EACKJ,KAAGK,EAAA,CAAA,GACLH,GAAe5B,EAAK+B,GAEzB,EAAG,CAAA,EANH,EAUI,SAAUC,EAAYC,GAC1B,OAAOV,OAAOW,YACZX,OAAOC,QAAQS,GAAKE,OAAO,SAACR,GAAW,OAATA,EAAA,GAAcS,MAAXT,EAAA,EAAM,GAE3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{spaces as r,colours as n}from"../types.js";var c=function(n){return r.includes(n)?"var(--spacing-".concat(n,")"):n},t=function(r){return n.includes(r)?"var(--clr-".concat(r,")"):r||"currentColor"};export{t as themeColorOrString,c as themeSpacingSizeOrString};
|
|
2
2
|
//# sourceMappingURL=themeUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeUtils.js","sources":["../../../src/utils/themeUtils.ts"],"sourcesContent":["import { spaces, colours, fontSizes } from \"../types\";\n\nexport const themeSpacingSizeOrString = (spaceString: string): string =>\n spaces.includes(spaceString as (typeof spaces)[number])\n ? `var(--spacing-${spaceString as (typeof spaces)[number]})`\n : spaceString;\n\nexport const themeFontSizeOrString = (fontSizeString: string): string =>\n fontSizes.includes(fontSizeString as (typeof fontSizes)[number])\n ? `var(--font-size-${fontSizeString as (typeof fontSizes)[number]})`\n : fontSizeString;\n\nexport const themeColorOrString = (\n colorString: string | (typeof colours)[number] | undefined,\n): string =>\n colours.includes(colorString as (typeof colours)[number])\n ? `var(--clr-${colorString as (typeof colours)[number]})`\n : colorString || \"currentColor\";\n"],"names":["themeSpacingSizeOrString","spaceString","spaces","includes","concat","
|
|
1
|
+
{"version":3,"file":"themeUtils.js","sources":["../../../src/utils/themeUtils.ts"],"sourcesContent":["import { spaces, colours, fontSizes } from \"../types\";\n\nexport const themeSpacingSizeOrString = (spaceString: string): string =>\n spaces.includes(spaceString as (typeof spaces)[number])\n ? `var(--spacing-${spaceString as (typeof spaces)[number]})`\n : spaceString;\n\nexport const themeFontSizeOrString = (fontSizeString: string): string =>\n fontSizes.includes(fontSizeString as (typeof fontSizes)[number])\n ? `var(--font-size-${fontSizeString as (typeof fontSizes)[number]})`\n : fontSizeString;\n\nexport const themeColorOrString = (\n colorString: string | (typeof colours)[number] | undefined,\n): string =>\n colours.includes(colorString as (typeof colours)[number])\n ? `var(--clr-${colorString as (typeof colours)[number]})`\n : colorString || \"currentColor\";\n"],"names":["themeSpacingSizeOrString","spaceString","spaces","includes","concat","themeColorOrString","colorString","colours"],"mappings":"kDAEO,IAAMA,EAA2B,SAACC,GACvC,OAAAC,EAAOC,SAASF,GACZ,iBAAAG,OAAiBH,EAAsC,KACvDA,CAFJ,EASWI,EAAqB,SAChCC,GAEA,OAAAC,EAAQJ,SAASG,GACb,aAAAF,OAAaE,EAAuC,KACpDA,GAAe,cAFnB"}
|