@foxford/ui 2.0.0-beta-f7fb8e6-20220713 → 2.0.0-beta-17e0ae1-20220714
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/Amount/Amount.js.map +1 -1
- package/components/Arrow/Arrow.js.map +1 -1
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/style.js +1 -1
- package/components/Checkbox/style.js.map +1 -1
- package/components/Icon/Icon.js +1 -1
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/style.js +1 -1
- package/components/Icon/style.js.map +1 -1
- package/components/Radio/Radio.js +1 -1
- package/components/Radio/Radio.js.map +1 -1
- package/components/Radio/style.js +1 -1
- package/components/Radio/style.js.map +1 -1
- package/dts/index.d.ts +4 -4
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Amount.js","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport cx from 'clsx'\nimport { Color } from '../../mixins/color'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport { Text } from '../Text/Text'\nimport { Display } from '../../mixins/display'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>, Display {\n /**\n * Value for amount\n */\n value?: number\n /**\n * Digits after point\n */\n digitsAfterPoint?: number\n /**\n * Show zero minor part\n */\n showZeroMinorPart?: boolean\n /**\n * Separator of major and minor part of amount\n */\n separator?: string\n /**\n * International code of currency.\n */\n currency?: keyof typeof CurrencyCodes\n /**\n * Use Header component for display amount\n */\n isHeader?: boolean\n /**\n * Amount is not valid and will be crossed out with ```text-decoration: line-through```\n */\n crossedOut?: boolean\n /**\n * If need only currency symbol\n */\n onlyCurrency?: boolean\n}\n\nconst AMOUNT_MAJOR_PART_SIZE = 3\nconst ZERO_MINOR_PART_REGEXP = /^0+$/\nconst MINUS_SIGN_HTML_CODE = '\\u2212'\n\nfunction createSplitter(partSize: number): (_s: string) => string[] {\n const parts = (str: string): string[] => {\n const { length } = str\n\n if (length <= partSize) {\n return [str]\n }\n\n const from = length - partSize\n const to = length\n\n return [str.slice(from, to)].concat(parts(str.slice(0, from)))\n }\n\n return parts\n}\n\nfunction formatAmount(\n value: AmountProps['value'] = 0,\n digitsAfterPoint: AmountProps['digitsAfterPoint'],\n currencyCode: AmountProps['currency']\n) {\n const isNegative = value < 0\n\n const valueAbs = Math.abs(value)\n const valueAbsStr = valueAbs.toFixed(digitsAfterPoint)\n\n const numberParts = valueAbsStr.split('.')\n const majorPart = numberParts[0]\n const minorPart = numberParts[1]\n\n const amountSplitter = createSplitter(AMOUNT_MAJOR_PART_SIZE)\n\n const majorPartFormatted = amountSplitter(majorPart).reverse().join(' ')\n\n const formattedValueStr = majorPartFormatted + (minorPart ? `,${minorPart}` : '')\n\n return {\n majorPart: majorPartFormatted,\n minorPart,\n value: formattedValueStr,\n isNegative,\n currencySymbol: currencyCode ? Amount.getCurrencySymbol(currencyCode) : '',\n }\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveNamedProperty<'size'>`](#/Миксины)\n */\nexport class Amount extends PureComponent<AmountProps> {\n static displayName = 'Amount'\n static defaultProps = {\n isHeader: false,\n showZeroMinorPart: false,\n crossedOut: false,\n digitsAfterPoint: 2,\n separator: ',',\n onlyCurrency: false,\n }\n\n static getCurrencySymbol(currencyCode: keyof typeof CurrencyCodes) {\n return CURRENCY_MAP[currencyCode] || currencyCode\n }\n\n renderMinorPart(minorPart: string) {\n const { showZeroMinorPart, separator } = this.props\n\n let needMinorPart = false\n\n if (minorPart) {\n needMinorPart = true\n\n if (!showZeroMinorPart && ZERO_MINOR_PART_REGEXP.test(minorPart)) {\n needMinorPart = false\n }\n }\n\n if (needMinorPart) {\n return (\n <span className='minor-container'>\n <span className='separator'>{separator}</span>\n <span className='minor'>{minorPart}</span>\n </span>\n )\n }\n\n return null\n }\n\n renderCurrencySymbol = (currencySymbol: string) => (\n <span style={{ position: 'relative' }}>\n {this.props.currency === 'RUR' ? (\n <span\n style={{\n position: 'absolute',\n width: 0,\n opacity: 0,\n visibility: 'hidden',\n }}\n >\n руб.\n </span>\n ) : null}\n <span>{` ${currencySymbol}`}</span>\n </span>\n )\n\n render() {\n const { value, digitsAfterPoint, currency, isHeader, className, style, crossedOut, onlyCurrency, ...rest } =\n this.props\n\n const { majorPart, minorPart, isNegative, currencySymbol } = formatAmount(value, digitsAfterPoint, currency)\n\n const classNames = cx('amount', className)\n\n const amountInner = (\n <Styled.Root className={classNames} style={style} crossedOut={crossedOut}>\n {!onlyCurrency ? (\n <>\n <span className='major'>\n {isNegative && MINUS_SIGN_HTML_CODE}\n {majorPart}\n </span>\n {this.renderMinorPart(minorPart)}\n </>\n ) : null}\n {currency && this.renderCurrencySymbol(currencySymbol)}\n </Styled.Root>\n )\n\n const Element = isHeader ? Text.Heading : Text\n\n return (\n <Element {...rest} as='span'>\n {amountInner}\n </Element>\n )\n }\n}\n"],"names":["ZERO_MINOR_PART_REGEXP","createSplitter","partSize","parts","str","length","from","slice","concat","Amount","PureComponent","constructor","super","arguments","this","renderCurrencySymbol","currencySymbol","_jsxs","style","position","children","props","currency","_jsx","width","opacity","visibility","static","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","showZeroMinorPart","separator","needMinorPart","test","className","render","_this$props","value","digitsAfterPoint","isHeader","crossedOut","onlyCurrency","rest","_objectWithoutProperties","_excluded","majorPart","isNegative","r","e","t","undefined","numberParts","Math","abs","toFixed","split","majorPartFormatted","reverse","join","formattedValueStr","getCurrencySymbol","classNames","cx","amountInner","Styled.Root","_Fragment","Text","Heading","_objectSpread","as","displayName","defaultProps"],"mappings":"6cA8CA,IAAMA,EAAyB,OAG/B,SAASC,EAAeC,GACtB,IAAMC,EAASC,IACb,IAAMC,OAAEA,GAAWD,EAEnB,GAAIC,GAAUH,EACZ,MAAO,CAACE,GAGV,IAAME,EAAOD,EAASH,EAGtB,MAAO,CAACE,EAAIG,MAAMD,EAFPD,IAEkBG,OAAOL,EAAMC,EAAIG,MAAM,EAAGD,MAGzD,OAAOH,EAsCF,MAAMM,UAAeC,EAA2BC,cAAAC,SAAAC,WAAAC,KAwCrDC,qBAAwBC,GACtBC,EAAA,OAAA,CAAMC,MAAO,CAAEC,SAAU,YAAzBC,SAAA,CAC2B,QAAxBN,KAAKO,MAAMC,SACVC,EAAA,OAAA,CACEL,MAAO,CACLC,SAAU,WACVK,MAAO,EACPC,QAAS,EACTC,WAAY,UALhBN,SAAA,SAUE,KACJG,EAAA,OAAA,CAAAH,SAAA,IAAAZ,OAAWQ,QA3CSW,yBAACC,GACvB,OAAOC,EAAaD,IAAiBA,EAGvCE,gBAAgBC,GACd,IAAMC,kBAAEA,EAAFC,UAAqBA,GAAcnB,KAAKO,MAE9C,IAAIa,GAAAA,EAUJ,OARIH,IACFG,MAEKF,GAAqBhC,EAAuBmC,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAjB,EAAA,OAAA,CAAMmB,UAAU,kBAAhBhB,SACE,CAAAG,EAAA,OAAA,CAAMa,UAAU,YAAhBhB,SAA6Ba,IAC7BV,EAAA,OAAA,CAAMa,UAAU,QAAhBhB,SAAyBW,OAKxB,KAqBTM,SACE,IAAAC,EACExB,KAAKO,OADDkB,MAAEA,EAAFC,iBAASA,EAATlB,SAA2BA,EAA3BmB,SAAqCA,EAArCL,UAA+CA,EAA/ClB,MAA0DA,EAA1DwB,WAAiEA,EAAjEC,aAA6EA,GAAnFL,EAAoGM,EAApGC,EAAAP,EAAAQ,GAGA,IAAMC,UAAEA,EAAFhB,UAAaA,EAAbiB,WAAwBA,EAAxBhC,eAAoCA,GAjG9C,SAAAiC,EAAAC,EAAAC,GAIE,IAHAZ,+BADFU,EAAAA,EACgC,EAG9B,IAFAT,EAEA3B,UAAAR,OAAA,EAJF6C,SAIE,IADAtB,EACAf,UAAAR,OAAA,EAJF8C,OAIEC,EACA,IAAMJ,EAAaT,EAAQ,EAK3B,IAAMc,EAHWC,KAAKC,IAAIhB,GACGiB,QAAQhB,GAELiB,MAAM,KACtC,IAAMV,EAAYM,EAAY,GAC9B,IAAMtB,EAAYsB,EAAY,GAI9B,IAAMK,EAFiBzD,EAnCM,EAmCNA,CAEmB8C,GAAWY,UAAUC,KAAK,KAEpE,IAAMC,EAAoBH,GAAsB3B,EAAgBA,IAAAA,OAAAA,GAAc,IAE9E,MAAO,CACLgB,UAAWW,EACX3B,UAAAA,EACAQ,MAAOsB,EACPb,WAAAA,EACAhC,eAAgBY,EAAenB,EAAOqD,kBAAkBlC,GAAgB,IAzB5E,CAiG8EW,EAAOC,EAAkBlB,GAEnG,IAAMyC,EAAaC,EAAG,SAAU5B,GAEhC,IAAM6B,EACJhD,EAACiD,EAAD,CAAa9B,UAAW2B,EAAY7C,MAAOA,EAAOwB,WAAYA,EAA9DtB,SACG,CAACuB,EAQE,KAPF1B,EAAAkD,EAAA,CAAA/C,SACE,CAAAH,EAAA,OAAA,CAAMmB,UAAU,QAAhBhB,SAAA,CACG4B,GA7Hc,IA8HdD,KAEFjC,KAAKgB,gBAAgBC,MAGzBT,GAAYR,KAAKC,qBAAqBC,MAM3C,OACEO,EAHckB,EAAW2B,EAAKC,QAAUD,EAGxCE,EAAAA,EAAA,GAAa1B,GAAb,GAAA,CAAmB2B,GAAG,OAAtBnD,SACG6C,MArFIxD,EACJ+D,YAAc,SADV/D,EAEJgE,aAAe,CACpBhC,UAAAA,EACAT,mBAAmB,EACnBU,cACAF,iBAAkB,EAClBP,UAAW,IACXU"}
|
|
1
|
+
{"version":3,"file":"Amount.js","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport cx from 'clsx'\nimport { Color } from '../../mixins/color'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport { Text } from '../Text/Text'\nimport { Display } from '../../mixins/display'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>, Display {\n /**\n * Value for amount\n */\n value?: number\n /**\n * Digits after point\n */\n digitsAfterPoint?: number\n /**\n * Show zero minor part\n */\n showZeroMinorPart?: boolean\n /**\n * Separator of major and minor part of amount\n */\n separator?: string\n /**\n * International code of currency.\n */\n currency?: keyof typeof CurrencyCodes | string\n /**\n * Use Header component for display amount\n */\n isHeader?: boolean\n /**\n * Amount is not valid and will be crossed out with ```text-decoration: line-through```\n */\n crossedOut?: boolean\n /**\n * If need only currency symbol\n */\n onlyCurrency?: boolean\n}\n\nconst AMOUNT_MAJOR_PART_SIZE = 3\nconst ZERO_MINOR_PART_REGEXP = /^0+$/\nconst MINUS_SIGN_HTML_CODE = '\\u2212'\n\nfunction createSplitter(partSize: number): (_s: string) => string[] {\n const parts = (str: string): string[] => {\n const { length } = str\n\n if (length <= partSize) {\n return [str]\n }\n\n const from = length - partSize\n const to = length\n\n return [str.slice(from, to)].concat(parts(str.slice(0, from)))\n }\n\n return parts\n}\n\nfunction formatAmount(\n value: AmountProps['value'] = 0,\n digitsAfterPoint: AmountProps['digitsAfterPoint'],\n currencyCode: AmountProps['currency']\n) {\n const isNegative = value < 0\n\n const valueAbs = Math.abs(value)\n const valueAbsStr = valueAbs.toFixed(digitsAfterPoint)\n\n const numberParts = valueAbsStr.split('.')\n const majorPart = numberParts[0]\n const minorPart = numberParts[1]\n\n const amountSplitter = createSplitter(AMOUNT_MAJOR_PART_SIZE)\n\n const majorPartFormatted = amountSplitter(majorPart).reverse().join(' ')\n\n const formattedValueStr = majorPartFormatted + (minorPart ? `,${minorPart}` : '')\n\n return {\n majorPart: majorPartFormatted,\n minorPart,\n value: formattedValueStr,\n isNegative,\n currencySymbol: currencyCode ? Amount.getCurrencySymbol(currencyCode) : '',\n }\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveNamedProperty<'size'>`](#/Миксины)\n */\nexport class Amount extends PureComponent<AmountProps> {\n static displayName = 'Amount'\n static defaultProps = {\n isHeader: false,\n showZeroMinorPart: false,\n crossedOut: false,\n digitsAfterPoint: 2,\n separator: ',',\n onlyCurrency: false,\n }\n\n static getCurrencySymbol(currencyCode: keyof typeof CurrencyCodes | string) {\n return CURRENCY_MAP[currencyCode] || currencyCode\n }\n\n renderMinorPart(minorPart: string) {\n const { showZeroMinorPart, separator } = this.props\n\n let needMinorPart = false\n\n if (minorPart) {\n needMinorPart = true\n\n if (!showZeroMinorPart && ZERO_MINOR_PART_REGEXP.test(minorPart)) {\n needMinorPart = false\n }\n }\n\n if (needMinorPart) {\n return (\n <span className='minor-container'>\n <span className='separator'>{separator}</span>\n <span className='minor'>{minorPart}</span>\n </span>\n )\n }\n\n return null\n }\n\n renderCurrencySymbol = (currencySymbol: string) => (\n <span style={{ position: 'relative' }}>\n {this.props.currency === 'RUR' ? (\n <span\n style={{\n position: 'absolute',\n width: 0,\n opacity: 0,\n visibility: 'hidden',\n }}\n >\n руб.\n </span>\n ) : null}\n <span>{` ${currencySymbol}`}</span>\n </span>\n )\n\n render() {\n const { value, digitsAfterPoint, currency, isHeader, className, style, crossedOut, onlyCurrency, ...rest } =\n this.props\n\n const { majorPart, minorPart, isNegative, currencySymbol } = formatAmount(value, digitsAfterPoint, currency)\n\n const classNames = cx('amount', className)\n\n const amountInner = (\n <Styled.Root className={classNames} style={style} crossedOut={crossedOut}>\n {!onlyCurrency ? (\n <>\n <span className='major'>\n {isNegative && MINUS_SIGN_HTML_CODE}\n {majorPart}\n </span>\n {this.renderMinorPart(minorPart)}\n </>\n ) : null}\n {currency && this.renderCurrencySymbol(currencySymbol)}\n </Styled.Root>\n )\n\n const Element = isHeader ? Text.Heading : Text\n\n return (\n <Element {...rest} as='span'>\n {amountInner}\n </Element>\n )\n }\n}\n"],"names":["ZERO_MINOR_PART_REGEXP","createSplitter","partSize","parts","str","length","from","slice","concat","Amount","PureComponent","constructor","super","arguments","this","renderCurrencySymbol","currencySymbol","_jsxs","style","position","children","props","currency","_jsx","width","opacity","visibility","static","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","showZeroMinorPart","separator","needMinorPart","test","className","render","_this$props","value","digitsAfterPoint","isHeader","crossedOut","onlyCurrency","rest","_objectWithoutProperties","_excluded","majorPart","isNegative","r","e","t","undefined","numberParts","Math","abs","toFixed","split","majorPartFormatted","reverse","join","formattedValueStr","getCurrencySymbol","classNames","cx","amountInner","Styled.Root","_Fragment","Text","Heading","_objectSpread","as","displayName","defaultProps"],"mappings":"6cA8CA,IAAMA,EAAyB,OAG/B,SAASC,EAAeC,GACtB,IAAMC,EAASC,IACb,IAAMC,OAAEA,GAAWD,EAEnB,GAAIC,GAAUH,EACZ,MAAO,CAACE,GAGV,IAAME,EAAOD,EAASH,EAGtB,MAAO,CAACE,EAAIG,MAAMD,EAFPD,IAEkBG,OAAOL,EAAMC,EAAIG,MAAM,EAAGD,MAGzD,OAAOH,EAsCF,MAAMM,UAAeC,EAA2BC,cAAAC,SAAAC,WAAAC,KAwCrDC,qBAAwBC,GACtBC,EAAA,OAAA,CAAMC,MAAO,CAAEC,SAAU,YAAzBC,SAAA,CAC2B,QAAxBN,KAAKO,MAAMC,SACVC,EAAA,OAAA,CACEL,MAAO,CACLC,SAAU,WACVK,MAAO,EACPC,QAAS,EACTC,WAAY,UALhBN,SAAA,SAUE,KACJG,EAAA,OAAA,CAAAH,SAAA,IAAAZ,OAAWQ,QA3CSW,yBAACC,GACvB,OAAOC,EAAaD,IAAiBA,EAGvCE,gBAAgBC,GACd,IAAMC,kBAAEA,EAAFC,UAAqBA,GAAcnB,KAAKO,MAE9C,IAAIa,GAAAA,EAUJ,OARIH,IACFG,MAEKF,GAAqBhC,EAAuBmC,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAjB,EAAA,OAAA,CAAMmB,UAAU,kBAAhBhB,SACE,CAAAG,EAAA,OAAA,CAAMa,UAAU,YAAhBhB,SAA6Ba,IAC7BV,EAAA,OAAA,CAAMa,UAAU,QAAhBhB,SAAyBW,OAKxB,KAqBTM,SACE,IAAAC,EACExB,KAAKO,OADDkB,MAAEA,EAAFC,iBAASA,EAATlB,SAA2BA,EAA3BmB,SAAqCA,EAArCL,UAA+CA,EAA/ClB,MAA0DA,EAA1DwB,WAAiEA,EAAjEC,aAA6EA,GAAnFL,EAAoGM,EAApGC,EAAAP,EAAAQ,GAGA,IAAMC,UAAEA,EAAFhB,UAAaA,EAAbiB,WAAwBA,EAAxBhC,eAAoCA,GAjG9C,SAAAiC,EAAAC,EAAAC,GAIE,IAHAZ,+BADFU,EAAAA,EACgC,EAG9B,IAFAT,EAEA3B,UAAAR,OAAA,EAJF6C,SAIE,IADAtB,EACAf,UAAAR,OAAA,EAJF8C,OAIEC,EACA,IAAMJ,EAAaT,EAAQ,EAK3B,IAAMc,EAHWC,KAAKC,IAAIhB,GACGiB,QAAQhB,GAELiB,MAAM,KACtC,IAAMV,EAAYM,EAAY,GAC9B,IAAMtB,EAAYsB,EAAY,GAI9B,IAAMK,EAFiBzD,EAnCM,EAmCNA,CAEmB8C,GAAWY,UAAUC,KAAK,KAEpE,IAAMC,EAAoBH,GAAsB3B,EAAgBA,IAAAA,OAAAA,GAAc,IAE9E,MAAO,CACLgB,UAAWW,EACX3B,UAAAA,EACAQ,MAAOsB,EACPb,WAAAA,EACAhC,eAAgBY,EAAenB,EAAOqD,kBAAkBlC,GAAgB,IAzB5E,CAiG8EW,EAAOC,EAAkBlB,GAEnG,IAAMyC,EAAaC,EAAG,SAAU5B,GAEhC,IAAM6B,EACJhD,EAACiD,EAAD,CAAa9B,UAAW2B,EAAY7C,MAAOA,EAAOwB,WAAYA,EAA9DtB,SACG,CAACuB,EAQE,KAPF1B,EAAAkD,EAAA,CAAA/C,SACE,CAAAH,EAAA,OAAA,CAAMmB,UAAU,QAAhBhB,SAAA,CACG4B,GA7Hc,IA8HdD,KAEFjC,KAAKgB,gBAAgBC,MAGzBT,GAAYR,KAAKC,qBAAqBC,MAM3C,OACEO,EAHckB,EAAW2B,EAAKC,QAAUD,EAGxCE,EAAAA,EAAA,GAAa1B,GAAb,GAAA,CAAmB2B,GAAG,OAAtBnD,SACG6C,MArFIxD,EACJ+D,YAAc,SADV/D,EAEJgE,aAAe,CACpBhC,UAAAA,EACAT,mBAAmB,EACnBU,cACAF,iBAAkB,EAClBP,UAAW,IACXU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arrow.js","sources":["../../../../src/components/Arrow/Arrow.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { BaseProps } from '../../shared/interfaces'\nimport ArrowSvg from './images/arrow.module.svg'\nimport * as Styled from './style'\n\nconst DIR_MAP = {\n top: 0,\n right: 90,\n bottom: 180,\n left: 270,\n}\n\nexport interface ArrowProps extends BaseProps {\n /**\n * Size of icon\n */\n size?: 'xs' | 'm' | 'l'\n /**\n * Direction arrow\n */\n top?: boolean\n /**\n * Direction arrow\n */\n right?: boolean\n /**\n * Direction arrow\n */\n bottom?: boolean\n /**\n * Direction arrow\n */\n left?: boolean\n inverse?: boolean\n outline?: boolean\n disabled?: boolean\n // eslint-disable-next-line no-unused-vars\n onClick?(event: React.MouseEvent<HTMLButtonElement>): void\n}\n\n/* eslint-disable react/prefer-stateless-function */\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n */\nexport class Arrow extends PureComponent<ArrowProps> {\n static displayName = 'Arrow'\n static defaultProps = {\n size: 'l',\n top: false,\n right: false,\n bottom: false,\n left: false,\n inverse: false,\n outline: false,\n disabled: false,\n onClick: () =>
|
|
1
|
+
{"version":3,"file":"Arrow.js","sources":["../../../../src/components/Arrow/Arrow.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { BaseProps } from '../../shared/interfaces'\nimport ArrowSvg from './images/arrow.module.svg'\nimport * as Styled from './style'\n\nconst DIR_MAP = {\n top: 0,\n right: 90,\n bottom: 180,\n left: 270,\n}\n\nexport interface ArrowProps extends BaseProps {\n /**\n * Size of icon\n */\n size?: 'xs' | 'm' | 'l'\n /**\n * Direction arrow\n */\n top?: boolean\n /**\n * Direction arrow\n */\n right?: boolean\n /**\n * Direction arrow\n */\n bottom?: boolean\n /**\n * Direction arrow\n */\n left?: boolean\n inverse?: boolean\n outline?: boolean\n disabled?: boolean\n // eslint-disable-next-line no-unused-vars\n onClick?(event: React.MouseEvent<HTMLButtonElement>): void\n}\n\n/* eslint-disable react/prefer-stateless-function */\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n */\nexport class Arrow extends PureComponent<ArrowProps> {\n static displayName = 'Arrow'\n static defaultProps = {\n size: 'l',\n top: false,\n right: false,\n bottom: false,\n left: false,\n inverse: false,\n outline: false,\n disabled: false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClick: () => {},\n }\n\n onClickHandler = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n const { disabled, onClick } = this.props\n\n if (!disabled && typeof onClick === 'function') {\n onClick(event)\n }\n }\n\n render() {\n const {\n top,\n right,\n bottom,\n left,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onClick, // eslint-disable-line no-unused-vars\n ...restProps\n } = this.props\n\n const arrowDir = {\n top: top && !bottom,\n right: right && !left,\n bottom: bottom && !top,\n left: left && !right,\n }\n\n const isMultiDir = Object.values(arrowDir).filter((value) => value === true).length > 1\n\n const rotateDeg =\n Object.keys(arrowDir).reduce((acc, key) => (arrowDir[key] ? acc + DIR_MAP[key] : acc), 0) / (isMultiDir ? 2 : 1)\n\n const arrowStyle = {\n transform: `rotate(${rotateDeg}deg)${isMultiDir ? ' translateY(-3px)' : ''}`,\n }\n\n return (\n <Styled.Root {...restProps} onClick={this.onClickHandler}>\n <span>\n <ArrowSvg style={arrowStyle} />\n </span>\n </Styled.Root>\n )\n }\n}\n"],"names":["DIR_MAP","top","right","bottom","left","Arrow","PureComponent","constructor","super","arguments","this","onClickHandler","event","preventDefault","disabled","onClick","props","render","_this$props","restProps","_objectWithoutProperties","_excluded","arrowDir","isMultiDir","Object","values","filter","value","length","rotateDeg","keys","reduce","acc","key","arrowStyle","transform","concat","_jsx","Styled.Root","children","ArrowSvg","style","displayName","defaultProps","size","inverse","outline"],"mappings":"8TAKA,IAAMA,EAAU,CACdC,IAAK,EACLC,MAAO,GACPC,OAAQ,IACRC,KAAM,KAqCD,MAAMC,UAAcC,EAA0BC,cAAAC,SAAAC,WAAAC,KAenDC,eAAkBC,IAChBA,EAAMC,iBACN,IAAMC,SAAEA,EAAFC,QAAYA,GAAYL,KAAKM,MAE9BF,GAA+B,mBAAZC,GACtBA,EAAQH,IAIZK,SACE,IAAAC,EAQIR,KAAKM,OARHf,IACJA,EADIC,MAEJA,EAFIC,OAGJA,EAHIC,KAIJA,GAJFc,EAOKC,EAPLC,EAAAF,EAAAG,GAUA,IAAMC,EAAW,CACfrB,IAAKA,IAAQE,EACbD,MAAOA,IAAUE,EACjBD,OAAQA,IAAWF,EACnBG,KAAMA,IAASF,GAGjB,IAAMqB,EAAaC,OAAOC,OAAOH,GAAUI,QAAQC,IAAoB,IAAVA,IAAgBC,OAAS,EAEtF,IAAMC,EACJL,OAAOM,KAAKR,GAAUS,SAAQC,EAAKC,IAASX,EAASW,GAAOD,EAAMhC,EAAQiC,GAAOD,GAAM,IAAMT,EAAa,EAAI,GAEhH,IAAMW,EAAa,CACjBC,2BAAqBN,EAAZ,QAAAO,OAA4Bb,EAAa,oBAAsB,KAG1E,OACEc,EAACC,SAAgBnB,GAAjB,GAAA,CAA4BJ,QAASL,KAAKC,eAA1C4B,SACEF,EAAA,OAAA,CAAAE,SACEF,EAACG,EAAD,CAAUC,MAAOP,UAtDd7B,EACJqC,YAAc,QADVrC,EAEJsC,aAAe,CACpBC,KAAM,IACN3C,KAAK,EACLC,SACAC,QAAAA,EACAC,MAAM,EACNyC,WACAC,SAAAA,EACAhC,UAAU,EAEVC,QAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import{useTheme as
|
|
1
|
+
import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import s from'clsx';import{useTheme as a}from'styled-components';import{useClassname as l}from'../../hooks/useClassname.js';import{CheckboxGroup as t}from'./Group.js';import{Root as i}from'./style.js';import{jsxs as o,jsx as d}from'react/jsx-runtime';var c=["children","disabled","error","id","name","size","value","label","fluid","display","width","className","style"];function h(t){var m=void 0===t.checked;var n=a();var{children:p,disabled:f,error:u,id:b,name:k,size:v,value:x,label:y,fluid:w,display:g,width:C=n.defaultInputControlsWidth,className:j,style:N}=t,z=r(t,c);var B=l(h.displayName);var W=s(B,j,t.checked&&!m?"".concat(B,"--checked"):null);var G="".concat(B,"__label");var P=m?{defaultChecked:t.defaultChecked}:{checked:t.checked};return o(i,{className:W,style:N,disabled:f,error:u,htmlFor:b||k,size:v,fluid:w,width:C,display:g,children:[d("input",e(e({},z),{},{id:b||k,name:k,type:"checkbox",value:x,disabled:f},P)),o("svg",{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:[d("rect",{x:".455",y:".455",width:"19.091",height:"19.091",rx:"5",transform:"translate(0 0)",fill:"#fff",stroke:"#B8B8B8",strokeWidth:"1"}),o("g",{fill:"none",children:[d("rect",{fill:"#48A1E6",width:"20",height:"20",rx:"5"}),d("path",{stroke:"#fff",strokeWidth:"2",d:"M6 9.99l3 3.01 6-6"})]})]}),(y||p)&&d("span",{className:G,children:y||p})]})}h.defaultProps={disabled:!1,size:'medium',display:'inline-flex',onChange:e=>console.log(e,e.target.value)},h.Group=t,h.displayName='Checkbox';export{h as Checkbox};
|
|
2
2
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { SizeInput } from '../../shared/enums/sizeInput'\nimport { BaseProps } from '../../shared/interfaces'\nimport { CheckboxGroup } from './Group'\nimport * as Styled from './style'\n\ntype CheckboxInputHtmlAttributes = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'>\n\nexport interface CheckboxProps extends BaseProps, Display, CheckboxInputHtmlAttributes {\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * A checkbox can appear disabled and be unable to change states\n */\n disabled?: boolean\n /**\n * Field can show the data contains errors\n */\n error?: boolean\n /**\n * Whether or not checkbox is checked\n */\n checked?: boolean\n /**\n * Value\n */\n value?: string | number\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * Input element ID\n */\n id?: string\n /**\n * Input element name\n */\n name?: string\n /**\n * Input element label\n */\n label?: string\n /**\n * Checkbox size\n */\n size?: 'small' | 'medium' | 'large' | 'extraLarge' | 's' | 'm' | 'l' | 'xl'\n fluid?: boolean\n /**\n * Width of label. Default is `Theme.defaultInputControlsWidth`\n */\n width?: ResponsiveProperty<'auto' | number | keyof typeof SizeInput>\n}\n\nCheckbox.defaultProps = {\n disabled: false,\n size: 'medium',\n display: 'inline-flex',\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n}\n\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = 'Checkbox'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `React.InputHTMLAttributes<HTMLInputElement>`\n */\nexport function Checkbox(props: typeof Checkbox.defaultProps & CheckboxProps) {\n const uncontrolled = props.checked === undefined\n const theme = useTheme()\n\n const {\n children,\n disabled,\n error,\n id,\n name,\n size,\n value,\n label,\n fluid,\n display,\n width = theme.defaultInputControlsWidth,\n className,\n style,\n ...anotherProps\n } = props\n\n const inputProps = uncontrolled ? { defaultChecked: props.defaultChecked } : { checked: props.checked }\n\n return (\n <Styled.Root\n className={
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import cx from 'clsx'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { SizeInput } from '../../shared/enums/sizeInput'\nimport { BaseProps } from '../../shared/interfaces'\nimport { CheckboxGroup } from './Group'\nimport * as Styled from './style'\n\ntype CheckboxInputHtmlAttributes = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'>\n\nexport interface CheckboxProps extends BaseProps, Display, CheckboxInputHtmlAttributes {\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * A checkbox can appear disabled and be unable to change states\n */\n disabled?: boolean\n /**\n * Field can show the data contains errors\n */\n error?: boolean\n /**\n * Whether or not checkbox is checked\n */\n checked?: boolean\n /**\n * Value\n */\n value?: string | number\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * Input element ID\n */\n id?: string\n /**\n * Input element name\n */\n name?: string\n /**\n * Input element label\n */\n label?: string\n /**\n * Checkbox size\n */\n size?: 'small' | 'medium' | 'large' | 'extraLarge' | 's' | 'm' | 'l' | 'xl'\n fluid?: boolean\n /**\n * Width of label. Default is `Theme.defaultInputControlsWidth`\n */\n width?: ResponsiveProperty<'auto' | number | keyof typeof SizeInput>\n}\n\nCheckbox.defaultProps = {\n disabled: false,\n size: 'medium',\n display: 'inline-flex',\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n}\n\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = 'Checkbox'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `React.InputHTMLAttributes<HTMLInputElement>`\n */\nexport function Checkbox(props: typeof Checkbox.defaultProps & CheckboxProps) {\n const uncontrolled = props.checked === undefined\n const theme = useTheme()\n\n const {\n children,\n disabled,\n error,\n id,\n name,\n size,\n value,\n label,\n fluid,\n display,\n width = theme.defaultInputControlsWidth,\n className,\n style,\n ...anotherProps\n } = props\n\n const baseClassName = useClassname(Checkbox.displayName)\n const _className = cx(baseClassName, className, props.checked && !uncontrolled ? `${baseClassName}--checked` : null)\n const _labelClassName = `${baseClassName}__label`\n\n const inputProps = uncontrolled ? { defaultChecked: props.defaultChecked } : { checked: props.checked }\n\n return (\n <Styled.Root\n className={_className}\n style={style}\n disabled={disabled}\n error={error}\n htmlFor={id || name}\n size={size}\n fluid={fluid}\n width={width}\n display={display}\n >\n <input\n {...anotherProps}\n id={id || name}\n name={name}\n type='checkbox'\n value={value}\n disabled={disabled}\n {...inputProps}\n />\n <svg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'>\n <rect\n x='.455'\n y='.455'\n width='19.091'\n height='19.091'\n rx='5'\n transform='translate(0 0)'\n fill='#fff'\n stroke='#B8B8B8'\n strokeWidth='1'\n />\n <g fill='none'>\n <rect fill='#48A1E6' width='20' height='20' rx='5' />\n <path stroke='#fff' strokeWidth='2' d='M6 9.99l3 3.01 6-6' />\n </g>\n </svg>\n {(label || children) && <span className={_labelClassName}>{label || children}</span>}\n </Styled.Root>\n )\n}\n"],"names":["Checkbox","props","uncontrolled","undefined","checked","theme","useTheme","children","disabled","error","id","name","size","value","label","fluid","display","width","defaultInputControlsWidth","className","style","anotherProps","_excluded","baseClassName","useClassname","displayName","_className","cx","_labelClassName","inputProps","defaultChecked","_jsxs","Styled.Root","htmlFor","_jsx","type","viewBox","xmlns","x","y","height","rx","transform","fill","stroke","strokeWidth","d","defaultProps","onChange","e","console","log","target","Group","CheckboxGroup"],"mappings":"oeA4EO,SAASA,EAASC,GACvB,IAAMC,OAAiCC,IAAlBF,EAAMG,QAC3B,IAAMC,EAAQC,IAEd,IAAMC,SACJA,EADIC,SAEJA,EAFIC,MAGJA,EAHIC,GAIJA,EAJIC,KAKJA,EALIC,KAMJA,EANIC,MAOJA,EAPIC,MAQJA,EARIC,MASJA,EATIC,QAUJA,EAVIC,MAWJA,EAAQZ,EAAMa,0BAXVC,UAYJA,EAZIC,MAaJA,GAEEnB,EADCoB,IACDpB,EAfJqB,GAiBA,IAAMC,EAAgBC,EAAaxB,EAASyB,aAC5C,IAAMC,EAAaC,EAAGJ,EAAeJ,EAAWlB,EAAMG,UAAYF,YAAkBqB,EAApC,aAA+D,MAC/G,IAAMK,EAAqBL,GAAAA,OAAAA,EAA3B,WAEA,IAAMM,EAAa3B,EAAe,CAAE4B,eAAgB7B,EAAM6B,gBAAmB,CAAE1B,QAASH,EAAMG,SAE9F,OACE2B,EAACC,EAAD,CACEb,UAAWO,EACXN,MAAOA,EACPZ,SAAUA,EACVC,MAAOA,EACPwB,QAASvB,GAAMC,EACfC,KAAMA,EACNG,MAAOA,EACPE,MAAOA,EACPD,QAASA,EATXT,SAAA,CAWE2B,iBACMb,GADN,GAAA,CAEEX,GAAIA,GAAMC,EACVA,KAAMA,EACNwB,KAAK,WACLtB,MAAOA,EACPL,SAAUA,GACNqB,IAENE,EAAA,MAAA,CAAKK,QAAQ,YAAYC,MAAM,6BAA/B9B,SACE,CAAA2B,EAAA,OAAA,CACEI,EAAE,OACFC,EAAE,OACFtB,MAAM,SACNuB,OAAO,SACPC,GAAG,IACHC,UAAU,iBACVC,KAAK,OACLC,OAAO,UACPC,YAAY,MAEdd,EAAA,IAAA,CAAGY,KAAK,OAARpC,SACE,CAAA2B,EAAA,OAAA,CAAMS,KAAK,UAAU1B,MAAM,KAAKuB,OAAO,KAAKC,GAAG,MAC/CP,EAAA,OAAA,CAAMU,OAAO,OAAOC,YAAY,IAAIC,EAAE,8BAGxChC,GAASP,IAAa2B,EAAA,OAAA,CAAMf,UAAWS,EAAjBrB,SAAmCO,GAASP,OAjF1EP,EAAS+C,aAAe,CACtBvC,UAAAA,EACAI,KAAM,SACNI,QAAS,cACTgC,SAAWC,GAA2CC,QAAQC,IAAIF,EAAGA,EAAEG,OAAOvC,QAGhFb,EAASqD,MAAQC,EAEjBtD,EAASyB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/taggedTemplateLiteral';import i,{css as o}from'styled-components';import r from'tinycolor2';import{screenMaxS as n}from'../../mixins/screen.js';import{responsiveProperty as l}from'../../mixins/responsive-property.js';var t;var s=function(e){var i=arguments.length>0&&void 0!==e?e:14;return o(["font-size:","px;svg{width:","px;height:","px;}"],i,i,i)};var a=o(["cursor:not-allowed;color:#d4d4d4;svg{circle:nth-child(1){stroke:#d4d4d4;}circle:nth-child(2){fill:#d4d4d4;}}span
|
|
1
|
+
import e from'@babel/runtime/helpers/taggedTemplateLiteral';import i,{css as o}from'styled-components';import r from'tinycolor2';import{screenMaxS as n}from'../../mixins/screen.js';import{responsiveProperty as l}from'../../mixins/responsive-property.js';var t;var s=function(e){var i=arguments.length>0&&void 0!==e?e:14;return o(["font-size:","px;svg{width:","px;height:","px;}"],i,i,i)};var a=o(["cursor:not-allowed;color:#d4d4d4;svg{circle:nth-child(1){stroke:#d4d4d4;}circle:nth-child(2){fill:#d4d4d4;}}& > span{cursor:not-allowed;}"]);var p=o(["svg{> rect{fill:",";stroke:",";}g > rect{fill:",";}}"],(e=>r(e.theme.colors.pomegranate).setAlpha(.1).toString()),(e=>e.theme.colors.pomegranate),(e=>e.theme.colors.pomegranate));var d=i.label.withConfig({shouldForwardProp:e=>['children','htmlFor'].includes(e)}).withConfig({componentId:"fox-ui__sc-9s6oap-0"})(["display:inline-flex;align-items:baseline;user-select:none;cursor:pointer;width:auto;svg{position:relative;top:2px;flex-shrink:0;g{opacity:0;transition:all 0.2s ease;}}& + &{margin-left:15px;}input{display:none;appearance:none;&:checked + svg{g{opacity:1;transform:scale(1);}}}> span{margin-left:10px;cursor:pointer;}"," "," "," "," "," "," "," ",""],(e=>'small'===e.size||'s'===e.size?s(14):null),(e=>'medium'===e.size||'m'===e.size?s(16):null),(e=>'large'===e.size||'l'===e.size?s(18):null),(e=>'extraLarge'===e.size||'xl'===e.size?s(20):null),(e=>e.disabled?a:null),(e=>e.error?p:null),(e=>l('width',e.fluid&&'auto'!==e.width?'max-width':'width')),(e=>e.fluid?o(["width:100%;"]):null));var m=i.div.withConfig({shouldForwardProp:e=>'inline'!==e}).withConfig({componentId:"fox-ui__sc-9s6oap-1"})(["display:flex;flex-direction:column;line-height:normal;> ","{margin-left:0;&:not(:first-child){margin-top:15px;}}",""],d,(i=>i.inline?o(["flex-direction:row;&&& > ","{margin-top:0;}> "," + ","{margin-left:15px;}",""],d,d,d,n()(t||(t=e(["\n flex-direction: column;\n > &{Root} {\n margin-top: 0;\n }\n > "," + "," {\n margin-left: 0;\n margin-top: 15px;\n }\n "])),d,d)):null));export{m as Group,d as Root};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Checkbox/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { screenMaxS } from 'mixins/screen'\nimport { responsiveProperty } from '../../mixins/responsive-property'\nimport { CheckboxGroupProps } from './Group'\nimport { CheckboxProps } from './Checkbox'\n\nconst sizeCheckbox = (size = 14) => css`\n font-size: ${size}px;\n svg {\n width: ${size}px;\n height: ${size}px;\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n color: #d4d4d4;\n svg {\n circle:nth-child(1) {\n stroke: #d4d4d4;\n }\n circle:nth-child(2) {\n fill: #d4d4d4;\n }\n }\n span
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Checkbox/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { screenMaxS } from 'mixins/screen'\nimport { responsiveProperty } from '../../mixins/responsive-property'\nimport { CheckboxGroupProps } from './Group'\nimport { CheckboxProps } from './Checkbox'\n\nconst sizeCheckbox = (size = 14) => css`\n font-size: ${size}px;\n svg {\n width: ${size}px;\n height: ${size}px;\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n color: #d4d4d4;\n svg {\n circle:nth-child(1) {\n stroke: #d4d4d4;\n }\n circle:nth-child(2) {\n fill: #d4d4d4;\n }\n }\n & > span {\n cursor: not-allowed;\n }\n`\n\nconst error = css`\n svg {\n > rect {\n fill: ${(props) => tinycolor(props.theme.colors.pomegranate).setAlpha(0.1).toString()};\n stroke: ${(props) => props.theme.colors.pomegranate};\n }\n g > rect {\n fill: ${(props) => props.theme.colors.pomegranate};\n }\n }\n`\n\nexport const Root = styled.label.withConfig<CheckboxProps>({\n shouldForwardProp: (prop) => ['children', 'htmlFor'].includes(prop),\n})`\n display: inline-flex;\n align-items: baseline;\n user-select: none;\n cursor: pointer;\n width: auto;\n svg {\n position: relative;\n top: 2px;\n flex-shrink: 0;\n g {\n opacity: 0;\n transition: all 0.2s ease;\n }\n }\n & + & {\n margin-left: 15px;\n }\n input {\n display: none;\n appearance: none;\n &:checked + svg {\n g {\n opacity: 1;\n transform: scale(1);\n }\n }\n }\n > span {\n margin-left: 10px;\n cursor: pointer;\n }\n ${(props) => (props.size === 'small' || props.size === 's' ? sizeCheckbox(14) : null)}\n ${(props) => (props.size === 'medium' || props.size === 'm' ? sizeCheckbox(16) : null)}\n ${(props) => (props.size === 'large' || props.size === 'l' ? sizeCheckbox(18) : null)}\n ${(props) => (props.size === 'extraLarge' || props.size === 'xl' ? sizeCheckbox(20) : null)}\n ${(props) => (props.disabled ? disabled : null)}\n ${(props) => (props.error ? error : null)}\n ${(props) => responsiveProperty('width', props.fluid && props.width !== 'auto' ? 'max-width' : 'width')}\n ${(props) =>\n props.fluid\n ? css`\n width: 100%;\n `\n : null}\n`\n\nexport const Group = styled.div.withConfig<CheckboxGroupProps>({\n shouldForwardProp: (prop) => prop !== 'inline',\n})`\n display: flex;\n flex-direction: column;\n line-height: normal;\n > ${Root} {\n margin-left: 0;\n &:not(:first-child) {\n margin-top: 15px;\n }\n }\n ${(props) =>\n props.inline\n ? css`\n flex-direction: row;\n &&& > ${Root} {\n margin-top: 0;\n }\n > ${Root} + ${Root} {\n margin-left: 15px;\n }\n ${screenMaxS()`\n flex-direction: column;\n > &{Root} {\n margin-top: 0;\n }\n > ${Root} + ${Root} {\n margin-left: 0;\n margin-top: 15px;\n }\n `}\n `\n : null}\n`\n"],"names":["sizeCheckbox","e","size","css","disabled","error","props","tinycolor","theme","colors","pomegranate","setAlpha","toString","Root","styled","label","withConfig","shouldForwardProp","prop","includes","componentId","responsiveProperty","fluid","width","Group","div","inline","screenMaxS","_templateObject","_taggedTemplateLiteral"],"mappings":"oQAOA,IAAMA,EAAe,SAAAC,GAAA,IAACC,+BAADD,EAAAA,EAAQ,GAAR,OAAeE,EACrBD,CAAAA,aAAAA,gBAAAA,aAAAA,QAAAA,EAEFA,EACCA,IAId,IAAME,EAAWD,EAAjB,CAAA,8IAgBA,IAAME,EAAQF,4DAGCG,GAAUC,EAAUD,EAAME,MAAMC,OAAOC,aAAaC,SAAS,IAAKC,aAChEN,GAAUA,EAAME,MAAMC,OAAOC,cAG/BJ,GAAUA,EAAME,MAAMC,OAAOC,cAKrC,IAAMG,EAAOC,EAAOC,MAAMC,WAA0B,CACzDC,kBAAoBC,GAAS,CAAC,WAAY,WAAWC,SAASD,KAD/CF,WAAA,CAAAI,YAAA,uBAAGN,CAAH,CAAA,+TAAA,IAAA,IAAA,IAAA,IAAA,IAAA,IAAA,IAAA,KAkCZR,GAA0B,UAAfA,EAAMJ,MAAmC,MAAfI,EAAMJ,KAAeF,EAAa,IAAM,OAC7EM,GAA0B,WAAfA,EAAMJ,MAAoC,MAAfI,EAAMJ,KAAeF,EAAa,IAAM,OAC9EM,GAA0B,UAAfA,EAAMJ,MAAmC,MAAfI,EAAMJ,KAAeF,EAAa,IAAM,OAC7EM,GAA0B,eAAfA,EAAMJ,MAAwC,OAAfI,EAAMJ,KAAgBF,EAAa,IAAM,OACnFM,GAAWA,EAAMF,SAAWA,EAAW,OACvCE,GAAWA,EAAMD,MAAQA,EAAQ,OACjCC,GAAUe,EAAmB,QAASf,EAAMgB,OAAyB,SAAhBhB,EAAMiB,MAAmB,YAAc,WAC5FjB,GACDA,EAAMgB,MACFnB,EADJ,CAAA,gBAII,OAGD,IAAMqB,EAAQV,EAAOW,IAAIT,WAA+B,CAC7DC,kBAAoBC,GAAkB,WAATA,IADbF,WAAA,CAAAI,YAAA,uBAAGN,CAMfD,CAAAA,2DAAAA,wDAAAA,IAAAA,GAMDP,GACDA,EAAMoB,OACFvB,EADJ,CAAA,4BAAA,oBAAA,MAAA,sBAAA,IAGcU,EAGJA,EAAUA,EAGZc,GAAAA,CATRC,IAAAA,EAAAC,EAAA,CAAA,8HAAA,MAAA,mGAcYhB,EAAUA,IAMlB"}
|
package/components/Icon/Icon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import s
|
|
1
|
+
import{useClassname as s}from'../../hooks/useClassname.js';import{Root as e}from'./style.js';import{defaultIcons as i}from'./icons.js';export{IconNames}from'./icons.js';import{jsxs as o,jsx as l}from'react/jsx-runtime';function n(r){var{name:a,icon:z,svg:t,pointer:c,color:m,size:p,sizeXS:u,sizeS:L,sizeM:S,sizeL:d,sizeXL:y,className:X,style:f,vAlign:j,children:v}=r;var N=s(n.displayName,X);return a&&i[a]?o(e,{vAlign:j,color:m,pointer:c,className:N,size:p,sizeXS:u,sizeS:L,sizeM:S,sizeL:d,sizeXL:y,style:f,children:[l(i[a],{}),v]}):t?l(e,{vAlign:j,color:m,pointer:c,className:N,size:p,sizeXS:u,sizeS:L,sizeM:S,sizeL:d,sizeXL:y,style:f,dangerouslySetInnerHTML:{__html:t||''},children:z||null}):o(e,{vAlign:j,color:m,pointer:c,className:N,size:p,sizeXS:u,sizeS:L,sizeM:S,sizeL:d,sizeXL:y,style:f,children:[z||null,v]})}n.displayName='Icon';export{n as Icon};
|
|
2
2
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import { useClassname } from '../../hooks/useClassname'\nimport { Color } from '../../mixins/color'\nimport { VAlign } from '../../mixins/vAlign'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { BaseProps } from '../../shared/interfaces'\nimport * as Styled from './style'\n\nimport { defaultIcons, IconNames } from './icons'\n\nexport interface IconProps extends BaseProps, Color, VAlign, ResponsiveNamedProperty<'size'> {\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Name of default icon\n */\n name?: keyof typeof IconNames\n /**\n * Object with icon's svg. Use for custom icon insertion with dangerouslySetInnerHTML\n */\n svg?: string\n /**\n * Object with icon's svg. Use for custom icon insertion\n */\n icon?: React.ReactNode\n /**\n * Show pointer cursor on hover?\n */\n pointer?: boolean\n}\n\nIcon.displayName = 'Icon'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`VAlign`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'fontColor'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'size'>`](#/Миксины)\n */\nexport function Icon(props: IconProps) {\n const {\n name,\n icon,\n svg,\n pointer,\n color,\n size,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n className,\n style,\n vAlign,\n children,\n } = props\n\n const _className = useClassname(Icon.displayName, className)\n\n if (name && defaultIcons[name]) {\n const Icon = defaultIcons[name]\n return (\n <Styled.Root\n vAlign={vAlign}\n color={color}\n pointer={pointer}\n className={_className}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n style={style}\n >\n <Icon />\n {children}\n </Styled.Root>\n )\n }\n\n if (svg) {\n return (\n <Styled.Root\n vAlign={vAlign}\n color={color}\n pointer={pointer}\n className={_className}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n style={style}\n dangerouslySetInnerHTML={{ __html: svg || '' }}\n >\n {icon || null}\n </Styled.Root>\n )\n }\n\n return (\n <Styled.Root\n vAlign={vAlign}\n color={color}\n pointer={pointer}\n className={_className}\n size={size}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n style={style}\n >\n {icon || null}\n {children}\n </Styled.Root>\n )\n}\n\nexport { IconNames }\n"],"names":["Icon","props","name","icon","svg","pointer","color","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","className","style","vAlign","children","_className","useClassname","displayName","defaultIcons","_jsxs","Styled.Root","_jsx","dangerouslySetInnerHTML","__html"],"mappings":"2NA0CO,SAASA,EAAKC,GACnB,IAAMC,KACJA,EADIC,KAEJA,EAFIC,IAGJA,EAHIC,QAIJA,EAJIC,MAKJA,EALIC,KAMJA,EANIC,OAOJA,EAPIC,MAQJA,EARIC,MASJA,EATIC,MAUJA,EAVIC,OAWJA,EAXIC,UAYJA,EAZIC,MAaJA,EAbIC,OAcJA,EAdIC,SAeJA,GACEf,EAEJ,IAAMgB,EAAaC,EAAalB,EAAKmB,YAAaN,GAElD,OAAIX,GAAQkB,EAAalB,GAGrBmB,EAACC,EAAD,CACEP,OAAQA,EACRT,MAAOA,EACPD,QAASA,EACTQ,UAAWI,EACXV,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRE,MAAOA,EAXTE,SAAA,CAaEO,EAfSH,EAAalB,GAExB,IAcGc,KAKHZ,EAEAmB,EAACD,EAAD,CACEP,OAAQA,EACRT,MAAOA,EACPD,QAASA,EACTQ,UAAWI,EACXV,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRE,MAAOA,EACPU,wBAAyB,CAAEC,OAAQrB,GAAO,IAZ5CY,SAcGb,GAAQ,OAMbkB,EAACC,EAAD,CACEP,OAAQA,EACRT,MAAOA,EACPD,QAASA,EACTQ,UAAWI,EACXV,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRE,MAAOA,EAXTE,SAAA,CAaGb,GAAQ,KACRa,KAzFPhB,EAAKmB,YAAc"}
|
package/components/Icon/style.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import i,{css as s}from'styled-components';import{vAlign as e}from'../../mixins/vAlign.js';import{color as o}from'../../mixins/color.js';import{property as r,responsiveNamedProperty as n}from'../../mixins/responsive-property.js';var l=s(["cursor:pointer;"]);var t=i.div.withConfig({shouldForwardProp:i=>['children','className','style,
|
|
1
|
+
import i,{css as s}from'styled-components';import{vAlign as e}from'../../mixins/vAlign.js';import{color as o}from'../../mixins/color.js';import{property as r,responsiveNamedProperty as n}from'../../mixins/responsive-property.js';var l=s(["cursor:pointer;"]);var t=i.div.withConfig({shouldForwardProp:i=>['children','className','style','dangerouslySetInnerHTML'].includes(i)}).withConfig({componentId:"fox-ui__sc-yfeniy-0"})(["display:inline-block;flex-shrink:0;vertical-align:baseline;width:1em;height:1em;svg{display:block;width:100%;height:100%;fill:currentColor;}"," "," "," "," ",""],(i=>i.pointer?l:null),(i=>i.vAlign?e(i.vAlign):null),(i=>i.color?o(i.color):null),(i=>i.size?r(i.size,'font-size'):null),(i=>{var{sizeXS:s,sizeS:e,sizeM:o,sizeL:r,sizeXL:l}=i;return n({sizes:{sizeXS:s,sizeS:e,sizeM:o,sizeL:r,sizeXL:l},cssProperty:'font-size'})}));export{t as Root};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Icon/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { vAlign } from '../../mixins/vAlign'\nimport { color } from '../../mixins/color'\nimport { responsiveNamedProperty, property } from '../../mixins/responsive-property'\nimport { IconProps } from './Icon'\n\nconst pointerStyle = css`\n cursor: pointer;\n`\nexport const Root = styled.div.withConfig<IconProps>({\n shouldForwardProp: (prop) => ['children', 'className', 'style, dangerouslySetInnerHTML'].includes(prop),\n})`\n display: inline-block;\n flex-shrink: 0;\n vertical-align: baseline;\n width: 1em;\n height: 1em;\n svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: currentColor;\n }\n ${(props) => (props.pointer ? pointerStyle : null)}\n ${(props) => (props.vAlign ? vAlign(props.vAlign) : null)}\n ${(props) => (props.color ? color(props.color) : null)}\n ${(props) => (props.size ? property(props.size, 'font-size') : null)}\n ${({ sizeXS, sizeS, sizeM, sizeL, sizeXL }) =>\n responsiveNamedProperty({ sizes: { sizeXS, sizeS, sizeM, sizeL, sizeXL }, cssProperty: 'font-size' })}\n`\n"],"names":["pointerStyle","css","Root","styled","div","withConfig","shouldForwardProp","prop","includes","componentId","props","pointer","vAlign","color","size","property","_ref","sizeXS","sizeS","sizeM","sizeL","sizeXL","responsiveNamedProperty","sizes","cssProperty"],"mappings":"qOAMA,IAAMA,EAAeC,EAArB,CAAA,oBAGO,IAAMC,EAAOC,EAAOC,IAAIC,WAAsB,CACnDC,kBAAoBC,GAAS,CAAC,WAAY,YAAa,
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Icon/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { vAlign } from '../../mixins/vAlign'\nimport { color } from '../../mixins/color'\nimport { responsiveNamedProperty, property } from '../../mixins/responsive-property'\nimport { IconProps } from './Icon'\n\nconst pointerStyle = css`\n cursor: pointer;\n`\nexport const Root = styled.div.withConfig<IconProps>({\n shouldForwardProp: (prop) => ['children', 'className', 'style', 'dangerouslySetInnerHTML'].includes(prop),\n})`\n display: inline-block;\n flex-shrink: 0;\n vertical-align: baseline;\n width: 1em;\n height: 1em;\n svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: currentColor;\n }\n ${(props) => (props.pointer ? pointerStyle : null)}\n ${(props) => (props.vAlign ? vAlign(props.vAlign) : null)}\n ${(props) => (props.color ? color(props.color) : null)}\n ${(props) => (props.size ? property(props.size, 'font-size') : null)}\n ${({ sizeXS, sizeS, sizeM, sizeL, sizeXL }) =>\n responsiveNamedProperty({ sizes: { sizeXS, sizeS, sizeM, sizeL, sizeXL }, cssProperty: 'font-size' })}\n`\n"],"names":["pointerStyle","css","Root","styled","div","withConfig","shouldForwardProp","prop","includes","componentId","props","pointer","vAlign","color","size","property","_ref","sizeXS","sizeS","sizeM","sizeL","sizeXL","responsiveNamedProperty","sizes","cssProperty"],"mappings":"qOAMA,IAAMA,EAAeC,EAArB,CAAA,oBAGO,IAAMC,EAAOC,EAAOC,IAAIC,WAAsB,CACnDC,kBAAoBC,GAAS,CAAC,WAAY,YAAa,QAAS,2BAA2BC,SAASD,KADrFF,WAAA,CAAAI,YAAA,uBAAGN,CAcfO,CAAAA,+IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,KAAAA,GAAWA,EAAMC,QAAUX,EAAe,OAC1CU,GAAWA,EAAME,OAASA,EAAOF,EAAME,QAAU,OACjDF,GAAWA,EAAMG,MAAQA,EAAMH,EAAMG,OAAS,OAC9CH,GAAWA,EAAMI,KAAOC,EAASL,EAAMI,KAAM,aAAe,OAC7DE,IAAA,IAACC,OAAEA,EAAFC,MAAUA,EAAVC,MAAiBA,EAAjBC,MAAwBA,EAAxBC,OAA+BA,GAAhCL,EAAA,OACAM,EAAwB,CAAEC,MAAO,CAAEN,OAAAA,EAAQC,MAAAA,EAAOC,MAAAA,EAAOC,MAAAA,EAAOC,OAAAA,GAAUG,YAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'@babel/runtime/helpers/objectSpread2';import a from'@babel/runtime/helpers/objectWithoutProperties';import{useTheme as
|
|
1
|
+
import e from'@babel/runtime/helpers/objectSpread2';import a from'@babel/runtime/helpers/objectWithoutProperties';import r from'clsx';import{useTheme as l}from'styled-components';import{useClassname as s}from'../../hooks/useClassname.js';import{RadioGroup as i}from'./Group.js';import{Root as o}from'./style.js';import{jsxs as d,jsx as t}from'react/jsx-runtime';var c=["children","disabled","error","id","name","size","value","label","className","width","style","fluid","display"];function m(i){var n=void 0===i.checked;var p=l();var{children:u,disabled:h,error:f,id:v,name:b,size:y,value:k,label:x,className:j,width:w=p.defaultInputControlsWidth,style:g,fluid:C,display:N}=i,z=a(i,c);var R=s(m.displayName);var G=r(R,j,i.checked&&!n?"".concat(R,"--checked"):null);var W="".concat(R,"__label");var A=n?{defaultChecked:i.defaultChecked}:{checked:i.checked};return d(o,{className:G,style:g,disabled:h,error:f,htmlFor:v||b,size:y,width:w,display:N,fluid:C,children:[t("input",e(e({},z),{},{id:v||b,name:b,type:"radio",value:k,disabled:h},A)),d("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:[t("circle",{cx:"10",cy:"10",r:"9",stroke:"#727D8A",strokeWidth:"2",fill:"#fff"}),t("circle",{cx:"10",cy:"10",r:"5",fill:"#727D8A"})]}),(x||u)&&t("span",{className:W,children:x||u})]})}m.defaultProps={disabled:!1,size:'medium',display:'inline-flex',onChange:e=>console.log(e,e.target.value)},m.Group=i,m.displayName='Radio';export{m as Radio};
|
|
2
2
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { BaseProps } from '../../shared/interfaces'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { SizeInput } from '../../shared/enums/sizeInput'\nimport { Display } from '../../mixins/display'\nimport { RadioGroup } from './Group'\nimport * as Styled from './style'\n\ntype RadioInputHtmlAttributes = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'>\n\nexport interface RadioProps extends BaseProps, Display, RadioInputHtmlAttributes {\n /**\n * Field id\n */\n id?: string\n /**\n * Field name\n */\n name?: string\n /**\n * Radio label\n */\n label?: string\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * A Radio can appear disabled and be unable to change states\n */\n disabled?: boolean\n /**\n * Field can show the data contains errors\n */\n error?: boolean\n /**\n * Whether or not Radio is checked\n */\n checked?: boolean\n defaultChecked?: boolean\n /**\n * Checkbox size\n */\n size?: 'small' | 'medium' | 'large'\n /**\n * Value\n */\n value?: string | number\n fluid?: boolean\n /**\n * Width of label. Default is `Theme.defaultInputControlsWidth`\n */\n width?: ResponsiveProperty<'auto' | number | keyof typeof SizeInput>\n}\n\nRadio.defaultProps = {\n disabled: false,\n size: 'medium',\n display: 'inline-flex',\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n}\n\nRadio.Group = RadioGroup\nRadio.displayName = 'Radio'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `React.InputHTMLAttributes<HTMLInputElement>`\n */\nexport function Radio(props: typeof Radio.defaultProps & RadioProps) {\n const uncontrolled = props.checked === undefined\n const theme = useTheme()\n const {\n children,\n disabled,\n error,\n id,\n name,\n size,\n value,\n label,\n className,\n width = theme.defaultInputControlsWidth,\n style,\n fluid,\n display,\n ...anotherProps\n } = props\n const
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import cx from 'clsx'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { BaseProps } from '../../shared/interfaces'\nimport { ResponsiveProperty } from '../../mixins/responsive-property'\nimport { SizeInput } from '../../shared/enums/sizeInput'\nimport { Display } from '../../mixins/display'\nimport { RadioGroup } from './Group'\nimport * as Styled from './style'\n\ntype RadioInputHtmlAttributes = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'>\n\nexport interface RadioProps extends BaseProps, Display, RadioInputHtmlAttributes {\n /**\n * Field id\n */\n id?: string\n /**\n * Field name\n */\n name?: string\n /**\n * Radio label\n */\n label?: string\n /**\n * On change handler\n */\n onChange?(_e: React.ChangeEvent<HTMLInputElement>): void\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * A Radio can appear disabled and be unable to change states\n */\n disabled?: boolean\n /**\n * Field can show the data contains errors\n */\n error?: boolean\n /**\n * Whether or not Radio is checked\n */\n checked?: boolean\n defaultChecked?: boolean\n /**\n * Checkbox size\n */\n size?: 'small' | 'medium' | 'large'\n /**\n * Value\n */\n value?: string | number\n fluid?: boolean\n /**\n * Width of label. Default is `Theme.defaultInputControlsWidth`\n */\n width?: ResponsiveProperty<'auto' | number | keyof typeof SizeInput>\n}\n\nRadio.defaultProps = {\n disabled: false,\n size: 'medium',\n display: 'inline-flex',\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => console.log(e, e.target.value), // eslint-disable-line no-console\n}\n\nRadio.Group = RadioGroup\nRadio.displayName = 'Radio'\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - `React.InputHTMLAttributes<HTMLInputElement>`\n */\nexport function Radio(props: typeof Radio.defaultProps & RadioProps) {\n const uncontrolled = props.checked === undefined\n const theme = useTheme()\n\n const {\n children,\n disabled,\n error,\n id,\n name,\n size,\n value,\n label,\n className,\n width = theme.defaultInputControlsWidth,\n style,\n fluid,\n display,\n ...anotherProps\n } = props\n\n const baseClassName = useClassname(Radio.displayName)\n const _className = cx(baseClassName, className, props.checked && !uncontrolled ? `${baseClassName}--checked` : null)\n const _labelClassName = `${baseClassName}__label`\n\n const inputProps = uncontrolled ? { defaultChecked: props.defaultChecked } : { checked: props.checked }\n\n return (\n <Styled.Root\n className={_className}\n style={style}\n disabled={disabled}\n error={error}\n htmlFor={id || name}\n size={size}\n width={width}\n display={display}\n fluid={fluid}\n >\n <input\n {...anotherProps}\n id={id || name}\n name={name}\n type='radio'\n value={value}\n disabled={disabled}\n {...inputProps}\n />\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'>\n <circle cx='10' cy='10' r='9' stroke='#727D8A' strokeWidth='2' fill='#fff' />\n <circle cx='10' cy='10' r='5' fill='#727D8A' />\n </svg>\n {(label || children) && <span className={_labelClassName}>{label || children}</span>}\n </Styled.Root>\n )\n}\n"],"names":["Radio","props","uncontrolled","undefined","checked","theme","useTheme","children","disabled","error","id","name","size","value","label","className","width","defaultInputControlsWidth","style","fluid","display","anotherProps","_excluded","baseClassName","useClassname","displayName","_className","cx","_labelClassName","inputProps","defaultChecked","_jsxs","Styled.Root","htmlFor","_jsx","type","xmlns","viewBox","cy","r","stroke","strokeWidth","fill","defaultProps","onChange","e","console","log","target","Group","RadioGroup"],"mappings":"ieA4EO,SAASA,EAAMC,GACpB,IAAMC,OAAiCC,IAAlBF,EAAMG,QAC3B,IAAMC,EAAQC,IAEd,IAAMC,SACJA,EADIC,SAEJA,EAFIC,MAGJA,EAHIC,GAIJA,EAJIC,KAKJA,EALIC,KAMJA,EANIC,MAOJA,EAPIC,MAQJA,EARIC,UASJA,EATIC,MAUJA,EAAQX,EAAMY,0BAVVC,MAWJA,EAXIC,MAYJA,EAZIC,QAaJA,GAEEnB,EADCoB,IACDpB,EAfJqB,GAiBA,IAAMC,EAAgBC,EAAaxB,EAAMyB,aACzC,IAAMC,EAAaC,EAAGJ,EAAeR,EAAWd,EAAMG,UAAYF,YAAkBqB,EAApC,aAA+D,MAC/G,IAAMK,EAAqBL,GAAAA,OAAAA,EAA3B,WAEA,IAAMM,EAAa3B,EAAe,CAAE4B,eAAgB7B,EAAM6B,gBAAmB,CAAE1B,QAASH,EAAMG,SAE9F,OACE2B,EAACC,EAAD,CACEjB,UAAWW,EACXR,MAAOA,EACPV,SAAUA,EACVC,MAAOA,EACPwB,QAASvB,GAAMC,EACfC,KAAMA,EACNI,MAAOA,EACPI,QAASA,EACTD,MAAOA,EATTZ,SAAA,CAWE2B,iBACMb,GADN,GAAA,CAEEX,GAAIA,GAAMC,EACVA,KAAMA,EACNwB,KAAK,QACLtB,MAAOA,EACPL,SAAUA,GACNqB,IAENE,EAAA,MAAA,CAAKK,MAAM,6BAA6BC,QAAQ,YAAhD9B,SACE,CAAA2B,EAAA,SAAA,CAAQP,GAAG,KAAKW,GAAG,KAAKC,EAAE,IAAIC,OAAO,UAAUC,YAAY,IAAIC,KAAK,SACpER,EAAA,SAAA,CAAQP,GAAG,KAAKW,GAAG,KAAKC,EAAE,IAAIG,KAAK,gBAEnC5B,GAASP,IAAa2B,EAAA,OAAA,CAAMnB,UAAWa,EAAjBrB,SAAmCO,GAASP,OAnE1EP,EAAM2C,aAAe,CACnBnC,UAAU,EACVI,KAAM,SACNQ,QAAS,cACTwB,SAAWC,GAA2CC,QAAQC,IAAIF,EAAGA,EAAEG,OAAOnC,QAGhFb,EAAMiD,MAAQC,EACdlD,EAAMyB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import i from'@babel/runtime/helpers/taggedTemplateLiteral';import l,{css as e}from'styled-components';import{screenMaxS as n}from'../../mixins/screen.js';import{responsiveProperty as r}from'../../mixins/responsive-property.js';import{display as o}from'../../mixins/display.js';var t;var a=function(i){var l=arguments.length>0&&void 0!==i?i:14;return e(["font-size:","px;svg{width:","px;height:","px;}"],l,l,l)};var s=e(["cursor:not-allowed;color:#d4d4d4;svg{circle:nth-child(1){stroke:#d4d4d4;}circle:nth-child(2){fill:#d4d4d4;}}span
|
|
1
|
+
import i from'@babel/runtime/helpers/taggedTemplateLiteral';import l,{css as e}from'styled-components';import{screenMaxS as n}from'../../mixins/screen.js';import{responsiveProperty as r}from'../../mixins/responsive-property.js';import{display as o}from'../../mixins/display.js';var t;var a=function(i){var l=arguments.length>0&&void 0!==i?i:14;return e(["font-size:","px;svg{width:","px;height:","px;}"],l,l,l)};var s=e(["cursor:not-allowed;color:#d4d4d4;svg{circle:nth-child(1){stroke:#d4d4d4;}circle:nth-child(2){fill:#d4d4d4;}}& > span{cursor:not-allowed;}"]);var d=e(["svg{circle{fill:#ffeef0;stroke:#ffa3a3;}circle:nth-child(2){fill:#ffa3a3;}}"]);var c=l.label.withConfig({shouldForwardProp:i=>['children','htmlFor'].includes(i)}).withConfig({componentId:"fox-ui__sc-1u0nc40-0"})(["align-items:baseline;user-select:none;cursor:pointer;width:auto;svg{position:relative;top:2px;flex-shrink:0;circle:nth-child(2){opacity:0;transition:all 0.2s ease;}}& + &{margin-left:15px;}input{display:none;appearance:none;&:checked + svg{circle:nth-child(2){opacity:1;transform:scale(1);}","}}> span{margin-left:10px;cursor:pointer;}"," "," "," "," "," "," "," ",""],(i=>i.error?null:e(["circle:not(:disabled){stroke:#48a1e6;}circle:not(:disabled):last-child{fill:#48a1e6;}"])),(i=>'small'===i.size?a(14):null),(i=>'medium'===i.size?a(16):null),(i=>'large'===i.size?a(18):null),(i=>i.disabled?s:null),(i=>i.error?d:null),(i=>i.display?o(i.display):null),(i=>r('width',i.fluid&&'auto'!==i.width?'max-width':'width')),(i=>i.fluid?e(["width:100%;"]):null));var p=l.div.withConfig({shouldForwardProp:i=>'inline'!==i}).withConfig({componentId:"fox-ui__sc-1u0nc40-1"})(["display:flex;flex-direction:column;line-height:normal;> ","{margin-left:0;&:not(:first-child){margin-top:15px;}}",""],c,(l=>l.inline?e(["flex-direction:row;&&& > ","{margin-top:0;}> "," + ","{margin-left:15px;}",""],c,c,c,n()(t||(t=i(["\n flex-direction: column;\n > &{Root} {\n margin-top: 0;\n }\n > "," + "," {\n margin-left: 0;\n margin-top: 15px;\n }\n "])),c,c)):null));export{p as Group,c as Root};
|
|
2
2
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sources":["../../../../src/components/Radio/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { screenMaxS } from 'mixins/screen'\nimport { responsiveProperty } from '../../mixins/responsive-property'\nimport { display } from '../../mixins/display'\nimport { RadioGroupProps } from './Group'\nimport { RadioProps } from './Radio'\n\nconst sizeRadio = (size = 14) => css`\n font-size: ${size}px;\n svg {\n width: ${size}px;\n height: ${size}px;\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n color: #d4d4d4;\n svg {\n circle:nth-child(1) {\n stroke: #d4d4d4;\n }\n circle:nth-child(2) {\n fill: #d4d4d4;\n }\n }\n span
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Radio/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport { screenMaxS } from 'mixins/screen'\nimport { responsiveProperty } from '../../mixins/responsive-property'\nimport { display } from '../../mixins/display'\nimport { RadioGroupProps } from './Group'\nimport { RadioProps } from './Radio'\n\nconst sizeRadio = (size = 14) => css`\n font-size: ${size}px;\n svg {\n width: ${size}px;\n height: ${size}px;\n }\n`\n\nconst disabled = css`\n cursor: not-allowed;\n color: #d4d4d4;\n svg {\n circle:nth-child(1) {\n stroke: #d4d4d4;\n }\n circle:nth-child(2) {\n fill: #d4d4d4;\n }\n }\n & > span {\n cursor: not-allowed;\n }\n`\n\nconst error = css`\n svg {\n circle {\n fill: #ffeef0;\n stroke: #ffa3a3;\n }\n circle:nth-child(2) {\n fill: #ffa3a3;\n }\n }\n`\n\nexport const Root = styled.label.withConfig<RadioProps>({\n shouldForwardProp: (prop) => ['children', 'htmlFor'].includes(prop),\n})`\n align-items: baseline;\n user-select: none;\n cursor: pointer;\n width: auto;\n svg {\n position: relative;\n top: 2px;\n flex-shrink: 0;\n circle:nth-child(2) {\n opacity: 0;\n transition: all 0.2s ease;\n }\n }\n & + & {\n margin-left: 15px;\n }\n input {\n display: none;\n appearance: none;\n &:checked + svg {\n circle:nth-child(2) {\n opacity: 1;\n transform: scale(1);\n }\n ${(props) =>\n !props.error\n ? css`\n circle:not(:disabled) {\n stroke: #48a1e6;\n }\n circle:not(:disabled):last-child {\n fill: #48a1e6;\n }\n `\n : null}\n }\n }\n > span {\n margin-left: 10px;\n cursor: pointer;\n }\n ${(props) => (props.size === 'small' ? sizeRadio(14) : null)}\n ${(props) => (props.size === 'medium' ? sizeRadio(16) : null)}\n ${(props) => (props.size === 'large' ? sizeRadio(18) : null)}\n ${(props) => (props.disabled ? disabled : null)}\n ${(props) => (props.error ? error : null)}\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => responsiveProperty('width', props.fluid && props.width !== 'auto' ? 'max-width' : 'width')}\n ${(props) =>\n props.fluid\n ? css`\n width: 100%;\n `\n : null}\n`\n\nexport const Group = styled.div.withConfig<RadioGroupProps>({\n shouldForwardProp: (prop) => prop !== 'inline',\n})`\n display: flex;\n flex-direction: column;\n line-height: normal;\n > ${Root} {\n margin-left: 0;\n &:not(:first-child) {\n margin-top: 15px;\n }\n }\n ${(props) =>\n props.inline\n ? css`\n flex-direction: row;\n &&& > ${Root} {\n margin-top: 0;\n }\n > ${Root} + ${Root} {\n margin-left: 15px;\n }\n ${screenMaxS()`\n flex-direction: column;\n > &{Root} {\n margin-top: 0;\n }\n > ${Root} + ${Root} {\n margin-left: 0;\n margin-top: 15px;\n }\n `}\n `\n : null}\n`\n"],"names":["sizeRadio","i","size","css","disabled","error","Root","styled","label","withConfig","shouldForwardProp","prop","includes","componentId","props","display","responsiveProperty","fluid","width","Group","div","inline","screenMaxS","_templateObject","_taggedTemplateLiteral"],"mappings":"4RAOA,IAAMA,EAAY,SAAAC,GAAA,IAACC,+BAADD,EAAAA,EAAQ,GAAR,OAAeE,EAClBD,CAAAA,aAAAA,gBAAAA,aAAAA,QAAAA,EAEFA,EACCA,IAId,IAAME,EAAWD,EAAjB,CAAA,8IAgBA,IAAME,EAAQF,EAAd,CAAA,gFAYO,IAAMG,EAAOC,EAAOC,MAAMC,WAAuB,CACtDC,kBAAoBC,GAAS,CAAC,WAAY,WAAWC,SAASD,KAD/CF,WAAA,CAAAI,YAAA,wBAAGN,CA2BXO,CAAAA,qSAAAA,6CAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,KAAAA,GACAA,EAAMT,MASH,KARAF,EADJ,CAAA,4FAgBHW,GAA0B,UAAfA,EAAMZ,KAAmBF,EAAU,IAAM,OACpDc,GAA0B,WAAfA,EAAMZ,KAAoBF,EAAU,IAAM,OACrDc,GAA0B,UAAfA,EAAMZ,KAAmBF,EAAU,IAAM,OACpDc,GAAWA,EAAMV,SAAWA,EAAW,OACvCU,GAAWA,EAAMT,MAAQA,EAAQ,OACjCS,GAAWA,EAAMC,QAAUA,EAAQD,EAAMC,SAAW,OACpDD,GAAUE,EAAmB,QAASF,EAAMG,OAAyB,SAAhBH,EAAMI,MAAmB,YAAc,WAC5FJ,GACDA,EAAMG,MACFd,EAGA,CAAA,gBAAA,OAGD,IAAMgB,EAAQZ,EAAOa,IAAIX,WAA4B,CAC1DC,kBAAoBC,GAAkB,WAATA,IADbF,WAAA,CAAAI,YAAA,wBAAGN,CAMfD,CAAAA,2DAAAA,wDAAAA,IAAAA,GAMDQ,GACDA,EAAMO,OACFlB,EADJ,CAAA,4BAAA,oBAAA,MAAA,sBAAA,IAGcG,EAGJA,EAAUA,EAGZgB,GAAAA,CATRC,IAAAA,EAAAC,EAAA,CAAA,8HAAA,MAAA,mGAcYlB,EAAUA,IAMlB"}
|
package/dts/index.d.ts
CHANGED
|
@@ -539,7 +539,7 @@ interface IconProps extends BaseProps, Color, VAlign, ResponsiveNamedProperty<'s
|
|
|
539
539
|
*/
|
|
540
540
|
name?: keyof typeof IconNames;
|
|
541
541
|
/**
|
|
542
|
-
* Object with icon's svg. Use for custom icon insertion
|
|
542
|
+
* Object with icon's svg. Use for custom icon insertion with dangerouslySetInnerHTML
|
|
543
543
|
*/
|
|
544
544
|
svg?: string;
|
|
545
545
|
/**
|
|
@@ -724,7 +724,7 @@ interface AmountProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>,
|
|
|
724
724
|
/**
|
|
725
725
|
* International code of currency.
|
|
726
726
|
*/
|
|
727
|
-
currency?: keyof typeof CurrencyCodes;
|
|
727
|
+
currency?: keyof typeof CurrencyCodes | string;
|
|
728
728
|
/**
|
|
729
729
|
* Use Header component for display amount
|
|
730
730
|
*/
|
|
@@ -754,7 +754,7 @@ declare class Amount extends PureComponent<AmountProps> {
|
|
|
754
754
|
separator: string;
|
|
755
755
|
onlyCurrency: boolean;
|
|
756
756
|
};
|
|
757
|
-
static getCurrencySymbol(currencyCode: keyof typeof CurrencyCodes):
|
|
757
|
+
static getCurrencySymbol(currencyCode: keyof typeof CurrencyCodes | string): any;
|
|
758
758
|
renderMinorPart(minorPart: string): JSX.Element | null;
|
|
759
759
|
renderCurrencySymbol: (currencySymbol: string) => JSX.Element;
|
|
760
760
|
render(): JSX.Element;
|
|
@@ -859,7 +859,7 @@ declare class Arrow extends PureComponent<ArrowProps> {
|
|
|
859
859
|
inverse: boolean;
|
|
860
860
|
outline: boolean;
|
|
861
861
|
disabled: boolean;
|
|
862
|
-
onClick: () =>
|
|
862
|
+
onClick: () => void;
|
|
863
863
|
};
|
|
864
864
|
onClickHandler: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
865
865
|
render(): JSX.Element;
|