@gsretail.com/gui-core
Version:
A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook
2 lines (1 loc) • 1.84 kB
JavaScript
import n from"./responsivePropType.js";import{getPath as e}from"./style.js";const r=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],o=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],i=[...r,...o];function t(n,r,o,i){var t;const a=null!=(t=e(n,r,!1))?t:o;return"number"==typeof a?n=>"string"==typeof n?n:("production"!==process.env.NODE_ENV&&"number"!=typeof n&&console.error(`MUI: Expected ${i} argument to be a number or a string, got ${n}.`),a*n):Array.isArray(a)?n=>"string"==typeof n?n:("production"!==process.env.NODE_ENV&&(Number.isInteger(n)?n>a.length-1&&console.error([`MUI: The value provided (${n}) overflows.`,`The supported values are: ${JSON.stringify(a)}.`,`${n} > ${a.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${r}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${r}\` as a number.`].join("\n"))),a[n]):"function"==typeof a?a:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${r}\` value (${a}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function a(n){return t(n,"spacing",8,"spacing")}"production"===process.env.NODE_ENV||r.reduce(((e,r)=>(e[r]=n,e)),{}),"production"===process.env.NODE_ENV||o.reduce(((e,r)=>(e[r]=n,e)),{}),"production"===process.env.NODE_ENV||i.reduce(((e,r)=>(e[r]=n,e)),{});export{a as createUnarySpacing,t as createUnaryUnit};