@cronocode/react-box 3.0.0 → 3.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.
- package/README.md +53 -42
- package/box.d.ts +3 -2
- package/components/button.d.ts +4 -4
- package/components/checkbox.d.ts +1 -1
- package/components/flex.d.ts +1 -2
- package/components/form.d.ts +3 -4
- package/components/grid.d.ts +1 -2
- package/components/radioButton.d.ts +4 -4
- package/components/textarea.d.ts +4 -4
- package/components/textbox.d.ts +4 -4
- package/components/tooltip.d.ts +2 -3
- package/core/boxExtends.d.ts +4 -2
- package/core/boxStyles.d.ts +34 -13
- package/core/coreTypes.d.ts +3 -3
- package/core/theme.d.ts +4 -0
- package/core/variables.d.ts +256 -0
- package/core.cjs +4 -4
- package/core.mjs +591 -276
- package/package.json +1 -1
- package/types.d.ts +11 -6
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This is a react base component which will reduce considerably necessity to write
|
|
|
6
6
|
|
|
7
7
|
1. Installation
|
|
8
8
|
|
|
9
|
-
```
|
|
9
|
+
```bash
|
|
10
10
|
npm install @cronocode/react-box
|
|
11
11
|
```
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Sizes is equal to `1/4rem`
|
|
|
18
18
|
|
|
19
19
|
In the example below is creating a box with `maring: 0.5rem` and `padding: 1.75rem`
|
|
20
20
|
|
|
21
|
-
```
|
|
21
|
+
```JS
|
|
22
22
|
import Box from "@cronocode/react-box";
|
|
23
23
|
|
|
24
24
|
export default function Component(props: Props) {
|
|
@@ -36,7 +36,7 @@ export default function Component(props: Props) {
|
|
|
36
36
|
|
|
37
37
|
- **Box** - base component with a tons of props
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```JS
|
|
40
40
|
import Box from "@cronocode/react-box";
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -46,72 +46,83 @@ import Box from "@cronocode/react-box";
|
|
|
46
46
|
|
|
47
47
|
- **Flex** - this is a `Box` component with `display: flex` style
|
|
48
48
|
|
|
49
|
-
```
|
|
49
|
+
```JS
|
|
50
50
|
import Flex from "@cronocode/react-box/components/flex";
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
- **Button** - this is a `Box` component with html tag `button` and `onClick` prop
|
|
54
54
|
|
|
55
|
-
```
|
|
55
|
+
```JS
|
|
56
56
|
import Button from "@cronocode/react-box/components/button";
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
- **Textbox** - this is a `Box` component with html tag `input`
|
|
60
60
|
|
|
61
|
-
```
|
|
61
|
+
```JS
|
|
62
62
|
import Textbox from "@cronocode/react-box/components/textbox";
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
- **Tooltip** - this is useful when you need a position absolute and the parent has overflow hidden.
|
|
66
66
|
|
|
67
|
-
```
|
|
67
|
+
```JS
|
|
68
68
|
import Tooltip from "@cronocode/react-box/components/tooltip";
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
## Extend props
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
It is possible to add your own props to define your custom styles.
|
|
74
|
+
You need to do a few steps.
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
function themePlugin() {
|
|
77
|
-
return {
|
|
78
|
-
name: 'themePlugin',
|
|
79
|
-
configResolved() {
|
|
80
|
-
const result = Theme.setupAugmentedProps({
|
|
81
|
-
colors: {
|
|
82
|
-
primary: '#445566'
|
|
83
|
-
},
|
|
84
|
-
backgroundImages: {
|
|
85
|
-
gradient: 'linear-gradient(to right, #77A1D3 0%, #79CBCA 51%, #77A1D3 100%)'
|
|
86
|
-
},
|
|
87
|
-
shadows: {
|
|
88
|
-
1: '0 4px 10px rgb(224 224 224 / 52%)',
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
fs.writeFileSync('./src/box-theme.generated.css', result.variables);
|
|
93
|
-
fs.writeFileSync('./src/box.generated.d.ts', result.boxDts);
|
|
94
|
-
},
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
2. Add this plugin to your build tool
|
|
101
|
-
|
|
102
|
-
Vitejs
|
|
76
|
+
1. In a project root file you need to define your extends
|
|
103
77
|
|
|
104
78
|
```JS
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
79
|
+
import Box from "@cronocode/react-box";
|
|
80
|
+
|
|
81
|
+
export const { extendedProps, extendedPropTypes } = Box.extend(
|
|
82
|
+
// css variables
|
|
83
|
+
{
|
|
84
|
+
dark: '#123123',
|
|
85
|
+
light: '#ededed',
|
|
86
|
+
cssVarName: 'cssVarValue',
|
|
87
|
+
myShadow: '10px 5px 5px red',
|
|
88
|
+
myGradient1: 'linear-gradient(#e66465, #9198e5)',
|
|
89
|
+
myGradient2: 'linear-gradient(black, white)',
|
|
90
|
+
},
|
|
91
|
+
// new custom props
|
|
92
|
+
{
|
|
93
|
+
background: [
|
|
94
|
+
{
|
|
95
|
+
values: ['myGradient1', 'myGradient2'] as const,
|
|
96
|
+
valueFormat: (value: string) => `var(--background${value})`,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
// extend values for existing props
|
|
101
|
+
{
|
|
102
|
+
color: [
|
|
103
|
+
{
|
|
104
|
+
values: ['dark', 'light'],
|
|
105
|
+
valueFormat: (value, useVariable) => useVariable(value),
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
}
|
|
109
|
+
);
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
2. Now you have to add typings to the Box in order to have intellisense for you new props and value.
|
|
113
|
+
You need to create a `box.d.ts`
|
|
112
114
|
|
|
113
115
|
```JS
|
|
114
|
-
import '
|
|
116
|
+
import '@cronocode/react-box';
|
|
117
|
+
import { ExtractBoxStyles } from '@cronocode/react-box/types';
|
|
118
|
+
import { extendedProps, extendedPropTypes } from './path-to-your-b0x-extends-declaration';
|
|
119
|
+
|
|
120
|
+
declare module '@cronocode/react-box/types' {
|
|
121
|
+
namespace Augmented {
|
|
122
|
+
interface BoxProps extends ExtractBoxStyles<typeof extendedProps> {}
|
|
123
|
+
interface BoxPropTypes extends ExtractBoxStyles<typeof extendedPropTypes> {}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
115
126
|
```
|
|
116
127
|
|
|
117
128
|
## Theme for components
|
package/box.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React, RefAttributes } from 'react';
|
|
1
|
+
import { default as React, Ref, RefAttributes } from 'react';
|
|
2
2
|
import { ClassNameType } from './core/classNames';
|
|
3
3
|
import { ExtractElementFromTag } from './core/coreTypes';
|
|
4
4
|
import { BoxStyleProps } from './types';
|
|
@@ -15,6 +15,7 @@ interface Props<TTag extends keyof React.JSX.IntrinsicElements> extends BoxStyle
|
|
|
15
15
|
className?: ClassNameType;
|
|
16
16
|
style?: React.ComponentProps<TTag>['style'];
|
|
17
17
|
}
|
|
18
|
+
declare function BoxComponent<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag>, ref: Ref<ExtractElementFromTag<TTag>>): React.ReactElement<React.ComponentProps<TTag>, string | React.JSXElementConstructor<any>>;
|
|
18
19
|
interface BoxType {
|
|
19
20
|
<TTag extends keyof React.JSX.IntrinsicElements = 'div'>(props: Props<TTag> & RefAttributes<ExtractElementFromTag<TTag>>): React.ReactNode;
|
|
20
21
|
extend: typeof BoxExtends.extend;
|
|
@@ -22,5 +23,5 @@ interface BoxType {
|
|
|
22
23
|
}
|
|
23
24
|
declare const Box: BoxType;
|
|
24
25
|
export default Box;
|
|
25
|
-
export type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = React.ComponentProps<typeof
|
|
26
|
+
export type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = React.ComponentProps<typeof BoxComponent<TTag>>;
|
|
26
27
|
export type BoxTagProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Required<BoxProps<TTag>>['props'];
|
package/components/button.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
type BoxTagProps = Required<
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
type ButtonProps = Omit<BoxProps<'button'>, 'ref' | 'tag'>;
|
|
3
|
+
type BoxTagProps = Required<ButtonProps>['props'];
|
|
4
4
|
declare const tagProps: readonly ["type", "onClick"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
6
|
type ButtonTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
7
7
|
type ButtonType = Required<React.ComponentProps<'button'>>['type'];
|
|
8
|
-
interface Props extends Omit<
|
|
8
|
+
interface Props extends Omit<ButtonProps, 'props'> {
|
|
9
9
|
props?: ButtonTagProps;
|
|
10
10
|
type?: ButtonType;
|
|
11
11
|
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
package/components/checkbox.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ interface Props extends CheckboxProps {
|
|
|
13
13
|
readOnly?: boolean;
|
|
14
14
|
defaultChecked?: boolean;
|
|
15
15
|
}
|
|
16
|
-
declare const _default: import('react').ForwardRefExoticComponent<
|
|
16
|
+
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLInputElement>>;
|
|
17
17
|
export default _default;
|
package/components/flex.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RefAttributes } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BoxProps } from '../box';
|
|
3
3
|
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
4
|
-
type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
|
|
5
4
|
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
6
5
|
export default _default;
|
package/components/form.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
type BoxTagProps = Required<BoxProps>['props'];
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
type BoxTagProps = Required<BoxProps<'form'>>['props'];
|
|
4
3
|
type FormTagProps = Omit<BoxTagProps, 'onSubmit' | 'ref'>;
|
|
5
|
-
interface Props<T> extends Omit<BoxProps
|
|
4
|
+
interface Props<T> extends Omit<BoxProps<'form'>, 'props' | 'tag'> {
|
|
6
5
|
props?: FormTagProps;
|
|
7
6
|
onSubmit: (obj: T, e: React.ChangeEvent<HTMLFormElement>) => void;
|
|
8
7
|
}
|
package/components/grid.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RefAttributes } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BoxProps } from '../box';
|
|
3
3
|
import { ExtractElementFromTag } from '../core/coreTypes';
|
|
4
|
-
type BoxProps<TTag extends keyof React.JSX.IntrinsicElements = 'div'> = Omit<React.ComponentProps<typeof Box<TTag>>, 'ref'>;
|
|
5
4
|
declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div">(props: BoxProps<TTag> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
|
|
6
5
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
type BoxTagProps = Required<
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
type RadioButtonProps = Omit<BoxProps<'input'>, 'ref' | 'tag'>;
|
|
3
|
+
type BoxTagProps = Required<RadioButtonProps>['props'];
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
6
|
type RadioButtonTagProps = Omit<BoxTagProps, TagPropsType | 'type'>;
|
|
7
|
-
interface Props extends Omit<
|
|
7
|
+
interface Props extends Omit<RadioButtonProps, 'props'> {
|
|
8
8
|
name?: string;
|
|
9
9
|
props?: RadioButtonTagProps;
|
|
10
10
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
package/components/textarea.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
type BoxTagProps = Required<
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
type TextareaProps = Omit<BoxProps<'textarea'>, 'ref' | 'tag'>;
|
|
3
|
+
type BoxTagProps = Required<TextareaProps>['props'];
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "placeholder", "value", "defaultValue", "rows", "cols", "autoFocus", "maxLength", "minLength", "readOnly"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
6
|
type TextareaTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
7
|
-
interface Props extends Omit<
|
|
7
|
+
interface Props extends Omit<TextareaProps, 'props'> {
|
|
8
8
|
name?: string;
|
|
9
9
|
props?: TextareaTagProps;
|
|
10
10
|
onInput?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
package/components/textbox.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
3
|
-
type BoxTagProps = Required<
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
type TextareaProps = Omit<BoxProps<'input'>, 'ref' | 'tag'>;
|
|
3
|
+
type BoxTagProps = Required<TextareaProps>['props'];
|
|
4
4
|
declare const tagProps: readonly ["name", "onInput", "onChange", "type", "placeholder", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
|
|
5
5
|
type TagPropsType = (typeof tagProps)[number];
|
|
6
6
|
type TextboxTagProps = Omit<BoxTagProps, TagPropsType>;
|
|
7
7
|
type TextboxType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
8
|
-
interface Props extends Omit<
|
|
8
|
+
interface Props extends Omit<TextareaProps, 'props'> {
|
|
9
9
|
name?: string;
|
|
10
10
|
props?: TextboxTagProps;
|
|
11
11
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
package/components/tooltip.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface Props extends React.ComponentProps<typeof Box> {
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
interface Props extends BoxProps {
|
|
4
3
|
onPositionChange?(position: {
|
|
5
4
|
top: number;
|
|
6
5
|
left: number;
|
package/core/boxExtends.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BoxStyle } from './coreTypes';
|
|
2
2
|
declare namespace BoxExtends {
|
|
3
|
-
function extend<TProps extends Record<string, BoxStyle[]>>(variables: Record<string, string>,
|
|
4
|
-
|
|
3
|
+
function extend<TProps extends Record<string, BoxStyle[]>, TPropTypes extends Record<string, BoxStyle[]>>(variables: Record<string, string>, extendedProps: TProps, extendedPropTypes: TPropTypes): {
|
|
4
|
+
extendedProps: TProps;
|
|
5
|
+
extendedPropTypes: TPropTypes;
|
|
6
|
+
};
|
|
5
7
|
}
|
|
6
8
|
export default BoxExtends;
|
package/core/boxStyles.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BoxStylesFormatters } from './boxStylesFormatters';
|
|
2
|
+
import { default as Variables } from './variables';
|
|
2
3
|
export declare const cssStyles: {
|
|
3
4
|
/** The appearance CSS property is used to display UI elements with platform-specific styling, based on the operating system's theme. */
|
|
4
5
|
appearance: {
|
|
@@ -60,50 +61,50 @@ export declare const cssStyles: {
|
|
|
60
61
|
/** The border-top-radius CSS property rounds the top corners of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
61
62
|
borderRadiusTop: {
|
|
62
63
|
values: number;
|
|
63
|
-
styleName: string;
|
|
64
|
-
valueFormat:
|
|
64
|
+
styleName: string[];
|
|
65
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
65
66
|
}[];
|
|
66
67
|
/** The border-right-radius CSS property rounds the right corners of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
67
68
|
borderRadiusRight: {
|
|
68
69
|
values: number;
|
|
69
|
-
styleName: string;
|
|
70
|
-
valueFormat:
|
|
70
|
+
styleName: string[];
|
|
71
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
71
72
|
}[];
|
|
72
73
|
/** The border-bottom-radius CSS property rounds the bottom corners of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
73
74
|
borderRadiusBottom: {
|
|
74
75
|
values: number;
|
|
75
|
-
styleName: string;
|
|
76
|
-
valueFormat:
|
|
76
|
+
styleName: string[];
|
|
77
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
77
78
|
}[];
|
|
78
79
|
/** The border-left-radius CSS property rounds the left corners of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
79
80
|
borderRadiusLeft: {
|
|
80
81
|
values: number;
|
|
81
|
-
styleName: string;
|
|
82
|
-
valueFormat:
|
|
82
|
+
styleName: string[];
|
|
83
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
83
84
|
}[];
|
|
84
85
|
/** The border-top-left-radius CSS property rounds the top-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
85
86
|
borderRadiusTopLeft: {
|
|
86
87
|
values: number;
|
|
87
88
|
styleName: string;
|
|
88
|
-
valueFormat:
|
|
89
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
89
90
|
}[];
|
|
90
91
|
/** The border-top-right-radius CSS property rounds the top-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
91
92
|
borderRadiusTopRight: {
|
|
92
93
|
values: number;
|
|
93
94
|
styleName: string;
|
|
94
|
-
valueFormat:
|
|
95
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
95
96
|
}[];
|
|
96
97
|
/** The border-bottom-right-radius CSS property rounds the bottom-right corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
97
98
|
borderRadiusBottomRight: {
|
|
98
99
|
values: number;
|
|
99
100
|
styleName: string;
|
|
100
|
-
valueFormat:
|
|
101
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
101
102
|
}[];
|
|
102
103
|
/** The border-bottom-left-radius CSS property rounds the bottom-left corner of an element by specifying the radius (or the radius of the semi-major and semi-minor axes) of the ellipse defining the curvature of the corner. */
|
|
103
104
|
borderRadiusBottomLeft: {
|
|
104
105
|
values: number;
|
|
105
106
|
styleName: string;
|
|
106
|
-
valueFormat:
|
|
107
|
+
valueFormat: typeof BoxStylesFormatters.Value.rem;
|
|
107
108
|
}[];
|
|
108
109
|
/** The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
|
109
110
|
position: {
|
|
@@ -642,7 +643,7 @@ export declare const cssStyles: {
|
|
|
642
643
|
valueFormat?: undefined;
|
|
643
644
|
})[];
|
|
644
645
|
/** The grid-column CSS shorthand property specifies a grid item's size and location within a grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. */
|
|
645
|
-
|
|
646
|
+
colSpan: ({
|
|
646
647
|
styleName: string;
|
|
647
648
|
values: number;
|
|
648
649
|
valueFormat: (value: number) => string;
|
|
@@ -681,6 +682,25 @@ export declare const cssStyles: {
|
|
|
681
682
|
styleName: string;
|
|
682
683
|
values: number;
|
|
683
684
|
}[];
|
|
685
|
+
color: {
|
|
686
|
+
values: Variables.ColorType[];
|
|
687
|
+
valueFormat: (value: string, useVariable: (name: string) => string) => string;
|
|
688
|
+
}[];
|
|
689
|
+
bgColor: {
|
|
690
|
+
values: Variables.ColorType[];
|
|
691
|
+
valueFormat: (value: string, useVariable: (name: string) => string) => string;
|
|
692
|
+
styleName: string;
|
|
693
|
+
}[];
|
|
694
|
+
borderColor: {
|
|
695
|
+
values: Variables.ColorType[];
|
|
696
|
+
valueFormat: (value: string, useVariable: (name: string) => string) => string;
|
|
697
|
+
styleName: string;
|
|
698
|
+
}[];
|
|
699
|
+
outlineColor: {
|
|
700
|
+
values: Variables.ColorType[];
|
|
701
|
+
valueFormat: (value: string, useVariable: (name: string) => string) => string;
|
|
702
|
+
styleName: string;
|
|
703
|
+
}[];
|
|
684
704
|
};
|
|
685
705
|
export declare const pseudo1: {
|
|
686
706
|
hover: string;
|
|
@@ -728,6 +748,7 @@ export declare const pseudoGroupClasses: {
|
|
|
728
748
|
hoverGroup: "hover";
|
|
729
749
|
focusGroup: "focus";
|
|
730
750
|
activeGroup: "active";
|
|
751
|
+
disabledGroup: "disabled";
|
|
731
752
|
};
|
|
732
753
|
export declare const breakpoints: {
|
|
733
754
|
sm: number;
|
package/core/coreTypes.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export type ArrayType<T> = T extends (infer U)[] ? U : T;
|
|
2
1
|
export type BoxStylesType<T> = T extends ReadonlyArray<infer U> ? T[number] : T;
|
|
3
2
|
export type ExtractElementType<T> = T extends React.DetailedHTMLProps<React.HTMLAttributes<infer E>, infer E> ? E : T extends React.SVGProps<infer E> ? E : never;
|
|
4
3
|
export type ExtractElementFromTag<T extends keyof React.JSX.IntrinsicElements> = ExtractElementType<React.JSX.IntrinsicElements[T]>;
|
|
5
4
|
interface BoxStyleArrayString {
|
|
6
5
|
values: ReadonlyArray<string>;
|
|
7
|
-
valueFormat?: (value: string) => string;
|
|
6
|
+
valueFormat?: (value: string, useVariable: (name: string) => string) => string;
|
|
8
7
|
}
|
|
9
8
|
interface BoxStyleArrayBoolean {
|
|
10
9
|
values: ReadonlyArray<boolean>;
|
|
@@ -23,7 +22,8 @@ interface BoxStyleString {
|
|
|
23
22
|
valueFormat?: (value: string) => string;
|
|
24
23
|
}
|
|
25
24
|
export type BoxStyle = (BoxStyleArrayString | BoxStyleArrayBoolean | BoxStyleArrayNumber | BoxStyleNumber | BoxStyleString) & {
|
|
26
|
-
styleName?: string;
|
|
25
|
+
styleName?: string | string[];
|
|
26
|
+
selector?: (className: string, pseudoClass: string) => string;
|
|
27
27
|
};
|
|
28
28
|
export type ExtractKeys<T extends Record<string, unknown>, TT> = {
|
|
29
29
|
[K in keyof T]?: TT;
|
package/core/theme.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export interface ThemeComponentStyles {
|
|
|
4
4
|
themes?: {
|
|
5
5
|
[name: string]: BoxThemeStyles;
|
|
6
6
|
};
|
|
7
|
+
children?: {
|
|
8
|
+
[name: string]: ThemeComponentStyles;
|
|
9
|
+
};
|
|
7
10
|
}
|
|
8
11
|
export interface ThemeSetup {
|
|
9
12
|
components?: {
|
|
@@ -15,6 +18,7 @@ export interface ThemeSetup {
|
|
|
15
18
|
checkbox?: ThemeComponentStyles;
|
|
16
19
|
radioButton?: ThemeComponentStyles;
|
|
17
20
|
label?: ThemeComponentStyles;
|
|
21
|
+
dropdown?: ThemeComponentStyles;
|
|
18
22
|
}
|
|
19
23
|
declare namespace Theme {
|
|
20
24
|
function setup(styles: ThemeSetup): void;
|