@cronocode/react-box 2.0.7 → 3.0.0-alpha.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.
- package/box.cjs +1 -1
- package/box.d.ts +15 -8
- package/box.mjs +15 -9
- package/components/baseSvg.d.ts +3 -4
- package/components/button.cjs +1 -1
- package/components/button.d.ts +4 -5
- package/components/button.mjs +1 -1
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +1 -4
- package/components/checkbox.mjs +10 -10
- package/components/dataGrid/dataGridContract.d.ts +19 -11
- package/components/dataGrid/useGridData.d.ts +7 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.d.ts +5 -3
- package/components/dataGrid.mjs +17 -28
- package/components/flex.d.ts +3 -6
- package/components/form.cjs +1 -1
- package/components/form.d.ts +3 -5
- package/components/form.mjs +1 -1
- package/components/grid.d.ts +3 -6
- package/components/label.d.ts +0 -1
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +5 -7
- package/components/radioButton.mjs +9 -9
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +5 -6
- package/components/textarea.mjs +8 -9
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +4 -6
- package/components/textbox.mjs +1 -1
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +2 -4
- package/components/tooltip.mjs +34 -40
- package/core/boxExtends.d.ts +6 -0
- package/core/boxStyles.d.ts +701 -1217
- package/core/boxStylesFormatters.d.ts +2 -2
- package/core/coreTypes.d.ts +31 -0
- package/core/theme.d.ts +13 -32
- package/core/useStyles.d.ts +12 -3
- package/core/useTheme.d.ts +7 -10
- package/core.cjs +4 -34
- package/core.mjs +1397 -1158
- package/package.json +20 -25
- package/ssg.d.ts +0 -1
- package/types.d.ts +26 -0
- package/utils/object/objectUtils.d.ts +2 -0
- package/components/dataGrid/useGrid.d.ts +0 -3
- package/core/stylesContext.d.ts +0 -13
- package/core/theme.cjs +0 -1
- package/core/theme.mjs +0 -4
- package/core/types.d.ts +0 -60
- package/utils.cjs +0 -1
- package/utils.mjs +0 -63
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronocode/react-box",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./box.cjs",
|
|
6
6
|
"module": "./box.mjs",
|
|
@@ -11,13 +11,8 @@
|
|
|
11
11
|
"require": "./box.cjs",
|
|
12
12
|
"types": "./box.d.ts"
|
|
13
13
|
},
|
|
14
|
-
"./
|
|
15
|
-
"
|
|
16
|
-
"require": "./core/theme.cjs",
|
|
17
|
-
"types": "./core/theme.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"./core/types": {
|
|
20
|
-
"types": "./core/types.d.ts"
|
|
14
|
+
"./types": {
|
|
15
|
+
"types": "./types.d.ts"
|
|
21
16
|
},
|
|
22
17
|
"./ssg": {
|
|
23
18
|
"import": "./ssg.mjs",
|
|
@@ -61,24 +56,24 @@
|
|
|
61
56
|
},
|
|
62
57
|
"devDependencies": {
|
|
63
58
|
"@rollup/pluginutils": "^5.1.0",
|
|
64
|
-
"@testing-library/dom": "^10.
|
|
65
|
-
"@testing-library/react": "^
|
|
66
|
-
"@types/node": "^
|
|
59
|
+
"@testing-library/dom": "^10.4.0",
|
|
60
|
+
"@testing-library/react": "^16.0.1",
|
|
61
|
+
"@types/node": "^22.5.5",
|
|
67
62
|
"@types/postcss-mixins": "^9.0.5",
|
|
68
|
-
"@types/prismjs": "^1.26.
|
|
69
|
-
"@types/react": "^18.
|
|
70
|
-
"@types/react-dom": "^18.
|
|
71
|
-
"@vitejs/plugin-react": "^4.
|
|
72
|
-
"autoprefixer": "^10.4.
|
|
73
|
-
"happy-dom": "^
|
|
74
|
-
"prettier": "^3.
|
|
63
|
+
"@types/prismjs": "^1.26.4",
|
|
64
|
+
"@types/react": "^18.3.7",
|
|
65
|
+
"@types/react-dom": "^18.3.0",
|
|
66
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
67
|
+
"autoprefixer": "^10.4.20",
|
|
68
|
+
"happy-dom": "^15.7.4",
|
|
69
|
+
"prettier": "^3.3.3",
|
|
75
70
|
"prismjs": "^1.29.0",
|
|
76
|
-
"react": "^18.
|
|
77
|
-
"react-dom": "^18.
|
|
78
|
-
"react-router-dom": "^6.
|
|
79
|
-
"typescript": "^5.
|
|
80
|
-
"vite": "^5.
|
|
81
|
-
"vite-plugin-dts": "^
|
|
82
|
-
"vitest": "^1.
|
|
71
|
+
"react": "^18.3.1",
|
|
72
|
+
"react-dom": "^18.3.1",
|
|
73
|
+
"react-router-dom": "^6.26.2",
|
|
74
|
+
"typescript": "^5.6.2",
|
|
75
|
+
"vite": "^5.4.6",
|
|
76
|
+
"vite-plugin-dts": "^4.2.1",
|
|
77
|
+
"vitest": "^2.1.1"
|
|
83
78
|
}
|
|
84
79
|
}
|
package/ssg.d.ts
CHANGED
package/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { breakpoints, cssStyles, pseudo1, pseudo2, pseudoClasses, pseudoGroupClasses } from './core/boxStyles';
|
|
2
|
+
import { ArrayType, BoxStyle, BoxStylesType, ExtractKeys } from './core/coreTypes';
|
|
3
|
+
export type ExtractBoxStyles<T extends Record<string, BoxStyle[]>> = {
|
|
4
|
+
[K in keyof T]?: BoxStylesType<ArrayType<T[K]>['values']>;
|
|
5
|
+
};
|
|
6
|
+
export type PseudoClassesType = keyof typeof pseudoClasses;
|
|
7
|
+
export declare namespace Augmented {
|
|
8
|
+
interface BoxProps {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export type BoxStyles = ExtractBoxStyles<typeof cssStyles> & Augmented.BoxProps;
|
|
12
|
+
type BoxPseudoClassesStyles1 = ExtractKeys<typeof pseudo1, BoxStylesWithPseudoClasses>;
|
|
13
|
+
type BoxPseudoClassesStyles2Nested = ExtractKeys<typeof pseudo2, BoxStylesWithPseudoClasses>;
|
|
14
|
+
type BoxPseudoClassesStyles2TopLevel = ExtractKeys<typeof pseudo2, boolean | [boolean, BoxStylesWithPseudoClasses]>;
|
|
15
|
+
interface BoxStylesWithPseudoClasses extends BoxStyles, BoxPseudoClassesStyles1, BoxPseudoClassesStyles2Nested {
|
|
16
|
+
}
|
|
17
|
+
type BoxPseudoGroupClassesStyles = ExtractKeys<typeof pseudoGroupClasses, string | Record<string, BoxStyles>>;
|
|
18
|
+
type BoxBreakpointsStyles = ExtractKeys<typeof breakpoints, BoxStylesWithPseudoClasses & BoxPseudoGroupClassesStyles>;
|
|
19
|
+
export interface ThemeProps {
|
|
20
|
+
clean?: boolean;
|
|
21
|
+
component?: string;
|
|
22
|
+
theme?: string;
|
|
23
|
+
}
|
|
24
|
+
export type BoxStyleProps = BoxStyles & BoxPseudoClassesStyles1 & BoxPseudoClassesStyles2TopLevel & BoxPseudoGroupClassesStyles & BoxBreakpointsStyles & ThemeProps;
|
|
25
|
+
export type BoxThemeStyles = BoxStylesWithPseudoClasses & BoxBreakpointsStyles;
|
|
26
|
+
export {};
|
|
@@ -3,5 +3,7 @@ declare namespace ObjectUtils {
|
|
|
3
3
|
props?: Object;
|
|
4
4
|
}, TKey extends keyof T>(props: T, keys: Readonly<TKey[]>, extraTagProps?: Object): T;
|
|
5
5
|
function isObject(value: unknown): value is object;
|
|
6
|
+
function mergeDeep<T>(...objects: object[]): T;
|
|
7
|
+
function isKeyOf<T extends object>(key: any, obj: T): key is keyof T;
|
|
6
8
|
}
|
|
7
9
|
export default ObjectUtils;
|
package/core/stylesContext.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BoxBreakpointsType, PseudoClassSuffix } from './boxStyles';
|
|
2
|
-
|
|
3
|
-
declare namespace StylesContext {
|
|
4
|
-
const boxClassName = "_box";
|
|
5
|
-
const svgClassName = "_svg";
|
|
6
|
-
const cronoStylesElementId = "crono-styles";
|
|
7
|
-
function get(key: string, value: unknown, breakpoint?: BoxBreakpointsType): string | undefined;
|
|
8
|
-
function flush(): void;
|
|
9
|
-
function clear(): void;
|
|
10
|
-
function addCustomPseudoClass(suffix: PseudoClassSuffix, customName: string, parentKey: string): void;
|
|
11
|
-
function getElement(): HTMLElement;
|
|
12
|
-
}
|
|
13
|
-
export default StylesContext;
|
package/core/theme.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("../core.cjs");module.exports=e.Theme;
|
package/core/theme.mjs
DELETED
package/core/types.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ThemeComponentProps } from './useTheme';
|
|
2
|
-
import { StyleItem, simpleBoxStyles } from './boxStyles';
|
|
3
|
-
|
|
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 declare namespace Augmented {
|
|
7
|
-
interface BoxProps {
|
|
8
|
-
}
|
|
9
|
-
interface SvgProps {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
type BoxStyles<T extends Record<string, StyleItem>> = {
|
|
13
|
-
[K in keyof T]?: T[K]['values1']['values'][number] | T[K]['values2']['values'][number] | T[K]['values3']['values'][number];
|
|
14
|
-
};
|
|
15
|
-
type BoxNormalStyles = BoxStyles<typeof simpleBoxStyles> & Augmented.BoxProps;
|
|
16
|
-
type SvgNormalStyles = BoxStyles<typeof simpleBoxStyles> & Augmented.SvgProps;
|
|
17
|
-
interface BoxPseudoClasses<T> {
|
|
18
|
-
disabled?: boolean | [boolean, T];
|
|
19
|
-
disabledGroup?: string | Record<string, T>;
|
|
20
|
-
hasDisabled?: T;
|
|
21
|
-
hover?: T;
|
|
22
|
-
hoverGroup?: string | Record<string, T>;
|
|
23
|
-
focus?: T;
|
|
24
|
-
hasFocus?: T;
|
|
25
|
-
focusGroup?: string | Record<string, T>;
|
|
26
|
-
active?: T;
|
|
27
|
-
activeGroup?: string | Record<string, T>;
|
|
28
|
-
checked?: boolean;
|
|
29
|
-
hasChecked?: T;
|
|
30
|
-
valid?: T;
|
|
31
|
-
hasValid?: T;
|
|
32
|
-
invalid?: T;
|
|
33
|
-
hasInvalid?: T;
|
|
34
|
-
}
|
|
35
|
-
interface BoxThemePseudoClassProps {
|
|
36
|
-
hover?: BoxNormalStyles;
|
|
37
|
-
focus?: BoxNormalStyles;
|
|
38
|
-
hasFocus?: BoxNormalStyles;
|
|
39
|
-
active?: BoxNormalStyles;
|
|
40
|
-
disabled?: BoxNormalStyles;
|
|
41
|
-
hasDisabled?: BoxNormalStyles;
|
|
42
|
-
indeterminate?: BoxNormalStyles;
|
|
43
|
-
checked?: BoxNormalStyles;
|
|
44
|
-
hasChecked?: BoxNormalStyles;
|
|
45
|
-
valid?: BoxNormalStyles;
|
|
46
|
-
hasValid?: BoxNormalStyles;
|
|
47
|
-
invalid?: BoxNormalStyles;
|
|
48
|
-
hasInvalid?: BoxNormalStyles;
|
|
49
|
-
}
|
|
50
|
-
export interface BoxBreakpoints<T = BoxThemeProps> {
|
|
51
|
-
sm?: T;
|
|
52
|
-
md?: T;
|
|
53
|
-
lg?: T;
|
|
54
|
-
xl?: T;
|
|
55
|
-
xxl?: T;
|
|
56
|
-
}
|
|
57
|
-
export type BoxThemeProps = BoxNormalStyles & BoxThemePseudoClassProps & BoxBreakpoints;
|
|
58
|
-
export type BoxStyleProps = BoxNormalStyles & BoxPseudoClasses<BoxNormalStyles> & ThemeComponentProps & BoxBreakpoints<BoxStyleProps>;
|
|
59
|
-
export type BoxSvgStyles = SvgNormalStyles & BoxPseudoClasses<SvgNormalStyles> & ThemeComponentProps & BoxBreakpoints<BoxSvgStyles>;
|
|
60
|
-
export {};
|
package/utils.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var h;(f=>{function p(s,i,r){const c={...s},e=c.props||{};return i.forEach(t=>{t in c&&(e[t]=c[t],delete c[t])}),r&&Object.entries(r).forEach(([t,n])=>{e[t]=n}),c.props=e,c}f.buildProps=p;function l(s){return typeof s=="object"&&s!==null}f.isObject=l})(h||(h={}));const b=h;var a;(f=>{function p(s){const i=Array.from(s.elements).reduce((r,c)=>{const e=c.name;return e&&(r[e]||(r[e]=[]),r[e].push(c)),r},{});return Object.entries(i).reduce((r,[c,e])=>{if(e.length===1){const t=e[0];l(r,c,t.type==="checkbox"||t.type==="radio"?t.checked:t.value)}else{const t=e.reduce((n,o)=>(o.type==="checkbox"||o.type==="radio"?o.checked&&n.push(o.value):n.push(o.value),n),[]);l(r,c,t)}return r},{})}f.getFormEntries=p;function l(s,i,r){if(i.includes(".")){const c=i.split(".");let e=s;c.forEach((t,n)=>{if(c.length>n+1){const o=t.match(/^(.+)\[(\d)\]$/);if(o){const[,u,d]=o;e[u]=e[u]||[],e[u][d]=e[u][d]||{},e=e[u][d]}else e[t]=e[t]||{},e=e[t]}else e[t]=r})}else s[i]=r}})(a||(a={}));const m=a;exports.FormUtils=m;exports.ObjectUtils=b;
|
package/utils.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var h;
|
|
2
|
-
((f) => {
|
|
3
|
-
function l(o, n, t) {
|
|
4
|
-
const c = { ...o }, e = c.props || {};
|
|
5
|
-
return n.forEach((r) => {
|
|
6
|
-
r in c && (e[r] = c[r], delete c[r]);
|
|
7
|
-
}), t && Object.entries(t).forEach(([r, i]) => {
|
|
8
|
-
e[r] = i;
|
|
9
|
-
}), c.props = e, c;
|
|
10
|
-
}
|
|
11
|
-
f.buildProps = l;
|
|
12
|
-
function p(o) {
|
|
13
|
-
return typeof o == "object" && o !== null;
|
|
14
|
-
}
|
|
15
|
-
f.isObject = p;
|
|
16
|
-
})(h || (h = {}));
|
|
17
|
-
const b = h;
|
|
18
|
-
var a;
|
|
19
|
-
((f) => {
|
|
20
|
-
function l(o) {
|
|
21
|
-
const n = Array.from(o.elements).reduce(
|
|
22
|
-
(t, c) => {
|
|
23
|
-
const e = c.name;
|
|
24
|
-
return e && (t[e] || (t[e] = []), t[e].push(c)), t;
|
|
25
|
-
},
|
|
26
|
-
{}
|
|
27
|
-
);
|
|
28
|
-
return Object.entries(n).reduce((t, [c, e]) => {
|
|
29
|
-
if (e.length === 1) {
|
|
30
|
-
const r = e[0];
|
|
31
|
-
p(t, c, r.type === "checkbox" || r.type === "radio" ? r.checked : r.value);
|
|
32
|
-
} else {
|
|
33
|
-
const r = e.reduce((i, s) => (s.type === "checkbox" || s.type === "radio" ? s.checked && i.push(s.value) : i.push(s.value), i), []);
|
|
34
|
-
p(t, c, r);
|
|
35
|
-
}
|
|
36
|
-
return t;
|
|
37
|
-
}, {});
|
|
38
|
-
}
|
|
39
|
-
f.getFormEntries = l;
|
|
40
|
-
function p(o, n, t) {
|
|
41
|
-
if (n.includes(".")) {
|
|
42
|
-
const c = n.split(".");
|
|
43
|
-
let e = o;
|
|
44
|
-
c.forEach((r, i) => {
|
|
45
|
-
if (c.length > i + 1) {
|
|
46
|
-
const s = r.match(/^(.+)\[(\d)\]$/);
|
|
47
|
-
if (s) {
|
|
48
|
-
const [, u, d] = s;
|
|
49
|
-
e[u] = e[u] || [], e[u][d] = e[u][d] || {}, e = e[u][d];
|
|
50
|
-
} else
|
|
51
|
-
e[r] = e[r] || {}, e = e[r];
|
|
52
|
-
} else
|
|
53
|
-
e[r] = t;
|
|
54
|
-
});
|
|
55
|
-
} else
|
|
56
|
-
o[n] = t;
|
|
57
|
-
}
|
|
58
|
-
})(a || (a = {}));
|
|
59
|
-
const m = a;
|
|
60
|
-
export {
|
|
61
|
-
m as F,
|
|
62
|
-
b as O
|
|
63
|
-
};
|