@pihanga2/shadcn 0.2.2 → 0.2.4
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 +3 -12
- package/cards/badge/badge.component.js +1 -1
- package/cards/box/box.component.js +1 -1
- package/cards/button/button.component.js +13 -13
- package/cards/chart/chart.types.d.ts +63 -0
- package/cards/checkbox/checkbox.component.js +1 -1
- package/cards/conditional/conditional.component.js +5 -5
- package/cards/dataTable/dataTable.component.js +8 -8
- package/cards/dataTable/dataTableRowDetail.component.js +1 -1
- package/cards/dialog/dialog.component.js +7 -7
- package/cards/dropDownMenu/drop-down.component.js +7 -7
- package/cards/field/field.component.js +4 -4
- package/cards/fileDrop/fileDrop.component.js +15 -15
- package/cards/flexGrid/flexGrid.component.js +1 -1
- package/cards/form/form.component.js +6 -6
- package/cards/framework/framework.component.js +4 -4
- package/cards/graphin/graphin.types.d.ts +106 -0
- package/cards/graphin/legend.component.d.ts +6 -0
- package/cards/input/input.component.js +1 -1
- package/cards/jsonViewer/index.js +13 -0
- package/cards/jsonViewer/index.js.map +1 -0
- package/cards/jsonViewer/jsonViewer.component.js +89 -0
- package/cards/jsonViewer/jsonViewer.component.js.map +1 -0
- package/cards/jsonViewer/jsonViewer.types.js +7 -0
- package/cards/jsonViewer/jsonViewer.types.js.map +1 -0
- package/cards/list/list.component.js +32 -32
- package/cards/list/list.types.js +1 -1
- package/cards/loadingOverlay/loadingOverlay.component.js +1 -1
- package/cards/loadingSkeleton/loading-skeleton.component.js +1 -1
- package/cards/pageWithNavbar/pageWithNavbar.component.js +43 -43
- package/cards/resizable/index.js +12 -0
- package/cards/resizable/index.js.map +1 -0
- package/cards/resizable/resizable.component.js +42 -0
- package/cards/resizable/resizable.component.js.map +1 -0
- package/cards/resizable/resizable.types.js +10 -0
- package/cards/resizable/resizable.types.js.map +1 -0
- package/cards/select/select.component.js +1 -1
- package/cards/slider/slider.component.js +1 -1
- package/cards/sliderValue/sliderValue.component.js +1 -1
- package/cards/stack/stack.component.js +4 -4
- package/cards/stepper/stepper.component.js +7 -7
- package/cards/switch/switch.component.js +1 -1
- package/cards/tabs/tabs.component.js +6 -6
- package/cards/textField/textField.component.js +1 -1
- package/cards/toast/toast.component.js +12 -12
- package/cards/toggleGroup/toggleGroup.component.js +1 -1
- package/cards/typography/typography.component.js +4 -4
- package/cards/typography/typography.types.js +1 -1
- package/components/ui/resizable.js +34 -0
- package/components/ui/resizable.js.map +1 -0
- package/package.json +13 -7
- package/pihanga-shadcn.css +1 -1
- package/cards/core-index.js +0 -68
package/README.md
CHANGED
|
@@ -52,17 +52,6 @@ module.exports = {
|
|
|
52
52
|
|
|
53
53
|
## Usage
|
|
54
54
|
|
|
55
|
-
### Register all core cards at once
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
import "@pihanga2/shadcn";
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
This imports `core-index.js`, which calls `registerCardComponent()` for every
|
|
62
|
-
core card in the Pihanga runtime.
|
|
63
|
-
|
|
64
|
-
### Register individual cards (tree-shakeable)
|
|
65
|
-
|
|
66
55
|
Import only the cards your app uses — unused cards are eliminated by your bundler:
|
|
67
56
|
|
|
68
57
|
```ts
|
|
@@ -73,7 +62,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
73
62
|
|
|
74
63
|
---
|
|
75
64
|
|
|
76
|
-
## Included cards (
|
|
65
|
+
## Included cards (35)
|
|
77
66
|
|
|
78
67
|
- `badge`
|
|
79
68
|
- `box`
|
|
@@ -89,6 +78,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
89
78
|
- `form`
|
|
90
79
|
- `framework`
|
|
91
80
|
- `input`
|
|
81
|
+
- `jsonViewer`
|
|
92
82
|
- `list`
|
|
93
83
|
- `loadingOverlay`
|
|
94
84
|
- `loadingSkeleton`
|
|
@@ -97,6 +87,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
97
87
|
- `navbarSearch`
|
|
98
88
|
- `pageWithNavbar`
|
|
99
89
|
- `pasteTarget`
|
|
90
|
+
- `resizable`
|
|
100
91
|
- `select`
|
|
101
92
|
- `slider`
|
|
102
93
|
- `sliderValue`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Badge as e } from "../../components/ui/badge.js";
|
|
2
2
|
import { cn as t } from "../../lib/utils.js";
|
|
3
|
-
import "@pihanga2/core";
|
|
4
3
|
import "react";
|
|
4
|
+
import "@pihanga2/core";
|
|
5
5
|
import { jsx as n } from "react/jsx-runtime";
|
|
6
6
|
//#region src/cards/badge/badge.component.tsx
|
|
7
7
|
var r = (r) => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getIcon as e } from "../icons.js";
|
|
2
|
+
import { Button as t, LinkButton as n } from "../../components/ui/button.js";
|
|
3
|
+
import { Tooltip as r, TooltipContent as i, TooltipTrigger as a } from "../../components/ui/tooltip.js";
|
|
4
4
|
import { useDropdownOpen as o } from "../dropDownMenu/dropdown-context.js";
|
|
5
|
-
import { Card as s } from "@pihanga2/core";
|
|
6
5
|
import "react";
|
|
6
|
+
import { Card as s } from "@pihanga2/core";
|
|
7
7
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
//#region src/cards/button/button.component.tsx
|
|
9
|
-
function d(
|
|
10
|
-
return
|
|
9
|
+
function d(t) {
|
|
10
|
+
return t ? e(t) : null;
|
|
11
11
|
}
|
|
12
|
-
var f = (
|
|
13
|
-
let { opts: f, ariaLabel: p, label: m, iconLabel: h, contentCard: g, href: _, target: v, tooltip: y, tooltipCard: b, tooltipMode: x, tooltipPlacement: S, className: C, id: w, onClicked: T, cardName: E, _cls: D, active: O, focused: k, disabled: A, loading: j, isPending: M } =
|
|
12
|
+
var f = (e) => {
|
|
13
|
+
let { opts: f, ariaLabel: p, label: m, iconLabel: h, contentCard: g, href: _, target: v, tooltip: y, tooltipCard: b, tooltipMode: x, tooltipPlacement: S, className: C, id: w, onClicked: T, cardName: E, _cls: D, active: O, focused: k, disabled: A, loading: j, isPending: M } = e, N = o(), P = d(f?.beforeIcon), F = d(f?.afterIcon), I = /* @__PURE__ */ u(c, { children: [
|
|
14
14
|
P,
|
|
15
15
|
h ? d(h) : g ? /* @__PURE__ */ l(s, {
|
|
16
16
|
cardName: g,
|
|
@@ -31,7 +31,7 @@ var f = (a) => {
|
|
|
31
31
|
className: `${D("root")} ${C || ""}`.trim()
|
|
32
32
|
}, R = () => {
|
|
33
33
|
T({ id: w });
|
|
34
|
-
}, z = () => _ ? /* @__PURE__ */ l(
|
|
34
|
+
}, z = () => _ ? /* @__PURE__ */ l(n, {
|
|
35
35
|
...L,
|
|
36
36
|
href: _,
|
|
37
37
|
target: v,
|
|
@@ -39,7 +39,7 @@ var f = (a) => {
|
|
|
39
39
|
label: p ?? m,
|
|
40
40
|
onClick: R,
|
|
41
41
|
children: I
|
|
42
|
-
}) : /* @__PURE__ */ l(
|
|
42
|
+
}) : /* @__PURE__ */ l(t, {
|
|
43
43
|
...L,
|
|
44
44
|
"data-pihanga": E,
|
|
45
45
|
label: p ?? m,
|
|
@@ -54,12 +54,12 @@ var f = (a) => {
|
|
|
54
54
|
"data-pihanga": `${E}-tooltip`,
|
|
55
55
|
children: y
|
|
56
56
|
});
|
|
57
|
-
return /* @__PURE__ */ u(
|
|
57
|
+
return /* @__PURE__ */ u(r, {
|
|
58
58
|
open: B,
|
|
59
|
-
children: [/* @__PURE__ */ l(
|
|
59
|
+
children: [/* @__PURE__ */ l(a, {
|
|
60
60
|
asChild: !0,
|
|
61
61
|
children: z()
|
|
62
|
-
}), /* @__PURE__ */ l(
|
|
62
|
+
}), /* @__PURE__ */ l(i, {
|
|
63
63
|
side: S,
|
|
64
64
|
children: V
|
|
65
65
|
})]
|
|
@@ -47,6 +47,55 @@ export type PiChartSeries = {
|
|
|
47
47
|
*/
|
|
48
48
|
fillOpacity?: number;
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* A single recharts `<ReferenceArea>` to overlay on the chart.
|
|
52
|
+
* Highlights a rectangular region between two x or y coordinates.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* // Highlight a y-range (horizontal band)
|
|
57
|
+
* { y1: 100, y2: 200, fill: "var(--chart-3)", fillOpacity: 0.2, label: "Target zone" }
|
|
58
|
+
*
|
|
59
|
+
* // Highlight an x-range (vertical band)
|
|
60
|
+
* { x1: "Feb", x2: "Apr", fill: "var(--chart-2)", fillOpacity: 0.15 }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export type PiChartReferenceArea = {
|
|
64
|
+
/** Start value on the **x-axis**. Omit for a y-only band. */
|
|
65
|
+
x1?: string | number;
|
|
66
|
+
/** End value on the **x-axis**. Omit for a y-only band. */
|
|
67
|
+
x2?: string | number;
|
|
68
|
+
/** Start value on the **y-axis**. Omit for an x-only band. */
|
|
69
|
+
y1?: number;
|
|
70
|
+
/** End value on the **y-axis**. Omit for an x-only band. */
|
|
71
|
+
y2?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Label rendered inside the area. Pass a plain string or a
|
|
74
|
+
* `{ value, position, fill, fontSize }` object for full control.
|
|
75
|
+
*/
|
|
76
|
+
label?: string | {
|
|
77
|
+
value: string;
|
|
78
|
+
position?: string;
|
|
79
|
+
fill?: string;
|
|
80
|
+
fontSize?: number;
|
|
81
|
+
};
|
|
82
|
+
/** CSS fill colour. Defaults to `"var(--chart-1)"`. */
|
|
83
|
+
fill?: string;
|
|
84
|
+
/** Fill opacity, 0–1. Defaults to `0.2`. */
|
|
85
|
+
fillOpacity?: number;
|
|
86
|
+
/** CSS colour for the area border stroke. */
|
|
87
|
+
stroke?: string;
|
|
88
|
+
/** SVG `stroke-dasharray` for the area border. */
|
|
89
|
+
strokeDasharray?: string;
|
|
90
|
+
/** Area border width in pixels. */
|
|
91
|
+
strokeWidth?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Behaviour when the area extends beyond the chart boundary.
|
|
94
|
+
* `"discard"` | `"hidden"` | `"visible"` | `"extendDomain"`.
|
|
95
|
+
* Defaults to `"discard"`.
|
|
96
|
+
*/
|
|
97
|
+
ifOverflow?: "discard" | "hidden" | "visible" | "extendDomain";
|
|
98
|
+
};
|
|
50
99
|
/**
|
|
51
100
|
* A single recharts `<ReferenceLine>` to overlay on the chart.
|
|
52
101
|
* Specify either `x` (vertical line) or `y` (horizontal line).
|
|
@@ -218,6 +267,20 @@ export type PiChartGraphProps = {
|
|
|
218
267
|
* ```
|
|
219
268
|
*/
|
|
220
269
|
referenceLines?: PiChartReferenceLine[];
|
|
270
|
+
/**
|
|
271
|
+
* One or more reference areas to overlay on the chart.
|
|
272
|
+
* Each entry maps directly to a recharts `<ReferenceArea>` and highlights
|
|
273
|
+
* a rectangular region (x-band, y-band, or both).
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* referenceAreas: [
|
|
278
|
+
* { y1: 100, y2: 200, fill: "var(--chart-3)", fillOpacity: 0.15, label: "Target" },
|
|
279
|
+
* { x1: "Feb", x2: "Apr", fill: "var(--chart-4)", fillOpacity: 0.1 },
|
|
280
|
+
* ]
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
referenceAreas?: PiChartReferenceArea[];
|
|
221
284
|
/** Extra Tailwind / CSS classes forwarded to the outermost element. */
|
|
222
285
|
className?: string;
|
|
223
286
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useBreakpoint as e, useContainerBreakpoint as t } from "../../components/hooks/use-breakpoint.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { Card as r } from "@pihanga2/core";
|
|
4
4
|
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/cards/conditional/conditional.component.tsx
|
|
6
6
|
var a = (a) => {
|
|
7
|
-
let { cardName: o, show: s = !0, showOn: c, containerQuery: l = !1, content: u } = a, d =
|
|
7
|
+
let { cardName: o, show: s = !0, showOn: c, containerQuery: l = !1, content: u } = a, d = n.useRef(null), f = e(l ? void 0 : c), p = t(l ? c : void 0, d), m = s && (l ? p : f);
|
|
8
8
|
return l ? /* @__PURE__ */ i("div", {
|
|
9
9
|
ref: d,
|
|
10
10
|
style: { width: "100%" },
|
|
11
|
-
children: m && /* @__PURE__ */ i(
|
|
11
|
+
children: m && /* @__PURE__ */ i(r, {
|
|
12
12
|
cardName: u,
|
|
13
13
|
parentCard: o
|
|
14
14
|
})
|
|
15
|
-
}) : m ? /* @__PURE__ */ i(
|
|
15
|
+
}) : m ? /* @__PURE__ */ i(r, {
|
|
16
16
|
cardName: u,
|
|
17
17
|
parentCard: o
|
|
18
18
|
}) : null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Badge as e } from "../../components/ui/badge.js";
|
|
2
2
|
import { cn as t } from "../../lib/utils.js";
|
|
3
3
|
import { Table as n, TableBody as r, TableCaption as i, TableCell as a, TableHead as o, TableHeader as s, TableRow as c } from "../../components/ui/table.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import l, { useMemo as u, useState as d } from "react";
|
|
5
|
+
import { Card as f } from "@pihanga2/core";
|
|
6
6
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
import { Check as h, ChevronDown as g, ChevronRight as _, ChevronUp as v, ChevronsUpDown as y, X as b } from "lucide-react";
|
|
8
8
|
//#region src/cards/dataTable/dataTable.component.tsx
|
|
@@ -32,7 +32,7 @@ function ee(t, n, r) {
|
|
|
32
32
|
className: "size-4 text-muted-foreground",
|
|
33
33
|
"aria-label": "false"
|
|
34
34
|
});
|
|
35
|
-
case "card": return /* @__PURE__ */ p(
|
|
35
|
+
case "card": return /* @__PURE__ */ p(f, {
|
|
36
36
|
cardName: String(n),
|
|
37
37
|
parentCard: r
|
|
38
38
|
});
|
|
@@ -76,7 +76,7 @@ function C(e) {
|
|
|
76
76
|
return e.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase()).trim();
|
|
77
77
|
}
|
|
78
78
|
var w = (e) => {
|
|
79
|
-
let { columns: h, rows: v, caption: y, sortKey: b, sortAscending: w, pageSize: T, currentPage: E, stickyHeader: D = !1, striped: te = !1, hoverable: ne = !0, compact: re = !1, emptyCard: O, emptyText: ie = "No data", className: k, cardName: A, onRowClicked: j, onSortChanged: M, onShowDetail: N, onHideDetail: P, onPageChanged: F } = e, [I, L] =
|
|
79
|
+
let { columns: h, rows: v, caption: y, sortKey: b, sortAscending: w, pageSize: T, currentPage: E, stickyHeader: D = !1, striped: te = !1, hoverable: ne = !0, compact: re = !1, emptyCard: O, emptyText: ie = "No data", className: k, cardName: A, onRowClicked: j, onSortChanged: M, onShowDetail: N, onHideDetail: P, onPageChanged: F } = e, [I, L] = d(/* @__PURE__ */ new Set()), [R, z] = d(b), [B, V] = d(w ?? !0), H = b === void 0 ? R : b, U = w === void 0 ? B : w, [W, G] = d(E ?? 0), K = E === void 0 ? W : E, q = v.some((e) => e.detailCard != null), J = h.length + +!!q, Y = u(() => H ? [...v].sort((e, t) => {
|
|
80
80
|
let n = e.data[H], r = t.data[H];
|
|
81
81
|
if (n == null && r == null) return 0;
|
|
82
82
|
if (n == null) return 1;
|
|
@@ -87,7 +87,7 @@ var w = (e) => {
|
|
|
87
87
|
v,
|
|
88
88
|
H,
|
|
89
89
|
U
|
|
90
|
-
]), X =
|
|
90
|
+
]), X = u(() => {
|
|
91
91
|
if (!T) return Y;
|
|
92
92
|
let e = K * T;
|
|
93
93
|
return Y.slice(e, e + T);
|
|
@@ -150,13 +150,13 @@ var w = (e) => {
|
|
|
150
150
|
/* @__PURE__ */ p(r, { children: X.length === 0 ? /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p(a, {
|
|
151
151
|
colSpan: J,
|
|
152
152
|
className: "py-8 text-center text-muted-foreground",
|
|
153
|
-
children: O ? /* @__PURE__ */ p(
|
|
153
|
+
children: O ? /* @__PURE__ */ p(f, {
|
|
154
154
|
cardName: O,
|
|
155
155
|
parentCard: A
|
|
156
156
|
}) : ie
|
|
157
157
|
}) }) : X.map((e, n) => {
|
|
158
158
|
let r = I.has(e.id), i = te && n % 2 == 1;
|
|
159
|
-
return /* @__PURE__ */ m(
|
|
159
|
+
return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ m(c, {
|
|
160
160
|
className: t(i && "bg-muted/30", ne && "cursor-pointer"),
|
|
161
161
|
"data-expanded": r || void 0,
|
|
162
162
|
onClick: () => se(e),
|
|
@@ -185,7 +185,7 @@ var w = (e) => {
|
|
|
185
185
|
className: "border-b p-0",
|
|
186
186
|
children: /* @__PURE__ */ p("div", {
|
|
187
187
|
className: "bg-muted/20 px-4 py-3",
|
|
188
|
-
children: /* @__PURE__ */ p(
|
|
188
|
+
children: /* @__PURE__ */ p(f, {
|
|
189
189
|
cardName: e.detailCard,
|
|
190
190
|
cardKey: `detail-${e.id}`,
|
|
191
191
|
row: e,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn as e } from "../../lib/utils.js";
|
|
2
|
-
import "@pihanga2/core";
|
|
3
2
|
import "react";
|
|
3
|
+
import "@pihanga2/core";
|
|
4
4
|
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/cards/dataTable/dataTableRowDetail.component.tsx
|
|
6
6
|
var i = (i) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Button as e } from "../../components/ui/button.js";
|
|
2
2
|
import { Dialog as t, DialogBody as n, DialogContent as r, DialogDescription as i, DialogFooter as a, DialogHeader as o, DialogTitle as s, DialogTrigger as c } from "../../components/ui/dialog.js";
|
|
3
|
-
import
|
|
4
|
-
import u from "
|
|
3
|
+
import l from "react";
|
|
4
|
+
import { Card as u } from "@pihanga2/core";
|
|
5
5
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
6
|
//#region src/cards/dialog/dialog.component.tsx
|
|
7
7
|
var p = (p) => {
|
|
8
|
-
let { id: m, trigger: h, content: g, title: _, description: v, open: y, size: b, variant: x, desktopVariant: S, mobileVariant: C, dismissible: w, hideClose: T, className: E, footer: D, footerCloseButtonText: O, cardName: k, onOpened: A, onClosed: j, onOpenChanged: M } = p, N = O === void 0 ? "Close" : O, [P, F] =
|
|
9
|
-
|
|
8
|
+
let { id: m, trigger: h, content: g, title: _, description: v, open: y, size: b, variant: x, desktopVariant: S, mobileVariant: C, dismissible: w, hideClose: T, className: E, footer: D, footerCloseButtonText: O, cardName: k, onOpened: A, onClosed: j, onOpenChanged: M } = p, N = O === void 0 ? "Close" : O, [P, F] = l.useState(!1), I = y ?? P, L = l.useRef(y);
|
|
9
|
+
l.useEffect(() => {
|
|
10
10
|
L.current === !0 && y === !1 && I === !1 && j({
|
|
11
11
|
id: m,
|
|
12
12
|
reason: "programmatic"
|
|
@@ -30,7 +30,7 @@ var p = (p) => {
|
|
|
30
30
|
return h ? /* @__PURE__ */ d("span", {
|
|
31
31
|
className: "inline-flex",
|
|
32
32
|
"data-pihanga-trigger-wrapper": !0,
|
|
33
|
-
children: /* @__PURE__ */ d(
|
|
33
|
+
children: /* @__PURE__ */ d(u, {
|
|
34
34
|
cardName: h,
|
|
35
35
|
parentCard: k
|
|
36
36
|
})
|
|
@@ -42,7 +42,7 @@ var p = (p) => {
|
|
|
42
42
|
function V() {
|
|
43
43
|
return D ? /* @__PURE__ */ d(a, {
|
|
44
44
|
className: "bg-muted/50",
|
|
45
|
-
children: /* @__PURE__ */ d(
|
|
45
|
+
children: /* @__PURE__ */ d(u, {
|
|
46
46
|
cardName: D,
|
|
47
47
|
parentCard: k
|
|
48
48
|
})
|
|
@@ -74,7 +74,7 @@ var p = (p) => {
|
|
|
74
74
|
className: E,
|
|
75
75
|
children: [
|
|
76
76
|
B(),
|
|
77
|
-
/* @__PURE__ */ d(n, { children: /* @__PURE__ */ d(
|
|
77
|
+
/* @__PURE__ */ d(n, { children: /* @__PURE__ */ d(u, {
|
|
78
78
|
cardName: g,
|
|
79
79
|
parentCard: k
|
|
80
80
|
}) }),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DropdownOpenContext as e } from "./dropdown-context.js";
|
|
2
2
|
import { DropdownMenu as t, DropdownMenuCheckboxItem as n, DropdownMenuContent as r, DropdownMenuGroup as i, DropdownMenuItem as a, DropdownMenuLabel as o, DropdownMenuRadioGroup as s, DropdownMenuRadioItem as c, DropdownMenuSeparator as l, DropdownMenuShortcut as u, DropdownMenuSub as d, DropdownMenuSubContent as f, DropdownMenuSubTrigger as p, DropdownMenuTrigger as m } from "./dropdown-menu.ui.js";
|
|
3
|
-
import
|
|
4
|
-
import g from "
|
|
3
|
+
import h from "react";
|
|
4
|
+
import { Card as g } from "@pihanga2/core";
|
|
5
5
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
6
6
|
//#region src/cards/dropDownMenu/drop-down.component.tsx
|
|
7
7
|
var b = (b) => {
|
|
8
|
-
let { trigger: x, menuLabel: S, menuAlign: C, items: w, cardName: T, checkboxCloseDelayMs: E } = b, [D, O] =
|
|
8
|
+
let { trigger: x, menuLabel: S, menuAlign: C, items: w, cardName: T, checkboxCloseDelayMs: E } = b, [D, O] = h.useState(!1), k = h.useRef(null), [A, j] = h.useState({}), M = h.useCallback((e, t) => [...e, t].join("::"), []), N = h.useCallback((e, t = []) => {
|
|
9
9
|
let n = {};
|
|
10
10
|
if (!e?.length) return n;
|
|
11
11
|
for (let r of e) if (!(!r || typeof r == "string")) {
|
|
@@ -36,9 +36,9 @@ var b = (b) => {
|
|
|
36
36
|
k.current = null, O(!1);
|
|
37
37
|
}, e);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
h.useEffect(() => () => {
|
|
40
40
|
P();
|
|
41
|
-
}, []),
|
|
41
|
+
}, []), h.useEffect(() => {
|
|
42
42
|
D && j(N(w));
|
|
43
43
|
}, [
|
|
44
44
|
D,
|
|
@@ -51,7 +51,7 @@ var b = (b) => {
|
|
|
51
51
|
"data-pihanga-trigger-wrapper": !0,
|
|
52
52
|
children: /* @__PURE__ */ v(e.Provider, {
|
|
53
53
|
value: D,
|
|
54
|
-
children: /* @__PURE__ */ v(
|
|
54
|
+
children: /* @__PURE__ */ v(g, {
|
|
55
55
|
cardName: x,
|
|
56
56
|
parentCard: T
|
|
57
57
|
})
|
|
@@ -62,7 +62,7 @@ var b = (b) => {
|
|
|
62
62
|
return S ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(o, { children: S }), /* @__PURE__ */ v(l, {})] }) : null;
|
|
63
63
|
}
|
|
64
64
|
function z(e) {
|
|
65
|
-
return typeof e == "string" ? e : /* @__PURE__ */ v(
|
|
65
|
+
return typeof e == "string" ? e : /* @__PURE__ */ v(g, {
|
|
66
66
|
cardName: e,
|
|
67
67
|
parentCard: T
|
|
68
68
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cn as e } from "../../lib/utils.js";
|
|
2
2
|
import { useFormContext as t } from "../form/form.context.js";
|
|
3
3
|
import { Field as n, FieldDescription as r, FieldError as i, FieldLabel as a } from "../../components/ui/field.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import o, { useMemo as s } from "react";
|
|
5
|
+
import { Card as c } from "@pihanga2/core";
|
|
6
6
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
//#region src/cards/field/field.component.tsx
|
|
8
8
|
var d = (d) => {
|
|
9
|
-
let { label: f, fieldCard: p, name: m, description: h, error: g, className: _, cardName: v } = d, y = t(), b = y.isInForm && m ? y.errors[m] : g, x =
|
|
9
|
+
let { label: f, fieldCard: p, name: m, description: h, error: g, className: _, cardName: v } = d, y = t(), b = y.isInForm && m ? y.errors[m] : g, x = o.useId(), S = !!b, C = s(() => ({
|
|
10
10
|
cardName: p,
|
|
11
11
|
parentCard: v,
|
|
12
12
|
id: x,
|
|
@@ -26,7 +26,7 @@ var d = (d) => {
|
|
|
26
26
|
htmlFor: x,
|
|
27
27
|
children: f
|
|
28
28
|
}),
|
|
29
|
-
/* @__PURE__ */ l(
|
|
29
|
+
/* @__PURE__ */ l(c, { ...C }),
|
|
30
30
|
h && /* @__PURE__ */ l(r, { children: h }),
|
|
31
31
|
/* @__PURE__ */ l(i, { children: b })
|
|
32
32
|
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DEF_FILE_DROP_FILE_TYPES as t } from "./fileDrop.types.js";
|
|
1
|
+
import { DEF_FILE_DROP_FILE_TYPES as e } from "./fileDrop.types.js";
|
|
3
2
|
/* empty css */
|
|
4
3
|
import "react";
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
import { FileUploader as r } from "react-drag-drop-files";
|
|
6
6
|
//#region src/cards/fileDrop/fileDrop.component.tsx
|
|
7
7
|
var i = Symbol.for("pihanga.card.FileDrop.LastDropped"), a = globalThis;
|
|
8
8
|
function o(e) {
|
|
@@ -16,7 +16,7 @@ function c() {
|
|
|
16
16
|
a[i] = null;
|
|
17
17
|
}
|
|
18
18
|
var l = (i) => {
|
|
19
|
-
let { fileTypes: a =
|
|
19
|
+
let { fileTypes: a = e, title: o = "Click or drop a file right here", description: l, showProgress: u = !1, progress: d = 0, progressStyle: f = {}, dropStyle: p = {}, onFileDropped: m, onError: h, cardName: g, className: _, _cls: v } = i;
|
|
20
20
|
function y(e) {
|
|
21
21
|
let t = Array.isArray(e) ? e[0] : e;
|
|
22
22
|
if (!t) return;
|
|
@@ -34,42 +34,42 @@ var l = (i) => {
|
|
|
34
34
|
h({ error: String(e) });
|
|
35
35
|
}
|
|
36
36
|
function x() {
|
|
37
|
-
let e = `${d}%`,
|
|
37
|
+
let e = `${d}%`, r = `${e} Complete`, i = {
|
|
38
38
|
width: "50%",
|
|
39
39
|
...f
|
|
40
40
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ n("div", {
|
|
42
42
|
className: "pi-progress",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ t("div", {
|
|
44
44
|
className: "pi-progress-label",
|
|
45
45
|
children: e
|
|
46
|
-
}), /* @__PURE__ */
|
|
46
|
+
}), /* @__PURE__ */ t("div", {
|
|
47
47
|
className: "pi-progress-container",
|
|
48
48
|
style: i,
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ t("div", {
|
|
50
50
|
className: "pi-progress-bar",
|
|
51
51
|
style: { width: e },
|
|
52
52
|
role: "progressbar",
|
|
53
|
-
"aria-label":
|
|
53
|
+
"aria-label": r
|
|
54
54
|
})
|
|
55
55
|
})]
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
function S() {
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ n("div", {
|
|
60
60
|
className: "dropzone-msg",
|
|
61
61
|
style: p,
|
|
62
|
-
children: [o && /* @__PURE__ */
|
|
62
|
+
children: [o && /* @__PURE__ */ t("h3", {
|
|
63
63
|
className: "dropzone-msg-title",
|
|
64
64
|
children: o
|
|
65
|
-
}), l && /* @__PURE__ */
|
|
65
|
+
}), l && /* @__PURE__ */ t("span", {
|
|
66
66
|
className: "dropzone-msg-desc",
|
|
67
67
|
children: l
|
|
68
68
|
})]
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
function C() {
|
|
72
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ t(r, {
|
|
73
73
|
handleChange: y,
|
|
74
74
|
onTypeError: b,
|
|
75
75
|
name: "file",
|
|
@@ -78,7 +78,7 @@ var l = (i) => {
|
|
|
78
78
|
children: S()
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ t("div", {
|
|
82
82
|
className: v("root", _),
|
|
83
83
|
"data-pihanga": g,
|
|
84
84
|
children: u ? x() : C()
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { cn as e } from "../../lib/utils.js";
|
|
2
2
|
import { FormContext as t } from "./form.context.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useCallback as n, useState as r } from "react";
|
|
4
|
+
import { Card as i } from "@pihanga2/core";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
6
|
//#region src/cards/form/form.component.tsx
|
|
7
7
|
var s = (s) => {
|
|
8
|
-
let { id: c, content: l = [], initialValues: u = {}, submitLabel: d = "Submit", className: f, cardName: p, onSubmitted: m } = s, [h, g] =
|
|
8
|
+
let { id: c, content: l = [], initialValues: u = {}, submitLabel: d = "Submit", className: f, cardName: p, onSubmitted: m } = s, [h, g] = r(() => ({ ...u })), [_, v] = r({}), y = n((e, t) => {
|
|
9
9
|
g((n) => ({
|
|
10
10
|
...n,
|
|
11
11
|
[e]: t
|
|
@@ -14,7 +14,7 @@ var s = (s) => {
|
|
|
14
14
|
let n = { ...t };
|
|
15
15
|
return delete n[e], n;
|
|
16
16
|
});
|
|
17
|
-
}, []), b =
|
|
17
|
+
}, []), b = n((e, t) => {
|
|
18
18
|
v((n) => {
|
|
19
19
|
if (t === null) {
|
|
20
20
|
let t = { ...n };
|
|
@@ -25,7 +25,7 @@ var s = (s) => {
|
|
|
25
25
|
[e]: t
|
|
26
26
|
};
|
|
27
27
|
});
|
|
28
|
-
}, []), x =
|
|
28
|
+
}, []), x = n((e) => {
|
|
29
29
|
e.preventDefault(), m({
|
|
30
30
|
id: c,
|
|
31
31
|
formData: h
|
|
@@ -47,7 +47,7 @@ var s = (s) => {
|
|
|
47
47
|
onSubmit: x,
|
|
48
48
|
className: e("flex flex-col gap-4", f),
|
|
49
49
|
"data-pihanga": p,
|
|
50
|
-
children: [l.map((e, t) => /* @__PURE__ */ a(
|
|
50
|
+
children: [l.map((e, t) => /* @__PURE__ */ a(i, {
|
|
51
51
|
cardName: e,
|
|
52
52
|
parentCard: p
|
|
53
53
|
}, t)), /* @__PURE__ */ a("button", {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TooltipProvider as e } from "../../components/ui/tooltip.js";
|
|
2
2
|
import { ThemeProvider as t } from "../../components/theme-provider/theme-provider.component.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { StrictMode as n } from "react";
|
|
4
|
+
import { Card as r } from "@pihanga2/core";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
6
|
//#region src/cards/framework/framework.component.tsx
|
|
7
7
|
var a = (a) => {
|
|
8
8
|
let { page: o, theme: s = "dark", cardName: c } = a;
|
|
9
|
-
return /* @__PURE__ */ i(
|
|
9
|
+
return /* @__PURE__ */ i(n, { children: /* @__PURE__ */ i(t, {
|
|
10
10
|
defaultTheme: s,
|
|
11
11
|
storageKey: "shadcn-ui-theme",
|
|
12
|
-
children: /* @__PURE__ */ i(e, { children: /* @__PURE__ */ i(
|
|
12
|
+
children: /* @__PURE__ */ i(e, { children: /* @__PURE__ */ i(r, {
|
|
13
13
|
cardName: o,
|
|
14
14
|
parentCard: c
|
|
15
15
|
}) })
|