@ztwoint/z-ui 0.1.137 → 0.1.139

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/README.md CHANGED
@@ -23,3 +23,30 @@ yarn add @ztwoint/z-ui
23
23
  > Note: To use this package on a remote server, you need to set up an SSH key with access to this repository.
24
24
 
25
25
  This package will be published to npm registry later.
26
+
27
+ ## Setup
28
+
29
+ ### Import Styles
30
+
31
+ In your application's main entry file (e.g., `main.tsx` or `App.tsx`), import the CSS:
32
+
33
+ ```javascript
34
+ import '@ztwoint/z-ui/css/tailwind.css';
35
+ ```
36
+
37
+ ### Fonts (Optional)
38
+
39
+ The library uses the Inter Variable font. You can either:
40
+
41
+ **Option 1: Use the bundled fonts**
42
+ ```javascript
43
+ import '@ztwoint/z-ui/css/fonts.css';
44
+ ```
45
+
46
+ **Option 2: Use your own font setup**
47
+ - Self-hosted fonts
48
+ - Google Fonts
49
+ - Custom font provider
50
+ - System fonts
51
+
52
+ See [src/styles/README.md](./src/styles/README.md) for more details.
@@ -0,0 +1,2 @@
1
+ export { KpiCard, kpiCardVariants } from './kpi-card';
2
+ export type { KpiCardProps } from './kpi-card';
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ declare const kpiCardVariants: (props?: ({
3
+ active?: boolean | null | undefined;
4
+ } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
5
+ export interface KpiCardProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {
6
+ titleText?: string;
7
+ subtitleText?: string;
8
+ bottomText?: string;
9
+ /** Whether the card is in an active/selected state */
10
+ active?: boolean;
11
+ /** React node to render in the top-right corner (e.g., action buttons) */
12
+ topRightActions?: React.ReactNode;
13
+ /** React node to render in the bottom-right corner (e.g., an icon) */
14
+ bottomRightIcon?: React.ReactNode;
15
+ }
16
+ declare const KpiCard: React.ForwardRefExoticComponent<KpiCardProps & React.RefAttributes<HTMLButtonElement>>;
17
+ export { KpiCard, kpiCardVariants };
@@ -0,0 +1,63 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cva as p } from "class-variance-authority";
4
+ import { cn as f } from "../../lib/utils.js";
5
+ const x = p(
6
+ [
7
+ "flex flex-col gap-2 items-start overflow-clip text-left",
8
+ "px-3.5 py-3.5 rounded-xl border border-stroke-solid-high",
9
+ "bg-background-neutral-default w-full",
10
+ "transition-all",
11
+ "hover:border-stroke-solid-hover hover:shadow-md",
12
+ "active:!border-stroke-solid-active",
13
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring-default"
14
+ ],
15
+ {
16
+ variants: {
17
+ active: {
18
+ true: "!border-stroke-solid-active"
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ active: !1
23
+ }
24
+ }
25
+ ), u = m.forwardRef(
26
+ ({
27
+ className: t,
28
+ titleText: i = "Title Text",
29
+ subtitleText: s,
30
+ bottomText: o = "100",
31
+ active: a,
32
+ topRightActions: l,
33
+ bottomRightIcon: n,
34
+ ...d
35
+ }, c) => /* @__PURE__ */ r(
36
+ "button",
37
+ {
38
+ ref: c,
39
+ type: "button",
40
+ className: f(x({ active: a }), t),
41
+ "aria-pressed": a,
42
+ ...d,
43
+ children: [
44
+ /* @__PURE__ */ r("div", { className: "flex gap-2 items-start w-full", children: [
45
+ /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col gap-0 items-start min-w-px min-h-px", children: [
46
+ /* @__PURE__ */ e("p", { className: "leading-normal-medium-sm text-text-body-short w-full whitespace-pre-wrap", children: i }),
47
+ /* @__PURE__ */ e("p", { className: "leading-normal-regular-xs text-text-neutral-secondary w-full whitespace-pre-wrap", children: s || " " })
48
+ ] }),
49
+ l && /* @__PURE__ */ e("div", { className: "flex gap-1 items-center justify-end shrink-0", children: l })
50
+ ] }),
51
+ /* @__PURE__ */ r("div", { className: "flex gap-2 items-center w-full", children: [
52
+ /* @__PURE__ */ e("div", { className: "flex flex-1 gap-px items-center min-w-px min-h-px", children: /* @__PURE__ */ e("p", { className: "leading-normal-bold-lg text-text-neutral-primary whitespace-nowrap", children: o }) }),
53
+ n
54
+ ] })
55
+ ]
56
+ }
57
+ )
58
+ );
59
+ u.displayName = "KpiCard";
60
+ export {
61
+ u as KpiCard,
62
+ x as kpiCardVariants
63
+ };
@@ -56,8 +56,9 @@ import "../../z2map/components/map-pin-content.js";
56
56
  import "../../z2map/components/map-controls.js";
57
57
  import "../../z2map/components/map-zoom-control.js";
58
58
  import "../../z2map/components/map-style-control.js";
59
+ import "../../kpi-card/kpi-card.js";
59
60
  import "../../table/table.context.js";
60
- const Gt = ({
61
+ const It = ({
61
62
  dataSource: w,
62
63
  schema: B,
63
64
  loading: b,
@@ -69,8 +70,8 @@ const Gt = ({
69
70
  headerClassName: j,
70
71
  search: s,
71
72
  filter: e,
72
- headerLeftContent: h,
73
- headerActions: p,
73
+ headerLeftContent: p,
74
+ headerActions: h,
74
75
  body: o = {
75
76
  cell: { hasBorder: !0 },
76
77
  className: "",
@@ -94,7 +95,7 @@ const Gt = ({
94
95
  typeof u == "string" && /* @__PURE__ */ t("div", { className: "text-text-warning-secondary text-sm", children: u })
95
96
  ] })
96
97
  ] }) });
97
- const N = a && a.totalPage && a.totalPage >= 2, C = l && l.totalPage && l.totalPage >= 2 || !!i || N, v = s || e || h || p, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
98
+ const N = a && a.totalPage && a.totalPage >= 2, C = l && l.totalPage && l.totalPage >= 2 || !!i || N, v = s || e || p || h, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
98
99
  return /* @__PURE__ */ m("div", { className: d("flex flex-col overflow-hidden relative", H), children: [
99
100
  /* @__PURE__ */ m(r, { dataSource: w, schema: B, emptyMessage: k, children: [
100
101
  g && v && /* @__PURE__ */ m(
@@ -108,7 +109,7 @@ const Gt = ({
108
109
  ),
109
110
  children: [
110
111
  /* @__PURE__ */ m(r.HeaderContent, { className: "overflow-x-auto p-[1px]", children: [
111
- h && h,
112
+ p && p,
112
113
  s && /* @__PURE__ */ t(
113
114
  r.Search,
114
115
  {
@@ -139,7 +140,7 @@ const Gt = ({
139
140
  }
140
141
  )
141
142
  ] }),
142
- p && /* @__PURE__ */ t(r.HeaderContent, { children: p })
143
+ h && /* @__PURE__ */ t(r.HeaderContent, { children: h })
143
144
  ]
144
145
  }
145
146
  ),
@@ -213,5 +214,5 @@ const Gt = ({
213
214
  ] });
214
215
  };
215
216
  export {
216
- Gt as default
217
+ It as default
217
218
  };
@@ -56,7 +56,8 @@ import "../../../z2map/components/map-pin-content.js";
56
56
  import "../../../z2map/components/map-controls.js";
57
57
  import "../../../z2map/components/map-zoom-control.js";
58
58
  import "../../../z2map/components/map-style-control.js";
59
- const ut = ({
59
+ import "../../../kpi-card/kpi-card.js";
60
+ const ht = ({
60
61
  avatar: m,
61
62
  value: a,
62
63
  rightIcon: o,
@@ -94,5 +95,5 @@ const ut = ({
94
95
  }
95
96
  );
96
97
  export {
97
- ut as AvatarCell
98
+ ht as AvatarCell
98
99
  };
@@ -61,6 +61,7 @@ import "../z2map/components/map-pin-content.js";
61
61
  import "../z2map/components/map-controls.js";
62
62
  import "../z2map/components/map-zoom-control.js";
63
63
  import "../z2map/components/map-style-control.js";
64
+ import "../kpi-card/kpi-card.js";
64
65
  import { TableHeaderWrapper as T } from "./components/table-header-wrapper.js";
65
66
  import { TableHeaderContent as b } from "./components/table-header-content.js";
66
67
  import { TableFooter as s } from "./components/table-footer.js";
@@ -15,8 +15,8 @@
15
15
  @import './colors/components/tab.css';
16
16
 
17
17
  @theme {
18
- --font-family-sans: 'Inter Variable', sans-serif;
19
- --font-family-display: 'Inter Variable', sans-serif;
18
+ --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
19
+ --font-family-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
20
20
  }
21
21
 
22
22
  /* Base styles to ensure Inter is applied globally */
@@ -1,6 +1,6 @@
1
1
  @theme {
2
- --font-family-sans: 'Inter Variable', sans-serif;
3
- --font-family-display: 'Inter Variable', sans-serif;
2
+ --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
3
+ --font-family-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
4
4
  }
5
5
 
6
6
  /* Base styles to ensure Inter is applied globally */
@@ -0,0 +1 @@
1
+ @import '@fontsource-variable/inter';