@foxford/ui 2.118.1 → 2.119.0-beta-3939fb6-20260713

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 (147) hide show
  1. package/components/Alert/Alert.js +1 -1
  2. package/components/Alert/Alert.js.map +1 -1
  3. package/components/Alert/Alert.mjs +1 -1
  4. package/components/Alert/Alert.mjs.map +1 -1
  5. package/components/Alert/sizes.js +2 -0
  6. package/components/Alert/sizes.js.map +1 -0
  7. package/components/Alert/sizes.mjs +2 -0
  8. package/components/Alert/sizes.mjs.map +1 -0
  9. package/components/Alert/style.js +1 -1
  10. package/components/Alert/style.js.map +1 -1
  11. package/components/Alert/style.mjs +1 -1
  12. package/components/Alert/style.mjs.map +1 -1
  13. package/components/Alert/useAlertProps.js +2 -0
  14. package/components/Alert/useAlertProps.js.map +1 -0
  15. package/components/Alert/useAlertProps.mjs +2 -0
  16. package/components/Alert/useAlertProps.mjs.map +1 -0
  17. package/components/Button/Button.js +1 -1
  18. package/components/Button/Button.js.map +1 -1
  19. package/components/Button/Button.mjs +1 -1
  20. package/components/Button/Button.mjs.map +1 -1
  21. package/components/DialogComponent/DialogComponent.js +1 -1
  22. package/components/DialogComponent/DialogComponent.js.map +1 -1
  23. package/components/DialogComponent/DialogComponent.mjs +1 -1
  24. package/components/DialogComponent/DialogComponent.mjs.map +1 -1
  25. package/components/IconButton/IconButton.js +1 -1
  26. package/components/IconButton/IconButton.js.map +1 -1
  27. package/components/IconButton/IconButton.mjs +1 -1
  28. package/components/IconButton/IconButton.mjs.map +1 -1
  29. package/components/IconButton/style.js +1 -1
  30. package/components/IconButton/style.js.map +1 -1
  31. package/components/IconButton/style.mjs +1 -1
  32. package/components/IconButton/style.mjs.map +1 -1
  33. package/components/Media/Media.js +1 -1
  34. package/components/Media/Media.js.map +1 -1
  35. package/components/Media/Media.mjs +1 -1
  36. package/components/Media/Media.mjs.map +1 -1
  37. package/components/Media/MediaMatchers.js +1 -1
  38. package/components/Media/MediaMatchers.js.map +1 -1
  39. package/components/Media/MediaMatchers.mjs +1 -1
  40. package/components/Media/MediaMatchers.mjs.map +1 -1
  41. package/components/Media/useMediaPropsMatches.js.map +1 -1
  42. package/components/Media/useMediaPropsMatches.mjs.map +1 -1
  43. package/components/Timer/Timer.js +2 -0
  44. package/components/Timer/Timer.js.map +1 -0
  45. package/components/Timer/Timer.mjs +2 -0
  46. package/components/Timer/Timer.mjs.map +1 -0
  47. package/components/Timer/context.js +2 -0
  48. package/components/Timer/context.js.map +1 -0
  49. package/components/Timer/context.mjs +2 -0
  50. package/components/Timer/context.mjs.map +1 -0
  51. package/components/Timer/images/Circle.svg.js +2 -0
  52. package/components/Timer/images/Circle.svg.js.map +1 -0
  53. package/components/Timer/images/Circle.svg.mjs +2 -0
  54. package/components/Timer/images/Circle.svg.mjs.map +1 -0
  55. package/components/Timer/sizes.js +2 -0
  56. package/components/Timer/sizes.js.map +1 -0
  57. package/components/Timer/sizes.mjs +2 -0
  58. package/components/Timer/sizes.mjs.map +1 -0
  59. package/components/Timer/styled.js +2 -0
  60. package/components/Timer/styled.js.map +1 -0
  61. package/components/Timer/styled.mjs +2 -0
  62. package/components/Timer/styled.mjs.map +1 -0
  63. package/components/Timer/useTimer.js +2 -0
  64. package/components/Timer/useTimer.js.map +1 -0
  65. package/components/Timer/useTimer.mjs +2 -0
  66. package/components/Timer/useTimer.mjs.map +1 -0
  67. package/components/Timer/useTimerProps.js +2 -0
  68. package/components/Timer/useTimerProps.js.map +1 -0
  69. package/components/Timer/useTimerProps.mjs +2 -0
  70. package/components/Timer/useTimerProps.mjs.map +1 -0
  71. package/components/TooltipComponent/TooltipComponent.js +1 -1
  72. package/components/TooltipComponent/TooltipComponent.js.map +1 -1
  73. package/components/TooltipComponent/TooltipComponent.mjs +1 -1
  74. package/components/TooltipComponent/TooltipComponent.mjs.map +1 -1
  75. package/dts/index.d.ts +896 -643
  76. package/{components/Media → hooks}/useMediaConnector.js +1 -1
  77. package/hooks/useMediaConnector.js.map +1 -0
  78. package/hooks/useMediaConnector.mjs +2 -0
  79. package/hooks/useMediaConnector.mjs.map +1 -0
  80. package/hooks/useMediaMatchers.js.map +1 -0
  81. package/hooks/useMediaMatchers.mjs.map +1 -0
  82. package/hooks/useResponsiveLayoutProps.js +2 -0
  83. package/hooks/useResponsiveLayoutProps.js.map +1 -0
  84. package/hooks/useResponsiveLayoutProps.mjs +2 -0
  85. package/hooks/useResponsiveLayoutProps.mjs.map +1 -0
  86. package/hooks/useResponsiveMarginProps.js +2 -0
  87. package/hooks/useResponsiveMarginProps.js.map +1 -0
  88. package/hooks/useResponsiveMarginProps.mjs +2 -0
  89. package/hooks/useResponsiveMarginProps.mjs.map +1 -0
  90. package/hooks/useResponsiveProps.js +2 -0
  91. package/hooks/useResponsiveProps.js.map +1 -0
  92. package/hooks/useResponsiveProps.mjs +2 -0
  93. package/hooks/useResponsiveProps.mjs.map +1 -0
  94. package/hooks/useResponsiveSizeProps.js +2 -0
  95. package/hooks/useResponsiveSizeProps.js.map +1 -0
  96. package/hooks/useResponsiveSizeProps.mjs +2 -0
  97. package/hooks/useResponsiveSizeProps.mjs.map +1 -0
  98. package/index.js +1 -1
  99. package/index.mjs +1 -1
  100. package/mixins/responsive-margin.js.map +1 -1
  101. package/mixins/responsive-margin.mjs.map +1 -1
  102. package/package.json +2 -2
  103. package/{components/Media/context.js → shared/context/media.js} +1 -1
  104. package/shared/context/media.js.map +1 -0
  105. package/{components/Media/context.mjs → shared/context/media.mjs} +1 -1
  106. package/shared/context/media.mjs.map +1 -0
  107. package/shared/media/MediaMatcher.js +2 -0
  108. package/shared/media/MediaMatcher.js.map +1 -0
  109. package/shared/media/MediaMatcher.mjs +2 -0
  110. package/shared/media/MediaMatcher.mjs.map +1 -0
  111. package/shared/media/MediaMediator.js +2 -0
  112. package/shared/media/MediaMediator.js.map +1 -0
  113. package/shared/media/MediaMediator.mjs +2 -0
  114. package/shared/media/MediaMediator.mjs.map +1 -0
  115. package/shared/utils/isPointerSupported.js +2 -0
  116. package/shared/utils/isPointerSupported.js.map +1 -0
  117. package/shared/utils/isPointerSupported.mjs +2 -0
  118. package/shared/utils/isPointerSupported.mjs.map +1 -0
  119. package/theme/colors-dark.js +1 -1
  120. package/theme/colors-dark.js.map +1 -1
  121. package/theme/colors-dark.mjs +1 -1
  122. package/theme/colors-dark.mjs.map +1 -1
  123. package/components/Alert/CountdownCircle.js +0 -2
  124. package/components/Alert/CountdownCircle.js.map +0 -1
  125. package/components/Alert/CountdownCircle.mjs +0 -2
  126. package/components/Alert/CountdownCircle.mjs.map +0 -1
  127. package/components/Alert/utils.js +0 -2
  128. package/components/Alert/utils.js.map +0 -1
  129. package/components/Alert/utils.mjs +0 -2
  130. package/components/Alert/utils.mjs.map +0 -1
  131. package/components/Media/MediaMatcher.js +0 -2
  132. package/components/Media/MediaMatcher.js.map +0 -1
  133. package/components/Media/MediaMatcher.mjs +0 -2
  134. package/components/Media/MediaMatcher.mjs.map +0 -1
  135. package/components/Media/MediaMediator.js +0 -2
  136. package/components/Media/MediaMediator.js.map +0 -1
  137. package/components/Media/MediaMediator.mjs +0 -2
  138. package/components/Media/MediaMediator.mjs.map +0 -1
  139. package/components/Media/context.js.map +0 -1
  140. package/components/Media/context.mjs.map +0 -1
  141. package/components/Media/useMediaConnector.js.map +0 -1
  142. package/components/Media/useMediaConnector.mjs +0 -2
  143. package/components/Media/useMediaConnector.mjs.map +0 -1
  144. package/components/Media/useMediaMatchers.js.map +0 -1
  145. package/components/Media/useMediaMatchers.mjs.map +0 -1
  146. /package/{components/Media → hooks}/useMediaMatchers.js +0 -0
  147. /package/{components/Media → hooks}/useMediaMatchers.mjs +0 -0
@@ -1,2 +1,2 @@
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 style=require('./style.js');var utils=require('./utils.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Anchor=require('../Anchor/Anchor.js');var Button=require('../Button/Button.js');var index=require('../../icon-pack/src/icons/Close/index.js');var index$1=require('../../icon-pack/src/icons/WarningTriangleFill/index.js');var index$2=require('../../icon-pack/src/icons/CheckCircleFill/index.js');var index$3=require('../../icon-pack/src/icons/NotifFill/index.js');var index$4=require('../../icon-pack/src/icons/CloseCirlceFill/index.js');const getDefaultIcon=({isCompact:e,theme:n,type:i})=>{const t=e?16:24;switch(i){case'error':return jsxRuntime.jsx(index$4.CloseCirlceFill,{fill:n.colors['alert-bg-error-500'],width:t,height:t});case'info':return jsxRuntime.jsx(index$3.NotifFill,{fill:n.colors['content-brand-primary'],width:t,height:t});case'success':return jsxRuntime.jsx(index$2.CheckCircleFill,{fill:n.colors['alert-success'],width:t,height:t});case'warning':return jsxRuntime.jsx(index$1.WarningTriangleFill,{fill:n.colors['alert-warning'],width:t,height:t});default:return null}};const Alert=React.forwardRef((e,n)=>{const i=styled.useTheme();const{cancelTimerText:t="Отменить",primaryAction:s,primaryActionProps:r={},secondaryAction:o,secondaryActionProps:l={},children:c,className:a,clear:u,customIcon:m,image:x,isCompact:h,link:p,linkProps:d={},noIcon:j,onClickCancelTimer:C,closeToast:y,onTimerFinish:g,size:k="s",style:f,textProps:R={},textWrap:w,timer:A,title:T,titleProps:v={},type:q,width:I=['fit-content','fit-content','fit-content','351px','304px','304px']}=useConfigPriority.useConfigPriority(i.components?.Alert,e);const b=useClassname.useClassname("Alert",a);const[F,W]=React.useState(!1);const z=Boolean(k==='l'||!!T||h&&(T||p||s||o));return jsxRuntime.jsxs(style.Root,{className:b,clear:u,column:z,isCompact:h,noIcon:j,onMouseEnter:()=>{A&&W(!0)},onMouseLeave:()=>{A&&W(!1)},ref:n,size:k,style:f,textWrap:w,type:q,width:I,withAction:!!s||!!o,withCloseIcon:!!y,withImage:!!x,withLink:!!p,withTimer:!!A,withTitle:!!T,children:[!j||m?jsxRuntime.jsxs(style.IconWrapper,{column:z,isCompact:h,withImage:!!x,children:[j||A||m||x?null:getDefaultIcon({isCompact:h,theme:i,type:q}),m?jsxRuntime.jsx(Icon.Icon,{name:m,size:h?16:24}):null,x,A?jsxRuntime.jsx(style.Timer,{isCompact:h,paused:F,timer:A,onTimerFinish:g,color:utils.countdownColor({theme:i,type:q})}):null]}):null,jsxRuntime.jsxs(style.ContentWrapper,{column:z,isCompact:h,children:[T?jsxRuntime.jsx(style.Title,{color:i.colors['content-onmain-primary'],isCompact:h,size:h?14:16,lineHeight:"m",...v,children:T}):null,jsxRuntime.jsx(style.Content,{appearance:"body",color:i.colors['content-onmain-primary'],column:z,isCompact:h,size:h?'xs':'s',textWrap:w,...R,children:c}),p?jsxRuntime.jsx(style.Link,{clear:u,column:z,isCompact:h,withTitle:!!T,children:jsxRuntime.jsx(Anchor.Anchor,{color:e.clear?i.colors['content-link']:i.colors['content-onmain-primary'],onClick:p.onClick,preset:"default",pseudo:!0,size:h?'s':'m',...d,children:p.content})}):null,s||o?jsxRuntime.jsxs(style.Actions,{column:z,isCompact:h,withTitle:!!T,children:[o?jsxRuntime.jsx(Button.Button,{black:!0,fontWeight:"normal",onClick:o.onClick,outline:!0,preset:"brand",size:h?'xs':'s',margin:4,...l,children:o.content}):null,s?jsxRuntime.jsx(Button.Button,{black:!0,fontWeight:"normal",onClick:s.onClick,preset:"brand",size:h?'xs':'s',margin:4,...r,children:s.content}):null]}):null]}),C?jsxRuntime.jsx(style.CancelTimer,{black:!0,clear:!0,fontWeight:"normal",isCompact:h,onClick:C,preset:"brand",size:h?'xs':'s',margin:4,children:t}):null,!y||h&&A?null:jsxRuntime.jsx(style.CloseIcon,{"aria-label":"close",onClick:y,type:"button",withTimer:!!A,children:jsxRuntime.jsx(index.Close,{fill:i.colors['content-onmain-primary'],width:h?18:24,height:h?18:24})})]})});Alert.displayName="Alert",exports.Alert=Alert,exports.COMPONENT_NAME="Alert";
1
+ 'use strict';var React=require('react');var isPointerSupported=require('../../shared/utils/isPointerSupported.js');var useMergedSizes=require('../../hooks/useMergedSizes.js');var useAlertProps=require('./useAlertProps.js');var sizes=require('./sizes.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var context=require('../Timer/context.js');var Slot=require('../Slot/Slot.js');var Icon=require('../Icon/Icon.js');var Timer=require('../Timer/Timer.js');var index=require('../../icon-pack/src/icons/Close/index.js');var index$1=require('../../icon-pack/src/icons/CloseCirlceFill/index.js');var index$2=require('../../icon-pack/src/icons/WarningTriangleFill/index.js');var index$3=require('../../icon-pack/src/icons/CheckCircleFill/index.js');var index$4=require('../../icon-pack/src/icons/NotifFill/index.js');const Alert=Object.assign(React.forwardRef((e,s)=>{const{size:r="s",layout:i="horizontal",margin:n=0,type:t="info",style:o={},palette:l={},title:c,text:a,addon:u,controls:x,discardButton:d,content:p,root:j,withIcon:S,clear:z,sizeXXS:m,sizeXS:R,sizeS:T,sizeM:P,sizeL:E,sizeXL:h,...v}=useAlertProps.useAlertProps(e);const I=useMergedSizes.useMergedSizes(v,i==='horizontal'?sizes.SIZES_HORIZONTAL:sizes.SIZES_VERTICAL);const g={size:r,sizeXXS:m,sizeXS:R,sizeS:T,sizeM:P,sizeL:E,sizeXL:h};const _={...g,sizes:sizes.SIZES_ICON,color:{info:'content-brand-primary',success:'alert-success',warning:'alert-warning',error:'alert-error'}[t],icon:{info:jsxRuntime.jsx(index$4.NotifFill,{}),success:jsxRuntime.jsx(index$3.CheckCircleFill,{}),warning:jsxRuntime.jsx(index$2.WarningTriangleFill,{}),error:jsxRuntime.jsx(index$1.CloseCirlceFill,{})}[t]};const C={...g,sizes:sizes.SIZES_ALERT_TIMER,color:{info:'content-brand-primary',success:'alert-success',warning:'alert-warning',error:'alert-error'}[t]};const q={...g,sizes:sizes.SIZES_TEXT,appearance:'caption',weight:700,wordBreak:'break-word',color:'inherit'};const y={...g,sizes:sizes.SIZES_TEXT,appearance:'caption',weight:400,wordBreak:'break-word',color:'inherit'};const A={...g,sizes:sizes.SIZES_ALERT_BUTTON,iconSizes:sizes.SIZES_ALERT_BUTTON_ICON,textSizes:sizes.SIZES_ALERT_BUTTON_TEXT,preset:'brand',black:!0,textProps:{weight:400}};const L={...g,sizes:sizes.SIZES_TEXT,preset:'brand',underline:'dashed',color:'inherit'};const k={...g,sizes:sizes.SIZES_DISCARD_BUTTON,icon:jsxRuntime.jsx(index.Close,{})};const[M,w]=React.useState(!1);const b=React.useMemo(()=>({paused:M}),[M]);return jsxRuntime.jsx(style.Root,{...v,style:{...I[r],'--alert-margin':n,...o},palette:l,clear:z,type:t,ref:s,onPointerEnter:e=>{v.onPointerEnter&&v.onPointerEnter(e),w(!0)},onMouseEnter:e=>{v.onMouseEnter&&v.onMouseEnter(e),isPointerSupported.isPointerSupported()||w(!0)},onPointerLeave:e=>{v.onPointerLeave&&v.onPointerLeave(e),w(!1)},onMouseLeave:e=>{v.onMouseLeave&&v.onMouseLeave(e),isPointerSupported.isPointerSupported()||w(!1)},children:jsxRuntime.jsx(context.TimerPropsContext.Provider,{value:b,children:jsxRuntime.jsx(Slot.Slot,{render:j,props:{titleProps:q,textProps:y,iconProps:_,timerProps:C,buttonProps:A,anchorProps:L,discardButtonProps:k},fallback:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(style.Container,{children:[S||u?jsxRuntime.jsxs(style.Addon,{children:[S?jsxRuntime.jsx(Icon.Icon,{..._}):null,jsxRuntime.jsx(Slot.Slot,{render:u,props:{iconProps:_,timerProps:C}})]}):null,jsxRuntime.jsxs(style.Main,{children:[jsxRuntime.jsx(Slot.Slot,{render:p,props:{titleProps:q,textProps:y},fallback:jsxRuntime.jsxs(style.Content,{children:[jsxRuntime.jsx(Slot.Slot,{render:c,props:q}),jsxRuntime.jsx(Slot.Slot,{render:a,props:y})]})}),x?jsxRuntime.jsx(style.Addon,{children:jsxRuntime.jsx(Slot.Slot,{render:x,props:{buttonProps:A,anchorProps:L}})}):null]})]}),d?jsxRuntime.jsx(style.DiscardButton,{children:jsxRuntime.jsx(Slot.Slot,{render:d,props:k})}):null]})})})})}),{Timer:Timer.Timer});exports.Alert=Alert;
2
2
  //# sourceMappingURL=Alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react'\nimport { useTheme } from 'styled-components'\nimport { CheckCircleFill, Close, CloseCirlceFill, NotifFill, WarningTriangleFill } from '@foxford/icon-pack'\nimport type { DefaultTheme } from 'styled-components'\n\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\n\nimport { Anchor } from '../Anchor'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\n\nimport * as Styled from './style'\n\nimport type { AlertProps } from './types'\nimport { countdownColor } from './utils'\n\nconst getDefaultIcon = ({\n isCompact,\n theme,\n type,\n}: Pick<AlertProps, 'isCompact' | 'type'> & { theme: DefaultTheme }) => {\n const size = isCompact ? 16 : 24\n\n switch (type) {\n case 'error':\n return <CloseCirlceFill fill={theme.colors['alert-bg-error-500']} width={size} height={size} />\n case 'info':\n return <NotifFill fill={theme.colors['content-brand-primary']} width={size} height={size} />\n case 'success':\n return <CheckCircleFill fill={theme.colors['alert-success']} width={size} height={size} />\n case 'warning':\n return <WarningTriangleFill fill={theme.colors['alert-warning']} width={size} height={size} />\n default:\n return null\n }\n}\n\nconst COMPONENT_NAME = 'Alert'\n\nconst Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const theme = useTheme()\n\n const {\n cancelTimerText = 'Отменить',\n primaryAction,\n primaryActionProps = {},\n secondaryAction,\n secondaryActionProps = {},\n children,\n className,\n clear,\n customIcon,\n image,\n isCompact,\n link,\n linkProps = {},\n noIcon,\n onClickCancelTimer,\n closeToast,\n onTimerFinish,\n size = 's',\n style,\n textProps = {},\n textWrap,\n timer,\n title,\n titleProps = {},\n type,\n width = ['fit-content', 'fit-content', 'fit-content', '351px', '304px', '304px'],\n } = useConfigPriority<AlertProps>(theme.components?.Alert, props)\n const _className = useClassname(COMPONENT_NAME, className)\n const [timerOnPause, setTimerOnPause] = useState(false)\n\n const column = Boolean(size === 'l' || !!title || (isCompact && (title || link || primaryAction || secondaryAction)))\n\n const handleMouseEnter = () => {\n if (timer) {\n setTimerOnPause(true)\n }\n }\n\n const handleMouseLeave = () => {\n if (timer) {\n setTimerOnPause(false)\n }\n }\n\n return (\n <Styled.Root\n className={_className}\n clear={clear}\n column={column}\n isCompact={isCompact}\n noIcon={noIcon}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n size={size}\n style={style}\n textWrap={textWrap}\n type={type}\n width={width}\n withAction={!!primaryAction || !!secondaryAction}\n withCloseIcon={!!closeToast}\n withImage={!!image}\n withLink={!!link}\n withTimer={!!timer}\n withTitle={!!title}\n >\n {!noIcon || customIcon ? (\n <Styled.IconWrapper column={column} isCompact={isCompact} withImage={!!image}>\n {!noIcon && !timer && !customIcon && !image ? getDefaultIcon({ isCompact, theme, type }) : null}\n {customIcon ? <Icon name={customIcon} size={isCompact ? 16 : 24} /> : null}\n {image}\n {timer ? (\n <Styled.Timer\n isCompact={isCompact}\n paused={timerOnPause}\n timer={timer}\n onTimerFinish={onTimerFinish}\n color={countdownColor({ theme, type })}\n />\n ) : null}\n </Styled.IconWrapper>\n ) : null}\n\n <Styled.ContentWrapper column={column} isCompact={isCompact}>\n {title ? (\n <Styled.Title\n color={theme.colors['content-onmain-primary']}\n isCompact={isCompact}\n size={isCompact ? 14 : 16}\n lineHeight='m'\n {...titleProps}\n >\n {title}\n </Styled.Title>\n ) : null}\n\n <Styled.Content\n appearance='body'\n color={theme.colors['content-onmain-primary']}\n column={column}\n isCompact={isCompact}\n size={isCompact ? 'xs' : 's'}\n textWrap={textWrap}\n {...textProps}\n >\n {children}\n </Styled.Content>\n\n {link ? (\n <Styled.Link clear={clear} column={column} isCompact={isCompact} withTitle={!!title}>\n <Anchor\n color={props.clear ? theme.colors['content-link'] : theme.colors['content-onmain-primary']}\n // eslint-disable-next-line react/jsx-handler-names\n onClick={link.onClick}\n preset='default'\n pseudo\n size={isCompact ? 's' : 'm'}\n {...linkProps}\n >\n {link.content}\n </Anchor>\n </Styled.Link>\n ) : null}\n\n {primaryAction || secondaryAction ? (\n <Styled.Actions column={column} isCompact={isCompact} withTitle={!!title}>\n {secondaryAction ? (\n <Button\n black\n fontWeight='normal'\n // eslint-disable-next-line react/jsx-handler-names\n onClick={secondaryAction.onClick}\n outline\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n {...secondaryActionProps}\n >\n {secondaryAction.content}\n </Button>\n ) : null}\n\n {primaryAction ? (\n <Button\n black\n fontWeight='normal'\n // eslint-disable-next-line react/jsx-handler-names\n onClick={primaryAction.onClick}\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n {...primaryActionProps}\n >\n {primaryAction.content}\n </Button>\n ) : null}\n </Styled.Actions>\n ) : null}\n </Styled.ContentWrapper>\n\n {onClickCancelTimer ? (\n <Styled.CancelTimer\n black\n clear\n fontWeight='normal'\n isCompact={isCompact}\n onClick={onClickCancelTimer}\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n >\n {cancelTimerText}\n </Styled.CancelTimer>\n ) : null}\n\n {closeToast && (isCompact ? !timer : true) ? (\n <Styled.CloseIcon aria-label='close' onClick={closeToast} type='button' withTimer={!!timer}>\n <Close\n fill={theme.colors['content-onmain-primary']}\n width={isCompact ? 18 : 24}\n height={isCompact ? 18 : 24}\n />\n </Styled.CloseIcon>\n ) : null}\n </Styled.Root>\n )\n})\n\nAlert.displayName = COMPONENT_NAME\n\nexport { Alert, COMPONENT_NAME }\n\nexport type { AlertProps }\n"],"names":["getDefaultIcon","isCompact","theme","type","size","_jsx","CloseCirlceFill","fill","colors","width","height","NotifFill","CheckCircleFill","WarningTriangleFill","Alert","forwardRef","props","ref","useTheme","cancelTimerText","primaryAction","primaryActionProps","secondaryAction","secondaryActionProps","children","className","clear","customIcon","image","link","linkProps","noIcon","onClickCancelTimer","closeToast","onTimerFinish","style","textProps","textWrap","timer","title","titleProps","useConfigPriority","components","_className","useClassname","timerOnPause","setTimerOnPause","useState","column","Boolean","_jsxs","Styled","onMouseEnter","handleMouseEnter","onMouseLeave","handleMouseLeave","withAction","withCloseIcon","withImage","withLink","withTimer","withTitle","Icon","name","paused","color","countdownColor","lineHeight","appearance","Anchor","onClick","preset","pseudo","content","Button","black","fontWeight","outline","margin","Close","displayName"],"mappings":"oxBAiBA,MAAMA,eAAiBA,EACrBC,YACAC,QACAC,WAEA,MAAMC,EAAOH,EAAY,GAAK,GAE9B,OAAQE,GACN,IAAK,QACH,OAAOE,WAAAA,IAACC,QAAAA,gBAAe,CAACC,KAAML,EAAMM,OAAO,sBAAuBC,MAAOL,EAAMM,OAAQN,IACzF,IAAK,OACH,OAAOC,WAAAA,IAACM,QAAAA,UAAS,CAACJ,KAAML,EAAMM,OAAO,yBAA0BC,MAAOL,EAAMM,OAAQN,IACtF,IAAK,UACH,OAAOC,WAAAA,IAACO,QAAAA,gBAAe,CAACL,KAAML,EAAMM,OAAO,iBAAkBC,MAAOL,EAAMM,OAAQN,IACpF,IAAK,UACH,OAAOC,WAAAA,IAACQ,QAAAA,oBAAmB,CAACN,KAAML,EAAMM,OAAO,iBAAkBC,MAAOL,EAAMM,OAAQN,IACxF,QACE,OAAO,OAMb,MAAMU,MAAQC,MAAAA,WAAuC,CAACC,EAAOC,KAC3D,MAAMf,EAAQgB,OAAAA,WAEd,MAAMC,gBACJA,EAAkB,WAAUC,cAC5BA,EAAaC,mBACbA,EAAqB,CAAA,EAAEC,gBACvBA,EAAeC,qBACfA,EAAuB,CAAA,EAAEC,SACzBA,EAAQC,UACRA,EAASC,MACTA,EAAKC,WACLA,EAAUC,MACVA,EAAK3B,UACLA,EAAS4B,KACTA,EAAIC,UACJA,EAAY,CAAA,EAAEC,OACdA,EAAMC,mBACNA,EAAkBC,WAClBA,EAAUC,cACVA,EAAa9B,KACbA,EAAO,UACP+B,EAAKC,UACLA,E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ACLkD,WAAW,SACX3E,UAAWA,EACXqE,QAAStC,EACTuC,OAAO,QACPnE,KAAMH,EAAY,KAAO,IACzB6E,OAAQ,EAAEtD,SAETL,IAED,MAEHc,GAAehC,GAAaqC,EAQzB,KAPFjC,WAAAA,IAAC8C,gBAAgB,CAAC,aAAW,QAAQmB,QAASrC,EAAY9B,KAAK,SAASyD,YAAatB,EAAMd,SACzFnB,WAAAA,IAAC0E,YAAK,CACJxE,KAAML,EAAMM,OAAO,0BACnBC,MAAOR,EAAY,GAAK,GACxBS,OAAQT,EAAY,GAAK,YAQrCa,MAAMkE,YAlMiB,mDAAA"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef, useMemo, useState } from 'react'\nimport { Close, NotifFill, CheckCircleFill, WarningTriangleFill, CloseCirlceFill } from '@foxford/icon-pack'\nimport { Timer, TimerPropsContext } from 'components/Timer'\nimport type { IconProps } from 'components/Icon'\nimport { Icon } from 'components/Icon'\nimport type { IconButtonProps } from 'components/IconButton'\nimport type { ButtonProps } from 'components/Button'\nimport type { AnchorProps } from 'components/Anchor'\nimport type { TextProps } from 'components/Text'\nimport type { TimerProps } from 'components/Timer'\nimport { Slot } from 'components/Slot'\nimport type { Color } from 'shared/types'\nimport { isPointerSupported } from 'shared/utils/isPointerSupported'\nimport { useMergedSizes } from 'hooks/useMergedSizes'\nimport { useAlertProps } from './useAlertProps'\nimport {\n SIZES_HORIZONTAL,\n SIZES_VERTICAL,\n SIZES_TEXT,\n SIZES_ICON,\n SIZES_ALERT_TIMER,\n SIZES_DISCARD_BUTTON,\n SIZES_ALERT_BUTTON,\n SIZES_ALERT_BUTTON_ICON,\n SIZES_ALERT_BUTTON_TEXT,\n} from './sizes'\nimport * as Styled from './style'\nimport type { AlertProps, AlertType } from './types'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для отображения информационных сообщений.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<div\\> элемента.\n *\n */\nconst Alert: React.ForwardRefExoticComponent<AlertProps> & {\n Timer: typeof Timer\n} = Object.assign(\n forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const {\n size = 's',\n layout = 'horizontal',\n margin = 0,\n type = 'info',\n style = {},\n palette = {},\n title,\n text,\n addon,\n controls,\n discardButton,\n content,\n root,\n withIcon,\n clear,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n ...restProps\n } = useAlertProps(props)\n\n const sizes = useMergedSizes(restProps, layout === 'horizontal' ? SIZES_HORIZONTAL : SIZES_VERTICAL)\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const iconProps: IconProps = {\n ...sizeProps,\n sizes: SIZES_ICON,\n color: (\n {\n info: 'content-brand-primary',\n success: 'alert-success',\n warning: 'alert-warning',\n error: 'alert-error',\n } as Record<AlertType, Color>\n )[type],\n icon: {\n info: <NotifFill />,\n success: <CheckCircleFill />,\n warning: <WarningTriangleFill />,\n error: <CloseCirlceFill />,\n }[type],\n }\n\n const timerProps: Partial<TimerProps> = {\n ...sizeProps,\n sizes: SIZES_ALERT_TIMER,\n color: (\n {\n info: 'content-brand-primary',\n success: 'alert-success',\n warning: 'alert-warning',\n error: 'alert-error',\n } as Record<AlertType, Color>\n )[type],\n }\n\n const titleProps: TextProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n appearance: 'caption',\n weight: 700,\n wordBreak: 'break-word',\n color: 'inherit',\n }\n\n const textProps: TextProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n appearance: 'caption',\n weight: 400,\n wordBreak: 'break-word',\n color: 'inherit',\n }\n\n const buttonProps: ButtonProps = {\n ...sizeProps,\n sizes: SIZES_ALERT_BUTTON,\n iconSizes: SIZES_ALERT_BUTTON_ICON,\n textSizes: SIZES_ALERT_BUTTON_TEXT,\n preset: 'brand',\n black: true,\n textProps: {\n weight: 400,\n },\n }\n\n const anchorProps: AnchorProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n preset: 'brand',\n underline: 'dashed',\n color: 'inherit',\n }\n\n const discardButtonProps: IconButtonProps = {\n ...sizeProps,\n sizes: SIZES_DISCARD_BUTTON,\n icon: <Close />,\n }\n\n const [timerPaused, setTimerPaused] = useState(false)\n\n const timerContextProps = useMemo<Partial<TimerProps>>(\n () => ({\n paused: timerPaused,\n }),\n [timerPaused]\n )\n\n return (\n <Styled.Root\n {...restProps}\n style={{\n ...sizes[size],\n '--alert-margin': margin,\n ...style,\n }}\n palette={palette}\n clear={clear}\n type={type}\n ref={ref}\n onPointerEnter={(evt) => {\n if (restProps.onPointerEnter) {\n restProps.onPointerEnter(evt)\n }\n setTimerPaused(true)\n }}\n onMouseEnter={(evt) => {\n if (restProps.onMouseEnter) {\n restProps.onMouseEnter(evt)\n }\n if (!isPointerSupported()) setTimerPaused(true)\n }}\n onPointerLeave={(evt) => {\n if (restProps.onPointerLeave) {\n restProps.onPointerLeave(evt)\n }\n setTimerPaused(false)\n }}\n onMouseLeave={(evt) => {\n if (restProps.onMouseLeave) {\n restProps.onMouseLeave(evt)\n }\n if (!isPointerSupported()) setTimerPaused(false)\n }}\n >\n <TimerPropsContext.Provider value={timerContextProps}>\n <Slot\n render={root}\n props={{\n titleProps,\n textProps,\n iconProps,\n timerProps,\n buttonProps,\n anchorProps,\n discardButtonProps,\n }}\n fallback={\n <>\n <Styled.Container>\n {withIcon || addon ? (\n <Styled.Addon>\n {withIcon ? <Icon {...iconProps} /> : null}\n <Slot render={addon} props={{ iconProps, timerProps }} />\n </Styled.Addon>\n ) : null}\n <Styled.Main>\n <Slot\n render={content}\n props={{\n titleProps,\n textProps,\n }}\n fallback={\n <Styled.Content>\n <Slot render={title} props={titleProps} />\n <Slot render={text} props={textProps} />\n </Styled.Content>\n }\n />\n {controls ? (\n <Styled.Addon>\n <Slot render={controls} props={{ buttonProps, anchorProps }} />\n </Styled.Addon>\n ) : null}\n </Styled.Main>\n </Styled.Container>\n {discardButton ? (\n <Styled.DiscardButton>\n <Slot render={discardButton} props={discardButtonProps} />\n </Styled.DiscardButton>\n ) : null}\n </>\n }\n />\n </TimerPropsContext.Provider>\n </Styled.Root>\n )\n }),\n {\n Timer,\n }\n)\n\nexport { Alert }\n"],"names":["Alert","Object","assign","forwardRef","props","ref","size","layout","margin","type","style","palette","title","text","addon","controls","discardButton","content","root","withIcon","clear","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","restProps","useAlertProps","sizes","useMergedSizes","SIZES_HORIZONTAL","SIZES_VERTICAL","sizeProps","iconProps","SIZES_ICON","color","info","success","warning","error","icon","_jsx","NotifFill","CheckCircleFill","WarningTriangleFill","CloseCirlceFill","timerProps","SIZES_ALERT_TIMER","titleProps","SIZES_TEXT","appearance","weight","wordBreak","textProps","buttonProps","SIZES_ALERT_BUTTON","iconSizes","SIZES_ALERT_BUTTON_ICON","textSizes","SIZES_ALERT_BUTTON_TEXT","preset","black","anchorProps","underline","discardButtonProps","SIZES_DISCARD_BUTTON","Close","timerPaused","setTimerPaused","useState","timerContextProps","useMemo","paused","Styled","onPointerEnter","evt","onMouseEnter","isPointerSupported","onPointerLeave","onMouseLeave","children","TimerPropsContext","Provider","value","Slot","render","fallback","_jsxs","_Fragment","Icon","Timer"],"mappings":"y0BAsCA,MAAMA,MAEFC,OAAOC,OACTC,MAAAA,WAAuC,CAACC,EAAOC,KAC7C,MAAMC,KACJA,EAAO,IAAGC,OACVA,EAAS,aAAYC,OACrBA,EAAS,EAACC,KACVA,EAAO,aACPC,EAAQ,CAAA,EAAEC,QACVA,EAAU,CAAA,EAAEC,MACZA,EAAKC,KACLA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,cACRA,EAAaC,QACbA,EAAOC,KACPA,EAAIC,SACJA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,KACGC,GACDC,cAAAA,cAA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AY,CAAAO,SACXvC,WAAAA,IAAC2C,UAAI,CAACC,OAAQvE,EAAUX,MAAO,CAAEmD,cAAaQ,mBAE9C,WAGP/C,EACC0B,WAAAA,IAACgC,oBAAoB,CAAAO,SACnBvC,WAAAA,IAAC2C,UAAI,CAACC,OAAQtE,EAAeZ,MAAO6D,MAEpC,gBAQlB,CACE0B,MAAAA,MAAAA"}
@@ -1,2 +1,2 @@
1
- import{forwardRef,useState}from'react';import{useTheme}from'styled-components';import{useClassname}from'../../hooks/useClassname.mjs';import{useConfigPriority}from'../../hooks/use-config-priority.mjs';import{Root,IconWrapper,Timer,ContentWrapper,Title,Content,Link,Actions,CancelTimer,CloseIcon}from'./style.mjs';import{countdownColor}from'./utils.mjs';import{jsxs,jsx}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Anchor}from'../Anchor/Anchor.mjs';import{Button}from'../Button/Button.mjs';import{Close}from'../../icon-pack/src/icons/Close/index.mjs';import{WarningTriangleFill}from'../../icon-pack/src/icons/WarningTriangleFill/index.mjs';import{CheckCircleFill}from'../../icon-pack/src/icons/CheckCircleFill/index.mjs';import{NotifFill}from'../../icon-pack/src/icons/NotifFill/index.mjs';import{CloseCirlceFill}from'../../icon-pack/src/icons/CloseCirlceFill/index.mjs';const getDefaultIcon=({isCompact:o,theme:e,type:n})=>{const i=o?16:24;switch(n){case'error':return jsx(CloseCirlceFill,{fill:e.colors['alert-bg-error-500'],width:i,height:i});case'info':return jsx(NotifFill,{fill:e.colors['content-brand-primary'],width:i,height:i});case'success':return jsx(CheckCircleFill,{fill:e.colors['alert-success'],width:i,height:i});case'warning':return jsx(WarningTriangleFill,{fill:e.colors['alert-warning'],width:i,height:i});default:return null}};const COMPONENT_NAME='Alert';const Alert=forwardRef((o,e)=>{const n=useTheme();const{cancelTimerText:i="Отменить",primaryAction:t,primaryActionProps:r={},secondaryAction:l,secondaryActionProps:s={},children:c,className:a,clear:m,customIcon:p,image:h,isCompact:u,link:C,linkProps:d={},noIcon:f,onClickCancelTimer:x,closeToast:j,onTimerFinish:g,size:k="s",style:w,textProps:y={},textWrap:T,timer:A,title:I,titleProps:F={},type:W,width:N=['fit-content','fit-content','fit-content','351px','304px','304px']}=useConfigPriority(n.components?.Alert,o);const b=useClassname("Alert",a);const[z,P]=useState(!1);const B=Boolean(k==='l'||!!I||u&&(I||C||t||l));return jsxs(Root,{className:b,clear:m,column:B,isCompact:u,noIcon:f,onMouseEnter:()=>{A&&P(!0)},onMouseLeave:()=>{A&&P(!1)},ref:e,size:k,style:w,textWrap:T,type:W,width:N,withAction:!!t||!!l,withCloseIcon:!!j,withImage:!!h,withLink:!!C,withTimer:!!A,withTitle:!!I,children:[!f||p?jsxs(IconWrapper,{column:B,isCompact:u,withImage:!!h,children:[f||A||p||h?null:getDefaultIcon({isCompact:u,theme:n,type:W}),p?jsx(Icon,{name:p,size:u?16:24}):null,h,A?jsx(Timer,{isCompact:u,paused:z,timer:A,onTimerFinish:g,color:countdownColor({theme:n,type:W})}):null]}):null,jsxs(ContentWrapper,{column:B,isCompact:u,children:[I?jsx(Title,{color:n.colors['content-onmain-primary'],isCompact:u,size:u?14:16,lineHeight:"m",...F,children:I}):null,jsx(Content,{appearance:"body",color:n.colors['content-onmain-primary'],column:B,isCompact:u,size:u?'xs':'s',textWrap:T,...y,children:c}),C?jsx(Link,{clear:m,column:B,isCompact:u,withTitle:!!I,children:jsx(Anchor,{color:o.clear?n.colors['content-link']:n.colors['content-onmain-primary'],onClick:C.onClick,preset:"default",pseudo:!0,size:u?'s':'m',...d,children:C.content})}):null,t||l?jsxs(Actions,{column:B,isCompact:u,withTitle:!!I,children:[l?jsx(Button,{black:!0,fontWeight:"normal",onClick:l.onClick,outline:!0,preset:"brand",size:u?'xs':'s',margin:4,...s,children:l.content}):null,t?jsx(Button,{black:!0,fontWeight:"normal",onClick:t.onClick,preset:"brand",size:u?'xs':'s',margin:4,...r,children:t.content}):null]}):null]}),x?jsx(CancelTimer,{black:!0,clear:!0,fontWeight:"normal",isCompact:u,onClick:x,preset:"brand",size:u?'xs':'s',margin:4,children:i}):null,!j||u&&A?null:jsx(CloseIcon,{"aria-label":"close",onClick:j,type:"button",withTimer:!!A,children:jsx(Close,{fill:n.colors['content-onmain-primary'],width:u?18:24,height:u?18:24})})]})});Alert.displayName="Alert";export{Alert,COMPONENT_NAME};
1
+ import{forwardRef,useState,useMemo}from'react';import{isPointerSupported}from'../../shared/utils/isPointerSupported.mjs';import{useMergedSizes}from'../../hooks/useMergedSizes.mjs';import{useAlertProps}from'./useAlertProps.mjs';import{SIZES_DISCARD_BUTTON,SIZES_TEXT,SIZES_ALERT_BUTTON_TEXT,SIZES_ALERT_BUTTON_ICON,SIZES_ALERT_BUTTON,SIZES_ALERT_TIMER,SIZES_ICON,SIZES_VERTICAL,SIZES_HORIZONTAL}from'./sizes.mjs';import{Root,Container,Addon,Main,Content,DiscardButton}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{TimerPropsContext}from'../Timer/context.mjs';import{Slot}from'../Slot/Slot.mjs';import{Icon}from'../Icon/Icon.mjs';import{Timer}from'../Timer/Timer.mjs';import{Close}from'../../icon-pack/src/icons/Close/index.mjs';import{CloseCirlceFill}from'../../icon-pack/src/icons/CloseCirlceFill/index.mjs';import{WarningTriangleFill}from'../../icon-pack/src/icons/WarningTriangleFill/index.mjs';import{CheckCircleFill}from'../../icon-pack/src/icons/CheckCircleFill/index.mjs';import{NotifFill}from'../../icon-pack/src/icons/NotifFill/index.mjs';const Alert=Object.assign(forwardRef((e,r)=>{const{size:o="s",layout:s="horizontal",margin:i=0,type:n="info",style:t={},palette:l={},title:c,text:a,addon:p,controls:S,discardButton:m,content:d,root:T,withIcon:E,clear:u,sizeXXS:j,sizeXS:x,sizeS:I,sizeM:_,sizeL:f,sizeXL:P,...z}=useAlertProps(e);const C=useMergedSizes(z,s==='horizontal'?SIZES_HORIZONTAL:SIZES_VERTICAL);const h={size:o,sizeXXS:j,sizeXS:x,sizeS:I,sizeM:_,sizeL:f,sizeXL:P};const g={...h,sizes:SIZES_ICON,color:{info:'content-brand-primary',success:'alert-success',warning:'alert-warning',error:'alert-error'}[n],icon:{info:jsx(NotifFill,{}),success:jsx(CheckCircleFill,{}),warning:jsx(WarningTriangleFill,{}),error:jsx(CloseCirlceFill,{})}[n]};const A={...h,sizes:SIZES_ALERT_TIMER,color:{info:'content-brand-primary',success:'alert-success',warning:'alert-warning',error:'alert-error'}[n]};const L={...h,sizes:SIZES_TEXT,appearance:'caption',weight:700,wordBreak:'break-word',color:'inherit'};const Z={...h,sizes:SIZES_TEXT,appearance:'caption',weight:400,wordBreak:'break-word',color:'inherit'};const R={...h,sizes:SIZES_ALERT_BUTTON,iconSizes:SIZES_ALERT_BUTTON_ICON,textSizes:SIZES_ALERT_BUTTON_TEXT,preset:'brand',black:!0,textProps:{weight:400}};const M={...h,sizes:SIZES_TEXT,preset:'brand',underline:'dashed',color:'inherit'};const N={...h,sizes:SIZES_DISCARD_BUTTON,icon:jsx(Close,{})};const[O,k]=useState(!1);const w=useMemo(()=>({paused:O}),[O]);return jsx(Root,{...z,style:{...C[o],'--alert-margin':i,...t},palette:l,clear:u,type:n,ref:r,onPointerEnter:e=>{z.onPointerEnter&&z.onPointerEnter(e),k(!0)},onMouseEnter:e=>{z.onMouseEnter&&z.onMouseEnter(e),isPointerSupported()||k(!0)},onPointerLeave:e=>{z.onPointerLeave&&z.onPointerLeave(e),k(!1)},onMouseLeave:e=>{z.onMouseLeave&&z.onMouseLeave(e),isPointerSupported()||k(!1)},children:jsx(TimerPropsContext.Provider,{value:w,children:jsx(Slot,{render:T,props:{titleProps:L,textProps:Z,iconProps:g,timerProps:A,buttonProps:R,anchorProps:M,discardButtonProps:N},fallback:jsxs(Fragment,{children:[jsxs(Container,{children:[E||p?jsxs(Addon,{children:[E?jsx(Icon,{...g}):null,jsx(Slot,{render:p,props:{iconProps:g,timerProps:A}})]}):null,jsxs(Main,{children:[jsx(Slot,{render:d,props:{titleProps:L,textProps:Z},fallback:jsxs(Content,{children:[jsx(Slot,{render:c,props:L}),jsx(Slot,{render:a,props:Z})]})}),S?jsx(Addon,{children:jsx(Slot,{render:S,props:{buttonProps:R,anchorProps:M}})}):null]})]}),m?jsx(DiscardButton,{children:jsx(Slot,{render:m,props:N})}):null]})})})})}),{Timer});export{Alert};
2
2
  //# sourceMappingURL=Alert.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.mjs","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react'\nimport { useTheme } from 'styled-components'\nimport { CheckCircleFill, Close, CloseCirlceFill, NotifFill, WarningTriangleFill } from '@foxford/icon-pack'\nimport type { DefaultTheme } from 'styled-components'\n\nimport { useClassname } from 'hooks/useClassname'\nimport { useConfigPriority } from 'hooks/use-config-priority'\n\nimport { Anchor } from '../Anchor'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\n\nimport * as Styled from './style'\n\nimport type { AlertProps } from './types'\nimport { countdownColor } from './utils'\n\nconst getDefaultIcon = ({\n isCompact,\n theme,\n type,\n}: Pick<AlertProps, 'isCompact' | 'type'> & { theme: DefaultTheme }) => {\n const size = isCompact ? 16 : 24\n\n switch (type) {\n case 'error':\n return <CloseCirlceFill fill={theme.colors['alert-bg-error-500']} width={size} height={size} />\n case 'info':\n return <NotifFill fill={theme.colors['content-brand-primary']} width={size} height={size} />\n case 'success':\n return <CheckCircleFill fill={theme.colors['alert-success']} width={size} height={size} />\n case 'warning':\n return <WarningTriangleFill fill={theme.colors['alert-warning']} width={size} height={size} />\n default:\n return null\n }\n}\n\nconst COMPONENT_NAME = 'Alert'\n\nconst Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const theme = useTheme()\n\n const {\n cancelTimerText = 'Отменить',\n primaryAction,\n primaryActionProps = {},\n secondaryAction,\n secondaryActionProps = {},\n children,\n className,\n clear,\n customIcon,\n image,\n isCompact,\n link,\n linkProps = {},\n noIcon,\n onClickCancelTimer,\n closeToast,\n onTimerFinish,\n size = 's',\n style,\n textProps = {},\n textWrap,\n timer,\n title,\n titleProps = {},\n type,\n width = ['fit-content', 'fit-content', 'fit-content', '351px', '304px', '304px'],\n } = useConfigPriority<AlertProps>(theme.components?.Alert, props)\n const _className = useClassname(COMPONENT_NAME, className)\n const [timerOnPause, setTimerOnPause] = useState(false)\n\n const column = Boolean(size === 'l' || !!title || (isCompact && (title || link || primaryAction || secondaryAction)))\n\n const handleMouseEnter = () => {\n if (timer) {\n setTimerOnPause(true)\n }\n }\n\n const handleMouseLeave = () => {\n if (timer) {\n setTimerOnPause(false)\n }\n }\n\n return (\n <Styled.Root\n className={_className}\n clear={clear}\n column={column}\n isCompact={isCompact}\n noIcon={noIcon}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n size={size}\n style={style}\n textWrap={textWrap}\n type={type}\n width={width}\n withAction={!!primaryAction || !!secondaryAction}\n withCloseIcon={!!closeToast}\n withImage={!!image}\n withLink={!!link}\n withTimer={!!timer}\n withTitle={!!title}\n >\n {!noIcon || customIcon ? (\n <Styled.IconWrapper column={column} isCompact={isCompact} withImage={!!image}>\n {!noIcon && !timer && !customIcon && !image ? getDefaultIcon({ isCompact, theme, type }) : null}\n {customIcon ? <Icon name={customIcon} size={isCompact ? 16 : 24} /> : null}\n {image}\n {timer ? (\n <Styled.Timer\n isCompact={isCompact}\n paused={timerOnPause}\n timer={timer}\n onTimerFinish={onTimerFinish}\n color={countdownColor({ theme, type })}\n />\n ) : null}\n </Styled.IconWrapper>\n ) : null}\n\n <Styled.ContentWrapper column={column} isCompact={isCompact}>\n {title ? (\n <Styled.Title\n color={theme.colors['content-onmain-primary']}\n isCompact={isCompact}\n size={isCompact ? 14 : 16}\n lineHeight='m'\n {...titleProps}\n >\n {title}\n </Styled.Title>\n ) : null}\n\n <Styled.Content\n appearance='body'\n color={theme.colors['content-onmain-primary']}\n column={column}\n isCompact={isCompact}\n size={isCompact ? 'xs' : 's'}\n textWrap={textWrap}\n {...textProps}\n >\n {children}\n </Styled.Content>\n\n {link ? (\n <Styled.Link clear={clear} column={column} isCompact={isCompact} withTitle={!!title}>\n <Anchor\n color={props.clear ? theme.colors['content-link'] : theme.colors['content-onmain-primary']}\n // eslint-disable-next-line react/jsx-handler-names\n onClick={link.onClick}\n preset='default'\n pseudo\n size={isCompact ? 's' : 'm'}\n {...linkProps}\n >\n {link.content}\n </Anchor>\n </Styled.Link>\n ) : null}\n\n {primaryAction || secondaryAction ? (\n <Styled.Actions column={column} isCompact={isCompact} withTitle={!!title}>\n {secondaryAction ? (\n <Button\n black\n fontWeight='normal'\n // eslint-disable-next-line react/jsx-handler-names\n onClick={secondaryAction.onClick}\n outline\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n {...secondaryActionProps}\n >\n {secondaryAction.content}\n </Button>\n ) : null}\n\n {primaryAction ? (\n <Button\n black\n fontWeight='normal'\n // eslint-disable-next-line react/jsx-handler-names\n onClick={primaryAction.onClick}\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n {...primaryActionProps}\n >\n {primaryAction.content}\n </Button>\n ) : null}\n </Styled.Actions>\n ) : null}\n </Styled.ContentWrapper>\n\n {onClickCancelTimer ? (\n <Styled.CancelTimer\n black\n clear\n fontWeight='normal'\n isCompact={isCompact}\n onClick={onClickCancelTimer}\n preset='brand'\n size={isCompact ? 'xs' : 's'}\n margin={4}\n >\n {cancelTimerText}\n </Styled.CancelTimer>\n ) : null}\n\n {closeToast && (isCompact ? !timer : true) ? (\n <Styled.CloseIcon aria-label='close' onClick={closeToast} type='button' withTimer={!!timer}>\n <Close\n fill={theme.colors['content-onmain-primary']}\n width={isCompact ? 18 : 24}\n height={isCompact ? 18 : 24}\n />\n </Styled.CloseIcon>\n ) : null}\n </Styled.Root>\n )\n})\n\nAlert.displayName = COMPONENT_NAME\n\nexport { Alert, COMPONENT_NAME }\n\nexport type { AlertProps }\n"],"names":["getDefaultIcon","isCompact","theme","type","size","_jsx","CloseCirlceFill","fill","colors","width","height","NotifFill","CheckCircleFill","WarningTriangleFill","COMPONENT_NAME","Alert","forwardRef","props","ref","useTheme","cancelTimerText","primaryAction","primaryActionProps","secondaryAction","secondaryActionProps","children","className","clear","customIcon","image","link","linkProps","noIcon","onClickCancelTimer","closeToast","onTimerFinish","style","textProps","textWrap","timer","title","titleProps","useConfigPriority","components","_className","useClassname","timerOnPause","setTimerOnPause","useState","column","Boolean","_jsxs","Styled","onMouseEnter","handleMouseEnter","onMouseLeave","handleMouseLeave","withAction","withCloseIcon","withImage","withLink","withTimer","withTitle","Icon","name","paused","color","countdownColor","lineHeight","appearance","Anchor","onClick","preset","pseudo","content","Button","black","fontWeight","outline","margin","Close","displayName"],"mappings":"23BAiBA,MAAMA,eAAiBA,EACrBC,YACAC,QACAC,WAEA,MAAMC,EAAOH,EAAY,GAAK,GAE9B,OAAQE,GACN,IAAK,QACH,OAAOE,IAACC,gBAAe,CAACC,KAAML,EAAMM,OAAO,sBAAuBC,MAAOL,EAAMM,OAAQN,IACzF,IAAK,OACH,OAAOC,IAACM,UAAS,CAACJ,KAAML,EAAMM,OAAO,yBAA0BC,MAAOL,EAAMM,OAAQN,IACtF,IAAK,UACH,OAAOC,IAACO,gBAAe,CAACL,KAAML,EAAMM,OAAO,iBAAkBC,MAAOL,EAAMM,OAAQN,IACpF,IAAK,UACH,OAAOC,IAACQ,oBAAmB,CAACN,KAAML,EAAMM,OAAO,iBAAkBC,MAAOL,EAAMM,OAAQN,IACxF,QACE,OAAO,OAIb,MAAMU,eAAiB,QAEvB,MAAMC,MAAQC,WAAuC,CAACC,EAAOC,KAC3D,MAAMhB,EAAQiB,WAEd,MAAMC,gBACJA,EAAkB,WAAUC,cAC5BA,EAAaC,mBACbA,EAAqB,CAAA,EAAEC,gBACvBA,EAAeC,qBACfA,EAAuB,CAAA,EAAEC,SACzBA,EAAQC,UACRA,EAASC,MACTA,EAAKC,WACLA,EAAUC,MACVA,EAAK5B,UACLA,E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E,QAAStC,EACTuC,OAAO,QACPpE,KAAMH,EAAY,KAAO,IACzB8E,OAAQ,EAAEtD,SAETL,IAED,MAEHc,GAAejC,GAAasC,EAQzB,KAPFlC,IAAC+C,UAAgB,CAAC,aAAW,QAAQmB,QAASrC,EAAY/B,KAAK,SAAS0D,YAAatB,EAAMd,SACzFpB,IAAC2E,MAAK,CACJzE,KAAML,EAAMM,OAAO,0BACnBC,MAAOR,EAAY,GAAK,GACxBS,OAAQT,EAAY,GAAK,YAQrCc,MAAMkE,YAlMiB"}
1
+ {"version":3,"file":"Alert.mjs","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { forwardRef, useMemo, useState } from 'react'\nimport { Close, NotifFill, CheckCircleFill, WarningTriangleFill, CloseCirlceFill } from '@foxford/icon-pack'\nimport { Timer, TimerPropsContext } from 'components/Timer'\nimport type { IconProps } from 'components/Icon'\nimport { Icon } from 'components/Icon'\nimport type { IconButtonProps } from 'components/IconButton'\nimport type { ButtonProps } from 'components/Button'\nimport type { AnchorProps } from 'components/Anchor'\nimport type { TextProps } from 'components/Text'\nimport type { TimerProps } from 'components/Timer'\nimport { Slot } from 'components/Slot'\nimport type { Color } from 'shared/types'\nimport { isPointerSupported } from 'shared/utils/isPointerSupported'\nimport { useMergedSizes } from 'hooks/useMergedSizes'\nimport { useAlertProps } from './useAlertProps'\nimport {\n SIZES_HORIZONTAL,\n SIZES_VERTICAL,\n SIZES_TEXT,\n SIZES_ICON,\n SIZES_ALERT_TIMER,\n SIZES_DISCARD_BUTTON,\n SIZES_ALERT_BUTTON,\n SIZES_ALERT_BUTTON_ICON,\n SIZES_ALERT_BUTTON_TEXT,\n} from './sizes'\nimport * as Styled from './style'\nimport type { AlertProps, AlertType } from './types'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для отображения информационных сообщений.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<div\\> элемента.\n *\n */\nconst Alert: React.ForwardRefExoticComponent<AlertProps> & {\n Timer: typeof Timer\n} = Object.assign(\n forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const {\n size = 's',\n layout = 'horizontal',\n margin = 0,\n type = 'info',\n style = {},\n palette = {},\n title,\n text,\n addon,\n controls,\n discardButton,\n content,\n root,\n withIcon,\n clear,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n ...restProps\n } = useAlertProps(props)\n\n const sizes = useMergedSizes(restProps, layout === 'horizontal' ? SIZES_HORIZONTAL : SIZES_VERTICAL)\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const iconProps: IconProps = {\n ...sizeProps,\n sizes: SIZES_ICON,\n color: (\n {\n info: 'content-brand-primary',\n success: 'alert-success',\n warning: 'alert-warning',\n error: 'alert-error',\n } as Record<AlertType, Color>\n )[type],\n icon: {\n info: <NotifFill />,\n success: <CheckCircleFill />,\n warning: <WarningTriangleFill />,\n error: <CloseCirlceFill />,\n }[type],\n }\n\n const timerProps: Partial<TimerProps> = {\n ...sizeProps,\n sizes: SIZES_ALERT_TIMER,\n color: (\n {\n info: 'content-brand-primary',\n success: 'alert-success',\n warning: 'alert-warning',\n error: 'alert-error',\n } as Record<AlertType, Color>\n )[type],\n }\n\n const titleProps: TextProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n appearance: 'caption',\n weight: 700,\n wordBreak: 'break-word',\n color: 'inherit',\n }\n\n const textProps: TextProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n appearance: 'caption',\n weight: 400,\n wordBreak: 'break-word',\n color: 'inherit',\n }\n\n const buttonProps: ButtonProps = {\n ...sizeProps,\n sizes: SIZES_ALERT_BUTTON,\n iconSizes: SIZES_ALERT_BUTTON_ICON,\n textSizes: SIZES_ALERT_BUTTON_TEXT,\n preset: 'brand',\n black: true,\n textProps: {\n weight: 400,\n },\n }\n\n const anchorProps: AnchorProps = {\n ...sizeProps,\n sizes: SIZES_TEXT,\n preset: 'brand',\n underline: 'dashed',\n color: 'inherit',\n }\n\n const discardButtonProps: IconButtonProps = {\n ...sizeProps,\n sizes: SIZES_DISCARD_BUTTON,\n icon: <Close />,\n }\n\n const [timerPaused, setTimerPaused] = useState(false)\n\n const timerContextProps = useMemo<Partial<TimerProps>>(\n () => ({\n paused: timerPaused,\n }),\n [timerPaused]\n )\n\n return (\n <Styled.Root\n {...restProps}\n style={{\n ...sizes[size],\n '--alert-margin': margin,\n ...style,\n }}\n palette={palette}\n clear={clear}\n type={type}\n ref={ref}\n onPointerEnter={(evt) => {\n if (restProps.onPointerEnter) {\n restProps.onPointerEnter(evt)\n }\n setTimerPaused(true)\n }}\n onMouseEnter={(evt) => {\n if (restProps.onMouseEnter) {\n restProps.onMouseEnter(evt)\n }\n if (!isPointerSupported()) setTimerPaused(true)\n }}\n onPointerLeave={(evt) => {\n if (restProps.onPointerLeave) {\n restProps.onPointerLeave(evt)\n }\n setTimerPaused(false)\n }}\n onMouseLeave={(evt) => {\n if (restProps.onMouseLeave) {\n restProps.onMouseLeave(evt)\n }\n if (!isPointerSupported()) setTimerPaused(false)\n }}\n >\n <TimerPropsContext.Provider value={timerContextProps}>\n <Slot\n render={root}\n props={{\n titleProps,\n textProps,\n iconProps,\n timerProps,\n buttonProps,\n anchorProps,\n discardButtonProps,\n }}\n fallback={\n <>\n <Styled.Container>\n {withIcon || addon ? (\n <Styled.Addon>\n {withIcon ? <Icon {...iconProps} /> : null}\n <Slot render={addon} props={{ iconProps, timerProps }} />\n </Styled.Addon>\n ) : null}\n <Styled.Main>\n <Slot\n render={content}\n props={{\n titleProps,\n textProps,\n }}\n fallback={\n <Styled.Content>\n <Slot render={title} props={titleProps} />\n <Slot render={text} props={textProps} />\n </Styled.Content>\n }\n />\n {controls ? (\n <Styled.Addon>\n <Slot render={controls} props={{ buttonProps, anchorProps }} />\n </Styled.Addon>\n ) : null}\n </Styled.Main>\n </Styled.Container>\n {discardButton ? (\n <Styled.DiscardButton>\n <Slot render={discardButton} props={discardButtonProps} />\n </Styled.DiscardButton>\n ) : null}\n </>\n }\n />\n </TimerPropsContext.Provider>\n </Styled.Root>\n )\n }),\n {\n Timer,\n }\n)\n\nexport { Alert }\n"],"names":["Alert","Object","assign","forwardRef","props","ref","size","layout","margin","type","style","palette","title","text","addon","controls","discardButton","content","root","withIcon","clear","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","restProps","useAlertProps","sizes","useMergedSizes","SIZES_HORIZONTAL","SIZES_VERTICAL","sizeProps","iconProps","SIZES_ICON","color","info","success","warning","error","icon","_jsx","NotifFill","CheckCircleFill","WarningTriangleFill","CloseCirlceFill","timerProps","SIZES_ALERT_TIMER","titleProps","SIZES_TEXT","appearance","weight","wordBreak","textProps","buttonProps","SIZES_ALERT_BUTTON","iconSizes","SIZES_ALERT_BUTTON_ICON","textSizes","SIZES_ALERT_BUTTON_TEXT","preset","black","anchorProps","underline","discardButtonProps","SIZES_DISCARD_BUTTON","Close","timerPaused","setTimerPaused","useState","timerContextProps","useMemo","paused","Styled","onPointerEnter","evt","onMouseEnter","isPointerSupported","onPointerLeave","onMouseLeave","children","TimerPropsContext","Provider","value","Slot","render","fallback","_jsxs","_Fragment","Icon","Timer"],"mappings":"mjCAsCA,MAAMA,MAEFC,OAAOC,OACTC,WAAuC,CAACC,EAAOC,KAC7C,MAAMC,KACJA,EAAO,IAAGC,OACVA,EAAS,aAAYC,OACrBA,EAAS,EAACC,KACVA,EAAO,OAAMC,MACbA,EAAQ,CAAA,EAAEC,QACVA,EAAU,CAAA,EAAEC,MACZA,EAAKC,KACLA,EAAIC,MACJA,EAAKC,SACLA,EAAQC,cACRA,EAAaC,QACbA,EAAOC,KACPA,EAAIC,SACJA,EAAQC,MACRA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,KACGC,GACDC,cAAcxB,GAElB,MAAMyB,EAAQC,eAAeH,EAAWpB,IAAW,aAAewB,iBA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D,cACZlD,EAAUkD,aAAaD,GAEpBE,sBAAsBT,GAAe,IAE5CU,eAAiBH,IACXjD,EAAUoD,gBACZpD,EAAUoD,eAAeH,GAE3BP,GAAe,IAEjBW,aAAeJ,IACTjD,EAAUqD,cACZrD,EAAUqD,aAAaJ,GAEpBE,sBAAsBT,GAAe,IAC1CY,SAEFvC,IAACwC,kBAAkBC,SAAQ,CAACC,MAAOb,EAAkBU,SACnDvC,IAAC2C,KAAI,CACHC,OAAQpE,EACRd,MAAO,CACL6C,aACAK,YACApB,YACAa,aACAQ,cACAQ,cACAE,sBAEFsB,SACEC,KAAAC,SAAA,CAAAR,SAAA,CACEO,KAACd,UAAgB,CAAAO,SAAA,CACd9D,GAAYL,EACX0E,KAACd,MAAY,CAAAO,SAAA,CACV9D,EAAWuB,IAACgD,KAAI,IAAKxD,IAAgB,KACtCQ,IAAC2C,KAAI,CAACC,OAAQxE,EAAOV,MAAO,CAAE8B,YAAWa,mBAEzC,KACJyC,KAACd,KAAW,CAAAO,SAAA,CACVvC,IAAC2C,KAAI,CACHC,OAAQrE,EACRb,MAAO,CACL6C,aACAK,aAEFiC,SACEC,KAACd,QAAc,CAAAO,SAAA,CACbvC,IAAC2C,KAAI,CAACC,OAAQ1E,EAAOR,MAAO6C,IAC5BP,IAAC2C,KAAI,CAACC,OAAQzE,EAAMT,MAAOkD,SAIhCvC,EACC2B,IAACgC,MAAY,CAAAO,SACXvC,IAAC2C,KAAI,CAACC,OAAQvE,EAAUX,MAAO,CAAEmD,cAAaQ,mBAE9C,WAGP/C,EACC0B,IAACgC,cAAoB,CAAAO,SACnBvC,IAAC2C,KAAI,CAACC,OAAQtE,EAAeZ,MAAO6D,MAEpC,gBAQlB,CACE0B"}
@@ -0,0 +1,2 @@
1
+ 'use strict';var sizes=require('../IconButton/sizes.js');var sizes$1=require('../Button/sizes.js');require('../Button/Button.js');var sizes$2=require('../Timer/sizes.js');const SIZES_ALERT_TIMER={m:sizes$2.SIZES.m,s:sizes$2.SIZES.s};const SIZES_DISCARD_BUTTON={m:sizes.SIZES_BASE.xl,s:sizes.SIZES_BASE.m};exports.SIZES_ALERT_BUTTON={m:sizes$1.SIZES.s,s:sizes$1.SIZES.xs},exports.SIZES_ALERT_BUTTON_ICON={m:{fontSize:20},s:{fontSize:20}},exports.SIZES_ALERT_BUTTON_TEXT={m:{fontSize:16},s:{fontSize:14}},exports.SIZES_ALERT_TIMER=SIZES_ALERT_TIMER,exports.SIZES_DISCARD_BUTTON=SIZES_DISCARD_BUTTON,exports.SIZES_HORIZONTAL={m:{'--alert-root-width':'fit-content','--alert-root-max-width':'704px','--alert-root-min-width':'224px','--alert-root-border-radius':'24px','--alert-root-min-height':'48px','--alert-container-padding':'4px 20px','--alert-container-gap':'12px','--alert-main-flex-direction':'row','--alert-main-gap-horizontal':'16px','--alert-main-gap-vertical':'0px','--alert-discard-button-padding':'8px 8px 8px 0px','--alert-content-padding':'10px 0px','--alert-content-align-items':'center','--alert-content-gap':'8px'},s:{'--alert-root-width':'fit-content','--alert-root-max-width':'512px','--alert-root-min-width':'192px','--alert-root-border-radius':'20px','--alert-root-min-height':'40px','--alert-container-padding':'4px 16px','--alert-container-gap':'8px','--alert-main-flex-direction':'row','--alert-main-gap-horizontal':'12px','--alert-main-gap-vertical':'0px','--alert-discard-button-padding':'8px 8px 8px 0px','--alert-content-padding':'7px 0px','--alert-content-align-items':'center','--alert-content-gap':'6px'}},exports.SIZES_ICON={m:{fontSize:24},s:{fontSize:20}},exports.SIZES_TEXT={m:{fontSize:16},s:{fontSize:14}},exports.SIZES_VERTICAL={m:{'--alert-root-width':'368px','--alert-root-max-width':'none','--alert-root-min-width':'auto','--alert-root-border-radius':'12px','--alert-root-min-height':'48px','--alert-container-padding':'16px 20px','--alert-container-gap':'12px','--alert-main-flex-direction':'column','--alert-main-gap-horizontal':'0px','--alert-main-gap-vertical':'12px','--alert-discard-button-padding':'12px 12px 12px 0px','--alert-content-padding':'3px 0px','--alert-content-align-items':'start','--alert-content-gap':'8px'},s:{'--alert-root-width':'fit-content','--alert-root-max-width':'100%','--alert-root-min-width':'280px','--alert-root-border-radius':'12px','--alert-root-min-height':'40px','--alert-container-padding':'12px 16px','--alert-container-gap':'8px','--alert-main-flex-direction':'column','--alert-main-gap-horizontal':'0px','--alert-main-gap-vertical':'10px','--alert-discard-button-padding':'10px 10px 10px 0px','--alert-content-padding':'2px 0px','--alert-content-align-items':'start','--alert-content-gap':'6px'}};
2
+ //# sourceMappingURL=sizes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.js","sources":["../../../../src/components/Alert/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES_BASE as SIZES_ICON_BUTTON } from 'components/IconButton'\nimport { SIZES as SIZES_TIMER } from 'components/Timer'\nimport { SIZES as SIZES_BUTTON } from 'components/Button'\nimport type { Size } from './types'\n\nexport const SIZES_HORIZONTAL: Record<Size, CSSProperties> = {\n m: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '704px',\n '--alert-root-min-width': '224px',\n '--alert-root-border-radius': '24px',\n '--alert-root-min-height': '48px',\n '--alert-container-padding': '4px 20px',\n '--alert-container-gap': '12px',\n '--alert-main-flex-direction': 'row',\n '--alert-main-gap-horizontal': '16px',\n '--alert-main-gap-vertical': '0px',\n '--alert-discard-button-padding': '8px 8px 8px 0px',\n '--alert-content-padding': '10px 0px',\n '--alert-content-align-items': 'center',\n '--alert-content-gap': '8px',\n },\n s: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '512px',\n '--alert-root-min-width': '192px',\n '--alert-root-border-radius': '20px',\n '--alert-root-min-height': '40px',\n '--alert-container-padding': '4px 16px',\n '--alert-container-gap': '8px',\n '--alert-main-flex-direction': 'row',\n '--alert-main-gap-horizontal': '12px',\n '--alert-main-gap-vertical': '0px',\n '--alert-discard-button-padding': '8px 8px 8px 0px',\n '--alert-content-padding': '7px 0px',\n '--alert-content-align-items': 'center',\n '--alert-content-gap': '6px',\n },\n}\n\nexport const SIZES_VERTICAL: Record<Size, CSSProperties> = {\n m: {\n '--alert-root-width': '368px',\n '--alert-root-max-width': 'none',\n '--alert-root-min-width': 'auto',\n '--alert-root-border-radius': '12px',\n '--alert-root-min-height': '48px',\n '--alert-container-padding': '16px 20px',\n '--alert-container-gap': '12px',\n '--alert-main-flex-direction': 'column',\n '--alert-main-gap-horizontal': '0px',\n '--alert-main-gap-vertical': '12px',\n '--alert-discard-button-padding': '12px 12px 12px 0px',\n '--alert-content-padding': '3px 0px',\n '--alert-content-align-items': 'start',\n '--alert-content-gap': '8px',\n },\n s: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '100%',\n '--alert-root-min-width': '280px',\n '--alert-root-border-radius': '12px',\n '--alert-root-min-height': '40px',\n '--alert-container-padding': '12px 16px',\n '--alert-container-gap': '8px',\n '--alert-main-flex-direction': 'column',\n '--alert-main-gap-horizontal': '0px',\n '--alert-main-gap-vertical': '10px',\n '--alert-discard-button-padding': '10px 10px 10px 0px',\n '--alert-content-padding': '2px 0px',\n '--alert-content-align-items': 'start',\n '--alert-content-gap': '6px',\n },\n}\n\nexport const SIZES_TEXT: Record<Size, CSSProperties> = {\n m: { fontSize: 16 },\n s: { fontSize: 14 },\n}\n\nexport const SIZES_ICON: Record<Size, CSSProperties> = {\n m: { fontSize: 24 },\n s: { fontSize: 20 },\n}\n\nexport const SIZES_ALERT_TIMER: Record<Size, CSSProperties> = {\n m: SIZES_TIMER.m,\n s: SIZES_TIMER.s,\n}\n\nexport const SIZES_DISCARD_BUTTON: Record<Size, CSSProperties> = {\n m: SIZES_ICON_BUTTON.xl,\n s: SIZES_ICON_BUTTON.m,\n}\n\nexport const SIZES_ALERT_BUTTON: Record<Size, CSSProperties> = {\n m: SIZES_BUTTON.s,\n s: SIZES_BUTTON.xs,\n}\n\nexport const SIZES_ALERT_BUTTON_ICON: Record<Size, CSSProperties> = {\n m: { fontSize: 20 },\n s: { fontSize: 20 },\n}\n\nexport const SIZES_ALERT_BUTTON_TEXT: Record<Size, CSSProperties> = {\n m: { fontSize: 16 },\n s: { fontSize: 14 },\n}\n"],"names":["SIZES_ALERT_TIMER","m","SIZES_TIMER","s","SIZES_DISCARD_BUTTON","SIZES_ICON_BUTTON","xl","SIZES_BUTTON","xs","fontSize"],"mappings":"2KAsFO,MAAMA,kBAAiD,CAC5DC,EAAGC,QAAAA,MAAYD,EACfE,EAAGD,QAAAA,MAAYC,GAGV,MAAMC,qBAAoD,CAC/DH,EAAGI,MAAAA,WAAkBC,GACrBH,EAAGE,MAAAA,WAAkBJ,8BAGwC,CAC7DA,EAAGM,QAAAA,MAAaJ,EAChBA,EAAGI,QAAAA,MAAaC,oCAGkD,CAClEP,EAAG,CAAEQ,SAAU,IACfN,EAAG,CAAEM,SAAU,qCAGmD,CAClER,EAAG,CAAEQ,SAAU,IACfN,EAAG,CAAEM,SAAU,4HAtG4C,CAC3DR,EAAG,CACD,qBAAsB,cACtB,yBAA0B,QAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,WAC7B,wBAAyB,OACzB,8BAA+B,MAC/B,8BAA+B,OAC/B,4BAA6B,MAC7B,iCAAkC,kBAClC,0BAA2B,WAC3B,8BAA+B,SAC/B,sBAAuB,OAEzBE,EAAG,CACD,qBAAsB,cACtB,yBAA0B,QAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,WAC7B,wBAAyB,MACzB,8BAA+B,MAC/B,8BAA+B,OAC/B,4BAA6B,MAC7B,iCAAkC,kBAClC,0BAA2B,UAC3B,8BAA+B,SAC/B,sBAAuB,2BA4C4B,CACrDF,EAAG,CAAEQ,SAAU,IACfN,EAAG,CAAEM,SAAU,wBAPsC,CACrDR,EAAG,CAAEQ,SAAU,IACfN,EAAG,CAAEM,SAAU,4BArC0C,CACzDR,EAAG,CACD,qBAAsB,QACtB,yBAA0B,OAC1B,yBAA0B,OAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,YAC7B,wBAAyB,OACzB,8BAA+B,SAC/B,8BAA+B,MAC/B,4BAA6B,OAC7B,iCAAkC,qBAClC,0BAA2B,UAC3B,8BAA+B,QAC/B,sBAAuB,OAEzBE,EAAG,CACD,qBAAsB,cACtB,yBAA0B,OAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,YAC7B,wBAAyB,MACzB,8BAA+B,SAC/B,8BAA+B,MAC/B,4BAA6B,OAC7B,iCAAkC,qBAClC,0BAA2B,UAC3B,8BAA+B,QAC/B,sBAAuB"}
@@ -0,0 +1,2 @@
1
+ import{SIZES_BASE}from'../IconButton/sizes.mjs';import{SIZES}from'../Button/sizes.mjs';import'../Button/Button.mjs';import{SIZES as SIZES$1}from'../Timer/sizes.mjs';const SIZES_HORIZONTAL={m:{'--alert-root-width':'fit-content','--alert-root-max-width':'704px','--alert-root-min-width':'224px','--alert-root-border-radius':'24px','--alert-root-min-height':'48px','--alert-container-padding':'4px 20px','--alert-container-gap':'12px','--alert-main-flex-direction':'row','--alert-main-gap-horizontal':'16px','--alert-main-gap-vertical':'0px','--alert-discard-button-padding':'8px 8px 8px 0px','--alert-content-padding':'10px 0px','--alert-content-align-items':'center','--alert-content-gap':'8px'},s:{'--alert-root-width':'fit-content','--alert-root-max-width':'512px','--alert-root-min-width':'192px','--alert-root-border-radius':'20px','--alert-root-min-height':'40px','--alert-container-padding':'4px 16px','--alert-container-gap':'8px','--alert-main-flex-direction':'row','--alert-main-gap-horizontal':'12px','--alert-main-gap-vertical':'0px','--alert-discard-button-padding':'8px 8px 8px 0px','--alert-content-padding':'7px 0px','--alert-content-align-items':'center','--alert-content-gap':'6px'}};const SIZES_VERTICAL={m:{'--alert-root-width':'368px','--alert-root-max-width':'none','--alert-root-min-width':'auto','--alert-root-border-radius':'12px','--alert-root-min-height':'48px','--alert-container-padding':'16px 20px','--alert-container-gap':'12px','--alert-main-flex-direction':'column','--alert-main-gap-horizontal':'0px','--alert-main-gap-vertical':'12px','--alert-discard-button-padding':'12px 12px 12px 0px','--alert-content-padding':'3px 0px','--alert-content-align-items':'start','--alert-content-gap':'8px'},s:{'--alert-root-width':'fit-content','--alert-root-max-width':'100%','--alert-root-min-width':'280px','--alert-root-border-radius':'12px','--alert-root-min-height':'40px','--alert-container-padding':'12px 16px','--alert-container-gap':'8px','--alert-main-flex-direction':'column','--alert-main-gap-horizontal':'0px','--alert-main-gap-vertical':'10px','--alert-discard-button-padding':'10px 10px 10px 0px','--alert-content-padding':'2px 0px','--alert-content-align-items':'start','--alert-content-gap':'6px'}};const SIZES_TEXT={m:{fontSize:16},s:{fontSize:14}};const SIZES_ICON={m:{fontSize:24},s:{fontSize:20}};const SIZES_ALERT_TIMER={m:SIZES$1.m,s:SIZES$1.s};const SIZES_DISCARD_BUTTON={m:SIZES_BASE.xl,s:SIZES_BASE.m};const SIZES_ALERT_BUTTON={m:SIZES.s,s:SIZES.xs};const SIZES_ALERT_BUTTON_ICON={m:{fontSize:20},s:{fontSize:20}};const SIZES_ALERT_BUTTON_TEXT={m:{fontSize:16},s:{fontSize:14}};export{SIZES_ALERT_BUTTON,SIZES_ALERT_BUTTON_ICON,SIZES_ALERT_BUTTON_TEXT,SIZES_ALERT_TIMER,SIZES_DISCARD_BUTTON,SIZES_HORIZONTAL,SIZES_ICON,SIZES_TEXT,SIZES_VERTICAL};
2
+ //# sourceMappingURL=sizes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.mjs","sources":["../../../../src/components/Alert/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { SIZES_BASE as SIZES_ICON_BUTTON } from 'components/IconButton'\nimport { SIZES as SIZES_TIMER } from 'components/Timer'\nimport { SIZES as SIZES_BUTTON } from 'components/Button'\nimport type { Size } from './types'\n\nexport const SIZES_HORIZONTAL: Record<Size, CSSProperties> = {\n m: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '704px',\n '--alert-root-min-width': '224px',\n '--alert-root-border-radius': '24px',\n '--alert-root-min-height': '48px',\n '--alert-container-padding': '4px 20px',\n '--alert-container-gap': '12px',\n '--alert-main-flex-direction': 'row',\n '--alert-main-gap-horizontal': '16px',\n '--alert-main-gap-vertical': '0px',\n '--alert-discard-button-padding': '8px 8px 8px 0px',\n '--alert-content-padding': '10px 0px',\n '--alert-content-align-items': 'center',\n '--alert-content-gap': '8px',\n },\n s: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '512px',\n '--alert-root-min-width': '192px',\n '--alert-root-border-radius': '20px',\n '--alert-root-min-height': '40px',\n '--alert-container-padding': '4px 16px',\n '--alert-container-gap': '8px',\n '--alert-main-flex-direction': 'row',\n '--alert-main-gap-horizontal': '12px',\n '--alert-main-gap-vertical': '0px',\n '--alert-discard-button-padding': '8px 8px 8px 0px',\n '--alert-content-padding': '7px 0px',\n '--alert-content-align-items': 'center',\n '--alert-content-gap': '6px',\n },\n}\n\nexport const SIZES_VERTICAL: Record<Size, CSSProperties> = {\n m: {\n '--alert-root-width': '368px',\n '--alert-root-max-width': 'none',\n '--alert-root-min-width': 'auto',\n '--alert-root-border-radius': '12px',\n '--alert-root-min-height': '48px',\n '--alert-container-padding': '16px 20px',\n '--alert-container-gap': '12px',\n '--alert-main-flex-direction': 'column',\n '--alert-main-gap-horizontal': '0px',\n '--alert-main-gap-vertical': '12px',\n '--alert-discard-button-padding': '12px 12px 12px 0px',\n '--alert-content-padding': '3px 0px',\n '--alert-content-align-items': 'start',\n '--alert-content-gap': '8px',\n },\n s: {\n '--alert-root-width': 'fit-content',\n '--alert-root-max-width': '100%',\n '--alert-root-min-width': '280px',\n '--alert-root-border-radius': '12px',\n '--alert-root-min-height': '40px',\n '--alert-container-padding': '12px 16px',\n '--alert-container-gap': '8px',\n '--alert-main-flex-direction': 'column',\n '--alert-main-gap-horizontal': '0px',\n '--alert-main-gap-vertical': '10px',\n '--alert-discard-button-padding': '10px 10px 10px 0px',\n '--alert-content-padding': '2px 0px',\n '--alert-content-align-items': 'start',\n '--alert-content-gap': '6px',\n },\n}\n\nexport const SIZES_TEXT: Record<Size, CSSProperties> = {\n m: { fontSize: 16 },\n s: { fontSize: 14 },\n}\n\nexport const SIZES_ICON: Record<Size, CSSProperties> = {\n m: { fontSize: 24 },\n s: { fontSize: 20 },\n}\n\nexport const SIZES_ALERT_TIMER: Record<Size, CSSProperties> = {\n m: SIZES_TIMER.m,\n s: SIZES_TIMER.s,\n}\n\nexport const SIZES_DISCARD_BUTTON: Record<Size, CSSProperties> = {\n m: SIZES_ICON_BUTTON.xl,\n s: SIZES_ICON_BUTTON.m,\n}\n\nexport const SIZES_ALERT_BUTTON: Record<Size, CSSProperties> = {\n m: SIZES_BUTTON.s,\n s: SIZES_BUTTON.xs,\n}\n\nexport const SIZES_ALERT_BUTTON_ICON: Record<Size, CSSProperties> = {\n m: { fontSize: 20 },\n s: { fontSize: 20 },\n}\n\nexport const SIZES_ALERT_BUTTON_TEXT: Record<Size, CSSProperties> = {\n m: { fontSize: 16 },\n s: { fontSize: 14 },\n}\n"],"names":["SIZES_HORIZONTAL","m","s","SIZES_VERTICAL","SIZES_TEXT","fontSize","SIZES_ICON","SIZES_ALERT_TIMER","SIZES_TIMER","SIZES_DISCARD_BUTTON","SIZES_ICON_BUTTON","xl","SIZES_ALERT_BUTTON","SIZES_BUTTON","xs","SIZES_ALERT_BUTTON_ICON","SIZES_ALERT_BUTTON_TEXT"],"mappings":"qKAMO,MAAMA,iBAAgD,CAC3DC,EAAG,CACD,qBAAsB,cACtB,yBAA0B,QAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,WAC7B,wBAAyB,OACzB,8BAA+B,MAC/B,8BAA+B,OAC/B,4BAA6B,MAC7B,iCAAkC,kBAClC,0BAA2B,WAC3B,8BAA+B,SAC/B,sBAAuB,OAEzBC,EAAG,CACD,qBAAsB,cACtB,yBAA0B,QAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,WAC7B,wBAAyB,MACzB,8BAA+B,MAC/B,8BAA+B,OAC/B,4BAA6B,MAC7B,iCAAkC,kBAClC,0BAA2B,UAC3B,8BAA+B,SAC/B,sBAAuB,QAIpB,MAAMC,eAA8C,CACzDF,EAAG,CACD,qBAAsB,QACtB,yBAA0B,OAC1B,yBAA0B,OAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,YAC7B,wBAAyB,OACzB,8BAA+B,SAC/B,8BAA+B,MAC/B,4BAA6B,OAC7B,iCAAkC,qBAClC,0BAA2B,UAC3B,8BAA+B,QAC/B,sBAAuB,OAEzBC,EAAG,CACD,qBAAsB,cACtB,yBAA0B,OAC1B,yBAA0B,QAC1B,6BAA8B,OAC9B,0BAA2B,OAC3B,4BAA6B,YAC7B,wBAAyB,MACzB,8BAA+B,SAC/B,8BAA+B,MAC/B,4BAA6B,OAC7B,iCAAkC,qBAClC,0BAA2B,UAC3B,8BAA+B,QAC/B,sBAAuB,QAIpB,MAAME,WAA0C,CACrDH,EAAG,CAAEI,SAAU,IACfH,EAAG,CAAEG,SAAU,KAGV,MAAMC,WAA0C,CACrDL,EAAG,CAAEI,SAAU,IACfH,EAAG,CAAEG,SAAU,KAGV,MAAME,kBAAiD,CAC5DN,EAAGO,QAAYP,EACfC,EAAGM,QAAYN,GAGV,MAAMO,qBAAoD,CAC/DR,EAAGS,WAAkBC,GACrBT,EAAGQ,WAAkBT,GAGhB,MAAMW,mBAAkD,CAC7DX,EAAGY,MAAaX,EAChBA,EAAGW,MAAaC,IAGX,MAAMC,wBAAuD,CAClEd,EAAG,CAAEI,SAAU,IACfH,EAAG,CAAEG,SAAU,KAGV,MAAMW,wBAAuD,CAClEf,EAAG,CAAEI,SAAU,IACfH,EAAG,CAAEG,SAAU"}
@@ -1,2 +1,2 @@
1
- 'use strict';var styled=require('styled-components');var focus=require('../../mixins/focus.js');var responsiveProperty=require('../../mixins/responsive-property.js');var CountdownCircle=require('./CountdownCircle.js');var Text=require('../Text/Text.js');var Button=require('../Button/Button.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var styled__default=_interopDefault(styled);const getPaddingY=({column:e,isCompact:n,withImage:t,withTimer:o})=>e?'16px':n?o?'5px':'12px':t?'8px':o?'2px':'12px';const getImageSize=({column:e,isCompact:n})=>n?'20px':e?'28px':'32px';const Root=styled__default.default.div.withConfig({shouldForwardProp:e=>['children','className','onMouseEnter','onMouseLeave','style'].includes(e)}).withConfig({displayName:"Alert__Root",componentId:"ui__sc-1v79u95-0"})([""," ",""],e=>`\n display: flex;\n align-items: ${e.column||(e.isCompact?!e.withTimer:e.textWrap)?'flex-start':'center'};\n justify-content: ${e.withTimer?'space-between':'flex-start'};\n padding-top: ${getPaddingY(e)};\n padding-right: ${(({isCompact:e,withCloseIcon:n,withTimer:t})=>n?e?'12px':'16px':t?'8px':'20px')(e)};\n padding-bottom: ${getPaddingY(e)};\n padding-left: ${(({isCompact:e,noIcon:n,size:t,withAction:o,withImage:i,withTitle:r})=>e?r||t==='l'?i||!n?'16px':'20px':i?'12px':o&&n?'20px':'16px':r||t==='l'?i||!n?'16px':'24px':i?'16px':'20px')(e)};\n height: ${e.isCompact||e.column||e.textWrap?'auto':'48px'};\n min-width: ${e.isCompact?'304px':'auto'};\n max-width: ${e.isCompact?'351px':'100%'};\n border-radius: ${e.column?e.isCompact?'20px':'12px':'30px'};\n background-color: ${((e,n,t)=>{if(n)return e.colors['bg-onmain-primary'];switch(t){case'error':return e.colors['alert-bg-error-200'];case'info':return e.colors['bg-brand-primary-200'];case'success':return e.colors['alert-bg-success-200'];case'warning':return e.colors['alert-bg-warning-200'];default:return e.colors['bg-oncolor-primary']}})(e.theme,!!e.clear,e.type)};\n box-shadow: ${e.clear?'0 6px 20px 0 rgba(0, 0, 0, 0.1)':'none'};\n box-sizing: border-box;\n `,responsiveProperty.responsiveProperty('width','width'));const IconWrapper=styled__default.default.div.withConfig({displayName:"Alert__IconWrapper",componentId:"ui__sc-1v79u95-1"})([""," ",";"],e=>`\n display: flex;\n margin-right: ${(({column:e,isCompact:n,withImage:t})=>n?'8px':e?t?'8px':'12px':'8px')(e)};\n `,e=>e.withImage?`\n img,\n svg {\n height: ${getImageSize(e)};\n width: ${getImageSize(e)};\n }\n `:null);const ContentWrapper=styled__default.default.div.withConfig({displayName:"Alert__ContentWrapper",componentId:"ui__sc-1v79u95-2"})(["",""],e=>`\n display: flex;\n margin-right: auto;\n flex-direction: ${e.column?'column':'row'};\n align-items: ${e.column?'flex-start':'center'};\n align-self: center;\n max-width: ${e.column?'260px':'initial'};\n white-space: ${e.column||e.isCompact?'normal':'nowrap'};\n overflow: hidden;\n `);const Title=styled__default.default(Text.Text).withConfig({displayName:"Alert__Title",componentId:"ui__sc-1v79u95-3"})(["",""],e=>`\n display: inline-block;\n margin-top: ${e.isCompact?'0':'2px'};\n margin-bottom: 8px;\n max-width: 100%;\n vertical-align: middle;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-weight: 700;\n overflow: hidden;\n `);const Content=styled__default.default(Text.Text).withConfig({displayName:"Alert__Content",componentId:"ui__sc-1v79u95-4"})(["",""],e=>`\n text-overflow: ${e.column||e.isCompact?'clip':'ellipsis'};\n white-space: ${e.column||e.isCompact||e.textWrap?'pre-wrap':'inherit'};\n overflow: hidden;\n `);const Link=styled__default.default.div.withConfig({displayName:"Alert__Link",componentId:"ui__sc-1v79u95-5"})(["",""],e=>`\n display: flex;\n margin-top: ${e.column?e.isCompact&&!e.withTitle?'4px':'12px':0};\n margin-left: ${e.column?0:'60px'};\n color: ${e.clear?e.theme.colors['content-link']:e.theme.colors['content-onmain-primary']};\n `);const Actions=styled__default.default.div.withConfig({displayName:"Alert__Actions",componentId:"ui__sc-1v79u95-6"})(["",""],e=>`\n margin-top: ${(({column:e,isCompact:n,withTitle:t})=>e?n?t?'16px':'8px':'16px':0)(e)};\n margin-left: ${e.column?0:'60px'};\n `);const CloseIcon=styled__default.default.button.withConfig({displayName:"Alert__CloseIcon",componentId:"ui__sc-1v79u95-7"})([""," ",""],e=>`\n appearance: none;\n display: flex;\n margin-left: ${e.withTimer?'0':'16px'};\n border-radius: 0;\n background: none;\n box-shadow: none;\n padding: 0;\n border: none;\n cursor: pointer;\n border-radius: 50%;\n `,focus.focus);const CancelTimer=styled__default.default(Button.Button).withConfig({displayName:"Alert__CancelTimer",componentId:"ui__sc-1v79u95-8"})(["",""],e=>`\n margin-left: ${e.isCompact?'28px':'60px'};\n padding-right: ${e.isCompact?'16px':'28px'};\n padding-left: ${e.isCompact?'16px':'28px'};\n `);const Timer=styled__default.default(CountdownCircle.CountdownCircle).withConfig({displayName:"Alert__Timer",componentId:"ui__sc-1v79u95-9"})(["",""],e=>`\n line-height: ${e.isCompact?'12px':'18px'};\n font-weight: ${e.isCompact?'700':'400'};\n font-size: ${e.isCompact?'11px':'14px'};\n color: ${e.color};\n\n svg {\n transform: rotateY(180deg);\n }\n `);exports.Actions=Actions,exports.CancelTimer=CancelTimer,exports.CloseIcon=CloseIcon,exports.Content=Content,exports.ContentWrapper=ContentWrapper,exports.IconWrapper=IconWrapper,exports.Link=Link,exports.Root=Root,exports.Timer=Timer,exports.Title=Title;
1
+ 'use strict';var styled=require('styled-components');var style=require('../../shared/utils/style.js');function _interopDefault(t){return t&&t.__esModule?t:{default:t}}var styled__default=_interopDefault(styled);const shouldForwardAlertProp=style.createShouldForwardProp(t=>!['layout','layoutXXS','layoutXS','layoutS','layoutM','layoutL','layoutXL','layouts'].includes(t),t=>!['type','clear'].includes(t));const template=t=>`\n color: ${t.color};\n background-color: ${t.backgroundColor};\n box-shadow: 0 6px 20px 0 ${t.shadowColor};\n`;const COLOR_SCHEMA={info:styled.css(["",""],t=>template({color:t.theme.colors['content-onmain-primary'],backgroundColor:t.clear?t.theme.colors['bg-other-surface']:t.theme.colors['bg-brand-primary-200'],shadowColor:t.clear?t.theme.colors['effect-shadow-medium']:'transparent',...t.palette})),success:styled.css(["",""],t=>template({color:t.theme.colors['content-onmain-primary'],backgroundColor:t.clear?t.theme.colors['bg-other-surface']:t.theme.colors['alert-bg-success-200'],shadowColor:t.clear?t.theme.colors['effect-shadow-medium']:'transparent',...t.palette})),warning:styled.css(["",""],t=>template({color:t.theme.colors['content-onmain-primary'],backgroundColor:t.clear?t.theme.colors['bg-other-surface']:t.theme.colors['alert-bg-warning-200'],shadowColor:t.clear?t.theme.colors['effect-shadow-medium']:'transparent',...t.palette})),error:styled.css(["",""],t=>template({color:t.theme.colors['content-onmain-primary'],backgroundColor:t.clear?t.theme.colors['bg-other-surface']:t.theme.colors['alert-bg-error-200'],shadowColor:t.clear?t.theme.colors['effect-shadow-medium']:'transparent',...t.palette}))};const Root=styled__default.default.div.withConfig({shouldForwardProp:shouldForwardAlertProp}).withConfig({displayName:"Alert__Root",componentId:"ui__sc-1v79u95-0"})(["box-sizing:border-box;display:flex;width:var(--alert-root-width);max-width:var(--alert-root-max-width);min-width:var(--alert-root-min-width);border-radius:var(--alert-root-border-radius);min-height:var(--alert-root-min-height);margin:var(--alert-margin);",""],t=>COLOR_SCHEMA[t.type]);const Container=styled__default.default.div.withConfig({displayName:"Alert__Container",componentId:"ui__sc-1v79u95-1"})(["box-sizing:border-box;display:flex;flex-grow:1;align-items:var(--alert-content-align-items);padding:var(--alert-container-padding);& > *:not(:last-child){margin-right:var(--alert-container-gap);}"]);const Main=styled__default.default.div.withConfig({displayName:"Alert__Main",componentId:"ui__sc-1v79u95-2"})(["box-sizing:border-box;flex-grow:1;display:flex;flex-direction:var(--alert-main-flex-direction);align-items:var(--alert-content-align-items);& > *:not(:last-child){margin-right:var(--alert-main-gap-horizontal);margin-bottom:var(--alert-main-gap-vertical);}"]);const Content=styled__default.default.div.withConfig({displayName:"Alert__Content",componentId:"ui__sc-1v79u95-3"})(["box-sizing:border-box;flex-grow:1;padding:var(--alert-content-padding);& > *:not(:last-child){margin-bottom:var(--alert-content-gap);}"]);const Addon=styled__default.default.div.withConfig({displayName:"Alert__Addon",componentId:"ui__sc-1v79u95-4"})(["box-sizing:border-box;display:flex;"]);const DiscardButton=styled__default.default.div.withConfig({displayName:"Alert__DiscardButton",componentId:"ui__sc-1v79u95-5"})(["box-sizing:border-box;flex-shrink:0;display:flex;align-items:var(--alert-content-align-items);padding:var(--alert-discard-button-padding);"]);exports.Addon=Addon,exports.Container=Container,exports.Content=Content,exports.DiscardButton=DiscardButton,exports.Main=Main,exports.Root=Root;
2
2
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sources":["../../../../src/components/Alert/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport type { DefaultTheme } from 'styled-components'\nimport { focus } from 'mixins/focus'\n\nimport { responsiveProperty } from 'mixins/responsive-property'\n\nimport { Button } from '../Button'\nimport { Text } from '../Text'\n\nimport { CountdownCircle } from './CountdownCircle'\n\nimport type {\n ActionsProps,\n AlertType,\n CancelTimerProps,\n CloseIconProps,\n ContentProps,\n ContentWrapperProps,\n CountdownCircleProps,\n IconWrapperProps,\n LinkProps,\n RootAlertProps,\n TitleProps,\n} from './types'\n\nconst bgColor = (theme: DefaultTheme, clear: boolean, type?: AlertType) => {\n if (clear) {\n return theme.colors['bg-onmain-primary']\n }\n\n switch (type) {\n case 'error':\n return theme.colors['alert-bg-error-200']\n case 'info':\n return theme.colors['bg-brand-primary-200']\n case 'success':\n return theme.colors['alert-bg-success-200']\n case 'warning':\n return theme.colors['alert-bg-warning-200']\n default:\n return theme.colors['bg-oncolor-primary']\n }\n}\n\nconst getPaddingY = ({\n column,\n isCompact,\n withImage,\n withTimer,\n}: Pick<RootAlertProps, 'column' | 'isCompact' | 'withImage' | 'withTimer'>) => {\n if (column) return '16px'\n\n if (isCompact) {\n return withTimer ? '5px' : '12px'\n }\n\n return withImage ? '8px' : withTimer ? '2px' : '12px'\n}\n\nconst paddingLeft = ({\n isCompact,\n noIcon,\n size,\n withAction,\n withImage,\n withTitle,\n}: Pick<RootAlertProps, 'isCompact' | 'noIcon' | 'size' | 'withAction' | 'withImage' | 'withTitle'>) => {\n if (isCompact) {\n if (withTitle || size === 'l') {\n return withImage || !noIcon ? '16px' : '20px'\n }\n\n return withImage ? '12px' : withAction && noIcon ? '20px' : '16px'\n }\n\n if (withTitle || size === 'l') {\n return withImage || !noIcon ? '16px' : '24px'\n }\n\n return withImage ? '16px' : '20px'\n}\n\nconst paddingRight = ({\n isCompact,\n withCloseIcon,\n withTimer,\n}: Pick<RootAlertProps, 'isCompact' | 'withCloseIcon' | 'withTimer'>) => {\n if (withCloseIcon) {\n return isCompact ? '12px' : '16px'\n }\n\n return withTimer ? '8px' : '20px'\n}\n\nconst getMarginRightIconWrapper = ({\n column,\n isCompact,\n withImage,\n}: {\n column: boolean\n isCompact?: boolean\n withImage: boolean\n}) => {\n if (isCompact) return '8px'\n\n return column ? (withImage ? '8px' : '12px') : '8px'\n}\n\nconst getImageSize = ({ column, isCompact }: { column: boolean; isCompact?: boolean }) => {\n if (isCompact) return '20px'\n\n return column ? '28px' : '32px'\n}\n\nconst getActionsMarginTop = ({\n column,\n isCompact,\n withTitle,\n}: {\n column: boolean\n isCompact?: boolean\n withTitle: boolean\n}) => {\n if (column) {\n return isCompact ? (withTitle ? '16px' : '8px') : '16px'\n }\n\n return 0\n}\n\nexport const Root = styled.div.withConfig<RootAlertProps>({\n shouldForwardProp: (prop) => ['children', 'className', 'onMouseEnter', 'onMouseLeave', 'style'].includes(prop),\n})`\n ${(props) => `\n display: flex;\n align-items: ${props.column || (props.isCompact ? !props.withTimer : props.textWrap) ? 'flex-start' : 'center'};\n justify-content: ${props.withTimer ? 'space-between' : 'flex-start'};\n padding-top: ${getPaddingY(props)};\n padding-right: ${paddingRight(props)};\n padding-bottom: ${getPaddingY(props)};\n padding-left: ${paddingLeft(props)};\n height: ${props.isCompact || props.column || props.textWrap ? 'auto' : '48px'};\n min-width: ${props.isCompact ? '304px' : 'auto'};\n max-width: ${props.isCompact ? '351px' : '100%'};\n border-radius: ${props.column ? (props.isCompact ? '20px' : '12px') : '30px'};\n background-color: ${bgColor(props.theme, !!props.clear, props.type)};\n box-shadow: ${props.clear ? '0 6px 20px 0 rgba(0, 0, 0, 0.1)' : 'none'};\n box-sizing: border-box;\n `}\n ${responsiveProperty('width', 'width')}\n`\n\nexport const IconWrapper = styled.div<IconWrapperProps>`\n ${(props) => `\n display: flex;\n margin-right: ${getMarginRightIconWrapper(props)};\n `}\n\n ${(props) =>\n props.withImage\n ? `\n img,\n svg {\n height: ${getImageSize(props)};\n width: ${getImageSize(props)};\n }\n `\n : null};\n`\n\nexport const ContentWrapper = styled.div<ContentWrapperProps>`\n ${(props) => `\n display: flex;\n margin-right: auto;\n flex-direction: ${props.column ? 'column' : 'row'};\n align-items: ${props.column ? 'flex-start' : 'center'};\n align-self: center;\n max-width: ${props.column ? '260px' : 'initial'};\n white-space: ${props.column || props.isCompact ? 'normal' : 'nowrap'};\n overflow: hidden;\n `}\n`\n\nexport const Title = styled(Text)<TitleProps>`\n ${(props) => `\n display: inline-block;\n margin-top: ${props.isCompact ? '0' : '2px'};\n margin-bottom: 8px;\n max-width: 100%;\n vertical-align: middle;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-weight: 700;\n overflow: hidden;\n `}\n`\n\nexport const Content = styled(Text)<ContentProps>`\n ${(props) => `\n text-overflow: ${props.column || props.isCompact ? 'clip' : 'ellipsis'};\n white-space: ${props.column || props.isCompact || props.textWrap ? 'pre-wrap' : 'inherit'};\n overflow: hidden;\n `}\n`\n\nexport const Link = styled.div<LinkProps>`\n ${(props) => `\n display: flex;\n margin-top: ${props.column ? (props.isCompact && !props.withTitle ? '4px' : '12px') : 0};\n margin-left: ${props.column ? 0 : '60px'};\n color: ${props.clear ? props.theme.colors['content-link'] : props.theme.colors['content-onmain-primary']};\n `}\n`\n\nexport const Actions = styled.div<ActionsProps>`\n ${(props) => `\n margin-top: ${getActionsMarginTop(props)};\n margin-left: ${props.column ? 0 : '60px'};\n `}\n`\n\nexport const CloseIcon = styled.button<CloseIconProps>`\n ${(props) => `\n appearance: none;\n display: flex;\n margin-left: ${props.withTimer ? '0' : '16px'};\n border-radius: 0;\n background: none;\n box-shadow: none;\n padding: 0;\n border: none;\n cursor: pointer;\n border-radius: 50%;\n `}\n ${focus}\n`\n\nexport const CancelTimer = styled(Button)<CancelTimerProps>`\n ${(props) => `\n margin-left: ${props.isCompact ? '28px' : '60px'};\n padding-right: ${props.isCompact ? '16px' : '28px'};\n padding-left: ${props.isCompact ? '16px' : '28px'};\n `}\n`\n\nexport const Timer = styled(CountdownCircle)<CountdownCircleProps>`\n ${(props) => `\n line-height: ${props.isCompact ? '12px' : '18px'};\n font-weight: ${props.isCompact ? '700' : '400'};\n font-size: ${props.isCompact ? '11px' : '14px'};\n color: ${props.color};\n\n svg {\n transform: rotateY(180deg);\n }\n `}\n`\n"],"names":["getPaddingY","column","isCompact","withImage","withTimer","getImageSize","Root","styled","div","withConfig","shouldForwardProp","prop","includes","displayName","componentId","props","textWrap","paddingRight","withCloseIcon","paddingLeft","noIcon","size","withAction","withTitle","bgColor","theme","clear","type","colors","responsiveProperty","IconWrapper","getMarginRightIconWrapper","ContentWrapper","Title","Text","Content","Link","Actions","getActionsMarginTop","CloseIcon","button","focus","CancelTimer","Button","Timer","CountdownCircle","color"],"mappings":"qZA4CA,MAAMA,YAAcA,EAClBC,SACAC,YACAC,YACAC,eAEIH,EAAe,OAEfC,EACKE,EAAY,MAAQ,OAGtBD,EAAY,MAAQC,EAAY,MAAQ,OAoDjD,MAAMC,aAAeA,EAAGJ,SAAQC,eAC1BA,EAAkB,OAEfD,EAAS,OAAS,OAmBpB,MAAMK,KAAOC,gBAAAA,QAAOC,IAAIC,WAA2B,CACxDC,kBAAoBC,GAAS,CAAC,WAAY,YAAa,eAAgB,eAAgB,SAASC,SAASD,KACzGF,WAAA,CAAAI,YAAA,cAAAC,YAAA,oBAFkBP,CAElB,CAAA,GAAA,IAAA,IACGQ,GAAU,0CAEIA,EAAMd,SAAWc,EAAMb,WAAaa,EAAMX,UAAYW,EAAMC,UAAY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oBAAbP,CAAa,CAAA,GAAA,IAAA,IACjCQ,GAAU,iEAGIA,EAAMX,UAAY,IAAM,sKASvCqC,MAAAA,OAGG,MAAMC,YAAcnC,gBAAAA,QAAOoC,eAAOlC,WAAA,CAAAI,YAAA,qBAAAC,YAAA,oBAAdP,CAAc,CAAA,GAAA,IACpCQ,GAAU,sBACIA,EAAMb,UAAY,OAAS,+BACzBa,EAAMb,UAAY,OAAS,8BAC5Ba,EAAMb,UAAY,OAAS,eAIxC,MAAM0C,MAAQrC,gBAAAA,QAAOsC,iCAAgBpC,WAAA,CAAAI,YAAA,eAAAC,YAAA,oBAAvBP,CAAuB,CAAA,GAAA,IACvCQ,GAAU,sBACIA,EAAMb,UAAY,OAAS,6BAC3Ba,EAAMb,UAAY,MAAQ,0BAC5Ba,EAAMb,UAAY,OAAS,uBAC/Ba,EAAM+B"}
1
+ {"version":3,"file":"style.js","sources":["../../../../src/components/Alert/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { FlattenInterpolation, ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { AlertType, StyledAlertProps, AlertPalette } from './types'\n\nconst filterLayoutProps = (propKey: string) =>\n !['layout', 'layoutXXS', 'layoutXS', 'layoutS', 'layoutM', 'layoutL', 'layoutXL', 'layouts'].includes(propKey)\n\nconst shouldForwardAlertProp = createShouldForwardProp(\n filterLayoutProps,\n (propKey: string) => !['type', 'clear'].includes(propKey)\n)\n\nconst template = (palette: AlertPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n box-shadow: 0 6px 20px 0 ${palette.shadowColor};\n`\n\nconst COLOR_SCHEMA: Record<AlertType, FlattenInterpolation<ThemedStyledProps<StyledAlertProps, DefaultTheme>>> = {\n info: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['bg-brand-primary-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n success: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-success-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n warning: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-warning-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n error: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-error-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledAlertProps>({\n shouldForwardProp: shouldForwardAlertProp,\n})`\n box-sizing: border-box;\n display: flex;\n width: var(--alert-root-width);\n max-width: var(--alert-root-max-width);\n min-width: var(--alert-root-min-width);\n border-radius: var(--alert-root-border-radius);\n min-height: var(--alert-root-min-height);\n margin: var(--alert-margin);\n\n ${(props) => {\n return COLOR_SCHEMA[props.type]\n }}\n`\n\nexport const Container = styled.div`\n box-sizing: border-box;\n display: flex;\n flex-grow: 1;\n align-items: var(--alert-content-align-items);\n padding: var(--alert-container-padding);\n\n & > *:not(:last-child) {\n margin-right: var(--alert-container-gap);\n }\n`\n\nexport const Main = styled.div`\n box-sizing: border-box;\n flex-grow: 1;\n display: flex;\n flex-direction: var(--alert-main-flex-direction);\n align-items: var(--alert-content-align-items);\n\n & > *:not(:last-child) {\n margin-right: var(--alert-main-gap-horizontal);\n margin-bottom: var(--alert-main-gap-vertical);\n }\n`\n\nexport const Content = styled.div`\n box-sizing: border-box;\n flex-grow: 1;\n padding: var(--alert-content-padding);\n\n & > *:not(:last-child) {\n margin-bottom: var(--alert-content-gap);\n }\n`\n\nexport const Addon = styled.div`\n box-sizing: border-box;\n display: flex;\n`\n\nexport const DiscardButton = styled.div`\n box-sizing: border-box;\n flex-shrink: 0;\n display: flex;\n align-items: var(--alert-content-align-items);\n padding: var(--alert-discard-button-padding);\n`\n"],"names":["shouldForwardAlertProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","shadowColor","COLOR_SCHEMA","info","css","props","theme","colors","clear","success","warning","error","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","type","Container","Main","Content","Addon","DiscardButton"],"mappings":"mNAQA,MAAMA,uBAAyBC,MAAAA,wBAHJC,IACxB,CAAC,SAAU,YAAa,WAAY,UAAW,UAAW,UAAW,WAAY,WAAWC,SAASD,GAIrGA,IAAqB,CAAC,OAAQ,SAASC,SAASD,IAGnD,MAAME,SAAYC,GAA0B,cACjCA,EAAQC,+BACGD,EAAQE,gDACDF,EAAQG,iBAGrC,MAAMC,aAA2G,CAC/GC,KAAMC,OAAAA,IAAG,CAAA,GAAA,IACJC,GACDR,SAAS,CACPE,MAAOM,EAAMC,MAAMC,OAAO,0BAC1BP,gBAAiBK,EAAMG,MACnBH,EAAMC,MAAMC,OAAO,oBACnBF,EAAMC,MAAMC,OAAO,wBACvBN,YAAaI,EAAMG,MAAQH,EAAMC,MAAMC,OAAO,wBAA0B,iBACrEF,EAAMP,WAGfW,QAASL,OAAAA,IAAG,CAAA,GAAA,IACPC,GACDR,SAAS,CACPE,MAAOM,EAAMC,MAAMC,OAAO,0BAC1BP,gBAAiBK,EAAMG,MACnBH,EAAMC,MAAMC,OAAO,oBACnBF,EAAMC,MAAMC,OAAO,wBACvBN,YAAaI,EAAMG,MAAQH,EAAMC,MAAMC,OAAO,wBAA0B,iBACrEF,EAAMP,WAGfY,QAASN,OAAAA,IAAG,CAAA,GAAA,IACPC,GACDR,SAAS,CACPE,MAAOM,EAAMC,MAAMC,OAAO,0BAC1BP,gBAAiBK,EAAMG,MACnBH,EAAMC,MAAMC,OAAO,oBACnBF,EAAMC,MAAMC,OAAO,wBACvBN,YAAaI,EAAMG,MAAQH,EAAMC,MAAMC,OAAO,wBAA0B,iBACrEF,EAAMP,WAGfa,MAAOP,OAAAA,IAAG,CAAA,GAAA,IACLC,GACDR,SAAS,CACPE,MAAOM,EAAMC,MAAMC,OAAO,0BAC1BP,gBAAiBK,EAAMG,MACnBH,EAAMC,MAAMC,OAAO,oBACnBF,EAAMC,MAAMC,OAAO,sBACvBN,YAAaI,EAAMG,MAAQH,EAAMC,MAAMC,OAAO,wBAA0B,iBACrEF,EAAMP,YAKV,MAAMc,KAAOC,gBAAAA,QAAOC,IAAIC,WAA6B,CAC1DC,kBAAmBvB,yBACnBsB,WAAA,CAAAE,YAAA,cAAAC,YAAA,oBAFkBL,CAElB,CAAA,iQAAA,IAUGR,GACMH,aAAaG,EAAMc,aAIjBC,UAAYP,gBAAAA,QAAOC,IAAGC,WAAA,CAAAE,YAAA,mBAAAC,YAAA,oBAAVL,CAAU,CAAA,8MAYtBQ,KAAOR,gBAAAA,QAAOC,IAAGC,WAAA,CAAAE,YAAA,cAAAC,YAAA,oBAAVL,CAAU,CAAA,0QAajBS,QAAUT,gBAAAA,QAAOC,IAAGC,WAAA,CAAAE,YAAA,iBAAAC,YAAA,oBAAVL,CAAU,CAAA,iJAUpBU,MAAQV,gBAAAA,QAAOC,IAAGC,WAAA,CAAAE,YAAA,eAAAC,YAAA,oBAAVL,CAAU,CAAA,8CAKlBW,cAAgBX,gBAAAA,QAAOC,IAAGC,WAAA,CAAAE,YAAA,uBAAAC,YAAA,oBAAVL,CAAU,CAAA"}
@@ -1,2 +1,2 @@
1
- import styled from'styled-components';import{focus}from'../../mixins/focus.mjs';import{responsiveProperty}from'../../mixins/responsive-property.mjs';import{CountdownCircle}from'./CountdownCircle.mjs';import{Text}from'../Text/Text.mjs';import{Button}from'../Button/Button.mjs';const getPaddingY=({column:n,isCompact:t,withImage:o,withTimer:e})=>n?'16px':t?e?'5px':'12px':o?'8px':e?'2px':'12px';const getImageSize=({column:n,isCompact:t})=>t?'20px':n?'28px':'32px';const Root=styled.div.withConfig({shouldForwardProp:n=>['children','className','onMouseEnter','onMouseLeave','style'].includes(n)}).withConfig({displayName:"Alert__Root",componentId:"ui__sc-1v79u95-0"})([""," ",""],n=>`\n display: flex;\n align-items: ${n.column||(n.isCompact?!n.withTimer:n.textWrap)?'flex-start':'center'};\n justify-content: ${n.withTimer?'space-between':'flex-start'};\n padding-top: ${getPaddingY(n)};\n padding-right: ${(({isCompact:n,withCloseIcon:t,withTimer:o})=>t?n?'12px':'16px':o?'8px':'20px')(n)};\n padding-bottom: ${getPaddingY(n)};\n padding-left: ${(({isCompact:n,noIcon:t,size:o,withAction:e,withImage:i,withTitle:r})=>n?r||o==='l'?i||!t?'16px':'20px':i?'12px':e&&t?'20px':'16px':r||o==='l'?i||!t?'16px':'24px':i?'16px':'20px')(n)};\n height: ${n.isCompact||n.column||n.textWrap?'auto':'48px'};\n min-width: ${n.isCompact?'304px':'auto'};\n max-width: ${n.isCompact?'351px':'100%'};\n border-radius: ${n.column?n.isCompact?'20px':'12px':'30px'};\n background-color: ${((n,t,o)=>{if(t)return n.colors['bg-onmain-primary'];switch(o){case'error':return n.colors['alert-bg-error-200'];case'info':return n.colors['bg-brand-primary-200'];case'success':return n.colors['alert-bg-success-200'];case'warning':return n.colors['alert-bg-warning-200'];default:return n.colors['bg-oncolor-primary']}})(n.theme,!!n.clear,n.type)};\n box-shadow: ${n.clear?'0 6px 20px 0 rgba(0, 0, 0, 0.1)':'none'};\n box-sizing: border-box;\n `,responsiveProperty('width','width'));const IconWrapper=styled.div.withConfig({displayName:"Alert__IconWrapper",componentId:"ui__sc-1v79u95-1"})([""," ",";"],n=>`\n display: flex;\n margin-right: ${(({column:n,isCompact:t,withImage:o})=>t?'8px':n?o?'8px':'12px':'8px')(n)};\n `,n=>n.withImage?`\n img,\n svg {\n height: ${getImageSize(n)};\n width: ${getImageSize(n)};\n }\n `:null);const ContentWrapper=styled.div.withConfig({displayName:"Alert__ContentWrapper",componentId:"ui__sc-1v79u95-2"})(["",""],n=>`\n display: flex;\n margin-right: auto;\n flex-direction: ${n.column?'column':'row'};\n align-items: ${n.column?'flex-start':'center'};\n align-self: center;\n max-width: ${n.column?'260px':'initial'};\n white-space: ${n.column||n.isCompact?'normal':'nowrap'};\n overflow: hidden;\n `);const Title=styled(Text).withConfig({displayName:"Alert__Title",componentId:"ui__sc-1v79u95-3"})(["",""],n=>`\n display: inline-block;\n margin-top: ${n.isCompact?'0':'2px'};\n margin-bottom: 8px;\n max-width: 100%;\n vertical-align: middle;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-weight: 700;\n overflow: hidden;\n `);const Content=styled(Text).withConfig({displayName:"Alert__Content",componentId:"ui__sc-1v79u95-4"})(["",""],n=>`\n text-overflow: ${n.column||n.isCompact?'clip':'ellipsis'};\n white-space: ${n.column||n.isCompact||n.textWrap?'pre-wrap':'inherit'};\n overflow: hidden;\n `);const Link=styled.div.withConfig({displayName:"Alert__Link",componentId:"ui__sc-1v79u95-5"})(["",""],n=>`\n display: flex;\n margin-top: ${n.column?n.isCompact&&!n.withTitle?'4px':'12px':0};\n margin-left: ${n.column?0:'60px'};\n color: ${n.clear?n.theme.colors['content-link']:n.theme.colors['content-onmain-primary']};\n `);const Actions=styled.div.withConfig({displayName:"Alert__Actions",componentId:"ui__sc-1v79u95-6"})(["",""],n=>`\n margin-top: ${(({column:n,isCompact:t,withTitle:o})=>n?t?o?'16px':'8px':'16px':0)(n)};\n margin-left: ${n.column?0:'60px'};\n `);const CloseIcon=styled.button.withConfig({displayName:"Alert__CloseIcon",componentId:"ui__sc-1v79u95-7"})([""," ",""],n=>`\n appearance: none;\n display: flex;\n margin-left: ${n.withTimer?'0':'16px'};\n border-radius: 0;\n background: none;\n box-shadow: none;\n padding: 0;\n border: none;\n cursor: pointer;\n border-radius: 50%;\n `,focus);const CancelTimer=styled(Button).withConfig({displayName:"Alert__CancelTimer",componentId:"ui__sc-1v79u95-8"})(["",""],n=>`\n margin-left: ${n.isCompact?'28px':'60px'};\n padding-right: ${n.isCompact?'16px':'28px'};\n padding-left: ${n.isCompact?'16px':'28px'};\n `);const Timer=styled(CountdownCircle).withConfig({displayName:"Alert__Timer",componentId:"ui__sc-1v79u95-9"})(["",""],n=>`\n line-height: ${n.isCompact?'12px':'18px'};\n font-weight: ${n.isCompact?'700':'400'};\n font-size: ${n.isCompact?'11px':'14px'};\n color: ${n.color};\n\n svg {\n transform: rotateY(180deg);\n }\n `);export{Actions,CancelTimer,CloseIcon,Content,ContentWrapper,IconWrapper,Link,Root,Timer,Title};
1
+ import styled,{css}from'styled-components';import{createShouldForwardProp}from'../../shared/utils/style.mjs';const shouldForwardAlertProp=createShouldForwardProp(o=>!['layout','layoutXXS','layoutXS','layoutS','layoutM','layoutL','layoutXL','layouts'].includes(o),o=>!['type','clear'].includes(o));const template=o=>`\n color: ${o.color};\n background-color: ${o.backgroundColor};\n box-shadow: 0 6px 20px 0 ${o.shadowColor};\n`;const COLOR_SCHEMA={info:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.clear?o.theme.colors['bg-other-surface']:o.theme.colors['bg-brand-primary-200'],shadowColor:o.clear?o.theme.colors['effect-shadow-medium']:'transparent',...o.palette})),success:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.clear?o.theme.colors['bg-other-surface']:o.theme.colors['alert-bg-success-200'],shadowColor:o.clear?o.theme.colors['effect-shadow-medium']:'transparent',...o.palette})),warning:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.clear?o.theme.colors['bg-other-surface']:o.theme.colors['alert-bg-warning-200'],shadowColor:o.clear?o.theme.colors['effect-shadow-medium']:'transparent',...o.palette})),error:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.clear?o.theme.colors['bg-other-surface']:o.theme.colors['alert-bg-error-200'],shadowColor:o.clear?o.theme.colors['effect-shadow-medium']:'transparent',...o.palette}))};const Root=styled.div.withConfig({shouldForwardProp:shouldForwardAlertProp}).withConfig({displayName:"Alert__Root",componentId:"ui__sc-1v79u95-0"})(["box-sizing:border-box;display:flex;width:var(--alert-root-width);max-width:var(--alert-root-max-width);min-width:var(--alert-root-min-width);border-radius:var(--alert-root-border-radius);min-height:var(--alert-root-min-height);margin:var(--alert-margin);",""],o=>COLOR_SCHEMA[o.type]);const Container=styled.div.withConfig({displayName:"Alert__Container",componentId:"ui__sc-1v79u95-1"})(["box-sizing:border-box;display:flex;flex-grow:1;align-items:var(--alert-content-align-items);padding:var(--alert-container-padding);& > *:not(:last-child){margin-right:var(--alert-container-gap);}"]);const Main=styled.div.withConfig({displayName:"Alert__Main",componentId:"ui__sc-1v79u95-2"})(["box-sizing:border-box;flex-grow:1;display:flex;flex-direction:var(--alert-main-flex-direction);align-items:var(--alert-content-align-items);& > *:not(:last-child){margin-right:var(--alert-main-gap-horizontal);margin-bottom:var(--alert-main-gap-vertical);}"]);const Content=styled.div.withConfig({displayName:"Alert__Content",componentId:"ui__sc-1v79u95-3"})(["box-sizing:border-box;flex-grow:1;padding:var(--alert-content-padding);& > *:not(:last-child){margin-bottom:var(--alert-content-gap);}"]);const Addon=styled.div.withConfig({displayName:"Alert__Addon",componentId:"ui__sc-1v79u95-4"})(["box-sizing:border-box;display:flex;"]);const DiscardButton=styled.div.withConfig({displayName:"Alert__DiscardButton",componentId:"ui__sc-1v79u95-5"})(["box-sizing:border-box;flex-shrink:0;display:flex;align-items:var(--alert-content-align-items);padding:var(--alert-discard-button-padding);"]);export{Addon,Container,Content,DiscardButton,Main,Root};
2
2
  //# sourceMappingURL=style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","sources":["../../../../src/components/Alert/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport type { DefaultTheme } from 'styled-components'\nimport { focus } from 'mixins/focus'\n\nimport { responsiveProperty } from 'mixins/responsive-property'\n\nimport { Button } from '../Button'\nimport { Text } from '../Text'\n\nimport { CountdownCircle } from './CountdownCircle'\n\nimport type {\n ActionsProps,\n AlertType,\n CancelTimerProps,\n CloseIconProps,\n ContentProps,\n ContentWrapperProps,\n CountdownCircleProps,\n IconWrapperProps,\n LinkProps,\n RootAlertProps,\n TitleProps,\n} from './types'\n\nconst bgColor = (theme: DefaultTheme, clear: boolean, type?: AlertType) => {\n if (clear) {\n return theme.colors['bg-onmain-primary']\n }\n\n switch (type) {\n case 'error':\n return theme.colors['alert-bg-error-200']\n case 'info':\n return theme.colors['bg-brand-primary-200']\n case 'success':\n return theme.colors['alert-bg-success-200']\n case 'warning':\n return theme.colors['alert-bg-warning-200']\n default:\n return theme.colors['bg-oncolor-primary']\n }\n}\n\nconst getPaddingY = ({\n column,\n isCompact,\n withImage,\n withTimer,\n}: Pick<RootAlertProps, 'column' | 'isCompact' | 'withImage' | 'withTimer'>) => {\n if (column) return '16px'\n\n if (isCompact) {\n return withTimer ? '5px' : '12px'\n }\n\n return withImage ? '8px' : withTimer ? '2px' : '12px'\n}\n\nconst paddingLeft = ({\n isCompact,\n noIcon,\n size,\n withAction,\n withImage,\n withTitle,\n}: Pick<RootAlertProps, 'isCompact' | 'noIcon' | 'size' | 'withAction' | 'withImage' | 'withTitle'>) => {\n if (isCompact) {\n if (withTitle || size === 'l') {\n return withImage || !noIcon ? '16px' : '20px'\n }\n\n return withImage ? '12px' : withAction && noIcon ? '20px' : '16px'\n }\n\n if (withTitle || size === 'l') {\n return withImage || !noIcon ? '16px' : '24px'\n }\n\n return withImage ? '16px' : '20px'\n}\n\nconst paddingRight = ({\n isCompact,\n withCloseIcon,\n withTimer,\n}: Pick<RootAlertProps, 'isCompact' | 'withCloseIcon' | 'withTimer'>) => {\n if (withCloseIcon) {\n return isCompact ? '12px' : '16px'\n }\n\n return withTimer ? '8px' : '20px'\n}\n\nconst getMarginRightIconWrapper = ({\n column,\n isCompact,\n withImage,\n}: {\n column: boolean\n isCompact?: boolean\n withImage: boolean\n}) => {\n if (isCompact) return '8px'\n\n return column ? (withImage ? '8px' : '12px') : '8px'\n}\n\nconst getImageSize = ({ column, isCompact }: { column: boolean; isCompact?: boolean }) => {\n if (isCompact) return '20px'\n\n return column ? '28px' : '32px'\n}\n\nconst getActionsMarginTop = ({\n column,\n isCompact,\n withTitle,\n}: {\n column: boolean\n isCompact?: boolean\n withTitle: boolean\n}) => {\n if (column) {\n return isCompact ? (withTitle ? '16px' : '8px') : '16px'\n }\n\n return 0\n}\n\nexport const Root = styled.div.withConfig<RootAlertProps>({\n shouldForwardProp: (prop) => ['children', 'className', 'onMouseEnter', 'onMouseLeave', 'style'].includes(prop),\n})`\n ${(props) => `\n display: flex;\n align-items: ${props.column || (props.isCompact ? !props.withTimer : props.textWrap) ? 'flex-start' : 'center'};\n justify-content: ${props.withTimer ? 'space-between' : 'flex-start'};\n padding-top: ${getPaddingY(props)};\n padding-right: ${paddingRight(props)};\n padding-bottom: ${getPaddingY(props)};\n padding-left: ${paddingLeft(props)};\n height: ${props.isCompact || props.column || props.textWrap ? 'auto' : '48px'};\n min-width: ${props.isCompact ? '304px' : 'auto'};\n max-width: ${props.isCompact ? '351px' : '100%'};\n border-radius: ${props.column ? (props.isCompact ? '20px' : '12px') : '30px'};\n background-color: ${bgColor(props.theme, !!props.clear, props.type)};\n box-shadow: ${props.clear ? '0 6px 20px 0 rgba(0, 0, 0, 0.1)' : 'none'};\n box-sizing: border-box;\n `}\n ${responsiveProperty('width', 'width')}\n`\n\nexport const IconWrapper = styled.div<IconWrapperProps>`\n ${(props) => `\n display: flex;\n margin-right: ${getMarginRightIconWrapper(props)};\n `}\n\n ${(props) =>\n props.withImage\n ? `\n img,\n svg {\n height: ${getImageSize(props)};\n width: ${getImageSize(props)};\n }\n `\n : null};\n`\n\nexport const ContentWrapper = styled.div<ContentWrapperProps>`\n ${(props) => `\n display: flex;\n margin-right: auto;\n flex-direction: ${props.column ? 'column' : 'row'};\n align-items: ${props.column ? 'flex-start' : 'center'};\n align-self: center;\n max-width: ${props.column ? '260px' : 'initial'};\n white-space: ${props.column || props.isCompact ? 'normal' : 'nowrap'};\n overflow: hidden;\n `}\n`\n\nexport const Title = styled(Text)<TitleProps>`\n ${(props) => `\n display: inline-block;\n margin-top: ${props.isCompact ? '0' : '2px'};\n margin-bottom: 8px;\n max-width: 100%;\n vertical-align: middle;\n white-space: nowrap;\n text-overflow: ellipsis;\n font-weight: 700;\n overflow: hidden;\n `}\n`\n\nexport const Content = styled(Text)<ContentProps>`\n ${(props) => `\n text-overflow: ${props.column || props.isCompact ? 'clip' : 'ellipsis'};\n white-space: ${props.column || props.isCompact || props.textWrap ? 'pre-wrap' : 'inherit'};\n overflow: hidden;\n `}\n`\n\nexport const Link = styled.div<LinkProps>`\n ${(props) => `\n display: flex;\n margin-top: ${props.column ? (props.isCompact && !props.withTitle ? '4px' : '12px') : 0};\n margin-left: ${props.column ? 0 : '60px'};\n color: ${props.clear ? props.theme.colors['content-link'] : props.theme.colors['content-onmain-primary']};\n `}\n`\n\nexport const Actions = styled.div<ActionsProps>`\n ${(props) => `\n margin-top: ${getActionsMarginTop(props)};\n margin-left: ${props.column ? 0 : '60px'};\n `}\n`\n\nexport const CloseIcon = styled.button<CloseIconProps>`\n ${(props) => `\n appearance: none;\n display: flex;\n margin-left: ${props.withTimer ? '0' : '16px'};\n border-radius: 0;\n background: none;\n box-shadow: none;\n padding: 0;\n border: none;\n cursor: pointer;\n border-radius: 50%;\n `}\n ${focus}\n`\n\nexport const CancelTimer = styled(Button)<CancelTimerProps>`\n ${(props) => `\n margin-left: ${props.isCompact ? '28px' : '60px'};\n padding-right: ${props.isCompact ? '16px' : '28px'};\n padding-left: ${props.isCompact ? '16px' : '28px'};\n `}\n`\n\nexport const Timer = styled(CountdownCircle)<CountdownCircleProps>`\n ${(props) => `\n line-height: ${props.isCompact ? '12px' : '18px'};\n font-weight: ${props.isCompact ? '700' : '400'};\n font-size: ${props.isCompact ? '11px' : '14px'};\n color: ${props.color};\n\n svg {\n transform: rotateY(180deg);\n }\n `}\n`\n"],"names":["getPaddingY","column","isCompact","withImage","withTimer","getImageSize","Root","styled","div","withConfig","shouldForwardProp","prop","includes","displayName","componentId","props","textWrap","paddingRight","withCloseIcon","paddingLeft","noIcon","size","withAction","withTitle","bgColor","theme","clear","type","colors","responsiveProperty","IconWrapper","getMarginRightIconWrapper","ContentWrapper","Title","Text","Content","Link","Actions","getActionsMarginTop","CloseIcon","button","focus","CancelTimer","Button","Timer","CountdownCircle","color"],"mappings":"oRA4CA,MAAMA,YAAcA,EAClBC,SACAC,YACAC,YACAC,eAEIH,EAAe,OAEfC,EACKE,EAAY,MAAQ,OAGtBD,EAAY,MAAQC,EAAY,MAAQ,OAoDjD,MAAMC,aAAeA,EAAGJ,SAAQC,eAC1BA,EAAkB,OAEfD,EAAS,OAAS,OAmBpB,MAAMK,KAAOC,OAAOC,IAAIC,WAA2B,CACxDC,kBAAoBC,GAAS,CAAC,WAAY,YAAa,eAAgB,eAAgB,SAASC,SAASD,KACzGF,WAAA,CAAAI,YAAA,cAAAC,YAAA,oBAFkBP,CAElB,CAAA,GAAA,IAAA,IACGQ,GAAU,0CAEIA,EAAMd,SAAWc,EAAMb,WAAaa,EAAMX,UAAYW,EAAMC,UAAY,aAAe,mCACnFD,EAAMX,UAAY,gBAAkB,mCACxCJ,YAAYe,2BAvDVE,GACnBf,YACAgB,gBACAd,eAEIc,EACKhB,EAAY,OAAS,OAGvBE,EAAY,MAAQ,OA+CRa,CAAaF,4BACZf,YAAYe,0BAhFdI,GAClBjB,YACAkB,SACAC,OACAC,aACAnB,YACAoB,eAEIrB,EACEqB,GAAaF,IAAS,IACjBlB,IAAciB,EAAS,OAAS,OAGlCjB,EAAY,OAASmB,GAAcF,EAAS,OAAS,OAG1DG,GAAaF,IAAS,IACjBlB,IAAciB,EAAS,O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,6BAC3Ba,EAAMb,UAAY,MAAQ,0BAC5Ba,EAAMb,UAAY,OAAS,uBAC/Ba,EAAM+B"}
1
+ {"version":3,"file":"style.mjs","sources":["../../../../src/components/Alert/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { FlattenInterpolation, ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { AlertType, StyledAlertProps, AlertPalette } from './types'\n\nconst filterLayoutProps = (propKey: string) =>\n !['layout', 'layoutXXS', 'layoutXS', 'layoutS', 'layoutM', 'layoutL', 'layoutXL', 'layouts'].includes(propKey)\n\nconst shouldForwardAlertProp = createShouldForwardProp(\n filterLayoutProps,\n (propKey: string) => !['type', 'clear'].includes(propKey)\n)\n\nconst template = (palette: AlertPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n box-shadow: 0 6px 20px 0 ${palette.shadowColor};\n`\n\nconst COLOR_SCHEMA: Record<AlertType, FlattenInterpolation<ThemedStyledProps<StyledAlertProps, DefaultTheme>>> = {\n info: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['bg-brand-primary-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n success: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-success-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n warning: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-warning-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n error: css<StyledAlertProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.clear\n ? props.theme.colors['bg-other-surface']\n : props.theme.colors['alert-bg-error-200'],\n shadowColor: props.clear ? props.theme.colors['effect-shadow-medium'] : 'transparent',\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledAlertProps>({\n shouldForwardProp: shouldForwardAlertProp,\n})`\n box-sizing: border-box;\n display: flex;\n width: var(--alert-root-width);\n max-width: var(--alert-root-max-width);\n min-width: var(--alert-root-min-width);\n border-radius: var(--alert-root-border-radius);\n min-height: var(--alert-root-min-height);\n margin: var(--alert-margin);\n\n ${(props) => {\n return COLOR_SCHEMA[props.type]\n }}\n`\n\nexport const Container = styled.div`\n box-sizing: border-box;\n display: flex;\n flex-grow: 1;\n align-items: var(--alert-content-align-items);\n padding: var(--alert-container-padding);\n\n & > *:not(:last-child) {\n margin-right: var(--alert-container-gap);\n }\n`\n\nexport const Main = styled.div`\n box-sizing: border-box;\n flex-grow: 1;\n display: flex;\n flex-direction: var(--alert-main-flex-direction);\n align-items: var(--alert-content-align-items);\n\n & > *:not(:last-child) {\n margin-right: var(--alert-main-gap-horizontal);\n margin-bottom: var(--alert-main-gap-vertical);\n }\n`\n\nexport const Content = styled.div`\n box-sizing: border-box;\n flex-grow: 1;\n padding: var(--alert-content-padding);\n\n & > *:not(:last-child) {\n margin-bottom: var(--alert-content-gap);\n }\n`\n\nexport const Addon = styled.div`\n box-sizing: border-box;\n display: flex;\n`\n\nexport const DiscardButton = styled.div`\n box-sizing: border-box;\n flex-shrink: 0;\n display: flex;\n align-items: var(--alert-content-align-items);\n padding: var(--alert-discard-button-padding);\n`\n"],"names":["shouldForwardAlertProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","shadowColor","COLOR_SCHEMA","info","css","props","theme","colors","clear","success","warning","error","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","type","Container","Main","Content","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c,KAAOC,OAAOC,IAAIC,WAA6B,CAC1DC,kBAAmBvB,yBACnBsB,WAAA,CAAAE,YAAA,cAAAC,YAAA,oBAFkBL,CAElB,CAAA,iQAAA,IAUGR,GACMH,aAAaG,EAAMc,aAIjBC,UAAYP,OAAOC,IAAGC,WAAA,CAAAE,YAAA,mBAAAC,YAAA,oBAAVL,CAAU,CAAA,8MAYtBQ,KAAOR,OAAOC,IAAGC,WAAA,CAAAE,YAAA,cAAAC,YAAA,oBAAVL,CAAU,CAAA,0QAajBS,QAAUT,OAAOC,IAAGC,WAAA,CAAAE,YAAA,iBAAAC,YAAA,oBAAVL,CAAU,CAAA,iJAUpBU,MAAQV,OAAOC,IAAGC,WAAA,CAAAE,YAAA,eAAAC,YAAA,oBAAVL,CAAU,CAAA,8CAKlBW,cAAgBX,OAAOC,IAAGC,WAAA,CAAAE,YAAA,uBAAAC,YAAA,oBAAVL,CAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ 'use strict';var useThemeMergedProps=require('../../hooks/useThemeMergedProps.js');var useResponsiveSizeProps=require('../../hooks/useResponsiveSizeProps.js');var useResponsiveLayoutProps=require('../../hooks/useResponsiveLayoutProps.js');var useResponsiveMarginProps=require('../../hooks/useResponsiveMarginProps.js');var useMergedPalette=require('../../hooks/useMergedPalette.js');exports.useAlertProps=e=>{const s=useThemeMergedProps.useThemeMergedProps(e,'Alert');const r=useResponsiveSizeProps.useResponsiveSizeProps(s);const o=useResponsiveLayoutProps.useResponsiveLayoutProps(s);const u=useResponsiveMarginProps.useResponsiveMarginProps(s);const p=useMergedPalette.useMergedPalette(s);return{...s,size:r,layout:o,margin:u,palette:p}};
2
+ //# sourceMappingURL=useAlertProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAlertProps.js","sources":["../../../../src/components/Alert/useAlertProps.ts"],"sourcesContent":["import { useThemeMergedProps } from 'hooks/useThemeMergedProps'\nimport { useResponsiveSizeProps } from 'hooks/useResponsiveSizeProps'\nimport { useResponsiveLayoutProps } from 'hooks/useResponsiveLayoutProps'\nimport { useResponsiveMarginProps } from 'hooks/useResponsiveMarginProps'\nimport { useMergedPalette } from 'hooks/useMergedPalette'\nimport type { AlertProps } from './types'\n\nexport const useAlertProps = (props: AlertProps) => {\n const mergedProps = useThemeMergedProps(props, 'Alert')\n const size = useResponsiveSizeProps(mergedProps)\n const layout = useResponsiveLayoutProps(mergedProps)\n const margin = useResponsiveMarginProps(mergedProps)\n const palette = useMergedPalette(mergedProps)\n\n return {\n ...mergedProps,\n size,\n layout,\n margin,\n palette,\n }\n}\n"],"names":["props","mergedProps","useThemeMergedProps","size","useResponsiveSizeProps","layout","useResponsiveLayoutProps","margin","useResponsiveMarginProps","palette","useMergedPalette"],"mappings":"qZAO8BA,IAC5B,MAAMC,EAAcC,oBAAAA,oBAAoBF,EAAO,SAC/C,MAAMG,EAAOC,uBAAAA,uBAAuBH,GACpC,MAAMI,EAASC,yBAAAA,yBAAyBL,GACxC,MAAMM,EAASC,yBAAAA,yBAAyBP,GACxC,MAAMQ,EAAUC,iBAAAA,iBAAiBT,GAEjC,MAAO,IACFA,EACHE,OACAE,SACAE,SACAE"}
@@ -0,0 +1,2 @@
1
+ import{useThemeMergedProps}from'../../hooks/useThemeMergedProps.mjs';import{useResponsiveSizeProps}from'../../hooks/useResponsiveSizeProps.mjs';import{useResponsiveLayoutProps}from'../../hooks/useResponsiveLayoutProps.mjs';import{useResponsiveMarginProps}from'../../hooks/useResponsiveMarginProps.mjs';import{useMergedPalette}from'../../hooks/useMergedPalette.mjs';const useAlertProps=e=>{const s=useThemeMergedProps(e,'Alert');const o=useResponsiveSizeProps(s);const r=useResponsiveLayoutProps(s);const p=useResponsiveMarginProps(s);const t=useMergedPalette(s);return{...s,size:o,layout:r,margin:p,palette:t}};export{useAlertProps};
2
+ //# sourceMappingURL=useAlertProps.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAlertProps.mjs","sources":["../../../../src/components/Alert/useAlertProps.ts"],"sourcesContent":["import { useThemeMergedProps } from 'hooks/useThemeMergedProps'\nimport { useResponsiveSizeProps } from 'hooks/useResponsiveSizeProps'\nimport { useResponsiveLayoutProps } from 'hooks/useResponsiveLayoutProps'\nimport { useResponsiveMarginProps } from 'hooks/useResponsiveMarginProps'\nimport { useMergedPalette } from 'hooks/useMergedPalette'\nimport type { AlertProps } from './types'\n\nexport const useAlertProps = (props: AlertProps) => {\n const mergedProps = useThemeMergedProps(props, 'Alert')\n const size = useResponsiveSizeProps(mergedProps)\n const layout = useResponsiveLayoutProps(mergedProps)\n const margin = useResponsiveMarginProps(mergedProps)\n const palette = useMergedPalette(mergedProps)\n\n return {\n ...mergedProps,\n size,\n layout,\n margin,\n palette,\n }\n}\n"],"names":["useAlertProps","props","mergedProps","useThemeMergedProps","size","useResponsiveSizeProps","layout","useResponsiveLayoutProps","margin","useResponsiveMarginProps","palette","useMergedPalette"],"mappings":"6WAOO,MAAMA,cAAiBC,IAC5B,MAAMC,EAAcC,oBAAoBF,EAAO,SAC/C,MAAMG,EAAOC,uBAAuBH,GACpC,MAAMI,EAASC,yBAAyBL,GACxC,MAAMM,EAASC,yBAAyBP,GACxC,MAAMQ,EAAUC,iBAAiBT,GAEjC,MAAO,IACFA,EACHE,OACAE,SACAE,SACAE"}
@@ -1,2 +1,2 @@
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 sizes=require('./sizes.js');var sizesDefault=require('./sizes-default.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');var Icon=require('../Icon/Icon.js');var index=require('../../icon-pack/src/icons/CheckFill/index.js');var index$1=require('../../icon-pack/src/icons/LoaderFill/index.js');const Button=withMergedProps.withMergedProps(React.forwardRef((e,s)=>{let{size:t="m",inline:n=!0,rounded:i=!0,color:r="accent",fontColor:o="white",showContentOnStatus:a,textProps:c={},iconProps:l={},leftIconProps:u={},rightIconProps:d={},as:x,sizeXXS:p,sizeXS:m,sizeS:j,sizeM:S,sizeL:h,sizeXL:z,className:I,children:f,content:R,fontWeight:y,icon:E,innerRef:v,...C}=e;const g=styled.useTheme();C.preset!=='default'||typeof t!='string'||C.round||(C={...sizesDefault.PROPS_BY_SIZE[t]??{},...C}),C.href&&(x='a'),C.to&&(x=g.link),C.disabled&&(x='button'),C.primary&&(r='primary'),C.secondary&&(r='atlantis');const _=useClassname.useClassname("Button",I);const N=useClassname.useClassname("Button");const P=hooks.useComputedRel(g,C);const T=hooks.useComputedLinkProps(x,C);let[q,D]=Array.isArray(E)?E:[E];const Z={size:t,sizeXXS:p,sizeXS:m,sizeS:j,sizeM:S,sizeL:h,sizeXL:z};const k={...Z,as:'span',color:'inherit',weight:y??(C.preset==='brand'?800:600),lineHeight:C.preset==='brand'?1.2:1,sizes:C.preset==='brand'?sizes.SIZES_TEXT:sizesDefault.SIZES_TEXT_DEFAULT};const L={...Z,color:'inherit',preset:C.preset,sizes:sizes.SIZES_ICON};const X=C.preset==='brand'&&C.success;const b=C.preset==='brand'&&C.loading;const O=typeof f!='function'&&(f||R)?jsxRuntime.jsx(Text.Text,{className:`${N}__content`,...k,...c,children:f||R}):null;return jsxRuntime.jsx(style.Root,{...C,...T,...Z,inline:n,color:r,fontColor:o,rounded:i,rel:P,as:x,className:_,ref:s??v,children:typeof f=='function'?f({textProps:k,iconProps:L}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[X||b?jsxRuntime.jsxs(style.ContentWithStatus,{children:[X?jsxRuntime.jsx(Icon.Icon,{...L,...l,icon:jsxRuntime.jsx(index.CheckFill,{})}):jsxRuntime.jsx(style.IconAnimation,{children:jsxRuntime.jsx(Icon.Icon,{...L,...l,icon:jsxRuntime.jsx(index$1.LoaderFill,{})})}),a?O:null]}):null,jsxRuntime.jsxs(style.Content,{"aria-hidden":X||b,children:[q?jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof q=='string'?q:void 0,icon:typeof q!='string'?q:void 0,...L,...l,...u}):null,O,D?jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof D=='string'?D:void 0,icon:typeof D!='string'?D:void 0,...L,...l,...d}):null]})]})})}),{displayName:"Button",sizes:e=>{let s=e.preset==='brand'?sizes.SIZES:sizesDefault.SIZES_DEFAULT;return e.round&&(s=e.preset==='brand'?sizes.SIZES_ROUND:sizesDefault.SIZES_ROUND_DEFAULT),s}});exports.SIZES=sizes.SIZES,exports.SIZES_ROUND=sizes.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 misc=require('../../shared/utils/misc.js');var withMergedProps=require('../../hocs/withMergedProps.js');var hooks=require('./hooks.js');var sizes=require('./sizes.js');var sizesDefault=require('./sizes-default.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');var Icon=require('../Icon/Icon.js');var index=require('../../icon-pack/src/icons/CheckFill/index.js');var index$1=require('../../icon-pack/src/icons/LoaderFill/index.js');const Button=withMergedProps.withMergedProps(React.forwardRef((e,s)=>{let{size:t="m",inline:n=!0,rounded:i=!0,color:r="accent",fontColor:o="white",showContentOnStatus:a,textProps:c={},iconProps:l={},leftIconProps:u={},rightIconProps:d={},textSizes:x={},iconSizes:m={},as:p,sizeXXS:j,sizeXS:S,sizeS:z,sizeM:h,sizeL:I,sizeXL:f,className:R,children:y,content:E,fontWeight:v,icon:g,innerRef:C,..._}=e;const q=styled.useTheme();_.preset!=='default'||typeof t!='string'||_.round||(_={...sizesDefault.PROPS_BY_SIZE[t]??{},..._}),_.href&&(p='a'),_.to&&(p=q.link),_.disabled&&(p='button'),_.primary&&(r='primary'),_.secondary&&(r='atlantis');const N=useClassname.useClassname("Button",R);const P=useClassname.useClassname("Button");const T=hooks.useComputedRel(q,_);const D=hooks.useComputedLinkProps(p,_);let[Z,k]=Array.isArray(g)?g:[g];const L={size:t,sizeXXS:j,sizeXS:S,sizeS:z,sizeM:h,sizeL:I,sizeXL:f};const X={...L,as:'span',color:'inherit',weight:v??(_.preset==='brand'?800:600),lineHeight:_.preset==='brand'?1.2:1,sizes:misc.deepmerge(_.preset==='brand'?sizes.SIZES_TEXT:sizesDefault.SIZES_TEXT_DEFAULT,x)};const b={...L,color:'inherit',preset:_.preset,sizes:misc.deepmerge(sizes.SIZES_ICON,m)};const O=_.preset==='brand'&&_.success;const w=_.preset==='brand'&&_.loading;const B=typeof y!='function'&&(y||E)?jsxRuntime.jsx(Text.Text,{className:`${P}__content`,...X,...c,children:y||E}):null;return jsxRuntime.jsx(style.Root,{..._,...D,...L,inline:n,color:r,fontColor:o,rounded:i,rel:T,as:p,className:N,ref:s??C,children:typeof y=='function'?y({textProps:X,iconProps:b}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[O||w?jsxRuntime.jsxs(style.ContentWithStatus,{children:[O?jsxRuntime.jsx(Icon.Icon,{...b,...l,icon:jsxRuntime.jsx(index.CheckFill,{})}):jsxRuntime.jsx(style.IconAnimation,{children:jsxRuntime.jsx(Icon.Icon,{...b,...l,icon:jsxRuntime.jsx(index$1.LoaderFill,{})})}),a?B:null]}):null,jsxRuntime.jsxs(style.Content,{"aria-hidden":O||w,children:[Z?jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof Z=='string'?Z:void 0,icon:typeof Z!='string'?Z:void 0,...b,...l,...u}):null,B,k?jsxRuntime.jsx(Icon.Icon,{className:"icon",name:typeof k=='string'?k:void 0,icon:typeof k!='string'?k:void 0,...b,...l,...d}):null]})]})})}),{displayName:"Button",sizes:e=>{let s=e.preset==='brand'?sizes.SIZES:sizesDefault.SIZES_DEFAULT;return e.round&&(s=e.preset==='brand'?sizes.SIZES_ROUND:sizesDefault.SIZES_ROUND_DEFAULT),s}});exports.SIZES=sizes.SIZES,exports.SIZES_ROUND=sizes.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":["/* eslint-disable prefer-const */\nimport { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { CheckFill, LoaderFill } from '@foxford/icon-pack'\nimport { useClassname } from 'hooks/useClassname'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } 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, SIZES_ICON, SIZES_TEXT } from './sizes'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE, SIZES_TEXT_DEFAULT } from './sizes-default'\nimport type { ButtonProps, Size } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<button\\> элемента.\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef<HTMLButtonElement, MergedProps<ButtonProps>>((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n showContentOnStatus,\n textProps: textPropsProp = {},\n iconProps: iconPropsProp = {},\n leftIconProps = {},\n rightIconProps = {},\n as: _as,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\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 as Size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = theme.link\n if (restProps.disabled) _as = 'button'\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 const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const textProps: TextProps = {\n ...sizeProps,\n as: 'span',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n sizes: restProps.preset === 'brand' ? SIZES_TEXT : SIZES_TEXT_DEFAULT,\n }\n\n const iconProps: IconProps = {\n ...sizeProps,\n color: 'inherit',\n preset: restProps.preset,\n sizes: SIZES_ICON,\n }\n\n const success = restProps.preset === 'brand' && restProps.success\n const loading = restProps.preset === 'brand' && restProps.loading\n\n const mainContent =\n typeof children !== 'function' && (children || content) ? (\n <Text className={`${textClassName}__content`} {...textProps} {...textPropsProp}>\n {children || content}\n </Text>\n ) : null\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n {...sizeProps}\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({ textProps, iconProps })\n ) : (\n <>\n {success || loading ? (\n <Styled.ContentWithStatus>\n {success ? (\n <Icon {...iconProps} {...iconPropsProp} icon={<CheckFill />} />\n ) : (\n <Styled.IconAnimation>\n <Icon {...iconProps} {...iconPropsProp} icon={<LoaderFill />} />\n </Styled.IconAnimation>\n )}\n {showContentOnStatus ? mainContent : null}\n </Styled.ContentWithStatus>\n ) : null}\n <Styled.Content aria-hidden={success || loading}>\n {before ? (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconProps}\n {...iconPropsProp}\n {...leftIconProps}\n />\n ) : null}\n {mainContent}\n {after ? (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconProps}\n {...iconPropsProp}\n {...rightIconProps}\n />\n ) : null}\n </Styled.Content>\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","showContentOnStatus","textProps","textPropsProp","iconProps","iconPropsProp","leftIconProps","rightIconProps","as","_as","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","link","disabled","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","sizeProps","weight","lineHeight","sizes","SIZES_TEXT","SIZES_TEXT_DEFAULT","SIZES_ICON","success","loading","mainContent","_jsx","Text","Styled","_jsxs","_Fragment","Icon","CheckFill","LoaderFill","name","undefined","displayName","SIZES","SIZES_DEFAULT","SIZES_ROUND","SIZES_ROUND_DEFAULT"],"mappings":"+kBAyBA,MAAMA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,WAAwD,CAACC,EAAOC,KAC9D,IAAIC,KACFA,EAAO,IAAGC,OACVA,GAAS,EAAIC,QACbA,GAAU,EAAIC,MACdA,EAAQ,SAAQC,UAChBA,EAAY,QAAOC,oBACnBA,EACAC,UAAWC,EAAgB,CAAA,EAC3BC,UAAWC,EAAgB,CAAA,EAAEC,cAC7BA,EAAgB,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OsB,EAAQtD,EAAM+B,SAAW,QAAU2C,MAAAA,YAAcC,aAAAA,qBAE3DrB,kHA9JU"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["/* eslint-disable prefer-const */\nimport { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport { CheckFill, LoaderFill } from '@foxford/icon-pack'\nimport { useClassname } from 'hooks/useClassname'\nimport { deepmerge } from 'shared/utils/misc'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } 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, SIZES_ICON, SIZES_TEXT } from './sizes'\nimport { SIZES_DEFAULT, SIZES_ROUND_DEFAULT, PROPS_BY_SIZE, SIZES_TEXT_DEFAULT } from './sizes-default'\nimport type { ButtonProps, Size } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Button'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<button\\> элемента.\n */\nconst Button: React.ForwardRefExoticComponent<ButtonProps> = withMergedProps<ButtonProps, HTMLButtonElement>(\n forwardRef<HTMLButtonElement, MergedProps<ButtonProps>>((props, ref) => {\n let {\n size = 'm',\n inline = true,\n rounded = true,\n color = 'accent',\n fontColor = 'white',\n showContentOnStatus,\n textProps: textPropsProp = {},\n iconProps: iconPropsProp = {},\n leftIconProps = {},\n rightIconProps = {},\n textSizes = {},\n iconSizes = {},\n as: _as,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\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 as Size] ?? {}\n restProps = { ...propsBySize, ...restProps }\n }\n\n if (restProps.href) _as = 'a'\n if (restProps.to) _as = theme.link\n if (restProps.disabled) _as = 'button'\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 const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const textProps: TextProps = {\n ...sizeProps,\n as: 'span',\n color: 'inherit',\n weight: fontWeight ?? (restProps.preset === 'brand' ? 800 : 600),\n lineHeight: restProps.preset === 'brand' ? 1.2 : 1,\n sizes: deepmerge(restProps.preset === 'brand' ? SIZES_TEXT : SIZES_TEXT_DEFAULT, textSizes),\n }\n\n const iconProps: IconProps = {\n ...sizeProps,\n color: 'inherit',\n preset: restProps.preset,\n sizes: deepmerge(SIZES_ICON, iconSizes),\n }\n\n const success = restProps.preset === 'brand' && restProps.success\n const loading = restProps.preset === 'brand' && restProps.loading\n\n const mainContent =\n typeof children !== 'function' && (children || content) ? (\n <Text className={`${textClassName}__content`} {...textProps} {...textPropsProp}>\n {children || content}\n </Text>\n ) : null\n\n return (\n <Styled.Root\n {...restProps}\n {...linkProps}\n {...sizeProps}\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({ textProps, iconProps })\n ) : (\n <>\n {success || loading ? (\n <Styled.ContentWithStatus>\n {success ? (\n <Icon {...iconProps} {...iconPropsProp} icon={<CheckFill />} />\n ) : (\n <Styled.IconAnimation>\n <Icon {...iconProps} {...iconPropsProp} icon={<LoaderFill />} />\n </Styled.IconAnimation>\n )}\n {showContentOnStatus ? mainContent : null}\n </Styled.ContentWithStatus>\n ) : null}\n <Styled.Content aria-hidden={success || loading}>\n {before ? (\n <Icon\n className='icon'\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconProps}\n {...iconPropsProp}\n {...leftIconProps}\n />\n ) : null}\n {mainContent}\n {after ? (\n <Icon\n className='icon'\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconProps}\n {...iconPropsProp}\n {...rightIconProps}\n />\n ) : null}\n </Styled.Content>\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","showContentOnStatus","textProps","textPropsProp","iconProps","iconPropsProp","leftIconProps","rightIconProps","textSizes","iconSizes","as","_as","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","className","children","content","fontWeight","icon","innerRef","restProps","theme","useTheme","preset","round","PROPS_BY_SIZE","href","to","link","disabled","primary","secondary","rootClassName","useClassname","textClassName","rel","useComputedRel","linkProps","useComputedLinkProps","before","after","Array","isArray","sizeProps","weight","lineHeight","sizes","deepmerge","SIZES_TEXT","SIZES_TEXT_DEFAULT","SIZES_ICON","success","loading","mainContent","_jsx","Text","Styled","_jsxs","_Fragment","Icon","CheckFill","LoaderFill","name","undefined","displayName","SIZES","SIZES_DEFAULT","SIZES_ROUND","SIZES_ROUND_DEFAULT"],"mappings":"8nBA0BA,MAAMA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,WAAwD,CAACC,EAAOC,KAC9D,IAAIC,KACFA,EAAO,IAAGC,OACVA,GAAS,EA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