@cronocode/react-box 1.2.7 → 1.3.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/baseSvg.module.css.mjs +4 -0
- package/box.d.ts +2 -1
- package/box.mjs +18 -14
- package/box.module.css.mjs +1 -1
- package/components/baseSvg.mjs +14 -14
- package/components/{buttonCore.d.ts → button.d.ts} +3 -2
- package/components/button.mjs +15 -0
- package/components/{radioButtonCore.d.ts → checkbox.d.ts} +7 -5
- package/components/checkbox.mjs +30 -0
- package/components/dataGrid.d.ts +15 -0
- package/components/dataGrid.mjs +36 -0
- package/components/flex.mjs +1 -0
- package/components/form.d.ts +10 -0
- package/components/{formAsync.mjs → form.mjs} +6 -5
- package/components/{checkboxCore.d.ts → radioButton.d.ts} +7 -5
- package/components/radioButton.mjs +26 -0
- package/components/{textareaCore.d.ts → textarea.d.ts} +6 -4
- package/components/textarea.mjs +30 -0
- package/components/textbox.d.ts +3 -4
- package/components/textbox.mjs +11 -11
- package/components/tooltip.d.ts +8 -0
- package/components/tooltip.mjs +55 -0
- package/hooks/usePortalContainer.d.ts +1 -0
- package/package.json +5 -2
- package/style.css +1 -1
- package/theme.d.ts +30 -21
- package/theme.mjs +20 -20
- package/types.d.ts +12 -2
- package/utils/object/objectUtils.d.ts +1 -439
- package/utils/utils.mjs +60 -45
- package/components/buttonCore.mjs +0 -13
- package/components/checkboxCore.mjs +0 -25
- package/components/formAsync.d.ts +0 -10
- package/components/radioButtonCore.mjs +0 -25
- package/components/textareaCore.mjs +0 -29
- package/components/textboxCore.d.ts +0 -24
- package/components/textboxCore.mjs +0 -28
package/theme.d.ts
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
import { BoxStyles } from './types';
|
|
2
|
+
export interface ThemeStyles {
|
|
3
|
+
styles: BoxStyles;
|
|
4
|
+
disabled?: BoxStyles;
|
|
5
|
+
}
|
|
6
|
+
export interface ThemeComponentStyles {
|
|
7
|
+
styles: BoxStyles;
|
|
8
|
+
disabled?: BoxStyles;
|
|
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
|
+
}
|
|
2
23
|
declare namespace Theme {
|
|
3
|
-
|
|
4
|
-
clean?: boolean;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
theme?: string;
|
|
7
|
-
}
|
|
8
|
-
interface Styles {
|
|
9
|
-
styles: BoxStyles;
|
|
10
|
-
disabled?: BoxStyles;
|
|
11
|
-
}
|
|
12
|
-
export interface ThemeStyles extends Styles {
|
|
13
|
-
themes?: {
|
|
14
|
-
[name: string]: Styles;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export interface ThemeComponentStyles {
|
|
18
|
-
textbox?: ThemeStyles;
|
|
19
|
-
}
|
|
20
|
-
export let Styles: ThemeComponentStyles;
|
|
21
|
-
export function setup(styles: ThemeComponentStyles): void;
|
|
22
|
-
export {};
|
|
24
|
+
function setup(styles: ThemeSetup): void;
|
|
23
25
|
}
|
|
24
26
|
export default Theme;
|
|
25
|
-
|
|
27
|
+
type ReservedComponentName = Exclude<string, keyof Omit<ThemeSetup, 'components'>>;
|
|
28
|
+
export interface ThemeComponentProps {
|
|
29
|
+
clean?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
component?: ReservedComponentName;
|
|
32
|
+
theme?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function useTheme(props: ThemeComponentProps): BoxStyles;
|
package/theme.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function n
|
|
6
|
-
|
|
1
|
+
import { useMemo as c } from "react";
|
|
2
|
+
let m = {};
|
|
3
|
+
var u;
|
|
4
|
+
((l) => {
|
|
5
|
+
function s(n) {
|
|
6
|
+
m = n;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
})(
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const { clean:
|
|
13
|
-
return
|
|
14
|
-
var d, a;
|
|
15
|
-
if (
|
|
8
|
+
l.setup = s;
|
|
9
|
+
})(u || (u = {}));
|
|
10
|
+
const h = u;
|
|
11
|
+
function p(l) {
|
|
12
|
+
const { clean: s, disabled: n, theme: t, component: o } = l;
|
|
13
|
+
return c(() => {
|
|
14
|
+
var i, d, a;
|
|
15
|
+
if (s)
|
|
16
16
|
return {};
|
|
17
|
-
let e =
|
|
17
|
+
let e = m[o] ?? ((i = m.components) == null ? void 0 : i[o]);
|
|
18
18
|
if (!e)
|
|
19
19
|
return {};
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
}, [
|
|
20
|
+
let r = t ? { ...e.styles, ...(d = e.themes) == null ? void 0 : d[t].styles } : e.styles;
|
|
21
|
+
return n ? t ? { ...r, ...e.disabled, ...(a = e.themes) == null ? void 0 : a[t].disabled } : { ...r, ...e.disabled } : r;
|
|
22
|
+
}, [o, s, n, t]);
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
h as default,
|
|
26
|
+
p as useTheme
|
|
27
27
|
};
|
package/types.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export declare const styleVariables: {
|
|
|
40
40
|
transition: readonly ["none"];
|
|
41
41
|
background: readonly ["none"];
|
|
42
42
|
userSelect: readonly ["none"];
|
|
43
|
+
appearance: readonly ["none"];
|
|
44
|
+
pointerEvents: readonly ["none"];
|
|
43
45
|
};
|
|
44
46
|
type GapType = (typeof styleVariables.gap)[number];
|
|
45
47
|
type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
|
|
@@ -59,6 +61,8 @@ type BorderAndOutlineStyleType = (typeof styleVariables.borderAndOutlineStyles)[
|
|
|
59
61
|
type TransitionType = (typeof styleVariables.transition)[number];
|
|
60
62
|
type BackgroundType = (typeof styleVariables.background)[number];
|
|
61
63
|
type UserSelectType = (typeof styleVariables.userSelect)[number];
|
|
64
|
+
type AppearanceType = (typeof styleVariables.appearance)[number];
|
|
65
|
+
type PointerEventsType = (typeof styleVariables.pointerEvents)[number];
|
|
62
66
|
interface BoxPseudoClasses {
|
|
63
67
|
hover?: boolean;
|
|
64
68
|
focus?: boolean;
|
|
@@ -70,7 +74,7 @@ interface BoxDisplay {
|
|
|
70
74
|
interface BoxSizing {
|
|
71
75
|
boxSizing?: (typeof styleVariables.boxSizing)[number];
|
|
72
76
|
}
|
|
73
|
-
interface BoxPosition {
|
|
77
|
+
export interface BoxPosition {
|
|
74
78
|
position?: (typeof styleVariables.position)[number];
|
|
75
79
|
inset?: SizeType;
|
|
76
80
|
top?: SizeType;
|
|
@@ -210,7 +214,13 @@ interface BoxTransition {
|
|
|
210
214
|
interface BoxUserSelect {
|
|
211
215
|
userSelect?: UserSelectType;
|
|
212
216
|
}
|
|
213
|
-
|
|
217
|
+
interface BoxAppearance {
|
|
218
|
+
appearance?: AppearanceType;
|
|
219
|
+
}
|
|
220
|
+
interface BoxPointerEvents {
|
|
221
|
+
pointerEvents?: PointerEventsType;
|
|
222
|
+
}
|
|
223
|
+
type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect & BoxAppearance & BoxPointerEvents;
|
|
214
224
|
export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
|
|
215
225
|
export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
|
|
216
226
|
export declare const themeSvgClasses: Partial<Record<keyof SvgStyles, string>>;
|