@veeqo/ui 13.15.0 → 13.15.1

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 +1 @@
1
- {"version":3,"file":"withClassNames.cjs","sources":["../../../src/hoc/withClassNames/withClassNames.ts"],"sourcesContent":["import React from 'react';\nimport { AnyStyledComponent } from 'styled-components';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\n/**\n * Creates a wrapper for a specified component that applies a given set of className's when rendered. Useful when\n * you're rendering multiple components which need to have the same CSS module classnames applied, allowing us to use\n * a similar approach to styled-components.\n *\n * Example usage:\n *\n * `styled.ts`:\n * ```\n * const StyledButton = withClassNames(Button, ['button', 'button--primary']);\n * ```\n *\n * `component.tsx`:\n * ```\n * <StyledButton className=\"other-class\">Click me</StyledButton>\n * ```\n *\n * @param Component Component to render with styles applied.\n * @param classNames An array of class names to apply to instances of the component.\n */\nexport const withClassNames = <P extends { className?: string }>(\n Component: React.ComponentType<P> | keyof JSX.IntrinsicElements | AnyStyledComponent,\n classNames: string[],\n) => {\n const ComponentWithClassNames = React.forwardRef<unknown, P>(({ className, ...props }, ref) =>\n React.createElement(Component, {\n ...(props as P),\n ref,\n className: buildClassnames([...classNames, className]),\n }),\n );\n\n const componentName =\n typeof Component === 'string'\n ? Component\n : (Component as React.ComponentType<P>).displayName ||\n (Component as React.ComponentType<P>).name ||\n 'Component';\n\n ComponentWithClassNames.displayName = `withClassNames(${componentName})`;\n\n return ComponentWithClassNames;\n};\n"],"names":["React","buildClassnames"],"mappings":";;;;;;;;;AAIA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,cAAc,GAAG,CAC5B,SAAoF,EACpF,UAAoB,KAClB;IACF,MAAM,uBAAuB,GAAGA,sBAAK,CAAC,UAAU,CAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KACxFA,sBAAK,CAAC,aAAa,CAAC,SAAS,EAAE;AAC7B,QAAA,GAAI,KAAW;QACf,GAAG;QACH,SAAS,EAAEC,+BAAe,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC;AACvD,KAAA,CAAC,CACH;AAED,IAAA,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK;AACnB,UAAE;UACC,SAAoC,CAAC,WAAW;AAChD,YAAA,SAAoC,CAAC,IAAI;AAC1C,YAAA,WAAW;AAEjB,IAAA,uBAAuB,CAAC,WAAW,GAAG,CAAkB,eAAA,EAAA,aAAa,GAAG;AAExE,IAAA,OAAO,uBAAuB;AAChC;;;;"}
1
+ {"version":3,"file":"withClassNames.cjs","sources":["../../../src/hoc/withClassNames/withClassNames.ts"],"sourcesContent":["import React from 'react';\nimport { AnyStyledComponent } from 'styled-components';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\ntype PropsOf<C> = C extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[C]\n : C extends React.ComponentType<infer P>\n ? P\n : never;\n\ntype WithClassName = { className?: string };\n\n/**\n * Creates a wrapper for a specified component that applies a given set of className's when rendered. Useful when\n * you're rendering multiple components which need to have the same CSS module classnames applied, allowing us to use\n * a similar approach to styled-components.\n *\n * Example usage:\n *\n * `styled.ts`:\n * ```\n * const StyledButton = withClassNames(Button, ['button', 'button--primary']);\n * ```\n *\n * `component.tsx`:\n * ```\n * <StyledButton className=\"other-class\">Click me</StyledButton>\n * ```\n *\n * @param Component Component to render with styles applied.\n * @param classNames An array of class names to apply to instances of the component.\n */\nexport const withClassNames = <\n C extends React.ComponentType<any> | keyof JSX.IntrinsicElements | AnyStyledComponent,\n>(\n Component: PropsOf<C> extends WithClassName ? C : never,\n classNames: string[],\n) => {\n const ComponentWithClassNames = React.forwardRef<unknown, PropsOf<C>>(\n ({ className, ...props }: any, ref) =>\n React.createElement(Component as any, {\n ...props,\n ref,\n className: buildClassnames([...classNames, className]),\n }),\n );\n\n const componentName =\n typeof Component === 'string'\n ? Component\n : (Component as React.ComponentType<any>).displayName ||\n (Component as React.ComponentType<any>).name ||\n 'Component';\n\n ComponentWithClassNames.displayName = `withClassNames(${componentName})`;\n\n return ComponentWithClassNames;\n};\n"],"names":["React","buildClassnames"],"mappings":";;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,cAAc,GAAG,CAG5B,SAAuD,EACvD,UAAoB,KAClB;IACF,MAAM,uBAAuB,GAAGA,sBAAK,CAAC,UAAU,CAC9C,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAO,EAAE,GAAG,KAChCA,sBAAK,CAAC,aAAa,CAAC,SAAgB,EAAE;AACpC,QAAA,GAAG,KAAK;QACR,GAAG;QACH,SAAS,EAAEC,+BAAe,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC;AACvD,KAAA,CAAC,CACL;AAED,IAAA,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK;AACnB,UAAE;UACC,SAAsC,CAAC,WAAW;AAClD,YAAA,SAAsC,CAAC,IAAI;AAC5C,YAAA,WAAW;AAEjB,IAAA,uBAAuB,CAAC,WAAW,GAAG,CAAkB,eAAA,EAAA,aAAa,GAAG;AAExE,IAAA,OAAO,uBAAuB;AAChC;;;;"}
@@ -1,5 +1,9 @@
1
1
  import React from 'react';
2
2
  import { AnyStyledComponent } from 'styled-components';
3
+ type PropsOf<C> = C extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[C] : C extends React.ComponentType<infer P> ? P : never;
4
+ type WithClassName = {
5
+ className?: string;
6
+ };
3
7
  /**
4
8
  * Creates a wrapper for a specified component that applies a given set of className's when rendered. Useful when
5
9
  * you're rendering multiple components which need to have the same CSS module classnames applied, allowing us to use
@@ -20,6 +24,5 @@ import { AnyStyledComponent } from 'styled-components';
20
24
  * @param Component Component to render with styles applied.
21
25
  * @param classNames An array of class names to apply to instances of the component.
22
26
  */
23
- export declare const withClassNames: <P extends {
24
- className?: string | undefined;
25
- }>(Component: keyof JSX.IntrinsicElements | AnyStyledComponent | React.ComponentType<P>, classNames: string[]) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<unknown>>;
27
+ export declare const withClassNames: <C extends keyof JSX.IntrinsicElements | React.ComponentType<any> | AnyStyledComponent>(Component: PropsOf<C> extends WithClassName ? C : never, classNames: string[]) => React.ForwardRefExoticComponent<React.PropsWithoutRef<PropsOf<C>> & React.RefAttributes<unknown>>;
28
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"withClassNames.js","sources":["../../../src/hoc/withClassNames/withClassNames.ts"],"sourcesContent":["import React from 'react';\nimport { AnyStyledComponent } from 'styled-components';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\n/**\n * Creates a wrapper for a specified component that applies a given set of className's when rendered. Useful when\n * you're rendering multiple components which need to have the same CSS module classnames applied, allowing us to use\n * a similar approach to styled-components.\n *\n * Example usage:\n *\n * `styled.ts`:\n * ```\n * const StyledButton = withClassNames(Button, ['button', 'button--primary']);\n * ```\n *\n * `component.tsx`:\n * ```\n * <StyledButton className=\"other-class\">Click me</StyledButton>\n * ```\n *\n * @param Component Component to render with styles applied.\n * @param classNames An array of class names to apply to instances of the component.\n */\nexport const withClassNames = <P extends { className?: string }>(\n Component: React.ComponentType<P> | keyof JSX.IntrinsicElements | AnyStyledComponent,\n classNames: string[],\n) => {\n const ComponentWithClassNames = React.forwardRef<unknown, P>(({ className, ...props }, ref) =>\n React.createElement(Component, {\n ...(props as P),\n ref,\n className: buildClassnames([...classNames, className]),\n }),\n );\n\n const componentName =\n typeof Component === 'string'\n ? Component\n : (Component as React.ComponentType<P>).displayName ||\n (Component as React.ComponentType<P>).name ||\n 'Component';\n\n ComponentWithClassNames.displayName = `withClassNames(${componentName})`;\n\n return ComponentWithClassNames;\n};\n"],"names":["React"],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,cAAc,GAAG,CAC5B,SAAoF,EACpF,UAAoB,KAClB;IACF,MAAM,uBAAuB,GAAGA,cAAK,CAAC,UAAU,CAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KACxFA,cAAK,CAAC,aAAa,CAAC,SAAS,EAAE;AAC7B,QAAA,GAAI,KAAW;QACf,GAAG;QACH,SAAS,EAAE,eAAe,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC;AACvD,KAAA,CAAC,CACH;AAED,IAAA,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK;AACnB,UAAE;UACC,SAAoC,CAAC,WAAW;AAChD,YAAA,SAAoC,CAAC,IAAI;AAC1C,YAAA,WAAW;AAEjB,IAAA,uBAAuB,CAAC,WAAW,GAAG,CAAkB,eAAA,EAAA,aAAa,GAAG;AAExE,IAAA,OAAO,uBAAuB;AAChC;;;;"}
1
+ {"version":3,"file":"withClassNames.js","sources":["../../../src/hoc/withClassNames/withClassNames.ts"],"sourcesContent":["import React from 'react';\nimport { AnyStyledComponent } from 'styled-components';\nimport { buildClassnames } from '../../utils/buildClassnames';\n\ntype PropsOf<C> = C extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[C]\n : C extends React.ComponentType<infer P>\n ? P\n : never;\n\ntype WithClassName = { className?: string };\n\n/**\n * Creates a wrapper for a specified component that applies a given set of className's when rendered. Useful when\n * you're rendering multiple components which need to have the same CSS module classnames applied, allowing us to use\n * a similar approach to styled-components.\n *\n * Example usage:\n *\n * `styled.ts`:\n * ```\n * const StyledButton = withClassNames(Button, ['button', 'button--primary']);\n * ```\n *\n * `component.tsx`:\n * ```\n * <StyledButton className=\"other-class\">Click me</StyledButton>\n * ```\n *\n * @param Component Component to render with styles applied.\n * @param classNames An array of class names to apply to instances of the component.\n */\nexport const withClassNames = <\n C extends React.ComponentType<any> | keyof JSX.IntrinsicElements | AnyStyledComponent,\n>(\n Component: PropsOf<C> extends WithClassName ? C : never,\n classNames: string[],\n) => {\n const ComponentWithClassNames = React.forwardRef<unknown, PropsOf<C>>(\n ({ className, ...props }: any, ref) =>\n React.createElement(Component as any, {\n ...props,\n ref,\n className: buildClassnames([...classNames, className]),\n }),\n );\n\n const componentName =\n typeof Component === 'string'\n ? Component\n : (Component as React.ComponentType<any>).displayName ||\n (Component as React.ComponentType<any>).name ||\n 'Component';\n\n ComponentWithClassNames.displayName = `withClassNames(${componentName})`;\n\n return ComponentWithClassNames;\n};\n"],"names":["React"],"mappings":";;;AAYA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,cAAc,GAAG,CAG5B,SAAuD,EACvD,UAAoB,KAClB;IACF,MAAM,uBAAuB,GAAGA,cAAK,CAAC,UAAU,CAC9C,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAO,EAAE,GAAG,KAChCA,cAAK,CAAC,aAAa,CAAC,SAAgB,EAAE;AACpC,QAAA,GAAG,KAAK;QACR,GAAG;QACH,SAAS,EAAE,eAAe,CAAC,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,CAAC;AACvD,KAAA,CAAC,CACL;AAED,IAAA,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK;AACnB,UAAE;UACC,SAAsC,CAAC,WAAW;AAClD,YAAA,SAAsC,CAAC,IAAI;AAC5C,YAAA,WAAW;AAEjB,IAAA,uBAAuB,CAAC,WAAW,GAAG,CAAkB,eAAA,EAAA,aAAa,GAAG;AAExE,IAAA,OAAO,uBAAuB;AAChC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veeqo/ui",
3
- "version": "13.15.0",
3
+ "version": "13.15.1",
4
4
  "description": "New optimised component library for Veeqo.",
5
5
  "author": "Robert Wealthall",
6
6
  "license": "ISC",