@xenide-io/the-old-ui-theme 0.2.4 → 0.2.6
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/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/index.js +636 -379
- package/dist/index.mjs +631 -384
- package/dist/tailwind-preset.mjs +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
6
35
|
var __export = (target, all) => {
|
|
7
36
|
for (var name in all)
|
|
8
37
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -226,19 +255,30 @@ var shapeClass = {
|
|
|
226
255
|
square: "ph-btn-square",
|
|
227
256
|
wide: "ph-btn-wide"
|
|
228
257
|
};
|
|
229
|
-
function Button({
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
258
|
+
function Button(_a) {
|
|
259
|
+
var _b = _a, {
|
|
260
|
+
variant = "secondary",
|
|
261
|
+
size = "md",
|
|
262
|
+
shape = "default",
|
|
263
|
+
outline = false,
|
|
264
|
+
split = false,
|
|
265
|
+
icon,
|
|
266
|
+
sideIcon,
|
|
267
|
+
className,
|
|
268
|
+
children,
|
|
269
|
+
type = "button"
|
|
270
|
+
} = _b, props = __objRest(_b, [
|
|
271
|
+
"variant",
|
|
272
|
+
"size",
|
|
273
|
+
"shape",
|
|
274
|
+
"outline",
|
|
275
|
+
"split",
|
|
276
|
+
"icon",
|
|
277
|
+
"sideIcon",
|
|
278
|
+
"className",
|
|
279
|
+
"children",
|
|
280
|
+
"type"
|
|
281
|
+
]);
|
|
242
282
|
const usesLemonChrome = variant === "primary" || variant === "secondary";
|
|
243
283
|
const content = usesLemonChrome ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ButtonChrome, { label: children, icon, sideIcon, split }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
244
284
|
icon != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ph-btn-icon", children: icon }) : null,
|
|
@@ -248,7 +288,7 @@ function Button({
|
|
|
248
288
|
] });
|
|
249
289
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
250
290
|
"button",
|
|
251
|
-
{
|
|
291
|
+
__spreadProps(__spreadValues({
|
|
252
292
|
type,
|
|
253
293
|
className: cn(
|
|
254
294
|
"ph-btn",
|
|
@@ -258,39 +298,48 @@ function Button({
|
|
|
258
298
|
shapeClass[shape],
|
|
259
299
|
split && "ph-btn-split",
|
|
260
300
|
className
|
|
261
|
-
)
|
|
262
|
-
|
|
301
|
+
)
|
|
302
|
+
}, props), {
|
|
263
303
|
children: content
|
|
264
|
-
}
|
|
304
|
+
})
|
|
265
305
|
);
|
|
266
306
|
}
|
|
267
307
|
|
|
268
308
|
// src/components/icons/IconBase.tsx
|
|
269
309
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
270
|
-
function IconBase({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
310
|
+
function IconBase(_a) {
|
|
311
|
+
var _b = _a, {
|
|
312
|
+
className,
|
|
313
|
+
size,
|
|
314
|
+
children,
|
|
315
|
+
viewBox = "0 0 24 24",
|
|
316
|
+
fill: fill2 = "none",
|
|
317
|
+
xmlns = "http://www.w3.org/2000/svg",
|
|
318
|
+
focusable = "false"
|
|
319
|
+
} = _b, props = __objRest(_b, [
|
|
320
|
+
"className",
|
|
321
|
+
"size",
|
|
322
|
+
"children",
|
|
323
|
+
"viewBox",
|
|
324
|
+
"fill",
|
|
325
|
+
"xmlns",
|
|
326
|
+
"focusable"
|
|
327
|
+
]);
|
|
328
|
+
var _a2;
|
|
280
329
|
const dimensionProps = size != null ? { width: size, height: size } : {};
|
|
281
330
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
282
331
|
"svg",
|
|
283
|
-
{
|
|
284
|
-
className: cn("ph-icon", className)
|
|
285
|
-
|
|
332
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
333
|
+
className: cn("ph-icon", className)
|
|
334
|
+
}, dimensionProps), {
|
|
286
335
|
viewBox,
|
|
287
336
|
fill: fill2,
|
|
288
337
|
xmlns,
|
|
289
338
|
focusable,
|
|
290
|
-
"aria-hidden": props["aria-hidden"]
|
|
291
|
-
|
|
339
|
+
"aria-hidden": (_a2 = props["aria-hidden"]) != null ? _a2 : true
|
|
340
|
+
}), props), {
|
|
292
341
|
children
|
|
293
|
-
}
|
|
342
|
+
})
|
|
294
343
|
);
|
|
295
344
|
}
|
|
296
345
|
|
|
@@ -298,7 +347,7 @@ function IconBase({
|
|
|
298
347
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
299
348
|
function createIconBase({ viewBox = "0 0 24 24", paths }) {
|
|
300
349
|
return function IconGlyph(props) {
|
|
301
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBase, { viewBox,
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconBase, __spreadProps(__spreadValues({ viewBox }, props), { children: paths }));
|
|
302
351
|
};
|
|
303
352
|
}
|
|
304
353
|
function createIconBasePath(d, viewBox = "0 0 24 24") {
|
|
@@ -521,8 +570,9 @@ var IconActivity = createIconBasePath(
|
|
|
521
570
|
var IconFlask = createIconBasePath(
|
|
522
571
|
"M19.8 18.4L14 10.67V6.5l1.35-1.35c.39-.39.39-1.02 0-1.41L14.65 2.7a.9959.9959 0 0 0-1.41 0L9.35 6.54c-.39.39-.39 1.02 0 1.41L10.7 9.3v4.17L4.2 18.4C3.53 19.07 4.04 20.25 5 20.25h14c.96 0 1.47-1.18.8-1.85zM6.91 18.25l5.09-5.09 5.09 5.09H6.91z"
|
|
523
572
|
);
|
|
524
|
-
function IconSpinner(
|
|
525
|
-
|
|
573
|
+
function IconSpinner(_a) {
|
|
574
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconSync, __spreadValues({ className: cn("ph-icon-spin", className) }, props));
|
|
526
576
|
}
|
|
527
577
|
var PH_ICONS = {
|
|
528
578
|
activity: IconActivity,
|
|
@@ -594,9 +644,10 @@ var PH_ICONS = {
|
|
|
594
644
|
warning: IconExclamation,
|
|
595
645
|
xCircle: IconCancel
|
|
596
646
|
};
|
|
597
|
-
function IconByName(
|
|
647
|
+
function IconByName(_a) {
|
|
648
|
+
var _b = _a, { name } = _b, props = __objRest(_b, ["name"]);
|
|
598
649
|
const Icon = PH_ICONS[name];
|
|
599
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, {
|
|
650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, __spreadValues({}, props));
|
|
600
651
|
}
|
|
601
652
|
|
|
602
653
|
// src/components/ui/Alert.tsx
|
|
@@ -630,7 +681,7 @@ function Alert({
|
|
|
630
681
|
role: "alert",
|
|
631
682
|
className: cn("ph-alert", statusClassMap[status], className),
|
|
632
683
|
children: [
|
|
633
|
-
icon
|
|
684
|
+
icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: cn("mt-0.5 h-5 w-5 shrink-0", config.color) }),
|
|
634
685
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1", children: [
|
|
635
686
|
title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "font-semibold", children: title }),
|
|
636
687
|
description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-1 text-sm text-ph-subtle", children: description }),
|
|
@@ -776,12 +827,13 @@ function Drawer({
|
|
|
776
827
|
|
|
777
828
|
// src/components/ui/Kbd.tsx
|
|
778
829
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
779
|
-
function Kbd(
|
|
830
|
+
function Kbd(_a) {
|
|
831
|
+
var _b = _a, { variant = "shortcut", keys, children, className } = _b, props = __objRest(_b, ["variant", "keys", "children", "className"]);
|
|
780
832
|
if (variant === "token") {
|
|
781
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { className: cn("ph-kbd text-ph-ink", className),
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", __spreadProps(__spreadValues({ className: cn("ph-kbd text-ph-ink", className) }, props), { children }));
|
|
782
834
|
}
|
|
783
835
|
const content = (keys == null ? void 0 : keys.length) ? keys.join(" ") : normalizeShortcut(children);
|
|
784
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("kbd", { className: cn("ph-shortcut", className),
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("kbd", __spreadProps(__spreadValues({ className: cn("ph-shortcut", className) }, props), { children: content }));
|
|
785
837
|
}
|
|
786
838
|
function normalizeShortcut(children) {
|
|
787
839
|
if (typeof children !== "string") return children;
|
|
@@ -808,16 +860,23 @@ function dropdownPanelClass(align, panelClassName) {
|
|
|
808
860
|
panelClassName
|
|
809
861
|
);
|
|
810
862
|
}
|
|
811
|
-
function DropdownMenu({
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
|
|
863
|
+
function DropdownMenu(_a) {
|
|
864
|
+
var _b = _a, {
|
|
865
|
+
trigger,
|
|
866
|
+
children,
|
|
867
|
+
align = "start",
|
|
868
|
+
className,
|
|
869
|
+
panelClassName,
|
|
870
|
+
"aria-label": ariaLabel
|
|
871
|
+
} = _b, props = __objRest(_b, [
|
|
872
|
+
"trigger",
|
|
873
|
+
"children",
|
|
874
|
+
"align",
|
|
875
|
+
"className",
|
|
876
|
+
"panelClassName",
|
|
877
|
+
"aria-label"
|
|
878
|
+
]);
|
|
879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", __spreadProps(__spreadValues({ className: cn("relative", className) }, props), { children: [
|
|
821
880
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
822
881
|
"summary",
|
|
823
882
|
{
|
|
@@ -827,27 +886,40 @@ function DropdownMenu({
|
|
|
827
886
|
}
|
|
828
887
|
),
|
|
829
888
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: dropdownPanelClass(align, panelClassName), children })
|
|
830
|
-
] });
|
|
889
|
+
] }));
|
|
831
890
|
}
|
|
832
|
-
function DropdownButton({
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
891
|
+
function DropdownButton(_a) {
|
|
892
|
+
var _b = _a, {
|
|
893
|
+
label,
|
|
894
|
+
variant = "secondary",
|
|
895
|
+
outline = false,
|
|
896
|
+
size = "md",
|
|
897
|
+
split = false,
|
|
898
|
+
icon,
|
|
899
|
+
sideIcon,
|
|
900
|
+
children,
|
|
901
|
+
align = "start",
|
|
902
|
+
className,
|
|
903
|
+
panelClassName,
|
|
904
|
+
"aria-label": ariaLabel
|
|
905
|
+
} = _b, props = __objRest(_b, [
|
|
906
|
+
"label",
|
|
907
|
+
"variant",
|
|
908
|
+
"outline",
|
|
909
|
+
"size",
|
|
910
|
+
"split",
|
|
911
|
+
"icon",
|
|
912
|
+
"sideIcon",
|
|
913
|
+
"children",
|
|
914
|
+
"align",
|
|
915
|
+
"className",
|
|
916
|
+
"panelClassName",
|
|
917
|
+
"aria-label"
|
|
918
|
+
]);
|
|
847
919
|
const usesLemonChrome = variant === "primary" || variant === "secondary";
|
|
848
920
|
const chevron = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconChevronDown, { className: "h-4 w-4", "aria-hidden": true });
|
|
849
|
-
const trailing = sideIcon
|
|
850
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: cn("relative", className),
|
|
921
|
+
const trailing = sideIcon != null ? sideIcon : chevron;
|
|
922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", __spreadProps(__spreadValues({ className: cn("relative", className) }, props), { children: [
|
|
851
923
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
852
924
|
"summary",
|
|
853
925
|
{
|
|
@@ -858,7 +930,7 @@ function DropdownButton({
|
|
|
858
930
|
sizeClass2[size],
|
|
859
931
|
split && "ph-btn-split"
|
|
860
932
|
),
|
|
861
|
-
"aria-label": ariaLabel
|
|
933
|
+
"aria-label": ariaLabel != null ? ariaLabel : label,
|
|
862
934
|
children: usesLemonChrome ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ButtonChrome, { label, icon, sideIcon: trailing, split }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
863
935
|
icon != null ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ph-btn-icon", children: icon }) : null,
|
|
864
936
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "ph-btn-label", children: label }),
|
|
@@ -867,14 +939,17 @@ function DropdownButton({
|
|
|
867
939
|
}
|
|
868
940
|
),
|
|
869
941
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: dropdownPanelClass(align, panelClassName), children })
|
|
870
|
-
] });
|
|
942
|
+
] }));
|
|
871
943
|
}
|
|
872
|
-
function DropdownItem({
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}
|
|
877
|
-
|
|
944
|
+
function DropdownItem(_a) {
|
|
945
|
+
var _b = _a, {
|
|
946
|
+
className,
|
|
947
|
+
children
|
|
948
|
+
} = _b, props = __objRest(_b, [
|
|
949
|
+
"className",
|
|
950
|
+
"children"
|
|
951
|
+
]);
|
|
952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", __spreadProps(__spreadValues({ type: "button", className: cn("ph-dropdown-item w-full text-left", className) }, props), { children }));
|
|
878
953
|
}
|
|
879
954
|
|
|
880
955
|
// src/components/ui/Input.tsx
|
|
@@ -885,21 +960,32 @@ var sizeMap3 = {
|
|
|
885
960
|
md: "",
|
|
886
961
|
lg: "ph-input-lg"
|
|
887
962
|
};
|
|
888
|
-
function Input({
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}
|
|
963
|
+
function Input(_a) {
|
|
964
|
+
var _b = _a, {
|
|
965
|
+
id: idProp,
|
|
966
|
+
label,
|
|
967
|
+
hideLabel = false,
|
|
968
|
+
error,
|
|
969
|
+
helperText,
|
|
970
|
+
size = "md",
|
|
971
|
+
variant = "default",
|
|
972
|
+
className,
|
|
973
|
+
wrapperClassName,
|
|
974
|
+
disabled
|
|
975
|
+
} = _b, props = __objRest(_b, [
|
|
976
|
+
"id",
|
|
977
|
+
"label",
|
|
978
|
+
"hideLabel",
|
|
979
|
+
"error",
|
|
980
|
+
"helperText",
|
|
981
|
+
"size",
|
|
982
|
+
"variant",
|
|
983
|
+
"className",
|
|
984
|
+
"wrapperClassName",
|
|
985
|
+
"disabled"
|
|
986
|
+
]);
|
|
901
987
|
const autoId = (0, import_react.useId)();
|
|
902
|
-
const id = idProp
|
|
988
|
+
const id = idProp != null ? idProp : autoId;
|
|
903
989
|
const hasError = Boolean(error);
|
|
904
990
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
905
991
|
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -916,7 +1002,7 @@ function Input({
|
|
|
916
1002
|
),
|
|
917
1003
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
918
1004
|
"input",
|
|
919
|
-
{
|
|
1005
|
+
__spreadValues({
|
|
920
1006
|
id,
|
|
921
1007
|
disabled,
|
|
922
1008
|
"aria-invalid": hasError || void 0,
|
|
@@ -927,29 +1013,39 @@ function Input({
|
|
|
927
1013
|
hasError && "ph-input-error",
|
|
928
1014
|
disabled && "cursor-not-allowed opacity-60",
|
|
929
1015
|
className
|
|
930
|
-
)
|
|
931
|
-
|
|
932
|
-
}
|
|
1016
|
+
)
|
|
1017
|
+
}, props)
|
|
933
1018
|
),
|
|
934
1019
|
helperText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs text-ph-subtle", children: helperText }),
|
|
935
1020
|
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs font-medium text-ph-danger", children: error })
|
|
936
1021
|
] });
|
|
937
1022
|
}
|
|
938
|
-
function Select({
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}
|
|
1023
|
+
function Select(_a) {
|
|
1024
|
+
var _b = _a, {
|
|
1025
|
+
id: idProp,
|
|
1026
|
+
label,
|
|
1027
|
+
hideLabel = false,
|
|
1028
|
+
error,
|
|
1029
|
+
helperText,
|
|
1030
|
+
size = "md",
|
|
1031
|
+
className,
|
|
1032
|
+
wrapperClassName,
|
|
1033
|
+
disabled,
|
|
1034
|
+
children
|
|
1035
|
+
} = _b, props = __objRest(_b, [
|
|
1036
|
+
"id",
|
|
1037
|
+
"label",
|
|
1038
|
+
"hideLabel",
|
|
1039
|
+
"error",
|
|
1040
|
+
"helperText",
|
|
1041
|
+
"size",
|
|
1042
|
+
"className",
|
|
1043
|
+
"wrapperClassName",
|
|
1044
|
+
"disabled",
|
|
1045
|
+
"children"
|
|
1046
|
+
]);
|
|
951
1047
|
const autoId = (0, import_react.useId)();
|
|
952
|
-
const id = idProp
|
|
1048
|
+
const id = idProp != null ? idProp : autoId;
|
|
953
1049
|
const hasError = Boolean(error);
|
|
954
1050
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
955
1051
|
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -962,7 +1058,7 @@ function Select({
|
|
|
962
1058
|
),
|
|
963
1059
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
964
1060
|
"select",
|
|
965
|
-
{
|
|
1061
|
+
__spreadProps(__spreadValues({
|
|
966
1062
|
id,
|
|
967
1063
|
disabled,
|
|
968
1064
|
"aria-invalid": hasError || void 0,
|
|
@@ -972,29 +1068,39 @@ function Select({
|
|
|
972
1068
|
hasError && "border-ph-danger focus:border-ph-danger focus:ring-ph-danger/20",
|
|
973
1069
|
disabled && "cursor-not-allowed opacity-60",
|
|
974
1070
|
className
|
|
975
|
-
)
|
|
976
|
-
|
|
1071
|
+
)
|
|
1072
|
+
}, props), {
|
|
977
1073
|
children
|
|
978
|
-
}
|
|
1074
|
+
})
|
|
979
1075
|
),
|
|
980
1076
|
helperText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs text-ph-subtle", children: helperText }),
|
|
981
1077
|
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs font-medium text-ph-danger", children: error })
|
|
982
1078
|
] });
|
|
983
1079
|
}
|
|
984
|
-
function Textarea({
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
1080
|
+
function Textarea(_a) {
|
|
1081
|
+
var _b = _a, {
|
|
1082
|
+
id: idProp,
|
|
1083
|
+
label,
|
|
1084
|
+
hideLabel = false,
|
|
1085
|
+
error,
|
|
1086
|
+
helperText,
|
|
1087
|
+
size = "md",
|
|
1088
|
+
className,
|
|
1089
|
+
wrapperClassName,
|
|
1090
|
+
disabled
|
|
1091
|
+
} = _b, props = __objRest(_b, [
|
|
1092
|
+
"id",
|
|
1093
|
+
"label",
|
|
1094
|
+
"hideLabel",
|
|
1095
|
+
"error",
|
|
1096
|
+
"helperText",
|
|
1097
|
+
"size",
|
|
1098
|
+
"className",
|
|
1099
|
+
"wrapperClassName",
|
|
1100
|
+
"disabled"
|
|
1101
|
+
]);
|
|
996
1102
|
const autoId = (0, import_react.useId)();
|
|
997
|
-
const id = idProp
|
|
1103
|
+
const id = idProp != null ? idProp : autoId;
|
|
998
1104
|
const hasError = Boolean(error);
|
|
999
1105
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
1000
1106
|
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -1007,7 +1113,7 @@ function Textarea({
|
|
|
1007
1113
|
),
|
|
1008
1114
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1009
1115
|
"textarea",
|
|
1010
|
-
{
|
|
1116
|
+
__spreadValues({
|
|
1011
1117
|
id,
|
|
1012
1118
|
disabled,
|
|
1013
1119
|
"aria-invalid": hasError || void 0,
|
|
@@ -1017,31 +1123,38 @@ function Textarea({
|
|
|
1017
1123
|
hasError && "border-ph-danger focus:border-ph-danger focus:ring-ph-danger/20",
|
|
1018
1124
|
disabled && "cursor-not-allowed opacity-60",
|
|
1019
1125
|
className
|
|
1020
|
-
)
|
|
1021
|
-
|
|
1022
|
-
}
|
|
1126
|
+
)
|
|
1127
|
+
}, props)
|
|
1023
1128
|
),
|
|
1024
1129
|
helperText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs text-ph-subtle", children: helperText }),
|
|
1025
1130
|
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-xs font-medium text-ph-danger", children: error })
|
|
1026
1131
|
] });
|
|
1027
1132
|
}
|
|
1028
|
-
function Checkbox({
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1133
|
+
function Checkbox(_a) {
|
|
1134
|
+
var _b = _a, {
|
|
1135
|
+
id: idProp,
|
|
1136
|
+
label,
|
|
1137
|
+
error,
|
|
1138
|
+
helperText,
|
|
1139
|
+
className,
|
|
1140
|
+
wrapperClassName,
|
|
1141
|
+
disabled
|
|
1142
|
+
} = _b, props = __objRest(_b, [
|
|
1143
|
+
"id",
|
|
1144
|
+
"label",
|
|
1145
|
+
"error",
|
|
1146
|
+
"helperText",
|
|
1147
|
+
"className",
|
|
1148
|
+
"wrapperClassName",
|
|
1149
|
+
"disabled"
|
|
1150
|
+
]);
|
|
1038
1151
|
const autoId = (0, import_react.useId)();
|
|
1039
|
-
const id = idProp
|
|
1152
|
+
const id = idProp != null ? idProp : autoId;
|
|
1040
1153
|
const hasError = Boolean(error);
|
|
1041
1154
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-control-row", wrapperClassName), children: [
|
|
1042
1155
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1043
1156
|
"input",
|
|
1044
|
-
{
|
|
1157
|
+
__spreadValues({
|
|
1045
1158
|
id,
|
|
1046
1159
|
type: "checkbox",
|
|
1047
1160
|
disabled,
|
|
@@ -1051,76 +1164,92 @@ function Checkbox({
|
|
|
1051
1164
|
hasError && "border-ph-danger",
|
|
1052
1165
|
disabled && "cursor-not-allowed opacity-60",
|
|
1053
1166
|
className
|
|
1054
|
-
)
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1167
|
+
)
|
|
1168
|
+
}, props)
|
|
1057
1169
|
),
|
|
1058
1170
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: id, className: cn("cursor-pointer", disabled && "opacity-60"), children: label }),
|
|
1059
1171
|
helperText && !hasError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-0.5 text-xs text-ph-subtle", children: helperText }),
|
|
1060
1172
|
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-0.5 text-xs font-medium text-ph-danger", children: error })
|
|
1061
1173
|
] });
|
|
1062
1174
|
}
|
|
1063
|
-
function Radio({
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
}
|
|
1175
|
+
function Radio(_a) {
|
|
1176
|
+
var _b = _a, {
|
|
1177
|
+
id: idProp,
|
|
1178
|
+
label,
|
|
1179
|
+
className,
|
|
1180
|
+
wrapperClassName,
|
|
1181
|
+
disabled
|
|
1182
|
+
} = _b, props = __objRest(_b, [
|
|
1183
|
+
"id",
|
|
1184
|
+
"label",
|
|
1185
|
+
"className",
|
|
1186
|
+
"wrapperClassName",
|
|
1187
|
+
"disabled"
|
|
1188
|
+
]);
|
|
1071
1189
|
const autoId = (0, import_react.useId)();
|
|
1072
|
-
const id = idProp
|
|
1190
|
+
const id = idProp != null ? idProp : autoId;
|
|
1073
1191
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-control-row", wrapperClassName, disabled && "opacity-60"), children: [
|
|
1074
1192
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1075
1193
|
"input",
|
|
1076
|
-
{
|
|
1194
|
+
__spreadValues({
|
|
1077
1195
|
id,
|
|
1078
1196
|
type: "radio",
|
|
1079
1197
|
disabled,
|
|
1080
|
-
className: cn("ph-radio", disabled && "cursor-not-allowed", className)
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1198
|
+
className: cn("ph-radio", disabled && "cursor-not-allowed", className)
|
|
1199
|
+
}, props)
|
|
1083
1200
|
),
|
|
1084
1201
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: id, className: cn("cursor-pointer", disabled && "opacity-60"), children: label })
|
|
1085
1202
|
] });
|
|
1086
1203
|
}
|
|
1087
|
-
function Toggle({
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
}
|
|
1204
|
+
function Toggle(_a) {
|
|
1205
|
+
var _b = _a, {
|
|
1206
|
+
id: idProp,
|
|
1207
|
+
label,
|
|
1208
|
+
className,
|
|
1209
|
+
wrapperClassName,
|
|
1210
|
+
disabled
|
|
1211
|
+
} = _b, props = __objRest(_b, [
|
|
1212
|
+
"id",
|
|
1213
|
+
"label",
|
|
1214
|
+
"className",
|
|
1215
|
+
"wrapperClassName",
|
|
1216
|
+
"disabled"
|
|
1217
|
+
]);
|
|
1095
1218
|
const autoId = (0, import_react.useId)();
|
|
1096
|
-
const id = idProp
|
|
1219
|
+
const id = idProp != null ? idProp : autoId;
|
|
1097
1220
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: cn("ph-control-row-between", wrapperClassName, disabled && "opacity-60"), children: [
|
|
1098
1221
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: disabled ? "opacity-60" : void 0, children: label }),
|
|
1099
1222
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1100
1223
|
"input",
|
|
1101
|
-
{
|
|
1224
|
+
__spreadValues({
|
|
1102
1225
|
id,
|
|
1103
1226
|
type: "checkbox",
|
|
1104
1227
|
role: "switch",
|
|
1105
1228
|
disabled,
|
|
1106
|
-
className: cn("ph-toggle", disabled && "cursor-not-allowed", className)
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1229
|
+
className: cn("ph-toggle", disabled && "cursor-not-allowed", className)
|
|
1230
|
+
}, props)
|
|
1109
1231
|
)
|
|
1110
1232
|
] });
|
|
1111
1233
|
}
|
|
1112
|
-
function Range({
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1234
|
+
function Range(_a) {
|
|
1235
|
+
var _b = _a, {
|
|
1236
|
+
label,
|
|
1237
|
+
minLabel,
|
|
1238
|
+
maxLabel,
|
|
1239
|
+
valueLabel,
|
|
1240
|
+
wrapperClassName,
|
|
1241
|
+
className
|
|
1242
|
+
} = _b, props = __objRest(_b, [
|
|
1243
|
+
"label",
|
|
1244
|
+
"minLabel",
|
|
1245
|
+
"maxLabel",
|
|
1246
|
+
"valueLabel",
|
|
1247
|
+
"wrapperClassName",
|
|
1248
|
+
"className"
|
|
1249
|
+
]);
|
|
1121
1250
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
1122
1251
|
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "ph-label", children: label }),
|
|
1123
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "range", className: cn("ph-range", className),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", __spreadValues({ type: "range", className: cn("ph-range", className) }, props)),
|
|
1124
1253
|
(minLabel || valueLabel || maxLabel) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between text-xs text-ph-mutedtext", children: [
|
|
1125
1254
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: minLabel }),
|
|
1126
1255
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: valueLabel }),
|
|
@@ -1128,11 +1257,12 @@ function Range({
|
|
|
1128
1257
|
] })
|
|
1129
1258
|
] });
|
|
1130
1259
|
}
|
|
1131
|
-
function FileUpload(
|
|
1260
|
+
function FileUpload(_a) {
|
|
1261
|
+
var _b = _a, { label, prompt = "Drop file or browse", wrapperClassName, className } = _b, props = __objRest(_b, ["label", "prompt", "wrapperClassName", "className"]);
|
|
1132
1262
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
1133
1263
|
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "ph-label", children: label }),
|
|
1134
1264
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex cursor-pointer items-center gap-3 rounded-lg border border-dashed border-ph-border bg-ph-surface px-4 py-6 text-sm text-ph-subtle transition hover:bg-ph-muted/60", children: [
|
|
1135
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { type: "file", className: cn("sr-only", className),
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", __spreadValues({ type: "file", className: cn("sr-only", className) }, props)),
|
|
1136
1266
|
prompt
|
|
1137
1267
|
] })
|
|
1138
1268
|
] });
|
|
@@ -1253,36 +1383,45 @@ function Pagination({
|
|
|
1253
1383
|
|
|
1254
1384
|
// src/components/ui/Panel.tsx
|
|
1255
1385
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1256
|
-
function Panel(
|
|
1257
|
-
|
|
1386
|
+
function Panel(_a) {
|
|
1387
|
+
var _b = _a, { title, description, children, className } = _b, props = __objRest(_b, ["title", "description", "children", "className"]);
|
|
1388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", __spreadProps(__spreadValues({ className: cn("ph-panel", className) }, props), { children: [
|
|
1258
1389
|
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "text-sm font-semibold uppercase tracking-wider text-ph-mutedtext", children: title }),
|
|
1259
1390
|
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-ph-subtle", children: description }),
|
|
1260
1391
|
children
|
|
1261
|
-
] });
|
|
1392
|
+
] }));
|
|
1262
1393
|
}
|
|
1263
1394
|
|
|
1264
1395
|
// src/components/ui/Rating.tsx
|
|
1265
1396
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1266
|
-
function Rating({
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
}
|
|
1397
|
+
function Rating(_a) {
|
|
1398
|
+
var _b = _a, {
|
|
1399
|
+
label,
|
|
1400
|
+
value = 0,
|
|
1401
|
+
max = 5,
|
|
1402
|
+
readOnly = true,
|
|
1403
|
+
onChange,
|
|
1404
|
+
className,
|
|
1405
|
+
wrapperClassName
|
|
1406
|
+
} = _b, props = __objRest(_b, [
|
|
1407
|
+
"label",
|
|
1408
|
+
"value",
|
|
1409
|
+
"max",
|
|
1410
|
+
"readOnly",
|
|
1411
|
+
"onChange",
|
|
1412
|
+
"className",
|
|
1413
|
+
"wrapperClassName"
|
|
1414
|
+
]);
|
|
1276
1415
|
const stars = Array.from({ length: max }, (_, index) => index + 1);
|
|
1277
1416
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
1278
1417
|
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "ph-label", children: label }),
|
|
1279
1418
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1280
1419
|
"div",
|
|
1281
|
-
{
|
|
1420
|
+
__spreadProps(__spreadValues({
|
|
1282
1421
|
className: cn("ph-rating flex", className),
|
|
1283
1422
|
role: readOnly ? "img" : "radiogroup",
|
|
1284
|
-
"aria-label": label
|
|
1285
|
-
|
|
1423
|
+
"aria-label": label != null ? label : `Rating: ${value} out of ${max}`
|
|
1424
|
+
}, props), {
|
|
1286
1425
|
children: stars.map((star) => {
|
|
1287
1426
|
const active = star <= value;
|
|
1288
1427
|
if (readOnly) {
|
|
@@ -1309,7 +1448,7 @@ function Rating({
|
|
|
1309
1448
|
star
|
|
1310
1449
|
);
|
|
1311
1450
|
})
|
|
1312
|
-
}
|
|
1451
|
+
})
|
|
1313
1452
|
)
|
|
1314
1453
|
] });
|
|
1315
1454
|
}
|
|
@@ -1317,19 +1456,28 @@ function Rating({
|
|
|
1317
1456
|
// src/components/ui/SearchInput.tsx
|
|
1318
1457
|
var import_react2 = require("react");
|
|
1319
1458
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1320
|
-
function SearchInput({
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
}
|
|
1459
|
+
function SearchInput(_a) {
|
|
1460
|
+
var _b = _a, {
|
|
1461
|
+
id: idProp,
|
|
1462
|
+
label = "Search",
|
|
1463
|
+
hideLabel = false,
|
|
1464
|
+
shortcut,
|
|
1465
|
+
density = "default",
|
|
1466
|
+
className,
|
|
1467
|
+
wrapperClassName,
|
|
1468
|
+
placeholder
|
|
1469
|
+
} = _b, props = __objRest(_b, [
|
|
1470
|
+
"id",
|
|
1471
|
+
"label",
|
|
1472
|
+
"hideLabel",
|
|
1473
|
+
"shortcut",
|
|
1474
|
+
"density",
|
|
1475
|
+
"className",
|
|
1476
|
+
"wrapperClassName",
|
|
1477
|
+
"placeholder"
|
|
1478
|
+
]);
|
|
1331
1479
|
const autoId = (0, import_react2.useId)();
|
|
1332
|
-
const id = idProp
|
|
1480
|
+
const id = idProp != null ? idProp : autoId;
|
|
1333
1481
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("relative", wrapperClassName), children: [
|
|
1334
1482
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: id, className: hideLabel ? "sr-only" : "ph-label mb-1.5 block", children: label }),
|
|
1335
1483
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative", children: [
|
|
@@ -1343,7 +1491,7 @@ function SearchInput({
|
|
|
1343
1491
|
) : null,
|
|
1344
1492
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1345
1493
|
"input",
|
|
1346
|
-
{
|
|
1494
|
+
__spreadValues({
|
|
1347
1495
|
id,
|
|
1348
1496
|
type: "search",
|
|
1349
1497
|
placeholder,
|
|
@@ -1353,36 +1501,41 @@ function SearchInput({
|
|
|
1353
1501
|
density === "compact" && "max-w-xs !min-h-[2rem] py-1.5 text-sm",
|
|
1354
1502
|
shortcut != null && "pl-[3.25rem]",
|
|
1355
1503
|
className
|
|
1356
|
-
)
|
|
1357
|
-
|
|
1358
|
-
}
|
|
1504
|
+
)
|
|
1505
|
+
}, props)
|
|
1359
1506
|
)
|
|
1360
1507
|
] })
|
|
1361
1508
|
] });
|
|
1362
1509
|
}
|
|
1363
|
-
function SearchGroup({
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
}
|
|
1510
|
+
function SearchGroup(_a) {
|
|
1511
|
+
var _b = _a, {
|
|
1512
|
+
id: idProp,
|
|
1513
|
+
label = "Search records",
|
|
1514
|
+
submitLabel = "Search",
|
|
1515
|
+
placeholder = "Persons, actions, flags\u2026",
|
|
1516
|
+
wrapperClassName,
|
|
1517
|
+
className
|
|
1518
|
+
} = _b, props = __objRest(_b, [
|
|
1519
|
+
"id",
|
|
1520
|
+
"label",
|
|
1521
|
+
"submitLabel",
|
|
1522
|
+
"placeholder",
|
|
1523
|
+
"wrapperClassName",
|
|
1524
|
+
"className"
|
|
1525
|
+
]);
|
|
1372
1526
|
const autoId = (0, import_react2.useId)();
|
|
1373
|
-
const id = idProp
|
|
1527
|
+
const id = idProp != null ? idProp : autoId;
|
|
1374
1528
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("ph-field", wrapperClassName), children: [
|
|
1375
1529
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: id, className: "ph-label", children: label }),
|
|
1376
1530
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "ph-search-group flex w-full max-w-lg min-h-[2.3125rem] items-stretch divide-x divide-ph-border", children: [
|
|
1377
1531
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1378
1532
|
"input",
|
|
1379
|
-
{
|
|
1533
|
+
__spreadValues({
|
|
1380
1534
|
id,
|
|
1381
1535
|
type: "search",
|
|
1382
1536
|
placeholder,
|
|
1383
|
-
className: cn("ph-input ph-input-group-field min-w-0 flex-1", className)
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1537
|
+
className: cn("ph-input ph-input-group-field min-w-0 flex-1", className)
|
|
1538
|
+
}, props)
|
|
1386
1539
|
),
|
|
1387
1540
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1388
1541
|
Button,
|
|
@@ -1433,13 +1586,14 @@ var statMap = {
|
|
|
1433
1586
|
purple: "",
|
|
1434
1587
|
warning: "border-amber-200 bg-amber-50/70"
|
|
1435
1588
|
};
|
|
1436
|
-
function Stat(
|
|
1437
|
-
|
|
1589
|
+
function Stat(_a) {
|
|
1590
|
+
var _b = _a, { icon, label, value, footer, tone = "default", className } = _b, props = __objRest(_b, ["icon", "label", "value", "footer", "tone", "className"]);
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("article", __spreadProps(__spreadValues({ className: cn("ph-stat", statMap[tone], className) }, props), { children: [
|
|
1438
1592
|
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("mb-2 h-7 w-7", toneMap[tone]), children: icon }),
|
|
1439
1593
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("ph-stat-label", tone === "warning" && toneMap[tone]), children: label }),
|
|
1440
1594
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("ph-stat-val", toneMap[tone]), children: value }),
|
|
1441
1595
|
footer && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-ph-subtle", children: footer })
|
|
1442
|
-
] });
|
|
1596
|
+
] }));
|
|
1443
1597
|
}
|
|
1444
1598
|
|
|
1445
1599
|
// src/components/ui/Toast.tsx
|
|
@@ -2234,12 +2388,15 @@ function ComponentDocs({ title = "Props & variants", rows, defaultOpen = false,
|
|
|
2234
2388
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { className: "px-4 py-2 font-semibold", children: "Default" }),
|
|
2235
2389
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("th", { className: "px-4 py-2 font-semibold", children: "Use" })
|
|
2236
2390
|
] }) }),
|
|
2237
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tbody", { className: "divide-y divide-ph-border", children: rows.map((row) =>
|
|
2238
|
-
|
|
2239
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tbody", { className: "divide-y divide-ph-border", children: rows.map((row) => {
|
|
2392
|
+
var _a;
|
|
2393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("tr", { children: [
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "px-4 py-3 align-top font-mono text-xs text-ph-ink", children: row.name }),
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "px-4 py-3 align-top font-mono text-xs text-ph-subtle", children: row.type }),
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "px-4 py-3 align-top font-mono text-xs text-ph-subtle", children: (_a = row.defaultValue) != null ? _a : "-" }),
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("td", { className: "px-4 py-3 align-top text-ph-subtle", children: row.description })
|
|
2398
|
+
] }, row.name);
|
|
2399
|
+
}) })
|
|
2243
2400
|
] }) })
|
|
2244
2401
|
] });
|
|
2245
2402
|
}
|
|
@@ -2257,9 +2414,10 @@ function ShowcaseWrapper({
|
|
|
2257
2414
|
children,
|
|
2258
2415
|
className
|
|
2259
2416
|
}) {
|
|
2417
|
+
var _a;
|
|
2260
2418
|
const [showCode, setShowCode] = (0, import_react11.useState)(false);
|
|
2261
|
-
const fallbackId = titleIdMap[title]
|
|
2262
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("section", { id: id
|
|
2419
|
+
const fallbackId = (_a = titleIdMap[title]) != null ? _a : title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
2420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("section", { id: id != null ? id : fallbackId, className: cn("scroll-mt-20", className), children: [
|
|
2263
2421
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ph-h2-rule mb-8", children: [
|
|
2264
2422
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2265
2423
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h2", { children: title }),
|
|
@@ -2493,17 +2651,25 @@ var statusMap = {
|
|
|
2493
2651
|
away: "bg-amber-400",
|
|
2494
2652
|
busy: "bg-ph-danger"
|
|
2495
2653
|
};
|
|
2496
|
-
function Avatar({
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2654
|
+
function Avatar(_a) {
|
|
2655
|
+
var _b = _a, {
|
|
2656
|
+
label,
|
|
2657
|
+
icon,
|
|
2658
|
+
size = "md",
|
|
2659
|
+
color = "bg-ph-brand text-white",
|
|
2660
|
+
status,
|
|
2661
|
+
badge,
|
|
2662
|
+
className
|
|
2663
|
+
} = _b, props = __objRest(_b, [
|
|
2664
|
+
"label",
|
|
2665
|
+
"icon",
|
|
2666
|
+
"size",
|
|
2667
|
+
"color",
|
|
2668
|
+
"status",
|
|
2669
|
+
"badge",
|
|
2670
|
+
"className"
|
|
2671
|
+
]);
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", __spreadProps(__spreadValues({ className: cn("relative inline-flex shrink-0", className) }, props), { children: [
|
|
2507
2673
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2508
2674
|
"div",
|
|
2509
2675
|
{
|
|
@@ -2525,13 +2691,14 @@ function Avatar({
|
|
|
2525
2691
|
}
|
|
2526
2692
|
),
|
|
2527
2693
|
badge && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "absolute -bottom-1 -right-1 flex min-w-[22px] items-center justify-center rounded-full bg-ph-brand px-1.5 py-px text-[10px] font-bold text-white", children: badge })
|
|
2528
|
-
] });
|
|
2694
|
+
] }));
|
|
2529
2695
|
}
|
|
2530
|
-
function AvatarGroup(
|
|
2696
|
+
function AvatarGroup(_a) {
|
|
2697
|
+
var _b = _a, { children, max, className } = _b, props = __objRest(_b, ["children", "max", "className"]);
|
|
2531
2698
|
const items = Array.isArray(children) ? children : [children];
|
|
2532
2699
|
const visible = max ? items.slice(0, max) : items;
|
|
2533
2700
|
const remaining = max ? items.length - max : 0;
|
|
2534
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("-space-x-3 flex rtl:space-x-reverse", className),
|
|
2701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", __spreadProps(__spreadValues({ className: cn("-space-x-3 flex rtl:space-x-reverse", className) }, props), { children: [
|
|
2535
2702
|
visible,
|
|
2536
2703
|
remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2537
2704
|
Avatar,
|
|
@@ -2541,7 +2708,7 @@ function AvatarGroup({ children, max, className, ...props }) {
|
|
|
2541
2708
|
color: "bg-ph-toolbar text-ph-subtle"
|
|
2542
2709
|
}
|
|
2543
2710
|
)
|
|
2544
|
-
] });
|
|
2711
|
+
] }));
|
|
2545
2712
|
}
|
|
2546
2713
|
|
|
2547
2714
|
// src/components/ui/Progress.tsx
|
|
@@ -2551,18 +2718,26 @@ var sizeMap6 = {
|
|
|
2551
2718
|
md: "h-2",
|
|
2552
2719
|
lg: "h-3"
|
|
2553
2720
|
};
|
|
2554
|
-
function Progress({
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
}
|
|
2721
|
+
function Progress(_a) {
|
|
2722
|
+
var _b = _a, {
|
|
2723
|
+
value,
|
|
2724
|
+
max = 100,
|
|
2725
|
+
color = "bg-ph-brand",
|
|
2726
|
+
label,
|
|
2727
|
+
showPercentage = false,
|
|
2728
|
+
size = "md",
|
|
2729
|
+
className
|
|
2730
|
+
} = _b, props = __objRest(_b, [
|
|
2731
|
+
"value",
|
|
2732
|
+
"max",
|
|
2733
|
+
"color",
|
|
2734
|
+
"label",
|
|
2735
|
+
"showPercentage",
|
|
2736
|
+
"size",
|
|
2737
|
+
"className"
|
|
2738
|
+
]);
|
|
2564
2739
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
2565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cn("w-full", className),
|
|
2740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", __spreadProps(__spreadValues({ className: cn("w-full", className) }, props), { children: [
|
|
2566
2741
|
(label || showPercentage) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mb-1.5 flex justify-between text-sm text-ph-subtle", children: [
|
|
2567
2742
|
label && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: label }),
|
|
2568
2743
|
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "tabular-nums", children: [
|
|
@@ -2581,31 +2756,39 @@ function Progress({
|
|
|
2581
2756
|
"aria-valuemax": max
|
|
2582
2757
|
}
|
|
2583
2758
|
) })
|
|
2584
|
-
] });
|
|
2759
|
+
] }));
|
|
2585
2760
|
}
|
|
2586
2761
|
|
|
2587
2762
|
// src/components/ui/ChatBubble.tsx
|
|
2588
2763
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2589
|
-
function ChatBubble({
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
}
|
|
2764
|
+
function ChatBubble(_a) {
|
|
2765
|
+
var _b = _a, {
|
|
2766
|
+
children,
|
|
2767
|
+
avatar,
|
|
2768
|
+
name,
|
|
2769
|
+
time,
|
|
2770
|
+
variant = "from",
|
|
2771
|
+
footer,
|
|
2772
|
+
className
|
|
2773
|
+
} = _b, props = __objRest(_b, [
|
|
2774
|
+
"children",
|
|
2775
|
+
"avatar",
|
|
2776
|
+
"name",
|
|
2777
|
+
"time",
|
|
2778
|
+
"variant",
|
|
2779
|
+
"footer",
|
|
2780
|
+
"className"
|
|
2781
|
+
]);
|
|
2599
2782
|
const isSelf = variant === "self";
|
|
2600
2783
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
2601
2784
|
"div",
|
|
2602
|
-
{
|
|
2785
|
+
__spreadProps(__spreadValues({
|
|
2603
2786
|
className: cn(
|
|
2604
2787
|
"flex gap-3",
|
|
2605
2788
|
isSelf && "flex-row-reverse",
|
|
2606
2789
|
className
|
|
2607
|
-
)
|
|
2608
|
-
|
|
2790
|
+
)
|
|
2791
|
+
}, props), {
|
|
2609
2792
|
children: [
|
|
2610
2793
|
avatar && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "shrink-0", children: avatar }),
|
|
2611
2794
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("min-w-0 flex-1", isSelf && "text-right"), children: [
|
|
@@ -2635,27 +2818,32 @@ function ChatBubble({
|
|
|
2635
2818
|
footer && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("footer", { className: "mt-2 text-[11px] text-ph-mutedtext", children: footer })
|
|
2636
2819
|
] })
|
|
2637
2820
|
]
|
|
2638
|
-
}
|
|
2821
|
+
})
|
|
2639
2822
|
);
|
|
2640
2823
|
}
|
|
2641
2824
|
|
|
2642
2825
|
// src/components/ui/Terminal.tsx
|
|
2643
2826
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2644
|
-
function Terminal({
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
}
|
|
2827
|
+
function Terminal(_a) {
|
|
2828
|
+
var _b = _a, {
|
|
2829
|
+
title = "sandbox",
|
|
2830
|
+
lines,
|
|
2831
|
+
children,
|
|
2832
|
+
className
|
|
2833
|
+
} = _b, props = __objRest(_b, [
|
|
2834
|
+
"title",
|
|
2835
|
+
"lines",
|
|
2836
|
+
"children",
|
|
2837
|
+
"className"
|
|
2838
|
+
]);
|
|
2651
2839
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2652
2840
|
"div",
|
|
2653
|
-
{
|
|
2841
|
+
__spreadProps(__spreadValues({
|
|
2654
2842
|
className: cn(
|
|
2655
2843
|
"overflow-hidden rounded-xl border border-ph-border shadow-ph-md",
|
|
2656
2844
|
className
|
|
2657
|
-
)
|
|
2658
|
-
|
|
2845
|
+
)
|
|
2846
|
+
}, props), {
|
|
2659
2847
|
children: [
|
|
2660
2848
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("header", { className: "flex items-center gap-2 border-b border-ph-border bg-ph-muted px-4 py-3", children: [
|
|
2661
2849
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "h-3 w-3 rounded-full bg-red-400" }),
|
|
@@ -2672,7 +2860,7 @@ function Terminal({
|
|
|
2672
2860
|
] }, i);
|
|
2673
2861
|
}) }) })
|
|
2674
2862
|
]
|
|
2675
|
-
}
|
|
2863
|
+
})
|
|
2676
2864
|
);
|
|
2677
2865
|
}
|
|
2678
2866
|
|
|
@@ -2684,16 +2872,23 @@ var positionMap = {
|
|
|
2684
2872
|
"bottom-right": "-right-[2px] -bottom-[2px]",
|
|
2685
2873
|
"bottom-left": "-left-[2px] -bottom-[2px]"
|
|
2686
2874
|
};
|
|
2687
|
-
function Indicator({
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
}
|
|
2696
|
-
|
|
2875
|
+
function Indicator(_a) {
|
|
2876
|
+
var _b = _a, {
|
|
2877
|
+
children,
|
|
2878
|
+
badge,
|
|
2879
|
+
color = "bg-ph-brand",
|
|
2880
|
+
position = "top-right",
|
|
2881
|
+
dot = false,
|
|
2882
|
+
className
|
|
2883
|
+
} = _b, props = __objRest(_b, [
|
|
2884
|
+
"children",
|
|
2885
|
+
"badge",
|
|
2886
|
+
"color",
|
|
2887
|
+
"position",
|
|
2888
|
+
"dot",
|
|
2889
|
+
"className"
|
|
2890
|
+
]);
|
|
2891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", __spreadProps(__spreadValues({ className: cn("relative inline-flex items-center justify-center", className) }, props), { children: [
|
|
2697
2892
|
dot ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2698
2893
|
"span",
|
|
2699
2894
|
{
|
|
@@ -2715,22 +2910,26 @@ function Indicator({
|
|
|
2715
2910
|
}
|
|
2716
2911
|
) : null,
|
|
2717
2912
|
children
|
|
2718
|
-
] });
|
|
2913
|
+
] }));
|
|
2719
2914
|
}
|
|
2720
2915
|
|
|
2721
2916
|
// src/components/ui/Timeline.tsx
|
|
2722
2917
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2723
|
-
function Timeline({
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
}
|
|
2918
|
+
function Timeline(_a) {
|
|
2919
|
+
var _b = _a, {
|
|
2920
|
+
events,
|
|
2921
|
+
alternate = false,
|
|
2922
|
+
className
|
|
2923
|
+
} = _b, props = __objRest(_b, [
|
|
2924
|
+
"events",
|
|
2925
|
+
"alternate",
|
|
2926
|
+
"className"
|
|
2927
|
+
]);
|
|
2729
2928
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2730
2929
|
"ol",
|
|
2731
|
-
{
|
|
2732
|
-
className: cn("relative space-y-8", className)
|
|
2733
|
-
|
|
2930
|
+
__spreadProps(__spreadValues({
|
|
2931
|
+
className: cn("relative space-y-8", className)
|
|
2932
|
+
}, props), {
|
|
2734
2933
|
children: events.map((event, idx) => {
|
|
2735
2934
|
const align = alternate && idx % 2 !== 0 ? "lg:flex-row-reverse" : "";
|
|
2736
2935
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("li", { className: cn("relative flex gap-6", align), children: [
|
|
@@ -2753,12 +2952,13 @@ function Timeline({
|
|
|
2753
2952
|
] })
|
|
2754
2953
|
] }, event.id);
|
|
2755
2954
|
})
|
|
2756
|
-
}
|
|
2955
|
+
})
|
|
2757
2956
|
);
|
|
2758
2957
|
}
|
|
2759
2958
|
|
|
2760
2959
|
// src/components/charts/ph-insight-charts.tsx
|
|
2761
2960
|
var import_react15 = require("react");
|
|
2961
|
+
var import_chart = require("chart.js");
|
|
2762
2962
|
var import_react_chartjs_2 = require("react-chartjs-2");
|
|
2763
2963
|
|
|
2764
2964
|
// src/lib/chart/with-alpha.ts
|
|
@@ -3113,7 +3313,7 @@ function readChartTokens(root) {
|
|
|
3113
3313
|
if (typeof document === "undefined") {
|
|
3114
3314
|
return FALLBACK_CHART_TOKENS;
|
|
3115
3315
|
}
|
|
3116
|
-
const el = root
|
|
3316
|
+
const el = root != null ? root : document.documentElement;
|
|
3117
3317
|
const series = [1, 2, 3, 4, 5, 6, 7].map((index) => {
|
|
3118
3318
|
const raw = readCssVar(el, `--ph-data-${index}`);
|
|
3119
3319
|
return raw !== "" ? raw : FALLBACK_CHART_TOKENS.series[index - 1];
|
|
@@ -3128,12 +3328,24 @@ function readChartTokens(root) {
|
|
|
3128
3328
|
}
|
|
3129
3329
|
|
|
3130
3330
|
// src/lib/chart/use-ph-chart-tokens.ts
|
|
3331
|
+
function tokensEqual(a, b) {
|
|
3332
|
+
if (a.series.length !== b.series.length) return false;
|
|
3333
|
+
for (let i = 0; i < a.series.length; i++) {
|
|
3334
|
+
if (a.series[i] !== b.series[i]) return false;
|
|
3335
|
+
}
|
|
3336
|
+
return a.grid === b.grid && a.text === b.text && a.textMuted === b.textMuted && a.surface === b.surface && a.borderStrong === b.borderStrong && a.accent === b.accent;
|
|
3337
|
+
}
|
|
3131
3338
|
function useChartTokens() {
|
|
3132
3339
|
const [tokens, setTokens] = (0, import_react13.useState)(FALLBACK_CHART_TOKENS);
|
|
3340
|
+
const tokensRef = (0, import_react13.useRef)(FALLBACK_CHART_TOKENS);
|
|
3133
3341
|
(0, import_react13.useEffect)(() => {
|
|
3134
3342
|
const root = document.documentElement;
|
|
3135
3343
|
const refresh = () => {
|
|
3136
|
-
|
|
3344
|
+
const next = readChartTokens(root);
|
|
3345
|
+
if (!tokensEqual(tokensRef.current, next)) {
|
|
3346
|
+
tokensRef.current = next;
|
|
3347
|
+
setTokens(next);
|
|
3348
|
+
}
|
|
3137
3349
|
};
|
|
3138
3350
|
refresh();
|
|
3139
3351
|
const observer = new MutationObserver(refresh);
|
|
@@ -3167,7 +3379,7 @@ function resolveDisplayedSeries(series, palette) {
|
|
|
3167
3379
|
return visible.map((s, visibleIndex) => {
|
|
3168
3380
|
const hasExplicit = s.color != null && String(s.color).trim() !== "";
|
|
3169
3381
|
const resolvedColor = hasExplicit ? String(s.color).trim() : palette[visibleIndex % palette.length];
|
|
3170
|
-
return {
|
|
3382
|
+
return __spreadProps(__spreadValues({}, s), { resolvedColor });
|
|
3171
3383
|
});
|
|
3172
3384
|
}
|
|
3173
3385
|
function yDomainForSeries(resolved) {
|
|
@@ -3230,7 +3442,7 @@ function CanvasTrendLineChart({
|
|
|
3230
3442
|
}, []);
|
|
3231
3443
|
const resolved = (0, import_react14.useMemo)(() => resolveDisplayedSeries(series, theme.colors), [series, theme.colors]);
|
|
3232
3444
|
const draw = (0, import_react14.useCallback)(() => {
|
|
3233
|
-
var _a, _b, _c;
|
|
3445
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3234
3446
|
const canvas = canvasRef.current;
|
|
3235
3447
|
const container = containerRef.current;
|
|
3236
3448
|
if (!canvas || !container) {
|
|
@@ -3258,15 +3470,15 @@ function CanvasTrendLineChart({
|
|
|
3258
3470
|
if (plotWidth <= 4 || plotHeight <= 4) {
|
|
3259
3471
|
return;
|
|
3260
3472
|
}
|
|
3261
|
-
const bg = theme.backgroundColor
|
|
3473
|
+
const bg = (_a = theme.backgroundColor) != null ? _a : "#ffffff";
|
|
3262
3474
|
ctx.fillStyle = bg;
|
|
3263
3475
|
ctx.fillRect(0, 0, cssW, cssH);
|
|
3264
3476
|
const labelList = [...labels];
|
|
3265
3477
|
const xScale = (0, import_d3_scale.scalePoint)().domain(labelList).range([plotLeft, plotLeft + plotWidth]).padding(0.5);
|
|
3266
3478
|
const [y0, y1] = yDomainForSeries(resolved);
|
|
3267
3479
|
const yScale = (0, import_d3_scale.scaleLinear)().domain([y0, y1]).nice().range([plotTop + plotHeight, plotTop]);
|
|
3268
|
-
const axisColor = theme.axisColor
|
|
3269
|
-
const gridColor = theme.gridColor
|
|
3480
|
+
const axisColor = (_b = theme.axisColor) != null ? _b : "#666";
|
|
3481
|
+
const gridColor = (_c = theme.gridColor) != null ? _c : "rgba(0,0,0,0.08)";
|
|
3270
3482
|
if (showGrid) {
|
|
3271
3483
|
const ticks = yScale.ticks(6);
|
|
3272
3484
|
ctx.strokeStyle = gridColor;
|
|
@@ -3288,7 +3500,7 @@ function CanvasTrendLineChart({
|
|
|
3288
3500
|
if (s.overlay || !s.fill) {
|
|
3289
3501
|
continue;
|
|
3290
3502
|
}
|
|
3291
|
-
const opacity = s.fill.opacity
|
|
3503
|
+
const opacity = (_d = s.fill.opacity) != null ? _d : 0.45;
|
|
3292
3504
|
const baseline = yScale(0);
|
|
3293
3505
|
ctx.save();
|
|
3294
3506
|
ctx.globalAlpha = opacity;
|
|
@@ -3322,10 +3534,10 @@ function CanvasTrendLineChart({
|
|
|
3322
3534
|
ctx.restore();
|
|
3323
3535
|
}
|
|
3324
3536
|
for (const s of resolved) {
|
|
3325
|
-
if ((
|
|
3537
|
+
if ((_e = s.visibility) == null ? void 0 : _e.excluded) {
|
|
3326
3538
|
continue;
|
|
3327
3539
|
}
|
|
3328
|
-
const pattern = ((
|
|
3540
|
+
const pattern = (_g = (_f = s.stroke) == null ? void 0 : _f.pattern) != null ? _g : [];
|
|
3329
3541
|
ctx.strokeStyle = s.resolvedColor;
|
|
3330
3542
|
ctx.lineWidth = 2;
|
|
3331
3543
|
ctx.lineJoin = "round";
|
|
@@ -3379,7 +3591,7 @@ function CanvasTrendLineChart({
|
|
|
3379
3591
|
if (hi != null && hi >= 0 && hi < labels.length && showCrosshair) {
|
|
3380
3592
|
const cx = xAt(hi);
|
|
3381
3593
|
if (cx != null) {
|
|
3382
|
-
const cross = theme.crosshairColor
|
|
3594
|
+
const cross = (_h = theme.crosshairColor) != null ? _h : gridColor;
|
|
3383
3595
|
ctx.strokeStyle = cross;
|
|
3384
3596
|
ctx.lineWidth = 1;
|
|
3385
3597
|
ctx.setLineDash([4, 4]);
|
|
@@ -3389,7 +3601,7 @@ function CanvasTrendLineChart({
|
|
|
3389
3601
|
ctx.stroke();
|
|
3390
3602
|
ctx.setLineDash([]);
|
|
3391
3603
|
for (const s of resolved) {
|
|
3392
|
-
if (s.overlay || ((
|
|
3604
|
+
if (s.overlay || ((_i = s.visibility) == null ? void 0 : _i.excluded)) {
|
|
3393
3605
|
continue;
|
|
3394
3606
|
}
|
|
3395
3607
|
const v = s.data[hi];
|
|
@@ -3489,9 +3701,31 @@ function CanvasTrendLineChart({
|
|
|
3489
3701
|
// src/components/charts/ph-insight-charts.tsx
|
|
3490
3702
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3491
3703
|
var DEMO_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
3704
|
+
var chartJsRegistered = false;
|
|
3705
|
+
function registerChartJs() {
|
|
3706
|
+
if (chartJsRegistered) return;
|
|
3707
|
+
if (typeof window === "undefined") return;
|
|
3708
|
+
import_chart.Chart.register(
|
|
3709
|
+
import_chart.CategoryScale,
|
|
3710
|
+
import_chart.LinearScale,
|
|
3711
|
+
import_chart.RadialLinearScale,
|
|
3712
|
+
import_chart.BarController,
|
|
3713
|
+
import_chart.BarElement,
|
|
3714
|
+
import_chart.DoughnutController,
|
|
3715
|
+
import_chart.PolarAreaController,
|
|
3716
|
+
import_chart.ArcElement,
|
|
3717
|
+
import_chart.Title,
|
|
3718
|
+
import_chart.Tooltip,
|
|
3719
|
+
import_chart.Legend
|
|
3720
|
+
);
|
|
3721
|
+
chartJsRegistered = true;
|
|
3722
|
+
}
|
|
3492
3723
|
function useClientMounted() {
|
|
3493
3724
|
const [mounted, setMounted] = (0, import_react15.useState)(false);
|
|
3494
|
-
(0, import_react15.useEffect)(() =>
|
|
3725
|
+
(0, import_react15.useEffect)(() => {
|
|
3726
|
+
setMounted(true);
|
|
3727
|
+
registerChartJs();
|
|
3728
|
+
}, []);
|
|
3495
3729
|
return mounted;
|
|
3496
3730
|
}
|
|
3497
3731
|
function ChartSkeleton({ className = "h-[280px]" }) {
|
|
@@ -3548,7 +3782,7 @@ function InsightVerticalBarChart() {
|
|
|
3548
3782
|
if (!mounted) {
|
|
3549
3783
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChartSkeleton, {});
|
|
3550
3784
|
}
|
|
3551
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[280px] w-full min-h-[220px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options }) });
|
|
3785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[280px] w-full min-h-[220px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options, redraw: false }) });
|
|
3552
3786
|
}
|
|
3553
3787
|
function InsightHorizontalBarChart() {
|
|
3554
3788
|
const mounted = useClientMounted();
|
|
@@ -3557,7 +3791,7 @@ function InsightHorizontalBarChart() {
|
|
|
3557
3791
|
if (!mounted) {
|
|
3558
3792
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChartSkeleton, { className: "h-[320px]" });
|
|
3559
3793
|
}
|
|
3560
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[320px] w-full min-h-[260px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options }) });
|
|
3794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[320px] w-full min-h-[260px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options, redraw: false }) });
|
|
3561
3795
|
}
|
|
3562
3796
|
function InsightStackedBarChart() {
|
|
3563
3797
|
const mounted = useClientMounted();
|
|
@@ -3566,7 +3800,7 @@ function InsightStackedBarChart() {
|
|
|
3566
3800
|
if (!mounted) {
|
|
3567
3801
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChartSkeleton, { className: "h-[300px]" });
|
|
3568
3802
|
}
|
|
3569
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[300px] w-full min-h-[240px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options }) });
|
|
3803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative h-[300px] w-full min-h-[240px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Bar, { data: config.data, options: config.options, redraw: false }) });
|
|
3570
3804
|
}
|
|
3571
3805
|
function InsightDoughnutChart() {
|
|
3572
3806
|
const mounted = useClientMounted();
|
|
@@ -3575,7 +3809,7 @@ function InsightDoughnutChart() {
|
|
|
3575
3809
|
if (!mounted) {
|
|
3576
3810
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChartSkeleton, { className: "h-[260px]" });
|
|
3577
3811
|
}
|
|
3578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative mx-auto h-[260px] w-full max-w-[280px] min-h-[220px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Doughnut, { data: config.data, options: config.options }) });
|
|
3812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative mx-auto h-[260px] w-full max-w-[280px] min-h-[220px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.Doughnut, { data: config.data, options: config.options, redraw: false }) });
|
|
3579
3813
|
}
|
|
3580
3814
|
function InsightPolarAreaChart() {
|
|
3581
3815
|
const mounted = useClientMounted();
|
|
@@ -3584,13 +3818,14 @@ function InsightPolarAreaChart() {
|
|
|
3584
3818
|
if (!mounted) {
|
|
3585
3819
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChartSkeleton, { className: "h-[280px]" });
|
|
3586
3820
|
}
|
|
3587
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative mx-auto h-[280px] w-full max-w-[320px] min-h-[240px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.PolarArea, { data: config.data, options: config.options }) });
|
|
3821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative mx-auto h-[280px] w-full max-w-[320px] min-h-[240px]", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_chartjs_2.PolarArea, { data: config.data, options: config.options, redraw: false }) });
|
|
3588
3822
|
}
|
|
3589
3823
|
|
|
3590
3824
|
// src/components/dashboard/DashboardWell.tsx
|
|
3591
3825
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3592
|
-
function DashboardWell(
|
|
3593
|
-
|
|
3826
|
+
function DashboardWell(_a) {
|
|
3827
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
3828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", __spreadValues({ className: cn("ph-dashboard-well", className) }, props));
|
|
3594
3829
|
}
|
|
3595
3830
|
|
|
3596
3831
|
// src/components/dashboard/DashboardToolbar.tsx
|
|
@@ -3611,78 +3846,92 @@ var presetClass = {
|
|
|
3611
3846
|
insights: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
3612
3847
|
dense: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
|
3613
3848
|
};
|
|
3614
|
-
function DashboardGrid({
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
}
|
|
3619
|
-
|
|
3849
|
+
function DashboardGrid(_a) {
|
|
3850
|
+
var _b = _a, {
|
|
3851
|
+
preset = "insights",
|
|
3852
|
+
className
|
|
3853
|
+
} = _b, props = __objRest(_b, [
|
|
3854
|
+
"preset",
|
|
3855
|
+
"className"
|
|
3856
|
+
]);
|
|
3857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", __spreadValues({ className: cn(presetClass[preset], className) }, props));
|
|
3620
3858
|
}
|
|
3621
3859
|
|
|
3622
3860
|
// src/components/dashboard/DashboardFiltersBar.tsx
|
|
3623
3861
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3624
|
-
function DashboardFiltersBar(
|
|
3862
|
+
function DashboardFiltersBar(_a) {
|
|
3863
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
3625
3864
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3626
3865
|
"div",
|
|
3627
|
-
{
|
|
3866
|
+
__spreadValues({
|
|
3628
3867
|
className: cn(
|
|
3629
3868
|
"flex flex-wrap items-center gap-2 rounded-[var(--ph-radius-app)] border border-solid bg-ph-surface px-3 py-2 text-sm text-ph-subtle [border-color:var(--ph-border-control)]",
|
|
3630
3869
|
"[box-shadow:var(--ph-chrome-inset-face-top),var(--ph-chrome-inset-face-bottom),var(--ph-shadow-elevation-3000)]",
|
|
3631
3870
|
className
|
|
3632
|
-
)
|
|
3633
|
-
|
|
3634
|
-
}
|
|
3871
|
+
)
|
|
3872
|
+
}, props)
|
|
3635
3873
|
);
|
|
3636
3874
|
}
|
|
3637
3875
|
|
|
3638
3876
|
// src/components/dashboard/DashboardKpiCard.tsx
|
|
3639
3877
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3640
|
-
function DashboardKpiCard(
|
|
3641
|
-
|
|
3878
|
+
function DashboardKpiCard(_a) {
|
|
3879
|
+
var _b = _a, { label, value, footer, icon, className, children } = _b, props = __objRest(_b, ["label", "value", "footer", "icon", "className", "children"]);
|
|
3880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("article", __spreadProps(__spreadValues({ className: cn("ph-stat", className) }, props), { children: [
|
|
3642
3881
|
icon != null ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mb-2 [&>svg]:h-7 [&>svg]:w-7", children: icon }) : null,
|
|
3643
3882
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ph-stat-label", children: label }),
|
|
3644
3883
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ph-stat-val", children: value }),
|
|
3645
3884
|
footer != null ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "mt-1 text-xs text-ph-subtle", children: footer }) : null,
|
|
3646
3885
|
children
|
|
3647
|
-
] });
|
|
3886
|
+
] }));
|
|
3648
3887
|
}
|
|
3649
3888
|
|
|
3650
3889
|
// src/components/dashboard/DashboardInsightPlaceholder.tsx
|
|
3651
3890
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3652
|
-
function DashboardInsightPlaceholder({
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
}
|
|
3891
|
+
function DashboardInsightPlaceholder(_a) {
|
|
3892
|
+
var _b = _a, {
|
|
3893
|
+
label = "Add insight",
|
|
3894
|
+
className,
|
|
3895
|
+
children,
|
|
3896
|
+
type = "button"
|
|
3897
|
+
} = _b, props = __objRest(_b, [
|
|
3898
|
+
"label",
|
|
3899
|
+
"className",
|
|
3900
|
+
"children",
|
|
3901
|
+
"type"
|
|
3902
|
+
]);
|
|
3659
3903
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3660
3904
|
"button",
|
|
3661
|
-
{
|
|
3905
|
+
__spreadProps(__spreadValues({
|
|
3662
3906
|
type,
|
|
3663
3907
|
"aria-label": label,
|
|
3664
3908
|
className: cn(
|
|
3665
3909
|
"ph-dashboard-placeholder group text-left outline-none transition",
|
|
3666
3910
|
"focus-visible:ring-2 focus-visible:ring-ph-brand focus-visible:ring-offset-2",
|
|
3667
3911
|
className
|
|
3668
|
-
)
|
|
3669
|
-
|
|
3912
|
+
)
|
|
3913
|
+
}, props), {
|
|
3670
3914
|
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "font-medium text-ph-subtle group-hover:text-ph-ink", children: label })
|
|
3671
|
-
}
|
|
3915
|
+
})
|
|
3672
3916
|
);
|
|
3673
3917
|
}
|
|
3674
3918
|
|
|
3675
3919
|
// src/components/dashboard/InsightShell.tsx
|
|
3676
3920
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3677
|
-
function InsightShell({
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
}
|
|
3921
|
+
function InsightShell(_a) {
|
|
3922
|
+
var _b = _a, {
|
|
3923
|
+
ribbonColour,
|
|
3924
|
+
bodyClassName,
|
|
3925
|
+
className,
|
|
3926
|
+
children
|
|
3927
|
+
} = _b, props = __objRest(_b, [
|
|
3928
|
+
"ribbonColour",
|
|
3929
|
+
"bodyClassName",
|
|
3930
|
+
"className",
|
|
3931
|
+
"children"
|
|
3932
|
+
]);
|
|
3684
3933
|
const ribbon = ribbonColour != null && String(ribbonColour).trim() !== "" ? String(ribbonColour).trim() : null;
|
|
3685
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("article", { className: cn("ph-insight-shell flex-row", className),
|
|
3934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("article", __spreadProps(__spreadValues({ className: cn("ph-insight-shell flex-row", className) }, props), { children: [
|
|
3686
3935
|
ribbon != null ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3687
3936
|
"div",
|
|
3688
3937
|
{
|
|
@@ -3692,7 +3941,7 @@ function InsightShell({
|
|
|
3692
3941
|
}
|
|
3693
3942
|
) : null,
|
|
3694
3943
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-3 p-4", bodyClassName), children })
|
|
3695
|
-
] });
|
|
3944
|
+
] }));
|
|
3696
3945
|
}
|
|
3697
3946
|
|
|
3698
3947
|
// src/components/dashboard/InsightShellHeader.tsx
|
|
@@ -3722,7 +3971,10 @@ function MiniTrendBars({
|
|
|
3722
3971
|
seriesResolver,
|
|
3723
3972
|
className
|
|
3724
3973
|
}) {
|
|
3725
|
-
const resolveSeries = seriesResolver
|
|
3974
|
+
const resolveSeries = seriesResolver != null ? seriesResolver : ((i) => {
|
|
3975
|
+
var _a;
|
|
3976
|
+
return (_a = DEFAULT_SERIES_CYCLE[i % DEFAULT_SERIES_CYCLE.length]) != null ? _a : 1;
|
|
3977
|
+
});
|
|
3726
3978
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cn("flex items-end gap-0.5", rowClassName, className), children: heights.map((raw, i) => {
|
|
3727
3979
|
const pct = clampPct(raw);
|
|
3728
3980
|
const series = resolveSeries(i, pct);
|
|
@@ -3737,17 +3989,22 @@ function MiniTrendBars({
|
|
|
3737
3989
|
|
|
3738
3990
|
// src/components/dashboard/InsightMiniCard.tsx
|
|
3739
3991
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3740
|
-
function InsightMiniCard({
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3992
|
+
function InsightMiniCard(_a) {
|
|
3993
|
+
var _b = _a, {
|
|
3994
|
+
title,
|
|
3995
|
+
subtitle,
|
|
3996
|
+
heights,
|
|
3997
|
+
ribbonColour
|
|
3998
|
+
} = _b, shellProps = __objRest(_b, [
|
|
3999
|
+
"title",
|
|
4000
|
+
"subtitle",
|
|
4001
|
+
"heights",
|
|
4002
|
+
"ribbonColour"
|
|
4003
|
+
]);
|
|
4004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(InsightShell, __spreadProps(__spreadValues({ ribbonColour }, shellProps), { children: [
|
|
3748
4005
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(InsightShellHeader, { title, subtitle }),
|
|
3749
4006
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(MiniTrendBars, { heights })
|
|
3750
|
-
] });
|
|
4007
|
+
] }));
|
|
3751
4008
|
}
|
|
3752
4009
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3753
4010
|
0 && (module.exports = {
|