@cruk/cruk-react-components 6.2.2 → 7.0.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 +49 -0
- package/lib/index.css +2 -0
- package/lib/index.css.map +1 -0
- package/lib/src/components/AddressLookup/index.js +1 -1
- package/lib/src/components/AddressLookup/index.js.map +1 -1
- package/lib/src/components/AddressLookup/styles.d.ts +4 -9
- package/lib/src/components/AddressLookup/styles.js +1 -1
- package/lib/src/components/AddressLookup/styles.js.map +1 -1
- package/lib/src/components/AllThemesWrapper.d.ts +3 -3
- package/lib/src/components/Avatar/index.d.ts +8 -7
- package/lib/src/components/Avatar/index.js +1 -1
- package/lib/src/components/Avatar/index.js.map +1 -1
- package/lib/src/components/Avatar/styles.d.ts +1 -3
- package/lib/src/components/Avatar/styles.js +1 -1
- package/lib/src/components/Avatar/styles.js.map +1 -1
- package/lib/src/components/Badge/index.d.ts +14 -15
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Badge/index.js.map +1 -1
- package/lib/src/components/Badge/styles.d.ts +1 -2
- package/lib/src/components/Badge/styles.js +1 -1
- package/lib/src/components/Badge/styles.js.map +1 -1
- package/lib/src/components/Box/index.d.ts +2 -1
- package/lib/src/components/Box/index.js +1 -1
- package/lib/src/components/Box/index.js.map +1 -1
- package/lib/src/components/Box/styles.d.ts +2 -3
- package/lib/src/components/Box/styles.js +1 -1
- package/lib/src/components/Box/styles.js.map +1 -1
- package/lib/src/components/Button/index.js +1 -1
- package/lib/src/components/Button/index.js.map +1 -1
- package/lib/src/components/Button/styles.d.ts +2 -5
- package/lib/src/components/Button/styles.js +1 -1
- package/lib/src/components/Button/styles.js.map +1 -1
- package/lib/src/components/Carousel/styles.d.ts +1 -7
- package/lib/src/components/Carousel/styles.js +1 -1
- package/lib/src/components/Carousel/styles.js.map +1 -1
- package/lib/src/components/Checkbox/index.js +1 -1
- package/lib/src/components/Checkbox/index.js.map +1 -1
- package/lib/src/components/Checkbox/styles.d.ts +3 -11
- package/lib/src/components/Checkbox/styles.js +1 -1
- package/lib/src/components/Checkbox/styles.js.map +1 -1
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/Collapse/index.js.map +1 -1
- package/lib/src/components/Collapse/styles.d.ts +1 -3
- package/lib/src/components/Collapse/styles.js +1 -1
- package/lib/src/components/Collapse/styles.js.map +1 -1
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/src/components/DateField/styles.d.ts +6 -15
- package/lib/src/components/DateField/styles.js +1 -1
- package/lib/src/components/DateField/styles.js.map +1 -1
- package/lib/src/components/ErrorText/index.js +1 -1
- package/lib/src/components/ErrorText/index.js.map +1 -1
- package/lib/src/components/ErrorText/styles.d.ts +3 -7
- package/lib/src/components/ErrorText/styles.js +1 -1
- package/lib/src/components/ErrorText/styles.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/Footer/styles.d.ts +6 -13
- package/lib/src/components/Footer/styles.js +1 -1
- package/lib/src/components/Footer/styles.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/Header/styles.d.ts +3 -14
- package/lib/src/components/Header/styles.js +1 -1
- package/lib/src/components/Header/styles.js.map +1 -1
- package/lib/src/components/Heading/index.js +1 -1
- package/lib/src/components/Heading/index.js.map +1 -1
- package/lib/src/components/Heading/styles.d.ts +1 -2
- package/lib/src/components/Heading/styles.js +1 -1
- package/lib/src/components/Heading/styles.js.map +1 -1
- package/lib/src/components/IconFa/index.js +1 -1
- package/lib/src/components/IconFa/index.js.map +1 -1
- package/lib/src/components/IconFa/styles.d.ts +0 -2
- package/lib/src/components/IconFa/styles.js.map +1 -1
- package/lib/src/components/InfoBox/index.d.ts +5 -4
- package/lib/src/components/InfoBox/index.js +1 -1
- package/lib/src/components/InfoBox/index.js.map +1 -1
- package/lib/src/components/InfoBox/styles.d.ts +4 -6
- package/lib/src/components/InfoBox/styles.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/LabelWrapper/styles.d.ts +4 -14
- package/lib/src/components/LabelWrapper/styles.js +1 -1
- package/lib/src/components/LabelWrapper/styles.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/LegendWrapper/styles.d.ts +1 -6
- package/lib/src/components/LegendWrapper/styles.js +1 -1
- package/lib/src/components/LegendWrapper/styles.js.map +1 -1
- package/lib/src/components/Link/index.js +1 -1
- package/lib/src/components/Link/index.js.map +1 -1
- package/lib/src/components/Link/styles.d.ts +1 -3
- package/lib/src/components/Link/styles.js +1 -1
- package/lib/src/components/Link/styles.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/Loader/styles.module.css.js +2 -0
- package/lib/src/components/Loader/styles.module.css.js.map +1 -0
- 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 +2 -1
- package/lib/src/components/Modal/index.js +1 -1
- package/lib/src/components/Modal/index.js.map +1 -1
- package/lib/src/components/Modal/styles.d.ts +3 -8
- package/lib/src/components/Modal/styles.js +1 -1
- package/lib/src/components/Modal/styles.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/Pagination/styles.d.ts +1 -5
- package/lib/src/components/Pagination/styles.js +1 -1
- package/lib/src/components/Pagination/styles.js.map +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/PopOver/styles.d.ts +1 -2
- package/lib/src/components/PopOver/styles.js +1 -1
- package/lib/src/components/PopOver/styles.js.map +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/ProgressBar/styles.d.ts +2 -11
- package/lib/src/components/ProgressBar/styles.js +1 -1
- package/lib/src/components/ProgressBar/styles.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/Radio/styles.d.ts +3 -12
- package/lib/src/components/Radio/styles.js +1 -1
- package/lib/src/components/Radio/styles.js.map +1 -1
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js.map +1 -1
- package/lib/src/components/RadioConsent/styles.d.ts +3 -10
- package/lib/src/components/RadioConsent/styles.js +1 -1
- package/lib/src/components/RadioConsent/styles.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/Select/styles.d.ts +2 -7
- package/lib/src/components/Select/styles.js +1 -1
- package/lib/src/components/Select/styles.js.map +1 -1
- package/lib/src/components/Spacing/index.d.ts +2 -2
- package/lib/src/components/Spacing/index.js +1 -1
- package/lib/src/components/Spacing/index.js.map +1 -1
- package/lib/src/components/Step/index.js +1 -1
- package/lib/src/components/Step/index.js.map +1 -1
- package/lib/src/components/Step/styles.d.ts +2 -8
- package/lib/src/components/Step/styles.js +1 -1
- package/lib/src/components/Step/styles.js.map +1 -1
- package/lib/src/components/Text/index.d.ts +2 -2
- package/lib/src/components/Text/index.js +1 -1
- package/lib/src/components/Text/index.js.map +1 -1
- package/lib/src/components/Text/styles.d.ts +1 -2
- package/lib/src/components/Text/styles.js +1 -1
- package/lib/src/components/Text/styles.js.map +1 -1
- package/lib/src/components/TextAreaField/index.js +1 -1
- package/lib/src/components/TextAreaField/index.js.map +1 -1
- package/lib/src/components/TextAreaField/styles.d.ts +2 -5
- package/lib/src/components/TextAreaField/styles.js +1 -1
- package/lib/src/components/TextAreaField/styles.js.map +1 -1
- package/lib/src/components/TextField/index.js +1 -1
- package/lib/src/components/TextField/index.js.map +1 -1
- package/lib/src/components/TextField/styles.d.ts +3 -8
- package/lib/src/components/TextField/styles.js +1 -1
- package/lib/src/components/TextField/styles.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/Totaliser/styles.d.ts +5 -18
- package/lib/src/components/Totaliser/styles.js +1 -1
- package/lib/src/components/Totaliser/styles.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/UserBlock/styles.d.ts +3 -8
- package/lib/src/components/UserBlock/styles.js +1 -1
- package/lib/src/components/UserBlock/styles.js.map +1 -1
- package/lib/src/components/index.d.ts +1 -8
- package/lib/src/components/index.js +1 -1
- package/lib/src/types.d.ts +8 -172
- package/lib/src/types.js +2 -0
- package/lib/src/types.js.map +1 -0
- 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 +10 -5
- 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/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/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/ThemeCheatSheet.d.ts +0 -7
- 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,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o from"styled-components";var t,e,r,i=o.span(t||(t=n(['\n display: block;\n color: var(--clr-text-dark, #000);\n font-size: var(--font-size-m, 1rem);\n line-height: var(--typ-line-height, 1.5em);\n font-weight: var(--typ-font-weight-labels, 500);\n font-family: var(--typ-font-family-label, "Poppins", Arial, sans-serif);\n min-width: 3em;\n margin-bottom: ',";\n\n // increase font size for desktop\n @media (min-width: 1200px) {\n font-size: var(--font-size-ml, 1.125rem);\n }\n & > * {\n font-weight: var(--typ-font-weight-base, 300);\n }\n"],['\n display: block;\n color: var(--clr-text-dark, #000);\n font-size: var(--font-size-m, 1rem);\n line-height: var(--typ-line-height, 1.5em);\n font-weight: var(--typ-font-weight-labels, 500);\n font-family: var(--typ-font-family-label, "Poppins", Arial, sans-serif);\n min-width: 3em;\n margin-bottom: ',";\n\n // increase font size for desktop\n @media (min-width: 1200px) {\n font-size: var(--font-size-ml, 1.125rem);\n }\n & > * {\n font-weight: var(--typ-font-weight-base, 300);\n }\n"])),function(n){return n.$hasHintText?"var(--spacing-xxs, 0.5rem)":0}),a=o.span(e||(e=n(['\n font-family: var(--typ-font-family-base, "Poppins", Arial, sans-serif);\n font-weight: var(--typ-font-weight-base, 300);\n display: block;\n color: var(--clr-text-mid, #666);\n'],['\n font-family: var(--typ-font-family-base, "Poppins", Arial, sans-serif);\n font-weight: var(--typ-font-weight-base, 300);\n display: block;\n color: var(--clr-text-mid, #666);\n']))),s=o.fieldset(r||(r=n(["\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n border: none;\n padding: 0;\n legend {\n margin-bottom: var(--spacing-xs, 1rem);\n }\n label {\n border-color: ",";\n margin-bottom: var(--spacing-none, 0);\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"],["\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n border: none;\n padding: 0;\n legend {\n margin-bottom: var(--spacing-xs, 1rem);\n }\n label {\n border-color: ",";\n margin-bottom: var(--spacing-none, 0);\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"])),function(n){return n.$hasError&&"var(--clr-text-error, #f00)"});export{a as HintText,i as LegendSpan,s as StyledFieldset};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/LegendWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/LegendWrapper/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\ntype StyledFieldsetProps = {\n $hasError?: boolean;\n $hasHintText?: boolean;\n};\n\nexport const LegendSpan = styled.span<{\n $hasHintText: boolean;\n}>`\n display: block;\n color: var(--clr-text-dark, #000);\n font-size: var(--font-size-m, 1rem);\n line-height: var(--typ-line-height, 1.5em);\n font-weight: var(--typ-font-weight-labels, 500);\n font-family: var(--typ-font-family-label, \"Poppins\", Arial, sans-serif);\n min-width: 3em;\n margin-bottom: ${({ $hasHintText }) =>\n $hasHintText ? \"var(--spacing-xxs, 0.5rem)\" : 0};\n\n // increase font size for desktop\n @media (min-width: 1200px) {\n font-size: var(--font-size-ml, 1.125rem);\n }\n & > * {\n font-weight: var(--typ-font-weight-base, 300);\n }\n`;\n\nexport const HintText = styled.span`\n font-family: var(--typ-font-family-base, \"Poppins\", Arial, sans-serif);\n font-weight: var(--typ-font-weight-base, 300);\n display: block;\n color: var(--clr-text-mid, #666);\n`;\n\nexport const StyledFieldset = styled.fieldset<StyledFieldsetProps>`\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n border: none;\n padding: 0;\n legend {\n margin-bottom: var(--spacing-xs, 1rem);\n }\n label {\n border-color: ${({ $hasError }) =>\n $hasError && \"var(--clr-text-error, #f00)\"};\n margin-bottom: var(--spacing-none, 0);\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n`;\n"],"names":["LegendSpan","styled","span","templateObject_1","__makeTemplateObject","_a","$hasHintText","HintText","templateObject_2","StyledFieldset","fieldset","templateObject_3","$hasError"],"mappings":"iHAOO,UAAMA,EAAaC,EAAOC,KAAIC,IAAAA,EAAAC,EAAA,CAAA,yTAAA,sMAAA,CAEnC,yTASiD,wMADhC,SAACC,GAChB,OAD8BA,EAAAC,aACf,6BAA+B,CAA9C,GAWSC,EAAWN,EAAOC,KAAIM,IAAAA,EAAAJ,EAAA,CAAA,2LAAA,CAAA,8LAOtBK,EAAiBR,EAAOS,SAAQC,IAAAA,EAAAP,EAAA,CAAA,yQAAA,8GAAA,CAAqB,yQAelB,gHAD5B,SAACC,GACf,OAD0BA,EAAAO,WACb,6BAAb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__rest as e,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{StyledLink as t}from"./styles.js";import{themeColorOrString as a}from"../../utils/themeUtils.js";var l=function(l){var s=l.rel?l.rel:"_blank"===l.target?"noopener noreferrer":"",i=l.as&&"a"!==l.as?void 0:"a",n=l.textHoverColor,p=l.appearance,m=l.ref,f=l.children,d=e(l,["textHoverColor","appearance","ref","children"]),c=n?a(n):void 0;return o.createElement(t,r({},d,{$textHoverColor:c,$appearance:p,rel:s,forwardedAs:i,ref:m}),f)};l.displayName="Link";export{l as Link,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Link/index.tsx"],"sourcesContent":["import React, {\n type AnchorHTMLAttributes,\n type Ref,\n type ElementType,\n type ReactNode,\n} from \"react\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Link/index.tsx"],"sourcesContent":["import React, {\n type AnchorHTMLAttributes,\n type Ref,\n type ElementType,\n type ReactNode,\n} from \"react\";\n\nimport { type TextProps } from \"../Text\";\nimport { StyledLink } from \"./styles\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type LinkProps = Omit<AnchorHTMLAttributes<HTMLElement>, \"nonce\"> &\n Omit<TextProps, \"as\" | \"ref\" | \"nonce\"> & {\n /** link text hover colour */\n textHoverColor?: string;\n /** link appearance variant, undefined is a standarding link withing a text block */\n appearance?: \"primary\" | \"secondary\";\n /** styled-components polymorphism where you can use the styling of a link but convert to another element like a button */\n ref?: Ref<HTMLElement>;\n /** styled-component polymorphic feature so you take the styling of a link and cast the component to be a \"span\" for example */\n as?: ElementType;\n /** Component children */\n children?: ReactNode;\n };\n\n/** Links are for wrapping plain text or elements to create clickable link.\n * This is to be treated as an anchor tag with the addition of the Text component API.\n * This component contains standard Anchor tag props like 'href' and 'target', but it also contains Text component props like 'textColor' and 'textAlign'.\n *\n * A link should really only be used for navigation to take a user to as new location.\n * The onClick handler can be use for more complicated scenarios.\n *\n * If you want something that looks like a link but behaves like a button ie. nothing to do with navigation, please consider using Link with as='button'\n *\n * If you want something that looks like a button but behaves like a link ie. it takes the user to a new location, please consider using Button and simply passing it an href, it will automatically turn into a link. */\nexport const Link = (props: LinkProps) => {\n // security by default\n const rel = props.rel\n ? props.rel\n : props.target === \"_blank\"\n ? \"noopener noreferrer\"\n : \"\";\n\n // only forward As anchor if we are not casting as something that is not an anchor\n const forwardAs = props.as && props.as !== \"a\" ? undefined : \"a\";\n\n const { textHoverColor, appearance, ref, children, ...rest } = props;\n\n const textHoverColorFinal = textHoverColor\n ? themeColorOrString(textHoverColor)\n : undefined;\n\n return (\n <StyledLink\n {...rest}\n $textHoverColor={textHoverColorFinal}\n $appearance={appearance}\n rel={rel}\n forwardedAs={forwardAs}\n ref={ref}\n >\n {children}\n </StyledLink>\n );\n};\n\nLink.displayName = \"Link\";\n\nexport default Link;\n"],"names":["Link","props","rel","target","forwardAs","as","undefined","textHoverColor","appearance","ref","children","rest","__rest","textHoverColorFinal","themeColorOrString","React","createElement","StyledLink","__assign","$appearance","forwardedAs","displayName"],"mappings":"6MAmCO,IAAMA,EAAO,SAACC,GAEnB,IAAMC,EAAMD,EAAMC,IACdD,EAAMC,IACW,WAAjBD,EAAME,OACJ,sBACA,GAGAC,EAAYH,EAAMI,IAAmB,MAAbJ,EAAMI,QAAaC,EAAY,IAErDC,EAAuDN,EAAKM,eAA5CC,EAAuCP,EAAKO,WAAhCC,EAA2BR,MAAtBS,EAAsBT,EAAKS,SAAdC,EAAIC,EAAKX,EAAzD,CAAA,iBAAA,aAAA,MAAA,aAEAY,EAAsBN,EACxBO,EAAmBP,QACnBD,EAEJ,OACES,EAAAC,cAACC,EAAUC,EAAA,CAAA,EACLP,mBACaE,EAAmBM,YACvBX,EACbN,IAAKA,EACLkB,YAAahB,EACbK,IAAKA,IAEJC,EAGP,EAEAV,EAAKqB,YAAc"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { type AnchorHTMLAttributes } from "react";
|
|
2
2
|
import { type TextProps } from "../Text";
|
|
3
|
-
import { type ThemeType } from "../../types";
|
|
4
3
|
type StyledLinkProps = AnchorHTMLAttributes<HTMLElement> & TextProps & {
|
|
5
|
-
theme: ThemeType;
|
|
6
4
|
$appearance?: "primary" | "secondary";
|
|
7
5
|
$textHoverColor?: string;
|
|
8
6
|
};
|
|
9
7
|
export declare const StyledLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("../Spacing").SpacingProps & import("react").HTMLAttributes<HTMLElement> & {
|
|
10
|
-
textColor?: string;
|
|
8
|
+
textColor?: typeof import("..").colours[number] | string;
|
|
11
9
|
textAlign?: "left" | "right" | "center" | "justify";
|
|
12
10
|
textSize?: import("..").FontSizeType;
|
|
13
11
|
textWeight?: number | string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r from"styled-components";import{Text as o}from"../Text/index.js";var e,a=r(o)(e||(e=n(["\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ",";\n text-decoration: ",";\n font-family: ",";\n
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r from"styled-components";import{Text as o}from"../Text/index.js";var e,a=r(o)(e||(e=n(["\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ",";\n\n text-decoration: ",";\n font-family: ",";\n font-weight: var(--typ-font-weight-links, 700);\n &:focus-visible {\n outline: auto;\n }\n\n &:hover {\n cursor: pointer;\n background-size: 100% 100%;\n color: ",";\n }\n"],["\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ",";\n\n text-decoration: ",";\n font-family: ",";\n font-weight: var(--typ-font-weight-links, 700);\n &:focus-visible {\n outline: auto;\n }\n\n &:hover {\n cursor: pointer;\n background-size: 100% 100%;\n color: ",";\n }\n"])),function(n){var r=n.$appearance;return r&&r&&"primary"===r?"var(--clr-link-secondary, #e60079)":"var(--clr-link, #e60079)"},function(n){return"secondary"===n.$appearance?"none":"underline"},function(n){var r=n.$appearance;return"primary"===r||"secondary"===r?"var(--typ-font-family-links, 'Poppins', Arial, sans-serif)":"var(--typ-font-family-base, 'Poppins', Arial, sans-serif)"},function(n){var r=n.$textHoverColor,o=n.$appearance;return r||(o?"var(--clr-link-secondary-hover, #a5005f)":"var(--clr-link-hover, #a5005f)")});export{a as StyledLink,a as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Link/styles.ts"],"sourcesContent":["import { type AnchorHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\n\nimport Text, { type TextProps } from \"../Text\";\n\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Link/styles.ts"],"sourcesContent":["import { type AnchorHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\n\nimport Text, { type TextProps } from \"../Text\";\n\ntype StyledLinkProps = AnchorHTMLAttributes<HTMLElement> &\n TextProps & {\n $appearance?: \"primary\" | \"secondary\";\n $textHoverColor?: string;\n };\n\nexport const StyledLink = styled(Text)<StyledLinkProps>`\n transition:\n color 0.2s ease,\n background-size 0.3s ease;\n overflow-wrap: break-word;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n padding: 0;\n color: ${({ $appearance }) =>\n !$appearance\n ? \"var(--clr-link, #e60079)\"\n : $appearance && $appearance === \"primary\"\n ? \"var(--clr-link-secondary, #e60079)\"\n : \"var(--clr-link, #e60079)\"};\n\n text-decoration: ${({ $appearance }) =>\n $appearance === \"secondary\" ? \"none\" : \"underline\"};\n font-family: ${({ $appearance }) =>\n $appearance === \"primary\" || $appearance === \"secondary\"\n ? \"var(--typ-font-family-links, 'Poppins', Arial, sans-serif)\"\n : \"var(--typ-font-family-base, 'Poppins', Arial, sans-serif)\"};\n font-weight: var(--typ-font-weight-links, 700);\n &:focus-visible {\n outline: auto;\n }\n\n &:hover {\n cursor: pointer;\n background-size: 100% 100%;\n color: ${({ $textHoverColor, $appearance }) =>\n $textHoverColor\n ? $textHoverColor\n : !$appearance\n ? \"var(--clr-link-hover, #a5005f)\"\n : $appearance && $appearance === \"primary\"\n ? \"var(--clr-link-secondary-hover, #a5005f)\"\n : \"var(--clr-link-secondary-hover, #a5005f)\"};\n }\n`;\n\nexport default StyledLink;\n"],"names":["StyledLink","styled","Text","templateObject_1","__makeTemplateObject","_a","$appearance","$textHoverColor"],"mappings":"+JAWaA,EAAaC,EAAOC,EAAPD,CAAYE,IAAAA,EAAAC,EAAA,CAAA,8LAAA,2BAAA,qBAAA,wLAAA,YAAA,CAAiB,8LAalB,2BAGiB,qBAIa,wLAgBX,cA5B7C,SAACC,GAAE,IAAAC,EAAWD,EAAAC,YACrB,OAACA,GAEGA,GAA+B,YAAhBA,EACb,sCAFF,2BADJ,EAMiB,SAACD,GAClB,MAAgB,cADeA,EAAAC,YACD,OAAS,WAAvC,EACa,SAACD,GAAE,IAAAC,EAAWD,EAAAC,YAC3B,MAAgB,YAAhBA,GAA6C,cAAhBA,EACzB,6DACA,2DAFJ,EAWS,SAACD,OAAEE,EAAeF,EAAAE,gBAAED,EAAWD,EAAAC,YACtC,OAAAC,IAEKD,EAGG,2CAFF,iCAHN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"react";import n from"./styles.module.css.js";function r(){return e.createElement(e.Fragment,null,e.createElement("p",{className:n["screen-reader-only"],role:"alert"},"Loading"),e.createElement("div",{className:n.spinner,"aria-hidden":"true"},e.createElement("span",null),e.createElement("span",null),e.createElement("span",null)))}export{r as Loader,r as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Loader/index.tsx"],"sourcesContent":["import React from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Loader/index.tsx"],"sourcesContent":["import React from \"react\";\nimport styles from \"./styles.module.css\";\n\n/**\n *\n * Loaders are used after some user interaction that we assume will take some time to complete. They inform the user that their request is beeing processed and that they should wait.\n */\nexport function Loader() {\n return (\n <>\n <p className={styles[\"screen-reader-only\"]} role=\"alert\">\n Loading\n </p>\n <div className={styles[\"spinner\"]} aria-hidden=\"true\">\n <span />\n <span />\n <span />\n </div>\n </>\n );\n}\n\nexport default Loader;\n"],"names":["Loader","React","createElement","Fragment","className","styles","role"],"mappings":"oEAOgBA,IACd,OACEC,EAAAC,cAAAD,EAAAE,SAAA,KACEF,EAAAC,cAAA,IAAA,CAAGE,UAAWC,EAAO,sBAAuBC,KAAK,SAAO,WAGxDL,EAAAC,cAAA,MAAA,CAAKE,UAAWC,EAAgB,sBAAe,QAC7CJ,EAAAC,cAAA,OAAA,MACAD,EAAAC,cAAA,OAAA,MACAD,EAAAC,cAAA,OAAA,OAIR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -9,6 +9,7 @@ export type ModalProps = SpacingProps & {
|
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
/** set max width of modal */
|
|
11
11
|
maxWidth?: string;
|
|
12
|
+
themeName: string;
|
|
12
13
|
/** set space from top of view port that modal appears */
|
|
13
14
|
top?: string;
|
|
14
15
|
/** background color of dialogue */
|
|
@@ -30,5 +31,5 @@ export type ModalProps = SpacingProps & {
|
|
|
30
31
|
* ## Accessibility
|
|
31
32
|
* - Once the Modal is appeared on the screen, the focus must be within the Modal container which will enable the screen readers to be able to navigate within the Modal. You may wish to hide the close button so that a user must click on another button to confirm a choice before the modal is closed. However closing with the 'ESC' key must always work, so the props which contains the function that allows the modal to close itself 'closeFunction' is always required.
|
|
32
33
|
*/
|
|
33
|
-
export declare function Modal({ modalName, closeFunction, showCloseButton, maxWidth, top, backgroundColor, children, width, margin, marginHorizontal, marginVertical, marginTop, marginRight, marginBottom, marginLeft, padding, paddingHorizontal, paddingVertical, paddingTop, paddingRight, paddingBottom, paddingLeft, isAnimated, }: ModalProps): React.JSX.Element;
|
|
34
|
+
export declare function Modal({ modalName, closeFunction, showCloseButton, themeName, maxWidth, top, backgroundColor, children, width, margin, marginHorizontal, marginVertical, marginTop, marginRight, marginBottom, marginLeft, padding, paddingHorizontal, paddingVertical, paddingTop, paddingRight, paddingBottom, paddingLeft, isAnimated, }: ModalProps): React.JSX.Element;
|
|
34
35
|
export default Modal;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useEffect as o}from"react";import{createPortal as t}from"react-dom";import n from"../../../node_modules/react-focus-lock/dist/es2015/Combination.js";import{faClose as i}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as a}from"../IconFa/index.js";import{Wrapper as d,Content as r,CloseButton as m,Background as l}from"./styles.js";import{themeColorOrString as c}from"../../utils/themeUtils.js";function g(g){var f=g.modalName,s=g.closeFunction,p=g.showCloseButton,u=g.themeName,h=g.maxWidth,v=void 0===h?"500px":h,w=g.top,y=void 0===w?"1rem":w,E=g.backgroundColor,b=g.children,k=g.width,x=void 0===k?"90%":k,C=g.margin,L=g.marginHorizontal,j=g.marginVertical,B=g.marginTop,$=g.marginRight,z=g.marginBottom,F=void 0===z?"xxl":z,H=g.marginLeft,R=g.padding,T=void 0===R?"xs":R,V=g.paddingHorizontal,A=g.paddingVertical,I=g.paddingTop,N=g.paddingRight,W=g.paddingBottom,_=g.paddingLeft,U=g.isAnimated,q=void 0===U||U,D=E?c(E):"var(--background-light, #ffffff)",G=e.useCallback(function(e){"Escape"===e.key&&s&&s()},[s]);return o(function(){if("undefined"!=typeof window)return document.body.style.overflow="hidden",document.addEventListener("keydown",G),function(){"undefined"!=typeof window&&(document.body.style.overflow="unset",document.removeEventListener("keydown",G))}},[G]),e.createElement(e.Fragment,null,"undefined"!=typeof window?t(e.createElement("section",{"data-theme":u},e.createElement(n,{returnFocus:!0},e.createElement(d,{role:"dialog","aria-modal":"true","aria-label":f},e.createElement(r,{backgroundColor:D,$maxWidth:v,$width:x,$top:y,margin:C,marginHorizontal:L,marginVertical:j,marginTop:B,marginRight:$,marginBottom:F,marginLeft:H,padding:T,paddingHorizontal:V,paddingVertical:A,paddingTop:I,paddingRight:N,paddingBottom:W,paddingLeft:_,$isAnimated:q},p&&s?e.createElement(m,{"aria-label":"close",appearance:"tertiary",onClick:function(){s()}},e.createElement(a,{faIcon:i})):null,b),e.createElement(l,{$isAnimated:q})))),document.body):null)}export{g as Modal,g as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import React, { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Modal/index.tsx"],"sourcesContent":["import React, { type ReactNode, useEffect } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport FocusLock from \"react-focus-lock\";\nimport { faClose } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\n\nimport { CloseButton, Wrapper, Content, Background } from \"./styles\";\n\nimport { type SpacingProps } from \"../Spacing\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type ModalProps = SpacingProps & {\n /** modal name used for aria-label */\n modalName: string;\n /** callback function called on modal close */\n closeFunction: () => void;\n /** flag to reveal close button with cross in the top right of modal */\n showCloseButton?: boolean;\n /** set max width of modal */\n maxWidth?: string;\n themeName: string;\n /** set space from top of view port that modal appears */\n top?: string;\n /** background color of dialogue */\n backgroundColor?: string;\n /** children components */\n children?: ReactNode;\n /** width of modal */\n width?: string;\n /** turn on animate in modal */\n isAnimated?: boolean;\n};\n\n/**\n *\n * Use a modal to display content over top of the rest of the site which must be interacted with before the user can continue.\n * ## How modals work\n * - Modals are positioned over everything else in the document and remove scroll from the \"body\" tag so that modal content scrolls instead.\n * - Modals are unmounted when closed.\n * - Modal's \"trap\" focus in them, ensuring the keyboard navigation cycles through the modal, and not the rest of the page.\n * ## Accessibility\n * - Once the Modal is appeared on the screen, the focus must be within the Modal container which will enable the screen readers to be able to navigate within the Modal. You may wish to hide the close button so that a user must click on another button to confirm a choice before the modal is closed. However closing with the 'ESC' key must always work, so the props which contains the function that allows the modal to close itself 'closeFunction' is always required.\n */\nexport function Modal({\n modalName,\n closeFunction,\n showCloseButton,\n themeName,\n maxWidth = \"500px\",\n top = \"1rem\",\n backgroundColor,\n children,\n width = \"90%\",\n margin,\n marginHorizontal,\n marginVertical,\n marginTop,\n marginRight,\n marginBottom = \"xxl\",\n marginLeft,\n padding = \"xs\",\n paddingHorizontal,\n paddingVertical,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n isAnimated = true,\n}: ModalProps) {\n const backgroundColourValue = backgroundColor\n ? themeColorOrString(backgroundColor)\n : \"var(--background-light, #ffffff)\";\n\n const closeByEsc = React.useCallback(\n (event: KeyboardEvent): void => {\n if (event.key === \"Escape\" && !!closeFunction) {\n closeFunction();\n }\n },\n [closeFunction],\n );\n\n useEffect(() => {\n if (typeof window === `undefined`) {\n return undefined;\n }\n document.body.style.overflow = \"hidden\";\n document.addEventListener(\"keydown\", closeByEsc);\n\n return () => {\n if (typeof window === `undefined`) {\n return;\n }\n document.body.style.overflow = \"unset\";\n document.removeEventListener(\"keydown\", closeByEsc);\n };\n }, [closeByEsc]);\n\n return (\n <>\n {typeof window !== `undefined`\n ? createPortal(\n <section data-theme={themeName}>\n <FocusLock returnFocus>\n <Wrapper role=\"dialog\" aria-modal=\"true\" aria-label={modalName}>\n <Content\n backgroundColor={backgroundColourValue}\n $maxWidth={maxWidth}\n $width={width}\n $top={top}\n margin={margin}\n marginHorizontal={marginHorizontal}\n marginVertical={marginVertical}\n marginTop={marginTop}\n marginRight={marginRight}\n marginBottom={marginBottom}\n marginLeft={marginLeft}\n padding={padding}\n paddingHorizontal={paddingHorizontal}\n paddingVertical={paddingVertical}\n paddingTop={paddingTop}\n paddingRight={paddingRight}\n paddingBottom={paddingBottom}\n paddingLeft={paddingLeft}\n $isAnimated={isAnimated}\n >\n {showCloseButton && closeFunction ? (\n <CloseButton\n aria-label=\"close\"\n appearance=\"tertiary\"\n onClick={() => {\n closeFunction();\n }}\n >\n <IconFa faIcon={faClose} />\n </CloseButton>\n ) : null}\n {children}\n </Content>\n <Background $isAnimated={isAnimated} />\n </Wrapper>\n </FocusLock>\n </section>,\n document.body,\n )\n : null}\n </>\n );\n}\n\nexport default Modal;\n"],"names":["Modal","_a","modalName","closeFunction","showCloseButton","themeName","_b","maxWidth","_c","top","backgroundColor","children","_d","width","margin","marginHorizontal","marginVertical","marginTop","marginRight","_e","marginBottom","marginLeft","_f","padding","paddingHorizontal","paddingVertical","paddingTop","paddingRight","paddingBottom","paddingLeft","_g","isAnimated","backgroundColourValue","themeColorOrString","closeByEsc","React","useCallback","event","key","useEffect","window","document","body","style","overflow","addEventListener","removeEventListener","createElement","Fragment","createPortal","FocusLock","returnFocus","Wrapper","role","Content","$maxWidth","$width","$top","CloseButton","appearance","onClick","IconFa","faIcon","faClose","Background","$isAnimated"],"mappings":"ybA4CM,SAAUA,EAAMC,OACpBC,EAASD,EAAAC,UACTC,EAAaF,EAAAE,cACbC,EAAeH,EAAAG,gBACfC,EAASJ,EAAAI,UACTC,EAAAL,EAAAM,SAAAA,OAAQ,IAAAD,EAAG,UACXE,EAAAP,EAAAQ,IAAAA,OAAG,IAAAD,EAAG,OAAMA,EACZE,EAAeT,EAAAS,gBACfC,EAAQV,EAAAU,SACRC,UAAAC,aAAQ,MAAKD,EACbE,EAAMb,EAAAa,OACNC,EAAgBd,EAAAc,iBAChBC,EAAcf,EAAAe,eACdC,EAAShB,EAAAgB,UACTC,EAAWjB,EAAAiB,YACXC,EAAAlB,EAAAmB,aAAAA,OAAY,IAAAD,EAAG,QACfE,eACAC,EAAArB,EAAAsB,QAAAA,OAAO,IAAAD,EAAG,KAAIA,EACdE,EAAiBvB,EAAAuB,kBACjBC,EAAexB,EAAAwB,gBACfC,EAAUzB,EAAAyB,WACVC,EAAY1B,EAAA0B,aACZC,EAAa3B,EAAA2B,cACbC,EAAW5B,EAAA4B,YACXC,eAAAC,OAAU,IAAAD,GAAOA,EAEXE,EAAwBtB,EAC1BuB,EAAmBvB,GACnB,mCAEEwB,EAAaC,EAAMC,YACvB,SAACC,GACmB,WAAdA,EAAMC,KAAsBnC,GAC9BA,GAEJ,EACA,CAACA,IAmBH,OAhBAoC,EAAU,WACR,GAAsB,oBAAXC,OAMX,OAHAC,SAASC,KAAKC,MAAMC,SAAW,SAC/BH,SAASI,iBAAiB,UAAWX,GAE9B,WACiB,oBAAXM,SAGXC,SAASC,KAAKC,MAAMC,SAAW,QAC/BH,SAASK,oBAAoB,UAAWZ,GAC1C,CACF,EAAG,CAACA,IAGFC,EAAAY,cAAAZ,EAAAa,SAAA,KACqB,oBAAXR,OACJS,EACEd,EAAAY,cAAA,UAAA,CAAA,aAAqB1C,GACnB8B,EAAAY,cAACG,GAAUC,aAAW,GACpBhB,EAAAY,cAACK,GAAQC,KAAK,SAAQ,aAAY,oBAAmBnD,GACnDiC,EAAAY,cAACO,EAAO,CACN5C,gBAAiBsB,EAAqBuB,UAC3BhD,EAAQiD,OACX3C,EAAK4C,KACPhD,EACNK,OAAQA,EACRC,iBAAkBA,EAClBC,eAAgBA,EAChBC,UAAWA,EACXC,YAAaA,EACbE,aAAcA,EACdC,WAAYA,EACZE,QAASA,EACTC,kBAAmBA,EACnBC,gBAAiBA,EACjBC,WAAYA,EACZC,aAAcA,EACdC,cAAeA,EACfC,YAAaA,cACAE,GAEZ3B,GAAmBD,EAClBgC,EAAAY,cAACW,EAAW,CAAA,aACC,QACXC,WAAW,WACXC,QAAS,WACPzD,GACF,GAEAgC,EAAAY,cAACc,EAAM,CAACC,OAAQC,KAEhB,KACHpD,GAEHwB,EAAAY,cAACiB,EAAU,CAAAC,YAAclC,OAI/BU,SAASC,MAEX,KAGV"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type ThemeType } from "../../types";
|
|
2
1
|
export declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
2
|
export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("../Spacing").SpacingProps & import("react").HTMLAttributes<HTMLElement> & {
|
|
4
|
-
backgroundColor?: string;
|
|
3
|
+
backgroundColor?: string | import("..").ColourVariableType;
|
|
5
4
|
ref?: import("react").Ref<HTMLDivElement>;
|
|
6
5
|
children?: import("react").ReactNode;
|
|
7
6
|
as?: import("react").ElementType;
|
|
@@ -11,9 +10,8 @@ export declare const Content: import("styled-components/dist/types").IStyledComp
|
|
|
11
10
|
$width: string;
|
|
12
11
|
$maxWidth: string;
|
|
13
12
|
$isAnimated?: boolean;
|
|
14
|
-
theme: ThemeType;
|
|
15
13
|
}>> & string & Omit<({ ...props }: import("../Box").BoxProps) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
16
|
-
export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components
|
|
14
|
+
export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").ButtonHTMLAttributes<HTMLElement> & {
|
|
17
15
|
appearance?: import("..").ButtonAppearanceType;
|
|
18
16
|
full?: boolean;
|
|
19
17
|
href?: string;
|
|
@@ -23,10 +21,7 @@ export declare const CloseButton: import("styled-components/dist/types").IStyled
|
|
|
23
21
|
isIconButton?: boolean;
|
|
24
22
|
ref?: import("react").Ref<HTMLElement>;
|
|
25
23
|
children?: import("react").ReactNode;
|
|
26
|
-
}, {
|
|
27
|
-
theme: ThemeType;
|
|
28
|
-
}>> & string & Omit<(props: import("../Button").ButtonProps) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
24
|
+
}, never>> & string & Omit<(props: import("../Button").ButtonProps) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
29
25
|
export declare const Background: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
30
|
-
theme: ThemeType;
|
|
31
26
|
$isAnimated?: boolean;
|
|
32
27
|
}>> & string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i,{keyframes as o}from"styled-components";import{Box as t}from"../Box/index.js";import{Button as a}from"../Button/index.js";var r,e,m,d,s,c,p=i.div(r||(r=n(["\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n"],["\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n"]))),f=o(e||(e=n(["\n from {\n opacity: 0;\n transform: scale(0);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n"],["\n from {\n opacity: 0;\n transform: scale(0);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n"]))),u=o(m||(m=n(["\n from {\n opacity: 0;\n }\n to {\n opacity: 0.5;\n }\n"],["\n from {\n opacity: 0;\n }\n to {\n opacity: 0.5;\n }\n"]))),l=i(t)(d||(d=n(["\n background-color: ",";\n position: relative;\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);\n margin: ",";\n width: ",";\n min-height: 10rem;\n max-width: ",";\n z-index: 9999;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.2s;\n transform-origin: top center;\n animation-name: ",";\n"],["\n background-color: ",";\n position: relative;\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);\n margin: ",";\n width: ",";\n min-height: 10rem;\n max-width: ",";\n z-index: 9999;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.2s;\n transform-origin: top center;\n animation-name: ",";\n"])),function(n){return n.$backgroundColor},function(n){var i=n.$top;return"".concat(i," auto auto auto")},function(n){return n.$width},function(n){return n.$maxWidth},function(n){return n.$isAnimated?f:"none"}),g=i(a)(s||(s=n(["\n float: right;\n margin-left: var(--spacing-xs, 1rem);\n font-size: 1.2rem;\n padding: 0;\n"],["\n float: right;\n margin-left: var(--spacing-xs, 1rem);\n font-size: 1.2rem;\n padding: 0;\n"]))),x=i.div(c||(c=n(["\n background: var(--clr-modal-backdrop, #000);\n bottom: 0;\n left: 0;\n opacity: 0.5;\n position: fixed;\n right: 0;\n top: 0;\n transition:\n opacity 0.3s,\n bottom 0s 0.3s;\n z-index: 100;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.3s;\n animation-name: ",";\n"],["\n background: var(--clr-modal-backdrop, #000);\n bottom: 0;\n left: 0;\n opacity: 0.5;\n position: fixed;\n right: 0;\n top: 0;\n transition:\n opacity 0.3s,\n bottom 0s 0.3s;\n z-index: 100;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.3s;\n animation-name: ",";\n"])),function(n){return n.$isAnimated?u:"none"});export{x as Background,g as CloseButton,l as Content,p as Wrapper};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Modal/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Modal/styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\nimport Box from \"../Box\";\nimport { Button } from \"../Button\";\n\nexport const Wrapper = styled.div`\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n position: fixed;\n top: 0;\n width: 100%;\n z-index: 9999;\n`;\n\nconst grow = keyframes`\n from {\n opacity: 0;\n transform: scale(0);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n`;\n\nconst fade = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: 0.5;\n }\n`;\n\nexport const Content = styled(Box)<{\n $backgroundColor?: string;\n $top: string;\n $width: string;\n $maxWidth: string;\n $isAnimated?: boolean;\n}>`\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n position: relative;\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);\n margin: ${({ $top }) => `${$top} auto auto auto`};\n width: ${({ $width }) => $width};\n min-height: 10rem;\n max-width: ${({ $maxWidth }) => $maxWidth};\n z-index: 9999;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.2s;\n transform-origin: top center;\n animation-name: ${({ $isAnimated }) => ($isAnimated ? grow : \"none\")};\n`;\n\nexport const CloseButton = styled(Button)`\n float: right;\n margin-left: var(--spacing-xs, 1rem);\n font-size: 1.2rem;\n padding: 0;\n`;\n\nexport const Background = styled.div<{\n $isAnimated?: boolean;\n}>`\n background: var(--clr-modal-backdrop, #000);\n bottom: 0;\n left: 0;\n opacity: 0.5;\n position: fixed;\n right: 0;\n top: 0;\n transition:\n opacity 0.3s,\n bottom 0s 0.3s;\n z-index: 100;\n animation-direction: normal;\n animation-timing-function: ease-in-out;\n animation-duration: 0.3s;\n animation-name: ${({ $isAnimated }) => ($isAnimated ? fade : \"none\")};\n`;\n"],"names":["Wrapper","styled","div","templateObject_1","__makeTemplateObject","grow","keyframes","templateObject_2","fade","templateObject_3","Content","Box","templateObject_4","_a","$backgroundColor","$top","concat","$width","$maxWidth","$isAnimated","CloseButton","Button","templateObject_5","Background","templateObject_6"],"mappings":"mNAIO,gBAAMA,EAAUC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,oIAAA,CAAA,uIAU3BC,EAAOC,EAASC,IAAAA,EAAAH,EAAA,CAAA,wHAAA,CAAA,2HAWhBI,EAAOF,EAASG,IAAAA,EAAAL,EAAA,CAAA,sEAAA,CAAA,yEASTM,EAAUT,EAAOU,EAAPV,CAAWW,IAAAA,EAAAR,EAAA,CAAA,yBAAA,qFAAA,eAAA,yCAAA,mLAAA,OAAA,CAMhC,yBAC8D,qFAGd,eACjB,yCAEU,mLAM2B,SAZhD,SAACS,GAAyB,OAAPA,EAAAC,gBAAO,EAGpC,SAACD,GAAE,IAAAE,EAAIF,EAAAE,KAAO,MAAA,GAAAC,OAAGD,EAAI,kBAAP,EACf,SAACF,GAAe,OAAPA,EAAAI,MAAO,EAEZ,SAACJ,GAAkB,OAAPA,EAAAK,SAAO,EAMd,SAACL,GAAoB,OAAPA,EAAAM,YAAsBd,EAAO,MAAtB,GAG5Be,EAAcnB,EAAOoB,EAAPpB,CAAcqB,IAAAA,EAAAlB,EAAA,CAAA,qGAAA,CAAA,wGAO5BmB,EAAatB,EAAOC,IAAGsB,IAAAA,EAAApB,EAAA,CAAA,8UAAA,OAAA,CAElC,8UAeoE,SAAlD,SAACS,GAAoB,OAAPA,EAAAM,YAAsBX,EAAO,MAAtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{PagerWrapper as a,PagerList as c,PagerItem as n,PagerLink as l}from"./styles.js";function r(r){var o=r.current,i=r.items,s=r.hideLast,m=r.pagerCallback,d=r.perPage,u=r.searchParam,f=void 0===u?"page":u,p=r.children,E=r.id,v=d>0?d:1,b=Math.ceil(i/v)||1,h=function(e){return{href:"".concat("undefined"!=typeof window?window.location.pathname:"","?").concat(f?"".concat(f,"=").concat(e):""),onClick:function(t){t.preventDefault(),m(e)}}};return t.createElement(t.Fragment,null,i>d&&t.createElement(a,null,t.createElement(c,null,t.createElement(n,{key:"Prev"},t.createElement(l,e({"data-cta":E?"".concat(E,"-prev"):null,name:"Prev","aria-disabled":1===o},1===o&&{tabIndex:-1},1!==o&&h(o-1),{$disabled:1===o}),"Prev")),function(a,c){for(var r=[],o=[],i=1;i<=c;i+=1)r.push(t.createElement(n,{key:i},t.createElement(l,e({"data-cta":E?"".concat(E,"-").concat(i):null,$active:i===a},h(i),{"aria-label":"page ".concat(i," of ").concat(c)}),i)));var m=r.slice(0,1).concat(t.createElement(n,{key:"first"},t.createElement("span",null,"..."))),d=r.slice(r.length-1).concat(t.createElement(n,{key:"last"},t.createElement("span",null,"..."))).reverse();return o=r.slice(0,c),c>7&&(o=a<=4?s?r.slice(0,7):r.slice(0,5).concat(d):a>c-4?m.concat(r.slice(-5)):s?m.concat(r.slice(a-3,a+2)):m.concat(r.slice(a-2,a+1)).concat(d)),o}(o,b),t.createElement(n,{key:"Next"},t.createElement(l,e({"data-cta":E?"".concat(E,"-next"):null,name:"Next","aria-disabled":o===b},o===b&&{tabIndex:-1},o!==b&&h(o+1),{$disabled:o===b}),"Next"))),p))}export{r as Pagination,r as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Pagination/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type TouchEvent,\n} from \"react\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Pagination/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type TouchEvent,\n} from \"react\";\n\nimport { PagerItem, PagerLink, PagerList, PagerWrapper } from \"./styles\";\n\nexport type PaginationProps = {\n /** set current page number */\n current: number;\n /** total number of pages */\n items: number;\n /** don't show an ellipsise and then the last page link, usefull for search results where the last page isn't important */\n hideLast?: boolean;\n /** callback function which is passed the selected page number on click */\n pagerCallback: (n: number) => void;\n /** number of items per page */\n perPage: number;\n /** the name of the search param in the url that is modified on page click, defaults to 'page' */\n searchParam?: string;\n children?: ReactNode;\n} & HTMLAttributes<HTMLElement>;\n\n/**\n * \n * Pagination is used when we are viewing large amounts of data.\nData is split into multiple pages and pagination is used to\neasily navigate through these pages.\n */\nexport function Pagination({\n current,\n items,\n hideLast,\n pagerCallback,\n perPage,\n searchParam = \"page\",\n children,\n id,\n}: PaginationProps) {\n const perPageValue = perPage > 0 ? perPage : 1;\n const totalPages = Math.ceil(items / perPageValue) || 1;\n\n const linkProps = (number: number) => ({\n href: `${typeof window !== \"undefined\" ? window.location.pathname : \"\"}?${\n searchParam ? `${searchParam}=${number}` : \"\"\n }`,\n onClick: (e: TouchEvent | MouseEvent) => {\n e.preventDefault();\n pagerCallback(number);\n },\n });\n\n const renderPager = (active: number, total: number) => {\n const list = [];\n let pager = [];\n // get the list of items\n for (let number = 1; number <= total; number += 1) {\n list.push(\n <PagerItem key={number}>\n <PagerLink\n data-cta={id ? `${id}-${number}` : null}\n $active={number === active}\n {...linkProps(number)}\n aria-label={`page ${number} of ${total}`}\n >\n {number}\n </PagerLink>\n </PagerItem>,\n );\n }\n const first = list.slice(0, 1).concat(\n <PagerItem key=\"first\">\n <span>...</span>\n </PagerItem>,\n );\n const last = list\n .slice(list.length - 1)\n .concat(\n <PagerItem key=\"last\">\n <span>...</span>\n </PagerItem>,\n )\n .reverse();\n pager = list.slice(0, total);\n if (total > 7) {\n if (active <= 4) {\n pager = hideLast ? list.slice(0, 7) : list.slice(0, 5).concat(last);\n } else {\n pager =\n active > total - 4\n ? first.concat(list.slice(-5))\n : hideLast\n ? first.concat(list.slice(active - 3, active + 2))\n : first.concat(list.slice(active - 2, active + 1)).concat(last);\n }\n }\n return pager;\n };\n\n return (\n <>\n {items > perPage && (\n <PagerWrapper>\n <PagerList>\n <PagerItem key=\"Prev\">\n <PagerLink\n data-cta={id ? `${id}-prev` : null}\n name=\"Prev\"\n aria-disabled={current === 1}\n {...(current === 1 && { tabIndex: -1 })}\n {...(current !== 1 && linkProps(current - 1))}\n $disabled={current === 1}\n >\n Prev\n </PagerLink>\n </PagerItem>\n {renderPager(current, totalPages)}\n <PagerItem key=\"Next\">\n <PagerLink\n data-cta={id ? `${id}-next` : null}\n name=\"Next\"\n aria-disabled={current === totalPages}\n {...(current === totalPages && { tabIndex: -1 })}\n {...(current !== totalPages && linkProps(current + 1))}\n $disabled={current === totalPages}\n >\n Next\n </PagerLink>\n </PagerItem>\n </PagerList>\n {children}\n </PagerWrapper>\n )}\n </>\n );\n}\n\nexport default Pagination;\n"],"names":["Pagination","_a","current","items","hideLast","pagerCallback","perPage","_b","searchParam","children","id","perPageValue","totalPages","Math","ceil","linkProps","number","href","concat","window","location","pathname","onClick","e","preventDefault","React","PagerWrapper","createElement","PagerList","PagerItem","key","PagerLink","__assign","name","tabIndex","active","total","list","pager","push","$active","first","slice","last","length","reverse","renderPager","$disabled"],"mappings":"iLA+BM,SAAUA,EAAWC,OACzBC,EAAOD,EAAAC,QACPC,EAAKF,EAAAE,MACLC,EAAQH,EAAAG,SACRC,EAAaJ,EAAAI,cACbC,YACAC,EAAAN,EAAAO,YAAAA,OAAW,IAAAD,EAAG,OAAMA,EACpBE,EAAQR,EAAAQ,SACRC,EAAET,EAAAS,GAEIC,EAAeL,EAAU,EAAIA,EAAU,EACvCM,EAAaC,KAAKC,KAAKX,EAAQQ,IAAiB,EAEhDI,EAAY,SAACC,GAAmB,MAAA,CACpCC,KAAM,GAAAC,OAAqB,oBAAXC,OAAyBA,OAAOC,SAASC,SAAW,GAAE,KAAAH,OACpEV,EAAc,GAAAU,OAAGV,EAAW,KAAAU,OAAIF,GAAW,IAE7CM,QAAS,SAACC,GACRA,EAAEC,iBACFnB,EAAcW,EAChB,EAPoC,EAyDtC,OACES,gCACGtB,EAAQG,GACPmB,gBAACC,EAAY,KACXD,EAAAE,cAACC,EAAS,KACRH,EAAAE,cAACE,EAAS,CAACC,IAAI,QACbL,EAAAE,cAACI,EAASC,EAAA,CAAA,WACEtB,EAAK,GAAAQ,OAAGR,EAAE,SAAU,KAC9BuB,KAAK,OAAM,gBACgB,IAAZ/B,GACE,IAAZA,GAAiB,CAAEgC,UAAU,GACjB,IAAZhC,GAAiBa,EAAUb,EAAU,cACnB,IAAZA,IAAa,SA3DlB,SAACiC,EAAgBC,GAInC,IAHA,IAAMC,EAAO,GACTC,EAAQ,GAEHtB,EAAS,EAAGA,GAAUoB,EAAOpB,GAAU,EAC9CqB,EAAKE,KACHd,EAAAE,cAACE,EAAS,CAACC,IAAKd,GACdS,EAAAE,cAACI,EAASC,EAAA,CAAA,WACEtB,EAAK,GAAAQ,OAAGR,EAAE,KAAAQ,OAAIF,GAAW,KAAIwB,QAC9BxB,IAAWmB,GAChBpB,EAAUC,iBACF,QAAAE,OAAQF,EAAM,QAAAE,OAAOkB,KAEhCpB,KAKT,IAAMyB,EAAQJ,EAAKK,MAAM,EAAG,GAAGxB,OAC7BO,EAAAE,cAACE,EAAS,CAACC,IAAI,SACbL,EAAAE,cAAA,OAAA,KAAA,SAGEgB,EAAON,EACVK,MAAML,EAAKO,OAAS,GACpB1B,OACCO,EAAAE,cAACE,EAAS,CAACC,IAAI,QACbL,EAAAE,cAAA,OAAA,KAAA,SAGHkB,UAcH,OAbAP,EAAQD,EAAKK,MAAM,EAAGN,GAClBA,EAAQ,IAERE,EADEH,GAAU,EACJ/B,EAAWiC,EAAKK,MAAM,EAAG,GAAKL,EAAKK,MAAM,EAAG,GAAGxB,OAAOyB,GAG5DR,EAASC,EAAQ,EACbK,EAAMvB,OAAOmB,EAAKK,OAAM,IACxBtC,EACEqC,EAAMvB,OAAOmB,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAC7CM,EAAMvB,OAAOmB,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAAIjB,OAAOyB,IAG7DL,CACT,CAmBWQ,CAAY5C,EAASU,GACtBa,EAAAE,cAACE,EAAS,CAACC,IAAI,QACbL,EAAAE,cAACI,EAASC,EAAA,CAAA,WACEtB,EAAK,GAAAQ,OAAGR,EAAE,SAAU,KAC9BuB,KAAK,OAAM,gBACI/B,IAAYU,GACtBV,IAAYU,GAAc,CAAEsB,UAAU,GACtChC,IAAYU,GAAcG,EAAUb,EAAU,GAAG,CAAA6C,UAC3C7C,IAAYU,IAAU,UAMtCH,GAKX"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { type ThemeType } from "../../types";
|
|
2
1
|
export declare const PagerWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
2
|
export declare const PagerList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
4
3
|
export declare const PagerLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {
|
|
5
4
|
name?: string;
|
|
6
|
-
theme: ThemeType;
|
|
7
5
|
$active?: boolean;
|
|
8
6
|
$disabled?: boolean;
|
|
9
7
|
}>> & string;
|
|
10
|
-
export declare const PagerItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components
|
|
11
|
-
theme: ThemeType;
|
|
12
|
-
}>> & string;
|
|
8
|
+
export declare const PagerItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import e,{css as o}from"styled-components";var r,i,t,a,d,c,l,s=e.div(r||(r=n(["\n display: table;\n width: 100%;\n clear: both;\n text-align: center;\n"],["\n display: table;\n width: 100%;\n clear: both;\n text-align: center;\n"]))),p=e.ul(i||(i=n(["\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n"],["\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n"]))),v=e.a(c||(c=n(['\n font-weight: normal;\n font-family: var(--typ-font-family-base, "Poppins", Arial, sans-serif);\n font-size: var(--font-size-s, 0.875rem);\n color: var(--clr-text-light, #fff);\n background-color: var(--clr-pagination-background, #00007e);\n cursor: pointer;\n border-radius: 0;\n margin: var(--spacing-xxs, 0.5rem);\n padding: 7px 11px;\n text-decoration: none;\n &:active,\n &:focus,\n &:hover {\n opacity: 0.88;\n text-decoration: underline;\n }\n &:visited {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: auto;\n }\n\n ',"\n\n ","\n\n ","\n"],['\n font-weight: normal;\n font-family: var(--typ-font-family-base, "Poppins", Arial, sans-serif);\n font-size: var(--font-size-s, 0.875rem);\n color: var(--clr-text-light, #fff);\n background-color: var(--clr-pagination-background, #00007e);\n cursor: pointer;\n border-radius: 0;\n margin: var(--spacing-xxs, 0.5rem);\n padding: 7px 11px;\n text-decoration: none;\n &:active,\n &:focus,\n &:hover {\n opacity: 0.88;\n text-decoration: underline;\n }\n &:visited {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: auto;\n }\n\n ',"\n\n ","\n\n ","\n"])),function(e){return e.$active&&o(t||(t=n(["\n color: var(--clr-text-dark, #000);\n background-color: var(--clr-pagination-active, #e6e6e6);\n cursor: default;\n &:hover {\n background-color: var(--clr-pagination-active, #e6e6e6);\n text-decoration: none;\n }\n "],["\n color: var(--clr-text-dark, #000);\n background-color: var(--clr-pagination-active, #e6e6e6);\n cursor: default;\n &:hover {\n background-color: var(--clr-pagination-active, #e6e6e6);\n text-decoration: none;\n }\n "])))},function(e){var r=e.name,i=e.$disabled;return("Prev"===r||"Next"===r)&&o(a||(a=n(["\n color: ",";\n background-color: transparent;\n font-weight: bold;\n padding: 8px 6px;\n background-color: transparent;\n &:focus,\n &:hover {\n background-color: transparent;\n text-decoration: underline;\n }\n &:active,\n &:visited {\n text-decoration: none;\n }\n "],["\n color: ",";\n background-color: transparent;\n font-weight: bold;\n padding: 8px 6px;\n background-color: transparent;\n &:focus,\n &:hover {\n background-color: transparent;\n text-decoration: underline;\n }\n &:active,\n &:visited {\n text-decoration: none;\n }\n "])),i?"var(--clr-disabled, #e6e6e6)":"var(--clr-pagination-text, #00007e)")},function(e){return e.$disabled&&o(d||(d=n(["\n color: var(--clr-disabled, #e6e6e6);\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: var(--clr-disabled, #e6e6e6);\n text-decoration: none;\n }\n "],["\n color: var(--clr-disabled, #e6e6e6);\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: var(--clr-disabled, #e6e6e6);\n text-decoration: none;\n }\n "])))}),u=e.li(l||(l=n(["\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: 576px) {\n display: inline;\n }\n span {\n border: none;\n min-width: 30px;\n padding: 5px;\n margin: 1px;\n border-radius: 0;\n border-width: var(--breakpoint-mobile, 576px);\n }\n"],["\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: 576px) {\n display: inline;\n }\n span {\n border: none;\n min-width: 30px;\n padding: 5px;\n margin: 1px;\n border-radius: 0;\n border-width: var(--breakpoint-mobile, 576px);\n }\n"])));export{u as PagerItem,v as PagerLink,p as PagerList,s as PagerWrapper};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Pagination/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Pagination/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nexport const PagerWrapper = styled.div`\n display: table;\n width: 100%;\n clear: both;\n text-align: center;\n`;\n\nexport const PagerList = styled.ul`\n display: inline-block;\n padding-left: 0;\n margin: 20px 0;\n`;\n\nexport const PagerLink = styled.a<{\n name?: string;\n $active?: boolean;\n $disabled?: boolean;\n}>`\n font-weight: normal;\n font-family: var(--typ-font-family-base, \"Poppins\", Arial, sans-serif);\n font-size: var(--font-size-s, 0.875rem);\n color: var(--clr-text-light, #fff);\n background-color: var(--clr-pagination-background, #00007e);\n cursor: pointer;\n border-radius: 0;\n margin: var(--spacing-xxs, 0.5rem);\n padding: 7px 11px;\n text-decoration: none;\n &:active,\n &:focus,\n &:hover {\n opacity: 0.88;\n text-decoration: underline;\n }\n &:visited {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: auto;\n }\n\n ${({ $active }) =>\n $active &&\n css`\n color: var(--clr-text-dark, #000);\n background-color: var(--clr-pagination-active, #e6e6e6);\n cursor: default;\n &:hover {\n background-color: var(--clr-pagination-active, #e6e6e6);\n text-decoration: none;\n }\n `}\n\n ${({ name, $disabled }) =>\n (name === \"Prev\" || name === \"Next\") &&\n css`\n color: ${$disabled\n ? \"var(--clr-disabled, #e6e6e6)\"\n : \"var(--clr-pagination-text, #00007e)\"};\n background-color: transparent;\n font-weight: bold;\n padding: 8px 6px;\n background-color: transparent;\n &:focus,\n &:hover {\n background-color: transparent;\n text-decoration: underline;\n }\n &:active,\n &:visited {\n text-decoration: none;\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n color: var(--clr-disabled, #e6e6e6);\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: var(--clr-disabled, #e6e6e6);\n text-decoration: none;\n }\n `}\n`;\n\nexport const PagerItem = styled.li`\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: 576px) {\n display: inline;\n }\n span {\n border: none;\n min-width: 30px;\n padding: 5px;\n margin: 1px;\n border-radius: 0;\n border-width: var(--breakpoint-mobile, 576px);\n }\n`;\n"],"names":["PagerWrapper","styled","div","templateObject_1","__makeTemplateObject","PagerList","ul","templateObject_2","PagerLink","a","templateObject_6","_a","$active","css","templateObject_3","name","$disabled","templateObject_4","templateObject_5","PagerItem","li","templateObject_7"],"mappings":"2HAEO,kBAAMA,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,gFAAA,CAAA,mFAOzBC,EAAYJ,EAAOK,GAAEC,IAAAA,EAAAH,EAAA,CAAA,uEAAA,CAAA,0EAMrBI,EAAYP,EAAOQ,EAACC,IAAAA,EAAAN,EAAA,CAAA,+jBAAA,SAAA,SAAA,MAAA,CAI/B,+jBAmCG,SAqBA,SAgBA,QA/CD,SAACO,GACD,OADUA,EAAAC,SAEVC,EAAGC,IAAAA,EAAAV,EAAA,CAAA,wQAAA,CAAA,0QADH,EAWA,SAACO,OAAEI,EAAIJ,EAAAI,KAAEC,EAASL,EAAAK,UAClB,OAAU,SAATD,GAA4B,SAATA,IACpBF,EAAGI,IAAAA,EAAAb,EAAA,CAAA,kBAAA,8UAAA,CAAA,kBAGwC,gVAFhCY,EACL,+BACA,sCAJN,EAoBA,SAACL,GACD,OADYA,EAAAK,WAEZH,EAAGK,IAAAA,EAAAd,EAAA,CAAA,sSAAA,CAAA,wSADH,GAgBSe,EAAYlB,EAAOmB,GAAEC,IAAAA,EAAAjB,EAAA,CAAA,yTAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{useRef as n,useState as t,useEffect as o}from"react";import{useKey as r}from"../../hooks/useKey.js";import{useEffectBrowser as i}from"../../hooks/useEffectBrowser.js";import{PopOverWrapper as a,PopOverModal as c}from"./styles.js";function l(l){var u=l.onPopOverIsOpenChange,s=l.children,m=l.minWidth,d=l.maxWidth,f=l.position,p=l.modalLabel,h=l.modalContent,E=l.css,v=l.full,k=void 0!==v&&v,$=n(null),g=t(!1),x=g[0],C=g[1],W=function(){return C(!x)},j=function(){return C(!1)},y=function(e){$.current&&!$.current.contains(e.target)&&j()};return r(function(){j()},{detectKeys:["Escape"]},[]),o(function(){u&&u(x)},[x,u]),i(function(){return document.addEventListener("click",y,!0),function(){document.removeEventListener("click",y,!0)}},[]),e.createElement(a,{$full:k,$css:E,ref:$},e.Children.map(s,function(n){return e.cloneElement(n,{onClick:W,"aria-expanded":x,"aria-haspopup":"dialog"})}),x?e.createElement(c,{$maxWidth:d||"none",$minWidth:m||"auto",$position:f||"top",role:"dialog","aria-label":p,"aria-modal":x},h):null)}export{l as PopOver,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/PopOver/index.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n useRef,\n type ReactNode,\n type DetailedReactHTMLElement,\n} from \"react\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/PopOver/index.tsx"],"sourcesContent":["import React, {\n useState,\n useEffect,\n useRef,\n type ReactNode,\n type DetailedReactHTMLElement,\n} from \"react\";\n\nimport { useKey } from \"../../hooks/useKey\";\nimport { useEffectBrowser } from \"../../hooks/useEffectBrowser\";\n\nimport { type PopOverPositionType } from \"../../types\";\nimport { PopOverWrapper, PopOverModal } from \"./styles\";\n\nexport type PopOverProps = {\n /** modalLabel: used for aria-label of modal */\n modalLabel: string;\n /** modalContent: contents in side the popover modal */\n modalContent: ReactNode;\n /** position: position that the popover opens relative to the triggering element, the trigger element is the child of the component */\n position?: PopOverPositionType;\n /** full: enable child button extend full width */\n full?: boolean;\n /** maxWidth: popover modal max width */\n maxWidth?: string;\n /** minWidth: popover modal min width */\n minWidth?: string;\n /** onPopOverIsOpenChange: popover isOpen changed handler */\n onPopOverIsOpenChange?: (isOpen: boolean) => void;\n children?: ReactNode;\n css?: string;\n};\n\n/**\n * Popover is a non-modal dialog that floats around its disclosure. It's\ncommonly used for displaying additional rich content on top of something.\n*/\nexport function PopOver({\n onPopOverIsOpenChange,\n children,\n minWidth,\n maxWidth,\n position,\n modalLabel,\n modalContent,\n css,\n full = false,\n}: PopOverProps) {\n const popRef = useRef<HTMLDivElement>(null);\n const [showPopOver, setShowPopOver] = useState(false);\n\n const toggle = () => setShowPopOver(!showPopOver);\n const closePopOver = () => setShowPopOver(false);\n\n // outside click closes popover\n const handleDocumentClick = (e: MouseEvent) => {\n if (!!popRef.current && !popRef.current.contains(e.target as Node)) {\n closePopOver();\n }\n };\n\n useKey(\n () => {\n closePopOver();\n },\n {\n detectKeys: [\"Escape\"],\n },\n [],\n );\n\n useEffect(() => {\n if (onPopOverIsOpenChange) {\n onPopOverIsOpenChange(showPopOver);\n }\n }, [showPopOver, onPopOverIsOpenChange]);\n\n useEffectBrowser(() => {\n document.addEventListener(\"click\", handleDocumentClick, true);\n return () => {\n document.removeEventListener(\"click\", handleDocumentClick, true);\n };\n }, []);\n\n return (\n <PopOverWrapper $full={full} $css={css} ref={popRef}>\n {React.Children.map(children, (child) =>\n React.cloneElement(\n child as DetailedReactHTMLElement<object, HTMLElement>,\n {\n onClick: toggle,\n \"aria-expanded\": showPopOver,\n \"aria-haspopup\": \"dialog\",\n },\n ),\n )}\n {showPopOver ? (\n <PopOverModal\n $maxWidth={maxWidth || \"none\"}\n $minWidth={minWidth || \"auto\"}\n $position={position || \"top\"}\n role=\"dialog\"\n aria-label={modalLabel}\n aria-modal={showPopOver}\n >\n {modalContent}\n </PopOverModal>\n ) : null}\n </PopOverWrapper>\n );\n}\n\nexport default PopOver;\n"],"names":["PopOver","_a","onPopOverIsOpenChange","children","minWidth","maxWidth","position","modalLabel","modalContent","css","_b","full","popRef","useRef","_c","useState","showPopOver","setShowPopOver","toggle","closePopOver","handleDocumentClick","e","current","contains","target","useKey","detectKeys","useEffect","useEffectBrowser","document","addEventListener","removeEventListener","React","createElement","PopOverWrapper","$full","ref","Children","map","child","cloneElement","onClick","PopOverModal","$maxWidth","$position","role"],"mappings":"gPAqCM,SAAUA,EAAQC,GACtB,IAAAC,EAAqBD,EAAAC,sBACrBC,EAAQF,EAAAE,SACRC,EAAQH,EAAAG,SACRC,EAAQJ,EAAAI,SACRC,EAAQL,EAAAK,SACRC,EAAUN,EAAAM,WACVC,EAAYP,EAAAO,aACZC,EAAGR,EAAAQ,IACHC,EAAAT,EAAAU,KAAAA,OAAI,IAAAD,GAAQA,EAENE,EAASC,EAAuB,MAChCC,EAAgCC,GAAS,GAAxCC,EAAWF,EAAA,GAAEG,EAAcH,EAAA,GAE5BI,EAAS,WAAM,OAAAD,GAAgBD,EAAhB,EACfG,EAAe,WAAM,OAAAF,GAAe,EAAf,EAGrBG,EAAsB,SAACC,GACrBT,EAAOU,UAAYV,EAAOU,QAAQC,SAASF,EAAEG,SACjDL,GAEJ,EAyBA,OAvBAM,EACE,WACEN,GACF,EACA,CACEO,WAAY,CAAC,WAEf,IAGFC,EAAU,WACJzB,GACFA,EAAsBc,EAE1B,EAAG,CAACA,EAAad,IAEjB0B,EAAiB,WAEf,OADAC,SAASC,iBAAiB,QAASV,GAAqB,GACjD,WACLS,SAASE,oBAAoB,QAASX,GAAqB,EAC7D,CACF,EAAG,IAGDY,EAAAC,cAACC,EAAc,CAAAC,MAAQxB,OAAYF,EAAK2B,IAAKxB,GAC1CoB,EAAMK,SAASC,IAAInC,EAAU,SAACoC,GAC7B,OAAAP,EAAMQ,aACJD,EACA,CACEE,QAASvB,EACT,gBAAiBF,EACjB,gBAAiB,UALrB,GASDA,EACCgB,EAAAC,cAACS,EAAY,CAAAC,UACAtC,GAAY,iBACZD,GAAY,OAAMwC,UAClBtC,GAAY,MACvBuC,KAAK,SAAQ,aACDtC,EAAU,aACVS,GAEXR,GAED,KAGV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PopOverPositionType } from "../../types";
|
|
2
2
|
export declare const PopOverWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
3
|
$full: boolean;
|
|
4
4
|
$css?: string;
|
|
@@ -7,5 +7,4 @@ export declare const PopOverModal: import("styled-components/dist/types").IStyle
|
|
|
7
7
|
$position: PopOverPositionType;
|
|
8
8
|
$maxWidth: string;
|
|
9
9
|
$minWidth: string;
|
|
10
|
-
theme?: ThemeType;
|
|
11
10
|
}>> & string;
|