@krosoft/react 0.0.76 → 0.0.78

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.
@@ -0,0 +1,78 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import "./calendar-BMReToKR.js";
3
+ import "./checkbox-BI6Lm_p-.js";
4
+ import "./floating-ui.react-dom-BPCyLQfI.js";
5
+ import { C as x, d as h, e as g, a as f } from "./card-7XPLAra3.js";
6
+ import { c } from "./index-gWiv5-6R.js";
7
+ import "./select-B-hcmC3K.js";
8
+ import b from "react";
9
+ import { formatNumber as N } from "@krosoft/core/helpers";
10
+ import { useTranslation as v } from "react-i18next";
11
+ const C = ({ titleKey: r, value: e, valueClassName: n, icon: a, iconClassName: d, description: l, descriptionClassName: i, onClick: o }) => {
12
+ const { t: m } = v();
13
+ return /* @__PURE__ */ s(x, { className: c(o ? "hover:border-primary cursor-pointer" : ""), onClick: o, children: [
14
+ /* @__PURE__ */ s(h, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
15
+ /* @__PURE__ */ t(g, { className: "text-sm font-medium", children: m(r) }),
16
+ b.createElement(a, {
17
+ className: c("size-6 text-muted-foreground", d)
18
+ })
19
+ ] }),
20
+ /* @__PURE__ */ s(f, { children: [
21
+ /* @__PURE__ */ t("div", { className: c("text-2xl font-bold", n), children: N(e) }),
22
+ /* @__PURE__ */ t("p", { className: c("text-xs text-muted-foreground", i), children: l })
23
+ ] })
24
+ ] });
25
+ }, R = ({ stats: r }) => /* @__PURE__ */ t("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: r.map((e) => /* @__PURE__ */ t(
26
+ C,
27
+ {
28
+ titleKey: e.titleKey,
29
+ value: e.value,
30
+ valueClassName: e.valueClassName,
31
+ icon: e.icon,
32
+ iconClassName: e.iconClassName,
33
+ description: e.description,
34
+ descriptionClassName: e.descriptionClassName,
35
+ onClick: e.onClick
36
+ },
37
+ e.titleKey
38
+ )) }), w = {
39
+ blue: "bg-gradient-to-br from-blue-500 to-cyan-500 text-white",
40
+ green: "bg-gradient-to-br from-green-500 to-emerald-500 text-white",
41
+ orange: "bg-gradient-to-br from-orange-500 to-yellow-500 text-white",
42
+ red: "bg-gradient-to-br from-red-500 to-pink-500 text-white",
43
+ purple: "bg-gradient-to-br from-purple-500 to-indigo-500 text-white",
44
+ accent: "bg-accent/10 text-accent",
45
+ success: "bg-success/10 text-success",
46
+ info: "bg-info/10 text-info",
47
+ warning: "bg-warning/10 text-warning",
48
+ destructive: "bg-destructive/10 text-destructive"
49
+ }, y = {
50
+ sm: "size-4",
51
+ md: "size-5",
52
+ lg: "size-6"
53
+ }, K = (r) => r === "up" ? "↑" : r === "down" ? "↓" : "", z = (r) => r === "up" ? "text-green-600" : r === "down" ? "text-red-600" : "text-muted-foreground", S = ({ title: r, value: e, unit: n, subtitle: a, icon: d, iconSize: l = "sm", trend: i, trendValue: o, color: m = "blue", children: u }) => {
54
+ const p = d;
55
+ return /* @__PURE__ */ t(x, { className: "relative overflow-hidden bg-card border shadow-lg hover:shadow-xl transition-all duration-300", children: /* @__PURE__ */ s(f, { className: "pt-6", children: [
56
+ /* @__PURE__ */ s("div", { className: "flex items-start justify-between", children: [
57
+ /* @__PURE__ */ s("div", { children: [
58
+ /* @__PURE__ */ t(g, { className: "text-sm font-medium text-muted-foreground", children: r }),
59
+ /* @__PURE__ */ s("div", { className: "flex items-baseline space-x-2 mt-1", children: [
60
+ /* @__PURE__ */ t("div", { className: "text-2xl font-bold text-card-foreground", children: typeof e == "number" ? e.toFixed(1) : e }),
61
+ n && /* @__PURE__ */ t("div", { className: "text-sm text-muted-foreground font-medium", children: n })
62
+ ] }),
63
+ a && /* @__PURE__ */ t("div", { className: "mt-1 text-xs text-muted-foreground", children: a }),
64
+ i && o && /* @__PURE__ */ s("div", { className: `flex items-center space-x-1 mt-2 text-xs ${z(i)}`, children: [
65
+ /* @__PURE__ */ t("span", { children: K(i) }),
66
+ /* @__PURE__ */ t("span", { children: o })
67
+ ] })
68
+ ] }),
69
+ /* @__PURE__ */ t("div", { className: `p-2 rounded-lg ${w[m]} shadow-lg`, children: /* @__PURE__ */ t(p, { className: y[l] }) })
70
+ ] }),
71
+ u && /* @__PURE__ */ t("div", { className: "mt-4", children: u })
72
+ ] }) });
73
+ };
74
+ export {
75
+ C as K,
76
+ S as M,
77
+ R as a
78
+ };
@@ -1,23 +1,36 @@
1
1
  import type { LucideIcon } from "lucide-react";
2
2
  import * as React from "react";
3
3
  declare const colorClasses: {
4
- readonly blue: "from-blue-500 to-cyan-500";
5
- readonly green: "from-green-500 to-emerald-500";
6
- readonly orange: "from-orange-500 to-yellow-500";
7
- readonly red: "from-red-500 to-pink-500";
8
- readonly purple: "from-purple-500 to-indigo-500";
4
+ readonly blue: "bg-gradient-to-br from-blue-500 to-cyan-500 text-white";
5
+ readonly green: "bg-gradient-to-br from-green-500 to-emerald-500 text-white";
6
+ readonly orange: "bg-gradient-to-br from-orange-500 to-yellow-500 text-white";
7
+ readonly red: "bg-gradient-to-br from-red-500 to-pink-500 text-white";
8
+ readonly purple: "bg-gradient-to-br from-purple-500 to-indigo-500 text-white";
9
+ readonly accent: "bg-accent/10 text-accent";
10
+ readonly success: "bg-success/10 text-success";
11
+ readonly info: "bg-info/10 text-info";
12
+ readonly warning: "bg-warning/10 text-warning";
13
+ readonly destructive: "bg-destructive/10 text-destructive";
9
14
  };
10
15
  export type MetricCardColor = keyof typeof colorClasses;
16
+ declare const iconSizeClasses: {
17
+ readonly sm: "size-4";
18
+ readonly md: "size-5";
19
+ readonly lg: "size-6";
20
+ };
21
+ export type MetricCardIconSize = keyof typeof iconSizeClasses;
11
22
  export interface MetricCardProps {
12
23
  title: string;
13
24
  value: string | number;
14
25
  unit?: string;
26
+ subtitle?: string;
15
27
  icon: LucideIcon;
28
+ iconSize?: MetricCardIconSize;
16
29
  trend?: "up" | "down" | "stable";
17
30
  trendValue?: string;
18
31
  color?: MetricCardColor;
19
32
  children?: React.ReactNode;
20
33
  }
21
- export declare const MetricCard: ({ title, value, unit, icon: Icon, trend, trendValue, color, children }: MetricCardProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const MetricCard: ({ title, value, unit, subtitle, icon, iconSize, trend, trendValue, color, children }: MetricCardProps) => import("react/jsx-runtime").JSX.Element;
22
35
  export {};
23
36
  //# sourceMappingURL=MetricCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetricCard.d.ts","sourceRoot":"","sources":["../../../../src/components/core/cards/MetricCard.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,QAAA,MAAM,YAAY;;;;;;CAMR,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAcD,eAAO,MAAM,UAAU,GAAI,wEAAiF,eAAe,4CA6B1H,CAAC"}
1
+ {"version":3,"file":"MetricCard.d.ts","sourceRoot":"","sources":["../../../../src/components/core/cards/MetricCard.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,QAAA,MAAM,YAAY;;;;;;;;;;;CAWR,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC;AAExD,QAAA,MAAM,eAAe;;;;CAIX,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,eAAe,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAcD,eAAO,MAAM,UAAU,GAAI,sFAAsG,eAAe,4CA6B/I,CAAC"}
@@ -1,4 +1,4 @@
1
- import { K as s, a as d, M as i } from "../../../MetricCard-88djqC4o.js";
1
+ import { K as s, a as d, M as i } from "../../../MetricCard-B1Y-27_U.js";
2
2
  export {
3
3
  s as KpiCard,
4
4
  d as KpiCards,
@@ -1,4 +1,4 @@
1
- import { K as r, a as s, M as t } from "../../MetricCard-88djqC4o.js";
1
+ import { K as r, a as s, M as t } from "../../MetricCard-B1Y-27_U.js";
2
2
  import { D as T, S as l } from "../../DateRangePicker-rrXXEYz8.js";
3
3
  import { C as i, a as d, E as n, L as p } from "../../LoadingState-CqRLmkxn.js";
4
4
  import { D as c, T as m, a as f, b as x, c as C, d as D, e as g, u as k } from "../../DataTable-CjFA9p4V.js";
@@ -1,4 +1,4 @@
1
- import { K as s, a as t, M as r } from "../MetricCard-88djqC4o.js";
1
+ import { K as s, a as t, M as r } from "../MetricCard-B1Y-27_U.js";
2
2
  import { D as l, S as i } from "../DateRangePicker-rrXXEYz8.js";
3
3
  import { C as d, a as n, E as c, L as p } from "../LoadingState-CqRLmkxn.js";
4
4
  import { D as C, T as S, a as f, b as m, c as x, d as g, e as u, u as D } from "../DataTable-CjFA9p4V.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@krosoft/core": ">=0.0.1",
34
- "next-themes": ">=0.4.0",
34
+ "next-themes": ">=0.4.6",
35
35
  "react": ">=18.3.1",
36
36
  "react-i18next": ">=17.0.8"
37
37
  },
@@ -51,14 +51,14 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "class-variance-authority": "^0.7.1",
53
53
  "clsx": "^2.1.1",
54
- "date-fns": "^4.2.1",
54
+ "date-fns": "^4.3.0",
55
55
  "lucide-react": "^1.16.0",
56
56
  "react-day-picker": "^10.0.1",
57
57
  "tailwind-merge": "^2.6.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@krosoft/core": "^0.0.37",
61
- "@krosoft/tooling-eslint-react": "^0.0.18",
61
+ "@krosoft/tooling-eslint-react": "^0.0.20",
62
62
  "@krosoft/tooling-prettier": "^0.0.14",
63
63
  "@krosoft/tooling-tsconfig-react": "^0.0.10",
64
64
  "@storybook/addon-essentials": "^8.6.18",
@@ -1,66 +0,0 @@
1
- import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import "./calendar-BMReToKR.js";
3
- import "./checkbox-BI6Lm_p-.js";
4
- import "./floating-ui.react-dom-BPCyLQfI.js";
5
- import { C as m, d as p, e as u, a as f } from "./card-7XPLAra3.js";
6
- import { c as n } from "./index-gWiv5-6R.js";
7
- import "./select-B-hcmC3K.js";
8
- import g from "react";
9
- import { formatNumber as N } from "@krosoft/core/helpers";
10
- import { useTranslation as h } from "react-i18next";
11
- const b = ({ titleKey: t, value: e, valueClassName: i, icon: d, iconClassName: s, description: l, descriptionClassName: c, onClick: a }) => {
12
- const { t: x } = h();
13
- return /* @__PURE__ */ o(m, { className: n(a ? "hover:border-primary cursor-pointer" : ""), onClick: a, children: [
14
- /* @__PURE__ */ o(p, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
15
- /* @__PURE__ */ r(u, { className: "text-sm font-medium", children: x(t) }),
16
- g.createElement(d, {
17
- className: n("size-6 text-muted-foreground", s)
18
- })
19
- ] }),
20
- /* @__PURE__ */ o(f, { children: [
21
- /* @__PURE__ */ r("div", { className: n("text-2xl font-bold", i), children: N(e) }),
22
- /* @__PURE__ */ r("p", { className: n("text-xs text-muted-foreground", c), children: l })
23
- ] })
24
- ] });
25
- }, F = ({ stats: t }) => /* @__PURE__ */ r("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: t.map((e) => /* @__PURE__ */ r(
26
- b,
27
- {
28
- titleKey: e.titleKey,
29
- value: e.value,
30
- valueClassName: e.valueClassName,
31
- icon: e.icon,
32
- iconClassName: e.iconClassName,
33
- description: e.description,
34
- descriptionClassName: e.descriptionClassName,
35
- onClick: e.onClick
36
- },
37
- e.titleKey
38
- )) }), C = {
39
- blue: "from-blue-500 to-cyan-500",
40
- green: "from-green-500 to-emerald-500",
41
- orange: "from-orange-500 to-yellow-500",
42
- red: "from-red-500 to-pink-500",
43
- purple: "from-purple-500 to-indigo-500"
44
- }, v = (t) => t === "up" ? "↗" : t === "down" ? "↘" : "→", w = (t) => t === "up" ? "text-green-600" : t === "down" ? "text-red-600" : "text-muted-foreground", H = ({ title: t, value: e, unit: i, icon: d, trend: s, trendValue: l, color: c = "blue", children: a }) => /* @__PURE__ */ o(m, { className: "relative overflow-hidden bg-card border shadow-lg hover:shadow-xl transition-all duration-300", children: [
45
- /* @__PURE__ */ r("div", { className: "absolute inset-0 bg-white/5" }),
46
- /* @__PURE__ */ o(p, { className: "flex flex-row items-center justify-between space-y-0 pb-2 relative z-10", children: [
47
- /* @__PURE__ */ r(u, { className: "text-sm font-medium text-muted-foreground", children: t }),
48
- /* @__PURE__ */ r("div", { className: `p-2 rounded-lg bg-gradient-to-br ${C[c]} shadow-lg`, children: /* @__PURE__ */ r(d, { className: "size-4 text-white" }) })
49
- ] }),
50
- /* @__PURE__ */ o(f, { className: "relative z-10", children: [
51
- /* @__PURE__ */ o("div", { className: "flex items-baseline space-x-2", children: [
52
- /* @__PURE__ */ r("div", { className: "text-2xl font-bold text-card-foreground", children: typeof e == "number" ? e.toFixed(1) : e }),
53
- i && /* @__PURE__ */ r("div", { className: "text-sm text-muted-foreground font-medium", children: i })
54
- ] }),
55
- s && l && /* @__PURE__ */ o("div", { className: `flex items-center space-x-1 mt-2 text-xs ${w(s)}`, children: [
56
- /* @__PURE__ */ r("span", { children: v(s) }),
57
- /* @__PURE__ */ r("span", { children: l })
58
- ] }),
59
- a && /* @__PURE__ */ r("div", { className: "mt-4", children: a })
60
- ] })
61
- ] });
62
- export {
63
- b as K,
64
- H as M,
65
- F as a
66
- };