@cronocode/react-box 1.7.1 → 1.7.3

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,4 +1,4 @@
1
- export declare namespace DoxStylesFormatters {
1
+ export declare namespace BoxStylesFormatters {
2
2
  namespace ClassName {
3
3
  function fraction(key: string, value: string | number | boolean): string;
4
4
  function svg(selector: string): string[];
@@ -0,0 +1,3 @@
1
+ import { boxStyles, pseudoClassSuffixes } from './boxStyles';
2
+ export type StyleKey = keyof typeof boxStyles;
3
+ export type PseudoClassSuffix = (typeof pseudoClassSuffixes)[number];
@@ -0,0 +1,2 @@
1
+ export type ClassNameType = undefined | string | string[] | Record<string, boolean> | ClassNameType[];
2
+ export declare function classNames(...classNameRules: ClassNameType[]): string[];
@@ -1,6 +1,7 @@
1
- export declare namespace StylesContext {
2
- const doxClassName = "_dox";
1
+ declare namespace StylesContext {
2
+ const boxClassName = "_box";
3
3
  const svgClassName = "_svg";
4
4
  function get(key: string, value: string | number | boolean): string | undefined;
5
5
  function flush(): void;
6
6
  }
7
+ export default StylesContext;
@@ -0,0 +1,38 @@
1
+ import { BoxStyleProps } from './types';
2
+ export interface ThemeStyles {
3
+ styles: BoxStyleProps;
4
+ disabled?: BoxStyleProps;
5
+ }
6
+ export interface ThemeComponentStyles {
7
+ styles: BoxStyleProps;
8
+ disabled?: BoxStyleProps;
9
+ themes?: {
10
+ [name: string]: ThemeStyles;
11
+ };
12
+ }
13
+ export interface ThemeSetup {
14
+ components?: {
15
+ [name: string]: ThemeComponentStyles;
16
+ };
17
+ button?: ThemeComponentStyles;
18
+ textbox?: ThemeComponentStyles;
19
+ textarea?: ThemeComponentStyles;
20
+ checkbox?: ThemeComponentStyles;
21
+ radioButton?: ThemeComponentStyles;
22
+ }
23
+ interface BoxAugmentedProps {
24
+ colors: Record<string, string>;
25
+ shadows: Record<string, string>;
26
+ backgrounds: Record<string, string>;
27
+ }
28
+ declare namespace Theme {
29
+ let Styles: ThemeSetup;
30
+ function setup(styles: ThemeSetup): void;
31
+ function setupAugmentedProps(props: BoxAugmentedProps, options?: {
32
+ namespacePath?: string;
33
+ }): {
34
+ variables: string;
35
+ boxDts: string;
36
+ };
37
+ }
38
+ export default Theme;
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import { StyleItem, aliases, boxStyles } from './boxStyles';
3
+ import { ThemeComponentProps } from './useTheme';
4
+ export type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
5
+ export type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
6
+ export type Hovered<T> = {
7
+ [K in keyof T as K extends string ? `${K}H` : never]: T[K];
8
+ };
9
+ export type Focused<T> = {
10
+ [K in keyof T as K extends string ? `${K}F` : never]: T[K];
11
+ };
12
+ export type Activated<T> = {
13
+ [K in keyof T as K extends string ? `${K}A` : never]: T[K];
14
+ };
15
+ export declare namespace Augmented {
16
+ interface BoxProps {
17
+ }
18
+ interface SvgProps {
19
+ }
20
+ }
21
+ type BoxStyles<T extends Record<string, StyleItem>> = {
22
+ [K in keyof T]?: T[K]['values1']['values'][number] | T[K]['values2']['values'][number] | T[K]['values3']['values'][number];
23
+ };
24
+ type BoxNormalStyles = BoxStyles<typeof boxStyles> & BoxStyles<typeof aliases>;
25
+ interface BoxPseudoClasses {
26
+ hover?: boolean;
27
+ focus?: boolean;
28
+ }
29
+ export type BoxStyleProps = BoxNormalStyles & BoxPseudoClasses & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles> & ThemeComponentProps & Augmented.BoxProps;
30
+ interface SvgNormalStyles {
31
+ rotate?: BoxNormalStyles['rotate'];
32
+ flip?: BoxNormalStyles['flip'];
33
+ transitionDuration?: BoxNormalStyles['transitionDuration'];
34
+ }
35
+ export type BoxSvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles> & Focused<SvgNormalStyles> & Activated<SvgNormalStyles> & ThemeComponentProps & Augmented.SvgProps;
36
+ export {};
@@ -0,0 +1,2 @@
1
+ import { BoxStyleProps } from './types';
2
+ export default function useStyles(props: BoxStyleProps, isSvg: boolean): (string | undefined)[];
@@ -0,0 +1,11 @@
1
+ import { ThemeSetup } from './theme';
2
+ import { BoxStyleProps } from './types';
3
+ type ReservedComponentName = Exclude<string, keyof Omit<ThemeSetup, 'components'>>;
4
+ export interface ThemeComponentProps {
5
+ clean?: boolean;
6
+ disabled?: boolean;
7
+ component?: ReservedComponentName;
8
+ theme?: string;
9
+ }
10
+ export declare function useTheme(props: ThemeComponentProps): BoxStyleProps | undefined;
11
+ export {};