@foxford/ui 2.66.0 → 2.67.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.
Files changed (70) hide show
  1. package/components/Amount/Amount.js +1 -1
  2. package/components/Amount/Amount.js.map +1 -1
  3. package/components/Amount/Amount.mjs +1 -1
  4. package/components/Amount/Amount.mjs.map +1 -1
  5. package/components/Anchor/Anchor.js +1 -1
  6. package/components/Anchor/Anchor.js.map +1 -1
  7. package/components/Anchor/Anchor.mjs +1 -1
  8. package/components/Anchor/Anchor.mjs.map +1 -1
  9. package/components/Button/Button.js +1 -1
  10. package/components/Button/Button.js.map +1 -1
  11. package/components/Button/Button.mjs +1 -1
  12. package/components/Button/Button.mjs.map +1 -1
  13. package/components/Checkbox/Checkbox.js +1 -1
  14. package/components/Checkbox/Checkbox.js.map +1 -1
  15. package/components/Checkbox/Checkbox.mjs +1 -1
  16. package/components/Checkbox/Checkbox.mjs.map +1 -1
  17. package/components/Dialog/Dialog.js +1 -1
  18. package/components/Dialog/Dialog.js.map +1 -1
  19. package/components/Dialog/Dialog.mjs +1 -1
  20. package/components/Dialog/Dialog.mjs.map +1 -1
  21. package/components/DialogComponent/constants.js +1 -1
  22. package/components/DialogComponent/constants.js.map +1 -1
  23. package/components/DialogComponent/constants.mjs +1 -1
  24. package/components/DialogComponent/constants.mjs.map +1 -1
  25. package/components/Menu/Menu.js +1 -1
  26. package/components/Menu/Menu.js.map +1 -1
  27. package/components/Menu/Menu.mjs +1 -1
  28. package/components/Menu/Menu.mjs.map +1 -1
  29. package/components/Modal/adapter.js +1 -1
  30. package/components/Modal/adapter.js.map +1 -1
  31. package/components/Modal/adapter.mjs +1 -1
  32. package/components/Modal/adapter.mjs.map +1 -1
  33. package/components/Popover/Popover.js +1 -1
  34. package/components/Popover/Popover.js.map +1 -1
  35. package/components/Popover/Popover.mjs +1 -1
  36. package/components/Popover/Popover.mjs.map +1 -1
  37. package/components/Radio/Radio.js +1 -1
  38. package/components/Radio/Radio.js.map +1 -1
  39. package/components/Radio/Radio.mjs +1 -1
  40. package/components/Radio/Radio.mjs.map +1 -1
  41. package/components/Tooltip/Tooltip.js +1 -1
  42. package/components/Tooltip/Tooltip.js.map +1 -1
  43. package/components/Tooltip/Tooltip.mjs +1 -1
  44. package/components/Tooltip/Tooltip.mjs.map +1 -1
  45. package/dts/index.d.ts +12 -13
  46. package/hooks/useClassname.js +1 -1
  47. package/hooks/useClassname.js.map +1 -1
  48. package/hooks/useClassname.mjs +1 -1
  49. package/hooks/useClassname.mjs.map +1 -1
  50. package/hooks/useMergedProps.js +1 -1
  51. package/hooks/useMergedProps.js.map +1 -1
  52. package/hooks/useMergedProps.mjs +1 -1
  53. package/hooks/useMergedProps.mjs.map +1 -1
  54. package/hooks/useMergedSizes.js +1 -1
  55. package/hooks/useMergedSizes.js.map +1 -1
  56. package/hooks/useMergedSizes.mjs +1 -1
  57. package/hooks/useMergedSizes.mjs.map +1 -1
  58. package/package.json +2 -4
  59. package/shared/utils/dom.js +1 -1
  60. package/shared/utils/dom.js.map +1 -1
  61. package/shared/utils/dom.mjs +1 -1
  62. package/shared/utils/dom.mjs.map +1 -1
  63. package/shared/utils/misc.js +1 -1
  64. package/shared/utils/misc.js.map +1 -1
  65. package/shared/utils/misc.mjs +1 -1
  66. package/shared/utils/misc.mjs.map +1 -1
  67. package/theme/theme-provider.js +1 -1
  68. package/theme/theme-provider.js.map +1 -1
  69. package/theme/theme-provider.mjs +1 -1
  70. package/theme/theme-provider.mjs.map +1 -1
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var cx=require('clsx');var index=require('./data/index.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var cx__default=_interopDefault(cx);const ZERO_MINOR_PART_REGEXP=/^0+$/;class Amount extends React.PureComponent{static displayName='Amount';static defaultProps={isHeader:!1,showZeroMinorPart:!1,crossedOut:!1,digitsAfterPoint:2,separator:',',onlyCurrency:!1};static getCurrencySymbol(e){return index.CURRENCY_MAP[e]||e}renderMinorPart(e){const{showZeroMinorPart:t,separator:r}=this.props;let s=!1;return e&&(s=!0,!t&&ZERO_MINOR_PART_REGEXP.test(e)&&(s=!1)),s?jsxRuntime.jsxs("span",{className:"minor-container",children:[jsxRuntime.jsx("span",{className:"separator",children:r}),jsxRuntime.jsx("span",{className:"minor",children:e})]}):null}renderCurrencySymbol=e=>jsxRuntime.jsxs("span",{style:{position:'relative'},children:[this.props.currency==='RUR'?jsxRuntime.jsx("span",{style:{position:'absolute',width:0,opacity:0,visibility:'hidden'},children:"руб."}):null,jsxRuntime.jsx("span",{children:` ${e}`})]});render(){const{value:e,digitsAfterPoint:t,currency:r,isHeader:s,className:n,style:i,crossedOut:a,onlyCurrency:o,...c}=this.props;const{majorPart:u,minorPart:l,isNegative:m,currencySymbol:x}=((e=0,t,r)=>{const s=e<0;const n=Math.abs(e).toFixed(t).split('.');const i=n[0];const a=n[1];const o=(()=>{const parts=e=>{const{length:t}=e;if(t<=3)return[e];const r=t-3;return[e.slice(r,t)].concat(parts(e.slice(0,r)))};return parts})()(i).reverse().join(' ');return{majorPart:o,minorPart:a,value:o+(a?`,${a}`:''),isNegative:s,currencySymbol:r?Amount.getCurrencySymbol(r):''}})(e,t,r);const d=cx__default.default('amount',n);const j=jsxRuntime.jsxs(style.Root,{className:d,style:i,crossedOut:a,children:[o?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"major",children:[m&&"−",u]}),this.renderMinorPart(l)]}),r&&this.renderCurrencySymbol(x)]});return jsxRuntime.jsx(s?Text.Text.Heading:Text.Text,{...c,as:"span",children:j})}}exports.Amount=Amount;
1
+ 'use strict';var React=require('react');var dom=require('../../shared/utils/dom.js');var index=require('./data/index.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');const ZERO_MINOR_PART_REGEXP=/^0+$/;class Amount extends React.PureComponent{static displayName='Amount';static defaultProps={isHeader:!1,showZeroMinorPart:!1,crossedOut:!1,digitsAfterPoint:2,separator:',',onlyCurrency:!1};static getCurrencySymbol(e){return index.CURRENCY_MAP[e]||e}renderMinorPart(e){const{showZeroMinorPart:s,separator:r}=this.props;let t=!1;return e&&(t=!0,!s&&ZERO_MINOR_PART_REGEXP.test(e)&&(t=!1)),t?jsxRuntime.jsxs("span",{className:"minor-container",children:[jsxRuntime.jsx("span",{className:"separator",children:r}),jsxRuntime.jsx("span",{className:"minor",children:e})]}):null}renderCurrencySymbol=e=>jsxRuntime.jsxs("span",{style:{position:'relative'},children:[this.props.currency==='RUR'?jsxRuntime.jsx("span",{style:{position:'absolute',width:0,opacity:0,visibility:'hidden'},children:"руб."}):null,jsxRuntime.jsx("span",{children:` ${e}`})]});render(){const{value:e,digitsAfterPoint:s,currency:r,isHeader:t,className:n,style:i,crossedOut:a,onlyCurrency:o,...c}=this.props;const{majorPart:u,minorPart:l,isNegative:m,currencySymbol:d}=((e=0,s,r)=>{const t=e<0;const n=Math.abs(e).toFixed(s).split('.');const i=n[0];const a=n[1];const o=(()=>{const parts=e=>{const{length:s}=e;if(s<=3)return[e];const r=s-3;return[e.slice(r,s)].concat(parts(e.slice(0,r)))};return parts})()(i).reverse().join(' ');return{majorPart:o,minorPart:a,value:o+(a?`,${a}`:''),isNegative:t,currencySymbol:r?Amount.getCurrencySymbol(r):''}})(e,s,r);const x=dom.concatClassNames('amount',n);const j=jsxRuntime.jsxs(style.Root,{className:x,style:i,crossedOut:a,children:[o?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"major",children:[m&&"−",u]}),this.renderMinorPart(l)]}),r&&this.renderCurrencySymbol(d)]});return jsxRuntime.jsx(t?Text.Text.Heading:Text.Text,{...c,as:"span",children:j})}}exports.Amount=Amount;
2
2
  //# sourceMappingURL=Amount.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Amount.js","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport cx from 'clsx'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends TextProps {\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","Amount","PureComponent","static","isHeader","showZeroMinorPart","crossedOut","digitsAfterPoint","separator","onlyCurrency","getCurrencySymbol","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","this","props","needMinorPart","test","_jsxs","className","children","_jsx","jsx","renderCurrencySymbol","currencySymbol","jsxs","style","position","currency","width","opacity","visibility","render","value","rest","majorPart","isNegative","numberParts","Math","abs","toFixed","split","majorPartFormatted","parts","str","length","from","slice","concat","createSplitter","amountSplitter","reverse","join","formatAmount","classNames","cx","amountInner","Styled","_Fragment","Text","Heading","as"],"mappings":"yTA2CA,MAAMA,uBAAyB,OAuDxB,MAAMC,eAAeC,MAAAA,cAC1BC,mBAAqB,SACrBA,oBAAsB,CACpBC,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,iBAAkB,EAClBC,UAAW,IACXC,cAAc,GAGhB,wBAAOC,CAAkBC,GACvB,OAAOC,MAAYA,aAACD,IAAiBA,CACvC,CAEAE,eAAAA,CAAgBC,GACd,MAAMT,kBAAEA,EAAiBG,UAAEA,GAAcO,KAAKC,MAE9C,IAAIC,GAAgB,EAUpB,OARIH,IACFG,GAAgB,GAEXZ,GAAqBL,uBAAuBkB,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAE,WAAAA,KAAA,OAAA,CAAMC,UAAU,kBAAiBC,UAC/BC,WAAAC,IAAA,OAAA,CAAMH,UAAU,YAAWC,SAAEb,IAC7Bc,WAAAC,IAAA,OAAA,CAAMH,UAAU,QAAOC,SAAEP,OAKxB,IACT,CAEAU,qBAAwBC,GACtBN,WAAAO,KAAA,OAAA,CAAMC,MAAO,CAAEC,SAAU,YAAaP,SAAA,CACnCN,KAAKC,MAAMa,WAAa,MACvBP,WAAAC,IAAA,OAAA,CACEI,MAAO,CACLC,SAAU,WACVE,MAAO,EACPC,QAAS,EACTC,WAAY,UACZX,SACH,SAGC,KACJC,WAAAC,IAAA,O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BC,MAM3C,OACEH,WAAAA,IAHclB,EAAWwD,UAAKC,QAAUD,KAAAA,KAGhC,IAAKzB,EAAM2B,GAAG,OAAMzC,SACzBoC,GAGP"}
1
+ {"version":3,"file":"Amount.js","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { concatClassNames } from 'shared/utils/dom'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends TextProps {\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 = concatClassNames('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","Amount","PureComponent","static","isHeader","showZeroMinorPart","crossedOut","digitsAfterPoint","separator","onlyCurrency","getCurrencySymbol","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","this","props","needMinorPart","test","_jsxs","className","children","_jsx","jsx","renderCurrencySymbol","currencySymbol","jsxs","style","position","currency","width","opacity","visibility","render","value","rest","majorPart","isNegative","numberParts","Math","abs","toFixed","split","majorPartFormatted","parts","str","length","from","slice","concat","createSplitter","amountSplitter","reverse","join","formatAmount","classNames","concatClassNames","amountInner","Styled","_Fragment","Text","Heading","as"],"mappings":"0OA2CA,MAAMA,uBAAyB,OAuDxB,MAAMC,eAAeC,MAAAA,cAC1BC,mBAAqB,SACrBA,oBAAsB,CACpBC,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,iBAAkB,EAClBC,UAAW,IACXC,cAAc,GAGhB,wBAAOC,CAAkBC,GACvB,OAAOC,MAAYA,aAACD,IAAiBA,CACvC,CAEAE,eAAAA,CAAgBC,GACd,MAAMT,kBAAEA,EAAiBG,UAAEA,GAAcO,KAAKC,MAE9C,IAAIC,GAAgB,EAUpB,OARIH,IACFG,GAAgB,GAEXZ,GAAqBL,uBAAuBkB,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAE,WAAAA,KAAA,OAAA,CAAMC,UAAU,kBAAiBC,UAC/BC,WAAAC,IAAA,OAAA,CAAMH,UAAU,YAAWC,SAAEb,IAC7Bc,WAAAC,IAAA,OAAA,CAAMH,UAAU,QAAOC,SAAEP,OAKxB,IACT,CAEAU,qBAAwBC,GACtBN,WAAAO,KAAA,OAAA,CAAMC,MAAO,CAAEC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PFU,WAAAA,KAAAwC,WAAAA,SAAA,CAAAtC,UACEF,WAAAO,KAAA,OAAA,CAAMN,UAAU,QAAOC,SACpBgB,CAAAA,GA7Hc,IA8HdD,KAEFrB,KAAKF,gBAAgBC,MAGzBe,GAAYd,KAAKS,qBAAqBC,MAM3C,OACEH,WAAAA,IAHclB,EAAWwD,UAAKC,QAAUD,KAAAA,KAGhC,IAAKzB,EAAM2B,GAAG,OAAMzC,SACzBoC,GAGP"}
@@ -1,2 +1,2 @@
1
- import{PureComponent}from'react';import cx from'clsx';import{CURRENCY_MAP}from'./data/index.mjs';import{Root}from'./style.mjs';import{jsxs,jsx,Fragment}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';const ZERO_MINOR_PART_REGEXP=/^0+$/;class Amount extends PureComponent{static displayName='Amount';static defaultProps={isHeader:!1,showZeroMinorPart:!1,crossedOut:!1,digitsAfterPoint:2,separator:',',onlyCurrency:!1};static getCurrencySymbol(r){return CURRENCY_MAP[r]||r}renderMinorPart(r){const{showZeroMinorPart:s,separator:t}=this.props;let e=!1;return r&&(e=!0,!s&&ZERO_MINOR_PART_REGEXP.test(r)&&(e=!1)),e?jsxs("span",{className:"minor-container",children:[jsx("span",{className:"separator",children:t}),jsx("span",{className:"minor",children:r})]}):null}renderCurrencySymbol=r=>jsxs("span",{style:{position:'relative'},children:[this.props.currency==='RUR'?jsx("span",{style:{position:'absolute',width:0,opacity:0,visibility:'hidden'},children:"руб."}):null,jsx("span",{children:` ${r}`})]});render(){const{value:r,digitsAfterPoint:s,currency:t,isHeader:e,className:n,style:o,crossedOut:i,onlyCurrency:a,...c}=this.props;const{majorPart:l,minorPart:m,isNegative:u,currencySymbol:d}=((r=0,s,t)=>{const e=r<0;const n=Math.abs(r).toFixed(s).split('.');const o=n[0];const i=n[1];const a=(()=>{const parts=r=>{const{length:s}=r;if(s<=3)return[r];const t=s-3;return[r.slice(t,s)].concat(parts(r.slice(0,t)))};return parts})()(o).reverse().join(' ');return{majorPart:a,minorPart:i,value:a+(i?`,${i}`:''),isNegative:e,currencySymbol:t?Amount.getCurrencySymbol(t):''}})(r,s,t);const p=cx('amount',n);const y=jsxs(Root,{className:p,style:o,crossedOut:i,children:[a?null:jsxs(Fragment,{children:[jsxs("span",{className:"major",children:[u&&"−",l]}),this.renderMinorPart(m)]}),t&&this.renderCurrencySymbol(d)]});return jsx(e?Text.Heading:Text,{...c,as:"span",children:y})}}export{Amount};
1
+ import{PureComponent}from'react';import{concatClassNames}from'../../shared/utils/dom.mjs';import{CURRENCY_MAP}from'./data/index.mjs';import{Root}from'./style.mjs';import{jsxs,jsx,Fragment}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';const ZERO_MINOR_PART_REGEXP=/^0+$/;class Amount extends PureComponent{static displayName='Amount';static defaultProps={isHeader:!1,showZeroMinorPart:!1,crossedOut:!1,digitsAfterPoint:2,separator:',',onlyCurrency:!1};static getCurrencySymbol(r){return CURRENCY_MAP[r]||r}renderMinorPart(r){const{showZeroMinorPart:s,separator:t}=this.props;let e=!1;return r&&(e=!0,!s&&ZERO_MINOR_PART_REGEXP.test(r)&&(e=!1)),e?jsxs("span",{className:"minor-container",children:[jsx("span",{className:"separator",children:t}),jsx("span",{className:"minor",children:r})]}):null}renderCurrencySymbol=r=>jsxs("span",{style:{position:'relative'},children:[this.props.currency==='RUR'?jsx("span",{style:{position:'absolute',width:0,opacity:0,visibility:'hidden'},children:"руб."}):null,jsx("span",{children:` ${r}`})]});render(){const{value:r,digitsAfterPoint:s,currency:t,isHeader:e,className:n,style:o,crossedOut:a,onlyCurrency:i,...c}=this.props;const{majorPart:l,minorPart:m,isNegative:u,currencySymbol:d}=((r=0,s,t)=>{const e=r<0;const n=Math.abs(r).toFixed(s).split('.');const o=n[0];const a=n[1];const i=(()=>{const parts=r=>{const{length:s}=r;if(s<=3)return[r];const t=s-3;return[r.slice(t,s)].concat(parts(r.slice(0,t)))};return parts})()(o).reverse().join(' ');return{majorPart:i,minorPart:a,value:i+(a?`,${a}`:''),isNegative:e,currencySymbol:t?Amount.getCurrencySymbol(t):''}})(r,s,t);const p=concatClassNames('amount',n);const y=jsxs(Root,{className:p,style:o,crossedOut:a,children:[i?null:jsxs(Fragment,{children:[jsxs("span",{className:"major",children:[u&&"−",l]}),this.renderMinorPart(m)]}),t&&this.renderCurrencySymbol(d)]});return jsx(e?Text.Heading:Text,{...c,as:"span",children:y})}}export{Amount};
2
2
  //# sourceMappingURL=Amount.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Amount.mjs","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport cx from 'clsx'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends TextProps {\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","Amount","PureComponent","static","isHeader","showZeroMinorPart","crossedOut","digitsAfterPoint","separator","onlyCurrency","getCurrencySymbol","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","this","props","needMinorPart","test","_jsxs","className","children","_jsx","renderCurrencySymbol","currencySymbol","style","position","currency","width","opacity","visibility","render","value","rest","majorPart","isNegative","numberParts","Math","abs","toFixed","split","majorPartFormatted","parts","str","length","from","slice","concat","createSplitter","amountSplitter","reverse","join","formatAmount","classNames","cx","amountInner","Styled","_Fragment","Text","Heading","as"],"mappings":"mNA2CA,MAAMA,uBAAyB,OAuDxB,MAAMC,eAAeC,cAC1BC,mBAAqB,SACrBA,oBAAsB,CACpBC,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,iBAAkB,EAClBC,UAAW,IACXC,cAAc,GAGhB,wBAAOC,CAAkBC,GACvB,OAAOC,aAAaD,IAAiBA,CACvC,CAEAE,eAAAA,CAAgBC,GACd,MAAMT,kBAAEA,EAAiBG,UAAEA,GAAcO,KAAKC,MAE9C,IAAIC,GAAgB,EAUpB,OARIH,IACFG,GAAgB,GAEXZ,GAAqBL,uBAAuBkB,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAE,KAAA,OAAA,CAAMC,UAAU,kBAAiBC,UAC/BC,IAAA,OAAA,CAAMF,UAAU,YAAWC,SAAEb,IAC7Bc,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ACqC,KAAW,CAACpC,UAAWiC,EAAY5B,MAAOA,EAAOnB,WAAYA,EAAWe,UACrEZ,EAQE,KAPFU,KAAAsC,SAAA,CAAApC,UACEF,KAAA,OAAA,CAAMC,UAAU,QAAOC,SACpBc,CAAAA,GA7Hc,IA8HdD,KAEFnB,KAAKF,gBAAgBC,MAGzBa,GAAYZ,KAAKQ,qBAAqBC,MAM3C,OACEF,IAHclB,EAAWsD,KAAKC,QAAUD,KAGhC,IAAKzB,EAAM2B,GAAG,OAAMvC,SACzBkC,GAGP"}
1
+ {"version":3,"file":"Amount.mjs","sources":["../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { concatClassNames } from 'shared/utils/dom'\nimport { CurrencyCodes, CURRENCY_MAP } from './data'\nimport * as Styled from './style'\n\nexport interface AmountProps extends TextProps {\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 = concatClassNames('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","Amount","PureComponent","static","isHeader","showZeroMinorPart","crossedOut","digitsAfterPoint","separator","onlyCurrency","getCurrencySymbol","currencyCode","CURRENCY_MAP","renderMinorPart","minorPart","this","props","needMinorPart","test","_jsxs","className","children","_jsx","renderCurrencySymbol","currencySymbol","style","position","currency","width","opacity","visibility","render","value","rest","majorPart","isNegative","numberParts","Math","abs","toFixed","split","majorPartFormatted","parts","str","length","from","slice","concat","createSplitter","amountSplitter","reverse","join","formatAmount","classNames","concatClassNames","amountInner","Styled","_Fragment","Text","Heading","as"],"mappings":"uPA2CA,MAAMA,uBAAyB,OAuDxB,MAAMC,eAAeC,cAC1BC,mBAAqB,SACrBA,oBAAsB,CACpBC,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,iBAAkB,EAClBC,UAAW,IACXC,cAAc,GAGhB,wBAAOC,CAAkBC,GACvB,OAAOC,aAAaD,IAAiBA,CACvC,CAEAE,eAAAA,CAAgBC,GACd,MAAMT,kBAAEA,EAAiBG,UAAEA,GAAcO,KAAKC,MAE9C,IAAIC,GAAgB,EAUpB,OARIH,IACFG,GAAgB,GAEXZ,GAAqBL,uBAAuBkB,KAAKJ,KACpDG,GAAgB,IAIhBA,EAEAE,KAAA,OAAA,CAAMC,UAAU,kBAA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GAEnG,MAAM0B,EAAaC,iBAAiB,SAAUlC,GAE9C,MAAMmC,EACJpC,KAACqC,KAAW,CAACpC,UAAWiC,EAAY5B,MAAOA,EAAOnB,WAAYA,EAAWe,UACrEZ,EAQE,KAPFU,KAAAsC,SAAA,CAAApC,UACEF,KAAA,OAAA,CAAMC,UAAU,QAAOC,SACpBc,CAAAA,GA7Hc,IA8HdD,KAEFnB,KAAKF,gBAAgBC,MAGzBa,GAAYZ,KAAKQ,qBAAqBC,MAM3C,OACEF,IAHclB,EAAWsD,KAAKC,QAAUD,KAGhC,IAAKzB,EAAM2B,GAAG,OAAMvC,SACzBkC,GAGP"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var reactRouterDom=require('react-router-dom');var styled=require('styled-components');var withMergedProps=require('../../hocs/withMergedProps.js');var useClassname=require('../../hooks/useClassname.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Anchor=withMergedProps.withMergedProps(React.forwardRef(((e,s)=>{const{size:r="inherit",autoRel:t=!0,textProps:n={},iconProps:o={},icon:i,children:a,content:c,...u}=e;const d=styled.useTheme();const l=useClassname.useClassname("Anchor",u.className);const m=d.utils?.relBuilder;const x=u.href??u.to;const p=u.rel??(t&&m&&typeof x=='string'?m(x,u.target):void 0);const[h,j]=Array.isArray(i)?i:[i];const v={as:'span',size:'inherit',color:'inherit',underline:u.underline,marginLeft:h?'0.20em':void 0,marginRight:j?'0.20em':void 0};const R={as:'span',color:'inherit'};let g;return u.to&&(g=reactRouterDom.Link),u.pseudo&&(g='div'),u.disabled&&(g='span'),u.as&&(g=u.as),jsxRuntime.jsx(style.Root,{...u,ref:s,as:g,className:l,size:r,rel:p,"data-disabled":u.disabled,children:typeof a=='function'?a({baseTextProps:v,textProps:n,iconBaseProps:R,iconProps:o,icon:i}):e.preset==='brand'?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[h&&jsxRuntime.jsx(Icon.Icon,{name:typeof h=='string'?h:void 0,icon:typeof h!='string'?h:void 0,...R,...o}),jsxRuntime.jsx(Text.Text,{...v,...n,children:a||c}),j&&jsxRuntime.jsx(Icon.Icon,{name:typeof j=='string'?j:void 0,icon:typeof j!='string'?j:void 0,...R,...o})]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:a||c})})})),{displayName:"Anchor",sizes:constants.SIZES});exports.Anchor=Anchor,exports.COMPONENT_NAME="Anchor";
1
+ 'use strict';var React=require('react');var styled=require('styled-components');var withMergedProps=require('../../hocs/withMergedProps.js');var useClassname=require('../../hooks/useClassname.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Anchor=withMergedProps.withMergedProps(React.forwardRef(((e,s)=>{const{size:r="inherit",autoRel:t=!0,textProps:n={},iconProps:o={},icon:i,children:a,content:c,...d}=e;const l=styled.useTheme();const u=useClassname.useClassname("Anchor",d.className);const m=l.utils?.relBuilder;const x=d.href??d.to;const p=d.rel??(t&&m&&typeof x=='string'?m(x,d.target):void 0);const[h,j]=Array.isArray(i)?i:[i];const v={as:'span',size:'inherit',color:'inherit',underline:d.underline,marginLeft:h?'0.20em':void 0,marginRight:j?'0.20em':void 0};const g={as:'span',color:'inherit'};let y;return d.to&&(y=l.link),d.pseudo&&(y='div'),d.disabled&&(y='span'),d.as&&(y=d.as),jsxRuntime.jsx(style.Root,{...d,ref:s,as:y,className:u,size:r,rel:p,"data-disabled":d.disabled,children:typeof a=='function'?a({baseTextProps:v,textProps:n,iconBaseProps:g,iconProps:o,icon:i}):d.preset==='brand'?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[h&&jsxRuntime.jsx(Icon.Icon,{name:typeof h=='string'?h:void 0,icon:typeof h!='string'?h:void 0,...g,...o}),jsxRuntime.jsx(Text.Text,{...v,...n,children:a||c}),j&&jsxRuntime.jsx(Icon.Icon,{name:typeof j=='string'?j:void 0,icon:typeof j!='string'?j:void 0,...g,...o})]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:a||c})})})),{displayName:"Anchor",sizes:constants.SIZES});exports.Anchor=Anchor,exports.COMPONENT_NAME="Anchor";
2
2
  //# sourceMappingURL=Anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { Link } from 'react-router-dom'\nimport { useTheme } from 'styled-components'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { AnchorProps } from './types'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Component accepts all \\<a\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [AnchorProps](https://github.com/foxford/ui/blob/master/src/components/Anchor/types.ts)\n */\nconst Anchor: React.ForwardRefExoticComponent<AnchorProps> = withMergedProps<AnchorProps, HTMLAnchorElement>(\n forwardRef((props, ref) => {\n const {\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n const relBuilder = theme.utils?.relBuilder\n const href = restProps.href ?? restProps.to\n\n const rel =\n restProps.rel ??\n (autoRel && relBuilder && typeof href === 'string' ? relBuilder(href, restProps.target) : undefined)\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n let rootNode\n if (restProps.to) rootNode = Link\n if (restProps.pseudo) rootNode = 'div'\n if (restProps.disabled) rootNode = 'span'\n if (restProps.as) rootNode = restProps.as\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode}\n className={className}\n size={size}\n rel={rel}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : props.preset === 'brand' ? (\n <>\n {before && (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after && (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n ) : (\n <>{children || content}</>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Anchor, COMPONENT_NAME }\n"],"names":["Anchor","withMergedProps","forwardRef","props","ref","size","autoRel","textProps","iconProps","icon","children","content","restProps","theme","useTheme","className","useClassname","relBuilder","utils","href","to","rel","target","undefined","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","marginRight","iconBaseProps","rootNode","Link","pseudo","disabled","_jsx","Styled","preset","_jsxs","_Fragment","jsx","Icon","name","Text","displayName","sizes","SIZES"],"mappings":"gbAyBMA,MAAAA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDT,EAEJ,MAAMU,EAAQC,OAAAA,WAEd,MAAMC,EAAYC,aAAYA,aA3BX,SA2B4BJ,EAAUG,WACzD,MAAME,EAAaJ,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,MAAOC,UAAAA,qDAhGY"}
1
+ {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { AnchorProps } from './types'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Component accepts all \\<a\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [AnchorProps](https://github.com/foxford/ui/blob/master/src/components/Anchor/types.ts)\n */\nconst Anchor: React.ForwardRefExoticComponent<AnchorProps> = withMergedProps<AnchorProps, HTMLAnchorElement>(\n forwardRef((props, ref) => {\n const {\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n const relBuilder = theme.utils?.relBuilder\n const href = restProps.href ?? restProps.to\n\n const rel =\n restProps.rel ??\n (autoRel && relBuilder && typeof href === 'string' ? relBuilder(href, restProps.target) : undefined)\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n let rootNode\n if (restProps.to) rootNode = theme.link\n if (restProps.pseudo) rootNode = 'div'\n if (restProps.disabled) rootNode = 'span'\n if (restProps.as) rootNode = restProps.as\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode}\n className={className}\n size={size}\n rel={rel}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before && (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after && (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n ) : (\n <>{children || content}</>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Anchor, COMPONENT_NAME }\n"],"names":["Anchor","withMergedProps","forwardRef","props","ref","size","autoRel","textProps","iconProps","icon","children","content","restProps","theme","useTheme","className","useClassname","relBuilder","utils","href","to","rel","target","undefined","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","marginRight","iconBaseProps","rootNode","link","pseudo","disabled","_jsx","Styled","preset","_jsxs","_Fragment","jsx","Icon","name","Text","displayName","sizes","SIZES"],"mappings":"iYAwBMA,MAAAA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDT,EAEJ,MAAMU,EAAQC,OAAAA,WAEd,MAAMC,EAAYC,aAAYA,aA3BX,SA2B4BJ,EAAUG,WACzD,MAAME,EAAaJ,EAAMK,OAAOD,WAChC,MAAME,EAAOP,EAAUO,MAAQP,EAAUQ,GAEzC,MAAMC,EACJT,EAAUS,MACTf,GAAWW,UAAqBE,GAAS,SAAWF,EAAWE,EAAMP,EAAUU,aAAUC,GAE5F,MAAOC,EAAQC,GAASC,MAAMC,QAAQlB,GAAQA,EAAO,CAACA,GAEtD,MAAMmB,EAA2B,CAC/BC,GAAI,OACJxB,KAAM,UACNyB,MAAO,UACPC,UAAWnB,EAAUmB,UACrBC,WAAYR,EAAS,cAAWD,EAChCU,YAAaR,EAAQ,cAAWF,GAGlC,MAAMW,EAA2B,CAAEL,GAAI,OAAQC,MAAO,WAEtD,IAAIK,EAMJ,OALIvB,EAAUQ,KAAIe,EAAWtB,EAAMuB,MAC/BxB,EAAUyB,SAAQF,EAAW,OAC7BvB,EAAU0B,WAAUH,EAAW,QAC/BvB,EAAUiB,KAAIM,EAAWvB,EAAUiB,IAGrCU,WAAAA,IAACC,MAAAA,KAAW,IACN5B,EACJR,IAAKA,EACLyB,GAAIM,EACJpB,UAAWA,EACXV,KAAMA,EACNgB,IAAKA,EACL,gBAAeT,EAAU0B,SAAS5B,gBAE1BA,GAAa,WACnBA,EAAS,CAAEkB,gBAAerB,YAAW2B,gBAAe1B,YAAWC,SAC7DG,EAAU6B,SAAW,QACvBC,WAAAA,KAAAC,WAAAA,SAAA,CAAAjC,SACGc,CAAAA,GACCe,WAAAK,IAACC,UAAI,CACHC,YAAatB,GAAW,SAAWA,OAASD,EAC5Cd,YAAae,GAAW,SAAWA,OAASD,KACxCW,KACA1B,IAGR+B,WAAAK,IAACG,UAAI,IAAKnB,KAAmBrB,EAASG,SACnCA,GAAYC,IAEdc,GACCc,WAAAK,IAACC,UAAI,CACHC,YAAarB,GAAU,SAAWA,OAAQF,EAC1Cd,YAAagB,GAAU,SAAWA,OAAQF,KACtCW,KACA1B,OAKV+B,WAAAK,IAAAD,oBAAA,CAAAjC,SAAGA,GAAYC,KAEL,IAGlB,CACEqC,YA/FmB,SAgGnBC,MAAOC,UAAAA,qDAhGY"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import{Link}from'react-router-dom';import{useTheme}from'styled-components';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useClassname}from'../../hooks/useClassname.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Anchor';const Anchor=withMergedProps(forwardRef(((o,e)=>{const{size:s="inherit",autoRel:r=!0,textProps:t={},iconProps:n={},icon:i,children:m,content:a,...c}=o;const d=useTheme();const p=useClassname("Anchor",c.className);const l=d.utils?.relBuilder;const f=c.href??c.to;const h=c.rel??(r&&l&&typeof f=='string'?l(f,c.target):void 0);const[x,g]=Array.isArray(i)?i:[i];const j={as:'span',size:'inherit',color:'inherit',underline:c.underline,marginLeft:x?'0.20em':void 0,marginRight:g?'0.20em':void 0};const u={as:'span',color:'inherit'};let y;return c.to&&(y=Link),c.pseudo&&(y='div'),c.disabled&&(y='span'),c.as&&(y=c.as),jsx(Root,{...c,ref:e,as:y,className:p,size:s,rel:h,"data-disabled":c.disabled,children:typeof m=='function'?m({baseTextProps:j,textProps:t,iconBaseProps:u,iconProps:n,icon:i}):o.preset==='brand'?jsxs(Fragment,{children:[x&&jsx(Icon,{name:typeof x=='string'?x:void 0,icon:typeof x!='string'?x:void 0,...u,...n}),jsx(Text,{...j,...t,children:m||a}),g&&jsx(Icon,{name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0,...u,...n})]}):jsx(Fragment,{children:m||a})})})),{displayName:"Anchor",sizes:SIZES});export{Anchor,COMPONENT_NAME};
1
+ import{forwardRef}from'react';import{useTheme}from'styled-components';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useClassname}from'../../hooks/useClassname.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Anchor';const Anchor=withMergedProps(forwardRef(((o,e)=>{const{size:s="inherit",autoRel:r=!0,textProps:t={},iconProps:n={},icon:i,children:a,content:c,...m}=o;const d=useTheme();const p=useClassname("Anchor",m.className);const l=d.utils?.relBuilder;const f=m.href??m.to;const h=m.rel??(r&&l&&typeof f=='string'?l(f,m.target):void 0);const[x,g]=Array.isArray(i)?i:[i];const j={as:'span',size:'inherit',color:'inherit',underline:m.underline,marginLeft:x?'0.20em':void 0,marginRight:g?'0.20em':void 0};const u={as:'span',color:'inherit'};let y;return m.to&&(y=d.link),m.pseudo&&(y='div'),m.disabled&&(y='span'),m.as&&(y=m.as),jsx(Root,{...m,ref:e,as:y,className:p,size:s,rel:h,"data-disabled":m.disabled,children:typeof a=='function'?a({baseTextProps:j,textProps:t,iconBaseProps:u,iconProps:n,icon:i}):m.preset==='brand'?jsxs(Fragment,{children:[x&&jsx(Icon,{name:typeof x=='string'?x:void 0,icon:typeof x!='string'?x:void 0,...u,...n}),jsx(Text,{...j,...t,children:a||c}),g&&jsx(Icon,{name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0,...u,...n})]}):jsx(Fragment,{children:a||c})})})),{displayName:"Anchor",sizes:SIZES});export{Anchor,COMPONENT_NAME};
2
2
  //# sourceMappingURL=Anchor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.mjs","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { Link } from 'react-router-dom'\nimport { useTheme } from 'styled-components'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { AnchorProps } from './types'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Component accepts all \\<a\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [AnchorProps](https://github.com/foxford/ui/blob/master/src/components/Anchor/types.ts)\n */\nconst Anchor: React.ForwardRefExoticComponent<AnchorProps> = withMergedProps<AnchorProps, HTMLAnchorElement>(\n forwardRef((props, ref) => {\n const {\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n const relBuilder = theme.utils?.relBuilder\n const href = restProps.href ?? restProps.to\n\n const rel =\n restProps.rel ??\n (autoRel && relBuilder && typeof href === 'string' ? relBuilder(href, restProps.target) : undefined)\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n let rootNode\n if (restProps.to) rootNode = Link\n if (restProps.pseudo) rootNode = 'div'\n if (restProps.disabled) rootNode = 'span'\n if (restProps.as) rootNode = restProps.as\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode}\n className={className}\n size={size}\n rel={rel}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : props.preset === 'brand' ? (\n <>\n {before && (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after && (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n ) : (\n <>{children || content}</>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Anchor, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Anchor","withMergedProps","forwardRef","props","ref","size","autoRel","textProps","iconProps","icon","children","content","restProps","theme","useTheme","className","useClassname","relBuilder","utils","href","to","rel","target","undefined","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","marginRight","iconBaseProps","rootNode","Link","pseudo","disabled","_jsx","Styled","preset","_jsxs","_Fragment","Icon","name","Text","displayName","sizes","SIZES"],"mappings":"oZAaMA,MAAAA,eAAiB,SAYjBC,MAAAA,OAAuDC,gBAC3DC,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDT,EAEJ,MAAMU,EAAQC,WAEd,MAAMC,EAAYC,aA3BC,SA2B4BJ,EAAUG,WACzD,MAAME,EAAaJ,EAAMK,OAAOD,WAChC,MAAME,EAAOP,EAAUO,MAAQP,EAAUQ,GAEzC,MAAMC,EACJT,EAAUS,MACTf,GAAWW,UAAqBE,GAAS,SAAWF,EAAWE,EAAMP,EAAUU,aAAUC,GAE5F,MAAOC,EAAQC,GAASC,MAAMC,QAAQlB,GAAQA,EAAO,CAACA,GAEtD,MAAMmB,EAA2B,CAC/BC,GAAI,OACJxB,KAAM,UACNyB,MAAO,UACPC,UAAWnB,EAAUmB,UACrBC,WAAYR,EAAS,cAAWD,EAChCU,YAAaR,EAAQ,cAAWF,GAGlC,MAAMW,EAA2B,CAAEL,GAAI,OAAQC,MAAO,WAEtD,IAAIK,EAMJ,OALIvB,EAAUQ,KAAIe,EAAWC,MACzBxB,EAAUyB,SAAQF,EAAW,OAC7BvB,EAAU0B,WAAUH,EAAW,QAC/BvB,EAAUiB,KAAIM,EAAWvB,EAAUiB,IAGrCU,IAACC,KAAW,IACN5B,EACJR,IAAKA,EACLyB,GAAIM,EACJpB,UAAWA,EACXV,KAAMA,EACNgB,IAAKA,EACL,gBAAeT,EAAU0B,SAAS5B,gBAE1BA,GAAa,WACnBA,EAAS,CAAEkB,gBAAerB,YAAW2B,gBAAe1B,YAAWC,SAC7DN,EAAMsC,SAAW,QACnBC,KAAAC,SAAA,CAAAjC,SACGc,CAAAA,GACCe,IAACK,KAAI,CACHC,YAAarB,GAAW,SAAWA,OAASD,EAC5Cd,YAAae,GAAW,SAAWA,OAASD,KACxCW,KACA1B,IAGR+B,IAACO,KAAI,IAAKlB,KAAmBrB,EAASG,SACnCA,GAAYC,IAEdc,GACCc,IAACK,KAAI,CACHC,YAAapB,GAAU,SAAWA,OAAQF,EAC1Cd,YAAagB,GAAU,SAAWA,OAAQF,KACtCW,KACA1B,OAKV+B,IAAAI,SAAA,CAAAjC,SAAGA,GAAYC,KAEL,IAGlB,CACEoC,YA/FmB,SAgGnBC,MAAOC"}
1
+ {"version":3,"file":"Anchor.mjs","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useClassname } from 'hooks/useClassname'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { AnchorProps } from './types'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Component accepts all \\<a\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [AnchorProps](https://github.com/foxford/ui/blob/master/src/components/Anchor/types.ts)\n */\nconst Anchor: React.ForwardRefExoticComponent<AnchorProps> = withMergedProps<AnchorProps, HTMLAnchorElement>(\n forwardRef((props, ref) => {\n const {\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n const relBuilder = theme.utils?.relBuilder\n const href = restProps.href ?? restProps.to\n\n const rel =\n restProps.rel ??\n (autoRel && relBuilder && typeof href === 'string' ? relBuilder(href, restProps.target) : undefined)\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n let rootNode\n if (restProps.to) rootNode = theme.link\n if (restProps.pseudo) rootNode = 'div'\n if (restProps.disabled) rootNode = 'span'\n if (restProps.as) rootNode = restProps.as\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode}\n className={className}\n size={size}\n rel={rel}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before && (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after && (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n ) : (\n <>{children || content}</>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Anchor, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Anchor","withMergedProps","forwardRef","props","ref","size","autoRel","textProps","iconProps","icon","children","content","restProps","theme","useTheme","className","useClassname","relBuilder","utils","href","to","rel","target","undefined","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","marginRight","iconBaseProps","rootNode","link","pseudo","disabled","_jsx","Styled","preset","_jsxs","_Fragment","Icon","name","Text","displayName","sizes","SIZES"],"mappings":"iXAYMA,MAAAA,eAAiB,SAYjBC,MAAAA,O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AAmBrB,EAASG,SACnCA,GAAYC,IAEdc,GACCc,IAACK,KAAI,CACHC,YAAapB,GAAU,SAAWA,OAAQF,EAC1Cd,YAAagB,GAAU,SAAWA,OAAQF,KACtCW,KACA1B,OAKV+B,IAAAI,SAAA,CAAAjC,SAAGA,GAAYC,KAEL,IAGlB,CACEoC,YA/FmB,SAgGnBC,MAAOC"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var styled=require('styled-components');var reactRouterDom=require('react-router-dom');var useClassname=require('../../hooks/useClassname.js');var withMergedProps=require('../../hocs/withMergedProps.js');var hooks=require('./hooks.js');var constants=require('./constants.js');var defaultConstants=require('./default-constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Button=withMergedProps.withMergedProps(React.forwardRef(((e,s)=>{let{size:t="m",inline:n=!0,rounded:r=!0,color:o="accent",fontColor:a="white",textProps:i={},iconProps:c={},as:u,className:l,children:d,content:m,fontWeight:p,icon:x,innerRef:h,...j}=e;const f=styled.useTheme();j.preset!=='default'||typeof t!='string'||j.round||(j={...defaultConstants.PROPS_BY_SIZE[t]??{},...j}),j.href&&(u='a'),j.to&&(u=reactRouterDom.Link),j.primary&&(o='primary'),j.secondary&&(o='atlantis');const R=useClassname.useClassname("Button",l);const y=useClassname.useClassname("Button");const v=hooks.useComputedRel(f,j);const S=hooks.useComputedLinkProps(u,j);let[g,I]=Array.isArray(x)?x:[x];j.success&&(g='checkFill',I=null),j.preset==='brand'&&j.loading&&(g=jsxRuntime.jsx(style.LoaderIcon,{}),I=null);const C={as:'span',size:'inherit',color:'inherit',weight:p??(j.preset==='brand'?800:600),lineHeight:j.preset==='brand'?1.2:1,marginLeft:g?'0.25em':void 0,marginRight:I?'0.25em':void 0};const P={as:'span',color:'inherit'};return jsxRuntime.jsx(style.Root,{...j,...S,size:t,inline:n,color:o,fontColor:a,rounded:r,rel:v,as:u,className:R,ref:s??h,children:typeof d=='function'?d({baseTextProps:C,textProps:i,iconBaseProps:P,iconProps:c,icon:[g,I]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g&&jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0,...P,...c}),(d||m)&&jsxRuntime.jsx(Text.Text,{className:`${y}__content`,...C,...i,children:d||m}),I&&jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof I=='string'?I:void 0,icon:typeof I!='string'?I:void 0,...P,...c})]})})})),{displayName:"Button",sizes:e=>{let s=e.preset==='brand'?constants.SIZES:defaultConstants.SIZES_DEFAULT;return e.round&&(s=e.preset==='brand'?constants.SIZES_ROUND:defaultConstants.SIZES_ROUND_DEFAULT),s}});exports.SIZES=constants.SIZES,exports.SIZES_ROUND=constants.SIZES_ROUND,exports.Button=Button,exports.COMPONENT_NAME="Button";
1
+ 'use strict';var React=require('react');var styled=require('styled-components');var useClassname=require('../../hooks/useClassname.js');var withMergedProps=require('../../hocs/withMergedProps.js');var hooks=require('./hooks.js');var constants=require('./constants.js');var defaultConstants=require('./default-constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Button=withMergedProps.withMergedProps(React.forwardRef(((e,s)=>{let{size:t="m",inline:n=!0,rounded:o=!0,color:r="accent",fontColor:a="white",textProps:i={},iconProps:c={},as:u,className:l,children:d,content:m,fontWeight:p,icon:x,innerRef:h,...j}=e;const f=styled.useTheme();j.preset!=='default'||typeof t!='string'||j.round||(j={...defaultConstants.PROPS_BY_SIZE[t]??{},...j}),j.href&&(u='a'),j.to&&(u=f.link),j.primary&&(r='primary'),j.secondary&&(r='atlantis');const R=useClassname.useClassname("Button",l);const y=useClassname.useClassname("Button");const S=hooks.useComputedRel(f,j);const g=hooks.useComputedLinkProps(u,j);let[v,I]=Array.isArray(x)?x:[x];j.success&&(v='checkFill',I=null),j.preset==='brand'&&j.loading&&(v=jsxRuntime.jsx(style.LoaderIcon,{}),I=null);const C={as:'span',size:'inherit',color:'inherit',weight:p??(j.preset==='brand'?800:600),lineHeight:j.preset==='brand'?1.2:1,marginLeft:v?'0.25em':void 0,marginRight:I?'0.25em':void 0};const P={as:'span',color:'inherit'};return jsxRuntime.jsx(style.Root,{...j,...g,size:t,inline:n,color:r,fontColor:a,rounded:o,rel:S,as:u,className:R,ref:s??h,children:typeof d=='function'?d({baseTextProps:C,textProps:i,iconBaseProps:P,iconProps:c,icon:[v,I]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[v&&jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof v=='string'?v:void 0,icon:typeof v!='string'?v:void 0,...P,...c}),(d||m)&&jsxRuntime.jsx(Text.Text,{className:`${y}__content`,...C,...i,children:d||m}),I&&jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof I=='string'?I:void 0,icon:typeof I!='string'?I:void 0,...P,...c})]})})})),{displayName:"Button",sizes:e=>{let s=e.preset==='brand'?constants.SIZES:defaultConstants.SIZES_DEFAULT;return e.round&&(s=e.preset==='brand'?constants.SIZES_ROUND:defaultConstants.SIZES_ROUND_DEFAULT),s}});exports.SIZES=constants.SIZES,exports.SIZES_ROUND=constants.SIZES_ROUND,exports.Button=Button,exports.COMPONENT_NAME="Button";
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { Link } from 'react-router-dom'\nimport { useClassname } from 'hooks/useClassname'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport { useComputedRel, useComputedLinkProps } from './hooks'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE } from './default-constants'\nimport type { ButtonProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [ButtonProps](https://github.com/foxford/ui/blob/master/src/components/Button/types.ts)\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n textProps = {},\n iconProps = {},\n as: _as,\n className,\n children,\n content,\n fontWeight,\n icon,\n innerRef,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (restProps.preset === 'default' && typeof size === 'string' && !restProps.round) {\n const propsBySize = PROPS_BY_SIZE[size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = Link\n\n if (restProps.primary) color = 'primary'\n if (restProps.secondary) color = 'atlantis'\n\n const rootClassName = useClassname(COMPONENT_NAME, className)\n const textClassName = useClassname(COMPONENT_NAME)\n const rel = useComputedRel(theme, restProps)\n const linkProps = useComputedLinkProps(_as, restProps)\n\n let [before, after] = Array.isArray(icon) ? icon : [icon]\n\n if (restProps.success) {\n before = 'checkFill'\n after = null\n }\n\n if (restProps.preset === 'brand' && restProps.loading) {\n before = <Styled.LoaderIcon />\n after = null\n }\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n size={size}\n inline={inline}\n color={color}\n fontColor={fontColor}\n rounded={rounded}\n rel={rel}\n as={_as}\n className={rootClassName}\n ref={ref ?? innerRef}\n >\n {typeof children === 'function' ? (\n children({\n baseTextProps,\n textProps,\n iconBaseProps,\n iconProps,\n icon: [before, after],\n })\n ) : (\n <>\n {before && (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n {(children || content) && (\n <Text className={`${textClassName}__content`} {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n )}\n {after && (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n let sizes = props.preset === 'brand' ? SIZES : SIZES_DEFAULT\n if (props.round) sizes = props.preset === 'brand' ? SIZES_ROUND : SIZES_ROUND_DEFAULT\n\n return sizes\n },\n }\n)\n\nexport { Button, COMPONENT_NAME, SIZES, SIZES_ROUND }\n\nexport type { ButtonProps }\n"],"names":["Button","withMergedProps","forwardRef","props","ref","size","inline","rounded","color","fontColor","textProps","iconProps","as","_as","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","Link","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","success","loading","_jsx","jsx","Styled","baseTextProps","weight","lineHeight","marginLeft","undefined","marginRight","iconBaseProps","_jsxs","jsxs","_Fragment","Icon","name","Text","displayName","sizes","SIZES","SIZES_DEFAULT","SIZES_ROUND","SIZES_ROUND_DEFAULT"],"mappings":"ugBA2BMA,MAAAA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,IAAIC,KACFA,EAAO,IAAGC,OACVA,GAAS,EAAIC,QACbA,GAAU,EAAIC,MACdA,EAAQ,SAAQC,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ASJ,gBAEbA,GAAa,WACnBA,EAAS,CACPgC,gBACArC,YACA2C,gBACA1C,YACAO,KAAM,CAACoB,EAAQC,KAGjBe,WAAAC,KAAAC,oBAAA,CAAAzC,SACGuB,CAAAA,GACCM,WAAAC,IAACY,UAAI,CACH3C,UAAU,OACV4C,YAAapB,GAAW,SAAWA,OAASa,EAC5CjC,YAAaoB,GAAW,SAAWA,OAASa,KACxCE,KACA1C,KAGNI,GAAYC,IACZ4B,WAAAA,IAACe,KAAAA,KAAI,CAAC7C,UAAW,GAAGmB,gBAA8Bc,KAAmBrC,EAASK,SAC3EA,GAAYC,IAGhBuB,GACCK,WAAAC,IAACY,UAAI,CACH3C,UAAU,OACV4C,YAAanB,GAAU,SAAWA,OAAQY,EAC1CjC,YAAaqB,GAAU,SAAWA,OAAQY,KACtCE,KACA1C,QAKA,IAGlB,CACEiD,YA/HmB,SAgInBC,MAAQ1D,IACN,IAAI0D,EAAQ1D,EAAMoB,SAAW,QAAUuC,UAAAA,MAAQC,iBAAAA,cAG/C,OAFI5D,EAAMqB,QAAOqC,EAAQ1D,EAAMoB,SAAW,QAAUyC,UAAWA,YAAGC,sCAE3DJ,CAAK,yHApIK"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport { useComputedRel, useComputedLinkProps } from './hooks'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE } from './default-constants'\nimport type { ButtonProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [ButtonProps](https://github.com/foxford/ui/blob/master/src/components/Button/types.ts)\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n textProps = {},\n iconProps = {},\n as: _as,\n className,\n children,\n content,\n fontWeight,\n icon,\n innerRef,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (restProps.preset === 'default' && typeof size === 'string' && !restProps.round) {\n const propsBySize = PROPS_BY_SIZE[size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = theme.link\n\n if (restProps.primary) color = 'primary'\n if (restProps.secondary) color = 'atlantis'\n\n const rootClassName = useClassname(COMPONENT_NAME, className)\n const textClassName = useClassname(COMPONENT_NAME)\n const rel = useComputedRel(theme, restProps)\n const linkProps = useComputedLinkProps(_as, restProps)\n\n let [before, after] = Array.isArray(icon) ? icon : [icon]\n\n if (restProps.success) {\n before = 'checkFill'\n after = null\n }\n\n if (restProps.preset === 'brand' && restProps.loading) {\n before = <Styled.LoaderIcon />\n after = null\n }\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n size={size}\n inline={inline}\n color={color}\n fontColor={fontColor}\n rounded={rounded}\n rel={rel}\n as={_as}\n className={rootClassName}\n ref={ref ?? innerRef}\n >\n {typeof children === 'function' ? (\n children({\n baseTextProps,\n textProps,\n iconBaseProps,\n iconProps,\n icon: [before, after],\n })\n ) : (\n <>\n {before && (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n {(children || content) && (\n <Text className={`${textClassName}__content`} {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n )}\n {after && (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n let sizes = props.preset === 'brand' ? SIZES : SIZES_DEFAULT\n if (props.round) sizes = props.preset === 'brand' ? SIZES_ROUND : SIZES_ROUND_DEFAULT\n\n return sizes\n },\n }\n)\n\nexport { Button, COMPONENT_NAME, SIZES, SIZES_ROUND }\n\nexport type { ButtonProps }\n"],"names":["Button","withMergedProps","forwardRef","props","ref","size","inline","rounded","color","fontColor","textProps","iconProps","as","_as","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","link","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","success","loading","_jsx","jsx","Styled","baseTextProps","weight","lineHeight","marginLeft","undefined","marginRight","iconBaseProps","_jsxs","jsxs","_Fragment","Icon","name","Text","displayName","sizes","SIZES","SIZES_DEFAULT","SIZES_ROUND","SIZES_ROUND_DEFAULT"],"mappings":"wdA0BMA,MAAAA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,IAAIC,KACFA,EAAO,IAAGC,OACVA,GAAS,EAAIC,QACbA,GAAU,EAAIC,MACdA,EAAQ,SAAQC,UAChBA,EAAY,QAAOC,UACnBA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EACdC,GAAIC,EAAGC,UACPA,EAASC,SACTA,EAAQC,QACRA,EAAOC,WACPA,EAAUC,KAC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B,CAAAA,GACCM,WAAAC,IAACY,UAAI,CACH3C,UAAU,OACV4C,YAAapB,GAAW,SAAWA,OAASa,EAC5CjC,YAAaoB,GAAW,SAAWA,OAASa,KACxCE,KACA1C,KAGNI,GAAYC,IACZ4B,WAAAA,IAACe,KAAAA,KAAI,CAAC7C,UAAW,GAAGmB,gBAA8Bc,KAAmBrC,EAASK,SAC3EA,GAAYC,IAGhBuB,GACCK,WAAAC,IAACY,UAAI,CACH3C,UAAU,OACV4C,YAAanB,GAAU,SAAWA,OAAQY,EAC1CjC,YAAaqB,GAAU,SAAWA,OAAQY,KACtCE,KACA1C,QAKA,IAGlB,CACEiD,YA/HmB,SAgInBC,MAAQ1D,IACN,IAAI0D,EAAQ1D,EAAMoB,SAAW,QAAUuC,UAAAA,MAAQC,iBAAAA,cAG/C,OAFI5D,EAAMqB,QAAOqC,EAAQ1D,EAAMoB,SAAW,QAAUyC,UAAWA,YAAGC,sCAE3DJ,CAAK,yHApIK"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import{useTheme}from'styled-components';import{Link}from'react-router-dom';import{useClassname}from'../../hooks/useClassname.mjs';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useComputedRel,useComputedLinkProps}from'./hooks.mjs';import{SIZES,SIZES_ROUND}from'./constants.mjs';import{SIZES_DEFAULT,SIZES_ROUND_DEFAULT,PROPS_BY_SIZE}from'./default-constants.mjs';import{Root,LoaderIcon}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Button';const Button=withMergedProps(forwardRef(((o,e)=>{let{size:t="m",inline:s=!0,rounded:r=!0,color:n="accent",fontColor:i="white",textProps:m={},iconProps:a={},as:c,className:p,children:l,content:d,fontWeight:u,icon:f,innerRef:S,...h}=o;const E=useTheme();h.preset!=='default'||typeof t!='string'||h.round||(h={...PROPS_BY_SIZE[t]??{},...h}),h.href&&(c='a'),h.to&&(c=Link),h.primary&&(n='primary'),h.secondary&&(n='atlantis');const I=useClassname("Button",p);const g=useClassname("Button");const j=useComputedRel(E,h);const x=useComputedLinkProps(c,h);let[N,P]=Array.isArray(f)?f:[f];h.success&&(N='checkFill',P=null),h.preset==='brand'&&h.loading&&(N=jsx(LoaderIcon,{}),P=null);const _={as:'span',size:'inherit',color:'inherit',weight:u??(h.preset==='brand'?800:600),lineHeight:h.preset==='brand'?1.2:1,marginLeft:N?'0.25em':void 0,marginRight:P?'0.25em':void 0};const R={as:'span',color:'inherit'};return jsx(Root,{...h,...x,size:t,inline:s,color:n,fontColor:i,rounded:r,rel:j,as:c,className:I,ref:e??S,children:typeof l=='function'?l({baseTextProps:_,textProps:m,iconBaseProps:R,iconProps:a,icon:[N,P]}):jsxs(Fragment,{children:[N&&jsx(Icon,{className:"icon",name:typeof N=='string'?N:void 0,icon:typeof N!='string'?N:void 0,...R,...a}),(l||d)&&jsx(Text,{className:`${g}__content`,..._,...m,children:l||d}),P&&jsx(Icon,{className:"icon",name:typeof P=='string'?P:void 0,icon:typeof P!='string'?P:void 0,...R,...a})]})})})),{displayName:"Button",sizes:o=>{let e=o.preset==='brand'?SIZES:SIZES_DEFAULT;return o.round&&(e=o.preset==='brand'?SIZES_ROUND:SIZES_ROUND_DEFAULT),e}});export{Button,COMPONENT_NAME,SIZES,SIZES_ROUND};
1
+ import{forwardRef}from'react';import{useTheme}from'styled-components';import{useClassname}from'../../hooks/useClassname.mjs';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useComputedRel,useComputedLinkProps}from'./hooks.mjs';import{SIZES,SIZES_ROUND}from'./constants.mjs';import{SIZES_DEFAULT,SIZES_ROUND_DEFAULT,PROPS_BY_SIZE}from'./default-constants.mjs';import{Root,LoaderIcon}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Button';const Button=withMergedProps(forwardRef(((o,e)=>{let{size:s="m",inline:t=!0,rounded:r=!0,color:n="accent",fontColor:i="white",textProps:a={},iconProps:m={},as:c,className:p,children:l,content:d,fontWeight:u,icon:f,innerRef:S,...h}=o;const E=useTheme();h.preset!=='default'||typeof s!='string'||h.round||(h={...PROPS_BY_SIZE[s]??{},...h}),h.href&&(c='a'),h.to&&(c=E.link),h.primary&&(n='primary'),h.secondary&&(n='atlantis');const I=useClassname("Button",p);const g=useClassname("Button");const j=useComputedRel(E,h);const x=useComputedLinkProps(c,h);let[N,P]=Array.isArray(f)?f:[f];h.success&&(N='checkFill',P=null),h.preset==='brand'&&h.loading&&(N=jsx(LoaderIcon,{}),P=null);const _={as:'span',size:'inherit',color:'inherit',weight:u??(h.preset==='brand'?800:600),lineHeight:h.preset==='brand'?1.2:1,marginLeft:N?'0.25em':void 0,marginRight:P?'0.25em':void 0};const R={as:'span',color:'inherit'};return jsx(Root,{...h,...x,size:s,inline:t,color:n,fontColor:i,rounded:r,rel:j,as:c,className:I,ref:e??S,children:typeof l=='function'?l({baseTextProps:_,textProps:a,iconBaseProps:R,iconProps:m,icon:[N,P]}):jsxs(Fragment,{children:[N&&jsx(Icon,{className:"icon",name:typeof N=='string'?N:void 0,icon:typeof N!='string'?N:void 0,...R,...m}),(l||d)&&jsx(Text,{className:`${g}__content`,..._,...a,children:l||d}),P&&jsx(Icon,{className:"icon",name:typeof P=='string'?P:void 0,icon:typeof P!='string'?P:void 0,...R,...m})]})})})),{displayName:"Button",sizes:o=>{let e=o.preset==='brand'?SIZES:SIZES_DEFAULT;return o.round&&(e=o.preset==='brand'?SIZES_ROUND:SIZES_ROUND_DEFAULT),e}});export{Button,COMPONENT_NAME,SIZES,SIZES_ROUND};
2
2
  //# sourceMappingURL=Button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { Link } from 'react-router-dom'\nimport { useClassname } from 'hooks/useClassname'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport { useComputedRel, useComputedLinkProps } from './hooks'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE } from './default-constants'\nimport type { ButtonProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [ButtonProps](https://github.com/foxford/ui/blob/master/src/components/Button/types.ts)\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n textProps = {},\n iconProps = {},\n as: _as,\n className,\n children,\n content,\n fontWeight,\n icon,\n innerRef,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (restProps.preset === 'default' && typeof size === 'string' && !restProps.round) {\n const propsBySize = PROPS_BY_SIZE[size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = Link\n\n if (restProps.primary) color = 'primary'\n if (restProps.secondary) color = 'atlantis'\n\n const rootClassName = useClassname(COMPONENT_NAME, className)\n const textClassName = useClassname(COMPONENT_NAME)\n const rel = useComputedRel(theme, restProps)\n const linkProps = useComputedLinkProps(_as, restProps)\n\n let [before, after] = Array.isArray(icon) ? icon : [icon]\n\n if (restProps.success) {\n before = 'checkFill'\n after = null\n }\n\n if (restProps.preset === 'brand' && restProps.loading) {\n before = <Styled.LoaderIcon />\n after = null\n }\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n size={size}\n inline={inline}\n color={color}\n fontColor={fontColor}\n rounded={rounded}\n rel={rel}\n as={_as}\n className={rootClassName}\n ref={ref ?? innerRef}\n >\n {typeof children === 'function' ? (\n children({\n baseTextProps,\n textProps,\n iconBaseProps,\n iconProps,\n icon: [before, after],\n })\n ) : (\n <>\n {before && (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n {(children || content) && (\n <Text className={`${textClassName}__content`} {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n )}\n {after && (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n let sizes = props.preset === 'brand' ? SIZES : SIZES_DEFAULT\n if (props.round) sizes = props.preset === 'brand' ? SIZES_ROUND : SIZES_ROUND_DEFAULT\n\n return sizes\n },\n }\n)\n\nexport { Button, COMPONENT_NAME, SIZES, SIZES_ROUND }\n\nexport type { ButtonProps }\n"],"names":["COMPONENT_NAME","Button","withMergedProps","forwardRef","props","ref","size","inline","rounded","color","fontColor","textProps","iconProps","as","_as","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","Link","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","success","loading","_jsx","Styled","baseTextProps","weight","lineHeight","marginLeft","undefined","marginRight","iconBaseProps","_jsxs","_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I,OAAQJ,MAAO,WAEtD,OACEoC,IAACC,KAAW,IACNzB,KACAgB,EACJ/B,KAAMA,EACNC,OAAQA,EACRE,MAAOA,EACPC,UAAWA,EACXF,QAASA,EACT2B,IAAKA,EACLtB,GAAIC,EACJC,UAAWiB,EACX3B,IAAKA,GAAOe,EAASJ,gBAEbA,GAAa,WACnBA,EAAS,CACP+B,gBACApC,YACA0C,gBACAzC,YACAO,KAAM,CAACoB,EAAQC,KAGjBc,KAAAC,SAAA,CAAAvC,SACGuB,CAAAA,GACCM,IAACW,KAAI,CACHzC,UAAU,OACV0C,YAAalB,GAAW,SAAWA,OAASY,EAC5ChC,YAAaoB,GAAW,SAAWA,OAASY,KACxCE,KACAzC,KAGNI,GAAYC,IACZ4B,IAACa,KAAI,CAAC3C,UAAW,GAAGmB,gBAA8Ba,KAAmBpC,EAASK,SAC3EA,GAAYC,IAGhBuB,GACCK,IAACW,KAAI,CACHzC,UAAU,OACV0C,YAAajB,GAAU,SAAWA,OAAQW,EAC1ChC,YAAaqB,GAAU,SAAWA,OAAQW,KACtCE,KACAzC,QAKA,IAGlB,CACE+C,YA/HmB,SAgInBC,MAAQxD,IACN,IAAIwD,EAAQxD,EAAMoB,SAAW,QAAUqC,MAAQC,cAG/C,OAFI1D,EAAMqB,QAAOmC,EAAQxD,EAAMoB,SAAW,QAAUuC,YAAcC,qBAE3DJ,CAAK"}
1
+ {"version":3,"file":"Button.mjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { Text } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport { useComputedRel, useComputedLinkProps } from './hooks'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE } from './default-constants'\nimport type { ButtonProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [ButtonProps](https://github.com/foxford/ui/blob/master/src/components/Button/types.ts)\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n textProps = {},\n iconProps = {},\n as: _as,\n className,\n children,\n content,\n fontWeight,\n icon,\n innerRef,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (restProps.preset === 'default' && typeof size === 'string' && !restProps.round) {\n const propsBySize = PROPS_BY_SIZE[size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = theme.link\n\n if (restProps.primary) color = 'primary'\n if (restProps.secondary) color = 'atlantis'\n\n const rootClassName = useClassname(COMPONENT_NAME, className)\n const textClassName = useClassname(COMPONENT_NAME)\n const rel = useComputedRel(theme, restProps)\n const linkProps = useComputedLinkProps(_as, restProps)\n\n let [before, after] = Array.isArray(icon) ? icon : [icon]\n\n if (restProps.success) {\n before = 'checkFill'\n after = null\n }\n\n if (restProps.preset === 'brand' && restProps.loading) {\n before = <Styled.LoaderIcon />\n after = null\n }\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n size={size}\n inline={inline}\n color={color}\n fontColor={fontColor}\n rounded={rounded}\n rel={rel}\n as={_as}\n className={rootClassName}\n ref={ref ?? innerRef}\n >\n {typeof children === 'function' ? (\n children({\n baseTextProps,\n textProps,\n iconBaseProps,\n iconProps,\n icon: [before, after],\n })\n ) : (\n <>\n {before && (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n {(children || content) && (\n <Text className={`${textClassName}__content`} {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n )}\n {after && (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n )}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => {\n let sizes = props.preset === 'brand' ? SIZES : SIZES_DEFAULT\n if (props.round) sizes = props.preset === 'brand' ? SIZES_ROUND : SIZES_ROUND_DEFAULT\n\n return sizes\n },\n }\n)\n\nexport { Button, COMPONENT_NAME, SIZES, SIZES_ROUND }\n\nexport type { ButtonProps }\n"],"names":["COMPONENT_NAME","Button","withMergedProps","forwardRef","props","ref","size","inline","rounded","color","fontColor","textProps","iconProps","as","_as","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","link","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","success","loading","_jsx","Styled","baseTextProps","weight","lineHeight","marginLeft","undefined","marginRight","iconBaseProps","_jsxs","_Fragment","Icon","name","Text","displayName","sizes","SIZES","SIZES_DEFAULT","SIZES_ROUND","SIZES_ROUND_DEFAULT"],"mappings":"0hBAcMA,MAAAA,eAAiB,SAYjBC,MAAAA,OAAuDC,gBAC3DC,YAAW,CAACC,EAAOC,KACjB,IAAIC,KACFA,EAAO,IAAGC,OACVA,GAAS,EAAIC,QACbA,GAAU,EAAIC,MACdA,EAAQ,SAAQC,UAChBA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,YACAO,KAAM,CAACoB,EAAQC,KAGjBc,KAAAC,SAAA,CAAAvC,SACGuB,CAAAA,GACCM,IAACW,KAAI,CACHzC,UAAU,OACV0C,YAAalB,GAAW,SAAWA,OAASY,EAC5ChC,YAAaoB,GAAW,SAAWA,OAASY,KACxCE,KACAzC,KAGNI,GAAYC,IACZ4B,IAACa,KAAI,CAAC3C,UAAW,GAAGmB,gBAA8Ba,KAAmBpC,EAASK,SAC3EA,GAAYC,IAGhBuB,GACCK,IAACW,KAAI,CACHzC,UAAU,OACV0C,YAAajB,GAAU,SAAWA,OAAQW,EAC1ChC,YAAaqB,GAAU,SAAWA,OAAQW,KACtCE,KACAzC,QAKA,IAGlB,CACE+C,YA/HmB,SAgInBC,MAAQxD,IACN,IAAIwD,EAAQxD,EAAMoB,SAAW,QAAUqC,MAAQC,cAG/C,OAFI1D,EAAMqB,QAAOmC,EAAQxD,EAAMoB,SAAW,QAAUuC,YAAcC,qBAE3DJ,CAAK"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var styled=require('styled-components');var cx=require('clsx');var useClassname=require('../../hooks/useClassname.js');var useConfigPriority=require('../../hooks/use-config-priority.js');var Group=require('./Group.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var InputCheckbox=require('../InputCheckbox/InputCheckbox.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var cx__default=_interopDefault(cx);const Checkbox=React.forwardRef(((e,s)=>{const t=styled.useTheme();const r=useClassname.useClassname("Checkbox");const{preset:n,style:o,id:u,name:c,value:a,disabled:i,error:l,success:d,fluid:x,children:h,label:C,checked:k,defaultChecked:b,background:m,onColored:p,size:j="m",inline:f=!0,width:y=t.defaultInputControlsWidth,className:R,onChange:v=()=>{},...g}=useConfigPriority.useConfigPriority(t.components?.Checkbox,e);let _=t.preset==='brand';typeof n=='string'&&(_=n==='brand');const q=cx__default.default(r,R,k&&`${r}--checked`);const I=`${r}__label`;return jsxRuntime.jsxs(style.Root,{ref:s,className:q,style:o,fluid:x,disabled:i,htmlFor:u||c,size:j,inline:f,width:y,error:l,success:d,background:m,onColored:p,brandPresetUsed:_,children:[jsxRuntime.jsx(style.Input,{...g,...k===void 0?{defaultChecked:b}:{checked:k},id:u||c,name:c,type:"checkbox",value:a,disabled:i,onChange:v}),_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m&&jsxRuntime.jsx(style.Background,{}),jsxRuntime.jsx(style.BrandMask,{children:jsxRuntime.jsx(style.CheckIcon,{})})]}):jsxRuntime.jsx(style.DefaultMask,{}),(C||h)&&jsxRuntime.jsx(style.Content,{className:I,children:C||h})]})}));Checkbox.Input=InputCheckbox.InputCheckbox,Checkbox.Group=Group.CheckboxGroup,Checkbox.displayName="Checkbox",exports.COMPONENT_NAME="Checkbox",exports.Checkbox=Checkbox;
1
+ 'use strict';var React=require('react');var styled=require('styled-components');var useClassname=require('../../hooks/useClassname.js');var useConfigPriority=require('../../hooks/use-config-priority.js');var dom=require('../../shared/utils/dom.js');var Group=require('./Group.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var InputCheckbox=require('../InputCheckbox/InputCheckbox.js');const Checkbox=React.forwardRef(((e,s)=>{const r=styled.useTheme();const t=useClassname.useClassname("Checkbox");const{preset:o,style:n,id:a,name:c,value:i,disabled:u,error:l,success:d,fluid:h,children:x,label:C,checked:m,defaultChecked:k,background:b,onColored:j,size:p="m",inline:y=!0,width:f=r.defaultInputControlsWidth,className:R,onChange:v=()=>{},...g}=useConfigPriority.useConfigPriority(r.components?.Checkbox,e);let q=r.preset==='brand';typeof o=='string'&&(q=o==='brand');const I=dom.concatClassNames(t,R,m&&`${t}--checked`);const N=`${t}__label`;return jsxRuntime.jsxs(style.Root,{ref:s,className:I,style:n,fluid:h,disabled:u,htmlFor:a||c,size:p,inline:y,width:f,error:l,success:d,background:b,onColored:j,brandPresetUsed:q,children:[jsxRuntime.jsx(style.Input,{...g,...m===void 0?{defaultChecked:k}:{checked:m},id:a||c,name:c,type:"checkbox",value:i,disabled:u,onChange:v}),q?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b&&jsxRuntime.jsx(style.Background,{}),jsxRuntime.jsx(style.BrandMask,{children:jsxRuntime.jsx(style.CheckIcon,{})})]}):jsxRuntime.jsx(style.DefaultMask,{}),(C||x)&&jsxRuntime.jsx(style.Content,{className:N,children:C||x})]})}));Checkbox.Input=InputCheckbox.InputCheckbox,Checkbox.Group=Group.CheckboxGroup,Checkbox.displayName="Checkbox",exports.COMPONENT_NAME="Checkbox",exports.Checkbox=Checkbox;
2
2
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport cx from 'clsx'\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport { InputCheckbox } from 'components/InputCheckbox'\nimport { CheckboxGroup } from './Group'\nimport type { CheckboxComponent, CheckboxProps } from './types'\n\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Checkbox'\n\nconst Checkbox = forwardRef<HTMLLabelElement, CheckboxProps>((props, ref) => {\n const theme = useTheme()\n const baseClassName = useClassname(COMPONENT_NAME)\n\n const {\n preset,\n style,\n id,\n name,\n value,\n disabled,\n error,\n success,\n fluid,\n children,\n label,\n checked,\n defaultChecked,\n background,\n onColored,\n size = 'm',\n inline = true,\n width = theme.defaultInputControlsWidth,\n className: _className,\n onChange = () => undefined,\n ...configProps\n } = useConfigPriority<CheckboxProps>(theme.components?.Checkbox, props)\n\n let brandPresetUsed = theme.preset === 'brand'\n if (typeof preset === 'string') brandPresetUsed = preset === 'brand'\n\n const className = cx(baseClassName, _className, checked && `${baseClassName}--checked`)\n const labelClassName = `${baseClassName}__label`\n const inputProps = checked === undefined ? { defaultChecked } : { checked }\n\n return (\n <Styled.Root\n ref={ref}\n className={className}\n style={style}\n fluid={fluid}\n disabled={disabled}\n htmlFor={id || name}\n size={size}\n inline={inline}\n width={width}\n error={error}\n success={success}\n background={background}\n onColored={onColored}\n brandPresetUsed={brandPresetUsed}\n >\n <Styled.Input\n {...configProps}\n {...inputProps}\n id={id || name}\n name={name}\n type='checkbox'\n value={value}\n disabled={disabled}\n onChange={onChange}\n />\n {brandPresetUsed ? (\n <>\n {background && <Styled.Background />}\n <Styled.BrandMask>\n <Styled.CheckIcon />\n </Styled.BrandMask>\n </>\n ) : (\n <Styled.DefaultMask />\n )}\n {(label || children) && <Styled.Content className={labelClassName}>{label || children}</Styled.Content>}\n </Styled.Root>\n )\n}) as CheckboxComponent\n\nCheckbox.Input = InputCheckbox\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = COMPONENT_NAME\n\nexport { Checkbox, COMPONENT_NAME }\n\nexport type { CheckboxProps }\n"],"names":["Checkbox","forwardRef","props","ref","theme","useTheme","baseClassName","useClassname","preset","style","id","name","value","disabled","error","success","fluid","children","label","checked","defaultChecked","background","onColored","size","inline","width","defaultInputControlsWidth","className","_className","onChange","configProps","useConfigPriority","components","brandPresetUsed","cx","labelClassName","_jsxs","Styled","htmlFor","_jsx","jsx","undefined","type","jsxs","_Fragment","Background","CheckIcon","Input","InputCheckbox","Group","CheckboxGroup","displayName"],"mappings":"mfAaMA,MAAAA,SAAWC,MAAUA,YAAkC,CAACC,EAAOC,KACnE,MAAMC,EAAQC,OAAAA,WACd,MAAMC,EAAgBC,0BAJD,YAMrB,MAAMC,OACJA,QACAC,EAAKC,GACLA,EAAEC,KACFA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,eACPA,EAAcC,WACdA,EAAUC,UACVA,EAASC,KACTA,EAAO,IAAGC,OACVA,GAAS,EAAIC,MACbA,EAAQrB,EAAMsB,0BACdC,UAAWC,EAAUC,SACrBA,EAAWA,KAAe,KACvBC,GACDC,kBAAiBA,kBAAgB3B,EAAM4B,YAAYhC,SAAUE,GAEjE,IAAI+B,EAAkB7B,EAAMI,SAAW,eAC5BA,GAAW,WAAUyB,EAAkBzB,IAAW,SAE7D,MAAMmB,EAAYO,oBAAG5B,EAAesB,EAAYT,GAAW,GAAGb,cAC9D,MAAM6B,EAAiB,GAAG7B,WAG1B,OACE8B,WAAAA,KAACC,MAAAA,KAAW,CACVlC,IAAKA,EACLwB,UAAWA,EACXlB,MAAOA,EACPO,MAAOA,EACPH,SAAUA,EACVyB,QAAS5B,GAAMC,EACfY,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPX,MAAOA,EACPC,QAASA,EACTM,WAAYA,EACZC,UAAWA,EACXW,gBAAiBA,EAAgBhB,SAEjCsB,CAAAA,WAAAC,IAACH,YAAY,IACPP,KApBSX,SAAYsB,EAAY,CAAErB,kBAAmB,CAAED,WAsB5DT,GAAIA,GAAMC,EACVA,KAAMA,EACN+B,KAAK,WACL9B,MAAOA,EACPC,SAAUA,EACVgB,SAAUA,IAEXI,EACCG,WAAAO,KAAAC,oBAAA,CAAA3B,SACGI,CAAAA,GAAckB,WAAAC,IAACH,MAAiBQ,WAAA,IACjCN,WAAAC,IAACH,gBAAgB,CAAApB,SACfsB,WAAAA,IAACF,MAAgBS,UAAE,SAIvBP,WAAAA,IAACF,MAAAA,YAAoB,CAAA,IAErBnB,GAASD,IAAasB,WAAAC,IAACH,cAAc,CAACV,UAAWQ,EAAelB,SAAEC,GAASD,MACjE,IAIlBjB,SAAS+C,MAAQC,cAAAA,cACjBhD,SAASiD,MAAQC,MAAAA,cAEjBlD,SAASmD,YAlFc,kCAAA"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport { InputCheckbox } from 'components/InputCheckbox'\nimport { concatClassNames } from 'shared/utils/dom'\nimport { CheckboxGroup } from './Group'\nimport type { CheckboxComponent, CheckboxProps } from './types'\n\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Checkbox'\n\nconst Checkbox = forwardRef<HTMLLabelElement, CheckboxProps>((props, ref) => {\n const theme = useTheme()\n const baseClassName = useClassname(COMPONENT_NAME)\n\n const {\n preset,\n style,\n id,\n name,\n value,\n disabled,\n error,\n success,\n fluid,\n children,\n label,\n checked,\n defaultChecked,\n background,\n onColored,\n size = 'm',\n inline = true,\n width = theme.defaultInputControlsWidth,\n className: _className,\n onChange = () => undefined,\n ...configProps\n } = useConfigPriority<CheckboxProps>(theme.components?.Checkbox, props)\n\n let brandPresetUsed = theme.preset === 'brand'\n if (typeof preset === 'string') brandPresetUsed = preset === 'brand'\n\n const className = concatClassNames(baseClassName, _className, checked && `${baseClassName}--checked`)\n const labelClassName = `${baseClassName}__label`\n const inputProps = checked === undefined ? { defaultChecked } : { checked }\n\n return (\n <Styled.Root\n ref={ref}\n className={className}\n style={style}\n fluid={fluid}\n disabled={disabled}\n htmlFor={id || name}\n size={size}\n inline={inline}\n width={width}\n error={error}\n success={success}\n background={background}\n onColored={onColored}\n brandPresetUsed={brandPresetUsed}\n >\n <Styled.Input\n {...configProps}\n {...inputProps}\n id={id || name}\n name={name}\n type='checkbox'\n value={value}\n disabled={disabled}\n onChange={onChange}\n />\n {brandPresetUsed ? (\n <>\n {background && <Styled.Background />}\n <Styled.BrandMask>\n <Styled.CheckIcon />\n </Styled.BrandMask>\n </>\n ) : (\n <Styled.DefaultMask />\n )}\n {(label || children) && <Styled.Content className={labelClassName}>{label || children}</Styled.Content>}\n </Styled.Root>\n )\n}) as CheckboxComponent\n\nCheckbox.Input = InputCheckbox\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = COMPONENT_NAME\n\nexport { Checkbox, COMPONENT_NAME }\n\nexport type { CheckboxProps }\n"],"names":["Checkbox","forwardRef","props","ref","theme","useTheme","baseClassName","useClassname","preset","style","id","name","value","disabled","error","success","fluid","children","label","checked","defaultChecked","background","onColored","size","inline","width","defaultInputControlsWidth","className","_className","onChange","configProps","useConfigPriority","components","brandPresetUsed","concatClassNames","labelClassName","_jsxs","Styled","htmlFor","_jsx","jsx","undefined","type","jsxs","_Fragment","Background","CheckIcon","Input","InputCheckbox","Group","CheckboxGroup","displayName"],"mappings":"oaAaMA,MAAAA,SAAWC,MAAUA,YAAkC,CAACC,EAAOC,KACnE,MAAMC,EAAQC,OAAAA,WACd,MAAMC,EAAgBC,0BAJD,YAMrB,MAAMC,OACJA,QACAC,EAAKC,GACLA,EAAEC,KACFA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,eACPA,EAAcC,WACdA,EAAUC,UACVA,EAASC,KACTA,EAAO,IAAGC,OACVA,GAAS,EAAIC,MACbA,EAAQrB,EAAMsB,0BACdC,UAAWC,EAAUC,SACrBA,EAAWA,KAAe,KACvBC,GACDC,kBAAiBA,kBAAgB3B,EAAM4B,YAAYhC,SAAUE,GAEjE,IAAI+B,EAAkB7B,EAAMI,SAAW,eAC5BA,GAAW,WAAUyB,EAAkBzB,IAAW,SAE7D,MAAMmB,EAAYO,qBAAiB5B,EAAesB,EAAYT,GAAW,GAAGb,cAC5E,MAAM6B,EAAiB,GAAG7B,WAG1B,OACE8B,WAAAA,KAACC,MAAAA,KAAW,CACVlC,IAAKA,EACLwB,UAAWA,EACXlB,MAAOA,EACPO,MAAOA,EACPH,SAAUA,EACVyB,QAAS5B,GAAMC,EACfY,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPX,MAAOA,EACPC,QAASA,EACTM,WAAYA,EACZC,UAAWA,EACXW,gBAAiBA,EAAgBhB,SAEjCsB,CAAAA,WAAAC,IAACH,YAAY,IACPP,KApBSX,SAAYsB,EAAY,CAAErB,kBAAmB,CAAED,WAsB5DT,GAAIA,GAAMC,EACVA,KAAMA,EACN+B,KAAK,WACL9B,MAAOA,EACPC,SAAUA,EACVgB,SAAUA,IAEXI,EACCG,WAAAO,KAAAC,oBAAA,CAAA3B,SACGI,CAAAA,GAAckB,WAAAC,IAACH,MAAiBQ,WAAA,IACjCN,WAAAC,IAACH,gBAAgB,CAAApB,SACfsB,WAAAA,IAACF,MAAgBS,UAAE,SAIvBP,WAAAA,IAACF,MAAAA,YAAoB,CAAA,IAErBnB,GAASD,IAAasB,WAAAC,IAACH,cAAc,CAACV,UAAWQ,EAAelB,SAAEC,GAASD,MACjE,IAIlBjB,SAAS+C,MAAQC,cAAAA,cACjBhD,SAASiD,MAAQC,MAAAA,cAEjBlD,SAASmD,YAlFc,kCAAA"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import{useTheme}from'styled-components';import cx from'clsx';import{useClassname}from'../../hooks/useClassname.mjs';import{useConfigPriority}from'../../hooks/use-config-priority.mjs';import{CheckboxGroup}from'./Group.mjs';import{Root,Input,Background,BrandMask,CheckIcon,DefaultMask,Content}from'./style.mjs';import{jsxs,jsx,Fragment}from'react/jsx-runtime';import{InputCheckbox}from'../InputCheckbox/InputCheckbox.mjs';const COMPONENT_NAME='Checkbox';const Checkbox=forwardRef(((e,o)=>{const s=useTheme();const r=useClassname("Checkbox");const{preset:n,style:t,id:c,name:a,value:d,disabled:i,error:m,success:l,fluid:h,children:u,label:k,checked:C,defaultChecked:x,background:p,onColored:b,size:f="m",inline:j=!0,width:g=s.defaultInputControlsWidth,className:y,onChange:I=()=>{},...N}=useConfigPriority(s.components?.Checkbox,e);let M=s.preset==='brand';typeof n=='string'&&(M=n==='brand');const P=cx(r,y,C&&`${r}--checked`);const w=`${r}__label`;return jsxs(Root,{ref:o,className:P,style:t,fluid:h,disabled:i,htmlFor:c||a,size:f,inline:j,width:g,error:m,success:l,background:p,onColored:b,brandPresetUsed:M,children:[jsx(Input,{...N,...C===void 0?{defaultChecked:x}:{checked:C},id:c||a,name:a,type:"checkbox",value:d,disabled:i,onChange:I}),M?jsxs(Fragment,{children:[p&&jsx(Background,{}),jsx(BrandMask,{children:jsx(CheckIcon,{})})]}):jsx(DefaultMask,{}),(k||u)&&jsx(Content,{className:w,children:k||u})]})}));Checkbox.Input=InputCheckbox,Checkbox.Group=CheckboxGroup,Checkbox.displayName="Checkbox";export{COMPONENT_NAME,Checkbox};
1
+ import{forwardRef}from'react';import{useTheme}from'styled-components';import{useClassname}from'../../hooks/useClassname.mjs';import{useConfigPriority}from'../../hooks/use-config-priority.mjs';import{concatClassNames}from'../../shared/utils/dom.mjs';import{CheckboxGroup}from'./Group.mjs';import{Root,Input,Background,BrandMask,CheckIcon,DefaultMask,Content}from'./style.mjs';import{jsxs,jsx,Fragment}from'react/jsx-runtime';import{InputCheckbox}from'../InputCheckbox/InputCheckbox.mjs';const COMPONENT_NAME='Checkbox';const Checkbox=forwardRef(((e,o)=>{const s=useTheme();const r=useClassname("Checkbox");const{preset:t,style:n,id:c,name:a,value:d,disabled:m,error:i,success:l,fluid:h,children:u,label:C,checked:k,defaultChecked:p,background:x,onColored:b,size:f="m",inline:j=!0,width:g=s.defaultInputControlsWidth,className:N,onChange:y=()=>{},...I}=useConfigPriority(s.components?.Checkbox,e);let M=s.preset==='brand';typeof t=='string'&&(M=t==='brand');const P=concatClassNames(r,N,k&&`${r}--checked`);const w=`${r}__label`;return jsxs(Root,{ref:o,className:P,style:n,fluid:h,disabled:m,htmlFor:c||a,size:f,inline:j,width:g,error:i,success:l,background:x,onColored:b,brandPresetUsed:M,children:[jsx(Input,{...I,...k===void 0?{defaultChecked:p}:{checked:k},id:c||a,name:a,type:"checkbox",value:d,disabled:m,onChange:y}),M?jsxs(Fragment,{children:[x&&jsx(Background,{}),jsx(BrandMask,{children:jsx(CheckIcon,{})})]}):jsx(DefaultMask,{}),(C||u)&&jsx(Content,{className:w,children:C||u})]})}));Checkbox.Input=InputCheckbox,Checkbox.Group=CheckboxGroup,Checkbox.displayName="Checkbox";export{COMPONENT_NAME,Checkbox};
2
2
  //# sourceMappingURL=Checkbox.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.mjs","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport cx from 'clsx'\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport { InputCheckbox } from 'components/InputCheckbox'\nimport { CheckboxGroup } from './Group'\nimport type { CheckboxComponent, CheckboxProps } from './types'\n\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Checkbox'\n\nconst Checkbox = forwardRef<HTMLLabelElement, CheckboxProps>((props, ref) => {\n const theme = useTheme()\n const baseClassName = useClassname(COMPONENT_NAME)\n\n const {\n preset,\n style,\n id,\n name,\n value,\n disabled,\n error,\n success,\n fluid,\n children,\n label,\n checked,\n defaultChecked,\n background,\n onColored,\n size = 'm',\n inline = true,\n width = theme.defaultInputControlsWidth,\n className: _className,\n onChange = () => undefined,\n ...configProps\n } = useConfigPriority<CheckboxProps>(theme.components?.Checkbox, props)\n\n let brandPresetUsed = theme.preset === 'brand'\n if (typeof preset === 'string') brandPresetUsed = preset === 'brand'\n\n const className = cx(baseClassName, _className, checked && `${baseClassName}--checked`)\n const labelClassName = `${baseClassName}__label`\n const inputProps = checked === undefined ? { defaultChecked } : { checked }\n\n return (\n <Styled.Root\n ref={ref}\n className={className}\n style={style}\n fluid={fluid}\n disabled={disabled}\n htmlFor={id || name}\n size={size}\n inline={inline}\n width={width}\n error={error}\n success={success}\n background={background}\n onColored={onColored}\n brandPresetUsed={brandPresetUsed}\n >\n <Styled.Input\n {...configProps}\n {...inputProps}\n id={id || name}\n name={name}\n type='checkbox'\n value={value}\n disabled={disabled}\n onChange={onChange}\n />\n {brandPresetUsed ? (\n <>\n {background && <Styled.Background />}\n <Styled.BrandMask>\n <Styled.CheckIcon />\n </Styled.BrandMask>\n </>\n ) : (\n <Styled.DefaultMask />\n )}\n {(label || children) && <Styled.Content className={labelClassName}>{label || children}</Styled.Content>}\n </Styled.Root>\n )\n}) as CheckboxComponent\n\nCheckbox.Input = InputCheckbox\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = COMPONENT_NAME\n\nexport { Checkbox, COMPONENT_NAME }\n\nexport type { CheckboxProps }\n"],"names":["COMPONENT_NAME","Checkbox","forwardRef","props","ref","theme","useTheme","baseClassName","useClassname","preset","style","id","name","value","disabled","error","success","fluid","children","label","checked","defaultChecked","background","onColored","size","inline","width","defaultInputControlsWidth","className","_className","onChange","configProps","useConfigPriority","components","brandPresetUsed","cx","labelClassName","_jsxs","Styled","htmlFor","_jsx","undefined","type","_Fragment","Input","InputCheckbox","Group","CheckboxGroup","displayName"],"mappings":"kcAWMA,MAAAA,eAAiB,WAEjBC,MAAAA,SAAWC,YAA4C,CAACC,EAAOC,KACnE,MAAMC,EAAQC,WACd,MAAMC,EAAgBC,aAJD,YAMrB,MAAMC,OACJA,EAAMC,MACNA,EAAKC,GACLA,EAAEC,KACFA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,eACPA,EAAcC,WACdA,EAAUC,UACVA,EAASC,KACTA,EAAO,IAAGC,OACVA,GAAS,EAAIC,MACbA,EAAQrB,EAAMsB,0BACdC,UAAWC,EAAUC,SACrBA,EAAWA,KAAe,KACvBC,GACDC,kBAAiC3B,EAAM4B,YAAYhC,SAAUE,GAEjE,IAAI+B,EAAkB7B,EAAMI,SAAW,eAC5BA,GAAW,WAAUyB,EAAkBzB,IAAW,SAE7D,MAAMmB,EAAYO,GAAG5B,EAAesB,EAAYT,GAAW,GAAGb,cAC9D,MAAM6B,EAAiB,GAAG7B,WAG1B,OACE8B,KAACC,KAAW,CACVlC,IAAKA,EACLwB,UAAWA,EACXlB,MAAOA,EACPO,MAAOA,EACPH,SAAUA,EACVyB,QAAS5B,GAAMC,EACfY,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPX,MAAOA,EACPC,QAASA,EACTM,WAAYA,EACZC,UAAWA,EACXW,gBAAiBA,EAAgBhB,SAEjCsB,CAAAA,IAACF,MAAY,IACPP,KApBSX,SAAYqB,EAAY,CAAEpB,kBAAmB,CAAED,WAsB5DT,GAAIA,GAAMC,EACVA,KAAMA,EACN8B,KAAK,WACL7B,MAAOA,EACPC,SAAUA,EACVgB,SAAUA,IAEXI,EACCG,KAAAM,SAAA,CAAAzB,SACGI,CAAAA,GAAckB,IAACF,WAAiB,IACjCE,IAACF,UAAgB,CAAApB,SACfsB,IAACF,UAAkB,SAIvBE,IAACF,YAAoB,CAAA,IAErBnB,GAASD,IAAasB,IAACF,QAAc,CAACV,UAAWQ,EAAelB,SAAEC,GAASD,MACjE,IAIlBjB,SAAS2C,MAAQC,cACjB5C,SAAS6C,MAAQC,cAEjB9C,SAAS+C,YAlFc"}
1
+ {"version":3,"file":"Checkbox.mjs","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\nimport { InputCheckbox } from 'components/InputCheckbox'\nimport { concatClassNames } from 'shared/utils/dom'\nimport { CheckboxGroup } from './Group'\nimport type { CheckboxComponent, CheckboxProps } from './types'\n\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Checkbox'\n\nconst Checkbox = forwardRef<HTMLLabelElement, CheckboxProps>((props, ref) => {\n const theme = useTheme()\n const baseClassName = useClassname(COMPONENT_NAME)\n\n const {\n preset,\n style,\n id,\n name,\n value,\n disabled,\n error,\n success,\n fluid,\n children,\n label,\n checked,\n defaultChecked,\n background,\n onColored,\n size = 'm',\n inline = true,\n width = theme.defaultInputControlsWidth,\n className: _className,\n onChange = () => undefined,\n ...configProps\n } = useConfigPriority<CheckboxProps>(theme.components?.Checkbox, props)\n\n let brandPresetUsed = theme.preset === 'brand'\n if (typeof preset === 'string') brandPresetUsed = preset === 'brand'\n\n const className = concatClassNames(baseClassName, _className, checked && `${baseClassName}--checked`)\n const labelClassName = `${baseClassName}__label`\n const inputProps = checked === undefined ? { defaultChecked } : { checked }\n\n return (\n <Styled.Root\n ref={ref}\n className={className}\n style={style}\n fluid={fluid}\n disabled={disabled}\n htmlFor={id || name}\n size={size}\n inline={inline}\n width={width}\n error={error}\n success={success}\n background={background}\n onColored={onColored}\n brandPresetUsed={brandPresetUsed}\n >\n <Styled.Input\n {...configProps}\n {...inputProps}\n id={id || name}\n name={name}\n type='checkbox'\n value={value}\n disabled={disabled}\n onChange={onChange}\n />\n {brandPresetUsed ? (\n <>\n {background && <Styled.Background />}\n <Styled.BrandMask>\n <Styled.CheckIcon />\n </Styled.BrandMask>\n </>\n ) : (\n <Styled.DefaultMask />\n )}\n {(label || children) && <Styled.Content className={labelClassName}>{label || children}</Styled.Content>}\n </Styled.Root>\n )\n}) as CheckboxComponent\n\nCheckbox.Input = InputCheckbox\nCheckbox.Group = CheckboxGroup\n\nCheckbox.displayName = COMPONENT_NAME\n\nexport { Checkbox, COMPONENT_NAME }\n\nexport type { CheckboxProps }\n"],"names":["COMPONENT_NAME","Checkbox","forwardRef","props","ref","theme","useTheme","baseClassName","useClassname","preset","style","id","name","value","disabled","error","success","fluid","children","label","checked","defaultChecked","background","onColored","size","inline","width","defaultInputControlsWidth","className","_className","onChange","configProps","useConfigPriority","components","brandPresetUsed","concatClassNames","labelClassName","_jsxs","Styled","htmlFor","_jsx","undefined","type","_Fragment","Input","InputCheckbox","Group","CheckboxGroup","displayName"],"mappings":"seAWMA,MAAAA,eAAiB,WAEjBC,MAAAA,SAAWC,YAA4C,CAACC,EAAOC,KACnE,MAAMC,EAAQC,WACd,MAAMC,EAAgBC,aAJD,YAMrB,MAAMC,OACJA,EAAMC,MACNA,EAAKC,GACLA,EAAEC,KACFA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,eACPA,EAAcC,WACdA,EAAUC,UACVA,EAASC,KACTA,EAAO,IAAGC,OACVA,GAAS,EAAIC,MACbA,EAAQrB,EAAMsB,0BACdC,UAAWC,EAAUC,SACrBA,EAAWA,KAAe,KACvBC,GACDC,kBAAiC3B,EAAM4B,YAAYhC,SAAUE,GAEjE,IAAI+B,EAAkB7B,EAAMI,SAAW,eAC5BA,GAAW,WAAUyB,EAAkBzB,IAAW,SAE7D,MAAMmB,EAAYO,iBAAiB5B,EAAesB,EAAYT,GAAW,GAAGb,cAC5E,MAAM6B,EAAiB,GAAG7B,WAG1B,OACE8B,KAACC,KAAW,CACVlC,IAAKA,EACLwB,UAAWA,EACXlB,MAAOA,EACPO,MAAOA,EACPH,SAAUA,EACVyB,QAAS5B,GAAMC,EACfY,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPX,MAAOA,EACPC,QAASA,EACTM,WAAYA,EACZC,UAAWA,EACXW,gBAAiBA,EAAgBhB,SAEjCsB,CAAAA,IAACF,MAAY,IACPP,KApBSX,SAAYqB,EAAY,CAAEpB,kBAAmB,CAAED,WAsB5DT,GAAIA,GAAMC,EACVA,KAAMA,EACN8B,KAAK,WACL7B,MAAOA,EACPC,SAAUA,EACVgB,SAAUA,IAEXI,EACCG,KAAAM,SAAA,CAAAzB,SACGI,CAAAA,GAAckB,IAACF,WAAiB,IACjCE,IAACF,UAAgB,CAAApB,SACfsB,IAACF,UAAkB,SAIvBE,IAACF,YAAoB,CAAA,IAErBnB,GAASD,IAAasB,IAACF,QAAc,CAACV,UAAWQ,EAAelB,SAAEC,GAASD,MACjE,IAIlBjB,SAAS2C,MAAQC,cACjB5C,SAAS6C,MAAQC,cAEjB9C,SAAS+C,YAlFc"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var ReactModal=require('react-modal');var ramda=require('ramda');var withMergedProps=require('../../hocs/withMergedProps.js');var withTranslation=require('../../hocs/withTranslation.js');var constants$1=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var DialogComponent=require('../DialogComponent/DialogComponent.js');var constants=require('../DialogComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ReactModal__default=_interopDefault(ReactModal);const TranslationDialogComponent=withTranslation.withTranslation(React.forwardRef(((e,o)=>{const{positions:n={},translated:a,...s}=e;const t=a?{}:ramda.mergeDeepLeft(n,constants$1.POSITIONS);return jsxRuntime.jsx(style.PositionedDialogComponent,{...s,positions:t,ref:o})})));const Dialog=Object.assign(withMergedProps.withMergedProps((e=>{const{size:o="s",position:n="center",role:a="dialog",open:s,preventScrollAfterClose:t,closeTimeoutMS:r,portalClassName:l,className:i,bodyOpenClassName:c,htmlOpenClassName:u,overlayClassName:d,shouldCloseOnOverlayClick:p,shouldCloseOnEsc:C,shouldReturnFocusAfterClose:m,parentSelector:g,overlayRef:D,contentRef:f,palette:v,overlayBlur:y,overlayDisabled:M,zIndex:h,onAfterOpen:w,onAfterClose:N,onRequestClose:R,...O}=e;const j=O.draggable||M;return jsxRuntime.jsx(ReactModal__default.default,{isOpen:s,ariaHideApp:!1,preventScroll:t,closeTimeoutMS:r,portalClassName:l,className:i,bodyOpenClassName:c,htmlOpenClassName:u,overlayClassName:d,shouldCloseOnOverlayClick:p,shouldCloseOnEsc:C,shouldReturnFocusAfterClose:m,parentSelector:g,overlayRef:D,contentRef:f,onAfterOpen:w,onAfterClose:N,onRequestClose:R,contentElement:e=>{const{ref:s,className:t,tabIndex:r,onKeyDown:l,onMouseDown:i,onMouseUp:c,onClick:u}=e;return jsxRuntime.jsx(TranslationDialogComponent,{...O,ref:s,size:o,role:a,className:t,tabIndex:r,position:n,"aria-modal":!O.draggable&&!M,palette:{color:v.color,backgroundColor:v.backgroundColor,shadowColor:v.shadowColor},zIndex:j?h:void 0,onKeyDown:e=>{O.onKeyDown&&O.onKeyDown(e),l&&l(e)},onMouseDown:e=>{O.onMouseDown&&O.onMouseDown(e),i&&i(e)},onMouseUp:e=>{O.onMouseUp&&O.onMouseUp(e),c&&c(e)},onClick:e=>{O.onClick&&O.onClick(e),u&&u(e)}})},overlayElement:(e,o)=>{const{ref:n,className:a,onClick:s,onMouseDown:t}=e;return j?o:jsxRuntime.jsx(style.DialogOverlay,{ref:n,className:a,blur:y,palette:{backgroundColor:v.overlayBackgroundColor},zIndex:h,onClick:s,onMouseDown:t,children:o})}})}),{sizes:e=>e.fancy?constants.SIZES_FANCY:constants.SIZES,displayName:"Dialog"}),{Component:DialogComponent.DialogComponent});exports.COMPONENT_NAME="Dialog",exports.Dialog=Dialog;
1
+ 'use strict';var React=require('react');var ReactModal=require('react-modal');var withMergedProps=require('../../hocs/withMergedProps.js');var withTranslation=require('../../hocs/withTranslation.js');var misc=require('../../shared/utils/misc.js');var constants$1=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var DialogComponent=require('../DialogComponent/DialogComponent.js');var constants=require('../DialogComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ReactModal__default=_interopDefault(ReactModal);const TranslationDialogComponent=withTranslation.withTranslation(React.forwardRef(((e,o)=>{const{positions:n={},translated:s,...a}=e;const t=s?{}:misc.deepmerge(constants$1.POSITIONS,n);return jsxRuntime.jsx(style.PositionedDialogComponent,{...a,positions:t,ref:o})})));const Dialog=Object.assign(withMergedProps.withMergedProps((e=>{const{size:o="s",position:n="center",role:s="dialog",open:a,preventScrollAfterClose:t,closeTimeoutMS:r,portalClassName:l,className:i,bodyOpenClassName:c,htmlOpenClassName:u,overlayClassName:d,shouldCloseOnOverlayClick:p,shouldCloseOnEsc:C,shouldReturnFocusAfterClose:m,parentSelector:g,overlayRef:D,contentRef:f,palette:v,overlayBlur:y,overlayDisabled:M,zIndex:h,onAfterOpen:w,onAfterClose:N,onRequestClose:R,...O}=e;const j=O.draggable||M;return jsxRuntime.jsx(ReactModal__default.default,{isOpen:a,ariaHideApp:!1,preventScroll:t,closeTimeoutMS:r,portalClassName:l,className:i,bodyOpenClassName:c,htmlOpenClassName:u,overlayClassName:d,shouldCloseOnOverlayClick:p,shouldCloseOnEsc:C,shouldReturnFocusAfterClose:m,parentSelector:g,overlayRef:D,contentRef:f,onAfterOpen:w,onAfterClose:N,onRequestClose:R,contentElement:e=>{const{ref:a,className:t,tabIndex:r,onKeyDown:l,onMouseDown:i,onMouseUp:c,onClick:u}=e;return jsxRuntime.jsx(TranslationDialogComponent,{...O,ref:a,size:o,role:s,className:t,tabIndex:r,position:n,"aria-modal":!O.draggable&&!M,palette:{color:v.color,backgroundColor:v.backgroundColor,shadowColor:v.shadowColor},zIndex:j?h:void 0,onKeyDown:e=>{O.onKeyDown&&O.onKeyDown(e),l&&l(e)},onMouseDown:e=>{O.onMouseDown&&O.onMouseDown(e),i&&i(e)},onMouseUp:e=>{O.onMouseUp&&O.onMouseUp(e),c&&c(e)},onClick:e=>{O.onClick&&O.onClick(e),u&&u(e)}})},overlayElement:(e,o)=>{const{ref:n,className:s,onClick:a,onMouseDown:t}=e;return j?o:jsxRuntime.jsx(style.DialogOverlay,{ref:n,className:s,blur:y,palette:{backgroundColor:v.overlayBackgroundColor},zIndex:h,onClick:a,onMouseDown:t,children:o})}})}),{sizes:e=>e.fancy?constants.SIZES_FANCY:constants.SIZES,displayName:"Dialog"}),{Component:DialogComponent.DialogComponent});exports.COMPONENT_NAME="Dialog",exports.Dialog=Dialog;
2
2
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport ReactModal from 'react-modal'\nimport { mergeDeepLeft } from 'ramda'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { withTranslation } from 'hocs/withTranslation'\nimport { DialogComponent, SIZES, SIZES_FANCY } from 'components/DialogComponent'\nimport { POSITIONS } from './constants'\nimport * as Styled from './style'\nimport type { DialogProps, TranslationDialogComponentProps } from './types'\n\nconst COMPONENT_NAME = 'Dialog'\n\nconst TranslationDialogComponent = withTranslation<HTMLDivElement, TranslationDialogComponentProps>(\n forwardRef((props, ref) => {\n const { positions = {}, translated, ...restProps } = props\n\n const dialogPositions = translated ? {} : mergeDeepLeft(positions, POSITIONS)\n\n return <Styled.PositionedDialogComponent {...restProps} positions={dialogPositions} ref={ref} />\n })\n)\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и позиции в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-modal\"](https://www.npmjs.com/package/react-modal).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через Dialog.Component.\n *\n * Полный интерфейс Dialog можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Dialog/types.ts), интерфейс Dialog.Component [тут](https://github.com/foxford/ui/blob/master/src/components/DialogComponent/types.ts).\n *\n */\nconst Dialog: React.ForwardRefExoticComponent<DialogProps> & { Component: typeof DialogComponent } = Object.assign(\n withMergedProps<DialogProps, HTMLDivElement>(\n (props) => {\n const {\n size = 's',\n position = 'center',\n role = 'dialog',\n open,\n preventScrollAfterClose,\n closeTimeoutMS,\n portalClassName,\n className,\n bodyOpenClassName,\n htmlOpenClassName,\n overlayClassName,\n shouldCloseOnOverlayClick,\n shouldCloseOnEsc,\n shouldReturnFocusAfterClose,\n parentSelector,\n overlayRef,\n contentRef,\n palette,\n overlayBlur,\n overlayDisabled,\n zIndex,\n onAfterOpen,\n onAfterClose,\n onRequestClose,\n ...dialogProps\n } = props\n\n const overlayElementDisabled = dialogProps.draggable || overlayDisabled\n\n return (\n <ReactModal\n isOpen={open}\n ariaHideApp={false}\n preventScroll={preventScrollAfterClose}\n closeTimeoutMS={closeTimeoutMS}\n portalClassName={portalClassName}\n className={className}\n bodyOpenClassName={bodyOpenClassName}\n htmlOpenClassName={htmlOpenClassName}\n overlayClassName={overlayClassName}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n shouldCloseOnEsc={shouldCloseOnEsc}\n shouldReturnFocusAfterClose={shouldReturnFocusAfterClose}\n parentSelector={parentSelector}\n overlayRef={overlayRef}\n contentRef={contentRef}\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onRequestClose={onRequestClose}\n contentElement={(contentProps) => {\n const { ref, className, tabIndex, onKeyDown, onMouseDown, onMouseUp, onClick } = contentProps\n\n return (\n <TranslationDialogComponent\n {...dialogProps}\n ref={ref}\n size={size}\n role={role}\n className={className}\n tabIndex={tabIndex}\n position={position}\n aria-modal={!dialogProps.draggable && !overlayDisabled}\n palette={{\n color: palette.color,\n backgroundColor: palette.backgroundColor,\n shadowColor: palette.shadowColor,\n }}\n zIndex={overlayElementDisabled ? zIndex : undefined}\n onKeyDown={(evt) => {\n if (dialogProps.onKeyDown) dialogProps.onKeyDown(evt)\n if (onKeyDown) onKeyDown(evt)\n }}\n onMouseDown={(evt) => {\n if (dialogProps.onMouseDown) dialogProps.onMouseDown(evt)\n if (onMouseDown) onMouseDown(evt)\n }}\n onMouseUp={(evt) => {\n if (dialogProps.onMouseUp) dialogProps.onMouseUp(evt)\n if (onMouseUp) onMouseUp(evt)\n }}\n onClick={(evt) => {\n if (dialogProps.onClick) dialogProps.onClick(evt)\n if (onClick) onClick(evt)\n }}\n />\n )\n }}\n overlayElement={(overlayProps, contentElement) => {\n const { ref, className, onClick, onMouseDown } = overlayProps\n\n return overlayElementDisabled ? (\n contentElement\n ) : (\n <Styled.DialogOverlay\n ref={ref}\n className={className}\n blur={overlayBlur}\n palette={{\n backgroundColor: palette.overlayBackgroundColor,\n }}\n zIndex={zIndex}\n onClick={onClick}\n onMouseDown={onMouseDown}\n >\n {contentElement}\n </Styled.DialogOverlay>\n )\n }}\n />\n )\n },\n {\n sizes: (props) => (props.fancy ? SIZES_FANCY : SIZES),\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Component: DialogComponent,\n }\n)\n\nexport { Dialog }\n\nexport { COMPONENT_NAME }\n"],"names":["TranslationDialogComponent","withTranslation","forwardRef","props","ref","positions","translated","restProps","dialogPositions","mergeDeepLeft","POSITIONS","_jsx","Styled","Dialog","Object","assign","withMergedProps","size","position","role","open","preventScrollAfterClose","closeTimeoutMS","portalClassName","className","bodyOpenClassName","htmlOpenClassName","overlayClassName","shouldCloseOnOverlayClick","shouldCloseOnEsc","shouldReturnFocusAfterClose","parentSelector","overlayRef","contentRef","palette","overlayBlur","overlayDisabled","zIndex","onAfterOpen","onAfterClose","onRequestClose","dialogProps","overlayElementDisabled","draggable","ReactModal","isOpen","ariaHideApp","preventScroll","contentElement","contentProps","tabIndex","onKeyDown","onMouseDown","onMouseUp","onClick","color","backgroundColor","shadowColor","undefined","evt","overlayElement","overlayProps","jsx","blur","overlayBackgroundColor","children","sizes","fancy","SIZES_FANCY","SIZES","displayName","Component","DialogComponent"],"mappings":"4kBAYA,MAAMA,2BAA6BC,gBAAAA,gBACjCC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,UAAEA,EAAY,CAAE,EAAAC,WAAEA,KAAeC,GAAcJ,EAErD,MAAMK,EAAkBF,EAAa,CAAA,EAAKG,MAAAA,cAAcJ,EAAWK,YAAAA,WAEnE,OAAOC,WAAAA,IAACC,MAAAA,0BAAgC,IAAKL,EAAWF,UAAWG,EAAiBJ,IAAKA,GAAO,KAiB9FS,MAAAA,OAA+FC,OAAOC,OAC1GC,gBAAAA,iBACGb,IACC,MAAMc,KACJA,EAAO,IAAGC,SACVA,EAAW,SAAQC,KACnBA,EAAO,SAAQC,KACfA,EAAIC,wBACJA,EAAuBC,eACvBA,EAAcC,gBACdA,EAAeC,UACfA,EAASC,kBACTA,EAAiBC,kBACjBA,EAAiBC,iBACjBA,EAAgBC,0BAChBA,EAAyBC,iBACzBA,EAAgBC,4BAChBA,EAA2BC,eAC3BA,EAAcC,WACdA,EAAUC,WACVA,EAAUC,QACVA,EAAOC,YACPA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AEA,EAAS8B,QAAEA,EAAOF,YAAEA,GAAgBS,EAEjD,OAAOnB,EACLM,EAEArC,WAAAmD,IAAClD,oBAAoB,CACnBR,IAAKA,EACLoB,UAAWA,EACXuC,KAAM5B,EACND,QAAS,CACPsB,gBAAiBtB,EAAQ8B,wBAE3B3B,OAAQA,EACRiB,QAASA,EACTF,YAAaA,EAAYa,SAExBjB,GAEJ,GAEH,GAGN,CACEkB,MAAQ/D,GAAWA,EAAMgE,MAAQC,UAAWA,YAAGC,UAAMA,MACrDC,YA9IiB,WAiJrB,CACEC,UAAWC,gBAAAA,yCAlJQ"}
1
+ {"version":3,"file":"Dialog.js","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport ReactModal from 'react-modal'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { withTranslation } from 'hocs/withTranslation'\nimport { DialogComponent, SIZES, SIZES_FANCY } from 'components/DialogComponent'\nimport { deepmerge } from 'shared/utils/misc'\nimport { POSITIONS } from './constants'\nimport * as Styled from './style'\nimport type { DialogProps, TranslationDialogComponentProps } from './types'\n\nconst COMPONENT_NAME = 'Dialog'\n\nconst TranslationDialogComponent = withTranslation<HTMLDivElement, TranslationDialogComponentProps>(\n forwardRef((props, ref) => {\n const { positions = {}, translated, ...restProps } = props\n\n const dialogPositions = translated ? {} : deepmerge(POSITIONS, positions)\n\n return <Styled.PositionedDialogComponent {...restProps} positions={dialogPositions} ref={ref} />\n })\n)\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и позиции в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-modal\"](https://www.npmjs.com/package/react-modal).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через Dialog.Component.\n *\n * Полный интерфейс Dialog можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Dialog/types.ts), интерфейс Dialog.Component [тут](https://github.com/foxford/ui/blob/master/src/components/DialogComponent/types.ts).\n *\n */\nconst Dialog: React.ForwardRefExoticComponent<DialogProps> & { Component: typeof DialogComponent } = Object.assign(\n withMergedProps<DialogProps, HTMLDivElement>(\n (props) => {\n const {\n size = 's',\n position = 'center',\n role = 'dialog',\n open,\n preventScrollAfterClose,\n closeTimeoutMS,\n portalClassName,\n className,\n bodyOpenClassName,\n htmlOpenClassName,\n overlayClassName,\n shouldCloseOnOverlayClick,\n shouldCloseOnEsc,\n shouldReturnFocusAfterClose,\n parentSelector,\n overlayRef,\n contentRef,\n palette,\n overlayBlur,\n overlayDisabled,\n zIndex,\n onAfterOpen,\n onAfterClose,\n onRequestClose,\n ...dialogProps\n } = props\n\n const overlayElementDisabled = dialogProps.draggable || overlayDisabled\n\n return (\n <ReactModal\n isOpen={open}\n ariaHideApp={false}\n preventScroll={preventScrollAfterClose}\n closeTimeoutMS={closeTimeoutMS}\n portalClassName={portalClassName}\n className={className}\n bodyOpenClassName={bodyOpenClassName}\n htmlOpenClassName={htmlOpenClassName}\n overlayClassName={overlayClassName}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n shouldCloseOnEsc={shouldCloseOnEsc}\n shouldReturnFocusAfterClose={shouldReturnFocusAfterClose}\n parentSelector={parentSelector}\n overlayRef={overlayRef}\n contentRef={contentRef}\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onRequestClose={onRequestClose}\n contentElement={(contentProps) => {\n const { ref, className, tabIndex, onKeyDown, onMouseDown, onMouseUp, onClick } = contentProps\n\n return (\n <TranslationDialogComponent\n {...dialogProps}\n ref={ref}\n size={size}\n role={role}\n className={className}\n tabIndex={tabIndex}\n position={position}\n aria-modal={!dialogProps.draggable && !overlayDisabled}\n palette={{\n color: palette.color,\n backgroundColor: palette.backgroundColor,\n shadowColor: palette.shadowColor,\n }}\n zIndex={overlayElementDisabled ? zIndex : undefined}\n onKeyDown={(evt) => {\n if (dialogProps.onKeyDown) dialogProps.onKeyDown(evt)\n if (onKeyDown) onKeyDown(evt)\n }}\n onMouseDown={(evt) => {\n if (dialogProps.onMouseDown) dialogProps.onMouseDown(evt)\n if (onMouseDown) onMouseDown(evt)\n }}\n onMouseUp={(evt) => {\n if (dialogProps.onMouseUp) dialogProps.onMouseUp(evt)\n if (onMouseUp) onMouseUp(evt)\n }}\n onClick={(evt) => {\n if (dialogProps.onClick) dialogProps.onClick(evt)\n if (onClick) onClick(evt)\n }}\n />\n )\n }}\n overlayElement={(overlayProps, contentElement) => {\n const { ref, className, onClick, onMouseDown } = overlayProps\n\n return overlayElementDisabled ? (\n contentElement\n ) : (\n <Styled.DialogOverlay\n ref={ref}\n className={className}\n blur={overlayBlur}\n palette={{\n backgroundColor: palette.overlayBackgroundColor,\n }}\n zIndex={zIndex}\n onClick={onClick}\n onMouseDown={onMouseDown}\n >\n {contentElement}\n </Styled.DialogOverlay>\n )\n }}\n />\n )\n },\n {\n sizes: (props) => (props.fancy ? SIZES_FANCY : SIZES),\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Component: DialogComponent,\n }\n)\n\nexport { Dialog }\n\nexport { COMPONENT_NAME }\n"],"names":["TranslationDialogComponent","withTranslation","forwardRef","props","ref","positions","translated","restProps","dialogPositions","deepmerge","POSITIONS","_jsx","Styled","Dialog","Object","assign","withMergedProps","size","position","role","open","preventScrollAfterClose","closeTimeoutMS","portalClassName","className","bodyOpenClassName","htmlOpenClassName","overlayClassName","shouldCloseOnOverlayClick","shouldCloseOnEsc","shouldReturnFocusAfterClose","parentSelector","overlayRef","contentRef","palette","overlayBlur","overlayDisabled","zIndex","onAfterOpen","onAfterClose","onRequestClose","dialogProps","overlayElementDisabled","draggable","ReactModal","isOpen","ariaHideApp","preventScroll","contentElement","contentProps","tabIndex","onKeyDown","onMouseDown","onMouseUp","onClick","color","backgroundColor","shadowColor","undefined","evt","overlayElement","overlayProps","jsx","blur","overlayBackgroundColor","children","sizes","fancy","SIZES_FANCY","SIZES","displayName","Component","DialogComponent"],"mappings":"gmBAYA,MAAMA,2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,IACrByC,EACJrC,IAAKA,EACLa,KAAMA,EACNE,KAAMA,EACNK,UAAWA,EACX0B,SAAUA,EACVhC,SAAUA,EACV,cAAauB,EAAYE,YAAcP,EACvCF,QAAS,CACPqB,MAAOrB,EAAQqB,MACfC,gBAAiBtB,EAAQsB,gBACzBC,YAAavB,EAAQuB,aAEvBpB,OAAQK,EAAyBL,OAASqB,EAC1CP,UAAYQ,IACNlB,EAAYU,WAAWV,EAAYU,UAAUQ,GAC7CR,GAAWA,EAAUQ,EAAI,EAE/BP,YAAcO,IACRlB,EAAYW,aAAaX,EAAYW,YAAYO,GACjDP,GAAaA,EAAYO,EAAI,EAEnCN,UAAYM,IACNlB,EAAYY,WAAWZ,EAAYY,UAAUM,GAC7CN,GAAWA,EAAUM,EAAI,EAE/BL,QAAUK,IACJlB,EAAYa,SAASb,EAAYa,QAAQK,GACzCL,GAASA,EAAQK,EAAI,GAE3B,EAGNC,eAAgBA,CAACC,EAAcb,KAC7B,MAAM5C,IAAEA,EAAGoB,UAAEA,EAAS8B,QAAEA,EAAOF,YAAEA,GAAgBS,EAEjD,OAAOnB,EACLM,EAEArC,WAAAmD,IAAClD,oBAAoB,CACnBR,IAAKA,EACLoB,UAAWA,EACXuC,KAAM5B,EACND,QAAS,CACPsB,gBAAiBtB,EAAQ8B,wBAE3B3B,OAAQA,EACRiB,QAASA,EACTF,YAAaA,EAAYa,SAExBjB,GAEJ,GAEH,GAGN,CACEkB,MAAQ/D,GAAWA,EAAMgE,MAAQC,UAAWA,YAAGC,UAAMA,MACrDC,YA9IiB,WAiJrB,CACEC,UAAWC,gBAAAA,yCAlJQ"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import ReactModal from'react-modal';import{mergeDeepLeft}from'ramda';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{withTranslation}from'../../hocs/withTranslation.mjs';import{POSITIONS}from'./constants.mjs';import{DialogOverlay,PositionedDialogComponent}from'./style.mjs';import{jsx}from'react/jsx-runtime';import{DialogComponent}from'../DialogComponent/DialogComponent.mjs';import{SIZES_FANCY,SIZES}from'../DialogComponent/constants.mjs';const COMPONENT_NAME='Dialog';const TranslationDialogComponent=withTranslation(forwardRef(((o,e)=>{const{positions:n={},translated:s,...l}=o;const a=s?{}:mergeDeepLeft(n,POSITIONS);return jsx(PositionedDialogComponent,{...l,positions:a,ref:e})})));const Dialog=Object.assign(withMergedProps((o=>{const{size:e="s",position:n="center",role:s="dialog",open:l,preventScrollAfterClose:a,closeTimeoutMS:r,portalClassName:t,className:i,bodyOpenClassName:m,htmlOpenClassName:c,overlayClassName:p,shouldCloseOnOverlayClick:C,shouldCloseOnEsc:d,shouldReturnFocusAfterClose:u,parentSelector:f,overlayRef:g,contentRef:D,palette:N,overlayBlur:O,overlayDisabled:y,zIndex:M,onAfterOpen:w,onAfterClose:h,onRequestClose:S,...v}=o;const j=v.draggable||y;return jsx(ReactModal,{isOpen:l,ariaHideApp:!1,preventScroll:a,closeTimeoutMS:r,portalClassName:t,className:i,bodyOpenClassName:m,htmlOpenClassName:c,overlayClassName:p,shouldCloseOnOverlayClick:C,shouldCloseOnEsc:d,shouldReturnFocusAfterClose:u,parentSelector:f,overlayRef:g,contentRef:D,onAfterOpen:w,onAfterClose:h,onRequestClose:S,contentElement:o=>{const{ref:l,className:a,tabIndex:r,onKeyDown:t,onMouseDown:i,onMouseUp:m,onClick:c}=o;return jsx(TranslationDialogComponent,{...v,ref:l,size:e,role:s,className:a,tabIndex:r,position:n,"aria-modal":!v.draggable&&!y,palette:{color:N.color,backgroundColor:N.backgroundColor,shadowColor:N.shadowColor},zIndex:j?M:void 0,onKeyDown:o=>{v.onKeyDown&&v.onKeyDown(o),t&&t(o)},onMouseDown:o=>{v.onMouseDown&&v.onMouseDown(o),i&&i(o)},onMouseUp:o=>{v.onMouseUp&&v.onMouseUp(o),m&&m(o)},onClick:o=>{v.onClick&&v.onClick(o),c&&c(o)}})},overlayElement:(o,e)=>{const{ref:n,className:s,onClick:l,onMouseDown:a}=o;return j?e:jsx(DialogOverlay,{ref:n,className:s,blur:O,palette:{backgroundColor:N.overlayBackgroundColor},zIndex:M,onClick:l,onMouseDown:a,children:e})}})}),{sizes:o=>o.fancy?SIZES_FANCY:SIZES,displayName:"Dialog"}),{Component:DialogComponent});export{COMPONENT_NAME,Dialog};
1
+ import{forwardRef}from'react';import ReactModal from'react-modal';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{withTranslation}from'../../hocs/withTranslation.mjs';import{deepmerge}from'../../shared/utils/misc.mjs';import{POSITIONS}from'./constants.mjs';import{DialogOverlay,PositionedDialogComponent}from'./style.mjs';import{jsx}from'react/jsx-runtime';import{DialogComponent}from'../DialogComponent/DialogComponent.mjs';import{SIZES_FANCY,SIZES}from'../DialogComponent/constants.mjs';const COMPONENT_NAME='Dialog';const TranslationDialogComponent=withTranslation(forwardRef(((o,e)=>{const{positions:n={},translated:s,...l}=o;const a=s?{}:deepmerge(POSITIONS,n);return jsx(PositionedDialogComponent,{...l,positions:a,ref:e})})));const Dialog=Object.assign(withMergedProps((o=>{const{size:e="s",position:n="center",role:s="dialog",open:l,preventScrollAfterClose:a,closeTimeoutMS:r,portalClassName:t,className:i,bodyOpenClassName:m,htmlOpenClassName:c,overlayClassName:p,shouldCloseOnOverlayClick:C,shouldCloseOnEsc:d,shouldReturnFocusAfterClose:u,parentSelector:f,overlayRef:g,contentRef:D,palette:N,overlayBlur:O,overlayDisabled:y,zIndex:M,onAfterOpen:h,onAfterClose:w,onRequestClose:S,...v}=o;const j=v.draggable||y;return jsx(ReactModal,{isOpen:l,ariaHideApp:!1,preventScroll:a,closeTimeoutMS:r,portalClassName:t,className:i,bodyOpenClassName:m,htmlOpenClassName:c,overlayClassName:p,shouldCloseOnOverlayClick:C,shouldCloseOnEsc:d,shouldReturnFocusAfterClose:u,parentSelector:f,overlayRef:g,contentRef:D,onAfterOpen:h,onAfterClose:w,onRequestClose:S,contentElement:o=>{const{ref:l,className:a,tabIndex:r,onKeyDown:t,onMouseDown:i,onMouseUp:m,onClick:c}=o;return jsx(TranslationDialogComponent,{...v,ref:l,size:e,role:s,className:a,tabIndex:r,position:n,"aria-modal":!v.draggable&&!y,palette:{color:N.color,backgroundColor:N.backgroundColor,shadowColor:N.shadowColor},zIndex:j?M:void 0,onKeyDown:o=>{v.onKeyDown&&v.onKeyDown(o),t&&t(o)},onMouseDown:o=>{v.onMouseDown&&v.onMouseDown(o),i&&i(o)},onMouseUp:o=>{v.onMouseUp&&v.onMouseUp(o),m&&m(o)},onClick:o=>{v.onClick&&v.onClick(o),c&&c(o)}})},overlayElement:(o,e)=>{const{ref:n,className:s,onClick:l,onMouseDown:a}=o;return j?e:jsx(DialogOverlay,{ref:n,className:s,blur:O,palette:{backgroundColor:N.overlayBackgroundColor},zIndex:M,onClick:l,onMouseDown:a,children:e})}})}),{sizes:o=>o.fancy?SIZES_FANCY:SIZES,displayName:"Dialog"}),{Component:DialogComponent});export{COMPONENT_NAME,Dialog};
2
2
  //# sourceMappingURL=Dialog.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.mjs","sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport ReactModal from 'react-modal'\nimport { mergeDeepLeft } from 'ramda'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { withTranslation } from 'hocs/withTranslation'\nimport { DialogComponent, SIZES, SIZES_FANCY } from 'components/DialogComponent'\nimport { POSITIONS } from './constants'\nimport * as Styled from './style'\nimport type { DialogProps, TranslationDialogComponentProps } from './types'\n\nconst COMPONENT_NAME = 'Dialog'\n\nconst TranslationDialogComponent = withTranslation<HTMLDivElement, TranslationDialogComponentProps>(\n forwardRef((props, ref) => {\n const { positions = {}, translated, ...restProps } = props\n\n const dialogPositions = translated ? {} : mergeDeepLeft(positions, POSITIONS)\n\n return <Styled.PositionedDialogComponent {...restProps} positions={dialogPositions} ref={ref} />\n })\n)\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и позиции в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-modal\"](https://www.npmjs.com/package/react-modal).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через Dialog.Component.\n *\n * Полный интерфейс Dialog можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Dialog/types.ts), интерфейс Dialog.Component [тут](https://github.com/foxford/ui/blob/master/src/components/DialogComponent/types.ts).\n *\n */\nconst Dialog: React.ForwardRefExoticComponent<DialogProps> & { Component: typeof DialogComponent } = Object.assign(\n withMergedProps<DialogProps, HTMLDivElement>(\n (props) => {\n const {\n size = 's',\n position = 'center',\n role = 'dialog',\n open,\n preventScrollAfterClose,\n closeTimeoutMS,\n portalClassName,\n className,\n bodyOpenClassName,\n htmlOpenClassName,\n overlayClassName,\n shouldCloseOnOverlayClick,\n shouldCloseOnEsc,\n shouldReturnFocusAfterClose,\n parentSelector,\n overlayRef,\n contentRef,\n palette,\n overlayBlur,\n overlayDisabled,\n zIndex,\n onAfterOpen,\n onAfterClose,\n onRequestClose,\n ...dialogProps\n } = props\n\n const overlayElementDisabled = dialogProps.draggable || overlayDisabled\n\n return (\n <ReactModal\n isOpen={open}\n ariaHideApp={false}\n preventScroll={preventScrollAfterClose}\n closeTimeoutMS={closeTimeoutMS}\n portalClassName={portalClassName}\n className={className}\n bodyOpenClassName={bodyOpenClassName}\n htmlOpenClassName={htmlOpenClassName}\n overlayClassName={overlayClassName}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n shouldCloseOnEsc={shouldCloseOnEsc}\n shouldReturnFocusAfterClose={shouldReturnFocusAfterClose}\n parentSelector={parentSelector}\n overlayRef={overlayRef}\n contentRef={contentRef}\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onRequestClose={onRequestClose}\n contentElement={(contentProps) => {\n const { ref, className, tabIndex, onKeyDown, onMouseDown, onMouseUp, onClick } = contentProps\n\n return (\n <TranslationDialogComponent\n {...dialogProps}\n ref={ref}\n size={size}\n role={role}\n className={className}\n tabIndex={tabIndex}\n position={position}\n aria-modal={!dialogProps.draggable && !overlayDisabled}\n palette={{\n color: palette.color,\n backgroundColor: palette.backgroundColor,\n shadowColor: palette.shadowColor,\n }}\n zIndex={overlayElementDisabled ? zIndex : undefined}\n onKeyDown={(evt) => {\n if (dialogProps.onKeyDown) dialogProps.onKeyDown(evt)\n if (onKeyDown) onKeyDown(evt)\n }}\n onMouseDown={(evt) => {\n if (dialogProps.onMouseDown) dialogProps.onMouseDown(evt)\n if (onMouseDown) onMouseDown(evt)\n }}\n onMouseUp={(evt) => {\n if (dialogProps.onMouseUp) dialogProps.onMouseUp(evt)\n if (onMouseUp) onMouseUp(evt)\n }}\n onClick={(evt) => {\n if (dialogProps.onClick) dialogProps.onClick(evt)\n if (onClick) onClick(evt)\n }}\n />\n )\n }}\n overlayElement={(overlayProps, contentElement) => {\n const { ref, className, onClick, onMouseDown } = overlayProps\n\n return overlayElementDisabled ? (\n contentElement\n ) : (\n <Styled.DialogOverlay\n ref={ref}\n className={className}\n blur={overlayBlur}\n palette={{\n backgroundColor: palette.overlayBackgroundColor,\n }}\n zIndex={zIndex}\n onClick={onClick}\n onMouseDown={onMouseDown}\n >\n {contentElement}\n </Styled.DialogOverlay>\n )\n }}\n />\n )\n },\n {\n sizes: (props) => (props.fancy ? SIZES_FANCY : SIZES),\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Component: DialogComponent,\n }\n)\n\nexport { Dialog }\n\nexport { COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","TranslationDialogComponent","withTranslation","forwardRef","props","ref","positions","translated","restProps","dialogPositions","mergeDeepLeft","POSITIONS","_jsx","Styled","Dialog","Object","assign","withMergedProps","size","position","role","open","preventScrollAfterClose","closeTimeoutMS","portalClassName","className","bodyOpenClassName","htmlOpenClassName","overlayClassName","shouldCloseOnOverlayClick","shouldCloseOnEsc","shouldReturnFocusAfterClose","parentSelector","overlayRef","contentRef","palette","overlayBlur","overlayDisabled","zIndex","onAfterOpen","onAfterClose","onRequestClose","dialogProps","overlayElementDisabled","draggable","ReactModal","isOpen","ariaHideApp","preventScroll","contentElement","contentProps","tabIndex","onKeyDown","onMouseDown","onMouseUp","onClick","color","backgroundColor","shadowColor","undefined","evt","overlayElement","overlayProps","blur","overlayBackgroundColor","children","sizes","fancy","SIZES_FANCY","SIZES","displayName","Component","DialogComponent"],"mappings":"0eAUMA,MAAAA,eAAiB,SAEvB,MAAMC,2BAA6BC,gBACjCC,YAAW,CAACC,EAAOC,KACjB,MAAMC,UAAEA,EAAY,CAAE,EAAAC,WAAEA,KAAeC,GAAcJ,EAErD,MAAMK,EAAkBF,EAAa,CAAA,EAAKG,cAAcJ,EAAWK,WAEnE,OAAOC,IAACC,0BAAgC,IAAKL,EAAWF,UAAWG,EAAiBJ,IAAKA,GAAO,KAiB9FS,MAAAA,OAA+FC,OAAOC,OAC1GC,iBACGb,IACC,MAAMc,KACJA,EAAO,IAAGC,SACVA,EAAW,SAAQC,KACnBA,EAAO,SAAQC,KACfA,EAAIC,wBACJA,EAAuBC,eACvBA,EAAcC,gBACdA,EAAeC,UACfA,EAASC,kBACTA,EAAiBC,kBACjBA,EAAiBC,iBACjBA,EAAgBC,0BAChBA,EAAyBC,iBACzBA,EAAgBC,4BAChBA,EAA2BC,eAC3BA,EAAcC,WACdA,EAAUC,WACVA,EAAUC,QACVA,EAAOC,YACPA,EAAWC,gBACXA,EAAeC,OACfA,EAAMC,YACNA,EAAWC,aACXA,EAAYC,eACZA,KACGC,GACDtC,EAEJ,MAAMuC,EAAyBD,EAAYE,WAAaP,EAExD,OACEzB,IAACiC,WAAU,CACTC,OAAQzB,EACR0B,aAAa,EACbC,cAAe1B,EACfC,eAAgBA,EAChBC,gBAAiBA,EACjBC,UAAWA,EACXC,kBAAmBA,EACnBC,kBAAmBA,EACnBC,iBAAkBA,EAClBC,0BAA2BA,EAC3BC,iBAAkBA,EAClBC,4BAA6BA,EAC7BC,eAAgB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src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport ReactModal from 'react-modal'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { withTranslation } from 'hocs/withTranslation'\nimport { DialogComponent, SIZES, SIZES_FANCY } from 'components/DialogComponent'\nimport { deepmerge } from 'shared/utils/misc'\nimport { POSITIONS } from './constants'\nimport * as Styled from './style'\nimport type { DialogProps, TranslationDialogComponentProps } from './types'\n\nconst COMPONENT_NAME = 'Dialog'\n\nconst TranslationDialogComponent = withTranslation<HTMLDivElement, TranslationDialogComponentProps>(\n forwardRef((props, ref) => {\n const { positions = {}, translated, ...restProps } = props\n\n const dialogPositions = translated ? {} : deepmerge(POSITIONS, positions)\n\n return <Styled.PositionedDialogComponent {...restProps} positions={dialogPositions} ref={ref} />\n })\n)\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и позиции в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-modal\"](https://www.npmjs.com/package/react-modal).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через Dialog.Component.\n *\n * Полный интерфейс Dialog можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Dialog/types.ts), интерфейс Dialog.Component [тут](https://github.com/foxford/ui/blob/master/src/components/DialogComponent/types.ts).\n *\n */\nconst Dialog: React.ForwardRefExoticComponent<DialogProps> & { Component: typeof DialogComponent } = Object.assign(\n withMergedProps<DialogProps, HTMLDivElement>(\n (props) => {\n const {\n size = 's',\n position = 'center',\n role = 'dialog',\n open,\n preventScrollAfterClose,\n closeTimeoutMS,\n portalClassName,\n className,\n bodyOpenClassName,\n htmlOpenClassName,\n overlayClassName,\n shouldCloseOnOverlayClick,\n shouldCloseOnEsc,\n shouldReturnFocusAfterClose,\n parentSelector,\n overlayRef,\n contentRef,\n palette,\n overlayBlur,\n overlayDisabled,\n zIndex,\n onAfterOpen,\n onAfterClose,\n onRequestClose,\n ...dialogProps\n } = props\n\n const overlayElementDisabled = dialogProps.draggable || overlayDisabled\n\n return (\n <ReactModal\n isOpen={open}\n ariaHideApp={false}\n preventScroll={preventScrollAfterClose}\n closeTimeoutMS={closeTimeoutMS}\n portalClassName={portalClassName}\n className={className}\n bodyOpenClassName={bodyOpenClassName}\n htmlOpenClassName={htmlOpenClassName}\n overlayClassName={overlayClassName}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n shouldCloseOnEsc={shouldCloseOnEsc}\n shouldReturnFocusAfterClose={shouldReturnFocusAfterClose}\n parentSelector={parentSelector}\n overlayRef={overlayRef}\n contentRef={contentRef}\n onAfterOpen={onAfterOpen}\n onAfterClose={onAfterClose}\n onRequestClose={onRequestClose}\n contentElement={(contentProps) => {\n const { ref, className, tabIndex, onKeyDown, onMouseDown, onMouseUp, onClick } = contentProps\n\n return (\n <TranslationDialogComponent\n {...dialogProps}\n ref={ref}\n size={size}\n role={role}\n className={className}\n tabIndex={tabIndex}\n position={position}\n aria-modal={!dialogProps.draggable && !overlayDisabled}\n palette={{\n color: palette.color,\n backgroundColor: palette.backgroundColor,\n shadowColor: palette.shadowColor,\n }}\n zIndex={overlayElementDisabled ? zIndex : undefined}\n onKeyDown={(evt) => {\n if (dialogProps.onKeyDown) dialogProps.onKeyDown(evt)\n if (onKeyDown) onKeyDown(evt)\n }}\n onMouseDown={(evt) => {\n if (dialogProps.onMouseDown) dialogProps.onMouseDown(evt)\n if (onMouseDown) onMouseDown(evt)\n }}\n onMouseUp={(evt) => {\n if (dialogProps.onMouseUp) dialogProps.onMouseUp(evt)\n if (onMouseUp) onMouseUp(evt)\n }}\n onClick={(evt) => {\n if (dialogProps.onClick) dialogProps.onClick(evt)\n if (onClick) onClick(evt)\n }}\n />\n )\n }}\n overlayElement={(overlayProps, contentElement) => {\n const { ref, className, onClick, onMouseDown } = overlayProps\n\n return overlayElementDisabled ? (\n contentElement\n ) : (\n <Styled.DialogOverlay\n ref={ref}\n className={className}\n blur={overlayBlur}\n palette={{\n backgroundColor: palette.overlayBackgroundColor,\n }}\n zIndex={zIndex}\n onClick={onClick}\n onMouseDown={onMouseDown}\n >\n {contentElement}\n </Styled.DialogOverlay>\n )\n }}\n />\n )\n },\n {\n sizes: (props) => (props.fancy ? SIZES_FANCY : SIZES),\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Component: DialogComponent,\n }\n)\n\nexport { Dialog }\n\nexport { COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","TranslationDialogComponent","withTranslation","forwardRef","props","ref","positions","translated","restProps","dialogPositions","deepmerge","POSITIONS","_jsx","Styled","Dialog","Object","assign","withMergedProps","size","position","role","open","preventScrollAfterClose","closeTimeoutMS","portalClassName","className","bodyOpenClassName","htmlOpenClassName","overlayClassName","shouldCloseOnOverlayClick","shouldCloseOnEsc","shouldReturnFocusAfterClose","parentSelector","overlayRef","contentRef","palette","overlayBlur","overlayDisabled","zIndex","onAfterOpen","onAfterClose","onRequestClose","dialogProps","overlayElementDisabled","draggable","ReactModal","isOpen","ariaHideApp","preventScroll","contentElement","contentProps","tabIndex","onKeyDown","onMouseDown","onMouseUp","onClick","color","backgroundColor","shadowColor","undefined","evt","overlayElement","overlayProps","blur","overlayBackgroundColor","children","sizes","fancy","SIZES_FANCY","SIZES","displayName","Component","DialogComponent"],"mappings":"4fAUMA,MAAAA,eAAiB,SAEvB,MAAMC,2BAA6BC,gBACjCC,YAAW,CAACC,EAAOC,KACjB,MAAMC,UAAEA,EAAY,CAAE,EAAAC,WAAEA,KAAeC,GAAcJ,EAErD,MAAMK,EAAkBF,EAAa,CAAA,EAAKG,UAAUC,UAAWL,GAE/D,OAAOM,IAACC,0BAAgC,IAAKL,EAAWF,UAAWG,EAAiBJ,IAAKA,GAAO,KAiB9FS,MAAAA,OAA+FC,OAAOC,OAC1GC,iBACGb,IACC,MAAMc,KACJA,EAAO,IAAGC,SACVA,EAAW,SAAQC,KACnBA,EAAO,SAAQC,KACfA,EAAIC,wBACJA,EAAuBC,eACvBA,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