@cruk/cruk-react-components 5.0.1 → 5.0.3
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/lib/components/AllThemesWrapper.d.ts +4 -6
- package/lib/components/Avatar/styles.d.ts +2 -3
- package/lib/components/Badge/Badge.stories.d.ts +0 -1
- package/lib/components/Badge/index.d.ts +3 -3
- package/lib/components/Badge/styles.d.ts +6 -7
- package/lib/components/Box/index.d.ts +0 -1
- package/lib/components/Button/styles.d.ts +4 -6
- package/lib/components/Carousel/Dots.d.ts +4 -5
- package/lib/components/Carousel/styles.d.ts +17 -22
- package/lib/components/Checkbox/styles.d.ts +13 -12
- package/lib/components/DateField/styles.d.ts +9 -7
- package/lib/components/Divider.d.ts +2 -3
- package/lib/components/IconFa/index.d.ts +1 -1
- package/lib/components/IconFa/styles.d.ts +4 -5
- package/lib/components/Pagination/styles.d.ts +2 -2
- package/lib/components/ProgressBar/styles.d.ts +2 -2
- package/lib/components/Radio/styles.d.ts +2 -2
- package/lib/components/TextAreaField/styles.d.ts +1 -1
- package/lib/components/ThemeCheatSheet.d.ts +2 -3
- package/lib/src/components/Avatar/styles.js.map +1 -1
- 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.js +1 -1
- package/lib/src/components/Badge/styles.js.map +1 -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.js +1 -1
- package/lib/src/components/Box/styles.js.map +1 -1
- package/lib/src/components/Button/styles.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/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.js +1 -1
- package/lib/src/components/Checkbox/styles.js.map +1 -1
- package/lib/src/components/DateField/styles.js.map +1 -1
- package/lib/src/components/Divider.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.js +1 -1
- package/lib/src/components/IconFa/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.js +1 -1
- package/lib/src/components/Pagination/styles.js.map +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.js +1 -1
- package/lib/src/components/Radio/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.js +1 -1
- package/lib/src/components/TextAreaField/styles.js.map +1 -1
- package/lib/src/utils/themeUtils.js +2 -0
- package/lib/src/utils/themeUtils.js.map +1 -0
- package/lib/utils/themeUtils.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import e from"styled-components";var o,t,r,i,a,s,l,c,d,p,h=e.div(o||(o=n(["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"],["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"]))),m=e.ul(t||(t=n(["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"],["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"])),(function(n){return n.$smoothScrolling?"smooth":"auto"})),u=e.li(r||(r=n(["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"],["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"])),(function(n){var e=n.$onlyChild,o=n.$fullWidthChild;return e||o?"100%":"80%"})),f=e.div(i||(i=n(["\n transition: transform 0.2s linear;\n transform: ",";\n"],["\n transition: transform 0.2s linear;\n transform: ",";\n"])),(function(n){var e=n.$isSelected,o=n.$shrinkUnselectedPages,t=n.$onlyChild,r=n.$fullWidthChild;return t||e&&o||r?"scale(1)":"scale(0.9)"})),g=e.div(a||(a=n(["\n display: flex;\n justify-content: center;\n"],["\n display: flex;\n justify-content: center;\n"]))),b=e.span(s||(s=n(["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"],["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"]))),x=e.button(l||(l=n(["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"],["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"])),(function(n){var e=n.disabled,o=n.theme;return e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary}),(function(n){return n.theme.fontSizes.xxxl}),(function(n){return n.disabled?"scale(0.8)":"scale(1)"})),w=e.div(c||(c=n(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"],["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"])),(function(n){return n
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import e from"styled-components";var o,t,r,i,a,s,l,c,d,p,h=e.div(o||(o=n(["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"],["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"]))),m=e.ul(t||(t=n(["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"],["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"])),(function(n){return n.$smoothScrolling?"smooth":"auto"})),u=e.li(r||(r=n(["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"],["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"])),(function(n){var e=n.$onlyChild,o=n.$fullWidthChild;return e||o?"100%":"80%"})),f=e.div(i||(i=n(["\n transition: transform 0.2s linear;\n transform: ",";\n"],["\n transition: transform 0.2s linear;\n transform: ",";\n"])),(function(n){var e=n.$isSelected,o=n.$shrinkUnselectedPages,t=n.$onlyChild,r=n.$fullWidthChild;return t||e&&o||r?"scale(1)":"scale(0.9)"})),g=e.div(a||(a=n(["\n display: flex;\n justify-content: center;\n"],["\n display: flex;\n justify-content: center;\n"]))),b=e.span(s||(s=n(["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"],["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"]))),x=e.button(l||(l=n(["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"],["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"])),(function(n){var e=n.disabled,o=n.theme;return e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary}),(function(n){return n.theme.fontSizes.xxxl}),(function(n){return n.disabled?"scale(0.8)":"scale(1)"})),w=e.div(c||(c=n(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"],["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"])),(function(n){return n.$count>6?"none":"flex"}),(function(n){return n.theme.breakpoint.tablet}),(function(n){return n.$count>10?"none":"flex"}),(function(n){return n.theme.breakpoint.desktop}),(function(n){return n.$count>20?"none":"flex"})),y=e.button(d||(d=n(["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"],["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"])),(function(n){return n.theme.spacing.xxs}),(function(n){var e=n.theme;return"auto ".concat(e.spacing.xxs)}),(function(n){return n.theme.fontSizes.l}),(function(n){return n.theme.fontSizes.l}),(function(n){var e=n.theme;return"solid 1px ".concat("su2c"===e.name?e.colors.textDark:e.colors.primary)}),(function(n){var e=n.theme;return n.$selected?"".concat("su2c"===e.name?e.colors.textDark:e.colors.primary):e.colors.backgroundLight})),v=e.span(p||(p=n(["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"],["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"])));export{g as ButtonWrapper,x as CarouselButton,u as CarouselCard,f as CarouselCardInner,m as CarouselScrollArea,h as CarouselWrapper,y as Dot,w as DotContainer,v as ScreenReaderOnly,b as VerticalAlign};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\nexport const CarouselScrollArea = styled.ul<{\n $smoothScrolling: boolean;\n}>`\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ${({ $smoothScrolling }) =>\n $smoothScrolling ? \"smooth\" : \"auto\"};\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n`;\n\nexport const CarouselCard = styled.li<{\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n scroll-snap-align: center;\n display: inline-block;\n width: ${({ $onlyChild, $fullWidthChild }) =>\n $onlyChild || $fullWidthChild ? \"100%\" : \"80%\"};\n`;\n\nexport const CarouselCardInner = styled.div<{\n $isSelected: boolean;\n $shrinkUnselectedPages: boolean;\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\n transition: transform 0.2s linear;\n transform: ${({\n $isSelected,\n $shrinkUnselectedPages,\n $onlyChild,\n $fullWidthChild,\n }) =>\n $onlyChild || ($isSelected && $shrinkUnselectedPages) || $fullWidthChild\n ? \"scale(1)\"\n : \"scale(0.9)\"};\n`;\n\nexport const ButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\nexport const VerticalAlign = styled.span`\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n`;\n\nexport const CarouselButton = styled.button<{\n disabled: boolean;\n theme: ThemeType;\n}>`\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ${({ disabled, theme }) =>\n disabled\n ? theme.colors.disabled\n : theme.name === \"su2c\"\n ? theme.colors.textDark\n : theme.colors.primary};\n font-size: ${({ theme }) => theme.fontSizes.xxxl};\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ${({ disabled }) => (disabled ? \"scale(0.8)\" : \"scale(1)\")};\n }\n`;\n\nexport const DotContainer = styled.div<{ $count: number; theme: ThemeType }>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ${({ $count }) => ($count > 6 ? \"none\" : \"flex\")};\n\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: ${({ $count }) => ($count > 10 ? \"none\" : \"flex\")};\n }\n\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n display: ${({ $count }) => ($count > 20 ? \"none\" : \"flex\")};\n }\n`;\n\nexport const Dot = styled.button<{ $selected: boolean; theme: ThemeType }>`\n border: none;\n outline-offset: ${({ theme }) => theme.spacing.xxs};\n padding: 0;\n margin: ${({ theme }) => `auto ${theme.spacing.xxs}`};\n width: ${({ theme }) => theme.fontSizes.l};\n height: ${({ theme }) => theme.fontSizes.l};\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ${({ theme }) =>\n `solid 1px ${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`};\n background-color: ${({ theme, $selected }) =>\n $selected\n ? `${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`\n : theme.colors.backgroundLight};\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n`;\n\n// TODO move to its own component\nexport const ScreenReaderOnly = styled.span`\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n"],"names":["CarouselWrapper","styled","div","templateObject_1","__makeTemplateObject","CarouselScrollArea","ul","templateObject_2","_a","$smoothScrolling","CarouselCard","li","templateObject_3","$onlyChild","$fullWidthChild","CarouselCardInner","templateObject_4","$isSelected","$shrinkUnselectedPages","ButtonWrapper","templateObject_5","VerticalAlign","span","templateObject_6","CarouselButton","button","templateObject_7","disabled","theme","colors","name","textDark","primary","fontSizes","xxxl","DotContainer","$count","breakpoint","tablet","desktop","Dot","templateObject_9","spacing","xxs","l","concat","$selected","backgroundLight","ScreenReaderOnly","templateObject_10"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import o,{forwardRef as t}from"react";import{useTheme as s,ThemeProvider as i}from"styled-components";import{faCheck as l}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as a}from"../../themes/cruk.js";import{ErrorText as d}from"../ErrorText/index.js";import{IconFa as m}from"../IconFa/index.js";import{StyledLabel as c,StyledInput as n,SelectedBorder as f,CheckWrapper as u,Check as h}from"./styles.js";var p=t((function(t,p){var E=s(),b=e(e({},a),E),x=t.children,j=t.hasError,k=t.errorMessage,v=r(t,["children","hasError","errorMessage"]);return o.createElement(i,{theme:b},o.createElement(c,{$hasError:j||!!k||!1
|
|
1
|
+
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import o,{forwardRef as t}from"react";import{useTheme as s,ThemeProvider as i}from"styled-components";import{faCheck as l}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as a}from"../../themes/cruk.js";import{ErrorText as d}from"../ErrorText/index.js";import{IconFa as m}from"../IconFa/index.js";import{StyledLabel as c,StyledInput as n,SelectedBorder as f,CheckWrapper as u,Check as h}from"./styles.js";var p=t((function(t,p){var E=s(),b=e(e({},a),E),x=t.children,j=t.hasError,k=t.errorMessage,v=r(t,["children","hasError","errorMessage"]);return o.createElement(i,{theme:b},o.createElement(c,{$hasError:j||!!k||!1,$checked:t.checked||t.defaultChecked||!1,$disabled:t.disabled||!1},o.createElement(n,e({},v,{disabled:t.disabled||!1,type:"checkbox",ref:p,"aria-describedby":t.id&&k?"".concat(t.id,"-error"):void 0})),o.createElement(f,null),x||t.value,b.utilities.useDefaultFromControls?null:o.createElement(u,null,o.createElement(h,null,o.createElement(m,{faIcon:l,color:"check",size:"1.25em"})))),!!k&&o.createElement(d,{marginTop:"xxs",id:t.id?"".concat(t.id,"-error"):void 0},k))}));export{p as Checkbox,p as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type LegacyRef,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\nimport { faCheck } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { IconFa } from \"../IconFa\";\n\nimport {\n StyledLabel,\n StyledInput,\n CheckWrapper,\n Check,\n SelectedBorder,\n} from \"./styles\";\n\nexport type CheckBoxProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement> | LegacyRef<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * Checkboxes allow the user to select one or more items.\n *\n * The value or children becomes the label, if you want an outer label for a checkbox or group of checkboxes please use a LegendWrapper component\n */\nexport const Checkbox = forwardRef(\n (props: CheckBoxProps, ref?: Ref<HTMLInputElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const { children, hasError, errorMessage, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={hasError || !!errorMessage || false}\n checked={props.checked || props.defaultChecked || false}\n disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : undefined\n }\n />\n <SelectedBorder />\n {children || props.value}\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check>\n <IconFa faIcon={faCheck} color=\"check\" size=\"1.25em\" />\n </Check>\n </CheckWrapper>\n )}\n </StyledLabel>\n {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nexport default Checkbox;\n"],"names":["Checkbox","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","children","hasError","errorMessage","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","checked","defaultChecked","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","value","utilities","useDefaultFromControls","CheckWrapper","Check","IconFa","faIcon","faCheck","color","size","ErrorText","marginTop"],"mappings":"ghBAoCaA,EAAWC,GACtB,SAACC,EAAsBC,GACrB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGGK,EAA8CP,EAAKO,SAAzCC,EAAoCR,EAA5BQ,SAAEC,EAA0BT,eAATU,IAASV,EAAhD,CAA6C,WAAA,WAAA,iBAEnD,OACEW,EAACC,cAAAC,EAAc,CAAAT,MAAOA,GACpBO,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type LegacyRef,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\nimport { faCheck } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { IconFa } from \"../IconFa\";\n\nimport {\n StyledLabel,\n StyledInput,\n CheckWrapper,\n Check,\n SelectedBorder,\n} from \"./styles\";\n\nexport type CheckBoxProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement> | LegacyRef<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * Checkboxes allow the user to select one or more items.\n *\n * The value or children becomes the label, if you want an outer label for a checkbox or group of checkboxes please use a LegendWrapper component\n */\nexport const Checkbox = forwardRef(\n (props: CheckBoxProps, ref?: Ref<HTMLInputElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const { children, hasError, errorMessage, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={hasError || !!errorMessage || false}\n $checked={props.checked || props.defaultChecked || false}\n $disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : undefined\n }\n />\n <SelectedBorder />\n {children || props.value}\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check>\n <IconFa faIcon={faCheck} color=\"check\" size=\"1.25em\" />\n </Check>\n </CheckWrapper>\n )}\n </StyledLabel>\n {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nexport default Checkbox;\n"],"names":["Checkbox","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","children","hasError","errorMessage","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","$checked","checked","defaultChecked","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","value","utilities","useDefaultFromControls","CheckWrapper","Check","IconFa","faIcon","faCheck","color","size","ErrorText","marginTop"],"mappings":"ghBAoCaA,EAAWC,GACtB,SAACC,EAAsBC,GACrB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGGK,EAA8CP,EAAKO,SAAzCC,EAAoCR,EAA5BQ,SAAEC,EAA0BT,eAATU,IAASV,EAAhD,CAA6C,WAAA,WAAA,iBAEnD,OACEW,EAACC,cAAAC,EAAc,CAAAT,MAAOA,GACpBO,EAACC,cAAAE,EACY,CAAAC,UAAAP,KAAcC,IAAgB,EAAKO,SACpChB,EAAMiB,SAAWjB,EAAMkB,iBAAkB,YACxClB,EAAMmB,WAAY,GAE7BR,EAAAC,cAACQ,EACKf,EAAA,CAAA,EAAAK,GACJS,SAAUnB,EAAMmB,WAAY,EAC5BE,KAAK,WACLpB,IAAKA,EAAG,mBAEJD,EAAMsB,IAAQb,EAAe,GAAGc,OAAAvB,EAAMsB,GAAE,eAAWE,KAGzDb,EAAAC,cAACa,EAAiB,MACjBlB,GAAYP,EAAM0B,MAClBtB,EAAMuB,UAAUC,uBAAyB,KACxCjB,gBAACkB,EAAY,KACXlB,EAAAC,cAACkB,EAAK,KACJnB,EAAAC,cAACmB,EAAO,CAAAC,OAAQC,EAASC,MAAM,QAAQC,KAAK,gBAKjD1B,GACDE,gBAACyB,EAAS,CACRC,UAAU,MACVf,GAAItB,EAAMsB,GAAK,GAAGC,OAAAvB,EAAMsB,kBAAaE,GAEpCf,GAKX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as t}from"styled-components";var i,e,r,s,a,l,c,d,p="1.5rem",h=o.div(i||(i=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(e||(e=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p),b=o.label(s||(s=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as t}from"styled-components";var i,e,r,s,a,l,c,d,p="1.5rem",h=o.div(i||(i=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(e||(e=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p),b=o.label(s||(s=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n.$disabled?"not-allowed":"pointer"}),(function(n){var o=n.theme;return n.$disabled?o.colors.disabled:o.colors.textDark}),(function(n){var o=n.theme;return"calc( (".concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m," calc( (").concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.xl)}),h,u,(function(n){var o=n.theme;return n.$disabled&&o.colors.disabled}),(function(o){var i=o.theme,e=o.$disabled,s=o.$checked,a=o.$hasError;return i.utilities.useDefaultFromControls?null:t(r||(r=n(["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "],["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "])),h,u,"2px",e?i.colors.disabled:a?i.colors.danger:s?i.colors.check:i.colors.inputBorder,h,u,"2px",e?i.colors.disabled:i.colours)})),f=o.div(a||(a=n(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),g=o.input(d||(d=n(["\n margin-right: 5px !important;\n\n ","\n"],["\n margin-right: 5px !important;\n\n ","\n"])),(function(o){var i=o.theme;return i.utilities.useDefaultFromControls?t(l||(l=n(["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "],["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "])),i.spacing.s):t(c||(c=n(["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "],["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "])),i.spacing.xxs,f,i.colors.inputBorder,h)}));export{u as Check,h as CheckWrapper,f as SelectedBorder,g as StyledInput,b as StyledLabel};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Checkbox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst CHECK_BOX_SIZE = \"1.5rem\";\nconst BUTTON_HEIGHT = \"3em\";\nconst BORDER_THICKNESS = \"2px\";\n\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Checkbox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst CHECK_BOX_SIZE = \"1.5rem\";\nconst BUTTON_HEIGHT = \"3em\";\nconst BORDER_THICKNESS = \"2px\";\n\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\n display: inline-block;\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n position: absolute;\n top: calc(50% - (${CHECK_BOX_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<{\n theme: ThemeType;\n}>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n`;\n\nexport const StyledLabel = styled.label<{\n $checked: boolean;\n $disabled: boolean;\n $hasError: boolean;\n theme: ThemeType;\n}>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n position: relative;\n\n cursor: ${({ $disabled }) => ($disabled ? \"not-allowed\" : \"pointer\")};\n display: block;\n\n color: ${({ theme, $disabled }) =>\n $disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n &:focus ~ ${CheckWrapper} ${Check} {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ${({ theme, $disabled }) => $disabled && theme.colors.disabled};\n }\n }\n\n ${({ theme, $disabled, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n }\n\n &:hover ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled ? theme.colors.disabled : theme.colours};\n }\n `}\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\n\n// TODO when we get rid of bootstrap remove !important.\nexport const StyledInput = styled.input<{\n theme: ThemeType;\n}>`\n margin-right: 5px !important;\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n /* This hides the original input */\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ ${CheckWrapper} svg path {\n transform: rotateY(0deg);\n }\n `}\n`;\n"],"names":["CHECK_BOX_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","templateObject_2","colors","selectionBorder","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","$disabled","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","$checked","$hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","colours","SelectedBorder","templateObject_5","StyledInput","input","templateObject_8","templateObject_6","s","templateObject_7","xxs"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/DateField/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\nimport Text from \"../Text\";\n\
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/DateField/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\nimport Text from \"../Text\";\n\nexport const Fieldset = styled.fieldset`\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n`;\n\nexport const TextAsLabel = styled(Text)<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<{ theme: ThemeType }>`\n display: inline-block;\n width: 60px;\n margin-right: ${({ theme }) => theme.spacing.xs};\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const LargeDateTextFieldWrapper = styled(DateTextFieldWrapper)`\n width: 80px;\n`;\n\nexport const ErrorTextWrapper = styled.div`\n clear: left;\n`;\n"],"names":["Fieldset","styled","fieldset","templateObject_1","__makeTemplateObject","Text","templateObject_2","_a","theme","typography","fontFamilyLabel","DateTextFieldWrapper","div","templateObject_3","spacing","xs","fontWeightBase","LargeDateTextFieldWrapper","templateObject_4","ErrorTextWrapper","templateObject_5"],"mappings":"yJAIa,IAAAA,EAAWC,EAAOC,SAAQC,IAAAA,EAAAC,EAAA,CAAA,0LAAA,CAAA,6LAaZH,EAAOI,EAAPJ,CAAYK,IAAAA,EAAAF,EAAA,CAAA,oBAAA,OAAA,CAAsB,oBACG,UAA/C,SAACG,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,IAGzB,cAAMC,EAAuBV,EAAOW,IAAyBC,IAAAA,EAAAT,EAAA,CAAA,+DAAA,kGAAA,YAAA,CAAA,+DAGnB,kGAGgB,eAH/C,SAACG,GAAc,OAAPA,EAAAC,MAAaM,QAAQC,EAAd,IAGd,SAACR,GAAc,OAAPA,EAAAC,MAAaC,WAAWO,cAAjB,IAIrBC,EAA4BhB,EAAOU,EAAPV,CAA4BiB,IAAAA,EAAAd,EAAA,CAAA,sBAAA,CAAA,yBAIxDe,EAAmBlB,EAAOW,IAAGQ,IAAAA,EAAAhB,EAAA,CAAA,sBAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.js","sources":["../../../src/components/Divider.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport styled from \"styled-components\";\n\nconst StyledDivider = styled.div`\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n &:before,\n &:after {\n background-color: #333;\n content: \"\";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n`;\n\
|
|
1
|
+
{"version":3,"file":"Divider.js","sources":["../../../src/components/Divider.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport styled from \"styled-components\";\n\nconst StyledDivider = styled.div`\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n &:before,\n &:after {\n background-color: #333;\n content: \"\";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n`;\n\nexport const Divider = ({ children }: { children?: ReactNode }) => (\n <StyledDivider>{children}</StyledDivider>\n);\n\nexport default Divider;\n"],"names":["StyledDivider","styled","div","templateObject_1","__makeTemplateObject","Divider","_a","children","React","createElement"],"mappings":"mIAGA,MAAMA,EAAgBC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,0SAAA,CAAA,6SAkBnBC,EAAU,SAACC,GAAE,IAAAC,EAAQD,EAAAC,SAAiC,OACjEC,EAACC,cAAAT,EAAe,KAAAO,EADiD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{useTheme as t}from"styled-components";import{crukTheme as r}from"../../themes/cruk.js";import{StyledIcon as m}from"./styles.js";import{themeSizeOrString as s,themeColorOrString as i}from"../../utils/themeUtils.js";function c(c){var n=c.faIcon,l=c.color,a=c.size,p=void 0===a?"1.1rem":a,f=t(),d=e(e({},r),f),u=n.icon,h=u[0],j=u[1],v=u[4];return o.createElement(m,{theme:d,role:"presentation",viewBox:"0 0 ".concat(h," ").concat(j),$size:s(p,d),$color:i(l,d)},v&&o.createElement("path",{d:v}))}export{c as IconFa,c as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/IconFa/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { type IconDefinition } from \"@fortawesome/fontawesome-common-types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledIcon } from \"./styles\";\nimport { themeColorOrString, themeSizeOrString } from \"../../utils/themeUtils\";\n\nexport type IconFaProps = {\n /** imported icon definition from \"@fortawesome/free-solid-svg-icons\" or \"@fortawesome/free-brands-svg-icons\" */\n faIcon: IconDefinition;\n /** color of icon, inherits current text colour by default */\n color?: string;\n /** size of ion 1.1em by default */\n size?: string;\n};\n\n/**\n * The IconFa component (Icon Font Awesome) displays an icon glyph as an `<svg>` element.\n *\n * This is an svg icon wrapper where a font awesome icon definition can be passed in a long with colour and size\n * */\nexport function IconFa({ faIcon, color, size = \"1.1rem\" }: IconFaProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const [width, height, , , svgPathData] = faIcon.icon;\n\n return (\n <StyledIcon\n theme={theme}\n role=\"presentation\"\n viewBox={`0 0 ${width} ${height}`}\n $size={themeSizeOrString(size, theme)}\n $color={themeColorOrString(color, theme)}\n >\n {svgPathData && <path d={svgPathData as string} />}\n </StyledIcon>\n );\n}\n\nexport default IconFa;\n"],"names":["IconFa","_a","faIcon","color","_b","size","foundTheme","useTheme","theme","__assign","defaultTheme","_c","icon","width","height","svgPathData","React","createElement","StyledIcon","role","viewBox","concat","$size","themeSizeOrString","$color","themeColorOrString","d"],"mappings":"sTAsBM,SAAUA,EAAOC,OAAEC,EAAMD,EAAAC,OAAEC,EAAKF,EAAAE,MAAEC,SAAAC,OAAO,IAAAD,EAAA,SAAQA,EAC/CE,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAECK,EAAmCT,EAAOU,KAAzCC,EAAKF,EAAA,GAAEG,EAAMH,EAAA,GAAMI,OAE1B,OACEC,EAACC,cAAAC,GACCV,MAAOA,EACPW,KAAK,eACLC,QAAS,OAAAC,OAAOR,EAAS,KAAAQ,OAAAP,GAClBQ,MAAAC,EAAkBlB,EAAMG,GAAMgB,OAC7BC,EAAmBtB,EAAOK,IAEjCO,GAAeC,wBAAMU,EAAGX,IAG/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";var t,e=i.svg(t||(t=n(["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"],["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"])),(function(n){return n
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";var t,e=i.svg(t||(t=n(["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"],["\n display: inline-block;\n height: ",";\n margin-top: -0.2em;\n vertical-align: middle;\n width: ",";\n path {\n fill: ",";\n }\n"])),(function(n){return n.$size}),(function(n){return n.$size}),(function(n){return n.$color}));export{e as StyledIcon,e as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/IconFa/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nexport const StyledIcon = styled.svg<{\n theme: ThemeType;\n $color?: string;\n $size: string;\n}>`\n display: inline-block;\n height: ${({ $size }) => $size};\n margin-top: -0.2em;\n vertical-align: middle;\n width: ${({ $size }) => $size};\n path {\n fill: ${({ $color }) => $color};\n }\n`;\n\nexport default StyledIcon;\n"],"names":["StyledIcon","styled","svg","templateObject_1","__makeTemplateObject","_a","$size","$color"],"mappings":"iHAGa,MAAAA,EAAaC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,iEAAA,0BAAA,YAAA,CAIlC,yCAE8B,iEAGD,0BAEG,eALtB,SAACC,GAAc,OAAPA,EAAAC,KAAO,IAGhB,SAACD,GAAc,OAAPA,EAAAC,KAAO,IAEd,SAACD,GAAe,OAAPA,EAAAE,MAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as a,ThemeProvider as c}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{PagerWrapper as l,PagerList as r,PagerItem as o,PagerLink as i}from"./styles.js";function s(s){var m=s.current,d=s.items,u=s.hideLast,p=s.pagerCallback,f=s.perPage,E=s.searchParam,v=void 0===E?"page":E,b=s.children,h=s.id,k=a(),y=e(e({},n),k),x=f>0?f:1,g=Math.ceil(d/x)||1,P=function(e){return{href:"".concat("undefined"!=typeof window?window.location.pathname:"","?").concat(v?"".concat(v,"=").concat(e):""),onClick:function(t){t.preventDefault(),p(e)}}};return t.createElement(c,{theme:y},d>f&&t.createElement(l,null,t.createElement(r,null,t.createElement(o,{key:"Prev"},t.createElement(i,e({"data-cta":h?"".concat(h,"-prev"):null,name:"Prev",
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as a,ThemeProvider as c}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{PagerWrapper as l,PagerList as r,PagerItem as o,PagerLink as i}from"./styles.js";function s(s){var m=s.current,d=s.items,u=s.hideLast,p=s.pagerCallback,f=s.perPage,E=s.searchParam,v=void 0===E?"page":E,b=s.children,h=s.id,k=a(),y=e(e({},n),k),x=f>0?f:1,g=Math.ceil(d/x)||1,P=function(e){return{href:"".concat("undefined"!=typeof window?window.location.pathname:"","?").concat(v?"".concat(v,"=").concat(e):""),onClick:function(t){t.preventDefault(),p(e)}}};return t.createElement(c,{theme:y},d>f&&t.createElement(l,null,t.createElement(r,null,t.createElement(o,{key:"Prev"},t.createElement(i,e({"data-cta":h?"".concat(h,"-prev"):null,name:"Prev","aria-disabled":1===m},1===m&&{tabIndex:-1},1!==m&&P(m-1),{$disabled:1===m}),"Prev")),function(a,c){for(var n=[],l=[],r=1;r<=c;r+=1)n.push(t.createElement(o,{key:r},t.createElement(i,e({"data-cta":h?"".concat(h,"-").concat(r):null,$active:r===a},P(r),{"aria-label":"page ".concat(r," of ").concat(c)}),r)));var s=n.slice(0,1).concat(t.createElement(o,{key:"first"},t.createElement("span",null,"..."))),m=n.slice(n.length-1).concat(t.createElement(o,{key:"last"},t.createElement("span",null,"..."))).reverse();return l=n.slice(0,c),c>7&&(l=a<=4?u?n.slice(0,7):n.slice(0,5).concat(m):a>c-4?s.concat(n.slice(-5)):u?s.concat(n.slice(a-3,a+2)):s.concat(n.slice(a-2,a+1)).concat(m)),l}(m,g),t.createElement(o,{key:"Next"},t.createElement(i,e({"data-cta":h?"".concat(h,"-next"):null,name:"Next","aria-disabled":m===g},m===g&&{tabIndex:-1},m!==g&&P(m+1),{$disabled:m===g}),"Next"))),b))}export{s as Pagination,s 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\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\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 foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\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 <ThemeProvider theme={theme}>\n {items > perPage && (\n <PagerWrapper>\n <PagerList>\n <PagerItem key=\"Prev\">\n <PagerLink\n data-cta={id ? `${id}-prev` : null}\n name=\"Prev\"\n
|
|
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\";\nimport { ThemeProvider, useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\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 foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\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 <ThemeProvider theme={theme}>\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 </ThemeProvider>\n );\n}\n\nexport default Pagination;\n"],"names":["Pagination","_a","current","items","hideLast","pagerCallback","perPage","_b","searchParam","children","id","foundTheme","useTheme","theme","__assign","defaultTheme","perPageValue","totalPages","Math","ceil","linkProps","number","href","concat","window","location","pathname","onClick","e","preventDefault","React","createElement","ThemeProvider","PagerWrapper","PagerList","PagerItem","key","PagerLink","name","tabIndex","active","total","list","pager","push","$active","first","slice","last","length","reverse","renderPager","$disabled"],"mappings":"kSAkCM,SAAUA,EAAWC,OACzBC,EAAOD,EAAAC,QACPC,EAAKF,EAAAE,MACLC,EAAQH,EAAAG,SACRC,EAAaJ,EAAAI,cACbC,YACAC,EAAAN,EAAAO,YAAAA,OAAc,IAAAD,EAAA,OAAMA,EACpBE,EAAQR,EAAAQ,SACRC,EAAET,EAAAS,GAEIC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAECK,EAAeV,EAAU,EAAIA,EAAU,EACvCW,EAAaC,KAAKC,KAAKhB,EAAQa,IAAiB,EAEhDI,EAAY,SAACC,GAAmB,MAAC,CACrCC,KAAM,GAAAC,OAAqB,oBAAXC,OAAyBA,OAAOC,SAASC,SAAW,GAClE,KAAAH,OAAAf,EAAc,GAAGe,OAAAf,EAAe,KAAAe,OAAAF,GAAW,IAE7CM,QAAS,SAACC,GACRA,EAAEC,iBACFxB,EAAcgB,EACf,IAkDH,OACES,EAAAC,cAACC,EAAa,CAACnB,MAAOA,GACnBV,EAAQG,GACPwB,gBAACG,EAAY,KACXH,EAAAC,cAACG,EAAS,KACRJ,EAAAC,cAACI,EAAS,CAACC,IAAI,QACbN,EAACC,cAAAM,EACWvB,EAAA,CAAA,WAAAJ,EAAK,GAAGa,OAAAb,EAAS,SAAG,KAC9B4B,KAAK,OACU,gBAAY,IAAZpC,GACE,IAAZA,GAAiB,CAAEqC,UAAW,GAClB,IAAZrC,GAAiBkB,EAAUlB,EAAU,cACnB,IAAZA,IAAa,SA3DlB,SAACsC,EAAgBC,GAInC,IAHA,IAAMC,EAAO,GACTC,EAAQ,GAEHtB,EAAS,EAAGA,GAAUoB,EAAOpB,GAAU,EAC9CqB,EAAKE,KACHd,EAAAC,cAACI,EAAU,CAAAC,IAAKf,GACdS,EAAAC,cAACM,EAASvB,EAAA,CAAA,WACEJ,EAAK,GAAAa,OAAGb,EAAE,KAAAa,OAAIF,GAAW,KAC1BwB,QAAAxB,IAAWmB,GAChBpB,EAAUC,iBACF,QAAQE,OAAAF,EAAa,QAAAE,OAAAkB,KAEhCpB,KAKT,IAAMyB,EAAQJ,EAAKK,MAAM,EAAG,GAAGxB,OAC7BO,EAAAC,cAACI,EAAU,CAAAC,IAAI,SACbN,EAAgBC,cAAA,OAAA,KAAA,SAGdiB,EAAON,EACVK,MAAML,EAAKO,OAAS,GACpB1B,OACCO,EAACC,cAAAI,EAAU,CAAAC,IAAI,QACbN,EAAAC,cAAA,OAAA,KAAA,SAGHmB,UAcH,OAbAP,EAAQD,EAAKK,MAAM,EAAGN,GAClBA,EAAQ,IAERE,EADEH,GAAU,EACJpC,EAAWsC,EAAKK,MAAM,EAAG,GAAKL,EAAKK,MAAM,EAAG,GAAGxB,OAAOyB,GAG5DR,EAASC,EAAQ,EACbK,EAAMvB,OAAOmB,EAAKK,OAAO,IACzB3C,EACE0C,EAAMvB,OAAOmB,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAC7CM,EAAMvB,OAAOmB,EAAKK,MAAMP,EAAS,EAAGA,EAAS,IAAIjB,OAAOyB,IAG7DL,CACT,CAmBWQ,CAAYjD,EAASe,GACtBa,EAAAC,cAACI,EAAS,CAACC,IAAI,QACbN,EAACC,cAAAM,EACWvB,EAAA,CAAA,WAAAJ,EAAK,GAAGa,OAAAb,EAAS,SAAG,KAC9B4B,KAAK,OACU,gBAAApC,IAAYe,GACtBf,IAAYe,GAAc,CAAEsB,UAAW,GACvCrC,IAAYe,GAAcG,EAAUlB,EAAU,GACxC,CAAAkD,UAAAlD,IAAYe,IAGb,UAGfR,GAKX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as e}from"styled-components";var t,r,i,a,d,c,l,s=o.div(t||(t=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"]))),u=o.ul(r||(r=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"]))),p=o.a(c||(c=n(["\n font-weight: normal;\n font-family: ",";\n font-size: ",";\n color: ",";\n background-color: ",";\n cursor: pointer;\n border-radius: 0;\n margin: ",";\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: ",";\n font-size: ",";\n color: ",";\n background-color: ",";\n cursor: pointer;\n border-radius: 0;\n margin: ",";\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(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.fontSizes.s}),(function(n){return n.theme.colors.textLight}),(function(n){return n.theme.colors.paginationBackground}),(function(n){return n.theme.spacing.xxs}),(function(o){var t=o.$active,r=o.theme;return t&&e(i||(i=n(["\n color: ",";\n background-color: ",";\n cursor: default;\n &:hover {\n background-color: ",";\n text-decoration: none;\n }\n "],["\n color: ",";\n background-color: ",";\n cursor: default;\n &:hover {\n background-color: ",";\n text-decoration: none;\n }\n "])),r.colors.textDark,r.colors.paginationActive,r.colors.paginationActive)}),(function(o){var t=o.name,r=o.theme,i=o
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as e}from"styled-components";var t,r,i,a,d,c,l,s=o.div(t||(t=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"]))),u=o.ul(r||(r=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"]))),p=o.a(c||(c=n(["\n font-weight: normal;\n font-family: ",";\n font-size: ",";\n color: ",";\n background-color: ",";\n cursor: pointer;\n border-radius: 0;\n margin: ",";\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: ",";\n font-size: ",";\n color: ",";\n background-color: ",";\n cursor: pointer;\n border-radius: 0;\n margin: ",";\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(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.fontSizes.s}),(function(n){return n.theme.colors.textLight}),(function(n){return n.theme.colors.paginationBackground}),(function(n){return n.theme.spacing.xxs}),(function(o){var t=o.$active,r=o.theme;return t&&e(i||(i=n(["\n color: ",";\n background-color: ",";\n cursor: default;\n &:hover {\n background-color: ",";\n text-decoration: none;\n }\n "],["\n color: ",";\n background-color: ",";\n cursor: default;\n &:hover {\n background-color: ",";\n text-decoration: none;\n }\n "])),r.colors.textDark,r.colors.paginationActive,r.colors.paginationActive)}),(function(o){var t=o.name,r=o.theme,i=o.$disabled;return("Prev"===t||"Next"===t)&&e(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?r.colors.disabled:r.colors.paginationText)}),(function(o){var t=o.theme;return o.$disabled&&e(d||(d=n(["\n color: $ ",";\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: ",";\n text-decoration: none;\n }\n "],["\n color: $ ",";\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: ",";\n text-decoration: none;\n }\n "])),t.colors.disabled,t.colors.disabled)})),b=o.li(l||(l=n(["\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: ",") {\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: ",";\n }\n"],["\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: ",") {\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: ",";\n }\n"])),(function(n){return n.theme.breakpoint.mobile}),(function(n){return n.theme.breakpoint.mobile}));export{b as PagerItem,p as PagerLink,u 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\";\nimport { type ThemeType } from \"../../types\";\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
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Pagination/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\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 theme: ThemeType;\n $active?: boolean;\n $disabled?: boolean;\n}>`\n font-weight: normal;\n font-family: ${({\n theme: {\n typography: { fontFamilyBase },\n },\n }) => fontFamilyBase};\n font-size: ${({\n theme: {\n fontSizes: { s },\n },\n }) => s};\n color: ${({ theme }) => theme.colors.textLight};\n background-color: ${({ theme }) => theme.colors.paginationBackground};\n cursor: pointer;\n border-radius: 0;\n margin: ${({ theme }) => theme.spacing.xxs};\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, theme }) =>\n $active &&\n css`\n color: ${theme.colors.textDark};\n background-color: ${theme.colors.paginationActive};\n cursor: default;\n &:hover {\n background-color: ${theme.colors.paginationActive};\n text-decoration: none;\n }\n `}\n\n ${({ name, theme, $disabled }) =>\n (name === \"Prev\" || name === \"Next\") &&\n css`\n color: ${$disabled ? theme.colors.disabled : theme.colors.paginationText};\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 ${({ theme, $disabled }) =>\n $disabled &&\n css`\n color: $ ${theme.colors.disabled};\n cursor: not-allowed;\n pointer-events:none\n text-decoration: none;\n &:hover,\n &:focus,\n &:active,\n &:visited {\n color: ${theme.colors.disabled};\n text-decoration: none;\n }\n `}\n`;\n\nexport const PagerItem = styled.li<{ theme: ThemeType }>`\n display: none;\n &:first-child,\n &:last-child {\n display: inline;\n }\n @media (min-width: ${(props) => props.theme.breakpoint.mobile}) {\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: ${(props) => props.theme.breakpoint.mobile};\n }\n`;\n"],"names":["PagerWrapper","styled","div","templateObject_1","__makeTemplateObject","PagerList","ul","templateObject_2","PagerLink","a","templateObject_6","_a","theme","typography","fontFamilyBase","fontSizes","s","colors","textLight","paginationBackground","spacing","xxs","$active","css","templateObject_3","textDark","paginationActive","name","$disabled","templateObject_4","disabled","paginationText","templateObject_5","PagerItem","li","templateObject_7","props","breakpoint","mobile"],"mappings":"2HAGa,kBAAAA,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,gFAAA,CAAA,mFAOzBC,EAAYJ,EAAOK,GAAEC,IAAAA,EAAAH,EAAA,CAAA,uEAAA,CAAA,0EAMrBI,EAAYP,EAAOQ,EAK9BC,IAAAA,EAAAN,EAAA,CAAA,4CAAA,mBAAA,eAAA,0BAAA,yDAAA,0PAAA,SAAA,SAAA,MAAA,CAAA,4CAMoB,mBAKb,eACuC,0BACsB,yDAG1B,0PA2BvC,SAmBA,SAgBA,SA5EY,SAACO,GAIV,OAF0BA,EAAAC,MAAAC,WAAAC,cAE1B,IACO,SAACH,GAIR,OAFYA,EAAAC,MAAAG,UAAAC,CAEZ,IACG,SAACL,GAAc,OAAPA,EAAAC,MAAaK,OAAOC,SAAb,IACJ,SAACP,GAAc,OAAPA,EAAAC,MAAaK,OAAOE,oBAAb,IAGzB,SAACR,GAAc,OAAPA,EAAAC,MAAaQ,QAAQC,GAAd,IAiBvB,SAACV,OAAEW,EAAOX,EAAAW,QAAEV,EAAKD,EAAAC,MACjB,OAAAU,GACAC,EAAGC,IAAAA,EAAApB,EAAA,CAAA,kBAAA,8BAAA,yEAAA,oDAAA,CAAA,kBAC6B,8BACmB,yEAGE,sDAJ1CQ,EAAMK,OAAOQ,SACFb,EAAMK,OAAOS,iBAGXd,EAAMK,OAAOS,iBANrC,IAWA,SAACf,GAAE,IAAAgB,SAAMf,EAAKD,EAAAC,MAAEgB,EAASjB,EAAAiB,UACzB,OAAU,SAATD,GAA4B,SAATA,IACpBJ,EAAGM,IAAAA,EAAAzB,EAAA,CAAA,kBAAA,8UAAA,CAAA,kBACuE,gVAA/DwB,EAAYhB,EAAMK,OAAOa,SAAWlB,EAAMK,OAAOc,eAF5D,IAkBA,SAACpB,OAAEC,EAAKD,EAAAC,MACR,OADmBD,EAAAiB,WAEnBL,EAAGS,IAAAA,EAAA5B,EAAA,CAAA,oBAAA,8KAAA,oDAAA,CAAA,oBAC+B,8KAQA,sDARrBQ,EAAMK,OAAOa,SAQblB,EAAMK,OAAOa,SAV1B,IAgBSG,EAAYhC,EAAOiC,GAAwBC,IAAAA,EAAA/B,EAAA,CAAA,2GAAA,oKAAA,YAAA,CAAA,2GAMO,oKASH,eATrC,SAACgC,GAAU,OAAAA,EAAMxB,MAAMyB,WAAWC,MAAM,IAS3C,SAACF,GAAU,OAAAA,EAAMxB,MAAMyB,WAAWC,MAAvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/ProgressBar/styles.ts"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst BAR_HEIGHT = \"16px\";\n\ntype CircleKeyCircleFillKeyFramesProps = {\n $strokeDashoffsetInit: number;\n strokeDashoffset: number;\n};\n\nconst CircleFillKeyFrames = ({\n $strokeDashoffsetInit,\n strokeDashoffset,\n}: CircleKeyCircleFillKeyFramesProps) => keyframes`\n 0% {\n stroke-dashoffset: ${$strokeDashoffsetInit} ;\n }\n 50% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n 100% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n`;\n\nconst SecondaryCircleFillKeyFrames = ({\n $strokeDashoffsetInit,\n strokeDashoffset,\n}: CircleKeyCircleFillKeyFramesProps) => keyframes`\n 0% {\n stroke-dashoffset: ${$strokeDashoffsetInit} ;\n }\n 100% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n`;\n\nconst TargetBarPulseKeyFrames = () => keyframes`\n 0% {\n width: 0px;\n height: 0px;\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n width: 64px;\n height: 64px;\n right: -32px;\n }\n`;\n\nconst LineBarPulseKeyFrames = () => keyframes`\n 0% {\n transform: scale(1);\n border-radius: 0px;\n\n }\n 50% {\n transform:scale(1.025);\n }\n 100% {\n transform: scale(1);\n border-radius: 0px;\n }\n`;\n\nexport const ProgressBarWrapper = styled.div`\n margin-top: ${BAR_HEIGHT};\n`;\n\nexport const LineProgressBarWrapper = styled.div<{\n $percentage: number;\n $secondaryPercentage: number;\n theme: ThemeType;\n}>`\n position: relative;\n height: ${BAR_HEIGHT};\n margin-bottom: 0;\n background-color: ${({\n theme: {\n colors: { progressBarBackground },\n },\n }) => progressBarBackground};\n box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n\n ${({ $percentage, $secondaryPercentage }) =>\n ($percentage === 100 || $secondaryPercentage === 100) &&\n css`\n animation: ${LineBarPulseKeyFrames} 0.3s 0.5s 1 ease-out;\n `}\n`;\n\nexport const LineProgressBar = styled.div<{\n $percentage: number;\n $barColor?: string;\n $isSecondary?: boolean;\n theme: ThemeType;\n}>`\n position: absolute;\n left: 0;\n height: ${BAR_HEIGHT};\n background-color: ${({ $barColor, $isSecondary, theme }) =>\n !!$barColor || !!$isSecondary\n ? theme.colors.progressBarSecondary\n : theme.colors.progressBar};\n box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n transition: width 0.6s ease;\n width: ${({ $percentage }) => $percentage}%;\n\n &::before {\n content: \"\";\n display: inline-block;\n position: absolute;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: 0px;\n height: 0px;\n border-radius: 50%;\n opacity: 0;\n filter: blur(2px);\n background-color: ${({\n $barColor,\n $isSecondary,\n theme: {\n colors: { progressBar, progressBarSecondary },\n },\n }) => ($barColor || $isSecondary ? progressBarSecondary : progressBar)};\n\n ${({ $percentage }) =>\n $percentage === 100 &&\n css`\n animation: ${TargetBarPulseKeyFrames} 0.33s 0.75s 3 ease-in;\n `}\n }\n`;\n\nexport const ScreenReaderOnly = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n`;\n\nexport const CircularWrapper = styled.div<{\n $circleSize: string;\n theme: ThemeType;\n}>`\n position: relative;\n width: ${({ $circleSize }) => $circleSize};\n height: ${({ $circleSize }) => $circleSize};\n background: none;\n margin: 0 auto;\n box-shadow: none;\n`;\n\nexport const CircleSvg = styled.svg`\n position: absolute;\n transform: rotate(-90deg);\n fill: none;\n stroke-linecap: round;\n width: 100%;\n height: 100%;\n`;\n\nexport const EmptyCircle = styled.circle<{\n theme: ThemeType;\n}>`\n stroke: ${({ theme }) => theme.tokenColors.grey_200};\n`;\n\nexport const FullCircle = styled.circle<{\n
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/ProgressBar/styles.ts"],"sourcesContent":["import styled, { css, keyframes } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst BAR_HEIGHT = \"16px\";\n\ntype CircleKeyCircleFillKeyFramesProps = {\n $strokeDashoffsetInit: number;\n strokeDashoffset: number;\n};\n\nconst CircleFillKeyFrames = ({\n $strokeDashoffsetInit,\n strokeDashoffset,\n}: CircleKeyCircleFillKeyFramesProps) => keyframes`\n 0% {\n stroke-dashoffset: ${$strokeDashoffsetInit} ;\n }\n 50% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n 100% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n`;\n\nconst SecondaryCircleFillKeyFrames = ({\n $strokeDashoffsetInit,\n strokeDashoffset,\n}: CircleKeyCircleFillKeyFramesProps) => keyframes`\n 0% {\n stroke-dashoffset: ${$strokeDashoffsetInit} ;\n }\n 100% {\n stroke-dashoffset: ${strokeDashoffset} ;\n }\n`;\n\nconst TargetBarPulseKeyFrames = () => keyframes`\n 0% {\n width: 0px;\n height: 0px;\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n width: 64px;\n height: 64px;\n right: -32px;\n }\n`;\n\nconst LineBarPulseKeyFrames = () => keyframes`\n 0% {\n transform: scale(1);\n border-radius: 0px;\n\n }\n 50% {\n transform:scale(1.025);\n }\n 100% {\n transform: scale(1);\n border-radius: 0px;\n }\n`;\n\nexport const ProgressBarWrapper = styled.div`\n margin-top: ${BAR_HEIGHT};\n`;\n\nexport const LineProgressBarWrapper = styled.div<{\n $percentage: number;\n $secondaryPercentage: number;\n theme: ThemeType;\n}>`\n position: relative;\n height: ${BAR_HEIGHT};\n margin-bottom: 0;\n background-color: ${({\n theme: {\n colors: { progressBarBackground },\n },\n }) => progressBarBackground};\n box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n\n ${({ $percentage, $secondaryPercentage }) =>\n ($percentage === 100 || $secondaryPercentage === 100) &&\n css`\n animation: ${LineBarPulseKeyFrames} 0.3s 0.5s 1 ease-out;\n `}\n`;\n\nexport const LineProgressBar = styled.div<{\n $percentage: number;\n $barColor?: string;\n $isSecondary?: boolean;\n theme: ThemeType;\n}>`\n position: absolute;\n left: 0;\n height: ${BAR_HEIGHT};\n background-color: ${({ $barColor, $isSecondary, theme }) =>\n !!$barColor || !!$isSecondary\n ? theme.colors.progressBarSecondary\n : theme.colors.progressBar};\n box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n transition: width 0.6s ease;\n width: ${({ $percentage }) => $percentage}%;\n\n &::before {\n content: \"\";\n display: inline-block;\n position: absolute;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: 0px;\n height: 0px;\n border-radius: 50%;\n opacity: 0;\n filter: blur(2px);\n background-color: ${({\n $barColor,\n $isSecondary,\n theme: {\n colors: { progressBar, progressBarSecondary },\n },\n }) => ($barColor || $isSecondary ? progressBarSecondary : progressBar)};\n\n ${({ $percentage }) =>\n $percentage === 100 &&\n css`\n animation: ${TargetBarPulseKeyFrames} 0.33s 0.75s 3 ease-in;\n `}\n }\n`;\n\nexport const ScreenReaderOnly = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n`;\n\nexport const CircularWrapper = styled.div<{\n $circleSize: string;\n theme: ThemeType;\n}>`\n position: relative;\n width: ${({ $circleSize }) => $circleSize};\n height: ${({ $circleSize }) => $circleSize};\n background: none;\n margin: 0 auto;\n box-shadow: none;\n`;\n\nexport const CircleSvg = styled.svg`\n position: absolute;\n transform: rotate(-90deg);\n fill: none;\n stroke-linecap: round;\n width: 100%;\n height: 100%;\n`;\n\nexport const EmptyCircle = styled.circle<{\n theme: ThemeType;\n}>`\n stroke: ${({ theme }) => theme.tokenColors.grey_200};\n`;\n\nexport const FullCircle = styled.circle<{\n strokeDashoffset: number;\n theme: ThemeType;\n $strokeDashoffsetInit: number;\n $barColor?: string;\n $isSecondary?: boolean;\n}>`\n stroke: ${({\n $isSecondary,\n $barColor,\n theme: {\n colors: { circularProgress, circularProgressSecondary },\n },\n }) =>\n $barColor || $isSecondary ? circularProgressSecondary : circularProgress};\n animation: ${({ $isSecondary, strokeDashoffset, $strokeDashoffsetInit }) =>\n $isSecondary\n ? SecondaryCircleFillKeyFrames({\n strokeDashoffset,\n $strokeDashoffsetInit,\n })\n : CircleFillKeyFrames({ strokeDashoffset, $strokeDashoffsetInit })}\n 1s linear;\n`;\n\nexport const CircularValue = styled.div<{\n theme: ThemeType;\n}>`\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n z-index: 2;\n font-size: ${({\n theme: {\n fontSizes: { l },\n },\n }) => l};\n line-height: ${({\n theme: {\n fontSizes: { l },\n },\n }) => l};\n text-align: center;\n height: 100%;\n color: ${({\n theme: {\n colors: { textDark },\n },\n }) => textDark};\n`;\n"],"names":["BAR_HEIGHT","TargetBarPulseKeyFrames","keyframes","templateObject_3","__makeTemplateObject","LineBarPulseKeyFrames","templateObject_4","ProgressBarWrapper","styled","div","templateObject_5","LineProgressBarWrapper","templateObject_7","_a","theme","colors","progressBarBackground","$percentage","$secondaryPercentage","css","templateObject_6","LineProgressBar","templateObject_9","$barColor","$isSecondary","progressBarSecondary","progressBar","_b","templateObject_8","ScreenReaderOnly","span","templateObject_10","CircularWrapper","templateObject_11","$circleSize","CircleSvg","svg","templateObject_12","EmptyCircle","circle","templateObject_13","tokenColors","grey_200","FullCircle","templateObject_14","circularProgress","circularProgressSecondary","strokeDashoffset","$strokeDashoffsetInit","templateObject_2","SecondaryCircleFillKeyFrames","templateObject_1","CircleFillKeyFrames","CircularValue","templateObject_15","fontSizes","l","textDark"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import s,{forwardRef as t}from"react";import{useTheme as a,ThemeProvider as o}from"styled-components";import{crukTheme as l}from"../../themes/cruk.js";import{ErrorText as i}from"../ErrorText/index.js";import{StyledLabel as d,StyledInput as m,SelectedBorder as n,CheckWrapper as c,Check as u,VerticalAlign as E}from"./styles.js";var h=t((function(t,h){var f=a(),p=e(e({},l),f);t.children,t.hasError,t.errorMessage;var b=r(t,["children","hasError","errorMessage"]);return s.createElement(o,{theme:p},s.createElement(d,{$hasError:t.hasError||!!t.errorMessage||!1,className:t.className
|
|
1
|
+
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import s,{forwardRef as t}from"react";import{useTheme as a,ThemeProvider as o}from"styled-components";import{crukTheme as l}from"../../themes/cruk.js";import{ErrorText as i}from"../ErrorText/index.js";import{StyledLabel as d,StyledInput as m,SelectedBorder as n,CheckWrapper as c,Check as u,VerticalAlign as E}from"./styles.js";var h=t((function(t,h){var f=a(),p=e(e({},l),f);t.children,t.hasError,t.errorMessage;var b=r(t,["children","hasError","errorMessage"]);return s.createElement(o,{theme:p},s.createElement(d,{$hasError:t.hasError||!!t.errorMessage||!1,className:t.className,$checked:t.checked||!1,$disabled:t.disabled||!1},s.createElement(m,e({},b,{disabled:t.disabled||!1,type:"radio",ref:h,"aria-describedby":t.id&&t.errorMessage?"".concat(t.id,"-error"):void 0})),s.createElement(n,null),p.utilities.useDefaultFromControls?null:s.createElement(c,null,s.createElement(u,null)),s.createElement(E,null,t.children||t.value)),!!t.errorMessage&&s.createElement(i,{marginTop:"xxs",id:t.id?"".concat(t.id,"-error"):void 0},t.errorMessage))}));export{h as Radio,h as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Radio/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type LegacyRef,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\n\nimport {\n StyledLabel,\n StyledInput,\n SelectedBorder,\n CheckWrapper,\n Check,\n VerticalAlign,\n} from \"./styles\";\n\nexport type RadioProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement> | LegacyRef<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * A single radio button which should be part of a field set of radio buttons\n *\n * The value or children becomes the label, if you want an outer label for a radio or group of radios please use a LegendWrapper component\n */\nexport const Radio = forwardRef(\n (props: RadioProps, ref?: Ref<HTMLInputElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { children, hasError, errorMessage, ...rest } = props;\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={props.hasError || !!props.errorMessage || false}\n className={props.className}\n checked={props.checked || false}\n disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"radio\"\n ref={ref}\n aria-describedby={\n !!props.id && !!props.errorMessage\n ? `${props.id}-error`\n : undefined\n }\n />\n <SelectedBorder />\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check />\n </CheckWrapper>\n )}\n <VerticalAlign>{props.children || props.value}</VerticalAlign>\n </StyledLabel>\n {!!props.errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {props.errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nexport default Radio;\n"],"names":["Radio","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","children","hasError","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","errorMessage","className","checked","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","utilities","useDefaultFromControls","CheckWrapper","Check","VerticalAlign","value","ErrorText","marginTop"],"mappings":"4ZAmCaA,EAAQC,GACnB,SAACC,EAAmBC,GAClB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGiDF,EAAKO,SAALP,EAA5BQ,SAA4BR,eAAT,IAAAS,IAAST,EAAhD,CAA6C,WAAA,WAAA,iBACnD,OACEU,EAACC,cAAAC,EAAc,CAAAR,MAAOA,GACpBM,EAAAC,cAACE,EAAW,CAAAC,UACCd,EAAMQ,YAAcR,EAAMe,eAAgB,EACrDC,UAAWhB,EAAMgB,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Radio/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type LegacyRef,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\n\nimport {\n StyledLabel,\n StyledInput,\n SelectedBorder,\n CheckWrapper,\n Check,\n VerticalAlign,\n} from \"./styles\";\n\nexport type RadioProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement> | LegacyRef<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * A single radio button which should be part of a field set of radio buttons\n *\n * The value or children becomes the label, if you want an outer label for a radio or group of radios please use a LegendWrapper component\n */\nexport const Radio = forwardRef(\n (props: RadioProps, ref?: Ref<HTMLInputElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { children, hasError, errorMessage, ...rest } = props;\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={props.hasError || !!props.errorMessage || false}\n className={props.className}\n $checked={props.checked || false}\n $disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"radio\"\n ref={ref}\n aria-describedby={\n !!props.id && !!props.errorMessage\n ? `${props.id}-error`\n : undefined\n }\n />\n <SelectedBorder />\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check />\n </CheckWrapper>\n )}\n <VerticalAlign>{props.children || props.value}</VerticalAlign>\n </StyledLabel>\n {!!props.errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {props.errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nexport default Radio;\n"],"names":["Radio","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","children","hasError","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","errorMessage","className","$checked","checked","$disabled","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","utilities","useDefaultFromControls","CheckWrapper","Check","VerticalAlign","value","ErrorText","marginTop"],"mappings":"4ZAmCaA,EAAQC,GACnB,SAACC,EAAmBC,GAClB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGiDF,EAAKO,SAALP,EAA5BQ,SAA4BR,eAAT,IAAAS,IAAST,EAAhD,CAA6C,WAAA,WAAA,iBACnD,OACEU,EAACC,cAAAC,EAAc,CAAAR,MAAOA,GACpBM,EAAAC,cAACE,EAAW,CAAAC,UACCd,EAAMQ,YAAcR,EAAMe,eAAgB,EACrDC,UAAWhB,EAAMgB,UACPC,SAAAjB,EAAMkB,UAAW,EAChBC,UAAAnB,EAAMoB,WAAY,GAE7BV,EAAAC,cAACU,EAAWhB,EAAA,CAAA,EACNI,EAAI,CACRW,SAAUpB,EAAMoB,WAAY,EAC5BE,KAAK,QACLrB,IAAKA,EAEH,mBAAED,EAAMuB,IAAQvB,EAAMe,aAClB,GAAAS,OAAGxB,EAAMuB,GAAU,eACnBE,KAGRf,EAAAC,cAACe,EAAiB,MACjBtB,EAAMuB,UAAUC,uBAAyB,KACxClB,gBAACmB,EAAY,KACXnB,EAACC,cAAAmB,EAAQ,OAGbpB,EAACC,cAAAoB,EAAe,KAAA/B,EAAMO,UAAYP,EAAMgC,UAEvChC,EAAMe,cACPL,EAACC,cAAAsB,EACC,CAAAC,UAAU,MACVX,GAAIvB,EAAMuB,GAAK,UAAGvB,EAAMuB,GAAE,eAAWE,GAEpCzB,EAAMe,cAKjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as i}from"styled-components";var e,t,r,l,a,s,c,d,b,p="1.5rem",h="0.75rem",g=o.div(e||(e=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(t||(t=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n pointer-events: none;\n border-radius: 100%;\n height: ",";\n width: ",';\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: "";\n border-radius: 100%;\n pointer-events: none;\n height: ',";\n width: ",";\n top: calc(50% - ("," / 2));\n left: calc(50% - ("," / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n pointer-events: none;\n border-radius: 100%;\n height: ",";\n width: ",';\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: "";\n border-radius: 100%;\n pointer-events: none;\n height: ',";\n width: ",";\n top: calc(50% - ("," / 2));\n left: calc(50% - ("," / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p,h,h,h,h),f=o.label(l||(l=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n width: 100%;\n position: relative;\n\n cursor: ",";\n display: inline-block;\n\n color: ",";\n padding: ",";\n vertical-align: middle;\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n width: 100%;\n position: relative;\n\n cursor: ",";\n display: inline-block;\n\n color: ",";\n padding: ",";\n vertical-align: middle;\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as i}from"styled-components";var e,t,r,l,a,s,c,d,b,p="1.5rem",h="0.75rem",g=o.div(e||(e=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(t||(t=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n pointer-events: none;\n border-radius: 100%;\n height: ",";\n width: ",';\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: "";\n border-radius: 100%;\n pointer-events: none;\n height: ',";\n width: ",";\n top: calc(50% - ("," / 2));\n left: calc(50% - ("," / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n pointer-events: none;\n border-radius: 100%;\n height: ",";\n width: ",';\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: "";\n border-radius: 100%;\n pointer-events: none;\n height: ',";\n width: ",";\n top: calc(50% - ("," / 2));\n left: calc(50% - ("," / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p,h,h,h,h),f=o.label(l||(l=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n width: 100%;\n position: relative;\n\n cursor: ",";\n display: inline-block;\n\n color: ",";\n padding: ",";\n vertical-align: middle;\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n width: 100%;\n position: relative;\n\n cursor: ",";\n display: inline-block;\n\n color: ",";\n padding: ",";\n vertical-align: middle;\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n.$disabled?"not-allowed":"pointer"}),(function(n){var o=n.theme;return n.$disabled?o.colors.disabled:o.colors.textDark}),(function(n){var o=n.theme;return"calc( (".concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m," calc( (").concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.xl)}),(function(o){var e=o.theme,t=o.$disabled,l=o.$checked,a=o.$hasError;return e.utilities.useDefaultFromControls?null:i(r||(r=n(["\n min-height: 2rem;\n\n "," "," {\n border: solid 2px\n ",";\n &:before {\n background-color: ",";\n }\n }\n\n &:hover "," "," {\n border: solid 2px\n ",";\n }\n "],["\n min-height: 2rem;\n\n "," "," {\n border: solid 2px\n ",";\n &:before {\n background-color: ",";\n }\n }\n\n &:hover "," "," {\n border: solid 2px\n ",";\n }\n "])),g,u,t?e.colors.disabled:a?e.colors.danger:l?e.colors.check:e.colors.inputBorder,l?e.colors.check:"rgba(255, 255, 255, 0)",g,u,t?e.colors.disabled:e.colors.check)})),m=o.span(a||(a=n(["\n display: inline;\n vertical-align: middle;\n line-height: 100%;\n background-color: ",";\n min-height: 2em;\n z-index: 1;\n"],["\n display: inline;\n vertical-align: middle;\n line-height: 100%;\n background-color: ",";\n min-height: 2em;\n z-index: 1;\n"])),(function(n){return n.theme.colors.backgroundLight})),x=o.div(s||(s=n(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0);\n z-index: 0;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0);\n z-index: 0;\n"]))),k=o.input(b||(b=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 margin-right: ",";\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 margin-right: ",";\n\n ","\n"])),(function(n){return n.theme.spacing.xxs}),(function(o){var e=o.theme;return e.utilities.useDefaultFromControls?i(c||(c=n(["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "],["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "])),e.spacing.s):i(d||(d=n(["\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n "],["\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n "])),e.spacing.xxs,x,e.colors.inputBorder)}));export{u as Check,g as CheckWrapper,x as SelectedBorder,k as StyledInput,f as StyledLabel,m as VerticalAlign};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../src/components/Radio/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst RADIO_SIZE = \"1.5rem\";\nconst RADIO_INNER_SIZE = \"0.75rem\";\nconst BUTTON_HEIGHT = \"3em\";\n\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\n display: inline-block;\n height: ${RADIO_SIZE};\n width: ${RADIO_SIZE};\n position: absolute;\n top: calc(50% - (${RADIO_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<{\n theme: ThemeType;\n}>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n pointer-events: none;\n border-radius: 100%;\n height: ${RADIO_SIZE};\n width: ${RADIO_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: \"\";\n border-radius: 100%;\n pointer-events: none;\n height: ${RADIO_INNER_SIZE};\n width: ${RADIO_INNER_SIZE};\n top: calc(50% - (${RADIO_INNER_SIZE} / 2));\n left: calc(50% - (${RADIO_INNER_SIZE} / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n`;\n\nexport const StyledLabel = styled.label<{\n $hasError: boolean;\n disabled: boolean;\n checked: boolean;\n theme: ThemeType;\n}>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n width: 100%;\n position: relative;\n\n cursor: ${({ disabled }) => (disabled ? \"not-allowed\" : \"pointer\")};\n display: inline-block;\n\n color: ${({ theme, disabled }) =>\n disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n vertical-align: middle;\n\n ${({ theme, disabled: isDisabled, checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid 2px\n ${isDisabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n &:before {\n background-color: ${checked\n ? theme.colors.check\n : `rgba(255, 255, 255, 0)`};\n }\n }\n\n &:hover ${CheckWrapper} ${Check} {\n border: solid 2px\n ${isDisabled ? theme.colors.disabled : theme.colors.check};\n }\n `}\n`;\n\nexport const VerticalAlign = styled.span<{\n theme: ThemeType;\n}>`\n display: inline;\n vertical-align: middle;\n line-height: 100%;\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n min-height: 2em;\n z-index: 1;\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0);\n z-index: 0;\n`;\n\nexport const StyledInput = styled.input<{\n disabled: boolean;\n theme: ThemeType;\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 margin-right: ${({\n theme: {\n spacing: { xxs },\n },\n }) => xxs};\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n `}\n`;\n"],"names":["RADIO_SIZE","RADIO_INNER_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","templateObject_2","colors","selectionBorder","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","isDisabled","checked","$hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","VerticalAlign","templateObject_5","SelectedBorder","templateObject_6","StyledInput","input","templateObject_9","xxs","templateObject_7","s"],"mappings":"2HAGA,sBAAMA,EAAa,SACbC,EAAmB,UAGZC,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,eAAA,gDAAA,oBAAA,OAAA,CAEpC,yCAEoB,eACD,gDAEU,oBAKrB,SAREN,EACDA,EAEUA,GACX,SAACO,GAIH,OAFWA,EAAAC,MAAAC,QAAAC,EAEX,IAGKC,EAAQR,EAAOS,KAAIC,IAAAA,EAAAP,EAAA,CAAA,mEAAA,iEAAA,eAAA,+RAAA,iBAAA,2BAAA,kCAAA,oIAAA,CAE9B,mEAG+D,iEAG3C,eACD,+RAgBS,iBACD,2BACU,kCACC,uIAvBlB,SAACC,GAAc,OAAPA,EAAAC,MAAaM,OAAOC,eAAb,GAGzBf,EACDA,EAgBGC,EACDA,EACUA,EACCA,GAOXe,EAAcb,EAAOc,MAKhCC,IAAAA,EAAAZ,EAAA,CAAA,iHAAA,mBAAA,qBAAA,4BAAA,yDAAA,2CAAA,iBAAA,qCAAA,MAAA,CAAA,iHAOyD,mBACA,qBACI,4BAEE,
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/Radio/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst RADIO_SIZE = \"1.5rem\";\nconst RADIO_INNER_SIZE = \"0.75rem\";\nconst BUTTON_HEIGHT = \"3em\";\n\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\n display: inline-block;\n height: ${RADIO_SIZE};\n width: ${RADIO_SIZE};\n position: absolute;\n top: calc(50% - (${RADIO_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<{\n theme: ThemeType;\n}>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n pointer-events: none;\n border-radius: 100%;\n height: ${RADIO_SIZE};\n width: ${RADIO_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition:\n border 0.25s linear,\n box-shadow 0.25s linear;\n\n &:before {\n display: block;\n position: absolute;\n content: \"\";\n border-radius: 100%;\n pointer-events: none;\n height: ${RADIO_INNER_SIZE};\n width: ${RADIO_INNER_SIZE};\n top: calc(50% - (${RADIO_INNER_SIZE} / 2));\n left: calc(50% - (${RADIO_INNER_SIZE} / 2));\n margin: auto;\n background-color: rgba(255, 255, 255, 0);\n transition: background-color 0.25s linear;\n }\n`;\n\nexport const StyledLabel = styled.label<{\n $hasError: boolean;\n $disabled: boolean;\n $checked: boolean;\n theme: ThemeType;\n}>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n width: 100%;\n position: relative;\n\n cursor: ${({ $disabled }) => ($disabled ? \"not-allowed\" : \"pointer\")};\n display: inline-block;\n\n color: ${({ theme, $disabled }) =>\n $disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n vertical-align: middle;\n\n ${({ theme, $disabled: isDisabled, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid 2px\n ${isDisabled\n ? theme.colors.disabled\n : $hasError\n ? theme.colors.danger\n : $checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n &:before {\n background-color: ${$checked\n ? theme.colors.check\n : `rgba(255, 255, 255, 0)`};\n }\n }\n\n &:hover ${CheckWrapper} ${Check} {\n border: solid 2px\n ${isDisabled ? theme.colors.disabled : theme.colors.check};\n }\n `}\n`;\n\nexport const VerticalAlign = styled.span<{\n theme: ThemeType;\n}>`\n display: inline;\n vertical-align: middle;\n line-height: 100%;\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n min-height: 2em;\n z-index: 1;\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0);\n z-index: 0;\n`;\n\nexport const StyledInput = styled.input<{\n disabled: boolean;\n theme: ThemeType;\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 margin-right: ${({\n theme: {\n spacing: { xxs },\n },\n }) => xxs};\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n `}\n`;\n"],"names":["RADIO_SIZE","RADIO_INNER_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","templateObject_2","colors","selectionBorder","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","$disabled","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","isDisabled","$checked","$hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","VerticalAlign","templateObject_5","SelectedBorder","templateObject_6","StyledInput","input","templateObject_9","xxs","templateObject_7","s"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as r,__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import i,{forwardRef as t}from"react";import{useTheme as o}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{ErrorText as a}from"../ErrorText/index.js";import{LabelWrapper as n}from"../LabelWrapper/index.js";import m from"./styles.js";var d=t((function(t,d){var l=t.errorMessage,p=t.hasError,c=t.hintText,u=t.label,f=t.resize,h=void 0===f?"vertical":f,x=t.lineCount,b=void 0===x?3:x,v=r(t,["errorMessage","hasError","hintText","label","resize","lineCount"]),E=o(),j=e(e({},s),E);return i.createElement(n,{label:u,hintText:c,required:v.required||!1},i.createElement(m,e({},v,{"aria-invalid":p||!!l||!1,"aria-describedby":v.id&&l?"".concat(v.id,"-error"):void 0,$hasError:p||!!l||!1
|
|
1
|
+
import{__rest as r,__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import i,{forwardRef as t}from"react";import{useTheme as o}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{ErrorText as a}from"../ErrorText/index.js";import{LabelWrapper as n}from"../LabelWrapper/index.js";import m from"./styles.js";var d=t((function(t,d){var l=t.errorMessage,p=t.hasError,c=t.hintText,u=t.label,f=t.resize,h=void 0===f?"vertical":f,x=t.lineCount,b=void 0===x?3:x,v=r(t,["errorMessage","hasError","hintText","label","resize","lineCount"]),E=o(),j=e(e({},s),E);return i.createElement(n,{label:u,hintText:c,required:v.required||!1},i.createElement(m,e({},v,{"aria-invalid":p||!!l||!1,"aria-describedby":v.id&&l?"".concat(v.id,"-error"):void 0,$hasError:p||!!l||!1,$resize:h,$lineCount:b,theme:j,ref:d,"data-hj-suppress":!0})),!!l&&i.createElement(a,{marginTop:"xxs",id:v.id?"".concat(v.id,"-error"):void 0},l))}));export{d as TextAreaField,d as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|