@krosoft/react 0.0.71 → 0.0.73

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 (40) hide show
  1. package/dist/KpiCards-Bjsd4bSz.js +40 -0
  2. package/dist/{SearchInput-LIey3bo9.js → SearchInput-Bu4wb0gI.js} +10 -9
  3. package/dist/ThemeSelector-DMgBLEYm.js +49 -0
  4. package/dist/Topbar-CFALRIJn.js +168 -0
  5. package/dist/{badge-Cj2EQgcL.js → badge-C4pCH7IL.js} +1 -1
  6. package/dist/components/core/cards/KpiCards.d.ts.map +1 -1
  7. package/dist/components/core/cards/index.js +1 -1
  8. package/dist/components/core/index.d.ts +1 -0
  9. package/dist/components/core/index.d.ts.map +1 -1
  10. package/dist/components/core/index.js +10 -8
  11. package/dist/components/core/inputs/index.js +1 -1
  12. package/dist/components/core/navbar/index.js +1 -1
  13. package/dist/components/core/theme/ThemeSelector.d.ts +8 -0
  14. package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -0
  15. package/dist/components/core/theme/index.d.ts +3 -0
  16. package/dist/components/core/theme/index.d.ts.map +1 -0
  17. package/dist/components/core/theme/index.js +4 -0
  18. package/dist/components/index.js +41 -30
  19. package/dist/components/ui/index.d.ts +1 -0
  20. package/dist/components/ui/index.d.ts.map +1 -1
  21. package/dist/components/ui/index.js +27 -18
  22. package/dist/components/ui/select.d.ts +14 -0
  23. package/dist/components/ui/select.d.ts.map +1 -0
  24. package/dist/hooks/index.d.ts +2 -0
  25. package/dist/hooks/index.d.ts.map +1 -1
  26. package/dist/hooks/index.js +16 -112
  27. package/dist/hooks/ui/useTheme.d.ts +20 -0
  28. package/dist/hooks/ui/useTheme.d.ts.map +1 -0
  29. package/dist/index-BQOmHRsD.js +1662 -0
  30. package/dist/select-CdiR6cO0.js +2020 -0
  31. package/dist/tailwind/index.d.ts +1 -1
  32. package/dist/tailwind/index.d.ts.map +1 -1
  33. package/dist/tailwind/index.js +3 -1
  34. package/dist/{toast-B6CC_ory.js → toast-BypnW71k.js} +1 -1
  35. package/dist/tooltip-Dep8OR3c.js +779 -0
  36. package/dist/useTheme-D__o7mLN.js +122 -0
  37. package/package.json +10 -2
  38. package/dist/KpiCards-D4Cy8CLT.js +0 -38
  39. package/dist/Topbar-CtXJ337W.js +0 -2314
  40. package/dist/index-BNCR478R.js +0 -272
@@ -1,117 +1,21 @@
1
- import * as S from "react";
2
- import { useState as E, useEffect as m } from "react";
3
- const u = 768;
4
- function _() {
5
- const [t, s] = E(!1);
6
- return m(() => {
7
- const e = window.matchMedia(`(max-width: ${String(u - 1)}px)`), o = () => {
8
- s(window.innerWidth < u);
1
+ import { useState as i, useEffect as a } from "react";
2
+ import { t as h, a as m, u as f, b as w } from "../useTheme-D__o7mLN.js";
3
+ const e = 768;
4
+ function c() {
5
+ const [o, t] = i(!1);
6
+ return a(() => {
7
+ const n = window.matchMedia(`(max-width: ${String(e - 1)}px)`), s = () => {
8
+ t(window.innerWidth < e);
9
9
  };
10
- return e.addEventListener("change", o), s(window.innerWidth < u), () => {
11
- e.removeEventListener("change", o);
10
+ return n.addEventListener("change", s), t(window.innerWidth < e), () => {
11
+ n.removeEventListener("change", s);
12
12
  };
13
- }, []), t;
13
+ }, []), o;
14
14
  }
15
- const p = 1, A = 1e6;
16
- let a = 0;
17
- function h() {
18
- return a = (a + 1) % Number.MAX_SAFE_INTEGER, a.toString();
19
- }
20
- const T = /* @__PURE__ */ new Map(), f = (t) => {
21
- if (T.has(t))
22
- return;
23
- const s = setTimeout(() => {
24
- T.delete(t), r({
25
- type: "REMOVE_TOAST",
26
- toastId: t
27
- });
28
- }, A);
29
- T.set(t, s);
30
- }, O = (t, s) => {
31
- switch (s.type) {
32
- case "ADD_TOAST":
33
- return {
34
- ...t,
35
- toasts: [s.toast, ...t.toasts].slice(0, p)
36
- };
37
- case "UPDATE_TOAST":
38
- return {
39
- ...t,
40
- toasts: t.toasts.map((e) => e.id === s.toast.id ? { ...e, ...s.toast } : e)
41
- };
42
- case "DISMISS_TOAST": {
43
- const { toastId: e } = s;
44
- return e ? f(e) : t.toasts.forEach((o) => {
45
- f(o.id);
46
- }), {
47
- ...t,
48
- toasts: t.toasts.map(
49
- (o) => o.id === e || e === void 0 ? {
50
- ...o,
51
- open: !1
52
- } : o
53
- )
54
- };
55
- }
56
- case "REMOVE_TOAST":
57
- return s.toastId === void 0 ? {
58
- ...t,
59
- toasts: []
60
- } : {
61
- ...t,
62
- toasts: t.toasts.filter((e) => e.id !== s.toastId)
63
- };
64
- }
65
- }, i = [];
66
- let c = { toasts: [] };
67
- function r(t) {
68
- c = O(c, t), i.forEach((s) => {
69
- s(c);
70
- });
71
- }
72
- function d({ ...t }) {
73
- const s = h(), e = (n) => r({
74
- type: "UPDATE_TOAST",
75
- toast: { ...n, id: s }
76
- }), o = () => r({ type: "DISMISS_TOAST", toastId: s });
77
- return r({
78
- type: "ADD_TOAST",
79
- toast: {
80
- ...t,
81
- id: s,
82
- open: !0,
83
- onOpenChange: (n) => {
84
- n || o();
85
- }
86
- }
87
- }), {
88
- id: s,
89
- dismiss: o,
90
- update: e
91
- };
92
- }
93
- function I() {
94
- const [t, s] = S.useState(c);
95
- return S.useEffect(() => (i.push(s), () => {
96
- const e = i.indexOf(s);
97
- e > -1 && i.splice(e, 1);
98
- }), [t]), {
99
- ...t,
100
- toast: d,
101
- dismiss: (e) => r({ type: "DISMISS_TOAST", toastId: e })
102
- };
103
- }
104
- const M = () => ({
105
- showSuccess: (e, o, n) => {
106
- d({ title: e, description: o, action: n });
107
- },
108
- showError: (e, o, n) => {
109
- console.error(o, n), d({ title: e, description: o, variant: "destructive" });
110
- }
111
- });
112
15
  export {
113
- d as toast,
114
- _ as useMobile,
115
- M as useNotifications,
116
- I as useToast
16
+ h as toast,
17
+ c as useMobile,
18
+ m as useNotifications,
19
+ f as useTheme,
20
+ w as useToast
117
21
  };
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ export interface ThemeOption {
3
+ value: string;
4
+ label: string;
5
+ icon: React.ComponentType<{
6
+ className?: string;
7
+ }>;
8
+ message?: string;
9
+ }
10
+ export declare function useTheme(themeOptions: readonly ThemeOption[]): {
11
+ theme: string | undefined;
12
+ setTheme: React.Dispatch<React.SetStateAction<string>>;
13
+ handleThemeChange: (newTheme: string) => void;
14
+ themeOptions: readonly ThemeOption[];
15
+ currentThemeOption: ThemeOption | undefined;
16
+ nextThemeOption: ThemeOption;
17
+ isDark: boolean;
18
+ cycleTheme: () => void;
19
+ };
20
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useTheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE;;;kCAItB,MAAM;;;;;;EAyB5C"}