@foxford/ui 2.113.0-beta-2aee8b7-20260526 → 2.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
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||e.shape==='circular'?sizes.SIZES_CIRCULAR:e.borderRadius!==void 0?sizes.SIZES_BASE:sizes.SIZES_SQUARE});const{size:r="s",borderRadius:i=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:l,sizeM:m,sizeL:
|
|
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||e.shape==='circular'?sizes.SIZES_CIRCULAR:e.borderRadius!==void 0?sizes.SIZES_BASE:sizes.SIZES_SQUARE});const{size:r="s",borderRadius:i=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:l,sizeM:m,sizeL:h,sizeXL:R,...P}=o;const v={size:r,sizeXXS:z,sizeXS:j,sizeS:l,sizeM:m,sizeL:h,sizeXL:R};const[g,I]=Array.isArray(x)?x:[x];const y={...v,as:'span',appearance:'caption',color:'inherit',whiteSpace:'nowrap',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:r,borderRadius:i,shape:c,ref:s,children:typeof p=='function'?p({textProps:y,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,{...y,children:p||S}):null,jsxRuntime.jsx(Slot.Slot,{props:{iconProps:f},render:u??(I?e=>jsxRuntime.jsx(Icon.Icon,{...e.iconProps,...f,name:typeof I=='string'?I:void 0,icon:typeof I!='string'?I: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 { 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_CIRCULAR, 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 || p.shape === 'circular') {\n return SIZES_CIRCULAR\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_CIRCULAR","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,OAASH,EAAEC,QAAU,WAClBG,MAAAA,eAGLJ,EAAEK,oBAAiBC,EACdC,MAAAA,WAGFC,MAAAA,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,
|
|
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_CIRCULAR, 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 || p.shape === 'circular') {\n return SIZES_CIRCULAR\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 whiteSpace: 'nowrap',\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_CIRCULAR","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","whiteSpace","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,OAASH,EAAEC,QAAU,WAClBG,MAAAA,eAGLJ,EAAEK,oBAAiBC,EACdC,MAAAA,WAGFC,MAAAA,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,UACPC,WAAY,SACZpC,MAAOqC,MAAAA,cACJzB,GAGL,MAAMC,EAAuB,IAAKe,EAAWO,MAAO,UAAWnC,MAAOsC,MAAAA,cAAexB,GAErF,OACEyB,WAAAA,IAACC,MAAAA,KAAW,IACNb,KACAC,EACJK,GAAIlB,EACJL,KAAMA,EACNJ,aAAcA,EACdJ,MAAOA,EACPN,IAAKA,EAAIoB,gBAEDA,GAAa,WACnBA,EAAS,CAAEL,YAAWE,cAEtB4B,WAAAA,KAAAC,oBAAA,CAAA1B,SAAA,CACEuB,WAAAA,IAACI,UAAI,CACHhD,MAAO,CAAEkB,aACT+B,OACE3B,IACCY,EACIgB,GACCN,WAAAA,IAACO,KAAAA,KAAI,IACCD,EAAehC,aACfA,EACJkC,YAAalB,GAAe,SAAWA,OAAatB,EACpDa,YAAaS,GAAe,SAAWA,OAAatB,SAGxDA,KAIPS,GAAYG,EAAUoB,WAAAA,IAACS,KAAAA,KAAI,IAAKrC,EAASK,SAAGA,GAAYG,IAAkB,KAE3EoB,WAAAA,IAACI,UAAI,CACHhD,MAAO,CAAEkB,aACT+B,OACE1B,IACCY,EACImB,GACCV,WAAAA,IAACO,KAAAA,KAAI,IACCG,EAAgBpC,aAChBA,EACJkC,YAAajB,GAAc,SAAWA,OAAYvB,EAClDa,YAAaU,GAAc,SAAWA,OAAYvB,SAGtDA,uDA3HK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createPolymorphicComponentWithRef}from'../../shared/utils/createPolymorphicComponentWithRef.mjs';import{useMergedProps}from'../../hooks/useMergedProps.mjs';import{Root}from'./style.mjs';import{SIZES_ROUNDED,SIZES_CIRCULAR,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||o.shape==='circular'?SIZES_CIRCULAR: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:
|
|
1
|
+
import{createPolymorphicComponentWithRef}from'../../shared/utils/createPolymorphicComponentWithRef.mjs';import{useMergedProps}from'../../hooks/useMergedProps.mjs';import{Root}from'./style.mjs';import{SIZES_ROUNDED,SIZES_CIRCULAR,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||o.shape==='circular'?SIZES_CIRCULAR: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:a,content:d,icon:E,sizeXXS:I,sizeXS:h,sizeS:f,sizeM:l,sizeL:z,sizeXL:j,...x}=s;const R={size:r,sizeXXS:I,sizeXS:h,sizeS:f,sizeM:l,sizeL:z,sizeXL:j};const[P,u]=Array.isArray(E)?E:[E];const g={...R,as:'span',appearance:'caption',color:'inherit',whiteSpace:'nowrap',sizes:SIZES_TEXT,...t};const _={...R,color:'inherit',sizes:SIZES_ICON,...n};return jsx(Root,{...x,...R,as:c,size:r,borderRadius:i,shape:p,ref:e,children:typeof S=='function'?S({textProps:g,iconProps:_}):jsxs(Fragment,{children:[jsx(Slot,{props:{iconProps:_},render:m??(P?o=>jsx(Icon,{...o.iconProps,..._,name:typeof P=='string'?P:void 0,icon:typeof P!='string'?P:void 0}):void 0)}),S||d?jsx(Text,{...g,children:S||d}):null,jsx(Slot,{props:{iconProps:_},render:a??(u?o=>jsx(Icon,{...o.iconProps,..._,name:typeof u=='string'?u:void 0,icon:typeof u!='string'?u: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 { 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_CIRCULAR, 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 || p.shape === 'circular') {\n return SIZES_CIRCULAR\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_CIRCULAR","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":"+bAYA,MAAMA,eAAiB,QAYvB,MAAMC,MAAQC,kCAAqD,CAACC,EAAOC,KACzE,MAAMC,EAAcC,eAAgEH,EAAO,CACzFI,cAdmB,QAenBC,MAAQC,GACFA,EAAEC,QAAU,UACPC,cAGLF,EAAEG,OAASH,EAAEC,QAAU,WAClBG,eAGLJ,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,
|
|
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_CIRCULAR, 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 || p.shape === 'circular') {\n return SIZES_CIRCULAR\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 whiteSpace: 'nowrap',\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_CIRCULAR","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","whiteSpace","SIZES_TEXT","SIZES_ICON","_jsx","Styled","_jsxs","_Fragment","Slot","render","addonLeftProps","Icon","name","Text","addonRightProps"],"mappings":"+bAYA,MAAMA,eAAiB,QAYvB,MAAMC,MAAQC,kCAAqD,CAACC,EAAOC,KACzE,MAAMC,EAAcC,eAAgEH,EAAO,CACzFI,cAdmB,QAenBC,MAAQC,GACFA,EAAEC,QAAU,UACPC,cAGLF,EAAEG,OAASH,EAAEC,QAAU,WAClBG,eAGLJ,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,UACPC,WAAY,SACZpC,MAAOqC,cACJzB,GAGL,MAAMC,EAAuB,IAAKe,EAAWO,MAAO,UAAWnC,MAAOsC,cAAexB,GAErF,OACEyB,IAACC,KAAW,IACNb,KACAC,EACJK,GAAIlB,EACJL,KAAMA,EACNJ,aAAcA,EACdJ,MAAOA,EACPN,IAAKA,EAAIoB,gBAEDA,GAAa,WACnBA,EAAS,CAAEL,YAAWE,cAEtB4B,KAAAC,SAAA,CAAA1B,SAAA,CACEuB,IAACI,KAAI,CACHhD,MAAO,CAAEkB,aACT+B,OACE3B,IACCY,EACIgB,GACCN,IAACO,KAAI,IACCD,EAAehC,aACfA,EACJkC,YAAalB,GAAe,SAAWA,OAAatB,EACpDa,YAAaS,GAAe,SAAWA,OAAatB,SAGxDA,KAIPS,GAAYG,EAAUoB,IAACS,KAAI,IAAKrC,EAASK,SAAGA,GAAYG,IAAkB,KAE3EoB,IAACI,KAAI,CACHhD,MAAO,CAAEkB,aACT+B,OACE1B,IACCY,EACImB,GACCV,IAACO,KAAI,IACCG,EAAgBpC,aAChBA,EACJkC,YAAajB,GAAc,SAAWA,OAAYvB,EAClDa,YAAaU,GAAc,SAAWA,OAAYvB,SAGtDA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/ui",
|
|
3
|
-
"version": "2.113.0
|
|
3
|
+
"version": "2.113.0",
|
|
4
4
|
"description": "UI components and utilities",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/foxford/ui/issues"
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"shared",
|
|
64
64
|
"theme"
|
|
65
65
|
],
|
|
66
|
-
"sha": "
|
|
66
|
+
"sha": "59335c6",
|
|
67
67
|
"scripts": {}
|
|
68
68
|
}
|