@foxford/ui 2.97.0 → 2.97.1-beta-047ff24-20260226

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 styled=require('styled-components');var polymorphic=require('../../shared/utils/polymorphic.js');var useMergedProps=require('../../hooks/useMergedProps.js');var useClassname=require('../../hooks/useClassname.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Anchor=polymorphic.polymorphicComponent(((e,s)=>{const r=styled.useTheme();const n=useMergedProps.useMergedProps(e,{displayName:"Anchor",sizes:constants.SIZES});const{component:o,size:t="inherit",autoRel:i=!0,textProps:a={},iconProps:c={},icon:l,children:u,content:p,...d}=n;const m=useClassname.useClassname("Anchor",d.className);const h=r.utils?.relBuilder;const[x,j]=Array.isArray(l)?l:[l];const y={as:'span',size:'inherit',color:'inherit',underline:d.underline,marginLeft:x?'0.20em':void 0,marginRight:j?'0.20em':void 0};const v={as:'span',color:'inherit'};return jsxRuntime.jsx(style.Root,{...d,ref:s,as:(()=>{let e='a';return'to'in d&&(e=r.link),d.pseudo&&(e='div'),d.disabled&&(e='span'),d.as&&(e=d.as),o&&(e=o),e})(),className:m,size:t,rel:(()=>{if('rel'in d)return d.rel;const e='href'in d?d.href:'to'in d?d.to:void 0;if(i&&h&&typeof e=='string'){const s='target'in d?d.target:void 0;if(typeof s=='string'||s===void 0)return h(e,s)}})(),"data-disabled":d.disabled,children:typeof u=='function'?u({baseTextProps:y,textProps:a,iconBaseProps:v,iconProps:c,icon:l}):d.preset==='brand'?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x?jsxRuntime.jsx(Icon.Icon,{name:typeof x=='string'?x:void 0,icon:typeof x!='string'?x:void 0,...v,...c}):null,jsxRuntime.jsx(Text.Text,{...y,...a,children:u||p}),j?jsxRuntime.jsx(Icon.Icon,{name:typeof j=='string'?j:void 0,icon:typeof j!='string'?j:void 0,...v,...c}):null]}):u||p})}));exports.Anchor=Anchor,exports.COMPONENT_NAME="Anchor";
1
+ 'use strict';var styled=require('styled-components');var polymorphic=require('../../shared/utils/polymorphic.js');var useMergedProps=require('../../hooks/useMergedProps.js');var useClassname=require('../../hooks/useClassname.js');var isNil=require('../../shared/utils/isNil.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Icon=require('../Icon/Icon.js');var Text=require('../Text/Text.js');const Anchor=polymorphic.polymorphicComponent(((e,s)=>{const r=styled.useTheme();const n=useMergedProps.useMergedProps(e,{displayName:"Anchor",sizes:constants.SIZES});const{component:i,size:o="inherit",autoRel:t=!0,textProps:a={},iconProps:c={},icon:l,children:u,content:d,...p}=n;const m=useClassname.useClassname("Anchor",p.className);const h=r.utils?.relBuilder;const[x,j]=Array.isArray(l)?l:[l];const v={as:'span',size:'inherit',color:'inherit',underline:p.underline,marginLeft:x?'0.20em':void 0,marginRight:j?'0.20em':void 0};const y={as:'span',color:'inherit'};return jsxRuntime.jsx(style.Root,{...p,ref:s,as:(()=>{let e='a';return'to'in p&&p.to&&(e=r.link),p.pseudo&&(e='div'),p.disabled&&(e='span'),p.as&&(e=p.as),i&&(e=i),e})(),className:m,size:o,rel:(()=>{if('rel'in p&&!isNil.isNil(p.rel))return p.rel;const e=('href'in p?p.href:void 0)??('to'in p?p.to:void 0);if(t&&h&&typeof e=='string'){const s='target'in p?p.target:void 0;if(typeof s=='string'||s===void 0)return h(e,s)}})(),"data-disabled":p.disabled,children:typeof u=='function'?u({baseTextProps:v,textProps:a,iconBaseProps:y,iconProps:c,icon:l}):p.preset==='brand'?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[x?jsxRuntime.jsx(Icon.Icon,{name:typeof x=='string'?x:void 0,icon:typeof x!='string'?x:void 0,...y,...c}):null,jsxRuntime.jsx(Text.Text,{...v,...a,children:u||d}),j?jsxRuntime.jsx(Icon.Icon,{name:typeof j=='string'?j:void 0,icon:typeof j!='string'?j:void 0,...y,...c}):null]}):u||d})}));exports.Anchor=Anchor,exports.COMPONENT_NAME="Anchor";
2
2
  //# sourceMappingURL=Anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { polymorphicComponent } from 'shared/utils/polymorphic'\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 { useClassname } from 'hooks/useClassname'\nimport { SIZES } from './constants'\nimport type { AnchorProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Полиморфный компонент. Поддерживает ref и нативные атрибуты выбранного HTML-элемента (по умолчанию \\<a\\>).\n */\nconst Anchor = polymorphicComponent<'a', AnchorProps, HTMLAnchorElement>((props, ref) => {\n const theme = useTheme()\n const mergedProps = useMergedProps<AnchorProps>(props, {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n })\n\n const {\n component,\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = mergedProps\n\n const rootNode = () => {\n let root: React.ElementType | undefined = 'a'\n\n if ('to' in restProps) {\n root = theme.link\n }\n if (restProps.pseudo) {\n root = 'div'\n }\n if (restProps.disabled) {\n root = 'span'\n }\n if (restProps.as) {\n root = restProps.as\n }\n if (component) {\n root = component\n }\n\n return root\n }\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n\n const relBuilder = theme.utils?.relBuilder\n\n const getRel = () => {\n if ('rel' in restProps) {\n return restProps.rel\n }\n\n const href = 'href' in restProps ? restProps.href : 'to' in restProps ? restProps.to : undefined\n if (autoRel && relBuilder && typeof href === 'string') {\n const target = 'target' in restProps ? restProps.target : undefined\n if (typeof target === 'string' || target === undefined) {\n return relBuilder(href, target)\n }\n }\n\n return undefined\n }\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode()}\n className={className}\n size={size}\n rel={getRel()}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n ) : (\n children || content\n )}\n </Styled.Root>\n )\n})\n\nconst AnchorDoc: React.FC<AnchorProps> = () => null\n\nexport { AnchorDoc, Anchor, COMPONENT_NAME }\n"],"names":["Anchor","polymorphicComponent","props","ref","theme","useTheme","mergedProps","useMergedProps","displayName","sizes","SIZES","component","size","autoRel","textProps","iconProps","icon","children","content","restProps","className","useClassname","relBuilder","utils","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","rootNode","root","link","pseudo","disabled","rel","getRel","href","to","target","preset","_jsxs","_Fragment","jsx","Icon","name","Text"],"mappings":"kaAoBMA,MAAAA,OAASC,YAAoBA,sBAAsC,CAACC,EAAOC,KAC/E,MAAMC,EAAQC,OAAAA,WACd,MAAMC,EAAcC,eAAcA,eAAcL,EAAO,CACrDM,YAXmB,SAYnBC,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C,SAC7DG,EAAU6B,SAAW,QACvBC,WAAAA,KAAAC,WAAAA,SAAA,CAAAjC,SACGO,CAAAA,EACCY,WAAAe,IAACC,UAAI,CACHC,YAAa7B,GAAW,SAAWA,OAASS,EAC5CjB,YAAaQ,GAAW,SAAWA,OAASS,KACxCE,KACApB,IAEJ,KACJqB,WAAAe,IAACG,UAAI,IAAK1B,KAAmBd,EAASG,SACnCA,GAAYC,IAEdO,EACCW,WAAAe,IAACC,UAAI,CACHC,YAAa5B,GAAU,SAAWA,OAAQQ,EAC1CjB,YAAaS,GAAU,SAAWA,OAAQQ,KACtCE,KACApB,IAEJ,QAGNE,GAAYC,GAEF,iDAvHK"}
1
+ {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { polymorphicComponent } from 'shared/utils/polymorphic'\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 { useClassname } from 'hooks/useClassname'\nimport { isNil } from 'shared/utils/isNil'\nimport { SIZES } from './constants'\nimport type { AnchorProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Полиморфный компонент. Поддерживает ref и нативные атрибуты выбранного HTML-элемента (по умолчанию \\<a\\>).\n */\nconst Anchor = polymorphicComponent<'a', AnchorProps, HTMLAnchorElement>((props, ref) => {\n const theme = useTheme()\n const mergedProps = useMergedProps<AnchorProps>(props, {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n })\n\n const {\n component,\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = mergedProps\n\n const rootNode = () => {\n let root: React.ElementType | undefined = 'a'\n\n if ('to' in restProps && restProps.to) {\n root = theme.link\n }\n if (restProps.pseudo) {\n root = 'div'\n }\n if (restProps.disabled) {\n root = 'span'\n }\n if (restProps.as) {\n root = restProps.as\n }\n if (component) {\n root = component\n }\n\n return root\n }\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n\n const relBuilder = theme.utils?.relBuilder\n\n const getRel = () => {\n if ('rel' in restProps && !isNil(restProps.rel)) {\n return restProps.rel\n }\n\n const href = ('href' in restProps ? restProps.href : undefined) ?? ('to' in restProps ? restProps.to : undefined)\n if (autoRel && relBuilder && typeof href === 'string') {\n const target = 'target' in restProps ? restProps.target : undefined\n if (typeof target === 'string' || target === undefined) {\n return relBuilder(href, target)\n }\n }\n\n return undefined\n }\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode()}\n className={className}\n size={size}\n rel={getRel()}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n ) : (\n children || content\n )}\n </Styled.Root>\n )\n})\n\nconst AnchorDoc: React.FC<AnchorProps> = () => null\n\nexport { AnchorDoc, Anchor, COMPONENT_NAME }\n"],"names":["Anchor","polymorphicComponent","props","ref","theme","useTheme","mergedProps","useMergedProps","displayName","sizes","SIZES","component","size","autoRel","textProps","iconProps","icon","children","content","restProps","className","useClassname","relBuilder","utils","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","rootNode","root","to","link","pseudo","disabled","rel","getRel","isNil","href","target","preset","_jsxs","_Fragment","jsx","Icon","name","Text"],"mappings":"mdAqBMA,MAAAA,OAASC,YAAoBA,sBAAsC,CAACC,EAAOC,KAC/E,MAAMC,EAAQC,OAAAA,WACd,MAAMC,EAAcC,eAAcA,eAAcL,EAAO,CACrDM,YAXmB,SAYnBC,MAAOC,UAAAA,QAGT,MAAMC,UACJA,EAASC,KACTA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDb,EAwBJ,MAAMc,EAAYC,aAAYA,aAjDT,SAiD0BF,EAAUC,WAEzD,MAAME,EAAalB,EAAMmB,OAAOD,WAkBhC,MAAOE,EAAQC,GAASC,MAAMC,QAAQX,GAAQA,EAAO,CAACA,GAEtD,MAAMY,EAA2B,CAC/BC,GAAI,OACJjB,KAAM,UACNkB,MAAO,UACPC,UAAWZ,EAAUY,UACrBC,WAAYR,EAAS,cAAWS,EAChCC,YAAaT,EAAQ,cAAWQ,GAGlC,MAAME,EAA2B,CAAEN,GAAI,OAAQC,MAAO,WAEtD,OACEM,WAAAA,IAACC,MAAAA,KAAW,IACNlB,EACJhB,IAAKA,EACL0B,GA3DaS,MACf,IAAIC,EAAsC,IAkB1C,MAhBI,OAAQpB,GAAaA,EAAUqB,KACjCD,EAAOnC,EAAMqC,MAEXtB,EAAUuB,SACZH,EAAO,OAELpB,EAAUwB,WACZJ,EAAO,QAELpB,EAAUU,KACZU,EAAOpB,EAAUU,IAEflB,IACF4B,EAAO5B,GAGF4B,CAAI,EAwCLD,GACJlB,UAAWA,EACXR,KAAMA,EACNgC,IApCWC,MACb,GAAI,QAAS1B,IAAc2B,MAAKA,MAAC3B,EAAUyB,KACzC,OAAOzB,EAAUyB,IAGnB,MAAMG,GAAQ,SAAU5B,EAAYA,EAAU4B,UAAOd,KAAe,OAAQd,EAAYA,EAAUqB,QAAKP,GACvG,GAAIpB,GAAWS,UAAqByB,GAAS,SAAU,CACrD,MAAMC,EAAS,WAAY7B,EAAYA,EAAU6B,YAASf,EAC1D,UAAWe,GAAW,UAAYA,SAAWf,EAC3C,OAAOX,EAAWyB,EAAMC,EAE5B,CAEgB,EAuBTH,GACL,gBAAe1B,EAAUwB,SAAS1B,gBAE1BA,GAAa,WACnBA,EAAS,CAAEW,gBAAed,YAAWqB,gBAAepB,YAAWC,SAC7DG,EAAU8B,SAAW,QACvBC,WAAAA,KAAAC,WAAAA,SAAA,CAAAlC,SACGO,CAAAA,EACCY,WAAAgB,IAACC,UAAI,CACHC,YAAa9B,GAAW,SAAWA,OAASS,EAC5CjB,YAAaQ,GAAW,SAAWA,OAASS,KACxCE,KACApB,IAEJ,KACJqB,WAAAgB,IAACG,UAAI,IAAK3B,KAAmBd,EAASG,SACnCA,GAAYC,IAEdO,EACCW,WAAAgB,IAACC,UAAI,CACHC,YAAa7B,GAAU,SAAWA,OAAQQ,EAC1CjB,YAAaS,GAAU,SAAWA,OAAQQ,KACtCE,KACApB,IAEJ,QAGNE,GAAYC,GAEF,iDAvHK"}
@@ -1,2 +1,2 @@
1
- import{useTheme}from'styled-components';import{polymorphicComponent}from'../../shared/utils/polymorphic.mjs';import{useMergedProps}from'../../hooks/useMergedProps.mjs';import{useClassname}from'../../hooks/useClassname.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Anchor';const Anchor=polymorphicComponent(((o,e)=>{const s=useTheme();const r=useMergedProps(o,{displayName:"Anchor",sizes:SIZES});const{component:n,size:t="inherit",autoRel:i=!0,textProps:m={},iconProps:c={},icon:a,children:p,content:l,...d}=r;const f=useClassname("Anchor",d.className);const h=s.utils?.relBuilder;const[u,g]=Array.isArray(a)?a:[a];const x={as:'span',size:'inherit',color:'inherit',underline:d.underline,marginLeft:u?'0.20em':void 0,marginRight:g?'0.20em':void 0};const j={as:'span',color:'inherit'};return jsx(Root,{...d,ref:e,as:(()=>{let o='a';return'to'in d&&(o=s.link),d.pseudo&&(o='div'),d.disabled&&(o='span'),d.as&&(o=d.as),n&&(o=n),o})(),className:f,size:t,rel:(()=>{if('rel'in d)return d.rel;const o='href'in d?d.href:'to'in d?d.to:void 0;if(i&&h&&typeof o=='string'){const e='target'in d?d.target:void 0;if(typeof e=='string'||e===void 0)return h(o,e)}})(),"data-disabled":d.disabled,children:typeof p=='function'?p({baseTextProps:x,textProps:m,iconBaseProps:j,iconProps:c,icon:a}):d.preset==='brand'?jsxs(Fragment,{children:[u?jsx(Icon,{name:typeof u=='string'?u:void 0,icon:typeof u!='string'?u:void 0,...j,...c}):null,jsx(Text,{...x,...m,children:p||l}),g?jsx(Icon,{name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0,...j,...c}):null]}):p||l})}));export{Anchor,COMPONENT_NAME};
1
+ import{useTheme}from'styled-components';import{polymorphicComponent}from'../../shared/utils/polymorphic.mjs';import{useMergedProps}from'../../hooks/useMergedProps.mjs';import{useClassname}from'../../hooks/useClassname.mjs';import{isNil}from'../../shared/utils/isNil.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{Icon}from'../Icon/Icon.mjs';import{Text}from'../Text/Text.mjs';const COMPONENT_NAME='Anchor';const Anchor=polymorphicComponent(((o,s)=>{const e=useTheme();const r=useMergedProps(o,{displayName:"Anchor",sizes:SIZES});const{component:n,size:t="inherit",autoRel:i=!0,textProps:m={},iconProps:c={},icon:a,children:p,content:l,...d}=r;const f=useClassname("Anchor",d.className);const h=e.utils?.relBuilder;const[u,g]=Array.isArray(a)?a:[a];const j={as:'span',size:'inherit',color:'inherit',underline:d.underline,marginLeft:u?'0.20em':void 0,marginRight:g?'0.20em':void 0};const x={as:'span',color:'inherit'};return jsx(Root,{...d,ref:s,as:(()=>{let o='a';return'to'in d&&d.to&&(o=e.link),d.pseudo&&(o='div'),d.disabled&&(o='span'),d.as&&(o=d.as),n&&(o=n),o})(),className:f,size:t,rel:(()=>{if('rel'in d&&!isNil(d.rel))return d.rel;const o=('href'in d?d.href:void 0)??('to'in d?d.to:void 0);if(i&&h&&typeof o=='string'){const s='target'in d?d.target:void 0;if(typeof s=='string'||s===void 0)return h(o,s)}})(),"data-disabled":d.disabled,children:typeof p=='function'?p({baseTextProps:j,textProps:m,iconBaseProps:x,iconProps:c,icon:a}):d.preset==='brand'?jsxs(Fragment,{children:[u?jsx(Icon,{name:typeof u=='string'?u:void 0,icon:typeof u!='string'?u:void 0,...x,...c}):null,jsx(Text,{...j,...m,children:p||l}),g?jsx(Icon,{name:typeof g=='string'?g:void 0,icon:typeof g!='string'?g:void 0,...x,...c}):null]}):p||l})}));export{Anchor,COMPONENT_NAME};
2
2
  //# sourceMappingURL=Anchor.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.mjs","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { polymorphicComponent } from 'shared/utils/polymorphic'\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 { useClassname } from 'hooks/useClassname'\nimport { SIZES } from './constants'\nimport type { AnchorProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Полиморфный компонент. Поддерживает ref и нативные атрибуты выбранного HTML-элемента (по умолчанию \\<a\\>).\n */\nconst Anchor = polymorphicComponent<'a', AnchorProps, HTMLAnchorElement>((props, ref) => {\n const theme = useTheme()\n const mergedProps = useMergedProps<AnchorProps>(props, {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n })\n\n const {\n component,\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = mergedProps\n\n const rootNode = () => {\n let root: React.ElementType | undefined = 'a'\n\n if ('to' in restProps) {\n root = theme.link\n }\n if (restProps.pseudo) {\n root = 'div'\n }\n if (restProps.disabled) {\n root = 'span'\n }\n if (restProps.as) {\n root = restProps.as\n }\n if (component) {\n root = component\n }\n\n return root\n }\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n\n const relBuilder = theme.utils?.relBuilder\n\n const getRel = () => {\n if ('rel' in restProps) {\n return restProps.rel\n }\n\n const href = 'href' in restProps ? restProps.href : 'to' in restProps ? restProps.to : undefined\n if (autoRel && relBuilder && typeof href === 'string') {\n const target = 'target' in restProps ? restProps.target : undefined\n if (typeof target === 'string' || target === undefined) {\n return relBuilder(href, target)\n }\n }\n\n return undefined\n }\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode()}\n className={className}\n size={size}\n rel={getRel()}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n ) : (\n children || content\n )}\n </Styled.Root>\n )\n})\n\nconst AnchorDoc: React.FC<AnchorProps> = () => null\n\nexport { AnchorDoc, Anchor, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Anchor","polymorphicComponent","props","ref","theme","useTheme","mergedProps","useMergedProps","displayName","sizes","SIZES","component","size","autoRel","textProps","iconProps","icon","children","content","restProps","className","useClassname","relBuilder","utils","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","rootNode","root","link","pseudo","disabled","rel","getRel","href","to","target","preset","_jsxs","_Fragment","Icon","name","Text"],"mappings":"uZAYMA,MAAAA,eAAiB,SAQjBC,MAAAA,OAASC,sBAA0D,CAACC,EAAOC,KAC/E,MAAMC,EAAQC,WACd,MAAMC,EAAcC,eAA4BL,EAAO,CACrDM,YAXmB,SAYnBC,MAAOC,QAGT,MAAMC,UACJA,EAASC,KACTA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDb,EAwBJ,MAAMc,EAAYC,aAjDG,SAiD0BF,EAAUC,WAEzD,MAAME,EAAalB,EAAMmB,OAAOD,WAkBhC,MAAOE,EAAQC,GAASC,MAAMC,QAAQX,GAAQA,EAAO,CAACA,GAEtD,MAAMY,EAA2B,CAC/BC,GAAI,OACJjB,KAAM,UACNkB,MAAO,UACPC,UAAWZ,EAAUY,UACrBC,WAAYR,EAAS,cAAWS,EAChCC,YAAaT,EAAQ,cAAWQ,GAGlC,MAAME,EAA2B,CAAEN,GAAI,OAAQC,MAAO,WAEtD,OACEM,IAACC,KAAW,IACNlB,EACJhB,IAAKA,EACL0B,GA3DaS,MACf,IAAIC,EAAsC,IAkB1C,MAhBI,OAAQpB,IACVoB,EAAOnC,EAAMoC,MAEXrB,EAAUsB,SACZF,EAAO,OAELpB,EAAUuB,WACZH,EAAO,QAELpB,EAAUU,KACZU,EAAOpB,EAAUU,IAEflB,IACF4B,EAAO5B,GAGF4B,CAAI,EAwCLD,GACJlB,UAAWA,EACXR,KAAMA,EACN+B,IApCWC,MACb,GAAI,QAASzB,EACX,OAAOA,EAAUwB,IAGnB,MAAME,EAAO,SAAU1B,EAAYA,EAAU0B,KAAO,OAAQ1B,EAAYA,EAAU2B,QAAKb,EACvF,GAAIpB,GAAWS,UAAqBuB,GAAS,SAAU,CACrD,MAAME,EAAS,WAAY5B,EAAYA,EAAU4B,YAASd,EAC1D,UAAWc,GAAW,UAAYA,SAAWd,EAC3C,OAAOX,EAAWuB,EAAME,EAE5B,CAEgB,EAuBTH,GACL,gBAAezB,EAAUuB,SAASzB,gBAE1BA,GAAa,WACnBA,EAAS,CAAEW,gBAAed,YAAWqB,gBAAepB,YAAWC,SAC7DG,EAAU6B,SAAW,QACvBC,KAAAC,SAAA,CAAAjC,SACGO,CAAAA,EACCY,IAACe,KAAI,CACHC,YAAa5B,GAAW,SAAWA,OAASS,EAC5CjB,YAAaQ,GAAW,SAAWA,OAASS,KACxCE,KACApB,IAEJ,KACJqB,IAACiB,KAAI,IAAKzB,KAAmBd,EAASG,SACnCA,GAAYC,IAEdO,EACCW,IAACe,KAAI,CACHC,YAAa3B,GAAU,SAAWA,OAAQQ,EAC1CjB,YAAaS,GAAU,SAAWA,OAAQQ,KACtCE,KACApB,IAEJ,QAGNE,GAAYC,GAEF"}
1
+ {"version":3,"file":"Anchor.mjs","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { polymorphicComponent } from 'shared/utils/polymorphic'\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 { useClassname } from 'hooks/useClassname'\nimport { isNil } from 'shared/utils/isNil'\nimport { SIZES } from './constants'\nimport type { AnchorProps } from './types'\nimport * as Styled from './style'\n\nconst COMPONENT_NAME = 'Anchor'\n\n/**\n *\n * Контрол многоцелевого назначения.\n *\n * Полиморфный компонент. Поддерживает ref и нативные атрибуты выбранного HTML-элемента (по умолчанию \\<a\\>).\n */\nconst Anchor = polymorphicComponent<'a', AnchorProps, HTMLAnchorElement>((props, ref) => {\n const theme = useTheme()\n const mergedProps = useMergedProps<AnchorProps>(props, {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n })\n\n const {\n component,\n size = 'inherit',\n autoRel = true,\n textProps = {},\n iconProps = {},\n icon,\n children,\n content,\n ...restProps\n } = mergedProps\n\n const rootNode = () => {\n let root: React.ElementType | undefined = 'a'\n\n if ('to' in restProps && restProps.to) {\n root = theme.link\n }\n if (restProps.pseudo) {\n root = 'div'\n }\n if (restProps.disabled) {\n root = 'span'\n }\n if (restProps.as) {\n root = restProps.as\n }\n if (component) {\n root = component\n }\n\n return root\n }\n\n const className = useClassname(COMPONENT_NAME, restProps.className)\n\n const relBuilder = theme.utils?.relBuilder\n\n const getRel = () => {\n if ('rel' in restProps && !isNil(restProps.rel)) {\n return restProps.rel\n }\n\n const href = ('href' in restProps ? restProps.href : undefined) ?? ('to' in restProps ? restProps.to : undefined)\n if (autoRel && relBuilder && typeof href === 'string') {\n const target = 'target' in restProps ? restProps.target : undefined\n if (typeof target === 'string' || target === undefined) {\n return relBuilder(href, target)\n }\n }\n\n return undefined\n }\n\n const [before, after] = Array.isArray(icon) ? icon : [icon]\n\n const baseTextProps: TextProps = {\n as: 'span',\n size: 'inherit',\n color: 'inherit',\n underline: restProps.underline,\n marginLeft: before ? '0.20em' : undefined,\n marginRight: after ? '0.20em' : undefined,\n }\n\n const iconBaseProps: IconProps = { as: 'span', color: 'inherit' }\n\n return (\n <Styled.Root\n {...restProps}\n ref={ref}\n as={rootNode()}\n className={className}\n size={size}\n rel={getRel()}\n data-disabled={restProps.disabled}\n >\n {typeof children === 'function' ? (\n children({ baseTextProps, textProps, iconBaseProps, iconProps, icon })\n ) : restProps.preset === 'brand' ? (\n <>\n {before ? (\n <Icon\n name={typeof before === 'string' ? before : undefined}\n icon={typeof before !== 'string' ? before : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n <Text {...baseTextProps} {...textProps}>\n {children || content}\n </Text>\n {after ? (\n <Icon\n name={typeof after === 'string' ? after : undefined}\n icon={typeof after !== 'string' ? after : undefined}\n {...iconBaseProps}\n {...iconProps}\n />\n ) : null}\n </>\n ) : (\n children || content\n )}\n </Styled.Root>\n )\n})\n\nconst AnchorDoc: React.FC<AnchorProps> = () => null\n\nexport { AnchorDoc, Anchor, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Anchor","polymorphicComponent","props","ref","theme","useTheme","mergedProps","useMergedProps","displayName","sizes","SIZES","component","size","autoRel","textProps","iconProps","icon","children","content","restProps","className","useClassname","relBuilder","utils","before","after","Array","isArray","baseTextProps","as","color","underline","marginLeft","undefined","marginRight","iconBaseProps","_jsx","Styled","rootNode","root","to","link","pseudo","disabled","rel","getRel","isNil","href","target","preset","_jsxs","_Fragment","Icon","name","Text"],"mappings":"ucAaMA,MAAAA,eAAiB,SAQjBC,MAAAA,OAASC,sBAA0D,CAACC,EAAOC,KAC/E,MAAMC,EAAQC,WACd,MAAMC,EAAcC,eAA4BL,EAAO,CACrDM,YAXmB,SAYnBC,MAAOC,QAGT,MAAMC,UACJA,EAASC,KACTA,EAAO,UAASC,QAChBA,GAAU,EAAIC,UACdA,EAAY,CAAE,EAAAC,UACdA,EAAY,CAAE,EAAAC,KACdA,EAAIC,SACJA,EAAQC,QACRA,KACGC,GACDb,EAwBJ,MAAMc,EAAYC,aAjDG,SAiD0BF,EAAUC,WAEzD,MAAME,EAAalB,EAAMmB,OAAOD,WAkBhC,MAAOE,EAAQC,GAASC,MAAMC,QAAQX,GAAQA,EAAO,CAACA,GAEtD,MAAMY,EAA2B,CAC/BC,GAAI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U,SAAWA,OAAQQ,KACtCE,KACApB,IAEJ,QAGNE,GAAYC,GAEF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxford/ui",
3
- "version": "2.97.0",
3
+ "version": "2.97.1-beta-047ff24-20260226",
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": "255a521",
66
+ "sha": "047ff24",
67
67
  "scripts": {}
68
68
  }