@foxford/ui 2.19.2 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Anchor/Anchor.js.map +1 -1
- package/components/ArrowBadge/ArrowBadge.js.map +1 -1
- package/components/Badge/Badge.js.map +1 -1
- package/components/Button/Button.js.map +1 -1
- package/components/FormInputLabel/FormInputLabel.js +2 -0
- package/components/FormInputLabel/FormInputLabel.js.map +1 -0
- package/components/FormInputLabel/constants.js +2 -0
- package/components/FormInputLabel/constants.js.map +1 -0
- package/components/FormInputLabel/style.js +2 -0
- package/components/FormInputLabel/style.js.map +1 -0
- package/components/FormLabel/FormLabel.js.map +1 -1
- package/components/Input/Input.js +1 -1
- package/components/Input/Input.js.map +1 -1
- package/components/Input/images/minus.module.svg.js +2 -0
- package/components/Input/images/minus.module.svg.js.map +1 -0
- package/components/Input/images/plus.module.svg.js +2 -0
- package/components/Input/images/plus.module.svg.js.map +1 -0
- package/components/Input/style.js +1 -1
- package/components/Input/style.js.map +1 -1
- package/components/Input.Phone/Input.Phone.js +1 -1
- package/components/Input.Phone/Input.Phone.js.map +1 -1
- package/components/InputCheckbox/InputCheckbox.js.map +1 -1
- package/components/InputRadio/InputRadio.js.map +1 -1
- package/components/Tab/Tab.js.map +1 -1
- package/components/Text/Text.js.map +1 -1
- package/components/Text/style.js +1 -1
- package/components/Text/style.js.map +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/style.js.map +1 -1
- package/dts/index.d.ts +282 -273
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/mixins/create-responsive-props.js +1 -1
- package/mixins/create-responsive-props.js.map +1 -1
- package/package.json +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { SIZES, SIZES_DEFAULT } from './constants'\nimport * as Styled from './style'\nimport type { TabProps } from './types'\n\nconst COMPONENT_NAME = 'Tab'\n\n/**\n *\n * Component
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { SIZES, SIZES_DEFAULT } from './constants'\nimport * as Styled from './style'\nimport type { TabProps } from './types'\n\nconst COMPONENT_NAME = 'Tab'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [TabProps](https://github.com/foxford/ui/blob/master/src/components/Tab/types.ts)\n */\nconst Tab: React.ForwardRefExoticComponent<TabProps> = withMergedProps<TabProps, HTMLButtonElement>(\n forwardRef((props, ref) => {\n const { size = 'm', type = 'button', textProps = {}, children, theme, ...restProps } = props\n\n const baseTextProps: TextProps = { as: 'span', size: 'inherit', color: 'inherit', weight: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n size={size}\n tabTheme={theme}\n type={restProps.as === undefined ? type : undefined}\n ref={ref}\n >\n {restProps.preset === 'brand' ? (\n <>\n {restProps.left && <Styled.Edge />}\n <Styled.Content>\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps })\n ) : (\n <Text {...baseTextProps} {...textProps}>\n {children}\n </Text>\n )}\n </Styled.Content>\n {restProps.right && <Styled.Edge after />}\n </>\n ) : (\n <>\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps })\n ) : (\n <Text {...baseTextProps} {...textProps}>\n {children}\n </Text>\n )}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n return props.preset === 'brand' ? SIZES : SIZES_DEFAULT\n },\n }\n)\n\nexport { Tab, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Tab","withMergedProps","forwardRef","props","ref","size","type","textProps","children","theme","restProps","_excluded","baseTextProps","as","color","weight","_jsx","Styled.Root","tabTheme","preset","_jsxs","_Fragment","left","Styled.Edge","Styled.Content","Text","right","after","displayName","sizes","SIZES","SIZES_DEFAULT"],"mappings":"oeAQMA,IAAAA,EAAiB,MAYjBC,IAAAA,EAAiDC,EACrDC,GAAAA,CAAYC,EAAOC,KACjB,IAAMC,KAAEA,EAAO,IAATC,KAAcA,EAAO,SAArBC,UAA+BA,EAAY,GAA3CC,SAA+CA,EAA/CC,MAAyDA,GAAwBN,EAAdO,IAAcP,EAAvFQ,GAEA,IAAMC,EAA2B,CAAEC,GAAI,OAAQR,KAAM,UAAWS,MAAO,UAAWC,OAAQ,WAE1F,OACEC,EAACC,SACKP,GADN,GAAA,CAEEL,KAAMA,EACNa,SAAUT,EACVH,cAAMI,EAAUG,GAAmBP,OAAAA,EACnCF,IAAKA,EALPI,SAOwB,UAArBE,EAAUS,OACTC,EAAAC,EAAA,CAAAb,SAAA,CACGE,EAAUY,MAAQN,EAACO,EADtB,IAEEP,EAACQ,EAAD,CAAAhB,SACuB,mBAAbA,EACNA,EAAS,CAAEI,cAAAA,EAAeL,UAAAA,IAE1BS,EAACS,EAASb,EAAAA,EAAAA,EAAAA,GAAAA,GAAmBL,GAA7B,GAAA,CAAAC,SACGA,OAINE,EAAUgB,OAASV,EAACO,EAAD,CAAaI,OAAK,OAGxCX,EAAAK,EAAA,CAAAb,SACuB,mBAAbA,EACNA,EAAS,CAAEI,cAAAA,EAAeL,UAAAA,IAE1BS,EAACS,EAASb,EAAAA,EAAAA,EAAAA,GAAAA,GAAmBL,GAA7B,GAAA,CAAAC,SACGA,aAQf,CACEoB,YAvDmB,MAwDnBC,MAAQ1B,GACkB,UAAjBA,EAAMgB,OAAqBW,EAAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../src/components/Text/Text.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { TextHeading } from 'components/Text.Heading'\nimport { TextEllipse } from 'components/Text.Ellipse'\nimport type { TextProps } from './types'\nimport { APPEARANCE, SIZES, SIZES_DEFAULT } from './constants'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Text'\n\n/**\n *\n * Component
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../src/components/Text/Text.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { TextHeading } from 'components/Text.Heading'\nimport { TextEllipse } from 'components/Text.Ellipse'\nimport type { TextProps } from './types'\nimport { APPEARANCE, SIZES, SIZES_DEFAULT } from './constants'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Text'\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [TextProps](https://github.com/foxford/ui/blob/master/src/components/Text/types.ts)\n */\nconst Text: React.ForwardRefExoticComponent<TextProps> & { Heading: typeof TextHeading; Ellipse: typeof TextEllipse } =\n Object.assign(\n withMergedProps<TextProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const textProps = props.appearance ? { ...APPEARANCE[props.appearance], ...props } : props\n\n const {\n size = 'm',\n weight = 'normal',\n lineHeight = 'm',\n fontStyle = 'normal',\n className,\n content,\n children,\n ...restProps\n } = textProps\n\n const textClassName = useClassname(COMPONENT_NAME, className)\n\n if (children) {\n return (\n <Styled.Root\n {...restProps}\n size={size}\n weight={weight}\n lineHeight={lineHeight}\n fontStyle={fontStyle}\n className={textClassName}\n ref={ref}\n >\n {children}\n </Styled.Root>\n )\n }\n\n return (\n <Styled.Root\n {...restProps}\n size={size}\n weight={weight}\n lineHeight={lineHeight}\n fontStyle={fontStyle}\n className={textClassName}\n dangerouslySetInnerHTML={{ __html: content || '' }}\n ref={ref}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n if (typeof props.appearance === 'string') {\n return SIZES[props.appearance] ?? SIZES_DEFAULT\n }\n\n return SIZES_DEFAULT\n },\n }\n ),\n {\n Heading: TextHeading,\n Ellipse: TextEllipse,\n }\n )\n\nexport { Text, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Text","Object","assign","withMergedProps","forwardRef","props","ref","textProps","appearance","APPEARANCE","size","weight","lineHeight","fontStyle","className","content","children","restProps","_excluded","textClassName","useClassname","_jsx","Styled.Root","dangerouslySetInnerHTML","__html","displayName","sizes","_SIZES$props$appearan","SIZES","SIZES_DEFAULT","Heading","TextHeading","Ellipse","TextEllipse"],"mappings":"knBASMA,IAAAA,EAAiB,OAYvB,IAAMC,EACJC,OAAOC,OACLC,EACEC,GAAAA,CAAYC,EAAOC,KACjB,IAAMC,EAAYF,EAAMG,WAAkBC,EAAAA,EAAAA,GAAAA,EAAWJ,EAAMG,aAAgBH,GAAUA,EAErF,IAAMK,KACJA,EAAO,IADHC,OAEJA,EAAS,SAFLC,WAGJA,EAAa,IAHTC,UAIJA,EAAY,SAJRC,UAKJA,EALIC,QAMJA,EANIC,SAOJA,GAEET,EADCU,IACDV,EATJW,GAWA,IAAMC,EAAgBC,EA7BP,OA6BoCN,GAEnD,OAEIO,EAACC,SACKL,GADN,GAFAD,EAEA,CAEEN,KAAMA,EACNC,OAAQA,EACRC,WAAYA,EACZC,UAAWA,EACXC,UAAWK,EACXb,IAAKA,EAPPU,SASGA,GAML,CAEEN,KAAMA,EACNC,OAAQA,EACRC,WAAYA,EACZC,UAAWA,EACXC,UAAWK,EACXI,wBAAyB,CAAEC,OAAQT,GAAW,IAC9CT,IAAKA,QAIX,CACEmB,YA7De,OA8DfC,MAAQrB,IACoC,IAAAsB,EAA1C,MAAgC,iBAArBtB,EAAMG,oBACfmB,EAAOC,EAAMvB,EAAMG,2BAGdqB,KAIb,CACEC,QAASC,EACTC,QAASC"}
|
package/components/Text/style.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import n from'styled-components';import{display as o}from'../../mixins/display.js';import{color as t}from'../../mixins/color.js';import{responsiveSize as e}from'../../mixins/responsive-size.js';import{responsiveMargin as i}from'../../mixins/responsive-margin.js';import{createShouldForwardProp as r}from'../../shared/utils/style.js';var a={lighter:100,normal:400,bold:600,bolder:800};var
|
|
1
|
+
import n from'styled-components';import{display as o}from'../../mixins/display.js';import{color as t}from'../../mixins/color.js';import{responsiveSize as e}from'../../mixins/responsive-size.js';import{responsiveMargin as i}from'../../mixins/responsive-margin.js';import{createShouldForwardProp as r}from'../../shared/utils/style.js';var a={lighter:100,normal:400,bold:600,bolder:800};var s={l:1.5,m:1.3,s:1.15,xs:1};var c=r((n=>!['appearance','fontFamily','weight','fontStyle','transform','underlineLinks','textAlign','lineHeight','content','display','chars','quoted','showZeroMinorPart','separator','underline','whiteSpace'].includes(n)));var l=n.div.withConfig({shouldForwardProp:c}).withConfig({componentId:"fox-ui__sc-s2fogy-0"})([""," "," "," "," ",""],(n=>{var o,t;return"\n margin: 0;\n ".concat(n.fontFamily?"font-family: ".concat(n.fontFamily,";"):'',"\n ").concat(n.transform?"text-transform: ".concat(n.transform,";"):'',"\n ").concat(n.weight?"font-weight: ".concat(null!==(o=a[n.weight])&&void 0!==o?o:n.weight,";"):'',"\n ").concat(n.fontStyle?"font-style: ".concat(n.fontStyle,";"):'',"\n ").concat(n.textAlign?"text-align: ".concat(n.textAlign,";"):'',"\n ").concat(n.lineHeight?"line-height: ".concat(null!==(t=s[n.lineHeight])&&void 0!==t?t:n.lineHeight,";"):'',"\n ").concat(n.underline?"border-bottom: 1px ".concat('string'==typeof n.underline?n.underline:'solid',";"):'',"\n ").concat(n.whiteSpace?"white-space: ".concat(n.whiteSpace,";"):'',"\n a {\n text-decoration: ").concat(n.underlineLinks?'underline':'none',";\n &:hover {\n text-decoration: none;\n }\n }\n ")}),e,i,(n=>n.display?o(n.display):null),(n=>t(n.color?n.color:n.theme.textColor)));export{l as Root};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color } from 'shared/types'\nimport type { StyledTextProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'underline',\n ].includes(propKey)\n)\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.underline ? `border-bottom: 1px ${typeof props.underline === 'string' ? props.underline : 'solid'};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","Root","styled","div","withConfig","shouldForwardProp","componentId","props","_WEIGHT_MAP$props$wei","_LINE_HEIGHT_MAP$prop","fontFamily","concat","transform","weight","fontStyle","textAlign","lineHeight","underline","underlineLinks","responsiveSize","responsiveMargin","display","color","theme","textColor"],"mappings":"6UASA,IAAMA,EAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,IAAMC,EAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,IAAMC,EAAwBC,GAC3BC,IACE,CACC,aACA,aACA,SACA,YACA,YACA,iBACA,YACA,aACA,UACA,UACA,QACA,SACA,oBACA,YACA,
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color } from 'shared/types'\nimport type { StyledTextProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'underline',\n 'whiteSpace',\n ].includes(propKey)\n)\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.underline ? `border-bottom: 1px ${typeof props.underline === 'string' ? props.underline : 'solid'};` : ''}\n ${props.whiteSpace ? `white-space: ${props.whiteSpace};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","Root","styled","div","withConfig","shouldForwardProp","componentId","props","_WEIGHT_MAP$props$wei","_LINE_HEIGHT_MAP$prop","fontFamily","concat","transform","weight","fontStyle","textAlign","lineHeight","underline","whiteSpace","underlineLinks","responsiveSize","responsiveMargin","display","color","theme","textColor"],"mappings":"6UASA,IAAMA,EAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,IAAMC,EAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,IAAMC,EAAwBC,GAC3BC,IACE,CACC,aACA,aACA,SACA,YACA,YACA,iBACA,YACA,aACA,UACA,UACA,QACA,SACA,oBACA,YACA,YACA,cACAC,SAASD,KAGR,IAAME,EAAOC,EAAOC,IAAIC,WAA4B,CACzDC,kBAAmBR,IADJO,WAAA,CAAAE,YAAA,uBAAGJ,CAAH,CAAA,GAAA,IAAA,IAAA,IAAA,IAAA,KAGZK,IAAD,IAAAC,EAAAC,EAAA,MAEEF,yBAAAA,OAAAA,EAAMG,WAA6BH,gBAAAA,OAAAA,EAAMG,WAAzC,KAAyD,GAF3D,UAAAC,OAGEJ,EAAMK,UAA+BL,mBAAAA,OAAAA,EAAMK,UAAe,KAAA,oBAC1DL,EAAMM,OAAN,gBAAAF,OAAA,QAAAH,EAA+BrB,EAAWoB,EAAMM,eAAhD,IAAAL,EAAAA,EAA2DD,EAAMM,OAAY,KAAA,GAC7EN,UAAAA,OAAAA,EAAMO,gCAA2BP,EAAMO,UAAvC,KAAsD,GALxD,UAAAH,OAMEJ,EAAMQ,UAA2BR,eAAAA,OAAAA,EAAMQ,eAAe,GANxD,UAAAJ,OAOEJ,EAAMS,WAAN,gBAAAL,OAAA,QAAAF,EAAmCjB,EAAgBe,EAAMS,mBAAAA,IAAzDP,EAAAA,EAAwEF,EAAMS,WAAgB,KAAA,GAC9FT,UAAAA,OAAAA,EAAMU,UAAN,sBAAAN,OAAmE,iBAApBJ,EAAMU,UAAyBV,EAAMU,UAAY,QAAa,KAAA,GAC7GV,UAAAA,OAAAA,EAAMW,kCAA6BX,EAAMW,WAAzC,KAAyD,GAT3D,sCAAAP,OAWqBJ,EAAMY,eAAiB,YAAc,OAX1D,4EAkBAC,EACAC,GAECd,GAAWA,EAAMe,QAAUA,EAAQf,EAAMe,SAAW,OACpDf,GAAyBgB,EAAdhB,EAAMgB,MAAchB,EAAMgB,MAAehB,EAAMiB,MAAMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport { useTheme } from 'styled-components'\nimport { omit } from 'ramda'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\nconst Textarea = (props: TextareaProps) => {\n const theme = useTheme()\n\n const {\n preset,\n disabled,\n error,\n fluid,\n name,\n onChange,\n maxLength,\n placeholder,\n required,\n tabIndex,\n value,\n className,\n style,\n autosize = true,\n rounded = true,\n cols = 20,\n rows = 2,\n maxRows = 30,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n ...configProps\n } = useConfigPriority<TextareaProps>(theme.components?.[COMPONENT_NAME], omit(['children'], props))\n\n const textarea = useRef() as React.MutableRefObject<HTMLTextAreaElement>\n\n const [tRows, setRows] = useState(rows)\n\n const onChangeHandler
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport { useTheme } from 'styled-components'\nimport { omit } from 'ramda'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\nconst Textarea = (props: TextareaProps) => {\n const theme = useTheme()\n\n const {\n preset,\n disabled,\n error,\n fluid,\n name,\n onChange,\n maxLength,\n placeholder,\n required,\n tabIndex,\n value,\n className,\n style,\n autosize = true,\n rounded = true,\n cols = 20,\n rows = 2,\n maxRows = 30,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n ...configProps\n } = useConfigPriority<TextareaProps>(theme.components?.[COMPONENT_NAME], omit(['children'], props))\n\n const textarea = useRef() as React.MutableRefObject<HTMLTextAreaElement>\n\n const [tRows, setRows] = useState(rows)\n\n const onChangeHandler = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const { target } = event\n\n if (target instanceof HTMLTextAreaElement && autosize) {\n const rect = target.getBoundingClientRect()\n\n if (target.scrollHeight > rect.height && tRows < maxRows) {\n setRows(tRows + 1)\n } else if (!target.value || target.value === '') {\n setRows(rows)\n }\n }\n\n if (typeof onChange === 'function') {\n onChange(event)\n }\n },\n [onChange, tRows, maxRows, autosize]\n )\n\n useEffect(() => {\n if (!textarea || !textarea.current) return\n\n const el = textarea.current\n const rect = el.getBoundingClientRect()\n if (el.scrollHeight > rect.height) {\n const lh = parseInt(getComputedStyle(el).lineHeight, 10)\n const numberOfLines = Math.floor(el.scrollHeight / lh)\n if (numberOfLines <= maxRows && numberOfLines > rows) {\n setRows(numberOfLines)\n }\n }\n }, [])\n\n let brandPresetUsed = theme.preset === 'brand'\n if (typeof preset === 'string') brandPresetUsed = preset === 'brand'\n\n return (\n <Styled.Root\n {...configProps}\n ref={textarea}\n className={className}\n style={style}\n onChange={onChangeHandler}\n cols={cols}\n disabled={disabled}\n maxLength={maxLength}\n name={name}\n placeholder={placeholder}\n required={required}\n rows={tRows}\n tabIndex={tabIndex}\n value={value}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n fluid={fluid}\n error={error}\n width={width}\n brandPresetUsed={brandPresetUsed}\n />\n )\n}\n\nTextarea.displayName = COMPONENT_NAME\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Textarea","props","_theme$components","theme","useTheme","_useConfigPriority","useConfigPriority","components","omit","preset","disabled","error","fluid","name","onChange","maxLength","placeholder","required","tabIndex","value","className","style","autosize","rounded","cols","rows","maxRows","color","placeholderColor","width","defaultInputControlsWidth","configProps","_objectWithoutProperties","_excluded","textarea","useRef","tRows","setRows","useState","onChangeHandler","useCallback","event","target","HTMLTextAreaElement","rect","getBoundingClientRect","scrollHeight","height","useEffect","current","el","lh","parseInt","getComputedStyle","lineHeight","numberOfLines","Math","floor","brandPresetUsed","_jsx","Styled.Root","ref","displayName"],"mappings":"onBAOMA,IAAAA,EAAiB,WAEjBC,IAAAA,EAAYC,IAAyB,IAAAC,EACzC,IAAMC,EAAQC,IAEd,IAAAC,EAuBIC,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,OAG5B,MAFsB,iBAAXA,IAAqBiD,EAA6B,UAAXjD,GAGhDkD,EAACC,SACK7B,GADN,GAAA,CAEE8B,IAAK3B,EACLd,UAAWA,EACXC,MAAOA,EACPP,SAAUyB,EACVf,KAAMA,EACNd,SAAUA,EACVK,UAAWA,EACXF,KAAMA,EACNG,YAAaA,EACbC,SAAUA,EACVQ,KAAMW,EACNlB,SAAUA,EACVC,MAAOA,EACPQ,MAAOA,EACPJ,QAASA,EACTK,iBAAkBA,EAClBhB,MAAOA,EACPD,MAAOA,EACPkB,MAAOA,EACP6B,gBAAiBA,MAKvB1D,EAAS8D,YAnGc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Textarea/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { property, responsiveNamedProperty } from 'mixins/responsive-property'\nimport { chooseWidthValue } from 'components/Input/helpers'\nimport { baseInputStyle } from 'components/Input/style'\nimport type { StyledTextareaProps } from './types'\n\
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Textarea/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { property, responsiveNamedProperty } from 'mixins/responsive-property'\nimport { chooseWidthValue } from 'components/Input/helpers'\nimport { baseInputStyle } from 'components/Input/style'\nimport type { StyledTextareaProps } from './types'\n\nconst brandTextareaStyle = css<StyledTextareaProps>`\n ${({ theme }) => `\n display: block;\n box-sizing: border-box;\n appearance: none;\n width: auto;\n resize: none;\n\n background: ${theme.colors['bg-onmain-secondary']};\n border: 1px solid ${theme.colors['border-onmain-default-large']};\n border-radius: 12px;\n padding: 12px 16px;\n\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 24px;\n color: ${theme.colors['content-onmain-primary']};\n\n transition-property: background-color, border-color, color, caret-color;\n transition-duration: 200ms;\n transition-timing-function: ease-in;\n\n &::placeholder {\n color: ${theme.colors['content-onmain-secondary']};\n }\n\n &:focus {\n border: 1px solid ${theme.colors['border-brand-primary']};\n caret-color: ${theme.colors['border-brand-primary']};\n outline: none;\n }\n\n &:disabled {\n background-color: ${theme.colors['bg-disabled-large']};\n border-color: ${theme.colors['border-disabled']};\n color: ${theme.colors['content-disabled']};\n cursor: not-allowed;\n }\n `};\n\n ${(props) =>\n props.width\n ? property(chooseWidthValue(props.width), props.fluid && props.width !== 'auto' ? 'max-width' : 'width')\n : null}\n\n ${(props) =>\n responsiveNamedProperty({\n sizes: {\n widthXS: props.widthXS,\n widthS: props.widthS,\n widthM: props.widthM,\n widthL: props.widthL,\n widthXL: props.widthXL,\n },\n cssProperty: props.fluid && props.width !== 'auto' ? 'max-width' : 'width',\n customSizeHandler: chooseWidthValue,\n })}\n\n ${({ fluid }) => fluid && 'width: 100%;'}\n\n ${({ error, theme }) =>\n error &&\n `\n background-color: ${theme.colors['alert-bg-error-100']};\n border: 1px solid ${theme.colors['alert-bg-error-500']};\n `}\n`\n\nconst baseTextareaStyle = css`\n resize: none;\n line-height: 23px;\n padding: 16px 20px 11px;\n ${baseInputStyle}\n`\n\nexport const Root = styled.textarea.withConfig<StyledTextareaProps>({\n shouldForwardProp: (prop) =>\n !['color', 'placeholderColor', 'rounded', 'fluid', 'error', 'brandPresetUsed', 'theme'].includes(prop) &&\n !prop.includes('width'),\n})`\n ${({ brandPresetUsed }) => (brandPresetUsed ? brandTextareaStyle : baseTextareaStyle)}\n`\n"],"names":["brandTextareaStyle","css","_ref","theme","concat","colors","props","width","property","chooseWidthValue","fluid","responsiveNamedProperty","sizes","widthXS","widthS","widthM","widthL","widthXL","cssProperty","customSizeHandler","_ref2","_ref3","error","baseTextareaStyle","baseInputStyle","Root","styled","textarea","withConfig","shouldForwardProp","prop","includes","componentId","_ref4","brandPresetUsed"],"mappings":"iPAMA,IAAMA,EAAqBC,EACvB,CAAA,GAAA,IAAA,IAAA,IAAA,IAAA,KAAAC,IAAA,IAACC,MAAEA,GAAHD,EAAA,MAAA,qIAAAE,OAOcD,EAAME,OAAO,uBACP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