@foxford/ui 2.0.1-beta-cc73152-20220909 → 2.0.2

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 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:y,href:b,to:h,as:v,target:j,content:N,onClick:C,ref:g,icon:k,type:x,innerRef:P}=p,R=a(p,c);var S=v||(y?'button':b?'a':h?r:'button');var _='a'!==S||y?{}:{href:b||h,target:j};var z='string'==typeof S||y?{}:{to:h||b};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:y||R.loading?void 0:C},B),_),z),E),R),{},{disabled:y,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',type:'button',width:'auto'},d.displayName='Button';export{d as Button};
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};
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 type: 'button',\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":"ueAkJO,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,aAAAA,EAAsB5B,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,QAlFhFF,EAAO0C,aAAe,CACpBpB,KAAM,IACNqB,SAAAA,EACAC,QAAS,cACT/B,KAAM,SACNgC,MAAO,QAGT7C,EAAOgC,YAAc"}
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","und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FhFF,EAAO0C,aAAe,CACpBpB,KAAM,IACNqB,SAAAA,EACAC,QAAS,cACTC,MAAO,QAGT7C,EAAOgC,YAAc"}
package/dts/index.d.ts CHANGED
@@ -1141,7 +1141,6 @@ declare namespace Button {
1141
1141
  size: string;
1142
1142
  rounded: boolean;
1143
1143
  display: string;
1144
- type: string;
1145
1144
  width: string;
1146
1145
  };
1147
1146
  var displayName: string;