@cronocode/react-box 3.0.11 → 3.0.13
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 +8 -7
- package/box.cjs +1 -1
- package/box.d.ts +8 -9
- package/box.mjs +16 -16
- package/components/button.d.ts +7 -6
- package/components/checkbox.d.ts +5 -3
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.mjs +4 -4
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +34 -23
- package/components/flex.d.ts +2 -1
- package/components/form.cjs +1 -1
- package/components/form.mjs +8 -5
- package/components/grid.d.ts +2 -1
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +7 -6
- package/components/radioButton.mjs +9 -9
- package/components/semantics.cjs +1 -1
- package/components/semantics.d.ts +27 -25
- package/components/semantics.mjs +26 -25
- package/components/textarea.d.ts +7 -6
- package/components/textbox.d.ts +7 -6
- package/components/tooltip.d.ts +1 -1
- package/core/boxStyles.d.ts +4 -2
- package/core/extends/boxComponents.d.ts +306 -0
- package/core/{boxExtends.d.ts → extends/boxExtends.d.ts} +4 -1
- package/core/extends/useComponents.d.ts +2 -0
- package/core/theme/theme.d.ts +1 -3
- package/core/theme/themeContext.d.ts +2 -4
- package/core/useStyles.d.ts +3 -3
- package/core.cjs +4 -4
- package/core.mjs +237 -230
- package/package.json +1 -1
- package/types.d.ts +46 -6
- package/components/label.cjs +0 -1
- package/components/label.d.ts +0 -5
- package/components/label.mjs +0 -10
- package/core/theme/defaultTheme.d.ts +0 -3
- package/core/theme/themeContract.d.ts +0 -25
- package/core/theme/useTheme.d.ts +0 -2
package/components/textbox.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { RefAttributes } from 'react';
|
|
2
|
+
import { BoxProps, BoxTagProps } from '../box';
|
|
3
|
+
import { ComponentsAndVariants } from '../types';
|
|
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
|
-
type
|
|
6
|
+
type TextareaProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'input', TKey>, 'tag' | 'props'>;
|
|
7
|
+
type TextboxTagProps = Omit<BoxTagProps<'input'>, TagPropsType | 'type'>;
|
|
7
8
|
type TextboxType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
8
|
-
interface Props extends
|
|
9
|
+
interface Props<TKey extends keyof ComponentsAndVariants> extends TextareaProps<TKey> {
|
|
9
10
|
name?: string;
|
|
10
11
|
props?: TextboxTagProps;
|
|
11
12
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -19,5 +20,5 @@ interface Props extends Omit<TextareaProps, 'props'> {
|
|
|
19
20
|
readOnly?: boolean;
|
|
20
21
|
step?: number | string;
|
|
21
22
|
}
|
|
22
|
-
declare const _default:
|
|
23
|
+
declare const _default: <TKey extends keyof ComponentsAndVariants = "textbox">(props: Props<TKey> & RefAttributes<HTMLInputElement>) => React.ReactNode;
|
|
23
24
|
export default _default;
|
package/components/tooltip.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ interface Props extends BoxProps {
|
|
|
5
5
|
left: number;
|
|
6
6
|
}): void;
|
|
7
7
|
}
|
|
8
|
-
declare const _default: import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const _default: import('react').ForwardRefExoticComponent<Omit<Props, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
9
|
export default _default;
|
package/core/boxStyles.d.ts
CHANGED
|
@@ -747,6 +747,7 @@ export declare const pseudo2: {
|
|
|
747
747
|
selected: string;
|
|
748
748
|
};
|
|
749
749
|
export declare const pseudoClasses: {
|
|
750
|
+
theme: string;
|
|
750
751
|
indeterminate: string;
|
|
751
752
|
checked: string;
|
|
752
753
|
required: string;
|
|
@@ -765,15 +766,16 @@ export declare const pseudoClasses: {
|
|
|
765
766
|
hasRequired: string;
|
|
766
767
|
hasDisabled: string;
|
|
767
768
|
};
|
|
768
|
-
export declare const pseudoClassesWeight: Record<"indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled", number>;
|
|
769
|
+
export declare const pseudoClassesWeight: Record<"theme" | "indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled", number>;
|
|
769
770
|
export declare const pseudoClassesByWeight: {
|
|
770
|
-
[key: number]: ("indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled")[];
|
|
771
|
+
[key: number]: ("theme" | "indeterminate" | "checked" | "required" | "disabled" | "selected" | "hover" | "focus" | "hasFocus" | "active" | "valid" | "hasValid" | "invalid" | "hasInvalid" | "optional" | "hasChecked" | "hasRequired" | "hasDisabled")[];
|
|
771
772
|
};
|
|
772
773
|
export declare const pseudoGroupClasses: {
|
|
773
774
|
hoverGroup: "hover";
|
|
774
775
|
focusGroup: "focus";
|
|
775
776
|
activeGroup: "active";
|
|
776
777
|
disabledGroup: "disabled";
|
|
778
|
+
theme: "theme";
|
|
777
779
|
};
|
|
778
780
|
export declare const breakpoints: {
|
|
779
781
|
/** Styles applied for small screens and larger. >= 640 */
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { BoxComponentStyles } from '../../types';
|
|
2
|
+
export interface BoxComponent {
|
|
3
|
+
clean?: boolean;
|
|
4
|
+
styles: BoxComponentStyles;
|
|
5
|
+
variants?: Record<string, BoxComponentStyles>;
|
|
6
|
+
children?: Record<string, BoxComponent>;
|
|
7
|
+
}
|
|
8
|
+
export type Components = Record<string, BoxComponent>;
|
|
9
|
+
declare const boxComponents: {
|
|
10
|
+
button: {
|
|
11
|
+
styles: {
|
|
12
|
+
display: "inline-flex";
|
|
13
|
+
color: "white";
|
|
14
|
+
bgColor: "violet-500";
|
|
15
|
+
borderColor: "violet-500";
|
|
16
|
+
p: number;
|
|
17
|
+
cursor: "pointer";
|
|
18
|
+
b: number;
|
|
19
|
+
borderRadius: number;
|
|
20
|
+
userSelect: "none";
|
|
21
|
+
lineHeight: number;
|
|
22
|
+
hover: {
|
|
23
|
+
bgColor: "violet-600";
|
|
24
|
+
borderColor: "violet-600";
|
|
25
|
+
};
|
|
26
|
+
disabled: {
|
|
27
|
+
cursor: "not-allowed";
|
|
28
|
+
bgColor: "violet-50";
|
|
29
|
+
color: "gray-400";
|
|
30
|
+
borderColor: "gray-300";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
variants: {
|
|
34
|
+
test: {};
|
|
35
|
+
test2: {};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
textbox: {
|
|
39
|
+
styles: {
|
|
40
|
+
display: "inline-block";
|
|
41
|
+
b: number;
|
|
42
|
+
borderColor: "violet-200";
|
|
43
|
+
bgColor: "violet-50";
|
|
44
|
+
color: "violet-950";
|
|
45
|
+
borderRadius: number;
|
|
46
|
+
p: number;
|
|
47
|
+
transition: "none";
|
|
48
|
+
lineHeight: number;
|
|
49
|
+
hover: {
|
|
50
|
+
borderColor: "violet-300";
|
|
51
|
+
};
|
|
52
|
+
focus: {
|
|
53
|
+
outline: number;
|
|
54
|
+
borderColor: "violet-500";
|
|
55
|
+
outlineColor: "violet-500";
|
|
56
|
+
};
|
|
57
|
+
disabled: {
|
|
58
|
+
cursor: "not-allowed";
|
|
59
|
+
bgColor: "violet-50";
|
|
60
|
+
color: "gray-400";
|
|
61
|
+
borderColor: "gray-300";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
textarea: {
|
|
66
|
+
styles: {
|
|
67
|
+
display: "inline-block";
|
|
68
|
+
b: number;
|
|
69
|
+
borderColor: "violet-200";
|
|
70
|
+
bgColor: "violet-50";
|
|
71
|
+
color: "violet-950";
|
|
72
|
+
borderRadius: number;
|
|
73
|
+
p: number;
|
|
74
|
+
transition: "none";
|
|
75
|
+
hover: {
|
|
76
|
+
borderColor: "violet-300";
|
|
77
|
+
};
|
|
78
|
+
focus: {
|
|
79
|
+
outline: number;
|
|
80
|
+
borderColor: "violet-500";
|
|
81
|
+
outlineColor: "violet-500";
|
|
82
|
+
};
|
|
83
|
+
disabled: {
|
|
84
|
+
cursor: "not-allowed";
|
|
85
|
+
bgColor: "violet-50";
|
|
86
|
+
color: "gray-400";
|
|
87
|
+
borderColor: "gray-300";
|
|
88
|
+
resize: "none";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
checkbox: {
|
|
93
|
+
styles: {
|
|
94
|
+
display: "inline-block";
|
|
95
|
+
appearance: "none";
|
|
96
|
+
b: number;
|
|
97
|
+
borderColor: "violet-300";
|
|
98
|
+
borderRadius: number;
|
|
99
|
+
p: number;
|
|
100
|
+
cursor: "pointer";
|
|
101
|
+
transition: "none";
|
|
102
|
+
hover: {
|
|
103
|
+
borderColor: "violet-500";
|
|
104
|
+
};
|
|
105
|
+
focus: {
|
|
106
|
+
outline: number;
|
|
107
|
+
outlineOffset: number;
|
|
108
|
+
outlineColor: "violet-500";
|
|
109
|
+
};
|
|
110
|
+
checked: {
|
|
111
|
+
bgColor: "violet-500";
|
|
112
|
+
borderColor: "violet-500";
|
|
113
|
+
bgImage: "bg-img-checked";
|
|
114
|
+
};
|
|
115
|
+
indeterminate: {
|
|
116
|
+
color: "violet-500";
|
|
117
|
+
bgImage: "bg-img-indeterminate";
|
|
118
|
+
};
|
|
119
|
+
disabled: {
|
|
120
|
+
cursor: "not-allowed";
|
|
121
|
+
bgColor: "violet-100";
|
|
122
|
+
color: "gray-400";
|
|
123
|
+
borderColor: "gray-300";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
radioButton: {
|
|
128
|
+
styles: {
|
|
129
|
+
appearance: "none";
|
|
130
|
+
b: number;
|
|
131
|
+
borderColor: "violet-300";
|
|
132
|
+
borderRadius: number;
|
|
133
|
+
p: number;
|
|
134
|
+
cursor: "pointer";
|
|
135
|
+
transition: "none";
|
|
136
|
+
hover: {
|
|
137
|
+
borderColor: "violet-500";
|
|
138
|
+
};
|
|
139
|
+
focus: {
|
|
140
|
+
outline: number;
|
|
141
|
+
outlineOffset: number;
|
|
142
|
+
outlineColor: "violet-500";
|
|
143
|
+
};
|
|
144
|
+
checked: {
|
|
145
|
+
bgColor: "violet-500";
|
|
146
|
+
borderColor: "violet-500";
|
|
147
|
+
bgImage: "bg-img-radio";
|
|
148
|
+
};
|
|
149
|
+
disabled: {
|
|
150
|
+
cursor: "not-allowed";
|
|
151
|
+
bgColor: "violet-100";
|
|
152
|
+
color: "gray-400";
|
|
153
|
+
borderColor: "violet-200";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
dropdown: {
|
|
158
|
+
styles: {
|
|
159
|
+
display: "inline-flex";
|
|
160
|
+
ai: "center";
|
|
161
|
+
gap: number;
|
|
162
|
+
jc: "space-between";
|
|
163
|
+
p: number;
|
|
164
|
+
cursor: "pointer";
|
|
165
|
+
bgColor: "violet-50";
|
|
166
|
+
color: "violet-950";
|
|
167
|
+
b: number;
|
|
168
|
+
borderColor: "violet-200";
|
|
169
|
+
borderRadius: number;
|
|
170
|
+
userSelect: "none";
|
|
171
|
+
lineHeight: number;
|
|
172
|
+
minWidth: number;
|
|
173
|
+
transition: "none";
|
|
174
|
+
hover: {
|
|
175
|
+
borderColor: "violet-300";
|
|
176
|
+
};
|
|
177
|
+
focus: {
|
|
178
|
+
outline: number;
|
|
179
|
+
borderColor: "violet-500";
|
|
180
|
+
outlineColor: "violet-500";
|
|
181
|
+
};
|
|
182
|
+
disabled: {
|
|
183
|
+
cursor: "not-allowed";
|
|
184
|
+
bgColor: "violet-50";
|
|
185
|
+
color: "gray-400";
|
|
186
|
+
borderColor: "gray-300";
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
children: {
|
|
190
|
+
display: {
|
|
191
|
+
styles: {
|
|
192
|
+
whiteSpace: "nowrap";
|
|
193
|
+
textOverflow: "ellipsis";
|
|
194
|
+
overflow: "hidden";
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
items: {
|
|
198
|
+
styles: {
|
|
199
|
+
display: "flex";
|
|
200
|
+
d: "column";
|
|
201
|
+
gap: number;
|
|
202
|
+
p: number;
|
|
203
|
+
b: number;
|
|
204
|
+
borderRadius: number;
|
|
205
|
+
position: "relative";
|
|
206
|
+
top: number;
|
|
207
|
+
bgColor: "white";
|
|
208
|
+
overflow: "auto";
|
|
209
|
+
maxHeight: number;
|
|
210
|
+
borderColor: "violet-300";
|
|
211
|
+
color: "violet-950";
|
|
212
|
+
shadow: "medium-shadow";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
item: {
|
|
216
|
+
styles: {
|
|
217
|
+
display: "flex";
|
|
218
|
+
width: "fit";
|
|
219
|
+
p: number;
|
|
220
|
+
cursor: "pointer";
|
|
221
|
+
borderRadius: number;
|
|
222
|
+
hover: {
|
|
223
|
+
bgColor: "gray-100";
|
|
224
|
+
};
|
|
225
|
+
focus: {
|
|
226
|
+
bgColor: "violet-50";
|
|
227
|
+
};
|
|
228
|
+
selected: {
|
|
229
|
+
bgColor: "violet-50";
|
|
230
|
+
cursor: "default";
|
|
231
|
+
hover: {
|
|
232
|
+
bgColor: "violet-100";
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
variants: {
|
|
237
|
+
multiple: {
|
|
238
|
+
selected: {
|
|
239
|
+
cursor: "pointer";
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
unselect: {
|
|
245
|
+
styles: {
|
|
246
|
+
display: "flex";
|
|
247
|
+
width: "fit";
|
|
248
|
+
p: number;
|
|
249
|
+
cursor: "pointer";
|
|
250
|
+
lineHeight: number;
|
|
251
|
+
borderRadius: number;
|
|
252
|
+
color: "violet-400";
|
|
253
|
+
hover: {
|
|
254
|
+
bgColor: "violet-50";
|
|
255
|
+
};
|
|
256
|
+
focus: {
|
|
257
|
+
bgColor: "violet-50";
|
|
258
|
+
};
|
|
259
|
+
selected: {
|
|
260
|
+
bgColor: "violet-50";
|
|
261
|
+
cursor: "default";
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
selectAll: {
|
|
266
|
+
styles: {
|
|
267
|
+
display: "flex";
|
|
268
|
+
width: "fit";
|
|
269
|
+
p: number;
|
|
270
|
+
cursor: "pointer";
|
|
271
|
+
lineHeight: number;
|
|
272
|
+
borderRadius: number;
|
|
273
|
+
color: "violet-400";
|
|
274
|
+
hover: {
|
|
275
|
+
bgColor: "violet-50";
|
|
276
|
+
};
|
|
277
|
+
focus: {
|
|
278
|
+
bgColor: "violet-50";
|
|
279
|
+
};
|
|
280
|
+
selected: {
|
|
281
|
+
bgColor: "violet-50";
|
|
282
|
+
cursor: "default";
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
emptyItem: {
|
|
287
|
+
styles: {
|
|
288
|
+
display: "flex";
|
|
289
|
+
width: "fit";
|
|
290
|
+
p: number;
|
|
291
|
+
cursor: "default";
|
|
292
|
+
lineHeight: number;
|
|
293
|
+
borderRadius: number;
|
|
294
|
+
color: "violet-400";
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
label: {
|
|
300
|
+
styles: {};
|
|
301
|
+
};
|
|
302
|
+
datagrid: {
|
|
303
|
+
styles: {};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
export default boxComponents;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { BoxStyle } from '
|
|
1
|
+
import { BoxStyle } from '../coreTypes';
|
|
2
|
+
import { Components } from './boxComponents';
|
|
2
3
|
declare namespace BoxExtends {
|
|
3
4
|
function extend<TProps extends Record<string, BoxStyle[]>, TPropTypes extends Record<string, BoxStyle[]>>(variables: Record<string, string>, extendedProps: TProps, extendedPropTypes: TPropTypes): {
|
|
4
5
|
extendedProps: TProps;
|
|
5
6
|
extendedPropTypes: TPropTypes;
|
|
6
7
|
};
|
|
8
|
+
let componentsStyles: Components;
|
|
9
|
+
function components<T extends Components>(components: T): T;
|
|
7
10
|
}
|
|
8
11
|
export default BoxExtends;
|
package/core/theme/theme.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { Themes } from './themeContract';
|
|
3
2
|
interface ThemeProps {
|
|
4
3
|
children: React.ReactNode;
|
|
5
4
|
theme: string;
|
|
5
|
+
use?: 'global' | 'local';
|
|
6
6
|
}
|
|
7
7
|
declare function Theme(props: ThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare namespace Theme {
|
|
9
|
-
let userThemes: Maybe<Themes>;
|
|
10
|
-
function setup(themes: Themes): void;
|
|
11
9
|
function useTheme(): [string, (theme: string) => void];
|
|
12
10
|
}
|
|
13
11
|
export default Theme;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
interface IThemeContext {
|
|
4
|
-
themeStyles: ThemeType;
|
|
2
|
+
interface ThemeContextProps {
|
|
5
3
|
theme: string;
|
|
6
4
|
setTheme(theme: string): void;
|
|
7
5
|
}
|
|
8
|
-
declare const ThemeContext: React.Context<
|
|
6
|
+
declare const ThemeContext: React.Context<ThemeContextProps>;
|
|
9
7
|
export default ThemeContext;
|
package/core/useStyles.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BoxStyleProps, PseudoClassesType } from '../types';
|
|
2
|
-
export default function useStyles(props: BoxStyleProps
|
|
1
|
+
import { BoxStyleProps, ComponentsAndVariants, PseudoClassesType } from '../types';
|
|
2
|
+
export default function useStyles<TKey extends keyof ComponentsAndVariants = never>(props: BoxStyleProps<TKey>, isSvg: boolean): string[];
|
|
3
3
|
declare namespace StylesContextImpl {
|
|
4
|
-
function addClassNames(props: BoxStyleProps
|
|
4
|
+
function addClassNames(props: BoxStyleProps<any>, classNames: string[], currentPseudoClasses: PseudoClassesType[], breakpoint?: string, pseudoClassParentName?: string): void;
|
|
5
5
|
function flush(): void;
|
|
6
6
|
function clear(): void;
|
|
7
7
|
}
|