@foxford/ui 2.110.0 → 2.111.0-beta-279e87d-20260513

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.
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var style=require('./style.js');var constants=require('./constants.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Badge=withMergedProps.withMergedProps(React.forwardRef((e,r)=>{const{size:s="s",borderRadius:t=3,textProps:n={},iconProps:i={},children:o,content:c,icon:a,...d}=e;const[u,x]=Array.isArray(a)?a:[a];const j={as:'span',size:'inherit',color:'inherit',marginLeft:u?'0.25em':void 0,marginRight:x?'0.25em':void 0};const p={color:'inherit'};return jsxRuntime.jsx(style.Root,{...d,size:s,borderRadius:t,ref:r,children:typeof o=='function'?o({baseTextProps:j,textProps:n,iconBaseProps:p,iconProps:i,icon:a}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u?jsxRuntime.jsx(Icon.Icon,{name:typeof u=='string'?u:void 0,icon:typeof u!='string'?u:void 0,...p,...i}):null,o||c?jsxRuntime.jsx(Text.Text,{...j,...n,children:o||c}):null,x?jsxRuntime.jsx(Icon.Icon,{name:typeof x=='string'?x:void 0,icon:typeof x!='string'?x:void 0,...p,...i}):null]})})}),{displayName:'Badge',sizes:e=>e.round?constants.SIZES_ROUND:constants.SIZES});exports.Badge=Badge;
1
+ 'use strict';var createPolymorphicComponentWithRef=require('../../shared/utils/createPolymorphicComponentWithRef.js');var useMergedProps=require('../../hooks/useMergedProps.js');var style=require('./style.js');var sizes=require('./sizes.js');var jsxRuntime=require('react/jsx-runtime');var Slot=require('../Slot/Slot.js');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Badge=createPolymorphicComponentWithRef.createPolymorphicComponentWithRef((e,s)=>{const o=useMergedProps.useMergedProps(e,{componentName:"Badge",sizes:e=>e.shape==='rounded'?sizes.SIZES_ROUNDED:e.round?sizes.SIZES_ROUND:e.borderRadius!==void 0?sizes.SIZES_BASE:sizes.SIZES_SQUARE});const{size:i="s",borderRadius:r=3,textProps:t={},iconProps:n={},shape:c="square",component:a="div",children:p,addonLeft:d,addonRight:u,content:S,icon:x,sizeXXS:z,sizeXS:j,sizeS:m,sizeM:l,sizeL:R,sizeXL:h,...P}=o;const v={size:i,sizeXXS:z,sizeXS:j,sizeS:m,sizeM:l,sizeL:R,sizeXL:h};const[g,y]=Array.isArray(x)?x:[x];const I={...v,as:'span',appearance:'caption',color:'inherit',sizes:sizes.SIZES_TEXT,...t};const f={...v,color:'inherit',sizes:sizes.SIZES_ICON,...n};return jsxRuntime.jsx(style.Root,{...P,...v,as:a,size:i,borderRadius:r,shape:c,ref:s,children:typeof p=='function'?p({textProps:I,iconProps:f}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Slot.Slot,{props:{iconProps:f},render:d??(g?e=>jsxRuntime.jsx(Icon.Icon,{...e.iconProps,...f,name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0}):void 0)}),p||S?jsxRuntime.jsx(Text.Text,{...I,children:p||S}):null,jsxRuntime.jsx(Slot.Slot,{props:{iconProps:f},render:u??(y?e=>jsxRuntime.jsx(Icon.Icon,{...e.iconProps,...f,name:typeof y=='string'?y:void 0,icon:typeof y!='string'?y:void 0}):void 0)})]})})});exports.Badge=Badge,exports.COMPONENT_NAME="Badge";
2
2
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { Icon } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport * as Styled from './style'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport type { BadgeProps } from './types'\n\nconst COMPONENT_NAME = 'Badge'\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [BadgeProps](https://github.com/foxford/ui/blob/master/packages/ui/src/components/Badge/types.ts)\n */\nexport const Badge: React.ForwardRefExoticComponent<BadgeProps> = withMergedProps<BadgeProps, HTMLDivElement>(\n forwardRef<HTMLDivElement, MergedProps<BadgeProps>>((props, ref) => {\n const {\n size = 's',\n borderRadius = 3,\n textProps = {},\n iconProps = {},\n children,\n content,\n icon,\n ...restProps\n } = props\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n const iconBaseProps: IconProps = { color: 'inherit' }\n\n return (\n <Styled.Root {...restProps} size={size} borderRadius={borderRadius} ref={ref}>\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n {children || content ? (\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n ) : null}\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.round ? SIZES_ROUND : SIZES),\n }\n)\n"],"names":["Badge","withMergedProps","forwardRef","props","ref","size","borderRadius","textProps","iconProps","children","content","icon","restProps","before","after","Array","isArray","baseTextProps","as","color","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","_jsxs","_Fragment","Icon","name","Text","displayName","sizes","round","SIZES_ROUND","SIZES"],"mappings":"iSAuBO,MAAMA,MAAqDC,gBAAAA,gBAChEC,MAAAA,WAAoD,CAACC,EAAOC,KAC1D,MAAMC,KACJA,EAAO,IAAGC,aACVA,EAAe,EAACC,UAChBA,EAAY,CAAA,EAAEC,UACdA,EAAY,CAAA,EAAEC,SACdA,EAAQC,QACRA,EAAOC,KACPA,KACGC,GACDT,EAEJ,MAAOU,EAAQC,GAASC,MAAMC,QAAQL,GAAQA,EAAO,CAACA,GAEtD,MAAMM,EAA2B,CAC/BC,GAAI,OACJb,KAAM,UACNc,MAAO,UACPC,WAAYP,EAAS,cAAWQ,EAChCC,YAAaR,EAAQ,cAAWO,GAElC,MAAME,EAA2B,CAAEJ,MAAO,WAE1C,OACEK,WAAAA,IAACC,MAAAA,KAAW,IAAKb,EAAWP,KAAMA,EAAMC,aAAcA,EAAcF,IAAKA,EAAIK,gBACnEA,GAAa,WACnBA,EAAS,CAAEQ,gBAAeV,YAAWgB,gBAAef,YAAWG,SAE/De,WAAAA,KAAAC,oBAAA,CAAAlB,SAAA,CACGI,EACCW,WAAAA,IAACI,UAAI,CACHC,YAAahB,GAAW,SAAWA,OAASQ,EAC5CV,YAAaE,GAAW,SAAWA,OAASQ,KACxCE,KACAf,IAEJ,KACHC,GAAYC,EACXc,WAAAA,IAACM,KAAAA,KAAI,IAAKb,KAAmBV,EAASE,SACnCA,GAAYC,IAEb,KACHI,EACCU,WAAAA,IAACI,KAAAA,KAAI,CACHC,YAAaf,GAAU,SAAWA,OAAQO,EAC1CV,YAAaG,GAAU,SAAWA,OAAQO,KACtCE,KACAf,IAEJ,YAMd,CACEuB,YArEmB,QAsEnBC,MAAQ7B,GAAWA,EAAM8B,MAAQC,UAAAA,YAAcC,UAAAA"}
1
+ {"version":3,"file":"Badge.js","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { createPolymorphicComponentWithRef } from 'shared/utils/createPolymorphicComponentWithRef'\nimport { useMergedProps } from 'hooks/useMergedProps'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { Icon } from 'components/Icon'\nimport type { IconProps } from 'components/Icon'\nimport { Slot } from 'components/Slot'\nimport type { PolymorphicProps } from 'shared/interfaces'\nimport * as Styled from './style'\nimport { SIZES_BASE, SIZES_SQUARE, SIZES_ICON, SIZES_ROUND, SIZES_ROUNDED, SIZES_TEXT } from './sizes'\nimport type { BadgeProps } from './types'\n\nconst COMPONENT_NAME = 'Badge'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для маркировки свойств сущности.\n *\n * Полиморфный компонент.\n *\n * Можно передать \"ref\" и атрибуты выбранного HTML-элемента (по умолчанию \\<div\\>).\n */\nconst Badge = createPolymorphicComponentWithRef<'div', BadgeProps>((props, ref) => {\n const mergedProps = useMergedProps<PolymorphicProps<React.ElementType, BadgeProps>>(props, {\n componentName: COMPONENT_NAME,\n sizes: (p) => {\n if (p.shape === 'rounded') {\n return SIZES_ROUNDED\n }\n\n if (p.round) {\n return SIZES_ROUND\n }\n\n if (p.borderRadius !== undefined) {\n return SIZES_BASE\n }\n\n return SIZES_SQUARE\n },\n })\n\n const {\n size = 's',\n borderRadius = 3,\n textProps: textPropsProp = {},\n iconProps: iconPropsProp = {},\n shape = 'square',\n component = 'div',\n children,\n addonLeft,\n addonRight,\n content,\n icon,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n ...restProps\n } = mergedProps\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const [iconBefore, iconAfter] = Array.isArray(icon) ? icon : [icon]\n\n const textProps: TextProps = {\n ...sizeProps,\n as: 'span',\n appearance: 'caption',\n color: 'inherit',\n sizes: SIZES_TEXT,\n ...textPropsProp,\n }\n\n const iconProps: IconProps = { ...sizeProps, color: 'inherit', sizes: SIZES_ICON, ...iconPropsProp }\n\n return (\n <Styled.Root\n {...restProps}\n {...sizeProps}\n as={component}\n size={size}\n borderRadius={borderRadius}\n shape={shape}\n ref={ref}\n >\n {typeof children === 'function' ? (\n children({ textProps, iconProps })\n ) : (\n <>\n <Slot\n props={{ iconProps }}\n render={\n addonLeft ??\n (iconBefore\n ? (addonLeftProps) => (\n <Icon\n {...addonLeftProps.iconProps}\n {...iconProps}\n name={typeof iconBefore === 'string' ? iconBefore : undefined}\n icon={typeof iconBefore !== 'string' ? iconBefore : undefined}\n />\n )\n : undefined)\n }\n />\n\n {children || content ? <Text {...textProps}>{children || content}</Text> : null}\n\n <Slot\n props={{ iconProps }}\n render={\n addonRight ??\n (iconAfter\n ? (addonRightProps) => (\n <Icon\n {...addonRightProps.iconProps}\n {...iconProps}\n name={typeof iconAfter === 'string' ? iconAfter : undefined}\n icon={typeof iconAfter !== 'string' ? iconAfter : undefined}\n />\n )\n : undefined)\n }\n />\n </>\n )}\n </Styled.Root>\n )\n})\n\nconst BadgeDoc: React.FC<BadgeProps> = () => null\n\nexport { BadgeDoc, Badge, COMPONENT_NAME }\n"],"names":["Badge","createPolymorphicComponentWithRef","props","ref","mergedProps","useMergedProps","componentName","sizes","p","shape","SIZES_ROUNDED","round","SIZES_ROUND","borderRadius","undefined","SIZES_BASE","SIZES_SQUARE","size","textProps","textPropsProp","iconProps","iconPropsProp","component","children","addonLeft","addonRight","content","icon","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","restProps","sizeProps","iconBefore","iconAfter","Array","isArray","as","appearance","color","SIZES_TEXT","SIZES_ICON","_jsx","Styled","_jsxs","_Fragment","Slot","render","addonLeftProps","Icon","name","Text","addonRightProps"],"mappings":"0YAwBA,MAAMA,MAAQC,kCAAAA,kCAAqD,CAACC,EAAOC,KACzE,MAAMC,EAAcC,eAAAA,eAAgEH,EAAO,CACzFI,cAdmB,QAenBC,MAAQC,GACFA,EAAEC,QAAU,UACPC,MAAAA,cAGLF,EAAEG,MACGC,MAAAA,YAGLJ,EAAEK,oBAAiBC,EACdC,MAAA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,KAAI,IACCG,EAAgBnC,aAChBA,EACJiC,YAAahB,GAAc,SAAWA,OAAYvB,EAClDa,YAAaU,GAAc,SAAWA,OAAYvB,SAGtDA,uDA1HK"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{Root}from'./style.mjs';import{SIZES_ROUND,SIZES}from'./constants.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const Badge=withMergedProps(forwardRef((o,r)=>{const{size:e="s",borderRadius:t=3,textProps:s={},iconProps:i={},children:n,content:c,icon:m,...a}=o;const[d,p]=Array.isArray(m)?m:[m];const f={as:'span',size:'inherit',color:'inherit',marginLeft:d?'0.25em':void 0,marginRight:p?'0.25em':void 0};const x={color:'inherit'};return jsx(Root,{...a,size:e,borderRadius:t,ref:r,children:typeof n=='function'?n({baseTextProps:f,textProps:s,iconBaseProps:x,iconProps:i,icon:m}):jsxs(Fragment,{children:[d?jsx(Icon,{name:typeof d=='string'?d:void 0,icon:typeof d!='string'?d:void 0,...x,...i}):null,n||c?jsx(Text,{...f,...s,children:n||c}):null,p?jsx(Icon,{name:typeof p=='string'?p:void 0,icon:typeof p!='string'?p:void 0,...x,...i}):null]})})}),{displayName:'Badge',sizes:o=>o.round?SIZES_ROUND:SIZES});export{Badge};
1
+ import{createPolymorphicComponentWithRef}from'../../shared/utils/createPolymorphicComponentWithRef.mjs';import{useMergedProps}from'../../hooks/useMergedProps.mjs';import{Root}from'./style.mjs';import{SIZES_ROUNDED,SIZES_ROUND,SIZES_BASE,SIZES_SQUARE,SIZES_ICON,SIZES_TEXT}from'./sizes.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Slot}from'../Slot/Slot.mjs';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Badge';const Badge=createPolymorphicComponentWithRef((o,e)=>{const s=useMergedProps(o,{componentName:"Badge",sizes:o=>o.shape==='rounded'?SIZES_ROUNDED:o.round?SIZES_ROUND:o.borderRadius!==void 0?SIZES_BASE:SIZES_SQUARE});const{size:r="s",borderRadius:i=3,textProps:t={},iconProps:n={},shape:p="square",component:c="div",children:S,addonLeft:m,addonRight:d,content:a,icon:E,sizeXXS:f,sizeXS:z,sizeS:I,sizeM:h,sizeL:l,sizeXL:j,...x}=s;const P={size:r,sizeXXS:f,sizeXS:z,sizeS:I,sizeM:h,sizeL:l,sizeXL:j};const[R,g]=Array.isArray(E)?E:[E];const u={...P,as:'span',appearance:'caption',color:'inherit',sizes:SIZES_TEXT,...t};const _={...P,color:'inherit',sizes:SIZES_ICON,...n};return jsx(Root,{...x,...P,as:c,size:r,borderRadius:i,shape:p,ref:e,children:typeof S=='function'?S({textProps:u,iconProps:_}):jsxs(Fragment,{children:[jsx(Slot,{props:{iconProps:_},render:m??(R?o=>jsx(Icon,{...o.iconProps,..._,name:typeof R=='string'?R:void 0,icon:typeof R!='string'?R:void 0}):void 0)}),S||a?jsx(Text,{...u,children:S||a}):null,jsx(Slot,{props:{iconProps:_},render:d??(g?o=>jsx(Icon,{...o.iconProps,..._,name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0}):void 0)})]})})});export{Badge,COMPONENT_NAME};
2
2
  //# sourceMappingURL=Badge.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.mjs","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { Icon } from 'components/Icon'\nimport type { TextProps } from 'components/Text'\nimport type { IconProps } from 'components/Icon'\nimport * as Styled from './style'\nimport { SIZES, SIZES_ROUND } from './constants'\nimport type { BadgeProps } from './types'\n\nconst COMPONENT_NAME = 'Badge'\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [BadgeProps](https://github.com/foxford/ui/blob/master/packages/ui/src/components/Badge/types.ts)\n */\nexport const Badge: React.ForwardRefExoticComponent<BadgeProps> = withMergedProps<BadgeProps, HTMLDivElement>(\n forwardRef<HTMLDivElement, MergedProps<BadgeProps>>((props, ref) => {\n const {\n size = 's',\n borderRadius = 3,\n textProps = {},\n iconProps = {},\n children,\n content,\n icon,\n ...restProps\n } = props\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n marginLeft: before ? '0.25em' : undefined,\n marginRight: after ? '0.25em' : undefined,\n }\n const iconBaseProps: IconProps = { color: 'inherit' }\n\n return (\n <Styled.Root {...restProps} size={size} borderRadius={borderRadius} ref={ref}>\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n {children || content ? (\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n ) : null}\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.round ? SIZES_ROUND : SIZES),\n }\n)\n"],"names":["Badge","withMergedProps","forwardRef","props","ref","size","borderRadius","textProps","iconProps","children","content","icon","restProps","before","after","Array","isArray","baseTextProps","as","color","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","_jsxs","_Fragment","Icon","name","Text","displayName","sizes","round","SIZES_ROUND","SIZES"],"mappings":"8RAuBO,MAAMA,MAAqDC,gBAChEC,WAAoD,CAACC,EAAOC,KAC1D,MAAMC,KACJA,EAAO,IAAGC,aACVA,EAAe,EAACC,UAChBA,EAAY,CAAA,EAAEC,UACdA,EAAY,CAAA,EAAEC,SACdA,EAAQC,QACRA,EAAOC,KACPA,KACGC,GACDT,EAEJ,MAAOU,EAAQC,GAASC,MAAMC,QAAQL,GAAQA,EAAO,CAACA,GAEtD,MAAMM,EAA2B,CAC/BC,GAAI,OACJb,KAAM,UACNc,MAAO,UACPC,WAAYP,EAAS,cAAWQ,EAChCC,YAAaR,EAAQ,cAAWO,GAElC,MAAME,EAA2B,CAAEJ,MAAO,WAE1C,OACEK,IAACC,KAAW,IAAKb,EAAWP,KAAMA,EAAMC,aAAcA,EAAcF,IAAKA,EAAIK,gBACnEA,GAAa,WACnBA,EAAS,CAAEQ,gBAAeV,YAAWgB,gBAAef,YAAWG,SAE/De,KAAAC,SAAA,CAAAlB,SAAA,CACGI,EACCW,IAACI,KAAI,CACHC,YAAahB,GAAW,SAAWA,OAASQ,EAC5CV,YAAaE,GAAW,SAAWA,OAASQ,KACxCE,KACAf,IAEJ,KACHC,GAAYC,EACXc,IAACM,KAAI,IAAKb,KAAmBV,EAASE,SACnCA,GAAYC,IAEb,KACHI,EACCU,IAACI,KAAI,CACHC,YAAaf,GAAU,SAAWA,OAAQO,EAC1CV,YAAaG,GAAU,SAAWA,OAAQO,KACtCE,KACAf,IAEJ,YAMd,CACEuB,YArEmB,QAsEnBC,MAAQ7B,GAAWA,EAAM8B,MAAQC,YAAcC"}
1
+ {"version":3,"file":"Badge.mjs","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { createPolymorphicComponentWithRef } from 'shared/utils/createPolymorphicComponentWithRef'\nimport { useMergedProps } from 'hooks/useMergedProps'\nimport { Text } from 'components/Text'\nimport type { TextProps } from 'components/Text'\nimport { Icon } from 'components/Icon'\nimport type { IconProps } from 'components/Icon'\nimport { Slot } from 'components/Slot'\nimport type { PolymorphicProps } from 'shared/interfaces'\nimport * as Styled from './style'\nimport { SIZES_BASE, SIZES_SQUARE, SIZES_ICON, SIZES_ROUND, SIZES_ROUNDED, SIZES_TEXT } from './sizes'\nimport type { BadgeProps } from './types'\n\nconst COMPONENT_NAME = 'Badge'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для маркировки свойств сущности.\n *\n * Полиморфный компонент.\n *\n * Можно передать \"ref\" и атрибуты выбранного HTML-элемента (по умолчанию \\<div\\>).\n */\nconst Badge = createPolymorphicComponentWithRef<'div', BadgeProps>((props, ref) => {\n const mergedProps = useMergedProps<PolymorphicProps<React.ElementType, BadgeProps>>(props, {\n componentName: COMPONENT_NAME,\n sizes: (p) => {\n if (p.shape === 'rounded') {\n return SIZES_ROUNDED\n }\n\n if (p.round) {\n return SIZES_ROUND\n }\n\n if (p.borderRadius !== undefined) {\n return SIZES_BASE\n }\n\n return SIZES_SQUARE\n },\n })\n\n const {\n size = 's',\n borderRadius = 3,\n textProps: textPropsProp = {},\n iconProps: iconPropsProp = {},\n shape = 'square',\n component = 'div',\n children,\n addonLeft,\n addonRight,\n content,\n icon,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n ...restProps\n } = mergedProps\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const [iconBefore, iconAfter] = Array.isArray(icon) ? icon : [icon]\n\n const textProps: TextProps = {\n ...sizeProps,\n as: 'span',\n appearance: 'caption',\n color: 'inherit',\n sizes: SIZES_TEXT,\n ...textPropsProp,\n }\n\n const iconProps: IconProps = { ...sizeProps, color: 'inherit', sizes: SIZES_ICON, ...iconPropsProp }\n\n return (\n <Styled.Root\n {...restProps}\n {...sizeProps}\n as={component}\n size={size}\n borderRadius={borderRadius}\n shape={shape}\n ref={ref}\n >\n {typeof children === 'function' ? (\n children({ textProps, iconProps })\n ) : (\n <>\n <Slot\n props={{ iconProps }}\n render={\n addonLeft ??\n (iconBefore\n ? (addonLeftProps) => (\n <Icon\n {...addonLeftProps.iconProps}\n {...iconProps}\n name={typeof iconBefore === 'string' ? iconBefore : undefined}\n icon={typeof iconBefore !== 'string' ? iconBefore : undefined}\n />\n )\n : undefined)\n }\n />\n\n {children || content ? <Text {...textProps}>{children || content}</Text> : null}\n\n <Slot\n props={{ iconProps }}\n render={\n addonRight ??\n (iconAfter\n ? (addonRightProps) => (\n <Icon\n {...addonRightProps.iconProps}\n {...iconProps}\n name={typeof iconAfter === 'string' ? iconAfter : undefined}\n icon={typeof iconAfter !== 'string' ? iconAfter : undefined}\n />\n )\n : undefined)\n }\n />\n </>\n )}\n </Styled.Root>\n )\n})\n\nconst BadgeDoc: React.FC<BadgeProps> = () => null\n\nexport { BadgeDoc, Badge, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Badge","createPolymorphicComponentWithRef","props","ref","mergedProps","useMergedProps","componentName","sizes","p","shape","SIZES_ROUNDED","round","SIZES_ROUND","borderRadius","undefined","SIZES_BASE","SIZES_SQUARE","size","textProps","textPropsProp","iconProps","iconPropsProp","component","children","addonLeft","addonRight","content","icon","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","restProps","sizeProps","iconBefore","iconAfter","Array","isArray","as","appearance","color","SIZES_TEXT","SIZES_ICON","_jsx","Styled","_jsxs","_Fragment","Slot","render","addonLeftProps","Icon","name","Text","addonRightProps"],"mappings":"4bAYA,MAAMA,eAAiB,QAYvB,MAAMC,MAAQC,kCAAqD,CAACC,EAAOC,KACzE,MAAMC,EAAcC,eAAgEH,EAAO,CACzFI,cAdmB,QAenBC,MAAQC,GACFA,EAAEC,QAAU,UACPC,cAGLF,EAAEG,MACGC,YAGLJ,EAAEK,oBAAiBC,EACdC,WAGFC,eAIX,MAAMC,KACJA,EAAO,IAAGJ,aACVA,EAAe,EACfK,UAAWC,EAAgB,CAAA,EAC3BC,UAAWC,EAAgB,CAAA,EAAEZ,MAC7BA,EAAQ,SAAQa,UAChBA,EAAY,MAAKC,SACjBA,EAAQC,UACRA,EAASC,WACTA,EAAUC,QACVA,EAAOC,KACPA,EAAIC,QACJA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,KACGC,GACD9B,EAEJ,MAAM+B,EAAY,CAChBlB,OACAW,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAOG,EAAYC,GAAaC,MAAMC,QAAQZ,GAAQA,EAAO,CAACA,GAE9D,MAAMT,EAAuB,IACxBiB,EACHK,GAAI,OACJC,WAAY,UACZC,MAAO,UACPnC,MAAOoC,cACJxB,GAGL,MAAMC,EAAuB,IAAKe,EAAWO,MAAO,UAAWnC,MAAOqC,cAAevB,GAErF,OACEwB,IAACC,KAAW,IACNZ,KACAC,EACJK,GAAIlB,EACJL,KAAMA,EACNJ,aAAcA,EACdJ,MAAOA,EACPN,IAAKA,EAAIoB,gBAEDA,GAAa,WACnBA,EAAS,CAAEL,YAAWE,cAEtB2B,KAAAC,SAAA,CAAAzB,SAAA,CACEsB,IAACI,KAAI,CACH/C,MAAO,CAAEkB,aACT8B,OACE1B,IACCY,EACIe,GACCN,IAACO,KAAI,IACCD,EAAe/B,aACfA,EACJiC,YAAajB,GAAe,SAAWA,OAAatB,EACpDa,YAAaS,GAAe,SAAWA,OAAatB,SAGxDA,KAIPS,GAAYG,EAAUmB,IAACS,KAAI,IAAKpC,EAASK,SAAGA,GAAYG,IAAkB,KAE3EmB,IAACI,KAAI,CACH/C,MAAO,CAAEkB,aACT8B,OACEzB,IACCY,EACIkB,GACCV,IAACO,KAAI,IACCG,EAAgBnC,aAChBA,EACJiC,YAAahB,GAAc,SAAWA,OAAYvB,EAClDa,YAAaU,GAAc,SAAWA,OAAYvB,SAGtDA"}
@@ -0,0 +1,2 @@
1
+ 'use strict';const SIZES_BASE={xxxl:{'--badge-size':'36px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:22},xxl:{'--badge-size':'36px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:20},xl:{'--badge-size':'32px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:18},l:{'--badge-size':'28px',height:'var(--badge-size)',paddingRight:8,paddingLeft:8,fontSize:16},m:{'--badge-size':'26px',height:'var(--badge-size)',paddingRight:8,paddingLeft:8,fontSize:14},s:{'--badge-size':'22px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:12},xs:{'--badge-size':'22px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10},xxs:{'--badge-size':'20px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10},xxxs:{'--badge-size':'18px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10}};const SIZES_SQUARE={xxxl:{...SIZES_BASE.xxxl,borderRadius:0},xxl:{...SIZES_BASE.xxl,borderRadius:0},xl:{...SIZES_BASE.xl,borderRadius:0},l:{...SIZES_BASE.l,borderRadius:0},m:{...SIZES_BASE.m,borderRadius:0},s:{...SIZES_BASE.s,borderRadius:0},xs:{...SIZES_BASE.xs,borderRadius:0},xxs:{...SIZES_BASE.xxs,borderRadius:0},xxxs:{...SIZES_BASE.xxxs,borderRadius:0}};const SIZES_ROUNDED={xxxl:{...SIZES_BASE.xxxl,borderRadius:10},xxl:{...SIZES_BASE.xxl,borderRadius:10},xl:{...SIZES_BASE.xl,borderRadius:8},l:{...SIZES_BASE.l,borderRadius:8},m:{...SIZES_BASE.m,borderRadius:8},s:{...SIZES_BASE.s,borderRadius:6},xs:{...SIZES_BASE.xs,borderRadius:4},xxs:{...SIZES_BASE.xxs,borderRadius:4},xxxs:{...SIZES_BASE.xxxs,borderRadius:4}};const SIZES_ROUND={xxxl:{...SIZES_BASE.xxxl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxl:{...SIZES_BASE.xxl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xl:{...SIZES_BASE.xl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},l:{...SIZES_BASE.l,width:'var(--badge-size)',padding:0,borderRadius:'50%'},m:{...SIZES_BASE.m,width:'var(--badge-size)',padding:0,borderRadius:'50%'},s:{...SIZES_BASE.s,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xs:{...SIZES_BASE.xs,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxs:{...SIZES_BASE.xxs,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxxs:{...SIZES_BASE.xxxs,width:'var(--badge-size)',padding:0,borderRadius:'50%'}};exports.SIZES_BASE=SIZES_BASE,exports.SIZES_ICON={xxxl:{fontSize:28},xxl:{fontSize:28},xl:{fontSize:24},l:{fontSize:20},m:{fontSize:16},s:{fontSize:12},xs:{fontSize:10},xxs:{fontSize:10},xxxs:{fontSize:10}},exports.SIZES_ROUND=SIZES_ROUND,exports.SIZES_ROUNDED=SIZES_ROUNDED,exports.SIZES_SQUARE=SIZES_SQUARE,exports.SIZES_TEXT={xxxl:{fontSize:'inherit',marginTop:0},xxl:{fontSize:'inherit',marginTop:0},xl:{fontSize:'inherit',marginTop:1},l:{fontSize:'inherit',marginTop:2},m:{fontSize:'inherit',marginTop:2},s:{fontSize:'inherit',marginTop:2},xs:{fontSize:'inherit',marginTop:0},xxs:{fontSize:'inherit',marginTop:0},xxxs:{fontSize:'inherit',marginTop:0}};
2
+ //# sourceMappingURL=sizes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.js","sources":["../../../../src/components/Badge/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport type { Size } from './types'\n\nexport const SIZES_BASE: Record<Size, CSSProperties> = {\n xxxl: {\n '--badge-size': '36px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 22,\n },\n xxl: {\n '--badge-size': '36px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 20,\n },\n xl: {\n '--badge-size': '32px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 18,\n },\n l: {\n '--badge-size': '28px',\n height: 'var(--badge-size)',\n paddingRight: 8,\n paddingLeft: 8,\n fontSize: 16,\n },\n m: {\n '--badge-size': '26px',\n height: 'var(--badge-size)',\n paddingRight: 8,\n paddingLeft: 8,\n fontSize: 14,\n },\n s: {\n '--badge-size': '22px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 12,\n },\n xs: {\n '--badge-size': '22px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n xxs: {\n '--badge-size': '20px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n xxxs: {\n '--badge-size': '18px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n}\n\nexport const SIZES_SQUARE: Record<Size, CSSProperties> = {\n xxxl: { ...SIZES_BASE.xxxl, borderRadius: 0 },\n xxl: { ...SIZES_BASE.xxl, borderRadius: 0 },\n xl: { ...SIZES_BASE.xl, borderRadius: 0 },\n l: { ...SIZES_BASE.l, borderRadius: 0 },\n m: { ...SIZES_BASE.m, borderRadius: 0 },\n s: { ...SIZES_BASE.s, borderRadius: 0 },\n xs: { ...SIZES_BASE.xs, borderRadius: 0 },\n xxs: { ...SIZES_BASE.xxs, borderRadius: 0 },\n xxxs: { ...SIZES_BASE.xxxs, borderRadius: 0 },\n}\n\nexport const SIZES_ROUNDED: Record<Size, CSSProperties> = {\n xxxl: {\n ...SIZES_BASE.xxxl,\n borderRadius: 10,\n },\n xxl: {\n ...SIZES_BASE.xxl,\n borderRadius: 10,\n },\n xl: {\n ...SIZES_BASE.xl,\n borderRadius: 8,\n },\n l: {\n ...SIZES_BASE.l,\n borderRadius: 8,\n },\n m: {\n ...SIZES_BASE.m,\n borderRadius: 8,\n },\n s: {\n ...SIZES_BASE.s,\n borderRadius: 6,\n },\n xs: {\n ...SIZES_BASE.xs,\n borderRadius: 4,\n },\n xxs: {\n ...SIZES_BASE.xxs,\n borderRadius: 4,\n },\n xxxs: {\n ...SIZES_BASE.xxxs,\n borderRadius: 4,\n },\n}\n\n/** @deprecated */\nexport const SIZES_ROUND: Record<Size, CSSProperties> = {\n xxxl: { ...SIZES_BASE.xxxl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxl: { ...SIZES_BASE.xxl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xl: { ...SIZES_BASE.xl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n l: { ...SIZES_BASE.l, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n m: { ...SIZES_BASE.m, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n s: { ...SIZES_BASE.s, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xs: { ...SIZES_BASE.xs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxs: { ...SIZES_BASE.xxs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxxs: { ...SIZES_BASE.xxxs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n}\n\nexport const SIZES_ICON: Record<Size, CSSProperties> = {\n xxxl: { fontSize: 28 },\n xxl: {\n fontSize: 28,\n },\n xl: { fontSize: 24 },\n l: { fontSize: 20 },\n m: { fontSize: 16 },\n s: { fontSize: 12 },\n xs: { fontSize: 10 },\n xxs: { fontSize: 10 },\n xxxs: { fontSize: 10 },\n}\n\nexport const SIZES_TEXT: Record<Size, CSSProperties> = {\n xxxl: { fontSize: 'inherit', marginTop: 0 },\n xxl: { fontSize: 'inherit', marginTop: 0 },\n xl: { fontSize: 'inherit', marginTop: 1 },\n l: { fontSize: 'inherit', marginTop: 2 },\n m: { fontSize: 'inherit', marginTop: 2 },\n s: { fontSize: 'inherit', marginTop: 2 },\n xs: { fontSize: 'inherit', marginTop: 0 },\n xxs: { fontSize: 'inherit', marginTop: 0 },\n xxxs: { fontSize: 'inherit', marginTop: 0 },\n}\n"],"names":["SIZES_BASE","xxxl","height","paddingRight","paddingLeft","fontSize","xxl","xl","l","m","s","xs","xxs","xxxs","SIZES_SQUARE","borderRadius","SIZES_ROUNDED","SIZES_ROUND","width","padding","marginTop"],"mappings":"aAGO,MAAMA,WAA0C,CACrDC,KAAM,CACJ,eAAgB,OAChBC,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZC,IAAK,CACH,eAAgB,OAChBJ,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZE,GAAI,CACF,eAAgB,OAChBL,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZG,EAAG,CACD,eAAgB,OAChBN,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZI,EAAG,CACD,eAAgB,OAChBP,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZK,EAAG,CACD,eAAgB,OAChBR,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZM,GAAI,CACF,eAAgB,OAChBT,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZO,IAAK,CACH,eAAgB,OAChBV,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZQ,KAAM,CACJ,eAAgB,OAChBX,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,KAIP,MAAMS,aAA4C,CACvDb,KAAM,IAAKD,WAAWC,KAAMc,aAAc,GAC1CT,IAAK,IAAKN,WAAWM,IAAKS,aAAc,GACxCR,GAAI,IAAKP,WAAWO,GAAIQ,aAAc,GACtCP,EAAG,IAAKR,WAAWQ,EAAGO,aAAc,GACpCN,EAAG,IAAKT,WAAWS,EAAGM,aAAc,GACpCL,EAAG,IAAKV,WAAWU,EAAGK,aAAc,GACpCJ,GAAI,IAAKX,WAAWW,GAAII,aAAc,GACtCH,IAAK,IAAKZ,WAAWY,IAAKG,aAAc,GACxCF,KAAM,IAAKb,WAAWa,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M,GAAI,CAAEN,SAAU,IAChBO,IAAK,CAAEP,SAAU,IACjBQ,KAAM,CAAER,SAAU,8HAGmC,CACrDJ,KAAM,CAAEI,SAAU,UAAWe,UAAW,GACxCd,IAAK,CAAED,SAAU,UAAWe,UAAW,GACvCb,GAAI,CAAEF,SAAU,UAAWe,UAAW,GACtCZ,EAAG,CAAEH,SAAU,UAAWe,UAAW,GACrCX,EAAG,CAAEJ,SAAU,UAAWe,UAAW,GACrCV,EAAG,CAAEL,SAAU,UAAWe,UAAW,GACrCT,GAAI,CAAEN,SAAU,UAAWe,UAAW,GACtCR,IAAK,CAAEP,SAAU,UAAWe,UAAW,GACvCP,KAAM,CAAER,SAAU,UAAWe,UAAW"}
@@ -0,0 +1,2 @@
1
+ const SIZES_BASE={xxxl:{'--badge-size':'36px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:22},xxl:{'--badge-size':'36px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:20},xl:{'--badge-size':'32px',height:'var(--badge-size)',paddingRight:10,paddingLeft:10,fontSize:18},l:{'--badge-size':'28px',height:'var(--badge-size)',paddingRight:8,paddingLeft:8,fontSize:16},m:{'--badge-size':'26px',height:'var(--badge-size)',paddingRight:8,paddingLeft:8,fontSize:14},s:{'--badge-size':'22px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:12},xs:{'--badge-size':'22px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10},xxs:{'--badge-size':'20px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10},xxxs:{'--badge-size':'18px',height:'var(--badge-size)',paddingRight:6,paddingLeft:6,fontSize:10}};const SIZES_SQUARE={xxxl:{...SIZES_BASE.xxxl,borderRadius:0},xxl:{...SIZES_BASE.xxl,borderRadius:0},xl:{...SIZES_BASE.xl,borderRadius:0},l:{...SIZES_BASE.l,borderRadius:0},m:{...SIZES_BASE.m,borderRadius:0},s:{...SIZES_BASE.s,borderRadius:0},xs:{...SIZES_BASE.xs,borderRadius:0},xxs:{...SIZES_BASE.xxs,borderRadius:0},xxxs:{...SIZES_BASE.xxxs,borderRadius:0}};const SIZES_ROUNDED={xxxl:{...SIZES_BASE.xxxl,borderRadius:10},xxl:{...SIZES_BASE.xxl,borderRadius:10},xl:{...SIZES_BASE.xl,borderRadius:8},l:{...SIZES_BASE.l,borderRadius:8},m:{...SIZES_BASE.m,borderRadius:8},s:{...SIZES_BASE.s,borderRadius:6},xs:{...SIZES_BASE.xs,borderRadius:4},xxs:{...SIZES_BASE.xxs,borderRadius:4},xxxs:{...SIZES_BASE.xxxs,borderRadius:4}};const SIZES_ROUND={xxxl:{...SIZES_BASE.xxxl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxl:{...SIZES_BASE.xxl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xl:{...SIZES_BASE.xl,width:'var(--badge-size)',padding:0,borderRadius:'50%'},l:{...SIZES_BASE.l,width:'var(--badge-size)',padding:0,borderRadius:'50%'},m:{...SIZES_BASE.m,width:'var(--badge-size)',padding:0,borderRadius:'50%'},s:{...SIZES_BASE.s,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xs:{...SIZES_BASE.xs,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxs:{...SIZES_BASE.xxs,width:'var(--badge-size)',padding:0,borderRadius:'50%'},xxxs:{...SIZES_BASE.xxxs,width:'var(--badge-size)',padding:0,borderRadius:'50%'}};const SIZES_ICON={xxxl:{fontSize:28},xxl:{fontSize:28},xl:{fontSize:24},l:{fontSize:20},m:{fontSize:16},s:{fontSize:12},xs:{fontSize:10},xxs:{fontSize:10},xxxs:{fontSize:10}};const SIZES_TEXT={xxxl:{fontSize:'inherit',marginTop:0},xxl:{fontSize:'inherit',marginTop:0},xl:{fontSize:'inherit',marginTop:1},l:{fontSize:'inherit',marginTop:2},m:{fontSize:'inherit',marginTop:2},s:{fontSize:'inherit',marginTop:2},xs:{fontSize:'inherit',marginTop:0},xxs:{fontSize:'inherit',marginTop:0},xxxs:{fontSize:'inherit',marginTop:0}};export{SIZES_BASE,SIZES_ICON,SIZES_ROUND,SIZES_ROUNDED,SIZES_SQUARE,SIZES_TEXT};
2
+ //# sourceMappingURL=sizes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.mjs","sources":["../../../../src/components/Badge/sizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport type { Size } from './types'\n\nexport const SIZES_BASE: Record<Size, CSSProperties> = {\n xxxl: {\n '--badge-size': '36px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 22,\n },\n xxl: {\n '--badge-size': '36px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 20,\n },\n xl: {\n '--badge-size': '32px',\n height: 'var(--badge-size)',\n paddingRight: 10,\n paddingLeft: 10,\n fontSize: 18,\n },\n l: {\n '--badge-size': '28px',\n height: 'var(--badge-size)',\n paddingRight: 8,\n paddingLeft: 8,\n fontSize: 16,\n },\n m: {\n '--badge-size': '26px',\n height: 'var(--badge-size)',\n paddingRight: 8,\n paddingLeft: 8,\n fontSize: 14,\n },\n s: {\n '--badge-size': '22px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 12,\n },\n xs: {\n '--badge-size': '22px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n xxs: {\n '--badge-size': '20px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n xxxs: {\n '--badge-size': '18px',\n height: 'var(--badge-size)',\n paddingRight: 6,\n paddingLeft: 6,\n fontSize: 10,\n },\n}\n\nexport const SIZES_SQUARE: Record<Size, CSSProperties> = {\n xxxl: { ...SIZES_BASE.xxxl, borderRadius: 0 },\n xxl: { ...SIZES_BASE.xxl, borderRadius: 0 },\n xl: { ...SIZES_BASE.xl, borderRadius: 0 },\n l: { ...SIZES_BASE.l, borderRadius: 0 },\n m: { ...SIZES_BASE.m, borderRadius: 0 },\n s: { ...SIZES_BASE.s, borderRadius: 0 },\n xs: { ...SIZES_BASE.xs, borderRadius: 0 },\n xxs: { ...SIZES_BASE.xxs, borderRadius: 0 },\n xxxs: { ...SIZES_BASE.xxxs, borderRadius: 0 },\n}\n\nexport const SIZES_ROUNDED: Record<Size, CSSProperties> = {\n xxxl: {\n ...SIZES_BASE.xxxl,\n borderRadius: 10,\n },\n xxl: {\n ...SIZES_BASE.xxl,\n borderRadius: 10,\n },\n xl: {\n ...SIZES_BASE.xl,\n borderRadius: 8,\n },\n l: {\n ...SIZES_BASE.l,\n borderRadius: 8,\n },\n m: {\n ...SIZES_BASE.m,\n borderRadius: 8,\n },\n s: {\n ...SIZES_BASE.s,\n borderRadius: 6,\n },\n xs: {\n ...SIZES_BASE.xs,\n borderRadius: 4,\n },\n xxs: {\n ...SIZES_BASE.xxs,\n borderRadius: 4,\n },\n xxxs: {\n ...SIZES_BASE.xxxs,\n borderRadius: 4,\n },\n}\n\n/** @deprecated */\nexport const SIZES_ROUND: Record<Size, CSSProperties> = {\n xxxl: { ...SIZES_BASE.xxxl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxl: { ...SIZES_BASE.xxl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xl: { ...SIZES_BASE.xl, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n l: { ...SIZES_BASE.l, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n m: { ...SIZES_BASE.m, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n s: { ...SIZES_BASE.s, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xs: { ...SIZES_BASE.xs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxs: { ...SIZES_BASE.xxs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n xxxs: { ...SIZES_BASE.xxxs, width: 'var(--badge-size)', padding: 0, borderRadius: '50%' },\n}\n\nexport const SIZES_ICON: Record<Size, CSSProperties> = {\n xxxl: { fontSize: 28 },\n xxl: {\n fontSize: 28,\n },\n xl: { fontSize: 24 },\n l: { fontSize: 20 },\n m: { fontSize: 16 },\n s: { fontSize: 12 },\n xs: { fontSize: 10 },\n xxs: { fontSize: 10 },\n xxxs: { fontSize: 10 },\n}\n\nexport const SIZES_TEXT: Record<Size, CSSProperties> = {\n xxxl: { fontSize: 'inherit', marginTop: 0 },\n xxl: { fontSize: 'inherit', marginTop: 0 },\n xl: { fontSize: 'inherit', marginTop: 1 },\n l: { fontSize: 'inherit', marginTop: 2 },\n m: { fontSize: 'inherit', marginTop: 2 },\n s: { fontSize: 'inherit', marginTop: 2 },\n xs: { fontSize: 'inherit', marginTop: 0 },\n xxs: { fontSize: 'inherit', marginTop: 0 },\n xxxs: { fontSize: 'inherit', marginTop: 0 },\n}\n"],"names":["SIZES_BASE","xxxl","height","paddingRight","paddingLeft","fontSize","xxl","xl","l","m","s","xs","xxs","xxxs","SIZES_SQUARE","borderRadius","SIZES_ROUNDED","SIZES_ROUND","width","padding","SIZES_ICON","SIZES_TEXT","marginTop"],"mappings":"AAGO,MAAMA,WAA0C,CACrDC,KAAM,CACJ,eAAgB,OAChBC,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZC,IAAK,CACH,eAAgB,OAChBJ,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZE,GAAI,CACF,eAAgB,OAChBL,OAAQ,oBACRC,aAAc,GACdC,YAAa,GACbC,SAAU,IAEZG,EAAG,CACD,eAAgB,OAChBN,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZI,EAAG,CACD,eAAgB,OAChBP,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAEZK,EAAG,CACD,eAAgB,OAChBR,OAAQ,oBACRC,aAAc,EACdC,YAAa,EACbC,SAAU,IAE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AAc,OAC9EP,EAAG,IAAKR,WAAWQ,EAAGU,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,OAC5EN,EAAG,IAAKT,WAAWS,EAAGS,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,OAC5EL,EAAG,IAAKV,WAAWU,EAAGQ,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,OAC5EJ,GAAI,IAAKX,WAAWW,GAAIO,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,OAC9EH,IAAK,IAAKZ,WAAWY,IAAKM,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,OAChFF,KAAM,IAAKb,WAAWa,KAAMK,MAAO,oBAAqBC,QAAS,EAAGJ,aAAc,QAG7E,MAAMK,WAA0C,CACrDnB,KAAM,CAAEI,SAAU,IAClBC,IAAK,CACHD,SAAU,IAEZE,GAAI,CAAEF,SAAU,IAChBG,EAAG,CAAEH,SAAU,IACfI,EAAG,CAAEJ,SAAU,IACfK,EAAG,CAAEL,SAAU,IACfM,GAAI,CAAEN,SAAU,IAChBO,IAAK,CAAEP,SAAU,IACjBQ,KAAM,CAAER,SAAU,KAGb,MAAMgB,WAA0C,CACrDpB,KAAM,CAAEI,SAAU,UAAWiB,UAAW,GACxChB,IAAK,CAAED,SAAU,UAAWiB,UAAW,GACvCf,GAAI,CAAEF,SAAU,UAAWiB,UAAW,GACtCd,EAAG,CAAEH,SAAU,UAAWiB,UAAW,GACrCb,EAAG,CAAEJ,SAAU,UAAWiB,UAAW,GACrCZ,EAAG,CAAEL,SAAU,UAAWiB,UAAW,GACrCX,GAAI,CAAEN,SAAU,UAAWiB,UAAW,GACtCV,IAAK,CAAEP,SAAU,UAAWiB,UAAW,GACvCT,KAAM,CAAER,SAAU,UAAWiB,UAAW"}
@@ -1,2 +1,2 @@
1
- 'use strict';var styled=require('styled-components');var color=require('../../mixins/color.js');var display=require('../../mixins/display.js');var responsiveSize=require('../../mixins/responsive-size.js');var responsiveMargin=require('../../mixins/responsive-margin.js');var style=require('../../shared/utils/style.js');var focus=require('../../mixins/focus.js');function _interopDefault(r){return r&&r.__esModule?r:{default:r}}var styled__default=_interopDefault(styled);const shouldForwardBadgeProp=style.createShouldForwardProp(r=>!['round','content','borderRadius','resetDefaultMargin','display','cursor'].includes(r));const template=r=>`\n color: ${r.color};\n background-color: ${r.backgroundColor};\n`;const COLOR_SCHEMA={primary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-primary-100'],...r.palette})),secondary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-secondary-100'],...r.palette})),tertiary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-tertiary-100'],...r.palette})),quaternary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-quaternary-100'],...r.palette}))};const Root=styled__default.default.div.withConfig({shouldForwardProp:shouldForwardBadgeProp}).attrs(r=>({dynamicSizeDeclaration:(e,o)=>({fontSize:typeof e=='string'?e:`${e}${o}`,height:'1.8em',width:r.round?'1.8em':void 0,paddingRight:r.round?void 0:'0.6em',paddingLeft:r.round?void 0:'0.6em'})})).withConfig({displayName:"Badge__Root",componentId:"ui__sc-h3lnrc-0"})([""," "," "," "," "," "," "," ",""],r=>`\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${r.round?'50%':typeof r.borderRadius=='number'?`${r.borderRadius}px`:r.borderRadius};\n cursor: ${r.cursor??'default'};\n `,r=>r.quaternary?COLOR_SCHEMA.quaternary:r.tertiary?COLOR_SCHEMA.tertiary:r.secondary?COLOR_SCHEMA.secondary:COLOR_SCHEMA.primary,focus.focus,responsiveSize.responsiveSize,responsiveMargin.responsiveMargin,r=>r.color&&color.color(r.color,'background-color'),r=>r.display&&display.display(r.display),r=>!r.resetDefaultMargin&&'&:not(:last-child) { margin-right: 8px; }');exports.Root=Root;
1
+ 'use strict';var styled=require('styled-components');var color=require('../../mixins/color.js');var display=require('../../mixins/display.js');var responsiveSize=require('../../mixins/responsive-size.js');var responsiveMargin=require('../../mixins/responsive-margin.js');var style=require('../../shared/utils/style.js');var focus=require('../../mixins/focus.js');function _interopDefault(r){return r&&r.__esModule?r:{default:r}}var styled__default=_interopDefault(styled);const shouldForwardBadgeProp=style.createShouldForwardProp(r=>!['round','shape','content','borderRadius','resetDefaultMargin','display','cursor','iconProps','textProps'].includes(r));const template=r=>`\n color: ${r.color};\n background-color: ${r.backgroundColor};\n`;const COLOR_SCHEMA={primary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-primary-100'],...r.palette})),secondary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-secondary-100'],...r.palette})),tertiary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-tertiary-100'],...r.palette})),quaternary:styled.css(["",""],r=>template({color:r.theme.colors['content-onmain-primary'],backgroundColor:r.theme.colors['bg-brand-quaternary-100'],...r.palette}))};const Root=styled__default.default.div.withConfig({shouldForwardProp:shouldForwardBadgeProp}).attrs(()=>({dynamicSizeDeclaration:(r,e)=>({fontSize:typeof r=='string'?r:`${r}${e}`,height:'1.8em'})})).withConfig({displayName:"Badge__Root",componentId:"ui__sc-h3lnrc-0"})([""," & > *:not(:last-child){margin-right:4px;}"," "," "," "," "," "," ",""],r=>`\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${typeof r.borderRadius=='number'?`${r.borderRadius}px`:r.borderRadius};\n cursor: ${r.cursor??'default'};\n `,r=>r.quaternary?COLOR_SCHEMA.quaternary:r.tertiary?COLOR_SCHEMA.tertiary:r.secondary?COLOR_SCHEMA.secondary:COLOR_SCHEMA.primary,focus.focus,responsiveSize.responsiveSize,responsiveMargin.responsiveMargin,r=>r.color&&color.color(r.color,'background-color'),r=>r.display&&display.display(r.display),r=>!r.resetDefaultMargin&&'&:not(:last-child) { margin-right: 8px; }');exports.Root=Root;
2
2
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sources":["../../../../src/components/Badge/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { display } from 'mixins/display'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { focus } from 'mixins/focus'\nimport type { StyledBadgeProps, BadgePalette } from './types'\n\nconst shouldForwardBadgeProp = createShouldForwardProp(\n (propKey) => !['round', 'content', 'borderRadius', 'resetDefaultMargin', 'display', 'cursor'].includes(propKey)\n)\n\nconst template = (palette: BadgePalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-primary-100'],\n ...props.palette,\n })}\n `,\n secondary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-secondary-100'],\n ...props.palette,\n })}\n `,\n tertiary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-tertiary-100'],\n ...props.palette,\n })}\n `,\n quaternary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-quaternary-100'],\n ...props.palette,\n })}\n `,\n}\n\nconst badgeStyles = (props: ThemedStyledProps<StyledBadgeProps, DefaultTheme>) => {\n if (props.quaternary) return COLOR_SCHEMA.quaternary\n if (props.tertiary) return COLOR_SCHEMA.tertiary\n if (props.secondary) return COLOR_SCHEMA.secondary\n\n return COLOR_SCHEMA.primary\n}\n\nexport const Root = styled.div\n .withConfig<StyledBadgeProps>({\n shouldForwardProp: shouldForwardBadgeProp,\n })\n .attrs<StyledBadgeProps>(\n (props): Required<Pick<StyledBadgeProps, 'dynamicSizeDeclaration'>> => ({\n dynamicSizeDeclaration: (size, sizeUnits) => {\n return {\n fontSize: typeof size === 'string' ? size : `${size}${sizeUnits}`,\n height: '1.8em',\n width: props.round ? '1.8em' : undefined,\n paddingRight: props.round ? undefined : '0.6em',\n paddingLeft: props.round ? undefined : '0.6em',\n }\n },\n })\n )`\n ${(props) => {\n const borderRadius = typeof props.borderRadius === 'number' ? `${props.borderRadius}px` : props.borderRadius\n\n return `\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${props.round ? '50%' : borderRadius};\n cursor: ${props.cursor ?? 'default'};\n `\n }}\n\n ${badgeStyles}\n ${focus}\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => props.color && color(props.color, 'background-color')}\n ${(props) => props.display && display(props.display)}\n ${(props) => !props.resetDefaultMargin && '&:not(:last-child) { margin-right: 8px; }'}\n`\n"],"names":["shouldForwardBadgeProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","COLOR_SCHEMA","primary","css","props","theme","colors","secondary","tertiary","quaternary","Root","styled","div","withConfig","shouldForwardProp","attrs","dynamicSizeDeclaration","size","sizeUnits","fontSize","height","width","round","undefined","paddingRight","paddingLeft","displayName","componentId","borderRadius","cursor","focus","responsiveSize","responsiveMargin","display","resetDefaultMargin"],"mappings":"wdAUA,MAAMA,uBAAyBC,MAAAA,wBAC5BC,IAAa,CAAC,QAAS,UAAW,eAAgB,qBAAsB,UAAW,UAAU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fA,EAAMK,WAAmBR,aAAaQ,WACtCL,EAAMI,SAAiBP,aAAaO,SACpCJ,EAAMG,UAAkBN,aAAaM,UAElCN,aAAaC,QAqClB4B,MAAAA,MACAC,eAAAA,eACAC,kCAEC5B,GAAUA,EAAML,OAASA,MAAAA,MAAMK,EAAML,MAAO,oBAC5CK,GAAUA,EAAM6B,SAAWA,QAAAA,QAAQ7B,EAAM6B,SACzC7B,IAAWA,EAAM8B,oBAAsB"}
1
+ {"version":3,"file":"style.js","sources":["../../../../src/components/Badge/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { display } from 'mixins/display'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { focus } from 'mixins/focus'\nimport type { StyledBadgeProps, BadgePalette } from './types'\n\nconst shouldForwardBadgeProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'round',\n 'shape',\n 'content',\n 'borderRadius',\n 'resetDefaultMargin',\n 'display',\n 'cursor',\n 'iconProps',\n 'textProps',\n ].includes(propKey)\n)\n\nconst template = (palette: BadgePalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-primary-100'],\n ...props.palette,\n })}\n `,\n secondary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-secondary-100'],\n ...props.palette,\n })}\n `,\n tertiary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-tertiary-100'],\n ...props.palette,\n })}\n `,\n quaternary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-quaternary-100'],\n ...props.palette,\n })}\n `,\n}\n\nconst badgeStyles = (props: ThemedStyledProps<StyledBadgeProps, DefaultTheme>) => {\n if (props.quaternary) return COLOR_SCHEMA.quaternary\n if (props.tertiary) return COLOR_SCHEMA.tertiary\n if (props.secondary) return COLOR_SCHEMA.secondary\n\n return COLOR_SCHEMA.primary\n}\n\nexport const Root = styled.div\n .withConfig<StyledBadgeProps>({\n shouldForwardProp: shouldForwardBadgeProp,\n })\n .attrs<StyledBadgeProps>(\n (): Required<Pick<StyledBadgeProps, 'dynamicSizeDeclaration'>> => ({\n dynamicSizeDeclaration: (size, sizeUnits) => ({\n fontSize: typeof size === 'string' ? size : `${size}${sizeUnits}`,\n height: '1.8em',\n }),\n })\n )`\n ${(props) => {\n const borderRadius = typeof props.borderRadius === 'number' ? `${props.borderRadius}px` : props.borderRadius\n\n return `\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${borderRadius};\n cursor: ${props.cursor ?? 'default'};\n `\n }}\n\n & > *:not(:last-child) {\n margin-right: 4px;\n }\n\n ${badgeStyles}\n ${focus}\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => props.color && color(props.color, 'background-color')}\n ${(props) => props.display && display(props.display)}\n ${(props) => !props.resetDefaultMargin && '&:not(:last-child) { margin-right: 8px; }'}\n`\n"],"names":["shouldForwardBadgeProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","COLOR_SCHEMA","primary","css","props","theme","colors","secondary","tertiary","quaternary","Root","styled","div","withConfig","shouldForwardProp","attrs","dynamicSizeDeclaration","size","sizeUnits","fontSize","height","displayName","componentId","borderRadius","cursor","focus","responsiveSize","responsiveMargin","display","resetDefaultMargin"],"mappings":"wdAUA,MAAMA,uBAAyBC,MAAAA,wBAC5BC,IACE,CACC,QACA,QACA,UACA,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BuB,MAAAA,MACAC,eAAAA,eACAC,kCAECvB,GAAUA,EAAML,OAASA,MAAAA,MAAMK,EAAML,MAAO,oBAC5CK,GAAUA,EAAMwB,SAAWA,QAAAA,QAAQxB,EAAMwB,SACzCxB,IAAWA,EAAMyB,oBAAsB"}
@@ -1,2 +1,2 @@
1
- import styled,{css}from'styled-components';import{color}from'../../mixins/color.mjs';import{display}from'../../mixins/display.mjs';import{responsiveSize}from'../../mixins/responsive-size.mjs';import{responsiveMargin}from'../../mixins/responsive-margin.mjs';import{createShouldForwardProp}from'../../shared/utils/style.mjs';import{focus}from'../../mixins/focus.mjs';const shouldForwardBadgeProp=createShouldForwardProp(o=>!['round','content','borderRadius','resetDefaultMargin','display','cursor'].includes(o));const template=o=>`\n color: ${o.color};\n background-color: ${o.backgroundColor};\n`;const COLOR_SCHEMA={primary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-primary-100'],...o.palette})),secondary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-secondary-100'],...o.palette})),tertiary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-tertiary-100'],...o.palette})),quaternary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-quaternary-100'],...o.palette}))};const Root=styled.div.withConfig({shouldForwardProp:shouldForwardBadgeProp}).attrs(o=>({dynamicSizeDeclaration:(r,e)=>({fontSize:typeof r=='string'?r:`${r}${e}`,height:'1.8em',width:o.round?'1.8em':void 0,paddingRight:o.round?void 0:'0.6em',paddingLeft:o.round?void 0:'0.6em'})})).withConfig({displayName:"Badge__Root",componentId:"ui__sc-h3lnrc-0"})([""," "," "," "," "," "," "," ",""],o=>`\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${o.round?'50%':typeof o.borderRadius=='number'?`${o.borderRadius}px`:o.borderRadius};\n cursor: ${o.cursor??'default'};\n `,o=>o.quaternary?COLOR_SCHEMA.quaternary:o.tertiary?COLOR_SCHEMA.tertiary:o.secondary?COLOR_SCHEMA.secondary:COLOR_SCHEMA.primary,focus,responsiveSize,responsiveMargin,o=>o.color&&color(o.color,'background-color'),o=>o.display&&display(o.display),o=>!o.resetDefaultMargin&&'&:not(:last-child) { margin-right: 8px; }');export{Root};
1
+ import styled,{css}from'styled-components';import{color}from'../../mixins/color.mjs';import{display}from'../../mixins/display.mjs';import{responsiveSize}from'../../mixins/responsive-size.mjs';import{responsiveMargin}from'../../mixins/responsive-margin.mjs';import{createShouldForwardProp}from'../../shared/utils/style.mjs';import{focus}from'../../mixins/focus.mjs';const shouldForwardBadgeProp=createShouldForwardProp(o=>!['round','shape','content','borderRadius','resetDefaultMargin','display','cursor','iconProps','textProps'].includes(o));const template=o=>`\n color: ${o.color};\n background-color: ${o.backgroundColor};\n`;const COLOR_SCHEMA={primary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-primary-100'],...o.palette})),secondary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-secondary-100'],...o.palette})),tertiary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-tertiary-100'],...o.palette})),quaternary:css(["",""],o=>template({color:o.theme.colors['content-onmain-primary'],backgroundColor:o.theme.colors['bg-brand-quaternary-100'],...o.palette}))};const Root=styled.div.withConfig({shouldForwardProp:shouldForwardBadgeProp}).attrs(()=>({dynamicSizeDeclaration:(o,r)=>({fontSize:typeof o=='string'?o:`${o}${r}`,height:'1.8em'})})).withConfig({displayName:"Badge__Root",componentId:"ui__sc-h3lnrc-0"})([""," & > *:not(:last-child){margin-right:4px;}"," "," "," "," "," "," ",""],o=>`\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${typeof o.borderRadius=='number'?`${o.borderRadius}px`:o.borderRadius};\n cursor: ${o.cursor??'default'};\n `,o=>o.quaternary?COLOR_SCHEMA.quaternary:o.tertiary?COLOR_SCHEMA.tertiary:o.secondary?COLOR_SCHEMA.secondary:COLOR_SCHEMA.primary,focus,responsiveSize,responsiveMargin,o=>o.color&&color(o.color,'background-color'),o=>o.display&&display(o.display),o=>!o.resetDefaultMargin&&'&:not(:last-child) { margin-right: 8px; }');export{Root};
2
2
  //# sourceMappingURL=style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","sources":["../../../../src/components/Badge/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { display } from 'mixins/display'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { focus } from 'mixins/focus'\nimport type { StyledBadgeProps, BadgePalette } from './types'\n\nconst shouldForwardBadgeProp = createShouldForwardProp(\n (propKey) => !['round', 'content', 'borderRadius', 'resetDefaultMargin', 'display', 'cursor'].includes(propKey)\n)\n\nconst template = (palette: BadgePalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-primary-100'],\n ...props.palette,\n })}\n `,\n secondary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-secondary-100'],\n ...props.palette,\n })}\n `,\n tertiary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-tertiary-100'],\n ...props.palette,\n })}\n `,\n quaternary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-quaternary-100'],\n ...props.palette,\n })}\n `,\n}\n\nconst badgeStyles = (props: ThemedStyledProps<StyledBadgeProps, DefaultTheme>) => {\n if (props.quaternary) return COLOR_SCHEMA.quaternary\n if (props.tertiary) return COLOR_SCHEMA.tertiary\n if (props.secondary) return COLOR_SCHEMA.secondary\n\n return COLOR_SCHEMA.primary\n}\n\nexport const Root = styled.div\n .withConfig<StyledBadgeProps>({\n shouldForwardProp: shouldForwardBadgeProp,\n })\n .attrs<StyledBadgeProps>(\n (props): Required<Pick<StyledBadgeProps, 'dynamicSizeDeclaration'>> => ({\n dynamicSizeDeclaration: (size, sizeUnits) => {\n return {\n fontSize: typeof size === 'string' ? size : `${size}${sizeUnits}`,\n height: '1.8em',\n width: props.round ? '1.8em' : undefined,\n paddingRight: props.round ? undefined : '0.6em',\n paddingLeft: props.round ? undefined : '0.6em',\n }\n },\n })\n )`\n ${(props) => {\n const borderRadius = typeof props.borderRadius === 'number' ? `${props.borderRadius}px` : props.borderRadius\n\n return `\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${props.round ? '50%' : borderRadius};\n cursor: ${props.cursor ?? 'default'};\n `\n }}\n\n ${badgeStyles}\n ${focus}\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => props.color && color(props.color, 'background-color')}\n ${(props) => props.display && display(props.display)}\n ${(props) => !props.resetDefaultMargin && '&:not(:last-child) { margin-right: 8px; }'}\n`\n"],"names":["shouldForwardBadgeProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","COLOR_SCHEMA","primary","css","props","theme","colors","secondary","tertiary","quaternary","Root","styled","div","withConfig","shouldForwardProp","attrs","dynamicSizeDeclaration","size","sizeUnits","fontSize","height","width","round","undefined","paddingRight","paddingLeft","displayName","componentId","borderRadius","cursor","focus","responsiveSize","responsiveMargin","display","resetDefaultMargin"],"mappings":"6WAUA,MAAMA,uBAAyBC,wBAC5BC,IAAa,CAAC,QAAS,UAAW,eAAgB,qBAAsB,UAAW,UAAUC,SAASD,IAGzG,MAAME,SAAYC,GAA0B,cACjCA,EAAQC,+BACGD,EAAQE,qBAG9B,MAAMC,aAAe,CACnBC,QAASC,IAAG,CAAA,GAAA,IACPC,GACDP,SAAS,CACPE,MAAOK,EAAMC,MAAMC,OAAO,0BAC1BN,gBAAiBI,EAAMC,MAAMC,OAAO,2BACjCF,EAAMN,WAGfS,UAAWJ,IAAG,CAAA,GAAA,IACTC,GACDP,SAAS,CACPE,MAAOK,EAAMC,MAAMC,OAAO,0BAC1BN,gBAAiBI,EAAMC,MAAMC,OAAO,6BACjCF,EAAMN,WAGfU,SAAUL,IAAG,CAAA,GAAA,IACRC,GACDP,SAAS,CACPE,MAAOK,EAAMC,MAAMC,OAAO,0BAC1BN,gBAAiBI,EAAMC,MAAMC,OAAO,4BACjCF,EAAMN,WAGfW,WAAYN,IAAG,CAAA,GAAA,IACVC,GACDP,SAAS,CACPE,MAAOK,EAAMC,MAAMC,OAAO,0BAC1BN,gBAAiBI,EAAMC,MAAMC,OAAO,8BACjCF,EAAMN,YAaV,MAAMY,KAAOC,OAAOC,IACxBC,WAA6B,CAC5BC,kBAAmBrB,yBAEpBsB,MACEX,IAAK,CACJY,uBAAwBA,CAACC,EAAMC,KACtB,CACLC,gBAAiBF,GAAS,SAAWA,EAAO,GAAGA,IAAOC,IACtDE,OAAQ,QACRC,MAAOjB,EAAMkB,MAAQ,aAAUC,EAC/BC,aAAcpB,EAAMkB,WAAQC,EAAY,QACxCE,YAAarB,EAAMkB,WAAQC,EAAY,aAI9CV,WAAA,CAAAa,YAAA,cAAAC,YAAA,mBAhBiBhB,CAgBjB,CAAA,GAAA,IAAA,IAAA,IAAA,IAAA,IAAA,IAAA,IAAA,IACEP,GAGM,+NAQYA,EAAMkB,MAAQ,aAVLlB,EAAMwB,cAAiB,SAAW,GAAGxB,EAAMwB,iBAAmBxB,EAAMwB,gCAWpFxB,EAAMyB,QAAU,mBArCXzB,GACfA,EAAMK,WAAmBR,aAAaQ,WACtCL,EAAMI,SAAiBP,aAAaO,SACpCJ,EAAMG,UAAkBN,aAAaM,UAElCN,aAAaC,QAqClB4B,MACAC,eACAC,iBAEC5B,GAAUA,EAAML,OAASA,MAAMK,EAAML,MAAO,oBAC5CK,GAAUA,EAAM6B,SAAWA,QAAQ7B,EAAM6B,SACzC7B,IAAWA,EAAM8B,oBAAsB"}
1
+ {"version":3,"file":"style.mjs","sources":["../../../../src/components/Badge/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport type { ThemedStyledProps, DefaultTheme } from 'styled-components'\nimport { color } from 'mixins/color'\nimport { display } from 'mixins/display'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { focus } from 'mixins/focus'\nimport type { StyledBadgeProps, BadgePalette } from './types'\n\nconst shouldForwardBadgeProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'round',\n 'shape',\n 'content',\n 'borderRadius',\n 'resetDefaultMargin',\n 'display',\n 'cursor',\n 'iconProps',\n 'textProps',\n ].includes(propKey)\n)\n\nconst template = (palette: BadgePalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-primary-100'],\n ...props.palette,\n })}\n `,\n secondary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-secondary-100'],\n ...props.palette,\n })}\n `,\n tertiary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-tertiary-100'],\n ...props.palette,\n })}\n `,\n quaternary: css<StyledBadgeProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-onmain-primary'],\n backgroundColor: props.theme.colors['bg-brand-quaternary-100'],\n ...props.palette,\n })}\n `,\n}\n\nconst badgeStyles = (props: ThemedStyledProps<StyledBadgeProps, DefaultTheme>) => {\n if (props.quaternary) return COLOR_SCHEMA.quaternary\n if (props.tertiary) return COLOR_SCHEMA.tertiary\n if (props.secondary) return COLOR_SCHEMA.secondary\n\n return COLOR_SCHEMA.primary\n}\n\nexport const Root = styled.div\n .withConfig<StyledBadgeProps>({\n shouldForwardProp: shouldForwardBadgeProp,\n })\n .attrs<StyledBadgeProps>(\n (): Required<Pick<StyledBadgeProps, 'dynamicSizeDeclaration'>> => ({\n dynamicSizeDeclaration: (size, sizeUnits) => ({\n fontSize: typeof size === 'string' ? size : `${size}${sizeUnits}`,\n height: '1.8em',\n }),\n })\n )`\n ${(props) => {\n const borderRadius = typeof props.borderRadius === 'number' ? `${props.borderRadius}px` : props.borderRadius\n\n return `\n box-sizing: border-box;\n isolation: isolate;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: max-content;\n flex-shrink: 0;\n border-radius: ${borderRadius};\n cursor: ${props.cursor ?? 'default'};\n `\n }}\n\n & > *:not(:last-child) {\n margin-right: 4px;\n }\n\n ${badgeStyles}\n ${focus}\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => props.color && color(props.color, 'background-color')}\n ${(props) => props.display && display(props.display)}\n ${(props) => !props.resetDefaultMargin && '&:not(:last-child) { margin-right: 8px; }'}\n`\n"],"names":["shouldForwardBadgeProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","COLOR_SCHEMA","primary","css","props","theme","colors","secondary","tertiary","quaternary","Root","styled","div","withConfig","shouldForwardProp","attrs","dynamicSizeDeclaration","size","sizeUnits","fontSize","height","displayName","componentId","borderRadius","cursor","focus","responsiveSize","responsiveM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CJ,EAAMG,UAAkBN,aAAaM,UAElCN,aAAaC,QAoClBuB,MACAC,eACAC,iBAECvB,GAAUA,EAAML,OAASA,MAAMK,EAAML,MAAO,oBAC5CK,GAAUA,EAAMwB,SAAWA,QAAQxB,EAAMwB,SACzCxB,IAAWA,EAAMyB,oBAAsB"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var style=require('./style.js');var constants=require('./constants.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');var IconButton=require('../IconButton/IconButton.js');var index=require('../../icon-pack/src/icons/HelpCircle/index.js');var Tooltip=require('../Tooltip/Tooltip.js');var Badge=require('../Badge/Badge.js');const FormLabel=withMergedProps.withMergedProps(React.forwardRef(({size:e="m",textProps:s={},hint:t={},badgeProps:r={},sizeXXS:n,sizeXS:i,sizeS:o,sizeM:a,sizeL:c,sizeXL:l,disabled:d,error:u,success:p,checked:x,children:j,control:m,label:b,...T},z)=>{const h={size:e,sizeXXS:n,sizeXS:i,sizeS:o,sizeM:a,sizeL:c,sizeXL:l};const S={disabled:d,error:u,success:p,checked:x};const B=typeof m=='object'&&typeof m.props=='object'&&m.props!==null?m.props:{};const{text:R,textProps:I={},buttonProps:L={},tooltipProps:g={}}=t;return jsxRuntime.jsxs(style.Root,{...T,...h,...S,ref:z,children:[jsxRuntime.jsx(style.Control,{children:typeof m=='function'?m({...h,...S}):React.cloneElement(m,{...h,...S,...B})}),jsxRuntime.jsxs(style.Content,{children:[jsxRuntime.jsx(Text.Text,{as:"span",appearance:"body",color:"inherit",wordBreak:"break-word",sizes:constants.SIZES_LABEL,...h,...s,children:b??j}),R?jsxRuntime.jsx(Text.Text,{as:"span",appearance:"caption",color:S.disabled?'content-disabled':'content-onmain-secondary',wordBreak:"break-word",sizes:constants.SIZES_SUBTITLE,...h,...I,children:R}):null]}),jsxRuntime.jsxs(style.Hint,{sizes:constants.SIZES_HINT,...h,children:[!L.onClick||g.title||g.content?null:jsxRuntime.jsx(IconButton.IconButton,{icon:jsxRuntime.jsx(index.HelpCircle,{}),marginLeft:2,...h,sizes:constants.SIZES_HINT_BUTTON,...L,disabled:S.disabled||L.disabled}),g.title||g.content?jsxRuntime.jsx(Tooltip.Tooltip,{preset:"brand",placement:"top",styles:{wrapper:{cursor:'inherit'}},...g,children:jsxRuntime.jsx(IconButton.IconButton,{icon:jsxRuntime.jsx(index.HelpCircle,{}),marginLeft:2,...h,sizes:constants.SIZES_HINT_BUTTON,...L,disabled:S.disabled||L.disabled})}):null,r.children?jsxRuntime.jsx(Badge.Badge,{size:"s",cursor:"inherit",marginLeft:6,resetDefaultMargin:!0,...r}):null]})]})}),{displayName:"FormLabel",sizes:constants.SIZES});exports.COMPONENT_NAME="FormLabel",exports.FormLabel=FormLabel;
1
+ 'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var style=require('./style.js');var constants=require('./constants.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');var IconButton=require('../IconButton/IconButton.js');var index=require('../../icon-pack/src/icons/HelpCircle/index.js');var Tooltip=require('../Tooltip/Tooltip.js');var Badge=require('../Badge/Badge.js');const FormLabel=withMergedProps.withMergedProps(React.forwardRef(({size:e="m",textProps:s={},hint:t={},badgeProps:r={},sizeXXS:n,sizeXS:i,sizeS:o,sizeM:a,sizeL:c,sizeXL:l,disabled:d,error:u,success:p,checked:x,children:j,control:m,label:b,...T},h)=>{const z={size:e,sizeXXS:n,sizeXS:i,sizeS:o,sizeM:a,sizeL:c,sizeXL:l};const S={disabled:d,error:u,success:p,checked:x};const B=typeof m=='object'&&typeof m.props=='object'&&m.props!==null?m.props:{};const{text:R,textProps:I={},buttonProps:L={},tooltipProps:g={}}=t;return jsxRuntime.jsxs(style.Root,{...T,...z,...S,ref:h,children:[jsxRuntime.jsx(style.Control,{children:typeof m=='function'?m({...z,...S}):React.cloneElement(m,{...z,...S,...B})}),jsxRuntime.jsxs(style.Content,{children:[jsxRuntime.jsx(Text.Text,{as:"span",appearance:"body",color:"inherit",wordBreak:"break-word",sizes:constants.SIZES_LABEL,...z,...s,children:b??j}),R?jsxRuntime.jsx(Text.Text,{as:"span",appearance:"caption",color:S.disabled?'content-disabled':'content-onmain-secondary',wordBreak:"break-word",sizes:constants.SIZES_SUBTITLE,...z,...I,children:R}):null]}),jsxRuntime.jsxs(style.Hint,{sizes:constants.SIZES_HINT,...z,children:[!L.onClick||g.title||g.content?null:jsxRuntime.jsx(IconButton.IconButton,{icon:jsxRuntime.jsx(index.HelpCircle,{}),marginLeft:2,...z,sizes:constants.SIZES_HINT_BUTTON,...L,disabled:S.disabled||L.disabled}),g.title||g.content?jsxRuntime.jsx(Tooltip.Tooltip,{preset:"brand",placement:"top",styles:{wrapper:{cursor:'inherit'}},...g,children:jsxRuntime.jsx(IconButton.IconButton,{icon:jsxRuntime.jsx(index.HelpCircle,{}),marginLeft:2,...z,sizes:constants.SIZES_HINT_BUTTON,...L,disabled:S.disabled||L.disabled})}):null,r.children?jsxRuntime.jsx(Badge.Badge,{size:"s",cursor:"inherit",marginLeft:6,resetDefaultMargin:!0,shape:"rounded",...r}):null]})]})}),{displayName:"FormLabel",sizes:constants.SIZES});exports.COMPONENT_NAME="FormLabel",exports.FormLabel=FormLabel;
2
2
  //# sourceMappingURL=FormLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.js","sources":["../../../../src/components/FormLabel/FormLabel.tsx"],"sourcesContent":["import { forwardRef, cloneElement } from 'react'\nimport { HelpCircle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { IconButton } from 'components/IconButton'\nimport { Badge } from 'components/Badge'\nimport { Tooltip } from 'components/Tooltip'\nimport * as Styled from './style'\nimport { SIZES, SIZES_LABEL, SIZES_HINT, SIZES_HINT_BUTTON, SIZES_SUBTITLE } from './constants'\nimport type { FormLabelProps } from './types'\n\nconst COMPONENT_NAME = 'FormLabel'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для контрола выбора с дополнительными элементами.\n * Позволяет добавить для контрола заголовок, подзаголовок, бейдж и подсказку.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<label\\> элемента.\n */\nconst FormLabel: React.ForwardRefExoticComponent<FormLabelProps> = withMergedProps<FormLabelProps, HTMLLabelElement>(\n forwardRef<HTMLLabelElement, MergedProps<FormLabelProps>>(\n (\n {\n size = 'm',\n textProps = {},\n hint = {},\n badgeProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n disabled,\n error,\n success,\n checked,\n children,\n control,\n label,\n ...props\n },\n ref\n ) => {\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const stateProps = {\n disabled,\n error,\n success,\n checked,\n }\n\n const elementProps =\n typeof control === 'object' && typeof control.props === 'object' && control.props !== null ? control.props : {}\n\n const {\n text: hintText,\n textProps: hintTextProps = {},\n buttonProps: hintButtonProps = {},\n tooltipProps: hintTooltipProps = {},\n } = hint\n\n return (\n <Styled.Root {...props} {...sizeProps} {...stateProps} ref={ref}>\n <Styled.Control>\n {typeof control === 'function'\n ? control({\n ...sizeProps,\n ...stateProps,\n })\n : cloneElement(control, {\n ...sizeProps,\n ...stateProps,\n ...elementProps,\n })}\n </Styled.Control>\n <Styled.Content>\n <Text\n as='span'\n appearance='body'\n color='inherit'\n wordBreak='break-word'\n sizes={SIZES_LABEL}\n {...sizeProps}\n {...textProps}\n >\n {label ?? children}\n </Text>\n {hintText ? (\n <Text\n as='span'\n appearance='caption'\n color={stateProps.disabled ? 'content-disabled' : 'content-onmain-secondary'}\n wordBreak='break-word'\n sizes={SIZES_SUBTITLE}\n {...sizeProps}\n {...hintTextProps}\n >\n {hintText}\n </Text>\n ) : null}\n </Styled.Content>\n\n <Styled.Hint sizes={SIZES_HINT} {...sizeProps}>\n {hintButtonProps.onClick && !hintTooltipProps.title && !hintTooltipProps.content ? (\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n ) : null}\n {hintTooltipProps.title || hintTooltipProps.content ? (\n <Tooltip\n preset='brand'\n placement='top'\n styles={{\n wrapper: { cursor: 'inherit' },\n }}\n {...hintTooltipProps}\n >\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n </Tooltip>\n ) : null}\n {badgeProps.children ? (\n <Badge size='s' cursor='inherit' marginLeft={6} resetDefaultMargin {...badgeProps} />\n ) : null}\n </Styled.Hint>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { FormLabel, COMPONENT_NAME }\n"],"names":["FormLabel","withMergedProps","forwardRef","size","textProps","hint","badgeProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","disabled","error","success","checked","children","control","label","props","ref","sizeProps","stateProps","elementProps","text","hintText","hintTextProps","buttonProps","hintButtonProps","tooltipProps","hintTooltipProps","_jsxs","Styled","_jsx","cloneElement","Text","as","appearance","color","wordBreak","sizes","SIZES_LABEL","SIZES_SUBTITLE","SIZES_HINT","onClick","title","content","IconButton","icon","HelpCircle","marginLeft","SIZES_HINT_BUTTON","Tooltip","preset","placement","styles","wrapper","cursor","Badge","resetDefaultMargin","displayName","SIZES"],"mappings":"0cAuBA,MAAMA,UAA6DC,gBAAAA,gBACjEC,MAAAA,WACE,EAEIC,OAAO,IACPC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,aAAa,CAAA,EACbC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,WACAC,QACAC,UACAC,UACAC,WACAC,UACAC,WACGC,GAELC,KA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VC,OAAQ,CACNC,QAAS,CAAEC,OAAQ,eAEjB3B,EAAgBd,SAEpBiB,WAAAA,IAACc,sBAAU,CACTC,KAAMf,WAAAA,IAACgB,MAAAA,eACPC,WAAY,KACR7B,EACJmB,MAAOW,UAAAA,qBACHvB,EACJhB,SAAUU,EAAWV,UAAYgB,EAAgBhB,aAGnD,KACHP,EAAWW,SACViB,WAAAA,IAACyB,MAAAA,MAAK,CAACxD,KAAK,IAAIuD,OAAO,UAAUP,WAAY,EAAGS,oBAAkB,KAAKtD,IACrE,aAMd,CACEuD,YA/ImB,YAgJnBpB,MAAOqB,UAAAA,+BAhJY"}
1
+ {"version":3,"file":"FormLabel.js","sources":["../../../../src/components/FormLabel/FormLabel.tsx"],"sourcesContent":["import { forwardRef, cloneElement } from 'react'\nimport { HelpCircle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { IconButton } from 'components/IconButton'\nimport { Badge } from 'components/Badge'\nimport { Tooltip } from 'components/Tooltip'\nimport * as Styled from './style'\nimport { SIZES, SIZES_LABEL, SIZES_HINT, SIZES_HINT_BUTTON, SIZES_SUBTITLE } from './constants'\nimport type { FormLabelProps } from './types'\n\nconst COMPONENT_NAME = 'FormLabel'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для контрола выбора с дополнительными элементами.\n * Позволяет добавить для контрола заголовок, подзаголовок, бейдж и подсказку.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<label\\> элемента.\n */\nconst FormLabel: React.ForwardRefExoticComponent<FormLabelProps> = withMergedProps<FormLabelProps, HTMLLabelElement>(\n forwardRef<HTMLLabelElement, MergedProps<FormLabelProps>>(\n (\n {\n size = 'm',\n textProps = {},\n hint = {},\n badgeProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n disabled,\n error,\n success,\n checked,\n children,\n control,\n label,\n ...props\n },\n ref\n ) => {\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const stateProps = {\n disabled,\n error,\n success,\n checked,\n }\n\n const elementProps =\n typeof control === 'object' && typeof control.props === 'object' && control.props !== null ? control.props : {}\n\n const {\n text: hintText,\n textProps: hintTextProps = {},\n buttonProps: hintButtonProps = {},\n tooltipProps: hintTooltipProps = {},\n } = hint\n\n return (\n <Styled.Root {...props} {...sizeProps} {...stateProps} ref={ref}>\n <Styled.Control>\n {typeof control === 'function'\n ? control({\n ...sizeProps,\n ...stateProps,\n })\n : cloneElement(control, {\n ...sizeProps,\n ...stateProps,\n ...elementProps,\n })}\n </Styled.Control>\n <Styled.Content>\n <Text\n as='span'\n appearance='body'\n color='inherit'\n wordBreak='break-word'\n sizes={SIZES_LABEL}\n {...sizeProps}\n {...textProps}\n >\n {label ?? children}\n </Text>\n {hintText ? (\n <Text\n as='span'\n appearance='caption'\n color={stateProps.disabled ? 'content-disabled' : 'content-onmain-secondary'}\n wordBreak='break-word'\n sizes={SIZES_SUBTITLE}\n {...sizeProps}\n {...hintTextProps}\n >\n {hintText}\n </Text>\n ) : null}\n </Styled.Content>\n\n <Styled.Hint sizes={SIZES_HINT} {...sizeProps}>\n {hintButtonProps.onClick && !hintTooltipProps.title && !hintTooltipProps.content ? (\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n ) : null}\n {hintTooltipProps.title || hintTooltipProps.content ? (\n <Tooltip\n preset='brand'\n placement='top'\n styles={{\n wrapper: { cursor: 'inherit' },\n }}\n {...hintTooltipProps}\n >\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n </Tooltip>\n ) : null}\n {badgeProps.children ? (\n <Badge size='s' cursor='inherit' marginLeft={6} resetDefaultMargin shape='rounded' {...badgeProps} />\n ) : null}\n </Styled.Hint>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { FormLabel, COMPONENT_NAME }\n"],"names":["FormLabel","withMergedProps","forwardRef","size","textProps","hint","badgeProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","disabled","error","success","checked","children","control","label","props","ref","sizeProps","stateProps","elementProps","text","hintText","hintTextProps","buttonProps","hintButtonProps","tooltipProps","hintTooltipProps","_jsxs","Styled","_jsx","cloneElement","Text","as","appearance","color","wordBreak","sizes","SIZES_LABEL","SIZES_SUBTITLE","SIZES_HINT","onClick","title","content","IconButton","icon","HelpCircle","marginLeft","SIZES_HINT_BUTTON","Tooltip","preset","placement","styles","wrapper","cursor","Badge","resetDefaultMargin","shape","displayName","SIZES"],"mappings":"0cAuBA,MAAMA,UAA6DC,gBAAAA,gBACjEC,MAAAA,WACE,EAEIC,OAAO,IACPC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,aAAa,CAAA,EACbC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,WACAC,QACAC,UACAC,UACAC,WACAC,UACAC,WACGC,GAELC,KAEA,MAAMC,EAAY,CAChBnB,OACAI,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMW,EAAa,CACjBV,WACAC,QACAC,UACAC,WAGF,MAAMQ,SACGN,GAAY,iBAAmBA,EAAQE,OAAU,UAAYF,EAAQE,QAAU,KAAOF,EAAQE,MAAQ,CAAA,EAE/G,MACEK,KAAMC,EACNtB,UAAWuB,EAAgB,CAAA,EAC3BC,YAAaC,EAAkB,CAAA,EAC/BC,aAAcC,EAAmB,CAAA,GAC/B1B,EAEJ,OACE2B,WAAAA,KAACC,MAAAA,KAAW,IAAKb,KAAWE,KAAeC,EAAYF,IAAKA,EAAIJ,SAAA,CAC9DiB,WAAAA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- import{forwardRef,cloneElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{Root,Control,Content,Hint}from'./style.mjs';import{SIZES,SIZES_LABEL,SIZES_SUBTITLE,SIZES_HINT,SIZES_HINT_BUTTON}from'./constants.mjs';import{jsxs,jsx}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';import{IconButton}from'../IconButton/IconButton.mjs';import{HelpCircle}from'../../icon-pack/src/icons/HelpCircle/index.mjs';import{Tooltip}from'../Tooltip/Tooltip.mjs';import{Badge}from'../Badge/Badge.mjs';const COMPONENT_NAME='FormLabel';const FormLabel=withMergedProps(forwardRef(({size:e="m",textProps:o={},hint:s={},badgeProps:r={},sizeXXS:t,sizeXS:i,sizeS:n,sizeM:l,sizeL:c,sizeXL:a,disabled:p,error:d,success:m,checked:S,children:T,control:j,label:x,...b},f)=>{const I={size:e,sizeXXS:t,sizeXS:i,sizeS:n,sizeM:l,sizeL:c,sizeXL:a};const z={disabled:p,error:d,success:m,checked:S};const E=typeof j=='object'&&typeof j.props=='object'&&j.props!==null?j.props:{};const{text:h,textProps:u={},buttonProps:B={},tooltipProps:L={}}=s;return jsxs(Root,{...b,...I,...z,ref:f,children:[jsx(Control,{children:typeof j=='function'?j({...I,...z}):cloneElement(j,{...I,...z,...E})}),jsxs(Content,{children:[jsx(Text,{as:"span",appearance:"body",color:"inherit",wordBreak:"break-word",sizes:SIZES_LABEL,...I,...o,children:x??T}),h?jsx(Text,{as:"span",appearance:"caption",color:z.disabled?'content-disabled':'content-onmain-secondary',wordBreak:"break-word",sizes:SIZES_SUBTITLE,...I,...u,children:h}):null]}),jsxs(Hint,{sizes:SIZES_HINT,...I,children:[!B.onClick||L.title||L.content?null:jsx(IconButton,{icon:jsx(HelpCircle,{}),marginLeft:2,...I,sizes:SIZES_HINT_BUTTON,...B,disabled:z.disabled||B.disabled}),L.title||L.content?jsx(Tooltip,{preset:"brand",placement:"top",styles:{wrapper:{cursor:'inherit'}},...L,children:jsx(IconButton,{icon:jsx(HelpCircle,{}),marginLeft:2,...I,sizes:SIZES_HINT_BUTTON,...B,disabled:z.disabled||B.disabled})}):null,r.children?jsx(Badge,{size:"s",cursor:"inherit",marginLeft:6,resetDefaultMargin:!0,...r}):null]})]})}),{displayName:"FormLabel",sizes:SIZES});export{COMPONENT_NAME,FormLabel};
1
+ import{forwardRef,cloneElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{Root,Control,Content,Hint}from'./style.mjs';import{SIZES,SIZES_LABEL,SIZES_SUBTITLE,SIZES_HINT,SIZES_HINT_BUTTON}from'./constants.mjs';import{jsxs,jsx}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';import{IconButton}from'../IconButton/IconButton.mjs';import{HelpCircle}from'../../icon-pack/src/icons/HelpCircle/index.mjs';import{Tooltip}from'../Tooltip/Tooltip.mjs';import{Badge}from'../Badge/Badge.mjs';const COMPONENT_NAME='FormLabel';const FormLabel=withMergedProps(forwardRef(({size:e="m",textProps:o={},hint:s={},badgeProps:r={},sizeXXS:t,sizeXS:i,sizeS:n,sizeM:l,sizeL:c,sizeXL:a,disabled:d,error:p,success:m,checked:S,children:T,control:j,label:x,...b},f)=>{const I={size:e,sizeXXS:t,sizeXS:i,sizeS:n,sizeM:l,sizeL:c,sizeXL:a};const z={disabled:d,error:p,success:m,checked:S};const E=typeof j=='object'&&typeof j.props=='object'&&j.props!==null?j.props:{};const{text:h,textProps:u={},buttonProps:B={},tooltipProps:L={}}=s;return jsxs(Root,{...b,...I,...z,ref:f,children:[jsx(Control,{children:typeof j=='function'?j({...I,...z}):cloneElement(j,{...I,...z,...E})}),jsxs(Content,{children:[jsx(Text,{as:"span",appearance:"body",color:"inherit",wordBreak:"break-word",sizes:SIZES_LABEL,...I,...o,children:x??T}),h?jsx(Text,{as:"span",appearance:"caption",color:z.disabled?'content-disabled':'content-onmain-secondary',wordBreak:"break-word",sizes:SIZES_SUBTITLE,...I,...u,children:h}):null]}),jsxs(Hint,{sizes:SIZES_HINT,...I,children:[!B.onClick||L.title||L.content?null:jsx(IconButton,{icon:jsx(HelpCircle,{}),marginLeft:2,...I,sizes:SIZES_HINT_BUTTON,...B,disabled:z.disabled||B.disabled}),L.title||L.content?jsx(Tooltip,{preset:"brand",placement:"top",styles:{wrapper:{cursor:'inherit'}},...L,children:jsx(IconButton,{icon:jsx(HelpCircle,{}),marginLeft:2,...I,sizes:SIZES_HINT_BUTTON,...B,disabled:z.disabled||B.disabled})}):null,r.children?jsx(Badge,{size:"s",cursor:"inherit",marginLeft:6,resetDefaultMargin:!0,shape:"rounded",...r}):null]})]})}),{displayName:"FormLabel",sizes:SIZES});export{COMPONENT_NAME,FormLabel};
2
2
  //# sourceMappingURL=FormLabel.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormLabel.mjs","sources":["../../../../src/components/FormLabel/FormLabel.tsx"],"sourcesContent":["import { forwardRef, cloneElement } from 'react'\nimport { HelpCircle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { IconButton } from 'components/IconButton'\nimport { Badge } from 'components/Badge'\nimport { Tooltip } from 'components/Tooltip'\nimport * as Styled from './style'\nimport { SIZES, SIZES_LABEL, SIZES_HINT, SIZES_HINT_BUTTON, SIZES_SUBTITLE } from './constants'\nimport type { FormLabelProps } from './types'\n\nconst COMPONENT_NAME = 'FormLabel'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для контрола выбора с дополнительными элементами.\n * Позволяет добавить для контрола заголовок, подзаголовок, бейдж и подсказку.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<label\\> элемента.\n */\nconst FormLabel: React.ForwardRefExoticComponent<FormLabelProps> = withMergedProps<FormLabelProps, HTMLLabelElement>(\n forwardRef<HTMLLabelElement, MergedProps<FormLabelProps>>(\n (\n {\n size = 'm',\n textProps = {},\n hint = {},\n badgeProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n disabled,\n error,\n success,\n checked,\n children,\n control,\n label,\n ...props\n },\n ref\n ) => {\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const stateProps = {\n disabled,\n error,\n success,\n checked,\n }\n\n const elementProps =\n typeof control === 'object' && typeof control.props === 'object' && control.props !== null ? control.props : {}\n\n const {\n text: hintText,\n textProps: hintTextProps = {},\n buttonProps: hintButtonProps = {},\n tooltipProps: hintTooltipProps = {},\n } = hint\n\n return (\n <Styled.Root {...props} {...sizeProps} {...stateProps} ref={ref}>\n <Styled.Control>\n {typeof control === 'function'\n ? control({\n ...sizeProps,\n ...stateProps,\n })\n : cloneElement(control, {\n ...sizeProps,\n ...stateProps,\n ...elementProps,\n })}\n </Styled.Control>\n <Styled.Content>\n <Text\n as='span'\n appearance='body'\n color='inherit'\n wordBreak='break-word'\n sizes={SIZES_LABEL}\n {...sizeProps}\n {...textProps}\n >\n {label ?? children}\n </Text>\n {hintText ? (\n <Text\n as='span'\n appearance='caption'\n color={stateProps.disabled ? 'content-disabled' : 'content-onmain-secondary'}\n wordBreak='break-word'\n sizes={SIZES_SUBTITLE}\n {...sizeProps}\n {...hintTextProps}\n >\n {hintText}\n </Text>\n ) : null}\n </Styled.Content>\n\n <Styled.Hint sizes={SIZES_HINT} {...sizeProps}>\n {hintButtonProps.onClick && !hintTooltipProps.title && !hintTooltipProps.content ? (\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n ) : null}\n {hintTooltipProps.title || hintTooltipProps.content ? (\n <Tooltip\n preset='brand'\n placement='top'\n styles={{\n wrapper: { cursor: 'inherit' },\n }}\n {...hintTooltipProps}\n >\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n </Tooltip>\n ) : null}\n {badgeProps.children ? (\n <Badge size='s' cursor='inherit' marginLeft={6} resetDefaultMargin {...badgeProps} />\n ) : null}\n </Styled.Hint>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { FormLabel, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","FormLabel","withMergedProps","forwardRef","size","textProps","hint","badgeProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","disabled","error","success","checked","children","control","label","props","ref","sizeProps","stateProps","elementProps","text","hintText","hintTextProps","buttonProps","hintButtonProps","tooltipProps","hintTooltipProps","_jsxs","Styled","_jsx","cloneElement","Text","as","appearance","color","wordBreak","sizes","SIZES_LABEL","SIZES_SUBTITLE","SIZES_HINT","onClick","title","content","IconButton","icon","HelpCircle","marginLeft","SIZES_HINT_BUTTON","Tooltip","preset","placement","styles","wrapper","cursor","Badge","resetDefaultMargin","displayName","SIZES"],"mappings":"8gBAYA,MAAMA,eAAiB,YAWvB,MAAMC,UAA6DC,gBACjEC,WACE,EAEIC,OAAO,IACPC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,aAAa,CAAA,EACbC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,WACAC,QACAC,UACAC,UACAC,WACAC,UACAC,WACGC,GAELC,KAEA,MAAMC,EAAY,CAChBnB,OACAI,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMW,EAAa,CACjBV,WACAC,QACAC,UACAC,WAGF,MAAMQ,SACGN,GAAY,iBAAmBA,EAAQE,OAAU,UAAYF,EAAQE,QAAU,KAAOF,EAAQE,MAAQ,CAAA,EAE/G,MACEK,KAAMC,EACNtB,UAAWuB,EAAgB,CAAA,EAC3BC,YAAaC,EAAkB,CAAA,EAC/BC,aAAcC,EAAmB,CAAA,GAC/B1B,EAEJ,OACE2B,KAACC,KAAW,IAAKb,KAAWE,KAAeC,EAAYF,IAAKA,EAAIJ,SAAA,CAC9DiB,IAACD,QAAc,CAAAhB,gBACLC,GAAY,WAChBA,EAAQ,IACHI,KACAC,IAELY,aAAajB,EAAS,IACjBI,KACAC,KACAC,MAGXQ,KAACC,QAAc,CAAAhB,SAAA,CACbiB,IAACE,KAAI,CACHC,GAAG,OACHC,WAAW,OACXC,MAAM,UACNC,UAAU,aACVC,MAAOC,eACHpB,KACAlB,EAASa,SAEZE,GAASF,IAEXS,EACCQ,IAACE,KAAI,CACHC,GAAG,OACHC,WAAW,UACXC,MAAOhB,EAAWV,SAAW,mBAAqB,2BAClD2B,UAAU,aACVC,MAAOE,kBACHrB,KACAK,EAAaV,SAEhBS,IAED,QAGNM,KAACC,KAAW,CAACQ,MAAOG,cAAgBtB,EAASL,WAC1CY,EAAgBgB,SAAYd,EAAiBe,OAAUf,EAAiBgB,QASrE,KARFb,IAACc,WAAU,CACTC,KAAMf,IAACgB,eACPC,WAAY,KACR7B,EACJmB,MAAOW,qBACHvB,EACJhB,SAAUU,EAAWV,UAAYgB,EAAgBhB,WAGpDkB,EAAiBe,OAASf,EAAiBgB,QAC1Cb,IAACmB,QAAO,CACNC,OAAO,QACPC,UAAU,MACVC,OAAQ,CACNC,QAAS,CAAEC,OAAQ,eAEjB3B,EAAgBd,SAEpBiB,IAACc,WAAU,CACTC,KAAMf,IAACgB,eACPC,WAAY,KACR7B,EACJmB,MAAOW,qBACHvB,EACJhB,SAAUU,EAAWV,UAAYgB,EAAgBhB,aAGnD,KACHP,EAAWW,SACViB,IAACyB,MAAK,CAACxD,KAAK,IAAIuD,OAAO,UAAUP,WAAY,EAAGS,oBAAkB,KAAKtD,IACrE,aAMd,CACEuD,YA/ImB,YAgJnBpB,MAAOqB"}
1
+ {"version":3,"file":"FormLabel.mjs","sources":["../../../../src/components/FormLabel/FormLabel.tsx"],"sourcesContent":["import { forwardRef, cloneElement } from 'react'\nimport { HelpCircle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { IconButton } from 'components/IconButton'\nimport { Badge } from 'components/Badge'\nimport { Tooltip } from 'components/Tooltip'\nimport * as Styled from './style'\nimport { SIZES, SIZES_LABEL, SIZES_HINT, SIZES_HINT_BUTTON, SIZES_SUBTITLE } from './constants'\nimport type { FormLabelProps } from './types'\n\nconst COMPONENT_NAME = 'FormLabel'\n\n/**\n *\n * *v1.0.0*\n *\n * Компонент для контрола выбора с дополнительными элементами.\n * Позволяет добавить для контрола заголовок, подзаголовок, бейдж и подсказку.\n *\n * Поддерживается \"ref\" и все нативные атрибуты \\<label\\> элемента.\n */\nconst FormLabel: React.ForwardRefExoticComponent<FormLabelProps> = withMergedProps<FormLabelProps, HTMLLabelElement>(\n forwardRef<HTMLLabelElement, MergedProps<FormLabelProps>>(\n (\n {\n size = 'm',\n textProps = {},\n hint = {},\n badgeProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n disabled,\n error,\n success,\n checked,\n children,\n control,\n label,\n ...props\n },\n ref\n ) => {\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const stateProps = {\n disabled,\n error,\n success,\n checked,\n }\n\n const elementProps =\n typeof control === 'object' && typeof control.props === 'object' && control.props !== null ? control.props : {}\n\n const {\n text: hintText,\n textProps: hintTextProps = {},\n buttonProps: hintButtonProps = {},\n tooltipProps: hintTooltipProps = {},\n } = hint\n\n return (\n <Styled.Root {...props} {...sizeProps} {...stateProps} ref={ref}>\n <Styled.Control>\n {typeof control === 'function'\n ? control({\n ...sizeProps,\n ...stateProps,\n })\n : cloneElement(control, {\n ...sizeProps,\n ...stateProps,\n ...elementProps,\n })}\n </Styled.Control>\n <Styled.Content>\n <Text\n as='span'\n appearance='body'\n color='inherit'\n wordBreak='break-word'\n sizes={SIZES_LABEL}\n {...sizeProps}\n {...textProps}\n >\n {label ?? children}\n </Text>\n {hintText ? (\n <Text\n as='span'\n appearance='caption'\n color={stateProps.disabled ? 'content-disabled' : 'content-onmain-secondary'}\n wordBreak='break-word'\n sizes={SIZES_SUBTITLE}\n {...sizeProps}\n {...hintTextProps}\n >\n {hintText}\n </Text>\n ) : null}\n </Styled.Content>\n\n <Styled.Hint sizes={SIZES_HINT} {...sizeProps}>\n {hintButtonProps.onClick && !hintTooltipProps.title && !hintTooltipProps.content ? (\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n ) : null}\n {hintTooltipProps.title || hintTooltipProps.content ? (\n <Tooltip\n preset='brand'\n placement='top'\n styles={{\n wrapper: { cursor: 'inherit' },\n }}\n {...hintTooltipProps}\n >\n <IconButton\n icon={<HelpCircle />}\n marginLeft={2}\n {...sizeProps}\n sizes={SIZES_HINT_BUTTON}\n {...hintButtonProps}\n disabled={stateProps.disabled || hintButtonProps.disabled}\n />\n </Tooltip>\n ) : null}\n {badgeProps.children ? (\n <Badge size='s' cursor='inherit' marginLeft={6} resetDefaultMargin shape='rounded' {...badgeProps} />\n ) : null}\n </Styled.Hint>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { FormLabel, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","FormLabel","withMergedProps","forwardRef","size","textProps","hint","badgeProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","disabled","error","success","checked","children","control","label","props","ref","sizeProps","stateProps","elementProps","text","hintText","hintTextProps","buttonProps","hintButtonProps","tooltipProps","hintTooltipProps","_jsxs","Styled","_jsx","cloneElement","Text","as","appearance","color","wordBreak","sizes","SIZES_LABEL","SIZES_SUBTITLE","SIZES_HINT","onClick","title","content","IconButton","icon","HelpCircle","marginLeft","SIZES_HINT_BUTTON","Tooltip","preset","placement","styles","wrapper","cursor","Badge","resetDefaultMargin","shape","displayName","SIZES"],"mappings":"8gBAYA,MAAMA,eAAiB,YAWvB,MAAMC,UAA6DC,gBACjEC,WACE,EAEIC,OAAO,IACPC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,aAAa,CAAA,EACbC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,WACAC,QACAC,UACAC,UACAC,WACAC,UACAC,WACGC,GAELC,KAEA,MAAMC,EAAY,CAChBnB,OACAI,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMW,EAAa,CACjBV,WACAC,QACAC,UACAC,WAGF,MAAMQ,SACGN,GAAY,iBAAmBA,EAAQE,OAAU,UAAYF,EAAQE,QAAU,KAAOF,EAAQE,MAAQ,CAAA,EAE/G,MACEK,KAAMC,EACNtB,UAAWuB,EAAgB,CAAA,EAC3BC,YAAaC,EAAkB,CAAA,EAC/BC,aAAcC,EAAmB,CAAA,GAC/B1B,EAEJ,OACE2B,KAACC,KAAW,IAAKb,KAAWE,KAAeC,EAAYF,IAAKA,EAAIJ,SAAA,CAC9DiB,IAACD,QAAc,CAAAhB,gBACLC,GAAY,WAChBA,EAAQ,IACHI,KACAC,IAELY,aAAajB,EAAS,IACjBI,KACAC,KACAC,MAGXQ,KAACC,QAAc,CAAAhB,SAAA,CACbiB,IAACE,KAAI,CACHC,GAAG,OACHC,WAAW,OACXC,MAAM,UACNC,UAAU,aACVC,MAAOC,eACHpB,KACAlB,EAASa,SAEZE,GAASF,IAEXS,EACCQ,IAACE,KAAI,CACHC,GAAG,OACHC,WAAW,UACXC,MAAOhB,EAAWV,SAAW,mBAAqB,2BAClD2B,UAAU,aACVC,MAAOE,kBACHrB,KACAK,EAAaV,SAEhBS,IAED,QAGNM,KAACC,KAAW,CAACQ,MAAOG,cAAgBtB,EAASL,WAC1CY,EAAgBgB,SAAYd,EAAiBe,OAAUf,EAAiBgB,QASrE,KARFb,IAACc,WAAU,CACTC,KAAMf,IAACgB,eACPC,WAAY,KACR7B,EACJmB,MAAOW,qBACHvB,EACJhB,SAAUU,EAAWV,UAAYgB,EAAgBhB,WAGpDkB,EAAiBe,OAASf,EAAiBgB,QAC1Cb,IAACmB,QAAO,CACNC,OAAO,QACPC,UAAU,MACVC,OAAQ,CACNC,QAAS,CAAEC,OAAQ,eAEjB3B,EAAgBd,SAEpBiB,IAACc,WAAU,CACTC,KAAMf,IAACgB,eACPC,WAAY,KACR7B,EACJmB,MAAOW,qBACHvB,EACJhB,SAAUU,EAAWV,UAAYgB,EAAgBhB,aAGnD,KACHP,EAAWW,SACViB,IAACyB,MAAK,CAACxD,KAAK,IAAIuD,OAAO,UAAUP,WAAY,EAAGS,oBAAkB,EAACC,MAAM,aAAcvD,IACrF,aAMd,CACEwD,YA/ImB,YAgJnBrB,MAAOsB"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var sizes=require('./sizes.js');var layouts=require('./layouts.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var AspectRatio=require('../AspectRatio/AspectRatio.js');var Skeleton=require('../Skeleton/Skeleton.js');var Badge=require('../Badge/Badge.js');var Text=require('../Text/Text.js');var Button=require('../Button/Button.js');var index=require('../../icon-pack/src/icons/Close/index.js');const PopoverComponent=withMergedProps.withMergedProps(React.forwardRef((e,t)=>{const{size:s="s",layout:i="vertical",sizeXXS:n,sizeXS:o,sizeS:r,sizeM:a,sizeL:l,sizeXL:u,layoutXXS:c,layoutXS:d,layoutS:x,layoutM:j,layoutL:m,layoutXL:p,root:R,badge:y,caption:S,header:h,title:g,content:z,body:T,closeButton:f,media:E,footer:k,imgSrcVertical:B,imgSrcHorizontal:I,loading:b,palette:v,closeFn:w,...P}=e;const A={size:s,sizeXXS:n,sizeXS:o,sizeS:r,sizeM:a,sizeL:l,sizeXL:u};const L={layout:i,layoutXXS:c,layoutXS:d,layoutS:x,layoutM:j,layoutL:m,layoutXL:p};const X={...A,borderRadius:8,marginRight:12,resetDefaultMargin:!0,sizes:sizes.SIZES_HEADER_BADGE};const C={...A,as:'span',appearance:'caption',color:'content-onmain-tertiary',weight:700,wordBreak:'break-word',sizes:sizes.SIZES_CAPTION};const V={...A,as:'h2',appearance:'subheading',color:'inherit',marginBottom:z?'0.4em':void 0,wordBreak:'break-word',sizes:sizes.SIZES_TITLE};const q={...A,as:'p',appearance:'body',color:'inherit',wordBreak:'break-word',sizes:sizes.SIZES_CONTENT};const _={...A,icon:jsxRuntime.jsx(index.Close,{}),square:!0,marginTop:10,marginRight:10,sizes:sizes.SIZES_CLOSE_BUTTON,onClick:()=>{typeof w=='function'&&w()}};return jsxRuntime.jsx(style.Root,{...P,...A,...L,layouts:layouts.LAYOUTS,palette:v,ref:t,children:React.isValidElement(R)?R:typeof R=='function'?R({badgeProps:X,captionProps:C,titleProps:V,contentProps:q,closeButtonProps:_}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b||E||I?jsxRuntime.jsx(style.Media,{...L,layouts:layouts.VISIBILITY_HORIZONTAL,children:b?jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"1:1",width:"100%",children:jsxRuntime.jsx(Skeleton.Skeleton,{})}):React.isValidElement(E)?E:jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"1:1",width:"100%",children:jsxRuntime.jsx(style.Img,{src:I})})}):null,jsxRuntime.jsxs(style.Container,{children:[jsxRuntime.jsxs(style.Content,{children:[b?jsxRuntime.jsx(style.Header,{children:jsxRuntime.jsx(Skeleton.Skeleton,{width:"20%",children:jsxRuntime.jsx(Badge.Badge,{...X})})}):React.isValidElement(h)?h:typeof h=='function'?h({badgeProps:X,captionProps:C}):y||S?jsxRuntime.jsxs(style.Header,{children:[React.isValidElement(y)?y:typeof y=='function'?y(X):typeof y=='string'||typeof y=='number'?jsxRuntime.jsx(Badge.Badge,{...X,children:y}):null,React.isValidElement(S)?S:typeof S=='function'?S(C):typeof S=='string'||typeof S=='number'?jsxRuntime.jsx(Text.Text,{...C,children:S}):null]}):null,b||E||B?jsxRuntime.jsx(style.Media,{...L,layouts:layouts.VISIBILITY_VERTICAL,children:b?jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"16:9",width:"100%",children:jsxRuntime.jsx(Skeleton.Skeleton,{})}):React.isValidElement(E)?E:jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"16:9",width:"100%",children:jsxRuntime.jsx(style.Img,{src:B})})}):null,b?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,children:jsxRuntime.jsx(Text.Text,{appearance:"subheading",marginBottom:"0.4em",sizes:sizes.SIZES_TITLE,...A})}),jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,width:"70%",children:jsxRuntime.jsx(Text.Text,{appearance:"body",marginBottom:"0.4em",sizes:sizes.SIZES_CONTENT,...A})}),jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,width:"50%",children:jsxRuntime.jsx(Text.Text,{appearance:"body",sizes:sizes.SIZES_CONTENT,...A})})]}):React.isValidElement(T)?T:typeof T=='function'?T({titleProps:V,contentProps:q}):g||z?jsxRuntime.jsxs("div",{children:[React.isValidElement(g)?g:typeof g=='function'?g(V):typeof g=='string'||typeof g=='number'?jsxRuntime.jsx(Text.Text,{...V,children:g}):null,React.isValidElement(z)?z:typeof z=='function'?z(q):typeof z=='string'||typeof z=='number'?jsxRuntime.jsx(Text.Text,{...q,children:z}):null]}):null]}),k?jsxRuntime.jsx(style.Footer,{children:b?jsxRuntime.jsx(Skeleton.Skeleton,{width:"100%",children:jsxRuntime.jsx(Button.Button,{preset:"brand",...A})}):React.isValidElement(k)?k:null}):null]}),f?jsxRuntime.jsx(style.ButtonPosition,{children:React.isValidElement(f)?f:typeof f=='function'?f(_):null}):null]})})}),{displayName:'PopoverComponent',sizes:sizes.SIZES});exports.PopoverComponent=PopoverComponent;
1
+ 'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var sizes=require('./sizes.js');var layouts=require('./layouts.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var AspectRatio=require('../AspectRatio/AspectRatio.js');var Skeleton=require('../Skeleton/Skeleton.js');var Badge=require('../Badge/Badge.js');var Text=require('../Text/Text.js');var Button=require('../Button/Button.js');var index=require('../../icon-pack/src/icons/Close/index.js');const PopoverComponent=withMergedProps.withMergedProps(React.forwardRef((e,t)=>{const{size:s="s",layout:i="vertical",sizeXXS:n,sizeXS:o,sizeS:r,sizeM:a,sizeL:l,sizeXL:u,layoutXXS:c,layoutXS:d,layoutS:x,layoutM:j,layoutL:m,layoutXL:p,root:R,badge:y,caption:S,header:h,title:g,content:z,body:T,closeButton:f,media:E,footer:k,imgSrcVertical:B,imgSrcHorizontal:I,loading:b,palette:v,closeFn:w,...P}=e;const A={size:s,sizeXXS:n,sizeXS:o,sizeS:r,sizeM:a,sizeL:l,sizeXL:u};const L={layout:i,layoutXXS:c,layoutXS:d,layoutS:x,layoutM:j,layoutL:m,layoutXL:p};const X={...A,shape:'rounded',marginRight:12,resetDefaultMargin:!0,sizes:sizes.SIZES_HEADER_BADGE};const C={...A,as:'span',appearance:'caption',color:'content-onmain-tertiary',weight:700,wordBreak:'break-word',sizes:sizes.SIZES_CAPTION};const V={...A,as:'h2',appearance:'subheading',color:'inherit',marginBottom:z?'0.4em':void 0,wordBreak:'break-word',sizes:sizes.SIZES_TITLE};const q={...A,as:'p',appearance:'body',color:'inherit',wordBreak:'break-word',sizes:sizes.SIZES_CONTENT};const _={...A,icon:jsxRuntime.jsx(index.Close,{}),square:!0,marginTop:10,marginRight:10,sizes:sizes.SIZES_CLOSE_BUTTON,onClick:()=>{typeof w=='function'&&w()}};return jsxRuntime.jsx(style.Root,{...P,...A,...L,layouts:layouts.LAYOUTS,palette:v,ref:t,children:React.isValidElement(R)?R:typeof R=='function'?R({badgeProps:X,captionProps:C,titleProps:V,contentProps:q,closeButtonProps:_}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b||E||I?jsxRuntime.jsx(style.Media,{...L,layouts:layouts.VISIBILITY_HORIZONTAL,children:b?jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"1:1",width:"100%",children:jsxRuntime.jsx(Skeleton.Skeleton,{})}):React.isValidElement(E)?E:jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"1:1",width:"100%",children:jsxRuntime.jsx(style.Img,{src:I})})}):null,jsxRuntime.jsxs(style.Container,{children:[jsxRuntime.jsxs(style.Content,{children:[b?jsxRuntime.jsx(style.Header,{children:jsxRuntime.jsx(Skeleton.Skeleton,{width:"20%",children:jsxRuntime.jsx(Badge.Badge,{...X})})}):React.isValidElement(h)?h:typeof h=='function'?h({badgeProps:X,captionProps:C}):y||S?jsxRuntime.jsxs(style.Header,{children:[React.isValidElement(y)?y:typeof y=='function'?y(X):typeof y=='string'||typeof y=='number'?jsxRuntime.jsx(Badge.Badge,{...X,children:y}):null,React.isValidElement(S)?S:typeof S=='function'?S(C):typeof S=='string'||typeof S=='number'?jsxRuntime.jsx(Text.Text,{...C,children:S}):null]}):null,b||E||B?jsxRuntime.jsx(style.Media,{...L,layouts:layouts.VISIBILITY_VERTICAL,children:b?jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"16:9",width:"100%",children:jsxRuntime.jsx(Skeleton.Skeleton,{})}):React.isValidElement(E)?E:jsxRuntime.jsx(AspectRatio.AspectRatio,{ratio:"16:9",width:"100%",children:jsxRuntime.jsx(style.Img,{src:B})})}):null,b?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,children:jsxRuntime.jsx(Text.Text,{appearance:"subheading",marginBottom:"0.4em",sizes:sizes.SIZES_TITLE,...A})}),jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,width:"70%",children:jsxRuntime.jsx(Text.Text,{appearance:"body",marginBottom:"0.4em",sizes:sizes.SIZES_CONTENT,...A})}),jsxRuntime.jsx(Skeleton.Skeleton,{borderRadius:4,width:"50%",children:jsxRuntime.jsx(Text.Text,{appearance:"body",sizes:sizes.SIZES_CONTENT,...A})})]}):React.isValidElement(T)?T:typeof T=='function'?T({titleProps:V,contentProps:q}):g||z?jsxRuntime.jsxs("div",{children:[React.isValidElement(g)?g:typeof g=='function'?g(V):typeof g=='string'||typeof g=='number'?jsxRuntime.jsx(Text.Text,{...V,children:g}):null,React.isValidElement(z)?z:typeof z=='function'?z(q):typeof z=='string'||typeof z=='number'?jsxRuntime.jsx(Text.Text,{...q,children:z}):null]}):null]}),k?jsxRuntime.jsx(style.Footer,{children:b?jsxRuntime.jsx(Skeleton.Skeleton,{width:"100%",children:jsxRuntime.jsx(Button.Button,{preset:"brand",...A})}):React.isValidElement(k)?k:null}):null]}),f?jsxRuntime.jsx(style.ButtonPosition,{children:React.isValidElement(f)?f:typeof f=='function'?f(_):null}):null]})})}),{displayName:'PopoverComponent',sizes:sizes.SIZES});exports.PopoverComponent=PopoverComponent;
2
2
  //# sourceMappingURL=PopoverComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverComponent.js","sources":["../../../../src/components/PopoverComponent/PopoverComponent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from 'react'\nimport { Close } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Badge } from 'components/Badge'\nimport { Text } from 'components/Text'\nimport { Button } from 'components/Button'\nimport { Skeleton } from 'components/Skeleton'\nimport { AspectRatio } from 'components/AspectRatio'\nimport type { IconButtonProps } from 'components/IconButton'\nimport type { BadgeProps } from 'components/Badge'\nimport type { TextProps } from 'components/Text'\nimport { SIZES, SIZES_CLOSE_BUTTON, SIZES_HEADER_BADGE, SIZES_CAPTION, SIZES_TITLE, SIZES_CONTENT } from './sizes'\nimport { LAYOUTS, VISIBILITY_HORIZONTAL, VISIBILITY_VERTICAL } from './layouts'\nimport * as Styled from './style'\nimport type { PopoverComponentProps } from './types'\n\nconst COMPONENT_NAME = 'PopoverComponent'\n\nconst PopoverComponent: React.ForwardRefExoticComponent<PopoverComponentProps> = withMergedProps<\n PopoverComponentProps,\n HTMLDivElement\n>(\n forwardRef<HTMLDivElement, MergedProps<PopoverComponentProps>>((props, ref) => {\n const {\n size = 's',\n layout = 'vertical',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n layoutXXS,\n layoutXS,\n layoutS,\n layoutM,\n layoutL,\n layoutXL,\n root,\n badge,\n caption,\n header,\n title,\n content,\n body,\n closeButton,\n media,\n footer,\n imgSrcVertical,\n imgSrcHorizontal,\n loading,\n palette,\n closeFn,\n ...restProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const layoutProps = {\n layout,\n layoutXXS,\n layoutXS,\n layoutS,\n layoutM,\n layoutL,\n layoutXL,\n }\n\n const badgeProps: BadgeProps = {\n ...sizeProps,\n borderRadius: 8,\n marginRight: 12,\n resetDefaultMargin: true,\n sizes: SIZES_HEADER_BADGE,\n }\n\n const captionProps: TextProps = {\n ...sizeProps,\n as: 'span',\n appearance: 'caption',\n color: 'content-onmain-tertiary',\n weight: 700,\n wordBreak: 'break-word',\n sizes: SIZES_CAPTION,\n }\n\n const titleProps: TextProps = {\n ...sizeProps,\n as: 'h2',\n appearance: 'subheading',\n color: 'inherit',\n marginBottom: content ? '0.4em' : undefined,\n wordBreak: 'break-word',\n sizes: SIZES_TITLE,\n }\n\n const contentProps: TextProps = {\n ...sizeProps,\n as: 'p',\n appearance: 'body',\n color: 'inherit',\n wordBreak: 'break-word',\n sizes: SIZES_CONTENT,\n }\n\n const closeButtonProps: IconButtonProps = {\n ...sizeProps,\n icon: <Close />,\n square: true,\n marginTop: 10,\n marginRight: 10,\n sizes: SIZES_CLOSE_BUTTON,\n onClick: () => {\n if (typeof closeFn === 'function') closeFn()\n },\n }\n\n return (\n <Styled.Root {...restProps} {...sizeProps} {...layoutProps} layouts={LAYOUTS} palette={palette} ref={ref}>\n {isValidElement(root) ? (\n root\n ) : typeof root === 'function' ? (\n root({\n badgeProps,\n captionProps,\n titleProps,\n contentProps,\n closeButtonProps,\n })\n ) : (\n <>\n {loading || media || imgSrcHorizontal ? (\n <Styled.Media {...layoutProps} layouts={VISIBILITY_HORIZONTAL}>\n {loading ? (\n <AspectRatio ratio='1:1' width='100%'>\n <Skeleton />\n </AspectRatio>\n ) : isValidElement(media) ? (\n media\n ) : (\n <AspectRatio ratio='1:1' width='100%'>\n <Styled.Img src={imgSrcHorizontal} />\n </AspectRatio>\n )}\n </Styled.Media>\n ) : null}\n <Styled.Container>\n <Styled.Content>\n {loading ? (\n <Styled.Header>\n <Skeleton width='20%'>\n <Badge {...badgeProps} />\n </Skeleton>\n </Styled.Header>\n ) : isValidElement(header) ? (\n header\n ) : typeof header === 'function' ? (\n header({\n badgeProps,\n captionProps,\n })\n ) : badge || caption ? (\n <Styled.Header>\n {isValidElement(badge) ? (\n badge\n ) : typeof badge === 'function' ? (\n badge(badgeProps)\n ) : typeof badge === 'string' || typeof badge === 'number' ? (\n <Badge {...badgeProps}>{badge}</Badge>\n ) : null}\n {isValidElement(caption) ? (\n caption\n ) : typeof caption === 'function' ? (\n caption(captionProps)\n ) : typeof caption === 'string' || typeof caption === 'number' ? (\n <Text {...captionProps}>{caption}</Text>\n ) : null}\n </Styled.Header>\n ) : null}\n {loading || media || imgSrcVertical ? (\n <Styled.Media {...layoutProps} layouts={VISIBILITY_VERTICAL}>\n {loading ? (\n <AspectRatio ratio='16:9' width='100%'>\n <Skeleton />\n </AspectRatio>\n ) : isValidElement(media) ? (\n media\n ) : (\n <AspectRatio ratio='16:9' width='100%'>\n <Styled.Img src={imgSrcVertical} />\n </AspectRatio>\n )}\n </Styled.Media>\n ) : null}\n {loading ? (\n <div>\n <Skeleton borderRadius={4}>\n <Text appearance='subheading' marginBottom='0.4em' sizes={SIZES_TITLE} {...sizeProps} />\n </Skeleton>\n <Skeleton borderRadius={4} width='70%'>\n <Text appearance='body' marginBottom='0.4em' sizes={SIZES_CONTENT} {...sizeProps} />\n </Skeleton>\n <Skeleton borderRadius={4} width='50%'>\n <Text appearance='body' sizes={SIZES_CONTENT} {...sizeProps} />\n </Skeleton>\n </div>\n ) : isValidElement(body) ? (\n body\n ) : typeof body === 'function' ? (\n body({\n titleProps,\n contentProps,\n })\n ) : title || content ? (\n <div>\n {isValidElement(title) ? (\n title\n ) : typeof title === 'function' ? (\n title(titleProps)\n ) : typeof title === 'string' || typeof title === 'number' ? (\n <Text {...titleProps}>{title}</Text>\n ) : null}\n {isValidElement(content) ? (\n content\n ) : typeof content === 'function' ? (\n content(contentProps)\n ) : typeof content === 'string' || typeof content === 'number' ? (\n <Text {...contentProps}>{content}</Text>\n ) : null}\n </div>\n ) : null}\n </Styled.Content>\n {footer ? (\n <Styled.Footer>\n {loading ? (\n <Skeleton width='100%'>\n <Button preset='brand' {...sizeProps} />\n </Skeleton>\n ) : isValidElement(footer) ? (\n footer\n ) : null}\n </Styled.Footer>\n ) : null}\n </Styled.Container>\n {closeButton ? (\n <Styled.ButtonPosition>\n {isValidElement(closeButton)\n ? closeButton\n : typeof closeButton === 'function'\n ? closeButton(closeButtonProps)\n : null}\n </Styled.ButtonPosition>\n ) : null}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { PopoverComponent }\n"],"names":["PopoverComponent","withMergedProps","forwardRef","props","ref","size","layout","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","layoutXXS","layoutXS","layoutS","layoutM","layoutL","layoutXL","root","badge","caption","header","title","content","body","closeButton","media","footer","imgSrcVertical","imgSrcHorizontal","loading","palette","closeFn","restProps","sizeProps","layoutProps","badgeProps","borderRadius","marginRight","resetDefaultMargin","sizes","SIZES_HEADER_BADGE","captionProps","as","appearance","color","weight","wordBreak","SIZES_CAPTION","titleProps","marginBottom","undefined","SIZES_TITLE","contentProps","SIZES_CONTENT","closeButtonProps","icon","_jsx","Close","square","marginTop","SIZES_CLOSE_BUTTON","onClick","Styled","layouts","LAYOUTS","children","isValidElement","_jsxs","_Fragment","VISIBILITY_HORIZONTAL","AspectRatio","ratio","width","Skeleton","src","Badge","Text","VISIBILITY_VERTICAL","Button","preset","displayName","SIZES"],"mappings":"ihBAmBA,MAAMA,iBAA2EC,gBAAAA,gBAI/EC,MAAAA,WAA+D,CAACC,EAAOC,KACrE,MAAMC,KACJA,EAAO,IAAGC,OACVA,EAAS,WAAUC,QACnBA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,KACRA,EAAIC,MACJA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,QACLA,EAAOC,KACPA,EAAIC,YACJA,EAAWC,MACXA,EAAKC,OACLA,EAAMC,eACNA,EAAcC,iBACdA,EAAgBC,QAChBA,EAAOC,QACPA,EAAOC,QACPA,KACGC,GACD/B,EAEJ,MAAMgC,EAAY,CAChB9B,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMwB,EAAc,CAClB9B,SACAO,YACAC,WACAC,UACAC,UACAC,UACAC,YAGF,MAAMmB,EAAyB,IAC1BF,EACHG,aAAc,EACdC,YAAa,GACbC,oBAAoB,EACpBC,MAAOC,MAAAA,oBAGT,MAAMC,EAA0B,IAC3BR,EACHS,GAAI,OACJC,WAAY,UACZC,MAAO,0BACPC,OAAQ,IACRC,UAAW,aACXP,MAAOQ,MAAAA,eAGT,MAAMC,EAAwB,IACzBf,EACHS,GAAI,KACJC,WAAY,aACZC,MAAO,UACPK,aAAc3B,EAAU,aAAU4B,EAClCJ,UAAW,aACXP,MAAOY,MAAAA,aAGT,MAAMC,EAA0B,IAC3BnB,EACHS,GAAI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AAU,SAChDmC,WAAAA,IAACoB,UAAI,IAAK5B,EAAUiB,SAAG5C,IACrB,KACH6C,qBAAe5C,GACdA,SACSA,GAAY,WACrBA,EAAQ8B,UACC9B,GAAY,iBAAmBA,GAAY,SACpDkC,WAAAA,IAACoB,UAAI,IAAKxB,EAAYa,SAAG3C,IACvB,QAEJ,QAELI,EACC8B,WAAAA,IAACM,aAAa,CAAAG,SACXpC,EACC2B,WAAAA,IAACiB,kBAAQ,CAACD,MAAM,OAAMP,SACpBT,WAAAA,IAACsB,cAAM,CAACC,OAAO,WAAY9C,MAE3BiC,MAAAA,eAAexC,GACjBA,EACE,OAEJ,QAELF,EACCgC,WAAAA,IAACM,qBAAqB,CAAAG,SACnBC,MAAAA,eAAe1C,GACZA,SACOA,GAAgB,WACrBA,EAAY8B,GACZ,OAEN,YAMd,CACE0B,YA3PmB,mBA4PnBzC,MAAO0C,MAAAA"}
1
+ {"version":3,"file":"PopoverComponent.js","sources":["../../../../src/components/PopoverComponent/PopoverComponent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from 'react'\nimport { Close } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Badge } from 'components/Badge'\nimport { Text } from 'components/Text'\nimport { Button } from 'components/Button'\nimport { Skeleton } from 'components/Skeleton'\nimport { AspectRatio } from 'components/AspectRatio'\nimport type { IconButtonProps } from 'components/IconButton'\nimport type { BadgeProps } from 'components/Badge'\nimport type { TextProps } from 'components/Text'\nimport { SIZES, SIZES_CLOSE_BUTTON, SIZES_HEADER_BADGE, SIZES_CAPTION, SIZES_TITLE, SIZES_CONTENT } from './sizes'\nimport { LAYOUTS, VISIBILITY_HORIZONTAL, VISIBILITY_VERTICAL } from './layouts'\nimport * as Styled from './style'\nimport type { PopoverComponentProps } from './types'\n\nconst COMPONENT_NAME = 'PopoverComponent'\n\nconst PopoverComponent: React.ForwardRefExoticComponent<PopoverComponentProps> = withMergedProps<\n PopoverComponentProps,\n HTMLDivElement\n>(\n forwardRef<HTMLDivElement, MergedProps<PopoverComponentProps>>((props, ref) => {\n const {\n size = 's',\n layout = 'vertical',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n layoutXXS,\n layoutXS,\n layoutS,\n layoutM,\n layoutL,\n layoutXL,\n root,\n badge,\n caption,\n header,\n title,\n content,\n body,\n closeButton,\n media,\n footer,\n imgSrcVertical,\n imgSrcHorizontal,\n loading,\n palette,\n closeFn,\n ...restProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const layoutProps = {\n layout,\n layoutXXS,\n layoutXS,\n layoutS,\n layoutM,\n layoutL,\n layoutXL,\n }\n\n const badgeProps: BadgeProps = {\n ...sizeProps,\n shape: 'rounded',\n marginRight: 12,\n resetDefaultMargin: true,\n sizes: SIZES_HEADER_BADGE,\n }\n\n const captionProps: TextProps = {\n ...sizeProps,\n as: 'span',\n appearance: 'caption',\n color: 'content-onmain-tertiary',\n weight: 700,\n wordBreak: 'break-word',\n sizes: SIZES_CAPTION,\n }\n\n const titleProps: TextProps = {\n ...sizeProps,\n as: 'h2',\n appearance: 'subheading',\n color: 'inherit',\n marginBottom: content ? '0.4em' : undefined,\n wordBreak: 'break-word',\n sizes: SIZES_TITLE,\n }\n\n const contentProps: TextProps = {\n ...sizeProps,\n as: 'p',\n appearance: 'body',\n color: 'inherit',\n wordBreak: 'break-word',\n sizes: SIZES_CONTENT,\n }\n\n const closeButtonProps: IconButtonProps = {\n ...sizeProps,\n icon: <Close />,\n square: true,\n marginTop: 10,\n marginRight: 10,\n sizes: SIZES_CLOSE_BUTTON,\n onClick: () => {\n if (typeof closeFn === 'function') closeFn()\n },\n }\n\n return (\n <Styled.Root {...restProps} {...sizeProps} {...layoutProps} layouts={LAYOUTS} palette={palette} ref={ref}>\n {isValidElement(root) ? (\n root\n ) : typeof root === 'function' ? (\n root({\n badgeProps,\n captionProps,\n titleProps,\n contentProps,\n closeButtonProps,\n })\n ) : (\n <>\n {loading || media || imgSrcHorizontal ? (\n <Styled.Media {...layoutProps} layouts={VISIBILITY_HORIZONTAL}>\n {loading ? (\n <AspectRatio ratio='1:1' width='100%'>\n <Skeleton />\n </AspectRatio>\n ) : isValidElement(media) ? (\n media\n ) : (\n <AspectRatio ratio='1:1' width='100%'>\n <Styled.Img src={imgSrcHorizontal} />\n </AspectRatio>\n )}\n </Styled.Media>\n ) : null}\n <Styled.Container>\n <Styled.Content>\n {loading ? (\n <Styled.Header>\n <Skeleton width='20%'>\n <Badge {...badgeProps} />\n </Skeleton>\n </Styled.Header>\n ) : isValidElement(header) ? (\n header\n ) : typeof header === 'function' ? (\n header({\n badgeProps,\n captionProps,\n })\n ) : badge || caption ? (\n <Styled.Header>\n {isValidElement(badge) ? (\n badge\n ) : typeof badge === 'function' ? (\n badge(badgeProps)\n ) : typeof badge === 'string' || typeof badge === 'number' ? (\n <Badge {...badgeProps}>{badge}</Badge>\n ) : null}\n {isValidElement(caption) ? (\n caption\n ) : typeof caption === 'function' ? (\n caption(captionProps)\n ) : typeof caption === 'string' || typeof caption === 'number' ? (\n <Text {...captionProps}>{caption}</Text>\n ) : null}\n </Styled.Header>\n ) : null}\n {loading || media || imgSrcVertical ? (\n <Styled.Media {...layoutProps} layouts={VISIBILITY_VERTICAL}>\n {loading ? (\n <AspectRatio ratio='16:9' width='100%'>\n <Skeleton />\n </AspectRatio>\n ) : isValidElement(media) ? (\n media\n ) : (\n <AspectRatio ratio='16:9' width='100%'>\n <Styled.Img src={imgSrcVertical} />\n </AspectRatio>\n )}\n </Styled.Media>\n ) : null}\n {loading ? (\n <div>\n <Skeleton borderRadius={4}>\n <Text appearance='subheading' marginBottom='0.4em' sizes={SIZES_TITLE} {...sizeProps} />\n </Skeleton>\n <Skeleton borderRadius={4} width='70%'>\n <Text appearance='body' marginBottom='0.4em' sizes={SIZES_CONTENT} {...sizeProps} />\n </Skeleton>\n <Skeleton borderRadius={4} width='50%'>\n <Text appearance='body' sizes={SIZES_CONTENT} {...sizeProps} />\n </Skeleton>\n </div>\n ) : isValidElement(body) ? (\n body\n ) : typeof body === 'function' ? (\n body({\n titleProps,\n contentProps,\n })\n ) : title || content ? (\n <div>\n {isValidElement(title) ? (\n title\n ) : typeof title === 'function' ? (\n title(titleProps)\n ) : typeof title === 'string' || typeof title === 'number' ? (\n <Text {...titleProps}>{title}</Text>\n ) : null}\n {isValidElement(content) ? (\n content\n ) : typeof content === 'function' ? (\n content(contentProps)\n ) : typeof content === 'string' || typeof content === 'number' ? (\n <Text {...contentProps}>{content}</Text>\n ) : null}\n </div>\n ) : null}\n </Styled.Content>\n {footer ? (\n <Styled.Footer>\n {loading ? (\n <Skeleton width='100%'>\n <Button preset='brand' {...sizeProps} />\n </Skeleton>\n ) : isValidElement(footer) ? (\n footer\n ) : null}\n </Styled.Footer>\n ) : null}\n </Styled.Container>\n {closeButton ? (\n <Styled.ButtonPosition>\n {isValidElement(closeButton)\n ? closeButton\n : typeof closeButton === 'function'\n ? closeButton(closeButtonProps)\n : null}\n </Styled.ButtonPosition>\n ) : null}\n </>\n )}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { PopoverComponent }\n"],"names":["PopoverComponent","withMergedProps","forwardRef","props","ref","size","layout","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","layoutXXS","layoutXS","layoutS","layoutM","layoutL","layoutXL","root","badge","caption","header","title","content","body","closeButton","media","footer","imgSrcVertical","imgSrcHorizontal","loading","palette","closeFn","restProps","sizeProps","layoutProps","badgeProps","shape","marginRight","resetDefaultMargin","sizes","SIZES_HEADER_BADGE","captionProps","as","appearance","color","weight","wordBreak","SIZES_CAPTION","titleProps","marginBottom","undefined","SIZES_TITLE","contentProps","SIZES_CONTENT","closeButtonProps","icon","_jsx","Close","square","marginTop","SIZES_CLOSE_BUTTON","onClick","Styled","layouts","LAYOUTS","children","isValidElement","_jsxs","_Fragment","VISIBILITY_HORIZONTAL","AspectRatio","ratio","width","Skeleton","src","Badge","Text","VISIBILITY_VERTICAL","borderRadius","Button","preset","displayName","SIZES"],"mappings":"ihBAmBA,MAAMA,iBAA2EC,gBAAAA,gBAI/EC,MAAAA,WAA+D,CAACC,EAAOC,KACrE,MAAMC,KACJA,EAAO,IAAGC,OACVA,EAAS,WAAUC,QACnBA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,KACRA,EAAIC,MACJA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,QACLA,EAAOC,KACPA,EAAIC,YACJA,EAAWC,MACXA,EAAKC,OACLA,EAAMC,eACNA,EAAcC,iBACdA,EAAgBC,QAChBA,EAAOC,QACPA,EAAOC,QACPA,KACGC,GACD/B,EAEJ,MAAMgC,EAAY,CAChB9B,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMwB,EAAc,CAClB9B,SACAO,YACAC,WACAC,UACAC,UACAC,UACAC,YAGF,MAAMmB,EAAyB,IAC1BF,EACHG,MAAO,UACPC,YAAa,GACbC,oBAAoB,EACpBC,MAAOC,MAAAA,oBAGT,MAAMC,EAA0B,IAC3BR,EACHS,GAAI,OACJC,WAAY,UACZC,MAAO,0BACPC,OAAQ,IACRC,UAAW,aACXP,MAAOQ,MAAAA,eAGT,MAAMC,EAAwB,IACzBf,EACHS,GAAI,KACJC,WAAY,aACZC,MAAO,UACPK,aAAc3B,EAAU,aAAU4B,EAClCJ,UAAW,aACXP,MAAOY,MAAAA,aAGT,MAAMC,EAA0B,IAC3BnB,EACHS,GAAI,IACJC,WAAY,OACZC,MAAO,UACPE,UAAW,aACXP,MAAOc,MAAAA,eAGT,MAAMC,EAAoC,IACrCrB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,GAAY,WACrBA,EAAQ8B,UACC9B,GAAY,iBAAmBA,GAAY,SACpDkC,WAAAA,IAACoB,UAAI,IAAKxB,EAAYa,SAAG3C,IACvB,QAEJ,QAELI,EACC8B,WAAAA,IAACM,aAAa,CAAAG,SACXpC,EACC2B,WAAAA,IAACiB,kBAAQ,CAACD,MAAM,OAAMP,SACpBT,WAAAA,IAACuB,cAAM,CAACC,OAAO,WAAY/C,MAE3BiC,MAAAA,eAAexC,GACjBA,EACE,OAEJ,QAELF,EACCgC,WAAAA,IAACM,qBAAqB,CAAAG,SACnBC,MAAAA,eAAe1C,GACZA,SACOA,GAAgB,WACrBA,EAAY8B,GACZ,OAEN,YAMd,CACE2B,YA3PmB,mBA4PnB1C,MAAO2C,MAAAA"}
@@ -1,2 +1,2 @@
1
- import{forwardRef,isValidElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{SIZES_CLOSE_BUTTON,SIZES_CONTENT,SIZES_TITLE,SIZES_CAPTION,SIZES_HEADER_BADGE,SIZES}from'./sizes.mjs';import{LAYOUTS,VISIBILITY_HORIZONTAL,VISIBILITY_VERTICAL}from'./layouts.mjs';import{Root,Media,Img,Container,Content,Header,Footer,ButtonPosition}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{AspectRatio}from'../AspectRatio/AspectRatio.mjs';import{Skeleton}from'../Skeleton/Skeleton.mjs';import{Badge}from'../Badge/Badge.mjs';import{Text}from'../Text/Text.mjs';import{Button}from'../Button/Button.mjs';import{Close}from'../../icon-pack/src/icons/Close/index.mjs';const PopoverComponent=withMergedProps(forwardRef((e,t)=>{const{size:o="s",layout:i="vertical",sizeXXS:s,sizeXS:n,sizeS:r,sizeM:a,sizeL:l,sizeXL:d,layoutXXS:c,layoutXS:p,layoutS:m,layoutM:S,layoutL:u,layoutXL:x,root:j,badge:h,caption:f,header:E,title:I,content:y,body:T,closeButton:g,media:B,footer:z,imgSrcVertical:L,imgSrcHorizontal:R,loading:b,palette:C,closeFn:_,...w}=e;const A={size:o,sizeXXS:s,sizeXS:n,sizeS:r,sizeM:a,sizeL:l,sizeXL:d};const P={layout:i,layoutXXS:c,layoutXS:p,layoutS:m,layoutM:S,layoutL:u,layoutXL:x};const V={...A,borderRadius:8,marginRight:12,resetDefaultMargin:!0,sizes:SIZES_HEADER_BADGE};const k={...A,as:'span',appearance:'caption',color:'content-onmain-tertiary',weight:700,wordBreak:'break-word',sizes:SIZES_CAPTION};const Z={...A,as:'h2',appearance:'subheading',color:'inherit',marginBottom:y?'0.4em':void 0,wordBreak:'break-word',sizes:SIZES_TITLE};const O={...A,as:'p',appearance:'body',color:'inherit',wordBreak:'break-word',sizes:SIZES_CONTENT};const X={...A,icon:jsx(Close,{}),square:!0,marginTop:10,marginRight:10,sizes:SIZES_CLOSE_BUTTON,onClick:()=>{typeof _=='function'&&_()}};return jsx(Root,{...w,...A,...P,layouts:LAYOUTS,palette:C,ref:t,children:isValidElement(j)?j:typeof j=='function'?j({badgeProps:V,captionProps:k,titleProps:Z,contentProps:O,closeButtonProps:X}):jsxs(Fragment,{children:[b||B||R?jsx(Media,{...P,layouts:VISIBILITY_HORIZONTAL,children:b?jsx(AspectRatio,{ratio:"1:1",width:"100%",children:jsx(Skeleton,{})}):isValidElement(B)?B:jsx(AspectRatio,{ratio:"1:1",width:"100%",children:jsx(Img,{src:R})})}):null,jsxs(Container,{children:[jsxs(Content,{children:[b?jsx(Header,{children:jsx(Skeleton,{width:"20%",children:jsx(Badge,{...V})})}):isValidElement(E)?E:typeof E=='function'?E({badgeProps:V,captionProps:k}):h||f?jsxs(Header,{children:[isValidElement(h)?h:typeof h=='function'?h(V):typeof h=='string'||typeof h=='number'?jsx(Badge,{...V,children:h}):null,isValidElement(f)?f:typeof f=='function'?f(k):typeof f=='string'||typeof f=='number'?jsx(Text,{...k,children:f}):null]}):null,b||B||L?jsx(Media,{...P,layouts:VISIBILITY_VERTICAL,children:b?jsx(AspectRatio,{ratio:"16:9",width:"100%",children:jsx(Skeleton,{})}):isValidElement(B)?B:jsx(AspectRatio,{ratio:"16:9",width:"100%",children:jsx(Img,{src:L})})}):null,b?jsxs("div",{children:[jsx(Skeleton,{borderRadius:4,children:jsx(Text,{appearance:"subheading",marginBottom:"0.4em",sizes:SIZES_TITLE,...A})}),jsx(Skeleton,{borderRadius:4,width:"70%",children:jsx(Text,{appearance:"body",marginBottom:"0.4em",sizes:SIZES_CONTENT,...A})}),jsx(Skeleton,{borderRadius:4,width:"50%",children:jsx(Text,{appearance:"body",sizes:SIZES_CONTENT,...A})})]}):isValidElement(T)?T:typeof T=='function'?T({titleProps:Z,contentProps:O}):I||y?jsxs("div",{children:[isValidElement(I)?I:typeof I=='function'?I(Z):typeof I=='string'||typeof I=='number'?jsx(Text,{...Z,children:I}):null,isValidElement(y)?y:typeof y=='function'?y(O):typeof y=='string'||typeof y=='number'?jsx(Text,{...O,children:y}):null]}):null]}),z?jsx(Footer,{children:b?jsx(Skeleton,{width:"100%",children:jsx(Button,{preset:"brand",...A})}):isValidElement(z)?z:null}):null]}),g?jsx(ButtonPosition,{children:isValidElement(g)?g:typeof g=='function'?g(X):null}):null]})})}),{displayName:'PopoverComponent',sizes:SIZES});export{PopoverComponent};
1
+ import{forwardRef,isValidElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{SIZES_CLOSE_BUTTON,SIZES_CONTENT,SIZES_TITLE,SIZES_CAPTION,SIZES_HEADER_BADGE,SIZES}from'./sizes.mjs';import{LAYOUTS,VISIBILITY_HORIZONTAL,VISIBILITY_VERTICAL}from'./layouts.mjs';import{Root,Media,Img,Container,Content,Header,Footer,ButtonPosition}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{AspectRatio}from'../AspectRatio/AspectRatio.mjs';import{Skeleton}from'../Skeleton/Skeleton.mjs';import{Badge}from'../Badge/Badge.mjs';import{Text}from'../Text/Text.mjs';import{Button}from'../Button/Button.mjs';import{Close}from'../../icon-pack/src/icons/Close/index.mjs';const PopoverComponent=withMergedProps(forwardRef((e,t)=>{const{size:o="s",layout:i="vertical",sizeXXS:s,sizeXS:n,sizeS:r,sizeM:a,sizeL:l,sizeXL:d,layoutXXS:c,layoutXS:p,layoutS:m,layoutM:S,layoutL:u,layoutXL:x,root:j,badge:h,caption:f,header:E,title:I,content:y,body:T,closeButton:g,media:B,footer:z,imgSrcVertical:L,imgSrcHorizontal:R,loading:C,palette:_,closeFn:b,...w}=e;const A={size:o,sizeXXS:s,sizeXS:n,sizeS:r,sizeM:a,sizeL:l,sizeXL:d};const P={layout:i,layoutXXS:c,layoutXS:p,layoutS:m,layoutM:S,layoutL:u,layoutXL:x};const V={...A,shape:'rounded',marginRight:12,resetDefaultMargin:!0,sizes:SIZES_HEADER_BADGE};const k={...A,as:'span',appearance:'caption',color:'content-onmain-tertiary',weight:700,wordBreak:'break-word',sizes:SIZES_CAPTION};const Z={...A,as:'h2',appearance:'subheading',color:'inherit',marginBottom:y?'0.4em':void 0,wordBreak:'break-word',sizes:SIZES_TITLE};const O={...A,as:'p',appearance:'body',color:'inherit',wordBreak:'break-word',sizes:SIZES_CONTENT};const X={...A,icon:jsx(Close,{}),square:!0,marginTop:10,marginRight:10,sizes:SIZES_CLOSE_BUTTON,onClick:()=>{typeof b=='function'&&b()}};return jsx(Root,{...w,...A,...P,layouts:LAYOUTS,palette:_,ref:t,children:isValidElement(j)?j:typeof j=='function'?j({badgeProps:V,captionProps:k,titleProps:Z,contentProps:O,closeButtonProps:X}):jsxs(Fragment,{children:[C||B||R?jsx(Media,{...P,layouts:VISIBILITY_HORIZONTAL,children:C?jsx(AspectRatio,{ratio:"1:1",width:"100%",children:jsx(Skeleton,{})}):isValidElement(B)?B:jsx(AspectRatio,{ratio:"1:1",width:"100%",children:jsx(Img,{src:R})})}):null,jsxs(Container,{children:[jsxs(Content,{children:[C?jsx(Header,{children:jsx(Skeleton,{width:"20%",children:jsx(Badge,{...V})})}):isValidElement(E)?E:typeof E=='function'?E({badgeProps:V,captionProps:k}):h||f?jsxs(Header,{children:[isValidElement(h)?h:typeof h=='function'?h(V):typeof h=='string'||typeof h=='number'?jsx(Badge,{...V,children:h}):null,isValidElement(f)?f:typeof f=='function'?f(k):typeof f=='string'||typeof f=='number'?jsx(Text,{...k,children:f}):null]}):null,C||B||L?jsx(Media,{...P,layouts:VISIBILITY_VERTICAL,children:C?jsx(AspectRatio,{ratio:"16:9",width:"100%",children:jsx(Skeleton,{})}):isValidElement(B)?B:jsx(AspectRatio,{ratio:"16:9",width:"100%",children:jsx(Img,{src:L})})}):null,C?jsxs("div",{children:[jsx(Skeleton,{borderRadius:4,children:jsx(Text,{appearance:"subheading",marginBottom:"0.4em",sizes:SIZES_TITLE,...A})}),jsx(Skeleton,{borderRadius:4,width:"70%",children:jsx(Text,{appearance:"body",marginBottom:"0.4em",sizes:SIZES_CONTENT,...A})}),jsx(Skeleton,{borderRadius:4,width:"50%",children:jsx(Text,{appearance:"body",sizes:SIZES_CONTENT,...A})})]}):isValidElement(T)?T:typeof T=='function'?T({titleProps:Z,contentProps:O}):I||y?jsxs("div",{children:[isValidElement(I)?I:typeof I=='function'?I(Z):typeof I=='string'||typeof I=='number'?jsx(Text,{...Z,children:I}):null,isValidElement(y)?y:typeof y=='function'?y(O):typeof y=='string'||typeof y=='number'?jsx(Text,{...O,children:y}):null]}):null]}),z?jsx(Footer,{children:C?jsx(Skeleton,{width:"100%",children:jsx(Button,{preset:"brand",...A})}):isValidElement(z)?z:null}):null]}),g?jsx(ButtonPosition,{children:isValidElement(g)?g:typeof g=='function'?g(X):null}):null]})})}),{displayName:'PopoverComponent',sizes:SIZES});export{PopoverComponent};
2
2
  //# sourceMappingURL=PopoverComponent.mjs.map