@cronocode/react-box 1.2.7 → 1.3.1

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.
Files changed (37) hide show
  1. package/baseSvg.module.css.mjs +4 -0
  2. package/box.d.ts +2 -1
  3. package/box.mjs +18 -14
  4. package/box.module.css.mjs +1 -1
  5. package/components/baseSvg.mjs +14 -14
  6. package/components/{buttonCore.d.ts → button.d.ts} +3 -2
  7. package/components/button.mjs +15 -0
  8. package/components/{radioButtonCore.d.ts → checkbox.d.ts} +7 -5
  9. package/components/checkbox.mjs +30 -0
  10. package/components/dataGrid.d.ts +2 -0
  11. package/components/dataGrid.mjs +36 -0
  12. package/components/flex.mjs +1 -0
  13. package/components/form.d.ts +10 -0
  14. package/components/{formAsync.mjs → form.mjs} +6 -5
  15. package/components/{checkboxCore.d.ts → radioButton.d.ts} +7 -5
  16. package/components/radioButton.mjs +26 -0
  17. package/components/{textareaCore.d.ts → textarea.d.ts} +6 -4
  18. package/components/textarea.mjs +30 -0
  19. package/components/textbox.d.ts +3 -4
  20. package/components/textbox.mjs +11 -11
  21. package/components/tooltip.d.ts +8 -0
  22. package/components/tooltip.mjs +55 -0
  23. package/hooks/usePortalContainer.d.ts +1 -0
  24. package/package.json +5 -2
  25. package/style.css +1 -1
  26. package/theme.d.ts +30 -21
  27. package/theme.mjs +20 -20
  28. package/types.d.ts +12 -2
  29. package/utils/object/objectUtils.d.ts +1 -439
  30. package/utils/utils.mjs +55 -44
  31. package/components/buttonCore.mjs +0 -13
  32. package/components/checkboxCore.mjs +0 -25
  33. package/components/formAsync.d.ts +0 -10
  34. package/components/radioButtonCore.mjs +0 -25
  35. package/components/textareaCore.mjs +0 -29
  36. package/components/textboxCore.d.ts +0 -24
  37. 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
- export interface ThemeComponentProps {
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
- export declare function useTheme(component: keyof Theme.ThemeComponentStyles, props: Theme.ThemeComponentProps): BoxStyles;
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 m } from "react";
2
- var r;
3
- ((t) => {
4
- t.Styles = {};
5
- function n(l) {
6
- t.Styles = l;
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
- t.setup = n;
9
- })(r || (r = {}));
10
- const y = r;
11
- function f(t, n) {
12
- const { clean: l, disabled: i, theme: s } = n;
13
- return m(() => {
14
- var d, a;
15
- if (l)
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 = r.Styles[t];
17
+ let e = m[o] ?? ((i = m.components) == null ? void 0 : i[o]);
18
18
  if (!e)
19
19
  return {};
20
- let u = s ? { ...e.styles, ...(d = e.themes) == null ? void 0 : d[s].styles } : e.styles;
21
- return i ? s ? { ...u, ...e.disabled, ...(a = e.themes) == null ? void 0 : a[s].disabled } : { ...u, ...e.disabled } : u;
22
- }, [t, l, i, s]);
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
- y as default,
26
- f as useTheme
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
- type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect;
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>>;