@foxford/ui 2.0.6-beta-2691fd9-20221221 → 2.0.7-beta-3b91f0c-20230124

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
- import e from'@babel/runtime/helpers/objectSpread2';import s from'@babel/runtime/helpers/objectWithoutProperties';import{Link as i}from'react-router-dom';import{useClassname as r}from'../../hooks/useClassname.js';import{Root as a}from'./style.js';import{jsx as o}from'react/jsx-runtime';var l=["as","to","href","wrapper","className","style","children","content","pseudo","underline","color","display","size","sizeXS","sizeS","sizeM","sizeL","sizeXL"];function p(t){var{as:z,to:n,href:d,wrapper:m,className:c,style:u,children:y,content:h,pseudo:L,underline:S,color:f,display:X,size:b,sizeXS:N,sizeS:v,sizeM:M,sizeL:j,sizeXL:w}=t,k=s(t,l);var x=r(p.displayName,c);var A;A='div'!==z||X?X:'block';var C={};return h&&(C=e(e({},C),{},{dangerouslySetInnerHTML:{__html:h}})),o(a,e(z?e(e({as:z,pseudo:L,wrapper:m,underline:S,href:d,className:x,style:u,color:f,size:b,display:A,sizeXS:N,sizeS:v,sizeM:M,sizeL:j,sizeXL:w},k),C):L?e(e({as:"div",pseudo:L,wrapper:m,underline:S,href:d,className:x,color:f,style:u,size:b,display:A,sizeXS:N,sizeS:v,sizeM:M,sizeL:j,sizeXL:w},k),C):n?e(e({as:i,to:n,pseudo:L,wrapper:m,underline:S,className:x,color:f,size:b,style:u,display:A,sizeXS:N,sizeS:v,sizeM:M,sizeL:j,sizeXL:w},k),C):e(e({as:"a",href:d,pseudo:L,wrapper:m,underline:S,className:x,color:f,size:b,style:u,display:A,sizeXS:N,sizeS:v,sizeM:M,sizeL:j,sizeXL:w},C),k),{},{children:y}))}p.displayName='Anchor',p.defaultProps={display:'inline-block'};export{p as Anchor};
1
+ import e from'@babel/runtime/helpers/objectSpread2';import s from'@babel/runtime/helpers/objectWithoutProperties';import{Link as r}from'react-router-dom';import{useTheme as i}from'styled-components';import{useClassname as l}from'../../hooks/useClassname.js';import{Root as o}from'./style.js';import{jsx as a}from'react/jsx-runtime';var t=["as","to","href","wrapper","className","style","children","content","pseudo","underline","color","display","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","autoRel"];function n(d){var p,z,u,m,c;var{as:h,to:y,href:v,wrapper:f,className:L,style:S,children:X,content:b,pseudo:N,underline:M,color:j,display:w,size:k,sizeXS:x,sizeS:R,sizeM:g,sizeL:A,sizeXL:B,autoRel:C}=d,P=s(d,t);var T=l(n.displayName,L);var _=i();var H;var I=C&&null!==(p=_.utils)&&void 0!==p&&p.relBuilder&&_.domain?_.utils.relBuilder(_.domain,null!==(z=d.href)&&void 0!==z?z:d.to,d.target):d.rel;H='div'!==h||w?w:'block';var W={};return b&&(W=e(e({},W),{},{dangerouslySetInnerHTML:{__html:b}})),a(o,h?e(e(e({as:h,pseudo:N,wrapper:f,underline:M,href:v,className:T,style:S,color:j,size:k,display:H,sizeXS:x,sizeS:R,sizeM:g,sizeL:A,sizeXL:B},P),W),{},{rel:'a'===h?null!==(u=d.rel)&&void 0!==u?u:I:void 0,children:X}):N?e(e(e({as:"div",pseudo:N,wrapper:f,underline:M,href:v,className:T,color:j,style:S,size:k,display:H,sizeXS:x,sizeS:R,sizeM:g,sizeL:A,sizeXL:B},P),W),{},{children:X}):y?e(e(e({as:r,to:y,pseudo:N,wrapper:f,underline:M,className:T,color:j,size:k,style:S,display:H,sizeXS:x,sizeS:R,sizeM:g,sizeL:A,sizeXL:B},P),W),{},{rel:null!==(m=d.rel)&&void 0!==m?m:I,children:X}):e(e(e({as:"a",href:v,pseudo:N,wrapper:f,underline:M,className:T,color:j,size:k,style:S,display:H,sizeXS:x,sizeS:R,sizeM:g,sizeL:A,sizeXL:B},W),P),{},{rel:null!==(c=d.rel)&&void 0!==c?c:I,children:X}))}n.displayName='Anchor',n.defaultProps={display:'inline-block'};export{n as Anchor};
2
2
  //# sourceMappingURL=Anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { Link } from 'react-router-dom'\nimport { useClassname } from 'hooks/useClassname'\nimport { BaseProps } from '../../shared/interfaces'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport * as Styled from './style'\n\nexport interface AnchorProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>, Display {\n /**\n * Custom CSS class name\n */\n as?: 'div' | 'span' | 'a' | typeof Link\n /**\n * React router link to\n */\n to?: string\n /**\n * Link href\n */\n href?: string\n /**\n * Is display inline\n * */\n wrapper?: boolean\n /**\n * Pseudo link has dashed bottom border\n * */\n pseudo?: boolean\n /**\n * If link should be underlined\n * */\n underline?: boolean\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Primary content\n */\n content?: string\n /**\n * Onclick handler\n */\n onClick?: () => void\n target?: string\n rel?: string\n}\n\nAnchor.displayName = 'Anchor'\nAnchor.defaultProps = {\n display: 'inline-block',\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveNamedProperty<'size'>`](#/Миксины)\n * - [`Display`](#/Миксины)\n */\nexport function Anchor(props: typeof Anchor.defaultProps & AnchorProps) {\n const {\n as,\n to,\n href,\n wrapper,\n className,\n style,\n children,\n content,\n pseudo,\n underline,\n color,\n display,\n size,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n ...rest\n } = props\n\n const _className = useClassname(Anchor.displayName, className)\n\n let _display: Display['display']\n\n if (as === 'div' && !display) _display = 'block'\n else _display = display\n\n let contentProps = {}\n\n if (content) {\n contentProps = {\n ...contentProps,\n dangerouslySetInnerHTML: { __html: content },\n }\n }\n\n if (as)\n return (\n <Styled.Root\n as={as}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n href={href}\n className={_className}\n style={style}\n color={color}\n size={size}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n >\n {children}\n </Styled.Root>\n )\n\n if (pseudo)\n return (\n <Styled.Root\n as='div'\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n href={href}\n className={_className}\n color={color}\n style={style}\n size={size}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n >\n {children}\n </Styled.Root>\n )\n else if (to)\n return (\n <Styled.Root\n as={Link}\n to={to}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n className={_className}\n color={color}\n size={size}\n style={style}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n >\n {children}\n </Styled.Root>\n )\n else\n return (\n <Styled.Root\n as='a'\n href={href}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n className={_className}\n color={color}\n size={size}\n style={style}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...contentProps}\n {...rest}\n >\n {children}\n </Styled.Root>\n )\n}\n"],"names":["Anchor","props","as","to","href","wrapper","className","style","children","content","pseudo","underline","color","display","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","rest","_excluded","_className","useClassname","displayName","_display","contentProps","dangerouslySetInnerHTML","__html","_jsx","Styled.Root","_objectSpread","Link","defaultProps"],"mappings":"mcAgEO,SAASA,EAAOC,GACrB,IAAMC,GACJA,EADIC,GAEJA,EAFIC,KAGJA,EAHIC,QAIJA,EAJIC,UAKJA,EALIC,MAMJA,EANIC,SAOJA,EAPIC,QAQJA,EARIC,OASJA,EATIC,UAUJA,EAVIC,MAWJA,EAXIC,QAYJ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AAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,GACJO,GACAN,GA1FN,GAAA,CAAAZ,SAmBGA,KAxETR,EAAOwB,YAAc,SACrBxB,EAAOiC,aAAe,CACpBpB,QAAS"}
1
+ {"version":3,"file":"Anchor.js","sources":["../../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import { Link } from 'react-router-dom'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { BaseProps } from '../../shared/interfaces'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { Color } from '../../mixins/color'\nimport { Display } from '../../mixins/display'\nimport * as Styled from './style'\n\nexport interface AnchorProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>, Display {\n /**\n * Custom CSS class name\n */\n as?: 'div' | 'span' | 'a' | typeof Link\n /**\n * React router link to\n */\n to?: string\n /**\n * Link href\n */\n href?: string\n /**\n * Is display inline\n * */\n wrapper?: boolean\n /**\n * Pseudo link has dashed bottom border\n * */\n pseudo?: boolean\n /**\n * If link should be underlined\n * */\n underline?: boolean\n /**\n * Primary content\n */\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Primary content\n */\n content?: string\n /**\n * Onclick handler\n */\n onClick?: () => void\n target?: string\n rel?: string\n /**\n * Auto-generate rel. You must specify domain inside theme\n */\n autoRel?: boolean\n}\n\nAnchor.displayName = 'Anchor'\nAnchor.defaultProps = {\n display: 'inline-block',\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`ResponsiveNamedProperty<'size'>`](#/Миксины)\n * - [`Display`](#/Миксины)\n */\nexport function Anchor(props: typeof Anchor.defaultProps & AnchorProps) {\n const {\n as,\n to,\n href,\n wrapper,\n className,\n style,\n children,\n content,\n pseudo,\n underline,\n color,\n display,\n size,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n autoRel,\n ...rest\n } = props\n\n const _className = useClassname(Anchor.displayName, className)\n const theme = useTheme()\n\n let _display: Display['display']\n const _rel =\n autoRel && theme.utils?.relBuilder && theme.domain\n ? theme.utils.relBuilder(theme.domain, props.href ?? props.to, props.target)\n : props.rel\n\n if (as === 'div' && !display) _display = 'block'\n else _display = display\n\n let contentProps = {}\n\n if (content) {\n contentProps = {\n ...contentProps,\n dangerouslySetInnerHTML: { __html: content },\n }\n }\n\n if (as)\n return (\n <Styled.Root\n as={as}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n href={href}\n className={_className}\n style={style}\n color={color}\n size={size}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n rel={as === 'a' ? props.rel ?? _rel : undefined}\n >\n {children}\n </Styled.Root>\n )\n\n if (pseudo)\n return (\n <Styled.Root\n as='div'\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n href={href}\n className={_className}\n color={color}\n style={style}\n size={size}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n >\n {children}\n </Styled.Root>\n )\n else if (to)\n return (\n <Styled.Root\n as={Link}\n to={to}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n className={_className}\n color={color}\n size={size}\n style={style}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...rest}\n {...contentProps}\n rel={props.rel ?? _rel}\n >\n {children}\n </Styled.Root>\n )\n else\n return (\n <Styled.Root\n as='a'\n href={href}\n pseudo={pseudo}\n wrapper={wrapper}\n underline={underline}\n className={_className}\n color={color}\n size={size}\n style={style}\n display={_display}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n {...contentProps}\n {...rest}\n rel={props.rel ?? _rel}\n >\n {children}\n </Styled.Root>\n )\n}\n"],"names":["Anchor","props","_theme$utils","_props$href","_props$rel","_props$rel2","_props$rel3","as","to","href","wrapper","className","style","children","content","pseudo","underline","color","display","size","sizeXS","sizeS","sizeM","sizeL","sizeXL","autoRel","rest","_excluded","_className","useClassname","displayName","theme","useTheme","_display","_rel","utils","relBuilder","domain","target","rel","contentProps","dangerouslySetInnerHTML","__html","_jsx","Styled.Root","_objectSpread","Link","defaultProps"],"mappings":"0fAqEO,SAASA,EAAOC,GAAiD,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EACtE,IAAMC,GACJA,EADIC,GAEJA,EAFIC,KAGJA,EAHIC,QAIJA,EAJIC,UAKJA,EALIC,MAMJA,EANIC,SAOJA,EAPIC,QAQJA,EARIC,OASJA,EATIC,UAUJA,EAVIC,MAWJA,EAXIC,QAYJA,EAZIC,KAaJA,EAbIC,OAcJA,EAdIC,MAeJA,EAfIC,MAgBJA,EAhBIC,MAiBJA,EAjBIC,OAkBJA,EAlBIC,QAmBJA,GAEExB,EADCyB,IACDzB,EArBJ0B,GAuBA,IAAMC,EAAaC,EAAa7B,EAAO8B,YAAanB,GACpD,IAAMoB,EAAQC,IAEd,IAAIC,EACJ,IAAMC,EACJT,GAAW,UAAAM,EAAMI,aAAAA,IAANjC,GAAAA,EAAakC,YAAcL,EAAMM,OACxCN,EAAMI,MAAMC,WAAWL,EAAMM,eAA7BlC,EAAqCF,EAAMQ,oBAAQR,EAAMO,GAAIP,EAAMqC,QACnErC,EAAMsC,IAGPN,EADM,QAAP1B,GAAiBW,EACLA,EADyB,QAGzC,IAAIsB,EAAe,GASnB,OAPI1B,IACF0B,SACKA,GADO,GAAA,CAEVC,wBAAyB,CAAEC,OAAQ5B,MAMnC6B,EAACC,EAFDrC,EAEAsC,EAAAA,EAAAA,EAAA,CACEtC,GAAIA,EACJQ,OAAQA,EACRL,QAASA,EACTM,UAAWA,EACXP,KAAMA,EACNE,UAAWiB,EACXhB,MAAOA,E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
1
- import e from'@babel/runtime/helpers/objectSpread2';import a from'@babel/runtime/helpers/objectWithoutProperties';import{Link as r}from'react-router-dom';import{useClassname as t}from'../../hooks/useClassname.js';import{Root as s,Content as o}from'./style.js';import{PROPS_BY_SIZE as n,PRESETS as i}from'./presets.js';import{jsxs as l,jsx as m}from'react/jsx-runtime';var c=["children","className","disabled","href","to","as","target","content","onClick","ref","icon","type","innerRef"];function d(p){var{children:f,className:u,disabled:h,href:y,to:b,as:v,target:j,content:N,onClick:C,ref:g,icon:k,type:x,innerRef:P}=p,R=a(p,c);var S=v||(h?'button':y?'a':b?r:'button');var _='a'!==S||h?{}:{href:y||b,target:j};var z='string'==typeof S||h?{}:{to:b||y};var B=R.size&&!R.round&&n[R.size]||{};var E=(e=>e.primary?i.primary:e.secondary?i.secondary:i.default)(p);var w=t(d.displayName,u);var I=t(d.displayName);return l(s,e(e(e(e(e(e({as:S,className:w,type:'button'===S?x:void 0,onClick:h||R.loading?void 0:C},B),_),z),E),R),{},{disabled:h,ref:g||P,children:[k&&m("span",{className:"icon",children:k}),(N||f)&&m(o,{className:"".concat(I,"__content"),children:N||f})]}))}d.defaultProps={size:'m',rounded:!0,display:'inline-flex',width:'auto'},d.displayName='Button';export{d as Button};
1
+ import e from'@babel/runtime/helpers/objectSpread2';import r from'@babel/runtime/helpers/objectWithoutProperties';import{Link as a}from'react-router-dom';import{useTheme as t}from'styled-components';import{useClassname as o}from'../../hooks/useClassname.js';import{Root as s,Content as i}from'./style.js';import{PROPS_BY_SIZE as n,PRESETS as l}from'./presets.js';import{jsxs as d,jsx as m}from'react/jsx-runtime';var c=["children","className","disabled","href","to","as","target","content","onClick","ref","icon","type","innerRef","autoRel"];function u(p){var f,v,h;var{children:y,className:b,disabled:j,href:N,to:R,as:g,target:C,content:k,onClick:x,ref:B,icon:P,type:S,innerRef:_,autoRel:z}=p,E=r(p,c);var T=t();var w=g||(j?'button':N?'a':R?a:'button');var I='a'!==w||j?{}:{href:N||R,target:C};var L='string'==typeof w||j?{}:{to:R||N};var O=E.size&&!E.round&&n[E.size]||{};var W=(e=>e.primary?l.primary:e.secondary?l.secondary:l.default)(p);var Y=o(u.displayName,b);var Z=o(u.displayName);var q=z&&N&&null!==(f=T.utils)&&void 0!==f&&f.relBuilder&&T.domain?T.utils.relBuilder(T.domain,null!==(v=p.href)&&void 0!==v?v:p.to,p.target):void 0;return d(s,e(e(e(e(e(e({as:w,className:Y,type:'button'===w?S:void 0,onClick:j||E.loading?void 0:x},O),I),L),W),E),{},{disabled:j,ref:B||_,rel:N?null!==(h=p.rel)&&void 0!==h?h:q:void 0,children:[P&&m("span",{className:"icon",children:P}),(k||y)&&m(i,{className:"".concat(Z,"__content"),children:k||y})]}))}u.defaultProps={size:'m',rounded:!0,display:'inline-flex',width:'auto'},u.displayName='Button';export{u as Button};
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { Link } from 'react-router-dom'\nimport { useClassname } from 'hooks/useClassname'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { BaseProps, Tooltiped } from '../../shared/interfaces'\nimport { Color } from '../../mixins/color'\nimport { Anchor } from '../../components/Anchor'\nimport * as Styled from './style'\nimport { PRESETS, PROPS_BY_SIZE } from './presets'\n\nexport interface ButtonProps\n extends BaseProps,\n Tooltiped,\n Display,\n Color,\n Color<'fontColor'>,\n ResponsiveNamedProperty<'padding'>,\n ResponsiveNamedProperty<'paddingTop'>,\n ResponsiveNamedProperty<'paddingRight'>,\n ResponsiveNamedProperty<'paddingBottom'>,\n ResponsiveNamedProperty<'paddingLeft'>,\n ResponsiveNamedProperty<'margin'>,\n ResponsiveNamedProperty<'marginTop'>,\n ResponsiveNamedProperty<'marginRight'>,\n ResponsiveNamedProperty<'marginBottom'>,\n ResponsiveNamedProperty<'marginLeft'>,\n ResponsiveNamedProperty<'fontSize'>,\n ResponsiveNamedProperty<'fluid', boolean>,\n ResponsiveNamedProperty<'width', 'auto' | 'l' | 'm' | 's' | 'xs' | number>,\n ResponsiveNamedProperty<'height', 'l' | 'm' | 's' | 'xs' | number> {\n /**\n * Node type\n */\n as?: 'div' | 'span' | 'a' | 'button' | typeof Link | typeof Anchor\n target?: string\n rel?: string\n /**\n * Link href\n */\n href?: string\n /**\n * React router link to\n */\n to?: string\n /**\n * Type for button element\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Basic button\n */\n basic?: boolean\n /**\n * Disabled\n */\n disabled?: boolean\n /**\n * Is primary\n */\n primary?: boolean\n /**\n * Is secondary\n */\n secondary?: boolean\n /**\n * Is inverted\n */\n inverted?: boolean\n /**\n * Is rounded\n */\n rounded?: boolean\n /**\n * Is round (in a shape of circle)\n */\n round?: boolean\n /**\n * Indicates if there should not be any margin\n * between this button and the previous one\n */\n noSpacing?: boolean\n /**\n * Is in loading state\n */\n loading?: boolean\n /**\n * Button icon\n */\n icon?: React.ReactNode\n /** On click callback */\n onClick?: () => void\n /** Function to make ref */\n ref?: React.LegacyRef<HTMLDivElement>\n /**\n * Size\n */\n size?: keyof typeof PROPS_BY_SIZE\n /**\n * Content of button\n * @deprecated Use children property\n */\n content?: React.ReactNode\n}\n\nButton.defaultProps = {\n size: 'm',\n rounded: true,\n display: 'inline-flex',\n width: 'auto',\n}\n\nButton.displayName = 'Button'\n\nconst extractPresetByProps = (props: ButtonProps): Partial<ButtonProps> => {\n if (props.primary) return PRESETS.primary\n if (props.secondary) return PRESETS.secondary\n return PRESETS.default\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`Tooltiped`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'fontColor'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginLeft'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'fontSize'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'fluid', boolean>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'width', 'auto' | 'l' | 'm' | 's' | 'xs' | number>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'height', 'l' | 'm' | 's' | 'xs' | number>`](#/Миксины)\n */\nexport function Button(props: ButtonProps) {\n const {\n children,\n className,\n disabled,\n href,\n to,\n as,\n target,\n content,\n onClick,\n ref,\n icon,\n type,\n innerRef,\n ...restProps\n } = props\n\n const _as = as || (disabled ? 'button' : href ? 'a' : to ? Link : 'button')\n const aProps = _as === 'a' && !disabled ? { href: href || to, target } : {}\n const linkProps = typeof _as !== 'string' && !disabled ? { to: to || href } : {}\n const propsBySize: Partial<ButtonProps> =\n restProps.size && !restProps.round ? PROPS_BY_SIZE[restProps.size] || {} : {}\n const presetProps: Partial<ButtonProps> = extractPresetByProps(props)\n const _className = useClassname(Button.displayName, className)\n const _contentClassName = useClassname(Button.displayName)\n\n return (\n <Styled.Root\n as={_as}\n className={_className}\n type={_as === 'button' ? type : undefined}\n onClick={disabled || restProps.loading ? undefined : onClick}\n {...propsBySize}\n {...aProps}\n {...linkProps}\n {...presetProps}\n {...restProps}\n disabled={disabled}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={(ref || innerRef) as any}\n >\n {icon && <span className='icon'>{icon}</span>}\n {(content || children) && (\n <Styled.Content className={`${_contentClassName}__content`}>{content || children}</Styled.Content>\n )}\n </Styled.Root>\n )\n}\n"],"names":["Button","props","children","className","disabled","href","to","as","target","content","onClick","ref","icon","type","innerRef","restProps","_excluded","_as","Link","aProps","linkProps","propsBySize","size","round","PROPS_BY_SIZE","presetProps","primary","PRESETS","secondary","default","_className","useClassname","displayName","_contentClassName","_jsxs","Styled.Root","_objectSpread","undefined","loading","_jsx","Styled.Content","concat","defaultProps","rounded","display","width"],"mappings":"ueAiJO,SAASA,EAAOC,GACrB,IAAMC,SACJA,EADIC,UAEJA,EAFIC,SAGJA,EAHIC,KAIJA,EAJIC,GAKJA,EALIC,GAMJA,EANIC,OAOJA,EAPIC,QAQJA,EARIC,QASJA,EATIC,IAUJA,EAVIC,KAWJA,EAXIC,KAYJA,EAZIC,SAaJA,GAEEb,EADCc,IACDd,EAfJe,GAiBA,IAAMC,EAAMV,IAAOH,EAAW,SAAWC,EAAO,IAAMC,EAAKY,EAAO,UAClE,IAAMC,EAAiB,MAARF,GAAgBb,EAA0C,GAA/B,CAAEC,KAAMA,GAAQC,EAAIE,OAAAA,GAC9D,IAAMY,EAA2B,iBAARH,GAAqBb,EAAgC,GAArB,CAAEE,GAAIA,GAAMD,GACrE,IAAMgB,EACJN,EAAUO,OAASP,EAAUQ,OAAQC,EAAcT,EAAUO,OAAc,GAC7E,IAAMG,EAnDsBxB,CAAAA,GACxBA,EAAMyB,QAAgBC,EAAQD,QAC9BzB,EAAM2B,UAAkBD,EAAQC,UAC7BD,EAAQE,QAHa5B,CAmDmCA,GAC/D,IAAM6B,EAAaC,EAAa/B,EAAOgC,YAAa7B,GACpD,IAAM8B,EAAoBF,EAAa/B,EAAOgC,aAE9C,OACEE,EAACC,EAADC,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAA,CACE7B,GAAIU,EACJd,UAAW2B,EACXjB,KAAc,WAARI,EAAmBJ,OAAOwB,EAChC3B,QAASN,GAAYW,EAAUuB,aAAUD,EAAY3B,GACjDW,GACAF,GACAC,GACAK,GACAV,GATN,GAAA,CAUEX,SAAUA,EAEVO,IAAMA,GAAOG,EAZfZ,SAAA,CAcGU,GAAQ2B,EAAA,OAAA,CAAMpC,UAAU,OAAhBD,SAAwBU,KAC/BH,GAAWP,IACXqC,EAACC,EAAD,CAAgBrC,UAAS,GAAAsC,OAAKR,EAA9B,aAAA/B,SAA6DO,GAAWP,QAjFhFF,EAAO0C,aAAe,CACpBpB,KAAM,IACNqB,SAAAA,EACAC,QAAS,cACTC,MAAO,QAGT7C,EAAOgC,YAAc"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import { Link } from 'react-router-dom'\nimport { useTheme } from 'styled-components'\nimport { useClassname } from 'hooks/useClassname'\nimport { Display } from '../../mixins/display'\nimport { ResponsiveNamedProperty } from '../../mixins/responsive-property'\nimport { BaseProps, Tooltiped } from '../../shared/interfaces'\nimport { Color } from '../../mixins/color'\nimport { Anchor } from '../../components/Anchor'\nimport * as Styled from './style'\nimport { PRESETS, PROPS_BY_SIZE } from './presets'\n\nexport interface ButtonProps\n extends BaseProps,\n Tooltiped,\n Display,\n Color,\n Color<'fontColor'>,\n ResponsiveNamedProperty<'padding'>,\n ResponsiveNamedProperty<'paddingTop'>,\n ResponsiveNamedProperty<'paddingRight'>,\n ResponsiveNamedProperty<'paddingBottom'>,\n ResponsiveNamedProperty<'paddingLeft'>,\n ResponsiveNamedProperty<'margin'>,\n ResponsiveNamedProperty<'marginTop'>,\n ResponsiveNamedProperty<'marginRight'>,\n ResponsiveNamedProperty<'marginBottom'>,\n ResponsiveNamedProperty<'marginLeft'>,\n ResponsiveNamedProperty<'fontSize'>,\n ResponsiveNamedProperty<'fluid', boolean>,\n ResponsiveNamedProperty<'width', 'auto' | 'l' | 'm' | 's' | 'xs' | number>,\n ResponsiveNamedProperty<'height', 'l' | 'm' | 's' | 'xs' | number> {\n /**\n * Node type\n */\n as?: 'div' | 'span' | 'a' | 'button' | typeof Link | typeof Anchor\n target?: string\n rel?: string\n /**\n * Auto-generate rel. You must specify domain inside theme\n */\n autoRel?: boolean\n /**\n * Link href\n */\n href?: string\n /**\n * React router link to\n */\n to?: string\n /**\n * Type for button element\n */\n type?: 'button' | 'submit' | 'reset'\n /**\n * Children react node\n */\n children?: React.ReactNode\n /**\n * Basic button\n */\n basic?: boolean\n /**\n * Disabled\n */\n disabled?: boolean\n /**\n * Is primary\n */\n primary?: boolean\n /**\n * Is secondary\n */\n secondary?: boolean\n /**\n * Is inverted\n */\n inverted?: boolean\n /**\n * Is rounded\n */\n rounded?: boolean\n /**\n * Is round (in a shape of circle)\n */\n round?: boolean\n /**\n * Indicates if there should not be any margin\n * between this button and the previous one\n */\n noSpacing?: boolean\n /**\n * Is in loading state\n */\n loading?: boolean\n /**\n * Button icon\n */\n icon?: React.ReactNode\n /** On click callback */\n onClick?: () => void\n /** Function to make ref */\n ref?: React.LegacyRef<HTMLDivElement>\n /**\n * Size\n */\n size?: keyof typeof PROPS_BY_SIZE\n /**\n * Content of button\n * @deprecated Use children property\n */\n content?: React.ReactNode\n}\n\nButton.defaultProps = {\n size: 'm',\n rounded: true,\n display: 'inline-flex',\n width: 'auto',\n}\n\nButton.displayName = 'Button'\n\nconst extractPresetByProps = (props: ButtonProps): Partial<ButtonProps> => {\n if (props.primary) return PRESETS.primary\n if (props.secondary) return PRESETS.secondary\n return PRESETS.default\n}\n\n/**\n * Расширен:\n * - [`BaseProps`](#/Миксины)\n * - [`Display`](#/Миксины)\n * - [`Tooltiped`](#/Миксины)\n * - [`Color`](#/Миксины)\n * - [`Color<'fontColor'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'padding'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingTop'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingRight'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingBottom'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'paddingLeft'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'margin'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginTop'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginRight'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginBottom'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'marginLeft'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'fontSize'>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'fluid', boolean>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'width', 'auto' | 'l' | 'm' | 's' | 'xs' | number>`](#/Миксины)\n * - [`ResponsiveNamedProperty<'height', 'l' | 'm' | 's' | 'xs' | number>`](#/Миксины)\n */\nexport function Button(props: ButtonProps) {\n const {\n children,\n className,\n disabled,\n href,\n to,\n as,\n target,\n content,\n onClick,\n ref,\n icon,\n type,\n innerRef,\n autoRel,\n ...restProps\n } = props\n const theme = useTheme()\n const _as = as || (disabled ? 'button' : href ? 'a' : to ? Link : 'button')\n const aProps = _as === 'a' && !disabled ? { href: href || to, target } : {}\n const linkProps = typeof _as !== 'string' && !disabled ? { to: to || href } : {}\n const propsBySize: Partial<ButtonProps> =\n restProps.size && !restProps.round ? PROPS_BY_SIZE[restProps.size] || {} : {}\n const presetProps: Partial<ButtonProps> = extractPresetByProps(props)\n const _className = useClassname(Button.displayName, className)\n const _contentClassName = useClassname(Button.displayName)\n const _rel =\n autoRel && href && theme.utils?.relBuilder && theme.domain\n ? theme.utils.relBuilder(theme.domain, props.href ?? props.to, props.target)\n : undefined\n\n return (\n <Styled.Root\n as={_as}\n className={_className}\n type={_as === 'button' ? type : undefined}\n onClick={disabled || restProps.loading ? undefined : onClick}\n {...propsBySize}\n {...aProps}\n {...linkProps}\n {...presetProps}\n {...restProps}\n disabled={disabled}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={(ref || innerRef) as any}\n rel={href ? props.rel ?? _rel : undefined}\n >\n {icon && <span className='icon'>{icon}</span>}\n {(content || children) && (\n <Styled.Content className={`${_contentClassName}__content`}>{content || children}</Styled.Content>\n )}\n </Styled.Root>\n )\n}\n"],"names":["Button","props","_theme$utils","_props$href","_props$rel","children","className","disabled","href","to","as","target","content","onClick","ref","icon","type","innerRef","autoRel","restProps","_excluded","theme","useTheme","_as","Link","aProps","linkProps","propsBySize","size","round","PROPS_BY_SIZE","presetProps","primary","PRESETS","secondary","default","_className","useClassname","displayName","_contentClassName","_rel","utils","relBuilder","domain","_jsxs","Styled.Root","_objectSpread","undefined","loading","rel","_jsx","Styled.Content","concat","defaultProps","rounded","display","width"],"mappings":"8hBAsJO,SAASA,EAAOC,GAAoB,IAAAC,EAAAC,EAAAC,EACzC,IAAMC,SACJA,EADIC,UAEJA,EAFIC,SAGJA,EAHIC,KAIJA,EAJIC,GAKJA,EALIC,GAMJA,EANIC,OAOJA,EAPIC,QAQJA,EARIC,QASJA,EATIC,IAUJA,EAVIC,KAWJA,EAXIC,KAYJA,EAZIC,SAaJA,EAbIC,QAcJA,GAEEjB,EADCkB,IACDlB,EAhBJmB,GAiBA,IAAMC,EAAQC,IACd,IAAMC,EAAMb,IAAOH,EAAW,SAAWC,EAAO,IAAMC,EAAKe,EAAO,UAClE,IAAMC,EAAiB,MAARF,GAAgBhB,EAA0C,GAA/B,CAAEC,KAAMA,GAAQC,EAAIE,OAAAA,GAC9D,IAAMe,EAA2B,iBAARH,GAAqBhB,EAAgC,GAArB,CAAEE,GAAIA,GAAMD,GACrE,IAAMmB,EACJR,EAAUS,OAAST,EAAUU,OAAQC,EAAcX,EAAUS,OAAc,GAC7E,IAAMG,EApDsB9B,CAAAA,GACxBA,EAAM+B,QAAgBC,EAAQD,QAC9B/B,EAAMiC,UAAkBD,EAAQC,UAC7BD,EAAQE,QAHalC,CAoDmCA,GAC/D,IAAMmC,EAAaC,EAAarC,EAAOsC,YAAahC,GACpD,IAAMiC,EAAoBF,EAAarC,EAAOsC,aAC9C,IAAME,EACJtB,GAAWV,GAAQ,QAAnBN,EAAmBmB,EAAMoB,aAAN,IAAAvC,GAAAA,EAAawC,YAAcrB,EAAMsB,OAChDtB,EAAMoB,MAAMC,WAAWrB,EAAMsB,OAA7B,QAAqC1C,EAAAA,EAAMO,YAA3C,IAAAL,EAAAA,EAAmDF,EAAMQ,GAAIR,EAAMU,aAAAA,EAGzE,OACEiC,EAACC,EAADC,EAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EAAA,CACEpC,GAAIa,EACJjB,UAAW8B,EACXpB,KAAc,WAARO,EAAmBP,OAAO+B,EAChClC,QAASN,GAAYY,EAAU6B,aAAAA,EAAsBnC,GACjDc,GACAF,GACAC,GACAK,GACAZ,GATN,GAAA,CAUEZ,SAAUA,EAEVO,IAAMA,GAAOG,EACbgC,IAAKzC,EAAI,QAAGP,EAAAA,EAAMgD,WAAAA,IAAT7C,EAAAA,EAAgBoC,OAAAA,EAb3BnC,SAAA,CAeGU,GAAQmC,EAAA,OAAA,CAAM5C,UAAU,OAAhBD,SAAwBU,KAC/BH,GAAWP,IACX6C,EAACC,EAAD,CAAgB7C,UAAS,GAAA8C,OAAKb,EAA9B,aAAAlC,SAA6DO,GAAWP,QAvFhFL,EAAOqD,aAAe,CACpBzB,KAAM,IACN0B,SAAAA,EACAC,QAAS,cACTC,MAAO,QAGTxD,EAAOsC,YAAc"}
package/dts/index.d.ts CHANGED
@@ -357,6 +357,10 @@ interface Theme {
357
357
  };
358
358
  classNamePrefix: string;
359
359
  defaultInputControlsWidth: number | keyof typeof SizeInput | 'auto';
360
+ domain?: string;
361
+ utils?: {
362
+ relBuilder?: (_hostname: string, _link?: string, _target?: string) => string;
363
+ };
360
364
  }
361
365
 
362
366
  declare type StyledComponentProps = {
@@ -802,6 +806,10 @@ interface AnchorProps extends BaseProps, Color, ResponsiveNamedProperty<'size'>,
802
806
  onClick?: () => void;
803
807
  target?: string;
804
808
  rel?: string;
809
+ /**
810
+ * Auto-generate rel. You must specify domain inside theme
811
+ */
812
+ autoRel?: boolean;
805
813
  }
806
814
  /**
807
815
  * Расширен:
@@ -1042,6 +1050,10 @@ interface ButtonProps extends BaseProps, Tooltiped, Display, Color, Color<'fontC
1042
1050
  as?: 'div' | 'span' | 'a' | 'button' | typeof Link | typeof Anchor;
1043
1051
  target?: string;
1044
1052
  rel?: string;
1053
+ /**
1054
+ * Auto-generate rel. You must specify domain inside theme
1055
+ */
1056
+ autoRel?: boolean;
1045
1057
  /**
1046
1058
  * Link href
1047
1059
  */