@pihanga2/shadcn 0.2.17 → 0.2.19
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 +6 -1
- package/cards/button/button.types.d.ts +2 -2
- package/cards/checkbox/checkbox.types.d.ts +2 -2
- package/cards/codeMirror/codeMirror.types.d.ts +1 -1
- package/cards/collapsibleCard/collapsibleCard.types.d.ts +1 -1
- package/cards/dataTable/dataTable.types.d.ts +5 -5
- package/cards/dialog/dialog.types.d.ts +3 -3
- package/cards/drawer/drawer.types.d.ts +3 -3
- package/cards/dropDownMenu/drop-down.types.d.ts +1 -1
- package/cards/emptyCard/emptyCard.component.js +25 -0
- package/cards/emptyCard/emptyCard.component.js.map +1 -0
- package/cards/emptyCard/emptyCard.types.js +7 -0
- package/cards/emptyCard/emptyCard.types.js.map +1 -0
- package/cards/emptyCard/index.js +12 -0
- package/cards/emptyCard/index.js.map +1 -0
- package/cards/fileDrop/fileDrop.types.d.ts +2 -2
- package/cards/form/form.types.d.ts +2 -2
- package/cards/graphin/graphin.types.d.ts +9 -9
- package/cards/input/input.component.js +28 -23
- package/cards/input/input.component.js.map +1 -1
- package/cards/input/input.types.d.ts +10 -4
- package/cards/input/input.types.js.map +1 -1
- package/cards/jsonViewer/jsonViewer.types.d.ts +2 -2
- package/cards/keyboardOverlay/keyboardOverlay.component.js +1 -0
- package/cards/keyboardOverlay/keyboardOverlay.component.js.map +1 -1
- package/cards/keyboardOverlay/keyboardOverlay.types.d.ts +1 -1
- package/cards/list/list.types.d.ts +1 -1
- package/cards/menu/menu.types.d.ts +1 -1
- package/cards/modeToggle/mode-toggle.types.d.ts +1 -1
- package/cards/navbarSearch/navbarSearch.type.d.ts +3 -3
- package/cards/observable/index.d.ts +1 -0
- package/cards/observable/index.js +13 -0
- package/cards/observable/index.js.map +1 -0
- package/cards/observable/observable.component.d.ts +4 -0
- package/cards/observable/observable.component.js +74 -0
- package/cards/observable/observable.component.js.map +1 -0
- package/cards/observable/observable.types.d.ts +253 -0
- package/cards/observable/observable.types.js +21 -0
- package/cards/observable/observable.types.js.map +1 -0
- package/cards/pageWithNavbar/pageWithNavbar.type.d.ts +1 -1
- package/cards/pageWithNavbarMeta/pageWithNavbarMeta.types.d.ts +1 -1
- package/cards/pasteTarget/pasteTarget.types.d.ts +2 -2
- package/cards/resizableColumns/index.js +12 -0
- package/cards/resizableColumns/index.js.map +1 -0
- package/cards/resizableColumns/resizableColumns.component.js +105 -0
- package/cards/resizableColumns/resizableColumns.component.js.map +1 -0
- package/cards/resizableColumns/resizableColumns.css +1 -0
- package/cards/resizableColumns/resizableColumns.types.js +7 -0
- package/cards/resizableColumns/resizableColumns.types.js.map +1 -0
- package/cards/resizableGrid/index.js +12 -0
- package/cards/resizableGrid/index.js.map +1 -0
- package/cards/resizableGrid/resizableGrid.component.js +166 -0
- package/cards/resizableGrid/resizableGrid.component.js.map +1 -0
- package/cards/resizableGrid/resizableGrid.css +1 -0
- package/cards/resizableGrid/resizableGrid.types.js +7 -0
- package/cards/resizableGrid/resizableGrid.types.js.map +1 -0
- package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.types.d.ts +2 -2
- package/cards/select/select.types.d.ts +6 -6
- package/cards/sheetCard/sheetCard.types.d.ts +3 -3
- package/cards/slider/slider.types.d.ts +4 -4
- package/cards/stack/stack.component.js +51 -38
- package/cards/stack/stack.component.js.map +1 -1
- package/cards/stepper/stepper.types.d.ts +1 -1
- package/cards/switch/switch.types.d.ts +2 -2
- package/cards/tabs/tabs.types.d.ts +1 -1
- package/cards/textArea/index.d.ts +1 -0
- package/cards/textArea/index.js +13 -0
- package/cards/textArea/index.js.map +1 -0
- package/cards/textArea/textArea.component.d.ts +4 -0
- package/cards/textArea/textArea.component.js +83 -0
- package/cards/textArea/textArea.component.js.map +1 -0
- package/cards/textArea/textArea.types.d.ts +147 -0
- package/cards/textArea/textArea.types.js +7 -0
- package/cards/textArea/textArea.types.js.map +1 -0
- package/cards/textField/textField.types.d.ts +2 -2
- package/cards/toast/toast.types.d.ts +3 -3
- package/cards/toggleGroup/toggleGroup.types.d.ts +2 -2
- package/components/ui/empty.js +40 -0
- package/components/ui/empty.js.map +1 -0
- package/components/ui/input.js +11 -11
- package/components/ui/input.js.map +1 -1
- package/components/ui/textarea.js +15 -0
- package/components/ui/textarea.js.map +1 -0
- package/package.json +28 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResizableGridComponent as e } from "./resizableGrid.component.js";
|
|
2
|
+
import { RESIZABLE_GRID_CARD as t, ResizableGrid as n } from "./resizableGrid.types.js";
|
|
3
|
+
import { registerCardComponent as r } from "@pihanga2/core";
|
|
4
|
+
//#region src/cards/resizableGrid/index.ts
|
|
5
|
+
r({
|
|
6
|
+
name: t,
|
|
7
|
+
component: e
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as RESIZABLE_GRID_CARD, n as ResizableGrid };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/resizableGrid/index.ts"],"sourcesContent":["import {registerCardComponent} from \"@pihanga2/core\";\n\nimport {ResizableGridComponent} from \"./resizableGrid.component\";\nimport {RESIZABLE_GRID_CARD} from \"./resizableGrid.types\";\n\nexport * from \"./resizableGrid.types\";\n\nregisterCardComponent({\n name: RESIZABLE_GRID_CARD,\n component: ResizableGridComponent,\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;AACb,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import './resizableGrid.css';/* empty css */
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { Card as t } from "@pihanga2/core";
|
|
4
|
+
import n from "clsx";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/cards/resizableGrid/resizableGrid.component.tsx
|
|
7
|
+
var a = 10, o = 8;
|
|
8
|
+
function s(e) {
|
|
9
|
+
let t = e.trim();
|
|
10
|
+
return t === "auto" ? {
|
|
11
|
+
type: "auto",
|
|
12
|
+
value: 0
|
|
13
|
+
} : t.endsWith("px") ? {
|
|
14
|
+
type: "px",
|
|
15
|
+
value: Math.max(0, parseFloat(t))
|
|
16
|
+
} : t.endsWith("%") ? {
|
|
17
|
+
type: "pct",
|
|
18
|
+
value: Math.max(0, parseFloat(t))
|
|
19
|
+
} : t.endsWith("fr") ? {
|
|
20
|
+
type: "fr",
|
|
21
|
+
value: Math.max(0, parseFloat(t))
|
|
22
|
+
} : {
|
|
23
|
+
type: "fr",
|
|
24
|
+
value: 1
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function c(e, t, n) {
|
|
28
|
+
if (!e?.length || e.length !== t) return Array(t).fill(100 / t);
|
|
29
|
+
let r = e.map(s), i = n > 0 ? r.reduce((e, t) => e + (t.type === "px" ? t.value / n * 100 : 0), 0) : 0, a = r.reduce((e, t) => e + (t.type === "pct" ? t.value : 0), 0), o = Math.max(0, 100 - i - a), c = r.reduce((e, t) => e + (t.type === "fr" ? t.value : 0), 0), l = r.map((e) => e.type === "auto" ? 0 : e.type === "px" ? n > 0 ? e.value / n * 100 : 0 : e.type === "pct" ? e.value : c > 0 ? e.value / c * o : 0), u = l.reduce((e, t) => e + t, 0);
|
|
30
|
+
if (u <= 0) {
|
|
31
|
+
let e = r.filter((e) => e.type !== "auto").length || t;
|
|
32
|
+
return r.map((t) => t.type === "auto" ? 0 : 100 / e);
|
|
33
|
+
}
|
|
34
|
+
return l.map((e, t) => r[t].type === "auto" ? 0 : e / u * 100);
|
|
35
|
+
}
|
|
36
|
+
function l(e, t) {
|
|
37
|
+
return e.map((n, r) => {
|
|
38
|
+
let i = n === "auto" ? "auto" : `${t[r]}fr`;
|
|
39
|
+
return r < e.length - 1 && n !== "auto" && e[r + 1] !== "auto" ? `${i} ${o}px` : i;
|
|
40
|
+
}).join(" ");
|
|
41
|
+
}
|
|
42
|
+
function u(e) {
|
|
43
|
+
let t = 1;
|
|
44
|
+
return e.map((n, r) => {
|
|
45
|
+
let i = t;
|
|
46
|
+
return t++, r < e.length - 1 && n !== "auto" && e[r + 1] !== "auto" && t++, i;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function d(e, t, n) {
|
|
50
|
+
return n >= e.length - 1 || e[n] === "auto" || e[n + 1] === "auto" ? null : t[n] + 1;
|
|
51
|
+
}
|
|
52
|
+
var f = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
53
|
+
function p(e, t, n) {
|
|
54
|
+
return (r, i) => {
|
|
55
|
+
let a = e.current, o = a[r] + a[r + 1], s = f(i, Math.min(n, o - n), Math.max(n, o - n)), c = [...a];
|
|
56
|
+
c[r] = s, c[r + 1] = o - s, e.current = c, t(c);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var m = (o) => {
|
|
60
|
+
let { cardName: s, cells: f = [], columnWidths: m, rowHeights: h, minColumnPercent: g = a, minRowPercent: _ = a, className: v, dividerClassName: y } = o, b = f.length, x = f[0]?.length ?? 0, S = e.useMemo(() => m ?? Array(x).fill("1fr"), [m, x]), C = e.useMemo(() => h ?? Array(b).fill("1fr"), [h, b]), [w, T] = e.useState(() => c(S, x, 0)), [E, D] = e.useState(() => c(C, b, 0)), O = e.useRef(w), k = e.useRef(E), A = e.useRef(null), j = e.useRef(null), M = e.useRef(null);
|
|
61
|
+
e.useLayoutEffect(() => {
|
|
62
|
+
if (!A.current) return;
|
|
63
|
+
let { width: e, height: t } = A.current.getBoundingClientRect(), n = c(S, x, e), r = c(C, b, t);
|
|
64
|
+
O.current = n, k.current = r, T(n), D(r);
|
|
65
|
+
}, [
|
|
66
|
+
S,
|
|
67
|
+
C,
|
|
68
|
+
x,
|
|
69
|
+
b
|
|
70
|
+
]), e.useEffect(() => () => {
|
|
71
|
+
j.current?.(), M.current?.();
|
|
72
|
+
}, []);
|
|
73
|
+
let N = e.useMemo(() => p(O, T, g), [g]), P = e.useMemo(() => p(k, D, _), [_]), F = e.useCallback((e) => (t) => {
|
|
74
|
+
t.preventDefault();
|
|
75
|
+
let n = t.clientX, r = O.current[e], i = A.current;
|
|
76
|
+
if (!i) return;
|
|
77
|
+
let { width: a } = i.getBoundingClientRect();
|
|
78
|
+
if (a <= 0) return;
|
|
79
|
+
let o = (t) => N(e, r + (t.clientX - n) / a * 100), s = () => {
|
|
80
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s), j.current = null;
|
|
81
|
+
};
|
|
82
|
+
j.current?.(), window.addEventListener("mousemove", o), window.addEventListener("mouseup", s), j.current = () => {
|
|
83
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s);
|
|
84
|
+
};
|
|
85
|
+
}, [N]), I = e.useCallback((e) => (t) => {
|
|
86
|
+
let n = O.current[e], r = n + O.current[e + 1], i = t.shiftKey ? 10 : 2;
|
|
87
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), N(e, n - i)) : t.key === "ArrowRight" ? (t.preventDefault(), N(e, n + i)) : t.key === "Home" ? (t.preventDefault(), N(e, g)) : t.key === "End" && (t.preventDefault(), N(e, r - g));
|
|
88
|
+
}, [N, g]), L = e.useCallback((e) => (t) => {
|
|
89
|
+
t.preventDefault();
|
|
90
|
+
let n = t.clientY, r = k.current[e], i = A.current;
|
|
91
|
+
if (!i) return;
|
|
92
|
+
let { height: a } = i.getBoundingClientRect();
|
|
93
|
+
if (a <= 0) return;
|
|
94
|
+
let o = (t) => P(e, r + (t.clientY - n) / a * 100), s = () => {
|
|
95
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s), M.current = null;
|
|
96
|
+
};
|
|
97
|
+
M.current?.(), window.addEventListener("mousemove", o), window.addEventListener("mouseup", s), M.current = () => {
|
|
98
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s);
|
|
99
|
+
};
|
|
100
|
+
}, [P]), R = e.useCallback((e) => (t) => {
|
|
101
|
+
let n = k.current[e], r = n + k.current[e + 1], i = t.shiftKey ? 10 : 2;
|
|
102
|
+
t.key === "ArrowUp" ? (t.preventDefault(), P(e, n - i)) : t.key === "ArrowDown" ? (t.preventDefault(), P(e, n + i)) : t.key === "Home" ? (t.preventDefault(), P(e, _)) : t.key === "End" && (t.preventDefault(), P(e, r - _));
|
|
103
|
+
}, [P, _]);
|
|
104
|
+
if (b === 0 || x === 0) return null;
|
|
105
|
+
let z = l(S, w), B = l(C, E), V = u(S), H = u(C);
|
|
106
|
+
return /* @__PURE__ */ i("div", {
|
|
107
|
+
ref: A,
|
|
108
|
+
"data-pihanga": s,
|
|
109
|
+
className: n("pi-resizable-grid", v),
|
|
110
|
+
style: {
|
|
111
|
+
gridTemplateColumns: z,
|
|
112
|
+
gridTemplateRows: B
|
|
113
|
+
},
|
|
114
|
+
children: [
|
|
115
|
+
f.map((e, n) => e.map((e, i) => /* @__PURE__ */ r("div", {
|
|
116
|
+
className: "pi-resizable-grid-cell",
|
|
117
|
+
style: {
|
|
118
|
+
gridColumn: V[i],
|
|
119
|
+
gridRow: H[n]
|
|
120
|
+
},
|
|
121
|
+
children: /* @__PURE__ */ r(t, {
|
|
122
|
+
cardName: e,
|
|
123
|
+
parentCard: s
|
|
124
|
+
})
|
|
125
|
+
}, `c${n}-${i}`))),
|
|
126
|
+
S.map((e, t) => {
|
|
127
|
+
let i = d(S, V, t);
|
|
128
|
+
return i === null ? null : /* @__PURE__ */ r("div", {
|
|
129
|
+
className: n("pi-resizable-grid-col-divider", y),
|
|
130
|
+
style: {
|
|
131
|
+
gridColumn: i,
|
|
132
|
+
gridRow: "1 / -1"
|
|
133
|
+
},
|
|
134
|
+
onMouseDown: F(t),
|
|
135
|
+
onKeyDown: I(t),
|
|
136
|
+
role: "separator",
|
|
137
|
+
"aria-orientation": "vertical",
|
|
138
|
+
"aria-label": `Resize columns ${t + 1} and ${t + 2}`,
|
|
139
|
+
"aria-valuenow": Math.round(w[t]),
|
|
140
|
+
tabIndex: 0
|
|
141
|
+
}, `cd${t}`);
|
|
142
|
+
}),
|
|
143
|
+
C.map((e, t) => {
|
|
144
|
+
let i = d(C, H, t);
|
|
145
|
+
return i === null ? null : /* @__PURE__ */ r("div", {
|
|
146
|
+
className: n("pi-resizable-grid-row-divider", y),
|
|
147
|
+
style: {
|
|
148
|
+
gridRow: i,
|
|
149
|
+
gridColumn: "1 / -1"
|
|
150
|
+
},
|
|
151
|
+
onMouseDown: L(t),
|
|
152
|
+
onKeyDown: R(t),
|
|
153
|
+
role: "separator",
|
|
154
|
+
"aria-orientation": "horizontal",
|
|
155
|
+
"aria-label": `Resize rows ${t + 1} and ${t + 2}`,
|
|
156
|
+
"aria-valuenow": Math.round(E[t]),
|
|
157
|
+
tabIndex: 0
|
|
158
|
+
}, `rd${t}`);
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
export { m as ResizableGridComponent };
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=resizableGrid.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizableGrid.component.js","names":[],"sources":["../../../src/cards/resizableGrid/resizableGrid.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport clsx from \"clsx\";\n\nimport \"./resizableGrid.css\";\nimport type {ResizableGridProps} from \"./resizableGrid.types\";\n\nconst DEFAULT_MIN_PERCENT = 10;\nconst DIVIDER_PX = 8;\n\ntype ParsedUnit = {type: \"px\" | \"pct\" | \"fr\" | \"auto\"; value: number};\n\nfunction parseWidthSpec(w: string): ParsedUnit {\n const s = w.trim();\n if (s === \"auto\") return {type: \"auto\", value: 0};\n if (s.endsWith(\"px\")) return {type: \"px\", value: Math.max(0, parseFloat(s))};\n if (s.endsWith(\"%\")) return {type: \"pct\", value: Math.max(0, parseFloat(s))};\n if (s.endsWith(\"fr\")) return {type: \"fr\", value: Math.max(0, parseFloat(s))};\n return {type: \"fr\", value: 1};\n}\n\n/**\n * Convert CSS-like spec strings to an array of ratio values (summing to 100 for\n * explicit tracks; auto tracks get 0). The ratios are later rendered as `{v}fr`\n * units in the CSS grid template so the browser distributes available space\n * proportionally after fixed tracks (px, dividers) are allocated.\n */\nfunction parseSpecs(\n specs: string[] | undefined,\n count: number,\n containerPx: number,\n): number[] {\n if (!specs?.length || specs.length !== count) {\n return new Array(count).fill(100 / count);\n }\n\n const parsed = specs.map(parseWidthSpec);\n\n const totalPxAsPct =\n containerPx > 0\n ? parsed.reduce(\n (s, p) => s + (p.type === \"px\" ? (p.value / containerPx) * 100 : 0),\n 0,\n )\n : 0;\n const totalExplicitPct = parsed.reduce(\n (s, p) => s + (p.type === \"pct\" ? p.value : 0),\n 0,\n );\n const remainingPct = Math.max(0, 100 - totalPxAsPct - totalExplicitPct);\n const totalFr = parsed.reduce(\n (s, p) => s + (p.type === \"fr\" ? p.value : 0),\n 0,\n );\n\n const raw = parsed.map((p) => {\n if (p.type === \"auto\") return 0;\n if (p.type === \"px\")\n return containerPx > 0 ? (p.value / containerPx) * 100 : 0;\n if (p.type === \"pct\") return p.value;\n return totalFr > 0 ? (p.value / totalFr) * remainingPct : 0;\n });\n\n // Normalise so explicit entries sum to 100 (auto entries stay 0).\n const explicitTotal = raw.reduce((s, v) => s + v, 0);\n if (explicitTotal <= 0) {\n const n = parsed.filter((p) => p.type !== \"auto\").length || count;\n return parsed.map((p) => (p.type === \"auto\" ? 0 : 100 / n));\n }\n return raw.map((v, i) =>\n parsed[i].type === \"auto\" ? 0 : (v / explicitTotal) * 100,\n );\n}\n\n/** Build CSS grid-template-columns / grid-template-rows string. */\nfunction buildTemplate(specs: string[], ratios: number[]): string {\n return specs\n .map((spec, i) => {\n const cell = spec === \"auto\" ? \"auto\" : `${ratios[i]}fr`;\n const addDivider =\n i < specs.length - 1 && spec !== \"auto\" && specs[i + 1] !== \"auto\";\n return addDivider ? `${cell} ${DIVIDER_PX}px` : cell;\n })\n .join(\" \");\n}\n\n/** Compute 1-based CSS grid track index for each cell column/row. */\nfunction computeCellTrackIndices(specs: string[]): number[] {\n let track = 1;\n return specs.map((spec, i) => {\n const idx = track;\n track++;\n if (i < specs.length - 1 && spec !== \"auto\" && specs[i + 1] !== \"auto\") {\n track++; // skip divider track\n }\n return idx;\n });\n}\n\n/**\n * CSS track index of the divider between cell[i] and cell[i+1].\n * Returns null when no divider should be rendered.\n */\nfunction dividerTrack(\n specs: string[],\n cellTracks: number[],\n i: number,\n): number | null {\n if (i >= specs.length - 1) return null;\n if (specs[i] === \"auto\" || specs[i + 1] === \"auto\") return null;\n return cellTracks[i] + 1;\n}\n\nconst clamp = (v: number, lo: number, hi: number) =>\n Math.min(hi, Math.max(lo, v));\n\n/** Update a pair of adjacent explicit tracks, keeping their combined ratio constant. */\nfunction makePairUpdater(\n ref: React.MutableRefObject<number[]>,\n setter: React.Dispatch<React.SetStateAction<number[]>>,\n minPct: number,\n) {\n return (divIdx: number, nextLeading: number) => {\n const curr = ref.current;\n const combined = curr[divIdx] + curr[divIdx + 1];\n const lo = Math.min(minPct, combined - minPct);\n const hi = Math.max(minPct, combined - minPct);\n const clamped = clamp(nextLeading, lo, hi);\n const next = [...curr];\n next[divIdx] = clamped;\n next[divIdx + 1] = combined - clamped;\n ref.current = next;\n setter(next);\n };\n}\n\nexport const ResizableGridComponent = (\n props: PiCardProps<ResizableGridProps>,\n): React.ReactNode => {\n const {\n cardName,\n cells = [],\n columnWidths,\n rowHeights,\n minColumnPercent = DEFAULT_MIN_PERCENT,\n minRowPercent = DEFAULT_MIN_PERCENT,\n className,\n dividerClassName,\n } = props;\n\n const numRows = cells.length;\n const numCols = cells[0]?.length ?? 0;\n\n const colSpecs = React.useMemo(\n () => columnWidths ?? new Array(numCols).fill(\"1fr\"),\n [columnWidths, numCols],\n );\n const rowSpecs = React.useMemo(\n () => rowHeights ?? new Array(numRows).fill(\"1fr\"),\n [rowHeights, numRows],\n );\n\n // Initialise with equal ratios; useLayoutEffect recalculates with real px.\n const [colRatios, setColRatios] = React.useState(() =>\n parseSpecs(colSpecs, numCols, 0),\n );\n const [rowRatios, setRowRatios] = React.useState(() =>\n parseSpecs(rowSpecs, numRows, 0),\n );\n const colRatiosRef = React.useRef(colRatios);\n const rowRatiosRef = React.useRef(rowRatios);\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const colCleanupRef = React.useRef<(() => void) | null>(null);\n const rowCleanupRef = React.useRef<(() => void) | null>(null);\n\n // Re-parse after mount so px specs can be resolved against actual container size.\n React.useLayoutEffect(() => {\n if (!containerRef.current) return;\n const {width, height} = containerRef.current.getBoundingClientRect();\n const nextCol = parseSpecs(colSpecs, numCols, width);\n const nextRow = parseSpecs(rowSpecs, numRows, height);\n colRatiosRef.current = nextCol;\n rowRatiosRef.current = nextRow;\n setColRatios(nextCol);\n setRowRatios(nextRow);\n }, [colSpecs, rowSpecs, numCols, numRows]);\n\n React.useEffect(\n () => () => {\n colCleanupRef.current?.();\n rowCleanupRef.current?.();\n },\n [],\n );\n\n const updateColPair = React.useMemo(\n () => makePairUpdater(colRatiosRef, setColRatios, minColumnPercent),\n [minColumnPercent],\n );\n const updateRowPair = React.useMemo(\n () => makePairUpdater(rowRatiosRef, setRowRatios, minRowPercent),\n [minRowPercent],\n );\n\n const handleColMouseDown = React.useCallback(\n (divIdx: number) => (e: React.MouseEvent) => {\n e.preventDefault();\n const startX = e.clientX;\n const startLeading = colRatiosRef.current[divIdx];\n const container = containerRef.current;\n if (!container) return;\n const {width} = container.getBoundingClientRect();\n if (width <= 0) return;\n const onMove = (ev: MouseEvent) =>\n updateColPair(\n divIdx,\n startLeading + ((ev.clientX - startX) / width) * 100,\n );\n const onUp = () => {\n window.removeEventListener(\"mousemove\", onMove);\n window.removeEventListener(\"mouseup\", onUp);\n colCleanupRef.current = null;\n };\n colCleanupRef.current?.();\n window.addEventListener(\"mousemove\", onMove);\n window.addEventListener(\"mouseup\", onUp);\n colCleanupRef.current = () => {\n window.removeEventListener(\"mousemove\", onMove);\n window.removeEventListener(\"mouseup\", onUp);\n };\n },\n [updateColPair],\n );\n\n const handleColKeyDown = React.useCallback(\n (divIdx: number) => (e: React.KeyboardEvent) => {\n const curr = colRatiosRef.current[divIdx];\n const combined = curr + colRatiosRef.current[divIdx + 1];\n const step = e.shiftKey ? 10 : 2;\n if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n updateColPair(divIdx, curr - step);\n } else if (e.key === \"ArrowRight\") {\n e.preventDefault();\n updateColPair(divIdx, curr + step);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n updateColPair(divIdx, minColumnPercent);\n } else if (e.key === \"End\") {\n e.preventDefault();\n updateColPair(divIdx, combined - minColumnPercent);\n }\n },\n [updateColPair, minColumnPercent],\n );\n\n const handleRowMouseDown = React.useCallback(\n (divIdx: number) => (e: React.MouseEvent) => {\n e.preventDefault();\n const startY = e.clientY;\n const startLeading = rowRatiosRef.current[divIdx];\n const container = containerRef.current;\n if (!container) return;\n const {height} = container.getBoundingClientRect();\n if (height <= 0) return;\n const onMove = (ev: MouseEvent) =>\n updateRowPair(\n divIdx,\n startLeading + ((ev.clientY - startY) / height) * 100,\n );\n const onUp = () => {\n window.removeEventListener(\"mousemove\", onMove);\n window.removeEventListener(\"mouseup\", onUp);\n rowCleanupRef.current = null;\n };\n rowCleanupRef.current?.();\n window.addEventListener(\"mousemove\", onMove);\n window.addEventListener(\"mouseup\", onUp);\n rowCleanupRef.current = () => {\n window.removeEventListener(\"mousemove\", onMove);\n window.removeEventListener(\"mouseup\", onUp);\n };\n },\n [updateRowPair],\n );\n\n const handleRowKeyDown = React.useCallback(\n (divIdx: number) => (e: React.KeyboardEvent) => {\n const curr = rowRatiosRef.current[divIdx];\n const combined = curr + rowRatiosRef.current[divIdx + 1];\n const step = e.shiftKey ? 10 : 2;\n if (e.key === \"ArrowUp\") {\n e.preventDefault();\n updateRowPair(divIdx, curr - step);\n } else if (e.key === \"ArrowDown\") {\n e.preventDefault();\n updateRowPair(divIdx, curr + step);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n updateRowPair(divIdx, minRowPercent);\n } else if (e.key === \"End\") {\n e.preventDefault();\n updateRowPair(divIdx, combined - minRowPercent);\n }\n },\n [updateRowPair, minRowPercent],\n );\n\n if (numRows === 0 || numCols === 0) return null;\n\n const colTemplate = buildTemplate(colSpecs, colRatios);\n const rowTemplate = buildTemplate(rowSpecs, rowRatios);\n const colTracks = computeCellTrackIndices(colSpecs);\n const rowTracks = computeCellTrackIndices(rowSpecs);\n\n return (\n <div\n ref={containerRef}\n data-pihanga={cardName}\n className={clsx(\"pi-resizable-grid\", className)}\n style={\n {\n gridTemplateColumns: colTemplate,\n gridTemplateRows: rowTemplate,\n } as React.CSSProperties\n }\n >\n {/* Grid cells */}\n {cells.map((row, ri) =>\n row.map((card, ci) => (\n <div\n key={`c${ri}-${ci}`}\n className=\"pi-resizable-grid-cell\"\n style={{gridColumn: colTracks[ci], gridRow: rowTracks[ri]}}\n >\n <Card cardName={card} parentCard={cardName} />\n </div>\n )),\n )}\n\n {/* Vertical column dividers — each spans all row tracks */}\n {colSpecs.map((_, ci) => {\n const track = dividerTrack(colSpecs, colTracks, ci);\n if (track === null) return null;\n return (\n <div\n key={`cd${ci}`}\n className={clsx(\"pi-resizable-grid-col-divider\", dividerClassName)}\n style={{gridColumn: track, gridRow: \"1 / -1\"}}\n onMouseDown={handleColMouseDown(ci)}\n onKeyDown={handleColKeyDown(ci)}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={`Resize columns ${ci + 1} and ${ci + 2}`}\n aria-valuenow={Math.round(colRatios[ci])}\n tabIndex={0}\n />\n );\n })}\n\n {/* Horizontal row dividers — each spans all column tracks */}\n {rowSpecs.map((_, ri) => {\n const track = dividerTrack(rowSpecs, rowTracks, ri);\n if (track === null) return null;\n return (\n <div\n key={`rd${ri}`}\n className={clsx(\"pi-resizable-grid-row-divider\", dividerClassName)}\n style={{gridRow: track, gridColumn: \"1 / -1\"}}\n onMouseDown={handleRowMouseDown(ri)}\n onKeyDown={handleRowKeyDown(ri)}\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label={`Resize rows ${ri + 1} and ${ri + 2}`}\n aria-valuenow={Math.round(rowRatios[ri])}\n tabIndex={0}\n />\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;AAOA,IAAM,IAAsB,IACtB,IAAa;AAInB,SAAS,EAAe,GAAuB;CAC7C,IAAM,IAAI,EAAE,KAAK;CAKjB,OAJI,MAAM,SAAe;EAAC,MAAM;EAAQ,OAAO;CAAC,IAC5C,EAAE,SAAS,IAAI,IAAU;EAAC,MAAM;EAAM,OAAO,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;CAAC,IACvE,EAAE,SAAS,GAAG,IAAU;EAAC,MAAM;EAAO,OAAO,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;CAAC,IACvE,EAAE,SAAS,IAAI,IAAU;EAAC,MAAM;EAAM,OAAO,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;CAAC,IACpE;EAAC,MAAM;EAAM,OAAO;CAAC;AAC9B;AAQA,SAAS,EACP,GACA,GACA,GACU;CACV,IAAI,CAAC,GAAO,UAAU,EAAM,WAAW,GACrC,OAAW,MAAM,CAAK,EAAE,KAAK,MAAM,CAAK;CAG1C,IAAM,IAAS,EAAM,IAAI,CAAc,GAEjC,IACJ,IAAc,IACV,EAAO,QACJ,GAAG,MAAM,KAAK,EAAE,SAAS,OAAQ,EAAE,QAAQ,IAAe,MAAM,IACjE,CACF,IACA,GACA,IAAmB,EAAO,QAC7B,GAAG,MAAM,KAAK,EAAE,SAAS,QAAQ,EAAE,QAAQ,IAC5C,CACF,GACM,IAAe,KAAK,IAAI,GAAG,MAAM,IAAe,CAAgB,GAChE,IAAU,EAAO,QACpB,GAAG,MAAM,KAAK,EAAE,SAAS,OAAO,EAAE,QAAQ,IAC3C,CACF,GAEM,IAAM,EAAO,KAAK,MAClB,EAAE,SA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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pi-resizable-grid{width:100%;height:100%;display:grid}.pi-resizable-grid-cell{min-width:0;min-height:0;overflow:hidden}.pi-resizable-grid-col-divider{cursor:col-resize;z-index:1;min-height:0;position:relative}.pi-resizable-grid-col-divider:before{content:"";width:var(--rg-divider-width,1px);background-color:var(--rg-divider-color,var(--border));transition:width .12s,background-color .12s;position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%)}.pi-resizable-grid-col-divider:hover:before,.pi-resizable-grid-col-divider:focus-visible:before{width:var(--rg-divider-hover-width,4px);background-color:var(--rg-divider-hover-color,var(--muted-foreground))}.pi-resizable-grid-row-divider{cursor:row-resize;z-index:1;min-width:0;position:relative}.pi-resizable-grid-row-divider:before{content:"";height:var(--rg-divider-width,1px);background-color:var(--rg-divider-color,var(--border));transition:height .12s,background-color .12s;position:absolute;top:50%;left:0;right:0;transform:translateY(-50%)}.pi-resizable-grid-row-divider:hover:before,.pi-resizable-grid-row-divider:focus-visible:before{height:var(--rg-divider-hover-width,4px);background-color:var(--rg-divider-hover-color,var(--muted-foreground))}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createCardDeclaration as e } from "@pihanga2/core";
|
|
2
|
+
//#region src/cards/resizableGrid/resizableGrid.types.ts
|
|
3
|
+
var t = "pi/resizable-grid", n = e(t);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t as RESIZABLE_GRID_CARD, n as ResizableGrid };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=resizableGrid.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizableGrid.types.js","names":[],"sources":["../../../src/cards/resizableGrid/resizableGrid.types.ts"],"sourcesContent":["import {createCardDeclaration, type PiCardRef} from \"@pihanga2/core\";\n\nexport const RESIZABLE_GRID_CARD = \"pi/resizable-grid\";\n\nexport type ResizableGridProps = {\n /**\n * 2D array of cards — cells[row][col]. Must be rectangular (all rows same length).\n */\n cells: PiCardRef[][];\n /**\n * Initial column widths using CSS-like values:\n * - '200px' — fixed initial width (resolved against container width at mount)\n * - '30%' — explicit percentage of container\n * - '1fr' — fraction of remaining space after px/% columns\n * - 'auto' — natural content width; no drag handle rendered for adjacent boundaries\n *\n * Defaults to equal `1fr` split when omitted.\n */\n columnWidths?: string[];\n /**\n * Initial row heights using the same syntax as columnWidths.\n * 'auto' rows follow content height (max across all cells in that row).\n * No drag handle is rendered between two rows unless both are explicit (non-auto).\n *\n * Defaults to equal `1fr` split when omitted.\n */\n rowHeights?: string[];\n /** Minimum percentage any explicit column can shrink to during drag. Default: 10 */\n minColumnPercent?: number;\n /** Minimum percentage any explicit row can shrink to during drag. Default: 10 */\n minRowPercent?: number;\n className?: string;\n dividerClassName?: string;\n};\n\nexport const ResizableGrid =\n createCardDeclaration<ResizableGridProps>(RESIZABLE_GRID_CARD);\n"],"mappings":";;AAEA,IAAa,IAAsB,qBAiCtB,IACX,EAA0C,CAAmB"}
|
|
@@ -5,10 +5,10 @@ export declare const SCROLLBAR_WITH_ANNOTATIONS_ACTION: {
|
|
|
5
5
|
ANNOTATION_CLICKED: string;
|
|
6
6
|
ANNOTATION_HOVERED: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const onScrollbarAnnotationClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
8
|
+
export declare const onScrollbarAnnotationClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
9
9
|
cardID: string;
|
|
10
10
|
} & AnnotationClickedEvent>) => void;
|
|
11
|
-
export declare const onScrollbarAnnotationHovered: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
11
|
+
export declare const onScrollbarAnnotationHovered: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
12
12
|
cardID: string;
|
|
13
13
|
} & AnnotationHoveredEvent>) => void;
|
|
14
14
|
/**
|
|
@@ -5,25 +5,25 @@ export declare const PI_SELECT_ACTION: {
|
|
|
5
5
|
CLOSED: string;
|
|
6
6
|
OPENED: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const onSelectChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
8
|
+
export declare const onSelectChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
9
9
|
cardID: string;
|
|
10
10
|
} & PiSelectChangedEvent>) => void;
|
|
11
11
|
/** @deprecated Use `onSelectChanged` instead. */
|
|
12
|
-
export declare const onPiSelectChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
12
|
+
export declare const onPiSelectChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
13
13
|
cardID: string;
|
|
14
14
|
} & PiSelectChangedEvent>) => void;
|
|
15
|
-
export declare const onSelectOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
15
|
+
export declare const onSelectOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
16
16
|
cardID: string;
|
|
17
17
|
} & PiSelectOpenedEvent>) => void;
|
|
18
18
|
/** @deprecated Use `onSelectOpened` instead. */
|
|
19
|
-
export declare const onPiSelectOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
19
|
+
export declare const onPiSelectOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
20
20
|
cardID: string;
|
|
21
21
|
} & PiSelectOpenedEvent>) => void;
|
|
22
|
-
export declare const onSelectClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
22
|
+
export declare const onSelectClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
23
23
|
cardID: string;
|
|
24
24
|
} & PiSelectClosedEvent>) => void;
|
|
25
25
|
/** @deprecated Use `onSelectClosed` instead. */
|
|
26
|
-
export declare const onPiSelectClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
26
|
+
export declare const onPiSelectClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
27
27
|
cardID: string;
|
|
28
28
|
} & PiSelectClosedEvent>) => void;
|
|
29
29
|
export type PiSelectOption = {
|
|
@@ -6,13 +6,13 @@ export declare const PI_SHEET_ACTION: {
|
|
|
6
6
|
OPENED: string;
|
|
7
7
|
OPEN_CHANGED: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const onSheetOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
9
|
+
export declare const onSheetOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
10
10
|
cardID: string;
|
|
11
11
|
} & SheetOpenedEvent>) => void;
|
|
12
|
-
export declare const onSheetClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
12
|
+
export declare const onSheetClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
13
13
|
cardID: string;
|
|
14
14
|
} & SheetClosedEvent>) => void;
|
|
15
|
-
export declare const onSheetOpenChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
15
|
+
export declare const onSheetOpenChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
16
16
|
cardID: string;
|
|
17
17
|
} & SheetOpenChangedEvent>) => void;
|
|
18
18
|
export type PiSheetProps = {
|
|
@@ -4,11 +4,11 @@ export declare const PI_SLIDER_ACTION: {
|
|
|
4
4
|
CHANGED: string;
|
|
5
5
|
COMMITTED: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const onSliderChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
7
|
+
export declare const onSliderChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
8
8
|
cardID: string;
|
|
9
9
|
} & PiSliderChangedEvent>) => void;
|
|
10
10
|
/** @deprecated Use `onSliderChanged` instead. */
|
|
11
|
-
export declare const onPiSliderChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
11
|
+
export declare const onPiSliderChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
12
12
|
cardID: string;
|
|
13
13
|
} & PiSliderChangedEvent>) => void;
|
|
14
14
|
/**
|
|
@@ -17,11 +17,11 @@ export declare const onPiSliderChanged: <S extends import('@pihanga2/core').Redu
|
|
|
17
17
|
* Use this instead of `onSliderChanged` when you only care about the final
|
|
18
18
|
* settled value and do not want to process every intermediate drag position.
|
|
19
19
|
*/
|
|
20
|
-
export declare const onSliderCommitted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
20
|
+
export declare const onSliderCommitted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
21
21
|
cardID: string;
|
|
22
22
|
} & PiSliderCommittedEvent>) => void;
|
|
23
23
|
/** @deprecated Use `onSliderCommitted` instead. */
|
|
24
|
-
export declare const onPiSliderCommitted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
24
|
+
export declare const onPiSliderCommitted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
25
25
|
cardID: string;
|
|
26
26
|
} & PiSliderCommittedEvent>) => void;
|
|
27
27
|
export type PiSliderProps = {
|
|
@@ -3,83 +3,96 @@ import { Card as t } from "@pihanga2/core";
|
|
|
3
3
|
import n from "clsx";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/cards/stack/stack.component.tsx
|
|
6
|
-
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function a(e) {
|
|
7
|
+
let t = 2166136261;
|
|
8
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
9
|
+
return (t >>> 0).toString(36);
|
|
10
|
+
}
|
|
11
|
+
function o(e, t) {
|
|
12
|
+
if (typeof e == "string") return e;
|
|
13
|
+
let n = Object.keys(e).sort();
|
|
14
|
+
return `${a(JSON.stringify(e, n))}-${t}`;
|
|
15
|
+
}
|
|
16
|
+
var s = (a) => {
|
|
17
|
+
let { content: s, direction: c, divider: l, spacing: u, justifyContent: d, alignItems: f, className: p, style: m, cardName: h, data: g } = a, _ = [
|
|
18
|
+
p,
|
|
19
|
+
(m ?? {}).root,
|
|
10
20
|
"flex"
|
|
11
21
|
];
|
|
12
|
-
if (
|
|
22
|
+
if (c) switch (c) {
|
|
13
23
|
case "row":
|
|
14
|
-
|
|
24
|
+
_.push("flex-row");
|
|
15
25
|
break;
|
|
16
26
|
case "row-reverse":
|
|
17
|
-
|
|
27
|
+
_.push("flex-row-reverse");
|
|
18
28
|
break;
|
|
19
29
|
case "column":
|
|
20
|
-
|
|
30
|
+
_.push("flex-col");
|
|
21
31
|
break;
|
|
22
32
|
case "column-reverse":
|
|
23
|
-
|
|
33
|
+
_.push("flex-col-reverse");
|
|
24
34
|
break;
|
|
25
35
|
}
|
|
26
|
-
if (
|
|
36
|
+
if (d) switch (d) {
|
|
27
37
|
case "flex-start":
|
|
28
|
-
|
|
38
|
+
_.push("justify-start");
|
|
29
39
|
break;
|
|
30
40
|
case "center":
|
|
31
|
-
|
|
41
|
+
_.push("justify-center");
|
|
32
42
|
break;
|
|
33
43
|
case "flex-end":
|
|
34
|
-
|
|
44
|
+
_.push("justify-end");
|
|
35
45
|
break;
|
|
36
46
|
case "space-between":
|
|
37
|
-
|
|
47
|
+
_.push("justify-between");
|
|
38
48
|
break;
|
|
39
49
|
case "space-around":
|
|
40
|
-
|
|
50
|
+
_.push("justify-around");
|
|
41
51
|
break;
|
|
42
52
|
case "space-evenly":
|
|
43
|
-
|
|
53
|
+
_.push("justify-evenly");
|
|
44
54
|
break;
|
|
45
55
|
}
|
|
46
|
-
if (
|
|
56
|
+
if (f) switch (f) {
|
|
47
57
|
case "flex-start":
|
|
48
|
-
|
|
58
|
+
_.push("items-start");
|
|
49
59
|
break;
|
|
50
60
|
case "center":
|
|
51
|
-
|
|
61
|
+
_.push("items-center");
|
|
52
62
|
break;
|
|
53
63
|
case "stretch":
|
|
54
|
-
|
|
64
|
+
_.push("items-stretch");
|
|
55
65
|
break;
|
|
56
66
|
case "flex-end":
|
|
57
|
-
|
|
67
|
+
_.push("items-end");
|
|
58
68
|
break;
|
|
59
69
|
case "baseline":
|
|
60
|
-
|
|
70
|
+
_.push("items-baseline");
|
|
61
71
|
break;
|
|
62
|
-
default: console.warn("stack: unsupported 'alignItems' property",
|
|
72
|
+
default: console.warn("stack: unsupported 'alignItems' property", f);
|
|
63
73
|
}
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
u && u > 0 && _.push(`gap-${u}`);
|
|
75
|
+
function v() {
|
|
76
|
+
return s ? s.map((n, a) => {
|
|
77
|
+
let c = o(n, a);
|
|
78
|
+
return /* @__PURE__ */ i(e, { children: [/* @__PURE__ */ r(t, {
|
|
79
|
+
cardName: n,
|
|
80
|
+
parentCard: h
|
|
81
|
+
}, `item-${c}`), l && a < s.length - 1 && /* @__PURE__ */ r(t, {
|
|
82
|
+
cardName: l,
|
|
83
|
+
parentCard: h
|
|
84
|
+
}, `divider-${c}`)] }, c);
|
|
85
|
+
}) : null;
|
|
73
86
|
}
|
|
74
|
-
let
|
|
87
|
+
let y = g ? Object.fromEntries(Object.entries(g).map(([e, t]) => [`data-${e}`, t])) : {};
|
|
75
88
|
return /* @__PURE__ */ i("div", {
|
|
76
|
-
className: n(
|
|
77
|
-
"data-pihanga":
|
|
78
|
-
...
|
|
79
|
-
children: [
|
|
89
|
+
className: n(_),
|
|
90
|
+
"data-pihanga": h,
|
|
91
|
+
...y,
|
|
92
|
+
children: [v(), a.children]
|
|
80
93
|
});
|
|
81
94
|
};
|
|
82
95
|
//#endregion
|
|
83
|
-
export {
|
|
96
|
+
export { s as Component };
|
|
84
97
|
|
|
85
98
|
//# sourceMappingURL=stack.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.component.js","names":[],"sources":["../../../src/cards/stack/stack.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type {StackProps} from \"./stack.types\";\n\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport clsx from \"clsx\";\nimport {Fragment} from \"react\";\n\nexport type SelectSD = {\n root?: string;\n};\n\nexport const Component = (props: PiCardProps<StackProps>): React.ReactNode => {\n const {\n content,\n direction,\n divider,\n spacing,\n justifyContent,\n alignItems,\n className,\n style,\n cardName,\n data,\n } = props;\n const sd: SelectSD = (style as SelectSD | undefined) ?? {};\n\n const cn = [className, sd.root, \"flex\"];\n if (direction) {\n switch (direction) {\n // \"column-reverse\" | \"column\" | \"row-reverse\" | \"row\"\n case \"row\":\n cn.push(\"flex-row\");\n break;\n case \"row-reverse\":\n cn.push(\"flex-row-reverse\");\n break;\n case \"column\":\n cn.push(\"flex-col\");\n break;\n case \"column-reverse\":\n cn.push(\"flex-col-reverse\");\n break;\n }\n }\n if (justifyContent) {\n switch (justifyContent) {\n // \"flex-start\" | \"center\" | \"flex-end\" | \"space-between\" | \"space-around\" | \"space-evenly\"\n case \"flex-start\":\n cn.push(\"justify-start\");\n break;\n case \"center\":\n cn.push(\"justify-center\");\n break;\n case \"flex-end\":\n cn.push(\"justify-end\");\n break;\n case \"space-between\":\n cn.push(\"justify-between\");\n break;\n case \"space-around\":\n cn.push(\"justify-around\");\n break;\n case \"space-evenly\":\n cn.push(\"justify-evenly\");\n break;\n }\n }\n if (alignItems) {\n switch (alignItems) {\n // \"flex-start\" | \"center\" | \"flex-end\" | \"normal\" | \"stretch\" | \"start\" | \"end\" | \"baseline\" | \"initial\" | \"inherit\"\n case \"flex-start\":\n cn.push(\"items-start\");\n break;\n case \"center\":\n cn.push(\"items-center\");\n break;\n case \"stretch\":\n cn.push(\"items-stretch\");\n break;\n case \"flex-end\":\n cn.push(\"items-end\");\n break;\n case \"baseline\":\n cn.push(\"items-baseline\");\n break;\n default:\n console.warn(\"stack: unsupported 'alignItems' property\", alignItems);\n }\n }\n if (spacing && spacing > 0) {\n if (\n direction === undefined ||\n direction === \"row\" ||\n direction === \"row-reverse\"\n ) {\n cn.push(`gap-${spacing}`);\n } else {\n cn.push(`gap-${spacing}`);\n }\n }\n\n function renderContent() {\n if (!content) return null;\n\n return content.map((cn, i) => (\n
|
|
1
|
+
{"version":3,"file":"stack.component.js","names":[],"sources":["../../../src/cards/stack/stack.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type {StackProps} from \"./stack.types\";\n\nimport {Card, type PiCardProps, type PiCardRef} from \"@pihanga2/core\";\nimport clsx from \"clsx\";\nimport {Fragment} from \"react\";\n\nexport type SelectSD = {\n root?: string;\n};\n\n/**\n * Cheap, non-cryptographic FNV-1a hash — good enough to turn an arbitrary\n * string into a short, stable identifier for use as a React key.\n */\nfunction fnv1aHash(str: string): string {\n let hash = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash = Math.imul(hash, 0x01000193);\n }\n return (hash >>> 0).toString(36);\n}\n\n/**\n * Derive a stable React key for a `PiCardRef`.\n *\n * - Strings (card names) are already unique — used as-is.\n * - Inline `PiCardDef` objects have no identity of their own, and two\n * structurally-identical defs created on different renders are different\n * object references. We hash the (key-sorted) JSON content so that\n * identical content maps to the same key — preserving React's\n * reconciliation identity across re-renders/reorders — while still\n * appending `i` so a hash collision (or two genuinely different defs\n * that hash the same) can never produce a duplicate key within the list.\n */\nfunction cardRefKey(cn: PiCardRef, i: number): string {\n if (typeof cn === \"string\") return cn;\n const sortedKeys = Object.keys(cn).sort();\n const json = JSON.stringify(cn, sortedKeys);\n return `${fnv1aHash(json)}-${i}`;\n}\n\nexport const Component = (props: PiCardProps<StackProps>): React.ReactNode => {\n const {\n content,\n direction,\n divider,\n spacing,\n justifyContent,\n alignItems,\n className,\n style,\n cardName,\n data,\n } = props;\n const sd: SelectSD = (style as SelectSD | undefined) ?? {};\n\n const cn = [className, sd.root, \"flex\"];\n if (direction) {\n switch (direction) {\n // \"column-reverse\" | \"column\" | \"row-reverse\" | \"row\"\n case \"row\":\n cn.push(\"flex-row\");\n break;\n case \"row-reverse\":\n cn.push(\"flex-row-reverse\");\n break;\n case \"column\":\n cn.push(\"flex-col\");\n break;\n case \"column-reverse\":\n cn.push(\"flex-col-reverse\");\n break;\n }\n }\n if (justifyContent) {\n switch (justifyContent) {\n // \"flex-start\" | \"center\" | \"flex-end\" | \"space-between\" | \"space-around\" | \"space-evenly\"\n case \"flex-start\":\n cn.push(\"justify-start\");\n break;\n case \"center\":\n cn.push(\"justify-center\");\n break;\n case \"flex-end\":\n cn.push(\"justify-end\");\n break;\n case \"space-between\":\n cn.push(\"justify-between\");\n break;\n case \"space-around\":\n cn.push(\"justify-around\");\n break;\n case \"space-evenly\":\n cn.push(\"justify-evenly\");\n break;\n }\n }\n if (alignItems) {\n switch (alignItems) {\n // \"flex-start\" | \"center\" | \"flex-end\" | \"normal\" | \"stretch\" | \"start\" | \"end\" | \"baseline\" | \"initial\" | \"inherit\"\n case \"flex-start\":\n cn.push(\"items-start\");\n break;\n case \"center\":\n cn.push(\"items-center\");\n break;\n case \"stretch\":\n cn.push(\"items-stretch\");\n break;\n case \"flex-end\":\n cn.push(\"items-end\");\n break;\n case \"baseline\":\n cn.push(\"items-baseline\");\n break;\n default:\n console.warn(\"stack: unsupported 'alignItems' property\", alignItems);\n }\n }\n if (spacing && spacing > 0) {\n if (\n direction === undefined ||\n direction === \"row\" ||\n direction === \"row-reverse\"\n ) {\n cn.push(`gap-${spacing}`);\n } else {\n cn.push(`gap-${spacing}`);\n }\n }\n\n function renderContent() {\n if (!content) return null;\n\n return content.map((cn, i) => {\n const key = cardRefKey(cn, i);\n return (\n <Fragment key={key}>\n <Card cardName={cn} parentCard={cardName} key={`item-${key}`} />\n {divider && i < content.length - 1 && (\n <Card\n cardName={divider}\n parentCard={cardName}\n key={`divider-${key}`}\n />\n )}\n </Fragment>\n );\n });\n }\n\n const dataAttrs = data\n ? Object.fromEntries(Object.entries(data).map(([k, v]) => [`data-${k}`, v]))\n : {};\n\n return (\n <div className={clsx(cn)} data-pihanga={cardName} {...dataAttrs}>\n {renderContent()}\n {props.children}\n </div>\n );\n};\n"],"mappings":";;;;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KAAK;GACH,EAAG,KAAK,gBAAgB;GACxB;EACF,SACE,QAAQ,KAAK,4CAA4C,CAAU;CACvE;CAEF,AAAI,KAAW,IAAU,KAMrB,EAAG,KAAK,OAAO,GAAS;CAM5B,SAAS,IAAgB;EAGvB,OAFK,IAEE,EAAQ,KAAK,GAAI,MAAM;GAC5B,IAAM,IAAM,EAAW,GAAI,CAAC;GAC5B,OACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;IAAM,UAAU;IAAI,YAAY;GAA+B,GAAhB,QAAQ,GAAQ,GAC9D,KAAW,IAAI,EAAQ,SAAS,KAC/B,kBAAC,GAAD;IACE,UAAU;IACV,YAAY;GAEb,GADM,WAAW,GACjB,CAEK,EAAA,GATK,CASL;EAEd,CAAC,IAhBoB;CAiBvB;CAEA,IAAM,IAAY,IACd,OAAO,YAAY,OAAO,QAAQ,CAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,IACzE,CAAC;CAEL,OACE,kBAAC,OAAD;EAAK,WAAW,EAAK,CAAE;EAAG,gBAAc;EAAU,GAAI;YAAtD,CACG,EAAc,GACd,EAAM,QACJ;;AAET"}
|
|
@@ -4,7 +4,7 @@ export declare const Stepper: <S extends import('@pihanga2/core').ReduxState>(p:
|
|
|
4
4
|
export declare const STEPPER_ACTION: {
|
|
5
5
|
STEPCLICKED: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const onStepperStepClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
7
|
+
export declare const onStepperStepClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
8
8
|
cardID: string;
|
|
9
9
|
} & StepperStepClickedEvent>) => void;
|
|
10
10
|
/**
|
|
@@ -3,11 +3,11 @@ export declare const Switch: <S extends import('@pihanga2/core').ReduxState>(p:
|
|
|
3
3
|
export declare const PI_SWITCH_ACTION: {
|
|
4
4
|
CHANGED: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const onSwitchChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
6
|
+
export declare const onSwitchChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
7
7
|
cardID: string;
|
|
8
8
|
} & PiSwitchChangedEvent>) => void;
|
|
9
9
|
/** @deprecated Use `onSwitchChanged` instead. */
|
|
10
|
-
export declare const onPiSwitchChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
10
|
+
export declare const onPiSwitchChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
11
11
|
cardID: string;
|
|
12
12
|
} & PiSwitchChangedEvent>) => void;
|
|
13
13
|
export type PiSwitchProps = {
|
|
@@ -6,7 +6,7 @@ export declare const SdTabs: <S extends import('@pihanga2/core').ReduxState>(p:
|
|
|
6
6
|
export declare const TABS_ACTION: {
|
|
7
7
|
TABCHANGED: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const onTabsTabChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').
|
|
9
|
+
export declare const onTabsTabChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
10
10
|
cardID: string;
|
|
11
11
|
} & TabsTabChangedEvent>) => void;
|
|
12
12
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './textArea.types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextAreaComponent as e } from "./textArea.component.js";
|
|
2
|
+
import { PI_TEXT_AREA_ACTION as t, PI_TEXT_AREA_CARD as n, TextArea as r, onTextAreaChanged as i, onTextAreaSubmitted as a } from "./textArea.types.js";
|
|
3
|
+
import { actionTypesToEvents as o, registerCardComponent as s } from "@pihanga2/core";
|
|
4
|
+
//#region src/cards/textArea/index.ts
|
|
5
|
+
s({
|
|
6
|
+
name: n,
|
|
7
|
+
component: e,
|
|
8
|
+
events: o(t)
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as PI_TEXT_AREA_ACTION, n as PI_TEXT_AREA_CARD, r as TextArea, i as onTextAreaChanged, a as onTextAreaSubmitted };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/textArea/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {TextAreaComponent} from \"./textArea.component\";\nimport {PI_TEXT_AREA_ACTION, PI_TEXT_AREA_CARD} from \"./textArea.types\";\n\nexport * from \"./textArea.types\";\n\nregisterCardComponent({\n name: PI_TEXT_AREA_CARD,\n component: TextAreaComponent,\n events: actionTypesToEvents(PI_TEXT_AREA_ACTION),\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAmB;AACjD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PiCardProps } from '@pihanga2/core';
|
|
3
|
+
import { PiTextAreaEvents, PiTextAreaProps } from './textArea.types';
|
|
4
|
+
export declare const TextAreaComponent: (props: PiCardProps<PiTextAreaProps, PiTextAreaEvents>) => React.ReactNode;
|