@deepnoid/ui 1.0.22 → 1.0.23
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-Q3SNUBIS.mjs +114 -0
- package/dist/components/breadcrumb/breadcrumb.mjs +3 -2
- package/dist/components/breadcrumb/index.mjs +3 -2
- package/dist/components/button/image-button.d.mts +194 -0
- package/dist/components/button/image-button.d.ts +194 -0
- package/dist/components/button/image-button.js +5572 -0
- package/dist/components/button/image-button.mjs +16 -0
- package/dist/components/button/index.d.mts +1 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +93 -0
- package/dist/components/button/index.mjs +8 -4
- package/dist/components/fileUpload/fileUpload.mjs +3 -2
- package/dist/components/fileUpload/index.mjs +3 -2
- package/dist/components/list/index.mjs +3 -3
- package/dist/components/modal/GlobalModalProvider.mjs +3 -2
- package/dist/components/modal/index.mjs +3 -2
- package/dist/components/modal/modal.mjs +3 -2
- package/dist/components/modal/useGlobalModal.mjs +3 -2
- package/dist/components/picker/datePicker.mjs +4 -3
- package/dist/components/picker/index.mjs +4 -3
- package/dist/components/picker/timePicker/Panel.mjs +3 -2
- package/dist/components/picker/timePicker/index.mjs +3 -2
- package/dist/components/select/index.mjs +3 -2
- package/dist/components/select/select.mjs +3 -2
- package/dist/components/table/index.mjs +7 -7
- package/dist/components/table/table-body.mjs +4 -4
- package/dist/components/table/table-head.mjs +4 -4
- package/dist/components/table/table.mjs +4 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +740 -647
- package/dist/index.mjs +64 -60
- package/package.json +1 -1
- package/dist/{chunk-W7ECZ3MW.mjs → chunk-7K3EB4DC.mjs} +3 -3
- /package/dist/{chunk-MY5U63QO.mjs → chunk-WG2WVMAR.mjs} +0 -0
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
GlobalModalProvider: () => GlobalModalProvider,
|
|
53
53
|
Icon: () => Icon_default,
|
|
54
54
|
IconButton: () => icon_button_default,
|
|
55
|
+
ImageButton: () => image_button_default,
|
|
55
56
|
Input: () => input_default,
|
|
56
57
|
List: () => list_default,
|
|
57
58
|
ListItem: () => listItem_default,
|
|
@@ -5464,7 +5465,7 @@ var backdropStyle = tv({
|
|
|
5464
5465
|
});
|
|
5465
5466
|
|
|
5466
5467
|
// src/components/breadcrumb/breadcrumb.tsx
|
|
5467
|
-
var
|
|
5468
|
+
var import_react11 = require("react");
|
|
5468
5469
|
|
|
5469
5470
|
// src/components/icon/Icon.tsx
|
|
5470
5471
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -6436,10 +6437,101 @@ var buttonGroup = tv({
|
|
|
6436
6437
|
}
|
|
6437
6438
|
});
|
|
6438
6439
|
|
|
6439
|
-
// src/components/
|
|
6440
|
+
// src/components/button/image-button.tsx
|
|
6441
|
+
var import_react10 = require("react");
|
|
6440
6442
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6441
|
-
|
|
6443
|
+
var ImageButton = (0, import_react10.forwardRef)((props, ref) => {
|
|
6444
|
+
const [localProps, variantProps] = mapPropsVariants(props, imageButtonStyle.variantKeys);
|
|
6445
|
+
const { classNames, src, alt, disableRipple, disabled, isLoading, size, isInGroup, onMouseDown, ...buttonProps } = {
|
|
6446
|
+
...localProps,
|
|
6447
|
+
...variantProps
|
|
6448
|
+
};
|
|
6449
|
+
const slots = (0, import_react10.useMemo)(() => imageButtonStyle({ ...variantProps }), [variantProps]);
|
|
6450
|
+
const { onPress, onClear, ripples } = useRipple();
|
|
6451
|
+
const handleRipple = (0, import_react10.useCallback)(
|
|
6452
|
+
(e) => {
|
|
6453
|
+
if (!disableRipple && !disabled) {
|
|
6454
|
+
onPress(e);
|
|
6455
|
+
}
|
|
6456
|
+
},
|
|
6457
|
+
[disableRipple, disabled, onPress]
|
|
6458
|
+
);
|
|
6459
|
+
const handleMouseDown = (0, import_react10.useCallback)(
|
|
6460
|
+
(e) => {
|
|
6461
|
+
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
6462
|
+
handleRipple(e);
|
|
6463
|
+
},
|
|
6464
|
+
[onMouseDown, handleRipple]
|
|
6465
|
+
);
|
|
6466
|
+
const rippleProps = (0, import_react10.useMemo)(() => ({ ripples, onClear }), [ripples, onClear]);
|
|
6442
6467
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6468
|
+
"button",
|
|
6469
|
+
{
|
|
6470
|
+
...buttonProps,
|
|
6471
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
6472
|
+
"data-loading": isLoading,
|
|
6473
|
+
disabled: disabled || isLoading,
|
|
6474
|
+
onMouseDown: handleMouseDown,
|
|
6475
|
+
ref,
|
|
6476
|
+
style: { padding: 0, ...buttonProps.style },
|
|
6477
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon_default, { className: "animate-spin", name: "loading", size }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src, alt, className: slots.image({ class: classNames == null ? void 0 : classNames.image }) }),
|
|
6479
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ripple_default, { ...rippleProps })
|
|
6480
|
+
] })
|
|
6481
|
+
}
|
|
6482
|
+
);
|
|
6483
|
+
});
|
|
6484
|
+
ImageButton.displayName = "ImageButton";
|
|
6485
|
+
var image_button_default = ImageButton;
|
|
6486
|
+
var imageButtonStyle = tv({
|
|
6487
|
+
extend: buttonBaseStyle,
|
|
6488
|
+
slots: {
|
|
6489
|
+
base: [],
|
|
6490
|
+
image: ["object-cover", "object-center"]
|
|
6491
|
+
},
|
|
6492
|
+
variants: {
|
|
6493
|
+
size: {
|
|
6494
|
+
sm: {
|
|
6495
|
+
base: ["w-[24px]", "h-[24px]", "rounded-sm"],
|
|
6496
|
+
image: ["w-[12px]", "h-[12px]"]
|
|
6497
|
+
},
|
|
6498
|
+
md: {
|
|
6499
|
+
base: ["w-[32px]", "h-[32px]", "rounded-md"],
|
|
6500
|
+
image: ["w-[14px]", "h-[14px]"]
|
|
6501
|
+
},
|
|
6502
|
+
lg: {
|
|
6503
|
+
base: ["w-[40px]", "h-[40px]", "rounded-lg"],
|
|
6504
|
+
image: ["w-[16px]", "h-[16px]"]
|
|
6505
|
+
},
|
|
6506
|
+
xl: {
|
|
6507
|
+
base: ["w-[50px]", "h-[50px]", "rounded-xl"],
|
|
6508
|
+
image: ["w-[18px]", "h-[18px]"]
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
full: {
|
|
6512
|
+
true: {
|
|
6513
|
+
base: ["w-full", "h-full"]
|
|
6514
|
+
}
|
|
6515
|
+
},
|
|
6516
|
+
isLoading: {
|
|
6517
|
+
true: {}
|
|
6518
|
+
}
|
|
6519
|
+
},
|
|
6520
|
+
defaultVariants: {
|
|
6521
|
+
size: "md",
|
|
6522
|
+
variant: "solid",
|
|
6523
|
+
color: "primary",
|
|
6524
|
+
full: false,
|
|
6525
|
+
disabled: false,
|
|
6526
|
+
isLoading: false,
|
|
6527
|
+
isInGroup: false
|
|
6528
|
+
}
|
|
6529
|
+
});
|
|
6530
|
+
|
|
6531
|
+
// src/components/breadcrumb/breadcrumb.tsx
|
|
6532
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6533
|
+
function BreadcrumbMenu({ label, onClick, isCurrent, size }) {
|
|
6534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6443
6535
|
text_button_default,
|
|
6444
6536
|
{
|
|
6445
6537
|
"aria-label": label,
|
|
@@ -6452,8 +6544,8 @@ function BreadcrumbMenu({ label, onClick, isCurrent, size }) {
|
|
|
6452
6544
|
}
|
|
6453
6545
|
);
|
|
6454
6546
|
}
|
|
6455
|
-
var Breadcrumb = (0,
|
|
6456
|
-
const slots = (0,
|
|
6547
|
+
var Breadcrumb = (0, import_react11.forwardRef)(({ startIconName, size, menus, classNames }, ref) => {
|
|
6548
|
+
const slots = (0, import_react11.useMemo)(() => breadcrumbStyle({ size }), [size]);
|
|
6457
6549
|
const renderMenus = (menus2) => {
|
|
6458
6550
|
const flatMenus = [];
|
|
6459
6551
|
const flatten = (items) => {
|
|
@@ -6468,22 +6560,22 @@ var Breadcrumb = (0, import_react10.forwardRef)(({ startIconName, size, menus, c
|
|
|
6468
6560
|
flatten(menus2);
|
|
6469
6561
|
return flatMenus.map((menu, index) => {
|
|
6470
6562
|
const isLast = index === flatMenus.length - 1;
|
|
6471
|
-
return /* @__PURE__ */ (0,
|
|
6563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
6472
6564
|
"li",
|
|
6473
6565
|
{
|
|
6474
6566
|
"aria-current": isLast ? "page" : void 0,
|
|
6475
6567
|
className: `flex items-center gap-[5px] ${isLast ? "overflow-hidden" : ""}`,
|
|
6476
6568
|
children: [
|
|
6477
|
-
/* @__PURE__ */ (0,
|
|
6478
|
-
!isLast && /* @__PURE__ */ (0,
|
|
6569
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BreadcrumbMenu, { isCurrent: isLast, label: menu.label, onClick: menu.onClick, size }),
|
|
6570
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon_default, { className: slots.separator(), name: "brace-right" })
|
|
6479
6571
|
]
|
|
6480
6572
|
},
|
|
6481
6573
|
`${menu.label}-${index}`
|
|
6482
6574
|
);
|
|
6483
6575
|
});
|
|
6484
6576
|
};
|
|
6485
|
-
return /* @__PURE__ */ (0,
|
|
6486
|
-
startIconName ? /* @__PURE__ */ (0,
|
|
6577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { "aria-label": "Breadcrumb", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("ul", { className: "flex w-full items-center gap-1", children: [
|
|
6578
|
+
startIconName ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon_default, { className: slots.icon(), name: startIconName, size }) }) : null,
|
|
6487
6579
|
renderMenus(menus)
|
|
6488
6580
|
] }) });
|
|
6489
6581
|
});
|
|
@@ -6521,14 +6613,14 @@ var breadcrumbStyle = tv({
|
|
|
6521
6613
|
});
|
|
6522
6614
|
|
|
6523
6615
|
// src/components/input/input.tsx
|
|
6524
|
-
var
|
|
6525
|
-
var
|
|
6526
|
-
var Input = (0,
|
|
6616
|
+
var import_react12 = require("react");
|
|
6617
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6618
|
+
var Input = (0, import_react12.forwardRef)((originalProps, ref) => {
|
|
6527
6619
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
6528
6620
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
6529
|
-
const inputRef = (0,
|
|
6530
|
-
const slots = (0,
|
|
6531
|
-
const getContentProps = (0,
|
|
6621
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
6622
|
+
const slots = (0, import_react12.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
6623
|
+
const getContentProps = (0, import_react12.useCallback)(
|
|
6532
6624
|
() => ({
|
|
6533
6625
|
className: clsx(
|
|
6534
6626
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -6539,18 +6631,18 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6539
6631
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
6540
6632
|
);
|
|
6541
6633
|
const renderStartContent = () => {
|
|
6542
|
-
if ((0,
|
|
6634
|
+
if ((0, import_react12.isValidElement)(startContent)) {
|
|
6543
6635
|
const existingProps = startContent.props;
|
|
6544
6636
|
const mergedProps = {
|
|
6545
6637
|
...getContentProps(),
|
|
6546
6638
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
6547
6639
|
};
|
|
6548
|
-
return (0,
|
|
6640
|
+
return (0, import_react12.cloneElement)(startContent, mergedProps);
|
|
6549
6641
|
}
|
|
6550
6642
|
const contentProps = getContentProps();
|
|
6551
|
-
return /* @__PURE__ */ (0,
|
|
6643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ...contentProps, children: startContent });
|
|
6552
6644
|
};
|
|
6553
|
-
const renderDateTimePickerIcon = () => /* @__PURE__ */ (0,
|
|
6645
|
+
const renderDateTimePickerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6554
6646
|
"div",
|
|
6555
6647
|
{
|
|
6556
6648
|
...getContentProps(),
|
|
@@ -6559,22 +6651,22 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6559
6651
|
target == null ? void 0 : target.focus();
|
|
6560
6652
|
target == null ? void 0 : target.showPicker();
|
|
6561
6653
|
},
|
|
6562
|
-
children: /* @__PURE__ */ (0,
|
|
6654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon_default, { className: "cursor-pointer", name: props.type === "time" ? "clock" : "calendar", size: originalProps.size })
|
|
6563
6655
|
}
|
|
6564
6656
|
);
|
|
6565
6657
|
const renderContentWithIcon = () => {
|
|
6566
|
-
if ((0,
|
|
6658
|
+
if ((0, import_react12.isValidElement)(endContent)) {
|
|
6567
6659
|
const existingProps = endContent.props;
|
|
6568
6660
|
const mergedProps = {
|
|
6569
6661
|
...getContentProps(),
|
|
6570
6662
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
6571
6663
|
};
|
|
6572
|
-
return (0,
|
|
6664
|
+
return (0, import_react12.cloneElement)(endContent, mergedProps);
|
|
6573
6665
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
6574
6666
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
6575
|
-
return /* @__PURE__ */ (0,
|
|
6667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon_default, { fill: true, name: "exclamation-circle", size: originalProps.size }) });
|
|
6576
6668
|
}
|
|
6577
|
-
return /* @__PURE__ */ (0,
|
|
6669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {});
|
|
6578
6670
|
};
|
|
6579
6671
|
const renderEndContent = () => {
|
|
6580
6672
|
switch (props.type) {
|
|
@@ -6588,7 +6680,7 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6588
6680
|
return renderContentWithIcon();
|
|
6589
6681
|
}
|
|
6590
6682
|
};
|
|
6591
|
-
return /* @__PURE__ */ (0,
|
|
6683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6592
6684
|
"div",
|
|
6593
6685
|
{
|
|
6594
6686
|
className: clsx(
|
|
@@ -6596,9 +6688,9 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6596
6688
|
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
6597
6689
|
),
|
|
6598
6690
|
children: [
|
|
6599
|
-
label ? /* @__PURE__ */ (0,
|
|
6600
|
-
/* @__PURE__ */ (0,
|
|
6601
|
-
/* @__PURE__ */ (0,
|
|
6691
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
6692
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper }), children: [
|
|
6693
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
6602
6694
|
"div",
|
|
6603
6695
|
{
|
|
6604
6696
|
className: clsx(
|
|
@@ -6607,7 +6699,7 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6607
6699
|
),
|
|
6608
6700
|
children: [
|
|
6609
6701
|
startContent ? renderStartContent() : null,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6702
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6611
6703
|
"input",
|
|
6612
6704
|
{
|
|
6613
6705
|
ref: ref || inputRef,
|
|
@@ -6621,7 +6713,7 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6621
6713
|
]
|
|
6622
6714
|
}
|
|
6623
6715
|
),
|
|
6624
|
-
helperMessage && !(errorMessage !== void 0) ? /* @__PURE__ */ (0,
|
|
6716
|
+
helperMessage && !(errorMessage !== void 0) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
6625
6717
|
"p",
|
|
6626
6718
|
{
|
|
6627
6719
|
className: clsx(
|
|
@@ -6631,8 +6723,8 @@ var Input = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
6631
6723
|
children: helperMessage
|
|
6632
6724
|
}
|
|
6633
6725
|
) : null,
|
|
6634
|
-
errorMessage && errorMessage.length > 0 ? /* @__PURE__ */ (0,
|
|
6635
|
-
errorMessage === "" && /* @__PURE__ */ (0,
|
|
6726
|
+
errorMessage && errorMessage.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }) : null,
|
|
6727
|
+
errorMessage === "" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { "aria-hidden": "true", className: clsx("error", "sr-only") })
|
|
6636
6728
|
] })
|
|
6637
6729
|
]
|
|
6638
6730
|
}
|
|
@@ -6905,24 +6997,24 @@ var inputStyle = tv(
|
|
|
6905
6997
|
);
|
|
6906
6998
|
|
|
6907
6999
|
// src/components/tabs/tabs.tsx
|
|
6908
|
-
var
|
|
6909
|
-
var
|
|
6910
|
-
var Tabs = (0,
|
|
7000
|
+
var import_react13 = require("react");
|
|
7001
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
7002
|
+
var Tabs = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
6911
7003
|
const [props, variantProps] = mapPropsVariants(originalProps, tabs.variantKeys);
|
|
6912
7004
|
const { data, defaultTabIndex, classNames } = props;
|
|
6913
|
-
const [activeTabIndex, setActiveTabIndex] = (0,
|
|
6914
|
-
const slots = (0,
|
|
6915
|
-
const getBaseProps = (0,
|
|
7005
|
+
const [activeTabIndex, setActiveTabIndex] = (0, import_react13.useState)(defaultTabIndex || 0);
|
|
7006
|
+
const slots = (0, import_react13.useMemo)(() => tabs({ ...variantProps }), [...Object.values(variantProps)]);
|
|
7007
|
+
const getBaseProps = (0, import_react13.useCallback)(() => {
|
|
6916
7008
|
return {
|
|
6917
7009
|
className: slots.base({ class: classNames == null ? void 0 : classNames.base })
|
|
6918
7010
|
};
|
|
6919
7011
|
}, [slots, classNames == null ? void 0 : classNames.base]);
|
|
6920
|
-
const getTabsProps = (0,
|
|
7012
|
+
const getTabsProps = (0, import_react13.useCallback)(() => {
|
|
6921
7013
|
return {
|
|
6922
7014
|
className: slots.tabs({ class: classNames == null ? void 0 : classNames.tabs })
|
|
6923
7015
|
};
|
|
6924
7016
|
}, [slots, classNames == null ? void 0 : classNames.tabs]);
|
|
6925
|
-
const getTabProps = (0,
|
|
7017
|
+
const getTabProps = (0, import_react13.useCallback)(
|
|
6926
7018
|
(index, disabled) => {
|
|
6927
7019
|
return {
|
|
6928
7020
|
className: slots.tab({ class: classNames == null ? void 0 : classNames.tab }),
|
|
@@ -6936,20 +7028,20 @@ var Tabs = (0, import_react12.forwardRef)((originalProps, ref) => {
|
|
|
6936
7028
|
},
|
|
6937
7029
|
[slots, classNames == null ? void 0 : classNames.tab, activeTabIndex]
|
|
6938
7030
|
);
|
|
6939
|
-
const getContentWrapperProps = (0,
|
|
7031
|
+
const getContentWrapperProps = (0, import_react13.useCallback)(() => {
|
|
6940
7032
|
return {
|
|
6941
7033
|
className: slots.contentWrapper({ class: classNames == null ? void 0 : classNames.contentWrapper })
|
|
6942
7034
|
};
|
|
6943
7035
|
}, [slots, classNames == null ? void 0 : classNames.contentWrapper]);
|
|
6944
|
-
const getContentProps = (0,
|
|
7036
|
+
const getContentProps = (0, import_react13.useCallback)(() => {
|
|
6945
7037
|
return {
|
|
6946
7038
|
className: slots.content({ class: classNames == null ? void 0 : classNames.content })
|
|
6947
7039
|
};
|
|
6948
7040
|
}, [slots, classNames == null ? void 0 : classNames.content]);
|
|
6949
|
-
return /* @__PURE__ */ (0,
|
|
6950
|
-
/* @__PURE__ */ (0,
|
|
6951
|
-
/* @__PURE__ */ (0,
|
|
6952
|
-
(tabItem, index) => index === activeTabIndex ? /* @__PURE__ */ (0,
|
|
7041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref, ...getBaseProps(), children: [
|
|
7042
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ...getTabsProps(), children: data == null ? void 0 : data.map((tabItem, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ...getTabProps(index, tabItem.disabled), children: tabItem.title }, `tabs-header-${tabItem.key}`)) }),
|
|
7043
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ...getContentWrapperProps(), children: data == null ? void 0 : data.map(
|
|
7044
|
+
(tabItem, index) => index === activeTabIndex ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ...getContentProps(), children: tabItem.component }, `tabs-content${tabItem.key}`) : null
|
|
6953
7045
|
) })
|
|
6954
7046
|
] });
|
|
6955
7047
|
});
|
|
@@ -7113,17 +7205,17 @@ var tabs = tv({
|
|
|
7113
7205
|
});
|
|
7114
7206
|
|
|
7115
7207
|
// src/components/textarea/textarea.tsx
|
|
7116
|
-
var
|
|
7117
|
-
var
|
|
7118
|
-
var
|
|
7119
|
-
var Textarea = (0,
|
|
7208
|
+
var import_react14 = require("react");
|
|
7209
|
+
var import_tailwind_variants15 = require("tailwind-variants");
|
|
7210
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
7211
|
+
var Textarea = (0, import_react14.forwardRef)((originalProps, ref) => {
|
|
7120
7212
|
var _a, _b;
|
|
7121
7213
|
const [props, variantProps] = mapPropsVariants(originalProps, textareaStyle.variantKeys);
|
|
7122
7214
|
const { classNames, label, helperMessage, errorMessage, rows = 3, ...textareaProps } = props;
|
|
7123
|
-
const [length, setLength] = (0,
|
|
7124
|
-
const innerRef = (0,
|
|
7125
|
-
(0,
|
|
7126
|
-
const autoResize = (0,
|
|
7215
|
+
const [length, setLength] = (0, import_react14.useState)(((_b = (_a = originalProps.value) == null ? void 0 : _a.toString()) != null ? _b : "").length);
|
|
7216
|
+
const innerRef = (0, import_react14.useRef)(null);
|
|
7217
|
+
(0, import_react14.useImperativeHandle)(ref, () => innerRef.current);
|
|
7218
|
+
const autoResize = (0, import_react14.useCallback)(() => {
|
|
7127
7219
|
const el = innerRef.current;
|
|
7128
7220
|
if (!el) return;
|
|
7129
7221
|
el.style.height = "auto";
|
|
@@ -7133,7 +7225,7 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7133
7225
|
const minHeight = lineHeight * minRows;
|
|
7134
7226
|
el.style.height = `${Math.max(el.scrollHeight, minHeight)}px`;
|
|
7135
7227
|
}, [rows]);
|
|
7136
|
-
const handleChange = (0,
|
|
7228
|
+
const handleChange = (0, import_react14.useCallback)(
|
|
7137
7229
|
(e) => {
|
|
7138
7230
|
var _a2;
|
|
7139
7231
|
setLength(e.target.value.length);
|
|
@@ -7142,11 +7234,11 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7142
7234
|
},
|
|
7143
7235
|
[originalProps, autoResize]
|
|
7144
7236
|
);
|
|
7145
|
-
(0,
|
|
7237
|
+
(0, import_react14.useEffect)(() => {
|
|
7146
7238
|
autoResize();
|
|
7147
7239
|
}, [originalProps.value, autoResize]);
|
|
7148
|
-
const slots = (0,
|
|
7149
|
-
return /* @__PURE__ */ (0,
|
|
7240
|
+
const slots = (0, import_react14.useMemo)(() => textareaStyle({ ...variantProps }), [variantProps]);
|
|
7241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
7150
7242
|
"div",
|
|
7151
7243
|
{
|
|
7152
7244
|
className: clsx(
|
|
@@ -7154,8 +7246,8 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7154
7246
|
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
7155
7247
|
),
|
|
7156
7248
|
children: [
|
|
7157
|
-
label ? /* @__PURE__ */ (0,
|
|
7158
|
-
/* @__PURE__ */ (0,
|
|
7249
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
7250
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
7159
7251
|
"div",
|
|
7160
7252
|
{
|
|
7161
7253
|
className: clsx(
|
|
@@ -7163,7 +7255,7 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7163
7255
|
textareaProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
|
|
7164
7256
|
),
|
|
7165
7257
|
children: [
|
|
7166
|
-
/* @__PURE__ */ (0,
|
|
7258
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7167
7259
|
"textarea",
|
|
7168
7260
|
{
|
|
7169
7261
|
ref: innerRef,
|
|
@@ -7174,8 +7266,8 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7174
7266
|
rows
|
|
7175
7267
|
}
|
|
7176
7268
|
),
|
|
7177
|
-
/* @__PURE__ */ (0,
|
|
7178
|
-
helperMessage && errorMessage === void 0 ? /* @__PURE__ */ (0,
|
|
7269
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex justify-between", children: [
|
|
7270
|
+
helperMessage && errorMessage === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7179
7271
|
"p",
|
|
7180
7272
|
{
|
|
7181
7273
|
className: clsx(
|
|
@@ -7185,9 +7277,9 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7185
7277
|
children: helperMessage
|
|
7186
7278
|
}
|
|
7187
7279
|
) : null,
|
|
7188
|
-
errorMessage && errorMessage.length > 0 ? /* @__PURE__ */ (0,
|
|
7189
|
-
errorMessage === "" && /* @__PURE__ */ (0,
|
|
7190
|
-
textareaProps.maxLength !== void 0 && /* @__PURE__ */ (0,
|
|
7280
|
+
errorMessage && errorMessage.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }) : null,
|
|
7281
|
+
errorMessage === "" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { "aria-hidden": "true", className: clsx("error", "sr-only") }),
|
|
7282
|
+
textareaProps.maxLength !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
7191
7283
|
"p",
|
|
7192
7284
|
{
|
|
7193
7285
|
className: clsx(
|
|
@@ -7212,7 +7304,7 @@ var Textarea = (0, import_react13.forwardRef)((originalProps, ref) => {
|
|
|
7212
7304
|
});
|
|
7213
7305
|
Textarea.displayName = "Textarea";
|
|
7214
7306
|
var textarea_default = Textarea;
|
|
7215
|
-
var textareaStyle = (0,
|
|
7307
|
+
var textareaStyle = (0, import_tailwind_variants15.tv)({
|
|
7216
7308
|
slots: {
|
|
7217
7309
|
base: ["group/textarea", "flex", "select-none"],
|
|
7218
7310
|
vertical: ["flex-col"],
|
|
@@ -7422,22 +7514,22 @@ var textareaStyle = (0, import_tailwind_variants14.tv)({
|
|
|
7422
7514
|
});
|
|
7423
7515
|
|
|
7424
7516
|
// src/components/table/table.tsx
|
|
7425
|
-
var
|
|
7426
|
-
var
|
|
7517
|
+
var import_react20 = require("react");
|
|
7518
|
+
var import_tailwind_variants19 = require("tailwind-variants");
|
|
7427
7519
|
|
|
7428
7520
|
// src/components/pagination/pagination.tsx
|
|
7429
|
-
var
|
|
7521
|
+
var import_react16 = require("react");
|
|
7430
7522
|
|
|
7431
7523
|
// src/components/pagination/usePagination.ts
|
|
7432
|
-
var
|
|
7524
|
+
var import_react15 = require("react");
|
|
7433
7525
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
7434
|
-
const startPage = (0,
|
|
7435
|
-
const endPage = (0,
|
|
7436
|
-
const pageList = (0,
|
|
7526
|
+
const startPage = (0, import_react15.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
7527
|
+
const endPage = (0, import_react15.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
7528
|
+
const pageList = (0, import_react15.useMemo)(
|
|
7437
7529
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
7438
7530
|
[startPage, endPage]
|
|
7439
7531
|
);
|
|
7440
|
-
const handleClickMovePage = (0,
|
|
7532
|
+
const handleClickMovePage = (0, import_react15.useCallback)(
|
|
7441
7533
|
(page) => (event) => {
|
|
7442
7534
|
event.preventDefault();
|
|
7443
7535
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -7454,8 +7546,8 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
7454
7546
|
var usePagination_default = usePagination;
|
|
7455
7547
|
|
|
7456
7548
|
// src/components/pagination/pagination.tsx
|
|
7457
|
-
var
|
|
7458
|
-
var Pagination = (0,
|
|
7549
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
7550
|
+
var Pagination = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
7459
7551
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
7460
7552
|
const {
|
|
7461
7553
|
classNames,
|
|
@@ -7469,12 +7561,12 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7469
7561
|
variant,
|
|
7470
7562
|
size
|
|
7471
7563
|
} = { ...props, ...variantProps };
|
|
7472
|
-
const [inputPage, setInputPage] = (0,
|
|
7564
|
+
const [inputPage, setInputPage] = (0, import_react16.useState)(currentPage);
|
|
7473
7565
|
const isFirstPageDisabled = currentPage <= 1;
|
|
7474
7566
|
const isPrevPageDisabled = currentPage <= 1;
|
|
7475
7567
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
7476
7568
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
7477
|
-
const slots = (0,
|
|
7569
|
+
const slots = (0, import_react16.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
7478
7570
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
7479
7571
|
currentPage,
|
|
7480
7572
|
totalPage,
|
|
@@ -7489,10 +7581,10 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7489
7581
|
}
|
|
7490
7582
|
}
|
|
7491
7583
|
};
|
|
7492
|
-
return /* @__PURE__ */ (0,
|
|
7493
|
-
/* @__PURE__ */ (0,
|
|
7494
|
-
/* @__PURE__ */ (0,
|
|
7495
|
-
showFirstLastButtons ? /* @__PURE__ */ (0,
|
|
7584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: [
|
|
7585
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
7586
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex", children: [
|
|
7587
|
+
showFirstLastButtons ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7496
7588
|
"div",
|
|
7497
7589
|
{
|
|
7498
7590
|
"aria-label": "firstPage",
|
|
@@ -7501,10 +7593,10 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7501
7593
|
}),
|
|
7502
7594
|
"data-disabled": isFirstPageDisabled,
|
|
7503
7595
|
onClick: !isFirstPageDisabled ? handleClickMovePage(1) : void 0,
|
|
7504
|
-
children: /* @__PURE__ */ (0,
|
|
7596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "left-double", size })
|
|
7505
7597
|
}
|
|
7506
7598
|
) : null,
|
|
7507
|
-
/* @__PURE__ */ (0,
|
|
7599
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7508
7600
|
"div",
|
|
7509
7601
|
{
|
|
7510
7602
|
"aria-label": "prevPage",
|
|
@@ -7513,11 +7605,11 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7513
7605
|
}),
|
|
7514
7606
|
"data-disabled": isPrevPageDisabled,
|
|
7515
7607
|
onClick: !isPrevPageDisabled ? handleClickMovePage(currentPage - 1) : void 0,
|
|
7516
|
-
children: /* @__PURE__ */ (0,
|
|
7608
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "left", size })
|
|
7517
7609
|
}
|
|
7518
7610
|
)
|
|
7519
7611
|
] }),
|
|
7520
|
-
showPageNumber ? pageList.map((page, index) => /* @__PURE__ */ (0,
|
|
7612
|
+
showPageNumber ? pageList.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7521
7613
|
"div",
|
|
7522
7614
|
{
|
|
7523
7615
|
className: slots.button({ class: classNames == null ? void 0 : classNames.button }),
|
|
@@ -7527,8 +7619,8 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7527
7619
|
},
|
|
7528
7620
|
index
|
|
7529
7621
|
)) : null,
|
|
7530
|
-
/* @__PURE__ */ (0,
|
|
7531
|
-
/* @__PURE__ */ (0,
|
|
7622
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex", children: [
|
|
7623
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7532
7624
|
"div",
|
|
7533
7625
|
{
|
|
7534
7626
|
"aria-label": "nextPage",
|
|
@@ -7537,10 +7629,10 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7537
7629
|
}),
|
|
7538
7630
|
"data-disabled": isNextPageDisabled,
|
|
7539
7631
|
onClick: !isNextPageDisabled ? handleClickMovePage(currentPage + 1) : void 0,
|
|
7540
|
-
children: /* @__PURE__ */ (0,
|
|
7632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "right", size })
|
|
7541
7633
|
}
|
|
7542
7634
|
),
|
|
7543
|
-
showFirstLastButtons ? /* @__PURE__ */ (0,
|
|
7635
|
+
showFirstLastButtons ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7544
7636
|
"div",
|
|
7545
7637
|
{
|
|
7546
7638
|
"aria-label": "lastPage",
|
|
@@ -7549,13 +7641,13 @@ var Pagination = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7549
7641
|
}),
|
|
7550
7642
|
"data-disabled": isLastPageDisabled,
|
|
7551
7643
|
onClick: !isLastPageDisabled ? handleClickMovePage(totalPage) : void 0,
|
|
7552
|
-
children: /* @__PURE__ */ (0,
|
|
7644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "right-double", size })
|
|
7553
7645
|
}
|
|
7554
7646
|
) : null
|
|
7555
7647
|
] })
|
|
7556
7648
|
] }),
|
|
7557
|
-
showPageLabel ? /* @__PURE__ */ (0,
|
|
7558
|
-
/* @__PURE__ */ (0,
|
|
7649
|
+
showPageLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: [
|
|
7650
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
7559
7651
|
input_default,
|
|
7560
7652
|
{
|
|
7561
7653
|
classNames: {
|
|
@@ -7765,14 +7857,14 @@ var paginationStyle = tv(
|
|
|
7765
7857
|
);
|
|
7766
7858
|
|
|
7767
7859
|
// src/components/scroll/scrollArea.tsx
|
|
7768
|
-
var
|
|
7769
|
-
var
|
|
7860
|
+
var import_tailwind_variants17 = require("tailwind-variants");
|
|
7861
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7770
7862
|
function ScrollArea({ children, className, direction, size, variant }) {
|
|
7771
|
-
return /* @__PURE__ */ (0,
|
|
7863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: clsx(scrollAreaStyle({ direction, size, variant }), className), children });
|
|
7772
7864
|
}
|
|
7773
7865
|
ScrollArea.displayName = "ScrollArea";
|
|
7774
7866
|
var scrollArea_default = ScrollArea;
|
|
7775
|
-
var scrollAreaStyle = (0,
|
|
7867
|
+
var scrollAreaStyle = (0, import_tailwind_variants17.tv)({
|
|
7776
7868
|
base: ["w-full", "h-full", "tw-scrollbar-base"],
|
|
7777
7869
|
variants: {
|
|
7778
7870
|
direction: {
|
|
@@ -7798,18 +7890,18 @@ var scrollAreaStyle = (0, import_tailwind_variants16.tv)({
|
|
|
7798
7890
|
});
|
|
7799
7891
|
|
|
7800
7892
|
// src/components/table/table-head.tsx
|
|
7801
|
-
var
|
|
7893
|
+
var import_react18 = require("react");
|
|
7802
7894
|
|
|
7803
7895
|
// src/components/checkbox/checkbox.tsx
|
|
7804
|
-
var
|
|
7805
|
-
var
|
|
7806
|
-
var CheckBox = (0,
|
|
7896
|
+
var import_react17 = require("react");
|
|
7897
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7898
|
+
var CheckBox = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
7807
7899
|
var _a, _b;
|
|
7808
7900
|
const [props, variantProps] = mapPropsVariants(originalProps, checkboxStyle.variantKeys);
|
|
7809
7901
|
const { children, classNames, labelPosition = "end", ...inputProps } = props;
|
|
7810
|
-
const slots = (0,
|
|
7902
|
+
const slots = (0, import_react17.useMemo)(() => checkboxStyle({ ...variantProps }), [variantProps]);
|
|
7811
7903
|
const isSelected = (_b = (_a = inputProps.checked) != null ? _a : inputProps.defaultChecked) != null ? _b : false;
|
|
7812
|
-
return /* @__PURE__ */ (0,
|
|
7904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7813
7905
|
"label",
|
|
7814
7906
|
{
|
|
7815
7907
|
className: clsx(
|
|
@@ -7817,8 +7909,8 @@ var CheckBox = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
7817
7909
|
labelPosition === "start" && slots.labelReverse({ class: classNames == null ? void 0 : classNames.labelReverse })
|
|
7818
7910
|
),
|
|
7819
7911
|
children: [
|
|
7820
|
-
/* @__PURE__ */ (0,
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7912
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { ...inputProps, ref, type: "checkbox" }) }),
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7822
7914
|
CheckBoxIcon,
|
|
7823
7915
|
{
|
|
7824
7916
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
@@ -7826,7 +7918,7 @@ var CheckBox = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
7826
7918
|
size: variantProps.size
|
|
7827
7919
|
}
|
|
7828
7920
|
) }),
|
|
7829
|
-
children ? /* @__PURE__ */ (0,
|
|
7921
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children }) : null
|
|
7830
7922
|
]
|
|
7831
7923
|
}
|
|
7832
7924
|
);
|
|
@@ -7834,7 +7926,7 @@ var CheckBox = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
7834
7926
|
CheckBox.displayName = "CheckBox";
|
|
7835
7927
|
var checkbox_default = CheckBox;
|
|
7836
7928
|
function CheckBoxIcon({ size, isSelected, className }) {
|
|
7837
|
-
const strokeWidth = (0,
|
|
7929
|
+
const strokeWidth = (0, import_react17.useMemo)(() => {
|
|
7838
7930
|
switch (size) {
|
|
7839
7931
|
case "sm":
|
|
7840
7932
|
return 1;
|
|
@@ -7848,7 +7940,7 @@ function CheckBoxIcon({ size, isSelected, className }) {
|
|
|
7848
7940
|
return 1.25;
|
|
7849
7941
|
}
|
|
7850
7942
|
}, [size]);
|
|
7851
|
-
return /* @__PURE__ */ (0,
|
|
7943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className, fill: "none", viewBox: "0 0 13 13", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7852
7944
|
"path",
|
|
7853
7945
|
{
|
|
7854
7946
|
d: "M2.16667 6.90123L5.63334 10.1111L10.8333 2.88889",
|
|
@@ -7980,7 +8072,7 @@ var checkboxStyle = tv({
|
|
|
7980
8072
|
});
|
|
7981
8073
|
|
|
7982
8074
|
// src/components/table/table-head.tsx
|
|
7983
|
-
var
|
|
8075
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7984
8076
|
function TableHeaderCell({
|
|
7985
8077
|
content,
|
|
7986
8078
|
column,
|
|
@@ -7988,9 +8080,9 @@ function TableHeaderCell({
|
|
|
7988
8080
|
slots,
|
|
7989
8081
|
classNames
|
|
7990
8082
|
}) {
|
|
7991
|
-
const thRef = (0,
|
|
7992
|
-
const [showTitle, setShowTitle] = (0,
|
|
7993
|
-
(0,
|
|
8083
|
+
const thRef = (0, import_react18.useRef)(null);
|
|
8084
|
+
const [showTitle, setShowTitle] = (0, import_react18.useState)(false);
|
|
8085
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
7994
8086
|
if (!isCheckbox && thRef.current) {
|
|
7995
8087
|
const el = thRef.current;
|
|
7996
8088
|
setShowTitle(el.scrollWidth > el.clientWidth);
|
|
@@ -7998,7 +8090,7 @@ function TableHeaderCell({
|
|
|
7998
8090
|
}, [content, isCheckbox]);
|
|
7999
8091
|
const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
|
|
8000
8092
|
const titleText = !isCheckbox && showTitle && isTextContent ? String(content) : void 0;
|
|
8001
|
-
return /* @__PURE__ */ (0,
|
|
8093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8002
8094
|
"th",
|
|
8003
8095
|
{
|
|
8004
8096
|
className: clsx(
|
|
@@ -8018,7 +8110,7 @@ function TableHeaderCell({
|
|
|
8018
8110
|
...getCellStyle(column, true)
|
|
8019
8111
|
} : void 0,
|
|
8020
8112
|
title: titleText,
|
|
8021
|
-
children: isTextContent ? content : /* @__PURE__ */ (0,
|
|
8113
|
+
children: isTextContent ? content : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8022
8114
|
"div",
|
|
8023
8115
|
{
|
|
8024
8116
|
className: clsx(
|
|
@@ -8040,8 +8132,8 @@ function TableHead({
|
|
|
8040
8132
|
classNames,
|
|
8041
8133
|
onCheckAll
|
|
8042
8134
|
}) {
|
|
8043
|
-
return /* @__PURE__ */ (0,
|
|
8044
|
-
columns.map((column, idx) => /* @__PURE__ */ (0,
|
|
8135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
8136
|
+
columns.map((column, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8045
8137
|
TableHeaderCell,
|
|
8046
8138
|
{
|
|
8047
8139
|
classNames,
|
|
@@ -8051,11 +8143,11 @@ function TableHead({
|
|
|
8051
8143
|
},
|
|
8052
8144
|
`${column.field}-${idx}`
|
|
8053
8145
|
)),
|
|
8054
|
-
rowCheckbox ? /* @__PURE__ */ (0,
|
|
8146
|
+
rowCheckbox ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8055
8147
|
TableHeaderCell,
|
|
8056
8148
|
{
|
|
8057
8149
|
classNames,
|
|
8058
|
-
content: /* @__PURE__ */ (0,
|
|
8150
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-full w-full items-center justify-center", "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8059
8151
|
checkbox_default,
|
|
8060
8152
|
{
|
|
8061
8153
|
checked: hasCheckedRows,
|
|
@@ -8075,8 +8167,8 @@ function TableHead({
|
|
|
8075
8167
|
var table_head_default = TableHead;
|
|
8076
8168
|
|
|
8077
8169
|
// src/components/table/table-body.tsx
|
|
8078
|
-
var
|
|
8079
|
-
var
|
|
8170
|
+
var import_react19 = require("react");
|
|
8171
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8080
8172
|
function TableCell({
|
|
8081
8173
|
row,
|
|
8082
8174
|
column,
|
|
@@ -8090,15 +8182,15 @@ function TableCell({
|
|
|
8090
8182
|
const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
|
|
8091
8183
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
8092
8184
|
const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
|
|
8093
|
-
const tdRef = (0,
|
|
8094
|
-
const [showTitle, setShowTitle] = (0,
|
|
8095
|
-
(0,
|
|
8185
|
+
const tdRef = (0, import_react19.useRef)(null);
|
|
8186
|
+
const [showTitle, setShowTitle] = (0, import_react19.useState)(false);
|
|
8187
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
8096
8188
|
if (tdRef.current && isTextContent) {
|
|
8097
8189
|
const el = tdRef.current;
|
|
8098
8190
|
setShowTitle(el.scrollWidth > el.clientWidth);
|
|
8099
8191
|
}
|
|
8100
8192
|
}, [content, isTextContent]);
|
|
8101
|
-
return /* @__PURE__ */ (0,
|
|
8193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8102
8194
|
"td",
|
|
8103
8195
|
{
|
|
8104
8196
|
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
|
|
@@ -8112,7 +8204,7 @@ function TableCell({
|
|
|
8112
8204
|
textOverflow: isTextContent ? "ellipsis" : void 0
|
|
8113
8205
|
},
|
|
8114
8206
|
title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
|
|
8115
|
-
children: isTextContent ? content : /* @__PURE__ */ (0,
|
|
8207
|
+
children: isTextContent ? content : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8116
8208
|
"div",
|
|
8117
8209
|
{
|
|
8118
8210
|
className: clsx(
|
|
@@ -8141,19 +8233,19 @@ function TableBody({
|
|
|
8141
8233
|
classNames,
|
|
8142
8234
|
className
|
|
8143
8235
|
}) {
|
|
8144
|
-
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0,
|
|
8236
|
+
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8145
8237
|
"td",
|
|
8146
8238
|
{
|
|
8147
8239
|
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"),
|
|
8148
8240
|
style: { width: "40px", minWidth: "40px", textAlign: "center" },
|
|
8149
|
-
children: /* @__PURE__ */ (0,
|
|
8241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex h-full w-full items-center justify-center", "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(checkbox_default, { checked: checkedRows.has(rowId), onChange: (e) => {
|
|
8150
8242
|
onCheckRow(rowId, e.target.checked);
|
|
8151
8243
|
}, size }) })
|
|
8152
8244
|
},
|
|
8153
8245
|
`checkbox-${rowId}-${rowIndex}`
|
|
8154
8246
|
);
|
|
8155
|
-
const renderEmptyRow = () => /* @__PURE__ */ (0,
|
|
8156
|
-
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0,
|
|
8247
|
+
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), colSpan: columns.length + (rowCheckbox ? 1 : 0), children: emptyContent }) });
|
|
8248
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8157
8249
|
"tr",
|
|
8158
8250
|
{
|
|
8159
8251
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
@@ -8162,7 +8254,7 @@ function TableBody({
|
|
|
8162
8254
|
onRowClick(row, rowIndex, event);
|
|
8163
8255
|
} : void 0,
|
|
8164
8256
|
children: [
|
|
8165
|
-
columns.map((column, colIdx) => /* @__PURE__ */ (0,
|
|
8257
|
+
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8166
8258
|
TableCell,
|
|
8167
8259
|
{
|
|
8168
8260
|
classNames,
|
|
@@ -8179,7 +8271,7 @@ function TableBody({
|
|
|
8179
8271
|
},
|
|
8180
8272
|
`${row.id}-${rowIndex}`
|
|
8181
8273
|
);
|
|
8182
|
-
return /* @__PURE__ */ (0,
|
|
8274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8183
8275
|
"tbody",
|
|
8184
8276
|
{
|
|
8185
8277
|
className: clsx(
|
|
@@ -8195,8 +8287,8 @@ function TableBody({
|
|
|
8195
8287
|
var table_body_default = TableBody;
|
|
8196
8288
|
|
|
8197
8289
|
// src/components/table/table.tsx
|
|
8198
|
-
var
|
|
8199
|
-
var Table = (0,
|
|
8290
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8291
|
+
var Table = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
8200
8292
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
8201
8293
|
const {
|
|
8202
8294
|
rows,
|
|
@@ -8221,8 +8313,8 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8221
8313
|
} = { ...props, ...variantProps };
|
|
8222
8314
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
8223
8315
|
const showPagination = pagination && totalData > 0;
|
|
8224
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
8225
|
-
const tableMinWidth = (0,
|
|
8316
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react20.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
8317
|
+
const tableMinWidth = (0, import_react20.useMemo)(() => {
|
|
8226
8318
|
const columnsWidth = columns.reduce((total, column) => {
|
|
8227
8319
|
if (column.width) return total + column.width;
|
|
8228
8320
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -8231,15 +8323,15 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8231
8323
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
8232
8324
|
return columnsWidth + checkboxWidth;
|
|
8233
8325
|
}, [columns, rowCheckbox]);
|
|
8234
|
-
const prevCheckedRef = (0,
|
|
8235
|
-
(0,
|
|
8326
|
+
const prevCheckedRef = (0, import_react20.useRef)("");
|
|
8327
|
+
(0, import_react20.useEffect)(() => {
|
|
8236
8328
|
const currentCheckedStr = Array.from(checkedRowIds).sort().join(",");
|
|
8237
8329
|
if (prevCheckedRef.current !== currentCheckedStr) {
|
|
8238
8330
|
prevCheckedRef.current = currentCheckedStr;
|
|
8239
8331
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
8240
8332
|
}
|
|
8241
8333
|
}, [checkedRowIds]);
|
|
8242
|
-
(0,
|
|
8334
|
+
(0, import_react20.useEffect)(() => {
|
|
8243
8335
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
8244
8336
|
const ids = Array.from(checkedRowIds);
|
|
8245
8337
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -8251,7 +8343,7 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8251
8343
|
}
|
|
8252
8344
|
}
|
|
8253
8345
|
}, [rows]);
|
|
8254
|
-
(0,
|
|
8346
|
+
(0, import_react20.useImperativeHandle)(
|
|
8255
8347
|
ref,
|
|
8256
8348
|
() => ({
|
|
8257
8349
|
checkedRowIds,
|
|
@@ -8278,19 +8370,19 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8278
8370
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
8279
8371
|
};
|
|
8280
8372
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
8281
|
-
const slots = (0,
|
|
8373
|
+
const slots = (0, import_react20.useMemo)(
|
|
8282
8374
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
8283
8375
|
[variantProps, onRowClick]
|
|
8284
8376
|
);
|
|
8285
|
-
return /* @__PURE__ */ (0,
|
|
8286
|
-
/* @__PURE__ */ (0,
|
|
8377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-table": "base", children: [
|
|
8378
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8287
8379
|
scrollArea_default,
|
|
8288
8380
|
{
|
|
8289
8381
|
className: slots.scroll({ class: classNames == null ? void 0 : classNames.scroll }),
|
|
8290
8382
|
direction: "both",
|
|
8291
8383
|
size: size === "xl" ? "lg" : size,
|
|
8292
8384
|
children: [
|
|
8293
|
-
/* @__PURE__ */ (0,
|
|
8385
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8294
8386
|
"table",
|
|
8295
8387
|
{
|
|
8296
8388
|
className: slots.table({ class: classNames == null ? void 0 : classNames.table }),
|
|
@@ -8300,7 +8392,7 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8300
8392
|
minWidth: `${tableMinWidth}px`
|
|
8301
8393
|
},
|
|
8302
8394
|
children: [
|
|
8303
|
-
/* @__PURE__ */ (0,
|
|
8395
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8304
8396
|
table_head_default,
|
|
8305
8397
|
{
|
|
8306
8398
|
classNames,
|
|
@@ -8313,7 +8405,7 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8313
8405
|
slots
|
|
8314
8406
|
}
|
|
8315
8407
|
),
|
|
8316
|
-
/* @__PURE__ */ (0,
|
|
8408
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8317
8409
|
table_body_default,
|
|
8318
8410
|
{
|
|
8319
8411
|
checkedRows: checkedRowIds,
|
|
@@ -8333,11 +8425,11 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8333
8425
|
]
|
|
8334
8426
|
}
|
|
8335
8427
|
),
|
|
8336
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
8428
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: slots.overlay({ class: classNames == null ? void 0 : classNames.overlay }) }) : null
|
|
8337
8429
|
]
|
|
8338
8430
|
}
|
|
8339
8431
|
),
|
|
8340
|
-
showPagination ? /* @__PURE__ */ (0,
|
|
8432
|
+
showPagination ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8341
8433
|
pagination_default,
|
|
8342
8434
|
{
|
|
8343
8435
|
color,
|
|
@@ -8356,7 +8448,7 @@ var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
8356
8448
|
});
|
|
8357
8449
|
Table.displayName = "Table";
|
|
8358
8450
|
var table_default = Table;
|
|
8359
|
-
var tableStyle = (0,
|
|
8451
|
+
var tableStyle = (0, import_tailwind_variants19.tv)({
|
|
8360
8452
|
slots: {
|
|
8361
8453
|
base: ["flex", "flex-col", "relative", "select-none", "gap-20", "h-full", "min-h-0"],
|
|
8362
8454
|
scroll: [],
|
|
@@ -8596,8 +8688,8 @@ var getCellStyle = (column, isHeader = false) => {
|
|
|
8596
8688
|
};
|
|
8597
8689
|
|
|
8598
8690
|
// src/components/table/definition-table.tsx
|
|
8599
|
-
var
|
|
8600
|
-
var
|
|
8691
|
+
var import_react21 = require("react");
|
|
8692
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8601
8693
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
8602
8694
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
8603
8695
|
var getMaxColCount = (rows) => {
|
|
@@ -8627,9 +8719,9 @@ var renderColGroup = (rows) => {
|
|
|
8627
8719
|
});
|
|
8628
8720
|
const cols = [];
|
|
8629
8721
|
for (let i = 0; i < maxCols; i++) {
|
|
8630
|
-
cols.push(/* @__PURE__ */ (0,
|
|
8722
|
+
cols.push(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("col", { style: { width: colWidths[i] || "auto" } }, i));
|
|
8631
8723
|
}
|
|
8632
|
-
return /* @__PURE__ */ (0,
|
|
8724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("colgroup", { children: cols });
|
|
8633
8725
|
};
|
|
8634
8726
|
var getHighlightColumnIndex = (rows, key) => {
|
|
8635
8727
|
if (!key) return null;
|
|
@@ -8650,7 +8742,7 @@ function DefinitionTableRow({
|
|
|
8650
8742
|
rowCount = 0,
|
|
8651
8743
|
highlightColumnIndex
|
|
8652
8744
|
}) {
|
|
8653
|
-
return /* @__PURE__ */ (0,
|
|
8745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: clsx("border-neutral-light border-b", className), children: cells.map((cell, colIndex) => {
|
|
8654
8746
|
const isFirstCell = colIndex === 0;
|
|
8655
8747
|
const isHighlighted = colIndex === highlightColumnIndex;
|
|
8656
8748
|
const isFirstRow = rowIndex === 0;
|
|
@@ -8682,7 +8774,7 @@ function DefinitionTableRow({
|
|
|
8682
8774
|
} else {
|
|
8683
8775
|
cellStyle = { width: "100%" };
|
|
8684
8776
|
}
|
|
8685
|
-
return /* @__PURE__ */ (0,
|
|
8777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8686
8778
|
"td",
|
|
8687
8779
|
{
|
|
8688
8780
|
className: combinedClassName,
|
|
@@ -8695,18 +8787,18 @@ function DefinitionTableRow({
|
|
|
8695
8787
|
);
|
|
8696
8788
|
}) });
|
|
8697
8789
|
}
|
|
8698
|
-
var DefinitionTable = (0,
|
|
8790
|
+
var DefinitionTable = (0, import_react21.forwardRef)(
|
|
8699
8791
|
({ rows = [], header, footer, highlightColumnKey, classNames }, ref) => {
|
|
8700
|
-
const slots = (0,
|
|
8701
|
-
const highlightColumnIndex = (0,
|
|
8792
|
+
const slots = (0, import_react21.useMemo)(() => DefinitionTableStyle(), []);
|
|
8793
|
+
const highlightColumnIndex = (0, import_react21.useMemo)(
|
|
8702
8794
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
8703
8795
|
[rows, highlightColumnKey]
|
|
8704
8796
|
);
|
|
8705
|
-
const maxColCount = (0,
|
|
8706
|
-
return /* @__PURE__ */ (0,
|
|
8707
|
-
/* @__PURE__ */ (0,
|
|
8797
|
+
const maxColCount = (0, import_react21.useMemo)(() => getMaxColCount(rows), [rows]);
|
|
8798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: clsx(slots.base(), classNames == null ? void 0 : classNames.base), ref, children: [
|
|
8799
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("table", { className: clsx(slots.table(), classNames == null ? void 0 : classNames.table), children: [
|
|
8708
8800
|
renderColGroup(rows),
|
|
8709
|
-
header != null && /* @__PURE__ */ (0,
|
|
8801
|
+
header != null && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8710
8802
|
"th",
|
|
8711
8803
|
{
|
|
8712
8804
|
className: clsx(slots.header(), classNames == null ? void 0 : classNames.header),
|
|
@@ -8714,7 +8806,7 @@ var DefinitionTable = (0, import_react20.forwardRef)(
|
|
|
8714
8806
|
children: header
|
|
8715
8807
|
}
|
|
8716
8808
|
) }) }),
|
|
8717
|
-
/* @__PURE__ */ (0,
|
|
8809
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8718
8810
|
DefinitionTableRow,
|
|
8719
8811
|
{
|
|
8720
8812
|
...row,
|
|
@@ -8726,7 +8818,7 @@ var DefinitionTable = (0, import_react20.forwardRef)(
|
|
|
8726
8818
|
i
|
|
8727
8819
|
)) })
|
|
8728
8820
|
] }),
|
|
8729
|
-
footer ? /* @__PURE__ */ (0,
|
|
8821
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: footer }) : null
|
|
8730
8822
|
] });
|
|
8731
8823
|
}
|
|
8732
8824
|
);
|
|
@@ -8754,11 +8846,11 @@ var DefinitionTableStyle = tv({
|
|
|
8754
8846
|
});
|
|
8755
8847
|
|
|
8756
8848
|
// src/components/select/select.tsx
|
|
8757
|
-
var
|
|
8849
|
+
var import_react22 = require("react");
|
|
8758
8850
|
var import_react_dom = require("react-dom");
|
|
8759
|
-
var
|
|
8851
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
8760
8852
|
var ALL_OPTION_VALUE = "__ALL__";
|
|
8761
|
-
var Select = (0,
|
|
8853
|
+
var Select = (0, import_react22.forwardRef)((originalProps, ref) => {
|
|
8762
8854
|
var _a, _b, _c;
|
|
8763
8855
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
8764
8856
|
const {
|
|
@@ -8777,14 +8869,14 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8777
8869
|
clearable,
|
|
8778
8870
|
...inputProps
|
|
8779
8871
|
} = props;
|
|
8780
|
-
const slots = (0,
|
|
8781
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
8782
|
-
const [targetRect, setTargetRect] = (0,
|
|
8783
|
-
const [optionWrapperHeight, setOptionWrapperHeight] = (0,
|
|
8784
|
-
const [isVisible, setIsVisible] = (0,
|
|
8785
|
-
const [isOpen, setIsOpen] = (0,
|
|
8786
|
-
const selectWrapperRef = (0,
|
|
8787
|
-
const optionWrapperRef = (0,
|
|
8872
|
+
const slots = (0, import_react22.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
8873
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react22.useState)(defaultSelectedOptions || []);
|
|
8874
|
+
const [targetRect, setTargetRect] = (0, import_react22.useState)(null);
|
|
8875
|
+
const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react22.useState)(0);
|
|
8876
|
+
const [isVisible, setIsVisible] = (0, import_react22.useState)(false);
|
|
8877
|
+
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
8878
|
+
const selectWrapperRef = (0, import_react22.useRef)(null);
|
|
8879
|
+
const optionWrapperRef = (0, import_react22.useRef)(null);
|
|
8788
8880
|
const isControlled = originalProps.value !== void 0;
|
|
8789
8881
|
const openSelect = () => {
|
|
8790
8882
|
if (selectWrapperRef.current) {
|
|
@@ -8837,7 +8929,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8837
8929
|
setSelectedOptions([]);
|
|
8838
8930
|
onChange == null ? void 0 : onChange([]);
|
|
8839
8931
|
};
|
|
8840
|
-
(0,
|
|
8932
|
+
(0, import_react22.useEffect)(() => {
|
|
8841
8933
|
const handleClickOutside = (e) => {
|
|
8842
8934
|
var _a2;
|
|
8843
8935
|
const target = e.target;
|
|
@@ -8850,12 +8942,12 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8850
8942
|
window.removeEventListener("mousedown", handleClickOutside);
|
|
8851
8943
|
};
|
|
8852
8944
|
}, []);
|
|
8853
|
-
(0,
|
|
8945
|
+
(0, import_react22.useEffect)(() => {
|
|
8854
8946
|
if (optionWrapperRef.current) {
|
|
8855
8947
|
setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
|
|
8856
8948
|
}
|
|
8857
8949
|
}, [targetRect]);
|
|
8858
|
-
(0,
|
|
8950
|
+
(0, import_react22.useEffect)(() => {
|
|
8859
8951
|
if (isControlled) {
|
|
8860
8952
|
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
8861
8953
|
const matched = options.filter((opt) => valueArray.includes(opt.value));
|
|
@@ -8886,7 +8978,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8886
8978
|
renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
|
|
8887
8979
|
}
|
|
8888
8980
|
return (0, import_react_dom.createPortal)(
|
|
8889
|
-
/* @__PURE__ */ (0,
|
|
8981
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8890
8982
|
"div",
|
|
8891
8983
|
{
|
|
8892
8984
|
className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
|
|
@@ -8904,7 +8996,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8904
8996
|
},
|
|
8905
8997
|
children: renderedOptions.map((option) => {
|
|
8906
8998
|
const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
|
|
8907
|
-
return /* @__PURE__ */ (0,
|
|
8999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
8908
9000
|
"div",
|
|
8909
9001
|
{
|
|
8910
9002
|
className: clsx(
|
|
@@ -8916,9 +9008,9 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8916
9008
|
},
|
|
8917
9009
|
role: "option",
|
|
8918
9010
|
children: [
|
|
8919
|
-
optionIconName && optionIconPlacement === "start" ? /* @__PURE__ */ (0,
|
|
9011
|
+
optionIconName && optionIconPlacement === "start" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { name: optionIconName, size: originalProps.size }) : null,
|
|
8920
9012
|
option.label,
|
|
8921
|
-
optionIconName && optionIconPlacement === "end" ? /* @__PURE__ */ (0,
|
|
9013
|
+
optionIconName && optionIconPlacement === "end" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { name: optionIconName, size: originalProps.size }) : null
|
|
8922
9014
|
]
|
|
8923
9015
|
},
|
|
8924
9016
|
option.value
|
|
@@ -8929,8 +9021,8 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8929
9021
|
document.body
|
|
8930
9022
|
);
|
|
8931
9023
|
};
|
|
8932
|
-
return /* @__PURE__ */ (0,
|
|
8933
|
-
/* @__PURE__ */ (0,
|
|
9024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
9025
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
8934
9026
|
"div",
|
|
8935
9027
|
{
|
|
8936
9028
|
className: clsx(
|
|
@@ -8938,9 +9030,9 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8938
9030
|
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
8939
9031
|
),
|
|
8940
9032
|
children: [
|
|
8941
|
-
label ? /* @__PURE__ */ (0,
|
|
8942
|
-
/* @__PURE__ */ (0,
|
|
8943
|
-
/* @__PURE__ */ (0,
|
|
9033
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
9035
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
8944
9036
|
"div",
|
|
8945
9037
|
{
|
|
8946
9038
|
className: clsx(
|
|
@@ -8951,7 +9043,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8951
9043
|
onClick: handleToggleSelect,
|
|
8952
9044
|
ref: selectWrapperRef,
|
|
8953
9045
|
children: [
|
|
8954
|
-
/* @__PURE__ */ (0,
|
|
9046
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8955
9047
|
"input",
|
|
8956
9048
|
{
|
|
8957
9049
|
...inputProps,
|
|
@@ -8966,8 +9058,8 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8966
9058
|
value: displayValue
|
|
8967
9059
|
}
|
|
8968
9060
|
),
|
|
8969
|
-
/* @__PURE__ */ (0,
|
|
8970
|
-
clearable && selectedOptions.length > 0 ? /* @__PURE__ */ (0,
|
|
9061
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { name: inputProps.name, type: "hidden", value: selectedValue }),
|
|
9062
|
+
clearable && selectedOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8971
9063
|
icon_button_default,
|
|
8972
9064
|
{
|
|
8973
9065
|
classNames: { base: "pr-[2px]" },
|
|
@@ -8978,7 +9070,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8978
9070
|
variant: "ghost"
|
|
8979
9071
|
}
|
|
8980
9072
|
) : null,
|
|
8981
|
-
/* @__PURE__ */ (0,
|
|
9073
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8982
9074
|
Icon_default,
|
|
8983
9075
|
{
|
|
8984
9076
|
className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`,
|
|
@@ -8989,8 +9081,8 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8989
9081
|
]
|
|
8990
9082
|
}
|
|
8991
9083
|
),
|
|
8992
|
-
helperMessage && !errorMessage ? /* @__PURE__ */ (0,
|
|
8993
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
9084
|
+
helperMessage && !errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }) : null,
|
|
9085
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }) : null
|
|
8994
9086
|
] })
|
|
8995
9087
|
]
|
|
8996
9088
|
}
|
|
@@ -9256,16 +9348,16 @@ var select = tv({
|
|
|
9256
9348
|
});
|
|
9257
9349
|
|
|
9258
9350
|
// src/components/chip/chip.tsx
|
|
9259
|
-
var
|
|
9260
|
-
var
|
|
9261
|
-
var Chip = (0,
|
|
9351
|
+
var import_react23 = require("react");
|
|
9352
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9353
|
+
var Chip = (0, import_react23.forwardRef)((originalProps, ref) => {
|
|
9262
9354
|
var _a;
|
|
9263
9355
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, chipStyle.variantKeys);
|
|
9264
9356
|
const props = { ...rawProps, ...variantProps };
|
|
9265
9357
|
const Component = props.onClick ? "button" : "div";
|
|
9266
|
-
const slots = (0,
|
|
9267
|
-
const renderIcon = (name) => name ? /* @__PURE__ */ (0,
|
|
9268
|
-
return /* @__PURE__ */ (0,
|
|
9358
|
+
const slots = (0, import_react23.useMemo)(() => chipStyle({ ...variantProps }), [variantProps]);
|
|
9359
|
+
const renderIcon = (name) => name ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon_default, { className: slots.icon(), fill: true, name, size: props.size }) : null;
|
|
9360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
9269
9361
|
Component,
|
|
9270
9362
|
{
|
|
9271
9363
|
"aria-label": props.label,
|
|
@@ -9444,13 +9536,13 @@ var chipStyle = tv({
|
|
|
9444
9536
|
});
|
|
9445
9537
|
|
|
9446
9538
|
// src/components/radio/radio.tsx
|
|
9447
|
-
var
|
|
9448
|
-
var
|
|
9449
|
-
var Radio = (0,
|
|
9539
|
+
var import_react24 = require("react");
|
|
9540
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9541
|
+
var Radio = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
9450
9542
|
const [props, variantProps] = mapPropsVariants(originalProps, radioStyle.variantKeys);
|
|
9451
9543
|
const { children, classNames, labelPosition = "end", error, ...inputProps } = props;
|
|
9452
|
-
const slots = (0,
|
|
9453
|
-
return /* @__PURE__ */ (0,
|
|
9544
|
+
const slots = (0, import_react24.useMemo)(() => radioStyle({ ...variantProps, isInvalid: error }), [variantProps, error]);
|
|
9545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
9454
9546
|
"label",
|
|
9455
9547
|
{
|
|
9456
9548
|
className: clsx(
|
|
@@ -9458,9 +9550,9 @@ var Radio = (0, import_react23.forwardRef)((originalProps, ref) => {
|
|
|
9458
9550
|
labelPosition === "start" && slots.labelReverse({ class: classNames == null ? void 0 : classNames.labelReverse })
|
|
9459
9551
|
),
|
|
9460
9552
|
children: [
|
|
9461
|
-
/* @__PURE__ */ (0,
|
|
9462
|
-
/* @__PURE__ */ (0,
|
|
9463
|
-
/* @__PURE__ */ (0,
|
|
9553
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { ...inputProps, ref, type: "radio" }) }),
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: slots.innerDot({ class: classNames == null ? void 0 : classNames.innerDot }) }) }),
|
|
9555
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: slots.labelWrapper({ class: classNames == null ? void 0 : classNames.labelWrapper }), children: children ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children }) : null })
|
|
9464
9556
|
]
|
|
9465
9557
|
}
|
|
9466
9558
|
);
|
|
@@ -9601,18 +9693,18 @@ var radioStyle = tv({
|
|
|
9601
9693
|
});
|
|
9602
9694
|
|
|
9603
9695
|
// src/components/switch/switch.tsx
|
|
9604
|
-
var
|
|
9605
|
-
var
|
|
9606
|
-
var
|
|
9607
|
-
var Switch = (0,
|
|
9696
|
+
var import_react25 = require("react");
|
|
9697
|
+
var import_tailwind_variants24 = require("tailwind-variants");
|
|
9698
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9699
|
+
var Switch = (0, import_react25.forwardRef)((originalProps, ref) => {
|
|
9608
9700
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, switchStyle.variantKeys);
|
|
9609
9701
|
const { size, color, disabled, disableAnimation, id, checked, onChange, classNames, ...inputProps } = {
|
|
9610
9702
|
...rawProps,
|
|
9611
9703
|
...variantProps
|
|
9612
9704
|
};
|
|
9613
|
-
const slots = (0,
|
|
9614
|
-
return /* @__PURE__ */ (0,
|
|
9615
|
-
/* @__PURE__ */ (0,
|
|
9705
|
+
const slots = (0, import_react25.useMemo)(() => switchStyle({ ...variantProps }), [variantProps]);
|
|
9706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
9707
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9616
9708
|
"input",
|
|
9617
9709
|
{
|
|
9618
9710
|
...inputProps,
|
|
@@ -9625,12 +9717,12 @@ var Switch = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
|
9625
9717
|
type: "checkbox"
|
|
9626
9718
|
}
|
|
9627
9719
|
),
|
|
9628
|
-
/* @__PURE__ */ (0,
|
|
9720
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: slots.thumb({ class: classNames == null ? void 0 : classNames.thumb }) }) })
|
|
9629
9721
|
] });
|
|
9630
9722
|
});
|
|
9631
9723
|
Switch.displayName = "Switch";
|
|
9632
9724
|
var switch_default = Switch;
|
|
9633
|
-
var switchStyle = (0,
|
|
9725
|
+
var switchStyle = (0, import_tailwind_variants24.tv)({
|
|
9634
9726
|
slots: {
|
|
9635
9727
|
base: ["group/switch", "relative", "max-w-fit", "inline-flex", "items-center", "justify-start", "cursor-pointer"],
|
|
9636
9728
|
wrapper: [
|
|
@@ -9732,7 +9824,7 @@ var switchStyle = (0, import_tailwind_variants23.tv)({
|
|
|
9732
9824
|
});
|
|
9733
9825
|
|
|
9734
9826
|
// src/components/tooltip/tooltip.tsx
|
|
9735
|
-
var
|
|
9827
|
+
var import_react27 = require("react");
|
|
9736
9828
|
var import_react_dom2 = require("react-dom");
|
|
9737
9829
|
|
|
9738
9830
|
// src/components/tooltip/tooltip-utils.ts
|
|
@@ -9855,11 +9947,11 @@ var getTailStyles = (placement) => {
|
|
|
9855
9947
|
};
|
|
9856
9948
|
|
|
9857
9949
|
// src/components/tooltip/useTooltip.ts
|
|
9858
|
-
var
|
|
9950
|
+
var import_react26 = require("react");
|
|
9859
9951
|
var useTooltip = ({ placement, offset, targetRect }) => {
|
|
9860
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
9861
|
-
const tooltipRef = (0,
|
|
9862
|
-
(0,
|
|
9952
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react26.useState)({ x: 0, y: 0 });
|
|
9953
|
+
const tooltipRef = (0, import_react26.useRef)(null);
|
|
9954
|
+
(0, import_react26.useEffect)(() => {
|
|
9863
9955
|
if (targetRect && tooltipRef.current) {
|
|
9864
9956
|
const { width, height } = tooltipRef.current.getBoundingClientRect();
|
|
9865
9957
|
const scrollX = window.scrollX;
|
|
@@ -9889,29 +9981,29 @@ var useTooltip = ({ placement, offset, targetRect }) => {
|
|
|
9889
9981
|
};
|
|
9890
9982
|
|
|
9891
9983
|
// src/components/tooltip/tooltip.tsx
|
|
9892
|
-
var
|
|
9893
|
-
var Tooltip = (0,
|
|
9984
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
9985
|
+
var Tooltip = (0, import_react27.forwardRef)((originalProps, ref) => {
|
|
9894
9986
|
const [props, variantProps] = mapPropsVariants(originalProps, tooltipStyle.variantKeys);
|
|
9895
9987
|
const { placement = "top", offset = 5, delay = 100, persistent = false, classNames, noTouchContent } = props;
|
|
9896
|
-
const slots = (0,
|
|
9897
|
-
const [targetRect, setTargetRect] = (0,
|
|
9988
|
+
const slots = (0, import_react27.useMemo)(() => tooltipStyle({ ...variantProps }), [variantProps]);
|
|
9989
|
+
const [targetRect, setTargetRect] = (0, import_react27.useState)(null);
|
|
9898
9990
|
const { tooltipPosition, tooltipRef } = useTooltip({
|
|
9899
9991
|
placement,
|
|
9900
9992
|
offset,
|
|
9901
9993
|
delay,
|
|
9902
9994
|
targetRect
|
|
9903
9995
|
});
|
|
9904
|
-
const childrenRef = (0,
|
|
9905
|
-
const delayTimeoutRef = (0,
|
|
9906
|
-
const getProps = (0,
|
|
9996
|
+
const childrenRef = (0, import_react27.useRef)(null);
|
|
9997
|
+
const delayTimeoutRef = (0, import_react27.useRef)(null);
|
|
9998
|
+
const getProps = (0, import_react27.useCallback)(
|
|
9907
9999
|
(slotKey, classNameKey) => ({
|
|
9908
10000
|
className: slots[slotKey]({ class: classNames == null ? void 0 : classNames[classNameKey] })
|
|
9909
10001
|
}),
|
|
9910
10002
|
[slots, classNames]
|
|
9911
10003
|
);
|
|
9912
|
-
const getBaseProps = (0,
|
|
9913
|
-
const getContentProps = (0,
|
|
9914
|
-
const showTooltip = (0,
|
|
10004
|
+
const getBaseProps = (0, import_react27.useCallback)(() => getProps("base", "base"), [getProps]);
|
|
10005
|
+
const getContentProps = (0, import_react27.useCallback)(() => getProps("content", "content"), [getProps]);
|
|
10006
|
+
const showTooltip = (0, import_react27.useCallback)(() => {
|
|
9915
10007
|
if (childrenRef.current) {
|
|
9916
10008
|
const rect = childrenRef.current.getBoundingClientRect();
|
|
9917
10009
|
setTargetRect({
|
|
@@ -9924,18 +10016,18 @@ var Tooltip = (0, import_react26.forwardRef)((originalProps, ref) => {
|
|
|
9924
10016
|
});
|
|
9925
10017
|
}
|
|
9926
10018
|
}, []);
|
|
9927
|
-
const hideTooltip = (0,
|
|
10019
|
+
const hideTooltip = (0, import_react27.useCallback)(() => {
|
|
9928
10020
|
if (!persistent) {
|
|
9929
10021
|
delayTimeoutRef.current = window.setTimeout(() => {
|
|
9930
10022
|
setTargetRect(null);
|
|
9931
10023
|
}, delay);
|
|
9932
10024
|
}
|
|
9933
10025
|
}, [persistent, delay]);
|
|
9934
|
-
(0,
|
|
10026
|
+
(0, import_react27.useEffect)(() => {
|
|
9935
10027
|
if (persistent) showTooltip();
|
|
9936
10028
|
}, [persistent, showTooltip]);
|
|
9937
|
-
return /* @__PURE__ */ (0,
|
|
9938
|
-
/* @__PURE__ */ (0,
|
|
10029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
10030
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9939
10031
|
"div",
|
|
9940
10032
|
{
|
|
9941
10033
|
ref: (node) => {
|
|
@@ -9952,7 +10044,7 @@ var Tooltip = (0, import_react26.forwardRef)((originalProps, ref) => {
|
|
|
9952
10044
|
}
|
|
9953
10045
|
),
|
|
9954
10046
|
targetRect ? (0, import_react_dom2.createPortal)(
|
|
9955
|
-
/* @__PURE__ */ (0,
|
|
10047
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9956
10048
|
"div",
|
|
9957
10049
|
{
|
|
9958
10050
|
ref: tooltipRef,
|
|
@@ -9965,7 +10057,7 @@ var Tooltip = (0, import_react26.forwardRef)((originalProps, ref) => {
|
|
|
9965
10057
|
},
|
|
9966
10058
|
children: [
|
|
9967
10059
|
props.content,
|
|
9968
|
-
variantProps.tail ? /* @__PURE__ */ (0,
|
|
10060
|
+
variantProps.tail ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9969
10061
|
"div",
|
|
9970
10062
|
{
|
|
9971
10063
|
className: `absolute h-2 w-2 rotate-45 bg-inherit ${getTailClassName(placement)}`,
|
|
@@ -10016,10 +10108,10 @@ var tooltipStyle = tv({
|
|
|
10016
10108
|
});
|
|
10017
10109
|
|
|
10018
10110
|
// src/components/modal/modal.tsx
|
|
10019
|
-
var
|
|
10111
|
+
var import_react28 = require("react");
|
|
10020
10112
|
var import_react_dom3 = require("react-dom");
|
|
10021
|
-
var
|
|
10022
|
-
var Modal = (0,
|
|
10113
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
10114
|
+
var Modal = (0, import_react28.forwardRef)((props, ref) => {
|
|
10023
10115
|
const [localProps, variantProps] = mapPropsVariants(props, modal.variantKeys);
|
|
10024
10116
|
const {
|
|
10025
10117
|
isOpen,
|
|
@@ -10038,8 +10130,8 @@ var Modal = (0, import_react27.forwardRef)((props, ref) => {
|
|
|
10038
10130
|
...restProps
|
|
10039
10131
|
} = localProps;
|
|
10040
10132
|
const variant = props.variant || "horizontal";
|
|
10041
|
-
const slots = (0,
|
|
10042
|
-
(0,
|
|
10133
|
+
const slots = (0, import_react28.useMemo)(() => modal(variantProps), [variantProps]);
|
|
10134
|
+
(0, import_react28.useEffect)(() => {
|
|
10043
10135
|
document.body.classList.toggle("overflow-hidden", Boolean(isOpen));
|
|
10044
10136
|
if (!isOpen || isKeyboardDismissDisabled) return;
|
|
10045
10137
|
const handleKeyDown = (e) => {
|
|
@@ -10053,11 +10145,11 @@ var Modal = (0, import_react27.forwardRef)((props, ref) => {
|
|
|
10053
10145
|
}, [isOpen, isKeyboardDismissDisabled, onCancel]);
|
|
10054
10146
|
if (!isOpen) return null;
|
|
10055
10147
|
return (0, import_react_dom3.createPortal)(
|
|
10056
|
-
/* @__PURE__ */ (0,
|
|
10057
|
-
hasBackdrop ? /* @__PURE__ */ (0,
|
|
10058
|
-
/* @__PURE__ */ (0,
|
|
10059
|
-
iconName || title ? /* @__PURE__ */ (0,
|
|
10060
|
-
iconName ? /* @__PURE__ */ (0,
|
|
10148
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
10149
|
+
hasBackdrop ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(backdrop_default, { open: true }) : null,
|
|
10150
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, ...restProps, children: [
|
|
10151
|
+
iconName || title ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper }), children: [
|
|
10152
|
+
iconName ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10061
10153
|
Icon_default,
|
|
10062
10154
|
{
|
|
10063
10155
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
@@ -10066,14 +10158,14 @@ var Modal = (0, import_react27.forwardRef)((props, ref) => {
|
|
|
10066
10158
|
size: variant === "vertical" ? 40 : 30
|
|
10067
10159
|
}
|
|
10068
10160
|
) : null,
|
|
10069
|
-
title ? /* @__PURE__ */ (0,
|
|
10161
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }) : null
|
|
10070
10162
|
] }) : null,
|
|
10071
|
-
showCloseButton ? /* @__PURE__ */ (0,
|
|
10072
|
-
typeof content === "string" ? /* @__PURE__ */ (0,
|
|
10073
|
-
cancelButtonText || confirmButtonText ? /* @__PURE__ */ (0,
|
|
10074
|
-
/* @__PURE__ */ (0,
|
|
10075
|
-
cancelButtonText ? /* @__PURE__ */ (0,
|
|
10076
|
-
confirmButtonText ? /* @__PURE__ */ (0,
|
|
10163
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon_default, { className: slots.closeIcon({ class: classNames == null ? void 0 : classNames.closeIcon }), name: "close", onClick: onCancel }) : null,
|
|
10164
|
+
typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: slots.content({ class: classNames == null ? void 0 : classNames.content }), children: content }) : content,
|
|
10165
|
+
cancelButtonText || confirmButtonText ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.footerWrapper({ class: classNames == null ? void 0 : classNames.footerWrapper }), children: [
|
|
10166
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.footer({ class: classNames == null ? void 0 : classNames.footer }), children: [
|
|
10167
|
+
cancelButtonText ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(button_default, { color: props.color, full: true, onClick: onCancel, variant: "outline", children: cancelButtonText }) : null,
|
|
10168
|
+
confirmButtonText ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(button_default, { color: props.color, full: true, onClick: onConfirm, children: confirmButtonText }) : null
|
|
10077
10169
|
] }),
|
|
10078
10170
|
extraFooter
|
|
10079
10171
|
] }) : null
|
|
@@ -10138,22 +10230,22 @@ var modal = tv({
|
|
|
10138
10230
|
});
|
|
10139
10231
|
|
|
10140
10232
|
// src/components/modal/GlobalModalProvider.tsx
|
|
10141
|
-
var
|
|
10142
|
-
var
|
|
10143
|
-
var GlobalModalContext = (0,
|
|
10233
|
+
var import_react29 = require("react");
|
|
10234
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
10235
|
+
var GlobalModalContext = (0, import_react29.createContext)(void 0);
|
|
10144
10236
|
function GlobalModalProvider({ children }) {
|
|
10145
10237
|
var _a;
|
|
10146
|
-
const [modalConfig, setModalConfig] = (0,
|
|
10147
|
-
const open = (0,
|
|
10238
|
+
const [modalConfig, setModalConfig] = (0, import_react29.useState)(null);
|
|
10239
|
+
const open = (0, import_react29.useCallback)((config) => {
|
|
10148
10240
|
setModalConfig(config);
|
|
10149
10241
|
}, []);
|
|
10150
|
-
const close = (0,
|
|
10242
|
+
const close = (0, import_react29.useCallback)(() => {
|
|
10151
10243
|
setModalConfig(null);
|
|
10152
10244
|
}, []);
|
|
10153
|
-
const value = (0,
|
|
10154
|
-
return /* @__PURE__ */ (0,
|
|
10245
|
+
const value = (0, import_react29.useMemo)(() => ({ open, close }), [open, close]);
|
|
10246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(GlobalModalContext.Provider, { value, children: [
|
|
10155
10247
|
children,
|
|
10156
|
-
modalConfig ? /* @__PURE__ */ (0,
|
|
10248
|
+
modalConfig ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
10157
10249
|
modal_default,
|
|
10158
10250
|
{
|
|
10159
10251
|
cancelButtonText: modalConfig.cancelButtonText,
|
|
@@ -10173,9 +10265,9 @@ function GlobalModalProvider({ children }) {
|
|
|
10173
10265
|
}
|
|
10174
10266
|
|
|
10175
10267
|
// src/components/modal/useGlobalModal.tsx
|
|
10176
|
-
var
|
|
10268
|
+
var import_react30 = require("react");
|
|
10177
10269
|
var useGlobalModal = () => {
|
|
10178
|
-
const context = (0,
|
|
10270
|
+
const context = (0, import_react30.useContext)(GlobalModalContext);
|
|
10179
10271
|
if (context === void 0) {
|
|
10180
10272
|
throw new Error("useGlobalModal must be used within a GlobalModalProvider");
|
|
10181
10273
|
}
|
|
@@ -10183,18 +10275,18 @@ var useGlobalModal = () => {
|
|
|
10183
10275
|
};
|
|
10184
10276
|
|
|
10185
10277
|
// src/components/drawer/drawer.tsx
|
|
10186
|
-
var
|
|
10278
|
+
var import_react31 = require("react");
|
|
10187
10279
|
var import_react_dom4 = require("react-dom");
|
|
10188
|
-
var
|
|
10189
|
-
var Drawer = (0,
|
|
10280
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
10281
|
+
var Drawer = (0, import_react31.forwardRef)((props, ref) => {
|
|
10190
10282
|
const [localProps, variantProps] = mapPropsVariants(props, drawer.variantKeys);
|
|
10191
10283
|
const { classNames, isOpen, content, isKeyboardDismissDisabled = false, onClose, backdrop = true } = localProps;
|
|
10192
10284
|
const position = props.position || "right";
|
|
10193
|
-
const [shouldRender, setShouldRender] = (0,
|
|
10194
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
10195
|
-
const [isContentAnimating, setIsContentAnimating] = (0,
|
|
10196
|
-
const slots = (0,
|
|
10197
|
-
(0,
|
|
10285
|
+
const [shouldRender, setShouldRender] = (0, import_react31.useState)(isOpen);
|
|
10286
|
+
const [isAnimating, setIsAnimating] = (0, import_react31.useState)(isOpen);
|
|
10287
|
+
const [isContentAnimating, setIsContentAnimating] = (0, import_react31.useState)(isOpen);
|
|
10288
|
+
const slots = (0, import_react31.useMemo)(() => drawer(variantProps), [variantProps]);
|
|
10289
|
+
(0, import_react31.useEffect)(() => {
|
|
10198
10290
|
if (isOpen) {
|
|
10199
10291
|
setShouldRender(true);
|
|
10200
10292
|
requestAnimationFrame(() => {
|
|
@@ -10214,7 +10306,7 @@ var Drawer = (0, import_react30.forwardRef)((props, ref) => {
|
|
|
10214
10306
|
};
|
|
10215
10307
|
}
|
|
10216
10308
|
}, [isOpen]);
|
|
10217
|
-
(0,
|
|
10309
|
+
(0, import_react31.useEffect)(() => {
|
|
10218
10310
|
if (shouldRender) {
|
|
10219
10311
|
document.body.classList.add("overflow-hidden");
|
|
10220
10312
|
} else {
|
|
@@ -10249,7 +10341,7 @@ var Drawer = (0, import_react30.forwardRef)((props, ref) => {
|
|
|
10249
10341
|
};
|
|
10250
10342
|
if (!shouldRender) return null;
|
|
10251
10343
|
return (0, import_react_dom4.createPortal)(
|
|
10252
|
-
/* @__PURE__ */ (0,
|
|
10344
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
10253
10345
|
"div",
|
|
10254
10346
|
{
|
|
10255
10347
|
"aria-labelledby": "drawer",
|
|
@@ -10264,8 +10356,8 @@ var Drawer = (0, import_react30.forwardRef)((props, ref) => {
|
|
|
10264
10356
|
ref,
|
|
10265
10357
|
role: "dialog",
|
|
10266
10358
|
children: [
|
|
10267
|
-
backdrop ? /* @__PURE__ */ (0,
|
|
10268
|
-
/* @__PURE__ */ (0,
|
|
10359
|
+
backdrop ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "absolute inset-0 bg-black/50 backdrop-blur-sm", onClick: onClose }) : null,
|
|
10360
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
10269
10361
|
"div",
|
|
10270
10362
|
{
|
|
10271
10363
|
className: slots.drawerWrapper({
|
|
@@ -10274,7 +10366,7 @@ var Drawer = (0, import_react30.forwardRef)((props, ref) => {
|
|
|
10274
10366
|
onClick: (e) => {
|
|
10275
10367
|
e.stopPropagation();
|
|
10276
10368
|
},
|
|
10277
|
-
children: /* @__PURE__ */ (0,
|
|
10369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: content })
|
|
10278
10370
|
}
|
|
10279
10371
|
)
|
|
10280
10372
|
]
|
|
@@ -10347,15 +10439,15 @@ var drawer = tv({
|
|
|
10347
10439
|
var drawer_default = Drawer;
|
|
10348
10440
|
|
|
10349
10441
|
// src/components/list/list.tsx
|
|
10350
|
-
var
|
|
10351
|
-
var
|
|
10352
|
-
var List = (0,
|
|
10442
|
+
var import_react32 = require("react");
|
|
10443
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
10444
|
+
var List = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
10353
10445
|
const [props, variantProps] = mapPropsVariants(originalProps, listStyle.variantKeys);
|
|
10354
10446
|
const { children, classNames } = props;
|
|
10355
|
-
const slots = (0,
|
|
10356
|
-
return /* @__PURE__ */ (0,
|
|
10357
|
-
if (!(0,
|
|
10358
|
-
return (0,
|
|
10447
|
+
const slots = (0, import_react32.useMemo)(() => listStyle(variantProps), [variantProps]);
|
|
10448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: import_react32.Children.map(children, (child) => {
|
|
10449
|
+
if (!(0, import_react32.isValidElement)(child)) return child;
|
|
10450
|
+
return (0, import_react32.cloneElement)(child, {
|
|
10359
10451
|
...variantProps,
|
|
10360
10452
|
...child.props
|
|
10361
10453
|
});
|
|
@@ -10392,9 +10484,9 @@ var listStyle = tv({
|
|
|
10392
10484
|
});
|
|
10393
10485
|
|
|
10394
10486
|
// src/components/list/listItem.tsx
|
|
10395
|
-
var
|
|
10396
|
-
var
|
|
10397
|
-
var ListItem = (0,
|
|
10487
|
+
var import_react33 = require("react");
|
|
10488
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10489
|
+
var ListItem = (0, import_react33.forwardRef)((props, ref) => {
|
|
10398
10490
|
const [rawProps, variantProps] = mapPropsVariants(props, listItemStyle.variantKeys);
|
|
10399
10491
|
const {
|
|
10400
10492
|
title,
|
|
@@ -10406,19 +10498,19 @@ var ListItem = (0, import_react32.forwardRef)((props, ref) => {
|
|
|
10406
10498
|
classNames,
|
|
10407
10499
|
onClick
|
|
10408
10500
|
} = { ...rawProps, ...variantProps };
|
|
10409
|
-
const slots = (0,
|
|
10501
|
+
const slots = (0, import_react33.useMemo)(() => listItemStyle(variantProps), [variantProps]);
|
|
10410
10502
|
const iconSize = ["lg", "xl"].includes(size) ? "lg" : "md";
|
|
10411
10503
|
const avatarSize = iconSize;
|
|
10412
|
-
return /* @__PURE__ */ (0,
|
|
10413
|
-
/* @__PURE__ */ (0,
|
|
10414
|
-
avatar ? /* @__PURE__ */ (0,
|
|
10415
|
-
startIconName ? /* @__PURE__ */ (0,
|
|
10416
|
-
/* @__PURE__ */ (0,
|
|
10417
|
-
/* @__PURE__ */ (0,
|
|
10418
|
-
subTitle ? /* @__PURE__ */ (0,
|
|
10504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-selected": selected, onClick, ref, children: [
|
|
10505
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
10506
|
+
avatar ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(avatar_default, { ...avatar, size: avatarSize, variant: "round" }) : null,
|
|
10507
|
+
startIconName ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { className: slots.startIcon({ class: classNames == null ? void 0 : classNames.startIcon }), fill: true, name: startIconName, size }) : null,
|
|
10508
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper }), children: [
|
|
10509
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
10510
|
+
subTitle ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: slots.subTitle({ class: classNames == null ? void 0 : classNames.subTitle }), children: subTitle }) : null
|
|
10419
10511
|
] })
|
|
10420
10512
|
] }),
|
|
10421
|
-
/* @__PURE__ */ (0,
|
|
10513
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon_default, { className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), name: "right-chevron", size: iconSize })
|
|
10422
10514
|
] });
|
|
10423
10515
|
});
|
|
10424
10516
|
ListItem.displayName = "ListItem";
|
|
@@ -10586,9 +10678,9 @@ var listItemStyle = tv({
|
|
|
10586
10678
|
});
|
|
10587
10679
|
|
|
10588
10680
|
// src/components/toast/toast.tsx
|
|
10589
|
-
var
|
|
10590
|
-
var
|
|
10591
|
-
var Toast = (0,
|
|
10681
|
+
var import_react34 = require("react");
|
|
10682
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10683
|
+
var Toast = (0, import_react34.forwardRef)((originalProps, ref) => {
|
|
10592
10684
|
const [props, variantProps] = mapPropsVariants(originalProps, toast.variantKeys);
|
|
10593
10685
|
const {
|
|
10594
10686
|
title,
|
|
@@ -10602,9 +10694,9 @@ var Toast = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
10602
10694
|
disableAnimation,
|
|
10603
10695
|
onClose
|
|
10604
10696
|
} = { ...props, ...variantProps };
|
|
10605
|
-
const slots = (0,
|
|
10606
|
-
const toastRef = (0,
|
|
10607
|
-
(0,
|
|
10697
|
+
const slots = (0, import_react34.useMemo)(() => toast({ ...variantProps }), [variantProps]);
|
|
10698
|
+
const toastRef = (0, import_react34.useRef)(null);
|
|
10699
|
+
(0, import_react34.useImperativeHandle)(
|
|
10608
10700
|
ref,
|
|
10609
10701
|
() => ({
|
|
10610
10702
|
getWidth: () => {
|
|
@@ -10615,7 +10707,7 @@ var Toast = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
10615
10707
|
[]
|
|
10616
10708
|
);
|
|
10617
10709
|
const animationClass = (placement == null ? void 0 : placement.includes("top")) ? "animate-slideInFromTop" : "animate-slideInFromBottom";
|
|
10618
|
-
return /* @__PURE__ */ (0,
|
|
10710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
10619
10711
|
"div",
|
|
10620
10712
|
{
|
|
10621
10713
|
className: clsx(
|
|
@@ -10627,12 +10719,12 @@ var Toast = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
10627
10719
|
ref: toastRef,
|
|
10628
10720
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
10629
10721
|
children: [
|
|
10630
|
-
/* @__PURE__ */ (0,
|
|
10631
|
-
showIcon ? originalProps.isLoading ? /* @__PURE__ */ (0,
|
|
10632
|
-
/* @__PURE__ */ (0,
|
|
10633
|
-
showCloseButton ? /* @__PURE__ */ (0,
|
|
10722
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
10723
|
+
showIcon ? originalProps.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon_default, { className: "mt-[2px] animate-spin", name: "loading" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon_default, { className: "mt-[2px]", fill: true, name: originalProps.icon || "info-circle" }) : null,
|
|
10724
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
10725
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon_default, { className: "cursor-pointer", name: "close", onClick: onClose }) : null
|
|
10634
10726
|
] }),
|
|
10635
|
-
content ? /* @__PURE__ */ (0,
|
|
10727
|
+
content ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: content }) : null
|
|
10636
10728
|
]
|
|
10637
10729
|
}
|
|
10638
10730
|
);
|
|
@@ -10737,7 +10829,7 @@ var toast = tv({
|
|
|
10737
10829
|
});
|
|
10738
10830
|
|
|
10739
10831
|
// src/components/toast/use-toast.tsx
|
|
10740
|
-
var
|
|
10832
|
+
var import_react35 = require("react");
|
|
10741
10833
|
|
|
10742
10834
|
// src/components/toast/toast-utils.ts
|
|
10743
10835
|
var getToastPosition = (placement, width, offset) => {
|
|
@@ -10776,10 +10868,10 @@ var getToastPosition = (placement, width, offset) => {
|
|
|
10776
10868
|
};
|
|
10777
10869
|
|
|
10778
10870
|
// src/components/toast/use-toast.tsx
|
|
10779
|
-
var
|
|
10780
|
-
var ToastContext = (0,
|
|
10871
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10872
|
+
var ToastContext = (0, import_react35.createContext)(null);
|
|
10781
10873
|
var useToast = () => {
|
|
10782
|
-
const context = (0,
|
|
10874
|
+
const context = (0, import_react35.useContext)(ToastContext);
|
|
10783
10875
|
if (!context) {
|
|
10784
10876
|
throw new Error("useToast must be used within a ToastProvider");
|
|
10785
10877
|
}
|
|
@@ -10789,11 +10881,11 @@ function ToastProvider({
|
|
|
10789
10881
|
globalOptions,
|
|
10790
10882
|
children
|
|
10791
10883
|
}) {
|
|
10792
|
-
const [toasts, setToasts] = (0,
|
|
10793
|
-
const [containerStyle, setContainerStyle] = (0,
|
|
10794
|
-
const toastRef = (0,
|
|
10795
|
-
const timersRef = (0,
|
|
10796
|
-
const startTimer = (0,
|
|
10884
|
+
const [toasts, setToasts] = (0, import_react35.useState)([]);
|
|
10885
|
+
const [containerStyle, setContainerStyle] = (0, import_react35.useState)({});
|
|
10886
|
+
const toastRef = (0, import_react35.useRef)(null);
|
|
10887
|
+
const timersRef = (0, import_react35.useRef)(/* @__PURE__ */ new Map());
|
|
10888
|
+
const startTimer = (0, import_react35.useCallback)((id, duration) => {
|
|
10797
10889
|
const existing = timersRef.current.get(id);
|
|
10798
10890
|
if (existing) clearTimeout(existing);
|
|
10799
10891
|
if (!isFinite(duration) || duration <= 0) {
|
|
@@ -10806,14 +10898,14 @@ function ToastProvider({
|
|
|
10806
10898
|
}, duration);
|
|
10807
10899
|
timersRef.current.set(id, timer);
|
|
10808
10900
|
}, []);
|
|
10809
|
-
const clearTimer = (0,
|
|
10901
|
+
const clearTimer = (0, import_react35.useCallback)((id) => {
|
|
10810
10902
|
const timer = timersRef.current.get(id);
|
|
10811
10903
|
if (timer) {
|
|
10812
10904
|
clearTimeout(timer);
|
|
10813
10905
|
timersRef.current.delete(id);
|
|
10814
10906
|
}
|
|
10815
10907
|
}, []);
|
|
10816
|
-
(0,
|
|
10908
|
+
(0, import_react35.useEffect)(() => {
|
|
10817
10909
|
const timers = timersRef.current;
|
|
10818
10910
|
return () => {
|
|
10819
10911
|
timers.forEach((timer) => {
|
|
@@ -10822,7 +10914,7 @@ function ToastProvider({
|
|
|
10822
10914
|
timers.clear();
|
|
10823
10915
|
};
|
|
10824
10916
|
}, []);
|
|
10825
|
-
const addToast = (0,
|
|
10917
|
+
const addToast = (0, import_react35.useCallback)(
|
|
10826
10918
|
(title, options = {}) => {
|
|
10827
10919
|
var _a, _b;
|
|
10828
10920
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
@@ -10840,14 +10932,14 @@ function ToastProvider({
|
|
|
10840
10932
|
},
|
|
10841
10933
|
[globalOptions, startTimer]
|
|
10842
10934
|
);
|
|
10843
|
-
const removeToast = (0,
|
|
10935
|
+
const removeToast = (0, import_react35.useCallback)(
|
|
10844
10936
|
(id) => {
|
|
10845
10937
|
clearTimer(id);
|
|
10846
10938
|
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
10847
10939
|
},
|
|
10848
10940
|
[clearTimer]
|
|
10849
10941
|
);
|
|
10850
|
-
const updateToast = (0,
|
|
10942
|
+
const updateToast = (0, import_react35.useCallback)(
|
|
10851
10943
|
(id, options) => {
|
|
10852
10944
|
setToasts(
|
|
10853
10945
|
(prev) => prev.map((t) => {
|
|
@@ -10865,7 +10957,7 @@ function ToastProvider({
|
|
|
10865
10957
|
},
|
|
10866
10958
|
[globalOptions == null ? void 0 : globalOptions.duration, startTimer]
|
|
10867
10959
|
);
|
|
10868
|
-
const dismissToast = (0,
|
|
10960
|
+
const dismissToast = (0, import_react35.useCallback)(
|
|
10869
10961
|
(id) => {
|
|
10870
10962
|
if (id !== void 0) {
|
|
10871
10963
|
removeToast(id);
|
|
@@ -10879,13 +10971,13 @@ function ToastProvider({
|
|
|
10879
10971
|
},
|
|
10880
10972
|
[removeToast]
|
|
10881
10973
|
);
|
|
10882
|
-
const loadingToast = (0,
|
|
10974
|
+
const loadingToast = (0, import_react35.useCallback)(
|
|
10883
10975
|
(title, options = {}) => {
|
|
10884
10976
|
return addToast(title, { ...options, isLoading: true });
|
|
10885
10977
|
},
|
|
10886
10978
|
[addToast]
|
|
10887
10979
|
);
|
|
10888
|
-
const contextValue = (0,
|
|
10980
|
+
const contextValue = (0, import_react35.useMemo)(() => {
|
|
10889
10981
|
const fn = (title, options) => {
|
|
10890
10982
|
return addToast(title, options);
|
|
10891
10983
|
};
|
|
@@ -10909,7 +11001,7 @@ function ToastProvider({
|
|
|
10909
11001
|
};
|
|
10910
11002
|
return fn;
|
|
10911
11003
|
}, [addToast, loadingToast, updateToast, dismissToast]);
|
|
10912
|
-
(0,
|
|
11004
|
+
(0, import_react35.useEffect)(() => {
|
|
10913
11005
|
var _a;
|
|
10914
11006
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
10915
11007
|
const offset = 20;
|
|
@@ -10923,22 +11015,22 @@ function ToastProvider({
|
|
|
10923
11015
|
right: right !== void 0 ? `${right}px` : void 0
|
|
10924
11016
|
});
|
|
10925
11017
|
}, [globalOptions == null ? void 0 : globalOptions.placement, globalOptions == null ? void 0 : globalOptions.width]);
|
|
10926
|
-
return /* @__PURE__ */ (0,
|
|
11018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(ToastContext.Provider, { value: contextValue, children: [
|
|
10927
11019
|
children,
|
|
10928
|
-
/* @__PURE__ */ (0,
|
|
11020
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col gap-[10px]", id: "deepnoid-toast-container", style: containerStyle, children: toasts.map((toast2) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(toast_default, { onClose: () => {
|
|
10929
11021
|
removeToast(toast2.id);
|
|
10930
11022
|
}, ref: toastRef, ...toast2 }, toast2.id)) })
|
|
10931
11023
|
] });
|
|
10932
11024
|
}
|
|
10933
11025
|
|
|
10934
11026
|
// src/components/picker/day.tsx
|
|
10935
|
-
var
|
|
10936
|
-
var
|
|
10937
|
-
var Day = (0,
|
|
11027
|
+
var import_react36 = require("react");
|
|
11028
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
11029
|
+
var Day = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
10938
11030
|
const [props, variantProps] = mapPropsVariants(originalProps, dayStyle.variantKeys);
|
|
10939
11031
|
const { classNames, children, ...divProps } = props;
|
|
10940
|
-
const slots = (0,
|
|
10941
|
-
return /* @__PURE__ */ (0,
|
|
11032
|
+
const slots = (0, import_react36.useMemo)(() => dayStyle({ ...variantProps }), [variantProps]);
|
|
11033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, ...divProps, children });
|
|
10942
11034
|
});
|
|
10943
11035
|
Day.displayName = "Day";
|
|
10944
11036
|
var day_default = Day;
|
|
@@ -10974,7 +11066,7 @@ var dayStyle = tv({
|
|
|
10974
11066
|
});
|
|
10975
11067
|
|
|
10976
11068
|
// src/components/picker/datePicker.tsx
|
|
10977
|
-
var
|
|
11069
|
+
var import_react37 = require("react");
|
|
10978
11070
|
var import_react_dom5 = require("react-dom");
|
|
10979
11071
|
|
|
10980
11072
|
// src/components/picker/utils.ts
|
|
@@ -11012,8 +11104,8 @@ var getCurrent12Hour = () => {
|
|
|
11012
11104
|
};
|
|
11013
11105
|
|
|
11014
11106
|
// src/components/picker/datePicker.tsx
|
|
11015
|
-
var
|
|
11016
|
-
var DatePicker = (0,
|
|
11107
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
11108
|
+
var DatePicker = (0, import_react37.forwardRef)((originalProps, ref) => {
|
|
11017
11109
|
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
11018
11110
|
const {
|
|
11019
11111
|
classNames,
|
|
@@ -11043,30 +11135,30 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11043
11135
|
enabledDates,
|
|
11044
11136
|
...inputProps
|
|
11045
11137
|
} = { ...props, ...variantProps };
|
|
11046
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
11047
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
11138
|
+
const [selectedDate, setSelectedDate] = (0, import_react37.useState)(range ? "" : typeof value === "string" ? value || "" : "");
|
|
11139
|
+
const [selectedRange, setSelectedRange] = (0, import_react37.useState)({
|
|
11048
11140
|
startDate: range && typeof value === "object" ? value.startDate || "" : "",
|
|
11049
11141
|
endDate: range && typeof value === "object" ? value.endDate || "" : ""
|
|
11050
11142
|
});
|
|
11051
|
-
const [tempSelectedDate, setTempSelectedDate] = (0,
|
|
11052
|
-
const [tempSelectedRange, setTempSelectedRange] = (0,
|
|
11053
|
-
const [rangeSelection, setRangeSelection] = (0,
|
|
11054
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11055
|
-
const [leftCurrentDate, setLeftCurrentDate] = (0,
|
|
11143
|
+
const [tempSelectedDate, setTempSelectedDate] = (0, import_react37.useState)(selectedDate);
|
|
11144
|
+
const [tempSelectedRange, setTempSelectedRange] = (0, import_react37.useState)(selectedRange);
|
|
11145
|
+
const [rangeSelection, setRangeSelection] = (0, import_react37.useState)("start");
|
|
11146
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react37.useState)(false);
|
|
11147
|
+
const [leftCurrentDate, setLeftCurrentDate] = (0, import_react37.useState)(
|
|
11056
11148
|
range && tempSelectedRange.startDate ? new Date(tempSelectedRange.startDate) : tempSelectedDate ? new Date(tempSelectedDate) : /* @__PURE__ */ new Date()
|
|
11057
11149
|
);
|
|
11058
|
-
const [rightCurrentDate, setRightCurrentDate] = (0,
|
|
11150
|
+
const [rightCurrentDate, setRightCurrentDate] = (0, import_react37.useState)(
|
|
11059
11151
|
dualCalendar ? new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1) : /* @__PURE__ */ new Date()
|
|
11060
11152
|
);
|
|
11061
|
-
const inputWrapperRef = (0,
|
|
11062
|
-
const calendarWrapperRef = (0,
|
|
11063
|
-
const [panelPos, setPanelPos] = (0,
|
|
11153
|
+
const inputWrapperRef = (0, import_react37.useRef)(null);
|
|
11154
|
+
const calendarWrapperRef = (0, import_react37.useRef)(null);
|
|
11155
|
+
const [panelPos, setPanelPos] = (0, import_react37.useState)({
|
|
11064
11156
|
top: -9999,
|
|
11065
11157
|
left: -9999,
|
|
11066
11158
|
right: -9999
|
|
11067
11159
|
});
|
|
11068
|
-
const blurTimeoutRef = (0,
|
|
11069
|
-
const isConfirmDisabled = (0,
|
|
11160
|
+
const blurTimeoutRef = (0, import_react37.useRef)(null);
|
|
11161
|
+
const isConfirmDisabled = (0, import_react37.useMemo)(() => {
|
|
11070
11162
|
if (range) {
|
|
11071
11163
|
const hasStart = Boolean(tempSelectedRange.startDate);
|
|
11072
11164
|
const hasEnd = Boolean(tempSelectedRange.endDate);
|
|
@@ -11086,7 +11178,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11086
11178
|
return dateString;
|
|
11087
11179
|
}
|
|
11088
11180
|
};
|
|
11089
|
-
const displayValue = (0,
|
|
11181
|
+
const displayValue = (0, import_react37.useMemo)(() => {
|
|
11090
11182
|
if (range) {
|
|
11091
11183
|
const start = formatDate(selectedRange.startDate);
|
|
11092
11184
|
const end = formatDate(selectedRange.endDate);
|
|
@@ -11096,7 +11188,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11096
11188
|
}
|
|
11097
11189
|
return formatDate(selectedDate);
|
|
11098
11190
|
}, [selectedDate, selectedRange, format, range]);
|
|
11099
|
-
const calculatePosition = (0,
|
|
11191
|
+
const calculatePosition = (0, import_react37.useCallback)(() => {
|
|
11100
11192
|
if (inputWrapperRef.current) {
|
|
11101
11193
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11102
11194
|
if (position === "left-start") {
|
|
@@ -11149,7 +11241,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11149
11241
|
e.preventDefault();
|
|
11150
11242
|
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
11151
11243
|
};
|
|
11152
|
-
const getCalendarDates = (0,
|
|
11244
|
+
const getCalendarDates = (0, import_react37.useCallback)((currentDate) => {
|
|
11153
11245
|
const year = currentDate.getFullYear();
|
|
11154
11246
|
const month = currentDate.getMonth();
|
|
11155
11247
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
@@ -11164,7 +11256,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11164
11256
|
for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
|
|
11165
11257
|
return weeks;
|
|
11166
11258
|
}, []);
|
|
11167
|
-
const isDateDisabled = (0,
|
|
11259
|
+
const isDateDisabled = (0, import_react37.useCallback)(
|
|
11168
11260
|
(date) => {
|
|
11169
11261
|
if (enabledDates) return !enabledDates(date);
|
|
11170
11262
|
if (disabledDates) return disabledDates(date);
|
|
@@ -11241,7 +11333,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11241
11333
|
}
|
|
11242
11334
|
setIsPanelOpen(false);
|
|
11243
11335
|
};
|
|
11244
|
-
const getDayProps = (0,
|
|
11336
|
+
const getDayProps = (0, import_react37.useCallback)(
|
|
11245
11337
|
(dateObj, currentDate) => {
|
|
11246
11338
|
const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date);
|
|
11247
11339
|
if (isDateDisabled(date)) return "disabled";
|
|
@@ -11266,7 +11358,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11266
11358
|
[tempSelectedDate, tempSelectedRange, range, isDateDisabled]
|
|
11267
11359
|
);
|
|
11268
11360
|
const getPlaceholderText = () => placeholder;
|
|
11269
|
-
(0,
|
|
11361
|
+
(0, import_react37.useEffect)(() => {
|
|
11270
11362
|
if (range && typeof value === "object") {
|
|
11271
11363
|
setSelectedRange(value || { startDate: "", endDate: "" });
|
|
11272
11364
|
setTempSelectedRange(value || { startDate: "", endDate: "" });
|
|
@@ -11277,16 +11369,16 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11277
11369
|
if (value) setLeftCurrentDate(new Date(value));
|
|
11278
11370
|
}
|
|
11279
11371
|
}, [value, range]);
|
|
11280
|
-
(0,
|
|
11372
|
+
(0, import_react37.useEffect)(() => {
|
|
11281
11373
|
if (dualCalendar) {
|
|
11282
11374
|
setRightCurrentDate(new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1));
|
|
11283
11375
|
}
|
|
11284
11376
|
}, [leftCurrentDate, dualCalendar]);
|
|
11285
|
-
const slots = (0,
|
|
11286
|
-
const endContent = /* @__PURE__ */ (0,
|
|
11287
|
-
const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0,
|
|
11288
|
-
/* @__PURE__ */ (0,
|
|
11289
|
-
/* @__PURE__ */ (0,
|
|
11377
|
+
const slots = (0, import_react37.useMemo)(() => datePickerStyle({ ...variantProps, dualCalendar }), [variantProps, dualCalendar]);
|
|
11378
|
+
const endContent = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon_default, { className: "cursor-pointer", fill: true, name: "calendar", onClick: handleCalendarIconClick, size });
|
|
11379
|
+
const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-[5px]", children: [
|
|
11380
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
11381
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11290
11382
|
icon_button_default,
|
|
11291
11383
|
{
|
|
11292
11384
|
color: "neutral",
|
|
@@ -11299,12 +11391,12 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11299
11391
|
variant: "soft"
|
|
11300
11392
|
}
|
|
11301
11393
|
),
|
|
11302
|
-
/* @__PURE__ */ (0,
|
|
11303
|
-
/* @__PURE__ */ (0,
|
|
11304
|
-
] }) : /* @__PURE__ */ (0,
|
|
11305
|
-
/* @__PURE__ */ (0,
|
|
11306
|
-
/* @__PURE__ */ (0,
|
|
11307
|
-
/* @__PURE__ */ (0,
|
|
11394
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
11395
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-8" })
|
|
11396
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
11397
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-8" }),
|
|
11398
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
11399
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11308
11400
|
icon_button_default,
|
|
11309
11401
|
{
|
|
11310
11402
|
color: "neutral",
|
|
@@ -11317,8 +11409,8 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11317
11409
|
variant: "soft"
|
|
11318
11410
|
}
|
|
11319
11411
|
)
|
|
11320
|
-
] }) : /* @__PURE__ */ (0,
|
|
11321
|
-
/* @__PURE__ */ (0,
|
|
11412
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11322
11414
|
icon_button_default,
|
|
11323
11415
|
{
|
|
11324
11416
|
color: "neutral",
|
|
@@ -11330,8 +11422,8 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11330
11422
|
variant: "soft"
|
|
11331
11423
|
}
|
|
11332
11424
|
),
|
|
11333
|
-
/* @__PURE__ */ (0,
|
|
11334
|
-
/* @__PURE__ */ (0,
|
|
11425
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
11426
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11335
11427
|
icon_button_default,
|
|
11336
11428
|
{
|
|
11337
11429
|
color: "neutral",
|
|
@@ -11344,10 +11436,10 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11344
11436
|
}
|
|
11345
11437
|
)
|
|
11346
11438
|
] }) }),
|
|
11347
|
-
/* @__PURE__ */ (0,
|
|
11348
|
-
/* @__PURE__ */ (0,
|
|
11439
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
|
|
11440
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react37.Fragment, { children: week.map((dateObj, index) => {
|
|
11349
11441
|
const dayVariant = getDayProps(dateObj, currentDate);
|
|
11350
|
-
return /* @__PURE__ */ (0,
|
|
11442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11351
11443
|
day_default,
|
|
11352
11444
|
{
|
|
11353
11445
|
onClick: () => {
|
|
@@ -11360,8 +11452,8 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11360
11452
|
);
|
|
11361
11453
|
}) }, weekIndex)) })
|
|
11362
11454
|
] });
|
|
11363
|
-
return /* @__PURE__ */ (0,
|
|
11364
|
-
/* @__PURE__ */ (0,
|
|
11455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
11456
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleFocusInput, ref: inputWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11365
11457
|
input_default,
|
|
11366
11458
|
{
|
|
11367
11459
|
...inputProps,
|
|
@@ -11394,7 +11486,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11394
11486
|
}
|
|
11395
11487
|
) }),
|
|
11396
11488
|
isPanelOpen ? (0, import_react_dom5.createPortal)(
|
|
11397
|
-
/* @__PURE__ */ (0,
|
|
11489
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
11398
11490
|
"div",
|
|
11399
11491
|
{
|
|
11400
11492
|
className: slots.calendarWrapper({ class: classNames == null ? void 0 : classNames.calendarWrapper }),
|
|
@@ -11408,13 +11500,13 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11408
11500
|
zIndex: 1e3
|
|
11409
11501
|
},
|
|
11410
11502
|
children: [
|
|
11411
|
-
/* @__PURE__ */ (0,
|
|
11503
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: dualCalendar ? "flex gap-[10px]" : "flex", children: [
|
|
11412
11504
|
renderCalendar(leftCurrentDate, true),
|
|
11413
|
-
dualCalendar && range ? /* @__PURE__ */ (0,
|
|
11505
|
+
dualCalendar && range ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "bg-neutral-soft w-px self-stretch" }) : null,
|
|
11414
11506
|
dualCalendar ? renderCalendar(rightCurrentDate, false) : null
|
|
11415
11507
|
] }),
|
|
11416
|
-
/* @__PURE__ */ (0,
|
|
11417
|
-
/* @__PURE__ */ (0,
|
|
11508
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex h-[30px] justify-between px-[10px]", children: [
|
|
11509
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11418
11510
|
text_button_default,
|
|
11419
11511
|
{
|
|
11420
11512
|
classNames: { base: "font-bold" },
|
|
@@ -11425,10 +11517,10 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11425
11517
|
children: resetTitle
|
|
11426
11518
|
}
|
|
11427
11519
|
),
|
|
11428
|
-
/* @__PURE__ */ (0,
|
|
11520
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(text_button_default, { classNames: { base: "font-bold" }, onClick: handleSetToday, size: "sm", variant: "underline", children: todayTitle })
|
|
11429
11521
|
] }),
|
|
11430
|
-
/* @__PURE__ */ (0,
|
|
11431
|
-
/* @__PURE__ */ (0,
|
|
11522
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-[10px]", children: [
|
|
11523
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11432
11524
|
button_default,
|
|
11433
11525
|
{
|
|
11434
11526
|
classNames: { base: "flex flex-1" },
|
|
@@ -11439,7 +11531,7 @@ var DatePicker = (0, import_react36.forwardRef)((originalProps, ref) => {
|
|
|
11439
11531
|
children: cancelTitle
|
|
11440
11532
|
}
|
|
11441
11533
|
),
|
|
11442
|
-
/* @__PURE__ */ (0,
|
|
11534
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
11443
11535
|
button_default,
|
|
11444
11536
|
{
|
|
11445
11537
|
classNames: { base: "flex flex-1" },
|
|
@@ -11501,19 +11593,19 @@ var datePickerStyle = tv({
|
|
|
11501
11593
|
});
|
|
11502
11594
|
|
|
11503
11595
|
// src/components/picker/timePicker/index.tsx
|
|
11504
|
-
var
|
|
11596
|
+
var import_react40 = require("react");
|
|
11505
11597
|
var import_react_dom6 = require("react-dom");
|
|
11506
11598
|
|
|
11507
11599
|
// src/components/picker/timePicker/Panel.tsx
|
|
11508
|
-
var
|
|
11600
|
+
var import_react39 = require("react");
|
|
11509
11601
|
|
|
11510
11602
|
// src/components/picker/timePicker/WheelColumn.tsx
|
|
11511
|
-
var
|
|
11512
|
-
var
|
|
11603
|
+
var import_react38 = require("react");
|
|
11604
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
11513
11605
|
var ITEM_HEIGHT = 30;
|
|
11514
11606
|
var ACTIVE_HEIGHT = 34;
|
|
11515
11607
|
function WheelColumn({ list, value, onChange }) {
|
|
11516
|
-
const ref = (0,
|
|
11608
|
+
const ref = (0, import_react38.useRef)(null);
|
|
11517
11609
|
const idx = list.indexOf(value);
|
|
11518
11610
|
const finalizeScroll = (index) => {
|
|
11519
11611
|
const v = list[index];
|
|
@@ -11522,7 +11614,7 @@ function WheelColumn({ list, value, onChange }) {
|
|
|
11522
11614
|
const handleClick = (index) => {
|
|
11523
11615
|
finalizeScroll(index);
|
|
11524
11616
|
};
|
|
11525
|
-
(0,
|
|
11617
|
+
(0, import_react38.useEffect)(() => {
|
|
11526
11618
|
const el = ref.current;
|
|
11527
11619
|
if (!el || idx < 0) return;
|
|
11528
11620
|
const handleWheel = (e) => {
|
|
@@ -11540,18 +11632,18 @@ function WheelColumn({ list, value, onChange }) {
|
|
|
11540
11632
|
el.removeEventListener("wheel", handleWheel);
|
|
11541
11633
|
};
|
|
11542
11634
|
}, [idx, list, onChange]);
|
|
11543
|
-
(0,
|
|
11635
|
+
(0, import_react38.useEffect)(() => {
|
|
11544
11636
|
const el = ref.current;
|
|
11545
11637
|
if (!el || idx < 0) return;
|
|
11546
11638
|
el.scrollTo({ top: idx * ITEM_HEIGHT });
|
|
11547
11639
|
}, [idx]);
|
|
11548
|
-
return /* @__PURE__ */ (0,
|
|
11549
|
-
/* @__PURE__ */ (0,
|
|
11550
|
-
/* @__PURE__ */ (0,
|
|
11551
|
-
/* @__PURE__ */ (0,
|
|
11640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "relative h-[94px] w-[40px]", children: [
|
|
11641
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "pointer-events-none absolute top-[30px] left-1/2 h-[34px] w-[40px] -translate-x-1/2 rounded-[10px] shadow-[inset_0_0_0_1.5px_var(--color-primary-light)]" }),
|
|
11642
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "scrollbar-none relative h-full overflow-hidden py-[0] select-none", ref, children: [
|
|
11643
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { height: ITEM_HEIGHT } }),
|
|
11552
11644
|
list.map((v, i) => {
|
|
11553
11645
|
const highlight = i === idx;
|
|
11554
|
-
return /* @__PURE__ */ (0,
|
|
11646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
11555
11647
|
"div",
|
|
11556
11648
|
{
|
|
11557
11649
|
className: `flex items-center justify-center text-sm font-bold ${highlight ? "text-body-foreground" : "text-neutral-light"}`,
|
|
@@ -11564,19 +11656,19 @@ function WheelColumn({ list, value, onChange }) {
|
|
|
11564
11656
|
i
|
|
11565
11657
|
);
|
|
11566
11658
|
}),
|
|
11567
|
-
/* @__PURE__ */ (0,
|
|
11659
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { height: ITEM_HEIGHT + 4 } })
|
|
11568
11660
|
] })
|
|
11569
11661
|
] });
|
|
11570
11662
|
}
|
|
11571
11663
|
|
|
11572
11664
|
// src/components/picker/timePicker/Panel.tsx
|
|
11573
|
-
var
|
|
11665
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
11574
11666
|
var hours = [...Array(12)].map((_, i) => String(i + 1).padStart(2, "0"));
|
|
11575
11667
|
var minutes = [...Array(60)].map((_, i) => String(i).padStart(2, "0"));
|
|
11576
11668
|
var meridiemList = ["AM", "PM"];
|
|
11577
|
-
var TimePickerPanel = (0,
|
|
11669
|
+
var TimePickerPanel = (0, import_react39.forwardRef)(
|
|
11578
11670
|
({ value, onChange, nowTitle, confirmTitle }, ref) => {
|
|
11579
|
-
const [time, setTime] = (0,
|
|
11671
|
+
const [time, setTime] = (0, import_react39.useState)({ hour: "", minute: "", meridiem: "" });
|
|
11580
11672
|
const handleNow = () => {
|
|
11581
11673
|
setTime(getCurrent12Hour());
|
|
11582
11674
|
};
|
|
@@ -11591,26 +11683,26 @@ var TimePickerPanel = (0, import_react38.forwardRef)(
|
|
|
11591
11683
|
const SS = "00";
|
|
11592
11684
|
onChange(`${HH}:${MM}:${SS}`);
|
|
11593
11685
|
};
|
|
11594
|
-
(0,
|
|
11686
|
+
(0, import_react39.useEffect)(() => {
|
|
11595
11687
|
setTime(value ? convert24To12(value) : getCurrent12Hour());
|
|
11596
11688
|
}, [value]);
|
|
11597
|
-
return /* @__PURE__ */ (0,
|
|
11598
|
-
/* @__PURE__ */ (0,
|
|
11599
|
-
/* @__PURE__ */ (0,
|
|
11600
|
-
/* @__PURE__ */ (0,
|
|
11689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
11690
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-[10px]", ref, children: [
|
|
11691
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-center gap-[5px]", children: [
|
|
11692
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WheelColumn, { list: hours, onChange: (v) => {
|
|
11601
11693
|
setTime({ ...time, hour: v });
|
|
11602
11694
|
}, value: time.hour }),
|
|
11603
|
-
/* @__PURE__ */ (0,
|
|
11604
|
-
/* @__PURE__ */ (0,
|
|
11695
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "w-[5px] text-sm font-bold", children: ":" }),
|
|
11696
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WheelColumn, { list: minutes, onChange: (v) => {
|
|
11605
11697
|
setTime({ ...time, minute: v });
|
|
11606
11698
|
}, value: time.minute })
|
|
11607
11699
|
] }),
|
|
11608
|
-
/* @__PURE__ */ (0,
|
|
11700
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WheelColumn, { list: meridiemList, onChange: (v) => {
|
|
11609
11701
|
setTime({ ...time, meridiem: v });
|
|
11610
11702
|
}, value: time.meridiem })
|
|
11611
11703
|
] }),
|
|
11612
|
-
/* @__PURE__ */ (0,
|
|
11613
|
-
/* @__PURE__ */ (0,
|
|
11704
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-between px-1 text-sm", children: [
|
|
11705
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11614
11706
|
text_button_default,
|
|
11615
11707
|
{
|
|
11616
11708
|
classNames: { base: "font-bold" },
|
|
@@ -11621,7 +11713,7 @@ var TimePickerPanel = (0, import_react38.forwardRef)(
|
|
|
11621
11713
|
children: nowTitle
|
|
11622
11714
|
}
|
|
11623
11715
|
),
|
|
11624
|
-
/* @__PURE__ */ (0,
|
|
11716
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11625
11717
|
text_button_default,
|
|
11626
11718
|
{
|
|
11627
11719
|
classNames: { base: "font-bold" },
|
|
@@ -11640,8 +11732,8 @@ var TimePickerPanel = (0, import_react38.forwardRef)(
|
|
|
11640
11732
|
var Panel_default = TimePickerPanel;
|
|
11641
11733
|
|
|
11642
11734
|
// src/components/picker/timePicker/index.tsx
|
|
11643
|
-
var
|
|
11644
|
-
var TimePicker = (0,
|
|
11735
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
11736
|
+
var TimePicker = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
11645
11737
|
const [props, variantProps] = mapPropsVariants(originalProps, timePickerStyle.variantKeys);
|
|
11646
11738
|
const {
|
|
11647
11739
|
classNames,
|
|
@@ -11658,20 +11750,20 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11658
11750
|
confirmTitle,
|
|
11659
11751
|
...inputProps
|
|
11660
11752
|
} = { ...props, ...variantProps };
|
|
11661
|
-
const slots = (0,
|
|
11662
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11663
|
-
const inputWrapperRef = (0,
|
|
11664
|
-
const panelWrapperRef = (0,
|
|
11665
|
-
const [panelPos, setPanelPos] = (0,
|
|
11753
|
+
const slots = (0, import_react40.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
|
|
11754
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react40.useState)(false);
|
|
11755
|
+
const inputWrapperRef = (0, import_react40.useRef)(null);
|
|
11756
|
+
const panelWrapperRef = (0, import_react40.useRef)(null);
|
|
11757
|
+
const [panelPos, setPanelPos] = (0, import_react40.useState)({
|
|
11666
11758
|
top: -9999,
|
|
11667
11759
|
left: -9999
|
|
11668
11760
|
});
|
|
11669
|
-
const displayValue = (0,
|
|
11761
|
+
const displayValue = (0, import_react40.useMemo)(() => {
|
|
11670
11762
|
if (!value) return "";
|
|
11671
11763
|
const { hour, minute, meridiem } = convert24To12(value);
|
|
11672
11764
|
return `${hour}:${minute} ${meridiem}`;
|
|
11673
11765
|
}, [value]);
|
|
11674
|
-
const calculatePosition = (0,
|
|
11766
|
+
const calculatePosition = (0, import_react40.useCallback)(() => {
|
|
11675
11767
|
if (inputWrapperRef.current) {
|
|
11676
11768
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11677
11769
|
setPanelPos({
|
|
@@ -11698,7 +11790,7 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11698
11790
|
onChange == null ? void 0 : onChange(time);
|
|
11699
11791
|
setIsPanelOpen(false);
|
|
11700
11792
|
};
|
|
11701
|
-
(0,
|
|
11793
|
+
(0, import_react40.useEffect)(() => {
|
|
11702
11794
|
const handleClickOutside = (e) => {
|
|
11703
11795
|
var _a, _b;
|
|
11704
11796
|
const target = e.target;
|
|
@@ -11711,8 +11803,8 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11711
11803
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
11712
11804
|
};
|
|
11713
11805
|
}, []);
|
|
11714
|
-
return /* @__PURE__ */ (0,
|
|
11715
|
-
/* @__PURE__ */ (0,
|
|
11806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11807
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: openPanel, ref: inputWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11716
11808
|
input_default,
|
|
11717
11809
|
{
|
|
11718
11810
|
...inputProps,
|
|
@@ -11724,7 +11816,7 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11724
11816
|
errorMessage: classNames == null ? void 0 : classNames.errorMessage
|
|
11725
11817
|
},
|
|
11726
11818
|
disabled,
|
|
11727
|
-
endContent: /* @__PURE__ */ (0,
|
|
11819
|
+
endContent: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { className: "cursor-pointer", name: "clock", size }),
|
|
11728
11820
|
errorMessage,
|
|
11729
11821
|
full,
|
|
11730
11822
|
label,
|
|
@@ -11740,7 +11832,7 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11740
11832
|
}
|
|
11741
11833
|
) }),
|
|
11742
11834
|
isPanelOpen ? (0, import_react_dom6.createPortal)(
|
|
11743
|
-
/* @__PURE__ */ (0,
|
|
11835
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11744
11836
|
"div",
|
|
11745
11837
|
{
|
|
11746
11838
|
className: slots.portalWrapper({ class: classNames == null ? void 0 : classNames.portalWrapper }),
|
|
@@ -11754,7 +11846,7 @@ var TimePicker = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
11754
11846
|
left: panelPos.left,
|
|
11755
11847
|
zIndex: 1e3
|
|
11756
11848
|
},
|
|
11757
|
-
children: /* @__PURE__ */ (0,
|
|
11849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Panel_default, { confirmTitle, nowTitle, onChange: handleChange, value })
|
|
11758
11850
|
}
|
|
11759
11851
|
),
|
|
11760
11852
|
document.body
|
|
@@ -11904,30 +11996,30 @@ var timePickerStyle = tv({
|
|
|
11904
11996
|
});
|
|
11905
11997
|
|
|
11906
11998
|
// src/components/tree/tree.tsx
|
|
11907
|
-
var
|
|
11908
|
-
var
|
|
11909
|
-
var TreeNodeItemBase = (0,
|
|
11999
|
+
var import_react41 = require("react");
|
|
12000
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
12001
|
+
var TreeNodeItemBase = (0, import_react41.forwardRef)(
|
|
11910
12002
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
11911
|
-
const slots = (0,
|
|
11912
|
-
const hasSelectedInChildren = (0,
|
|
12003
|
+
const slots = (0, import_react41.useMemo)(() => treeStyle(), []);
|
|
12004
|
+
const hasSelectedInChildren = (0, import_react41.useCallback)(
|
|
11913
12005
|
(children2) => {
|
|
11914
12006
|
if (!children2 || !selectedName) return false;
|
|
11915
12007
|
return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
|
|
11916
12008
|
},
|
|
11917
12009
|
[selectedName]
|
|
11918
12010
|
);
|
|
11919
|
-
const [children, setChildren] = (0,
|
|
11920
|
-
const [isOpen, setIsOpen] = (0,
|
|
12011
|
+
const [children, setChildren] = (0, import_react41.useState)(node.children);
|
|
12012
|
+
const [isOpen, setIsOpen] = (0, import_react41.useState)(() => {
|
|
11921
12013
|
if (!selectedName) return false;
|
|
11922
12014
|
return hasSelectedInChildren(node.children);
|
|
11923
12015
|
});
|
|
11924
|
-
const hasOpenedInitially = (0,
|
|
11925
|
-
const hasMore = (0,
|
|
12016
|
+
const hasOpenedInitially = (0, import_react41.useRef)(false);
|
|
12017
|
+
const hasMore = (0, import_react41.useMemo)(() => {
|
|
11926
12018
|
if (node.isLeaf) return false;
|
|
11927
12019
|
if (Array.isArray(children)) return children.length > 0;
|
|
11928
12020
|
return typeof onExpand === "function";
|
|
11929
12021
|
}, [node.isLeaf, children, onExpand]);
|
|
11930
|
-
const toggleOpen = (0,
|
|
12022
|
+
const toggleOpen = (0, import_react41.useCallback)(async () => {
|
|
11931
12023
|
if (!isOpen && !children && onExpand && !node.isLeaf) {
|
|
11932
12024
|
try {
|
|
11933
12025
|
const result = await onExpand(node);
|
|
@@ -11948,7 +12040,7 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
11948
12040
|
e.preventDefault();
|
|
11949
12041
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
11950
12042
|
};
|
|
11951
|
-
(0,
|
|
12043
|
+
(0, import_react41.useEffect)(() => {
|
|
11952
12044
|
if (!selectedName) return;
|
|
11953
12045
|
if (!hasOpenedInitially.current) {
|
|
11954
12046
|
const shouldOpen = hasSelectedInChildren(children);
|
|
@@ -11956,7 +12048,7 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
11956
12048
|
hasOpenedInitially.current = true;
|
|
11957
12049
|
}
|
|
11958
12050
|
}, [selectedName, children, hasSelectedInChildren]);
|
|
11959
|
-
return /* @__PURE__ */ (0,
|
|
12051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
11960
12052
|
"div",
|
|
11961
12053
|
{
|
|
11962
12054
|
className: clsx(
|
|
@@ -11965,7 +12057,7 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
11965
12057
|
),
|
|
11966
12058
|
ref,
|
|
11967
12059
|
children: [
|
|
11968
|
-
/* @__PURE__ */ (0,
|
|
12060
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
11969
12061
|
"div",
|
|
11970
12062
|
{
|
|
11971
12063
|
className: clsx(
|
|
@@ -11976,7 +12068,7 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
11976
12068
|
onClick: handleClick,
|
|
11977
12069
|
onContextMenu: handleRightClick,
|
|
11978
12070
|
children: [
|
|
11979
|
-
hasMore ? /* @__PURE__ */ (0,
|
|
12071
|
+
hasMore ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11980
12072
|
Icon_default,
|
|
11981
12073
|
{
|
|
11982
12074
|
className: clsx(
|
|
@@ -11991,7 +12083,7 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
11991
12083
|
]
|
|
11992
12084
|
}
|
|
11993
12085
|
),
|
|
11994
|
-
isOpen && hasMore ? /* @__PURE__ */ (0,
|
|
12086
|
+
isOpen && hasMore ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: slots.gap({ class: classNames == null ? void 0 : classNames.gap }), children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11995
12087
|
TreeNodeItem,
|
|
11996
12088
|
{
|
|
11997
12089
|
classNames,
|
|
@@ -12009,9 +12101,9 @@ var TreeNodeItemBase = (0, import_react40.forwardRef)(
|
|
|
12009
12101
|
}
|
|
12010
12102
|
);
|
|
12011
12103
|
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
12012
|
-
var TreeNodeItem = (0,
|
|
12104
|
+
var TreeNodeItem = (0, import_react41.memo)(TreeNodeItemBase);
|
|
12013
12105
|
function Tree({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) {
|
|
12014
|
-
const slots = (0,
|
|
12106
|
+
const slots = (0, import_react41.useMemo)(() => treeStyle(), []);
|
|
12015
12107
|
const handleClick = (e) => {
|
|
12016
12108
|
var _a;
|
|
12017
12109
|
(_a = group.onClick) == null ? void 0 : _a.call(group, e);
|
|
@@ -12021,10 +12113,10 @@ function Tree({ headerContent, group, groupIcon, fileIcon, selectedName, classNa
|
|
|
12021
12113
|
e.preventDefault();
|
|
12022
12114
|
(_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
|
|
12023
12115
|
};
|
|
12024
|
-
return /* @__PURE__ */ (0,
|
|
12025
|
-
headerContent ? /* @__PURE__ */ (0,
|
|
12026
|
-
/* @__PURE__ */ (0,
|
|
12027
|
-
group.content ? /* @__PURE__ */ (0,
|
|
12116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
12117
|
+
headerContent ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: headerContent }) : null,
|
|
12118
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
12119
|
+
group.content ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
12028
12120
|
"div",
|
|
12029
12121
|
{
|
|
12030
12122
|
className: clsx(
|
|
@@ -12040,7 +12132,7 @@ function Tree({ headerContent, group, groupIcon, fileIcon, selectedName, classNa
|
|
|
12040
12132
|
]
|
|
12041
12133
|
}
|
|
12042
12134
|
) : null,
|
|
12043
|
-
group.data.length > 0 && /* @__PURE__ */ (0,
|
|
12135
|
+
group.data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: slots.itemWrapper({ class: classNames == null ? void 0 : classNames.itemWrapper }), children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
12044
12136
|
TreeNodeItem,
|
|
12045
12137
|
{
|
|
12046
12138
|
classNames,
|
|
@@ -12079,19 +12171,19 @@ var treeStyle = tv({
|
|
|
12079
12171
|
});
|
|
12080
12172
|
|
|
12081
12173
|
// src/components/fileUpload/fileUpload.tsx
|
|
12082
|
-
var
|
|
12083
|
-
var
|
|
12174
|
+
var import_react44 = require("react");
|
|
12175
|
+
var import_tailwind_variants36 = require("tailwind-variants");
|
|
12084
12176
|
|
|
12085
12177
|
// src/components/progress/progress.tsx
|
|
12086
|
-
var
|
|
12178
|
+
var import_react43 = require("react");
|
|
12087
12179
|
|
|
12088
12180
|
// src/hooks/useIsMounted.ts
|
|
12089
|
-
var
|
|
12181
|
+
var import_react42 = require("react");
|
|
12090
12182
|
function useIsMounted(props = {}) {
|
|
12091
12183
|
const { rerender = false, delay = 0 } = props;
|
|
12092
|
-
const isMountedRef = (0,
|
|
12093
|
-
const [isMounted, setIsMounted] = (0,
|
|
12094
|
-
(0,
|
|
12184
|
+
const isMountedRef = (0, import_react42.useRef)(false);
|
|
12185
|
+
const [isMounted, setIsMounted] = (0, import_react42.useState)(false);
|
|
12186
|
+
(0, import_react42.useEffect)(() => {
|
|
12095
12187
|
isMountedRef.current = true;
|
|
12096
12188
|
let timer = null;
|
|
12097
12189
|
if (rerender) {
|
|
@@ -12113,11 +12205,11 @@ function useIsMounted(props = {}) {
|
|
|
12113
12205
|
}
|
|
12114
12206
|
};
|
|
12115
12207
|
}, [rerender]);
|
|
12116
|
-
return [(0,
|
|
12208
|
+
return [(0, import_react42.useCallback)(() => isMountedRef.current, []), isMounted];
|
|
12117
12209
|
}
|
|
12118
12210
|
|
|
12119
12211
|
// src/components/progress/progress.tsx
|
|
12120
|
-
var
|
|
12212
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
12121
12213
|
function Progress(originalProps) {
|
|
12122
12214
|
const [props, variantProps] = mapPropsVariants(originalProps, progressStyle.variantKeys);
|
|
12123
12215
|
const { children, classNames, value = 0, minValue = 0, maxValue = 100, ...progressProps } = props;
|
|
@@ -12127,12 +12219,12 @@ function Progress(originalProps) {
|
|
|
12127
12219
|
delay: 100
|
|
12128
12220
|
});
|
|
12129
12221
|
const selfMounted = variantProps.disableAnimation ? true : isMounted;
|
|
12130
|
-
const percentage = (0,
|
|
12222
|
+
const percentage = (0, import_react43.useMemo)(
|
|
12131
12223
|
() => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value - minValue) / (maxValue - minValue) * 100),
|
|
12132
12224
|
[selfMounted, isIndeterminate, value, minValue, maxValue]
|
|
12133
12225
|
);
|
|
12134
|
-
const slots = (0,
|
|
12135
|
-
return /* @__PURE__ */ (0,
|
|
12226
|
+
const slots = (0, import_react43.useMemo)(() => progressStyle({ ...variantProps }), [variantProps]);
|
|
12227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: slots.track({ class: classNames == null ? void 0 : classNames.track }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
12136
12228
|
"div",
|
|
12137
12229
|
{
|
|
12138
12230
|
className: slots.indicator({ class: classNames == null ? void 0 : classNames.indicator }),
|
|
@@ -12232,7 +12324,7 @@ var clampPercentage = (value) => {
|
|
|
12232
12324
|
};
|
|
12233
12325
|
|
|
12234
12326
|
// src/components/fileUpload/fileUpload.tsx
|
|
12235
|
-
var
|
|
12327
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12236
12328
|
function FileUpload({
|
|
12237
12329
|
buttonText,
|
|
12238
12330
|
cancelText,
|
|
@@ -12251,16 +12343,16 @@ function FileUpload({
|
|
|
12251
12343
|
classNames,
|
|
12252
12344
|
defaultFile
|
|
12253
12345
|
}) {
|
|
12254
|
-
const fileInputRef = (0,
|
|
12255
|
-
const uploadIntervalRef = (0,
|
|
12256
|
-
const [currentFile, setCurrentFile] = (0,
|
|
12257
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
12258
|
-
const [message, setMessage] = (0,
|
|
12259
|
-
const [displayFileName, setDisplayFileName] = (0,
|
|
12260
|
-
const [hasUploadedFile, setHasUploadedFile] = (0,
|
|
12261
|
-
const [isUploading, setIsUploading] = (0,
|
|
12346
|
+
const fileInputRef = (0, import_react44.useRef)(null);
|
|
12347
|
+
const uploadIntervalRef = (0, import_react44.useRef)(null);
|
|
12348
|
+
const [currentFile, setCurrentFile] = (0, import_react44.useState)(null);
|
|
12349
|
+
const [uploadProgress, setUploadProgress] = (0, import_react44.useState)(0);
|
|
12350
|
+
const [message, setMessage] = (0, import_react44.useState)(errorMessage);
|
|
12351
|
+
const [displayFileName, setDisplayFileName] = (0, import_react44.useState)("");
|
|
12352
|
+
const [hasUploadedFile, setHasUploadedFile] = (0, import_react44.useState)(false);
|
|
12353
|
+
const [isUploading, setIsUploading] = (0, import_react44.useState)(false);
|
|
12262
12354
|
const slots = fileUploadStyle();
|
|
12263
|
-
(0,
|
|
12355
|
+
(0, import_react44.useEffect)(() => {
|
|
12264
12356
|
if (defaultFile == null ? void 0 : defaultFile.name) {
|
|
12265
12357
|
setDisplayFileName(defaultFile.name);
|
|
12266
12358
|
setHasUploadedFile(true);
|
|
@@ -12334,21 +12426,21 @@ function FileUpload({
|
|
|
12334
12426
|
}
|
|
12335
12427
|
if (onCancelUpload) onCancelUpload();
|
|
12336
12428
|
};
|
|
12337
|
-
(0,
|
|
12429
|
+
(0, import_react44.useEffect)(() => {
|
|
12338
12430
|
return () => {
|
|
12339
12431
|
if (uploadIntervalRef.current) {
|
|
12340
12432
|
clearInterval(uploadIntervalRef.current);
|
|
12341
12433
|
}
|
|
12342
12434
|
};
|
|
12343
12435
|
}, []);
|
|
12344
|
-
(0,
|
|
12436
|
+
(0, import_react44.useEffect)(() => {
|
|
12345
12437
|
if (errorMessage !== void 0) {
|
|
12346
12438
|
setMessage(errorMessage);
|
|
12347
12439
|
}
|
|
12348
12440
|
}, [errorMessage]);
|
|
12349
|
-
return /* @__PURE__ */ (0,
|
|
12350
|
-
/* @__PURE__ */ (0,
|
|
12351
|
-
/* @__PURE__ */ (0,
|
|
12441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
12442
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
|
|
12443
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: slots.inputWrapper(), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12352
12444
|
input_default,
|
|
12353
12445
|
{
|
|
12354
12446
|
errorMessage: message && message.length > 0 ? message : void 0,
|
|
@@ -12360,19 +12452,19 @@ function FileUpload({
|
|
|
12360
12452
|
variant: "outline"
|
|
12361
12453
|
}
|
|
12362
12454
|
) }),
|
|
12363
|
-
/* @__PURE__ */ (0,
|
|
12364
|
-
/* @__PURE__ */ (0,
|
|
12365
|
-
cancelText && (hasUploadedFile || displayFileName) && !isUploading ? /* @__PURE__ */ (0,
|
|
12455
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-[10px]", children: [
|
|
12456
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(button_default, { isLoading: isUploading, onClick: handleButtonClick, type: "button", variant: "outline", children: buttonText }),
|
|
12457
|
+
cancelText && (hasUploadedFile || displayFileName) && !isUploading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(button_default, { color: "danger", onClick: handleCancelUpload, type: "button", variant: "soft", children: cancelText }) : null
|
|
12366
12458
|
] }),
|
|
12367
|
-
/* @__PURE__ */ (0,
|
|
12459
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { accept: accept.join(","), hidden: true, onChange: handleFileChange, ref: fileInputRef, type: "file" })
|
|
12368
12460
|
] }),
|
|
12369
|
-
showProgress && currentFile && hasUploadedFile && uploadProgress < 100 ? /* @__PURE__ */ (0,
|
|
12370
|
-
!message && helperMessage ? /* @__PURE__ */ (0,
|
|
12461
|
+
showProgress && currentFile && hasUploadedFile && uploadProgress < 100 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(progress_default, { value: uploadProgress }) : null,
|
|
12462
|
+
!message && helperMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: slots.helperMessage(), children: helperMessage }) : null
|
|
12371
12463
|
] });
|
|
12372
12464
|
}
|
|
12373
12465
|
FileUpload.displayName = "FileUpload";
|
|
12374
12466
|
var fileUpload_default = FileUpload;
|
|
12375
|
-
var fileUploadStyle = (0,
|
|
12467
|
+
var fileUploadStyle = (0, import_tailwind_variants36.tv)({
|
|
12376
12468
|
slots: {
|
|
12377
12469
|
base: ["flex", "flex-col", "gap-[5px]"],
|
|
12378
12470
|
container: ["flex", "gap-[10px]"],
|
|
@@ -12384,8 +12476,8 @@ var fileUploadStyle = (0, import_tailwind_variants35.tv)({
|
|
|
12384
12476
|
});
|
|
12385
12477
|
|
|
12386
12478
|
// src/components/skeleton/skeleton.tsx
|
|
12387
|
-
var
|
|
12388
|
-
var
|
|
12479
|
+
var import_tailwind_variants37 = require("tailwind-variants");
|
|
12480
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
12389
12481
|
function Skeleton({ color = "primary", className, speed = "normal", rounded = "md" }) {
|
|
12390
12482
|
const speedMap = {
|
|
12391
12483
|
fast: "0.7s",
|
|
@@ -12393,14 +12485,14 @@ function Skeleton({ color = "primary", className, speed = "normal", rounded = "m
|
|
|
12393
12485
|
slow: "2s"
|
|
12394
12486
|
};
|
|
12395
12487
|
const slots = skeletonStyle();
|
|
12396
|
-
return /* @__PURE__ */ (0,
|
|
12488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12397
12489
|
"div",
|
|
12398
12490
|
{
|
|
12399
12491
|
className: clsx(slots.base({ color, rounded }), className),
|
|
12400
12492
|
style: {
|
|
12401
12493
|
"--shimmer-duration": speedMap[speed]
|
|
12402
12494
|
},
|
|
12403
|
-
children: /* @__PURE__ */ (0,
|
|
12495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("style", { children: `@keyframes shimmer {
|
|
12404
12496
|
100% {
|
|
12405
12497
|
transform: translateX(100%);
|
|
12406
12498
|
}
|
|
@@ -12414,7 +12506,7 @@ function Skeleton({ color = "primary", className, speed = "normal", rounded = "m
|
|
|
12414
12506
|
}
|
|
12415
12507
|
Skeleton.displayName = "Skeleton";
|
|
12416
12508
|
var skeleton_default = Skeleton;
|
|
12417
|
-
var skeletonStyle = (0,
|
|
12509
|
+
var skeletonStyle = (0, import_tailwind_variants37.tv)({
|
|
12418
12510
|
slots: {
|
|
12419
12511
|
base: [
|
|
12420
12512
|
"relative",
|
|
@@ -12454,12 +12546,12 @@ var skeletonStyle = (0, import_tailwind_variants36.tv)({
|
|
|
12454
12546
|
|
|
12455
12547
|
// src/components/charts/circularProgress.tsx
|
|
12456
12548
|
var import_recharts = require("recharts");
|
|
12457
|
-
var
|
|
12458
|
-
var
|
|
12459
|
-
var CircularProgress = (0,
|
|
12549
|
+
var import_react45 = require("react");
|
|
12550
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
12551
|
+
var CircularProgress = (0, import_react45.forwardRef)((originalProps, ref) => {
|
|
12460
12552
|
const [props, variantProps] = mapPropsVariants(originalProps, circularProgressStyle.variantKeys);
|
|
12461
12553
|
const { label, size = 150, percentage, innerContent, classNames } = { ...props, ...variantProps };
|
|
12462
|
-
const slots = (0,
|
|
12554
|
+
const slots = (0, import_react45.useMemo)(() => circularProgressStyle({ ...variantProps }), [variantProps]);
|
|
12463
12555
|
const data = [
|
|
12464
12556
|
{
|
|
12465
12557
|
name: label,
|
|
@@ -12491,12 +12583,12 @@ var CircularProgress = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
|
12491
12583
|
const colorValue = originalProps.color;
|
|
12492
12584
|
const colorKey = colorValue || "blue";
|
|
12493
12585
|
const currentGradient = gradientColors[colorKey];
|
|
12494
|
-
const wrappedInnerContent = (0,
|
|
12586
|
+
const wrappedInnerContent = (0, import_react45.useMemo)(() => {
|
|
12495
12587
|
return wrapSpanWithClass(innerContent);
|
|
12496
12588
|
}, [innerContent]);
|
|
12497
|
-
return /* @__PURE__ */ (0,
|
|
12498
|
-
/* @__PURE__ */ (0,
|
|
12499
|
-
/* @__PURE__ */ (0,
|
|
12589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: [
|
|
12590
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
12591
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
12500
12592
|
import_recharts.RadialBarChart,
|
|
12501
12593
|
{
|
|
12502
12594
|
barSize: BAR_SIZE,
|
|
@@ -12508,11 +12600,11 @@ var CircularProgress = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
|
12508
12600
|
startAngle: 90,
|
|
12509
12601
|
width: size,
|
|
12510
12602
|
children: [
|
|
12511
|
-
/* @__PURE__ */ (0,
|
|
12512
|
-
/* @__PURE__ */ (0,
|
|
12513
|
-
/* @__PURE__ */ (0,
|
|
12603
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("linearGradient", { id: gradientId, x1: "0%", x2: "100%", y1: "0%", y2: "100%", children: [
|
|
12604
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("stop", { offset: "0%", stopColor: currentGradient.start }),
|
|
12605
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("stop", { offset: "100%", stopColor: currentGradient.end })
|
|
12514
12606
|
] }) }),
|
|
12515
|
-
/* @__PURE__ */ (0,
|
|
12607
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12516
12608
|
"circle",
|
|
12517
12609
|
{
|
|
12518
12610
|
cx: size / 2,
|
|
@@ -12523,7 +12615,7 @@ var CircularProgress = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
|
12523
12615
|
strokeWidth: "1"
|
|
12524
12616
|
}
|
|
12525
12617
|
),
|
|
12526
|
-
/* @__PURE__ */ (0,
|
|
12618
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12527
12619
|
"circle",
|
|
12528
12620
|
{
|
|
12529
12621
|
cx: size / 2,
|
|
@@ -12534,14 +12626,14 @@ var CircularProgress = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
|
12534
12626
|
strokeWidth: BAR_SIZE
|
|
12535
12627
|
}
|
|
12536
12628
|
),
|
|
12537
|
-
/* @__PURE__ */ (0,
|
|
12538
|
-
/* @__PURE__ */ (0,
|
|
12629
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_recharts.PolarAngleAxis, { angleAxisId: 0, domain: [0, 100], tick: false, type: "number" }),
|
|
12630
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_recharts.RadialBar, { animationDuration: 1e3, cornerRadius: 12, dataKey: "value", fill: `url(#${gradientId})` })
|
|
12539
12631
|
]
|
|
12540
12632
|
}
|
|
12541
12633
|
),
|
|
12542
|
-
innerContent ? /* @__PURE__ */ (0,
|
|
12634
|
+
innerContent ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: slots.inner({ class: classNames == null ? void 0 : classNames.inner }), children: wrappedInnerContent }) : null
|
|
12543
12635
|
] }),
|
|
12544
|
-
label ? /* @__PURE__ */ (0,
|
|
12636
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null
|
|
12545
12637
|
] });
|
|
12546
12638
|
});
|
|
12547
12639
|
CircularProgress.displayName = "CircularProgress";
|
|
@@ -12585,16 +12677,16 @@ function wrapSpanWithClass(node) {
|
|
|
12585
12677
|
if (Array.isArray(node)) {
|
|
12586
12678
|
return node.map(wrapSpanWithClass);
|
|
12587
12679
|
}
|
|
12588
|
-
if ((0,
|
|
12680
|
+
if ((0, import_react45.isValidElement)(node)) {
|
|
12589
12681
|
const element = node;
|
|
12590
12682
|
if (element.type === "span") {
|
|
12591
12683
|
const existing = (_a = element.props.className) != null ? _a : "";
|
|
12592
|
-
return (0,
|
|
12684
|
+
return (0, import_react45.cloneElement)(element, {
|
|
12593
12685
|
className: `text-xl font-bold ${existing}`.trim()
|
|
12594
12686
|
});
|
|
12595
12687
|
}
|
|
12596
12688
|
if (element.props.children) {
|
|
12597
|
-
return (0,
|
|
12689
|
+
return (0, import_react45.cloneElement)(element, {
|
|
12598
12690
|
children: wrapSpanWithClass(element.props.children)
|
|
12599
12691
|
});
|
|
12600
12692
|
}
|
|
@@ -12604,11 +12696,11 @@ function wrapSpanWithClass(node) {
|
|
|
12604
12696
|
}
|
|
12605
12697
|
|
|
12606
12698
|
// src/components/charts/areaChart.tsx
|
|
12607
|
-
var
|
|
12699
|
+
var import_react46 = require("react");
|
|
12608
12700
|
var import_recharts2 = require("recharts");
|
|
12609
|
-
var
|
|
12610
|
-
var AreaChartComponent = (0,
|
|
12611
|
-
const uniqueId = (0,
|
|
12701
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
12702
|
+
var AreaChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
12703
|
+
const uniqueId = (0, import_react46.useId)();
|
|
12612
12704
|
const [props, variantProps] = mapPropsVariants(originalProps, areaChartStyle.variantKeys);
|
|
12613
12705
|
const {
|
|
12614
12706
|
data,
|
|
@@ -12620,34 +12712,34 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12620
12712
|
chartHeight = 240,
|
|
12621
12713
|
classNames
|
|
12622
12714
|
} = { ...props, ...variantProps };
|
|
12623
|
-
const slots = (0,
|
|
12715
|
+
const slots = (0, import_react46.useMemo)(() => areaChartStyle({ ...variantProps }), [variantProps]);
|
|
12624
12716
|
const COLOR_MAP = {
|
|
12625
12717
|
primary: "#3F9CF2",
|
|
12626
12718
|
danger: "#FF4684"
|
|
12627
12719
|
};
|
|
12628
|
-
const colorHex = (0,
|
|
12629
|
-
const totalChartWidth = (0,
|
|
12720
|
+
const colorHex = (0, import_react46.useMemo)(() => COLOR_MAP[color], [color]);
|
|
12721
|
+
const totalChartWidth = (0, import_react46.useMemo)(() => {
|
|
12630
12722
|
if (!data || !itemWidth) return void 0;
|
|
12631
12723
|
const dataLength = startFromZero ? data.length + 1 : data.length;
|
|
12632
12724
|
return dataLength * itemWidth;
|
|
12633
12725
|
}, [data, itemWidth, startFromZero]);
|
|
12634
|
-
const needsScroll = (0,
|
|
12726
|
+
const needsScroll = (0, import_react46.useMemo)(() => {
|
|
12635
12727
|
return totalChartWidth;
|
|
12636
12728
|
}, [totalChartWidth]);
|
|
12637
|
-
const processedData = (0,
|
|
12729
|
+
const processedData = (0, import_react46.useMemo)(() => {
|
|
12638
12730
|
if (!data) return [];
|
|
12639
12731
|
return data;
|
|
12640
12732
|
}, [data, startFromZero]);
|
|
12641
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12642
|
-
const tickRef = (0,
|
|
12733
|
+
const [tickPositions, setTickPositions] = (0, import_react46.useState)([]);
|
|
12734
|
+
const tickRef = (0, import_react46.useRef)([]);
|
|
12643
12735
|
function CustomTick({ x, y, payload }) {
|
|
12644
12736
|
if (x !== void 0) {
|
|
12645
12737
|
tickRef.current.push(x);
|
|
12646
12738
|
}
|
|
12647
12739
|
if (startFromZero && payload.value === "") {
|
|
12648
|
-
return /* @__PURE__ */ (0,
|
|
12740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("g", {});
|
|
12649
12741
|
}
|
|
12650
|
-
return /* @__PURE__ */ (0,
|
|
12742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12651
12743
|
"text",
|
|
12652
12744
|
{
|
|
12653
12745
|
className: "text-body-foreground",
|
|
@@ -12661,7 +12753,7 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12661
12753
|
}
|
|
12662
12754
|
);
|
|
12663
12755
|
}
|
|
12664
|
-
(0,
|
|
12756
|
+
(0, import_react46.useEffect)(() => {
|
|
12665
12757
|
const raf = requestAnimationFrame(() => {
|
|
12666
12758
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
12667
12759
|
const mids = [];
|
|
@@ -12681,19 +12773,19 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12681
12773
|
if (startFromZero && (payload == null ? void 0 : payload.name) === "") {
|
|
12682
12774
|
return null;
|
|
12683
12775
|
}
|
|
12684
|
-
return /* @__PURE__ */ (0,
|
|
12685
|
-
/* @__PURE__ */ (0,
|
|
12686
|
-
/* @__PURE__ */ (0,
|
|
12776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
12777
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("circle", { cx, cy, fill, opacity: 0.2, r: 8 }),
|
|
12778
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("circle", { cx, cy, fill, r: 3.5, stroke, strokeWidth: 2 })
|
|
12687
12779
|
] });
|
|
12688
12780
|
}
|
|
12689
|
-
const chartContent = /* @__PURE__ */ (0,
|
|
12781
|
+
const chartContent = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12690
12782
|
"div",
|
|
12691
12783
|
{
|
|
12692
12784
|
style: {
|
|
12693
12785
|
width: totalChartWidth || "100%",
|
|
12694
12786
|
minWidth: totalChartWidth || "100%"
|
|
12695
12787
|
},
|
|
12696
|
-
children: /* @__PURE__ */ (0,
|
|
12788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
12697
12789
|
import_recharts2.AreaChart,
|
|
12698
12790
|
{
|
|
12699
12791
|
className: "bg-body-background [&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
|
|
@@ -12702,11 +12794,11 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12702
12794
|
margin: { left: -30 },
|
|
12703
12795
|
width: totalChartWidth || 400,
|
|
12704
12796
|
children: [
|
|
12705
|
-
/* @__PURE__ */ (0,
|
|
12706
|
-
/* @__PURE__ */ (0,
|
|
12707
|
-
/* @__PURE__ */ (0,
|
|
12797
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("linearGradient", { id: `colorGradient-${uniqueId}`, x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
12798
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "5%", stopColor: colorHex, stopOpacity: 0.3 }),
|
|
12799
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "95%", stopColor: colorHex, stopOpacity: 0 })
|
|
12708
12800
|
] }) }),
|
|
12709
|
-
/* @__PURE__ */ (0,
|
|
12801
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12710
12802
|
import_recharts2.CartesianGrid,
|
|
12711
12803
|
{
|
|
12712
12804
|
className: "stroke-neutral-light",
|
|
@@ -12716,7 +12808,7 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12716
12808
|
verticalPoints: tickPositions
|
|
12717
12809
|
}
|
|
12718
12810
|
),
|
|
12719
|
-
/* @__PURE__ */ (0,
|
|
12811
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12720
12812
|
import_recharts2.XAxis,
|
|
12721
12813
|
{
|
|
12722
12814
|
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
@@ -12726,7 +12818,7 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12726
12818
|
padding: { left: 35.5, right: 35.5 }
|
|
12727
12819
|
}
|
|
12728
12820
|
),
|
|
12729
|
-
/* @__PURE__ */ (0,
|
|
12821
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12730
12822
|
import_recharts2.YAxis,
|
|
12731
12823
|
{
|
|
12732
12824
|
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
@@ -12742,12 +12834,12 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12742
12834
|
ticks: [0, 20, 40, 60, 80, 100]
|
|
12743
12835
|
}
|
|
12744
12836
|
),
|
|
12745
|
-
/* @__PURE__ */ (0,
|
|
12837
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12746
12838
|
import_recharts2.Area,
|
|
12747
12839
|
{
|
|
12748
12840
|
activeDot: false,
|
|
12749
12841
|
dataKey: "value",
|
|
12750
|
-
dot: /* @__PURE__ */ (0,
|
|
12842
|
+
dot: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CustomDotWithShadow, { fill: colorHex, stroke: colorHex }),
|
|
12751
12843
|
fill: `url(#colorGradient-${uniqueId})`,
|
|
12752
12844
|
stroke: colorHex,
|
|
12753
12845
|
strokeWidth: 2,
|
|
@@ -12759,10 +12851,10 @@ var AreaChartComponent = (0, import_react45.forwardRef)((originalProps, ref) =>
|
|
|
12759
12851
|
)
|
|
12760
12852
|
}
|
|
12761
12853
|
);
|
|
12762
|
-
return /* @__PURE__ */ (0,
|
|
12763
|
-
label ? /* @__PURE__ */ (0,
|
|
12854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: [
|
|
12855
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
12764
12856
|
headerContent,
|
|
12765
|
-
needsScroll ? /* @__PURE__ */ (0,
|
|
12857
|
+
needsScroll ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(scrollArea_default, { direction: "x", size: "sm", children: chartContent }) : chartContent
|
|
12766
12858
|
] });
|
|
12767
12859
|
});
|
|
12768
12860
|
AreaChartComponent.displayName = "AreaChart";
|
|
@@ -12790,10 +12882,10 @@ var areaChartStyle = tv({
|
|
|
12790
12882
|
});
|
|
12791
12883
|
|
|
12792
12884
|
// src/components/charts/barChart.tsx
|
|
12793
|
-
var
|
|
12885
|
+
var import_react47 = require("react");
|
|
12794
12886
|
var import_recharts3 = require("recharts");
|
|
12795
|
-
var
|
|
12796
|
-
var BarChartComponent = (0,
|
|
12887
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
12888
|
+
var BarChartComponent = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
12797
12889
|
const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
|
|
12798
12890
|
const {
|
|
12799
12891
|
data = [],
|
|
@@ -12805,13 +12897,13 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12805
12897
|
barGap = 20,
|
|
12806
12898
|
tooltipFormatter
|
|
12807
12899
|
} = { ...props, ...variantProps };
|
|
12808
|
-
const slots = (0,
|
|
12809
|
-
const chartRef = (0,
|
|
12810
|
-
const tooltipRef = (0,
|
|
12811
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
12812
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12813
|
-
const tickRef = (0,
|
|
12814
|
-
const [tooltipState, setTooltipState] = (0,
|
|
12900
|
+
const slots = (0, import_react47.useMemo)(() => barChartStyle({ ...variantProps }), [variantProps]);
|
|
12901
|
+
const chartRef = (0, import_react47.useRef)(null);
|
|
12902
|
+
const tooltipRef = (0, import_react47.useRef)(null);
|
|
12903
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react47.useState)(0);
|
|
12904
|
+
const [tickPositions, setTickPositions] = (0, import_react47.useState)([]);
|
|
12905
|
+
const tickRef = (0, import_react47.useRef)([]);
|
|
12906
|
+
const [tooltipState, setTooltipState] = (0, import_react47.useState)(null);
|
|
12815
12907
|
const handleMouseEnter = (e, dataKey) => {
|
|
12816
12908
|
if (!tooltipFormatter || !chartRef.current) return;
|
|
12817
12909
|
const { payload, x, y } = e;
|
|
@@ -12840,17 +12932,17 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12840
12932
|
const adjustedHeight = height + extraHeight;
|
|
12841
12933
|
const adjustedY = y;
|
|
12842
12934
|
const bottomY = adjustedY + adjustedHeight;
|
|
12843
|
-
return height ? /* @__PURE__ */ (0,
|
|
12935
|
+
return height ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12844
12936
|
"path",
|
|
12845
12937
|
{
|
|
12846
12938
|
d: `M${x},${bottomY} L${x},${adjustedY + radius} Q${x},${adjustedY} ${x + radius},${adjustedY} L${x + width - radius},${adjustedY} Q${x + width},${adjustedY} ${x + width},${adjustedY + radius} L${x + width},${bottomY} Z`,
|
|
12847
12939
|
fill
|
|
12848
12940
|
}
|
|
12849
|
-
) : /* @__PURE__ */ (0,
|
|
12941
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("rect", { fill, height: 0, width, x, y });
|
|
12850
12942
|
}
|
|
12851
12943
|
function CustomTick({ x, y, payload }) {
|
|
12852
12944
|
if (x !== void 0) tickRef.current.push(x);
|
|
12853
|
-
return /* @__PURE__ */ (0,
|
|
12945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12854
12946
|
"text",
|
|
12855
12947
|
{
|
|
12856
12948
|
className: "text-body-foreground",
|
|
@@ -12865,7 +12957,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12865
12957
|
);
|
|
12866
12958
|
}
|
|
12867
12959
|
function CustomYAxisTick({ x, y, payload }) {
|
|
12868
|
-
return /* @__PURE__ */ (0,
|
|
12960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12869
12961
|
"text",
|
|
12870
12962
|
{
|
|
12871
12963
|
className: "text-body-foreground",
|
|
@@ -12880,7 +12972,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12880
12972
|
}
|
|
12881
12973
|
);
|
|
12882
12974
|
}
|
|
12883
|
-
(0,
|
|
12975
|
+
(0, import_react47.useEffect)(() => {
|
|
12884
12976
|
const raf = requestAnimationFrame(() => {
|
|
12885
12977
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
12886
12978
|
const mids = [];
|
|
@@ -12894,7 +12986,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12894
12986
|
cancelAnimationFrame(raf);
|
|
12895
12987
|
};
|
|
12896
12988
|
}, [data]);
|
|
12897
|
-
(0,
|
|
12989
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
12898
12990
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
12899
12991
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
12900
12992
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
@@ -12909,7 +13001,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12909
13001
|
}
|
|
12910
13002
|
setTooltipLeft(left);
|
|
12911
13003
|
}, [tooltipState]);
|
|
12912
|
-
return /* @__PURE__ */ (0,
|
|
13004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
12913
13005
|
"div",
|
|
12914
13006
|
{
|
|
12915
13007
|
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
@@ -12922,8 +13014,8 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12922
13014
|
},
|
|
12923
13015
|
ref: chartRef,
|
|
12924
13016
|
children: [
|
|
12925
|
-
label ? /* @__PURE__ */ (0,
|
|
12926
|
-
/* @__PURE__ */ (0,
|
|
13017
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
13018
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_recharts3.ResponsiveContainer, { height: "100%", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
12927
13019
|
import_recharts3.BarChart,
|
|
12928
13020
|
{
|
|
12929
13021
|
barGap,
|
|
@@ -12932,21 +13024,21 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12932
13024
|
data,
|
|
12933
13025
|
margin: { left: -20 },
|
|
12934
13026
|
children: [
|
|
12935
|
-
/* @__PURE__ */ (0,
|
|
12936
|
-
/* @__PURE__ */ (0,
|
|
12937
|
-
/* @__PURE__ */ (0,
|
|
12938
|
-
/* @__PURE__ */ (0,
|
|
13027
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("defs", { children: [
|
|
13028
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id: "blueGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
13029
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0%", stopColor: "#DEC1FA" }),
|
|
13030
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "100%", stopColor: "#3F9CF2" })
|
|
12939
13031
|
] }),
|
|
12940
|
-
/* @__PURE__ */ (0,
|
|
12941
|
-
/* @__PURE__ */ (0,
|
|
12942
|
-
/* @__PURE__ */ (0,
|
|
13032
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id: "greenGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
13033
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0%", stopColor: "#C2E59C" }),
|
|
13034
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "100%", stopColor: "#64B3F4" })
|
|
12943
13035
|
] }),
|
|
12944
|
-
/* @__PURE__ */ (0,
|
|
12945
|
-
/* @__PURE__ */ (0,
|
|
12946
|
-
/* @__PURE__ */ (0,
|
|
13036
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("linearGradient", { id: "pinkGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
13037
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "0%", stopColor: "#DDD6F3" }),
|
|
13038
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("stop", { offset: "100%", stopColor: "#FAACA8" })
|
|
12947
13039
|
] })
|
|
12948
13040
|
] }),
|
|
12949
|
-
/* @__PURE__ */ (0,
|
|
13041
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12950
13042
|
import_recharts3.CartesianGrid,
|
|
12951
13043
|
{
|
|
12952
13044
|
className: "stroke-neutral-light",
|
|
@@ -12956,7 +13048,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12956
13048
|
verticalPoints: tickPositions
|
|
12957
13049
|
}
|
|
12958
13050
|
),
|
|
12959
|
-
/* @__PURE__ */ (0,
|
|
13051
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12960
13052
|
import_recharts3.XAxis,
|
|
12961
13053
|
{
|
|
12962
13054
|
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
@@ -12966,7 +13058,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12966
13058
|
tickLine: false
|
|
12967
13059
|
}
|
|
12968
13060
|
),
|
|
12969
|
-
/* @__PURE__ */ (0,
|
|
13061
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12970
13062
|
import_recharts3.YAxis,
|
|
12971
13063
|
{
|
|
12972
13064
|
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
@@ -12976,7 +13068,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12976
13068
|
ticks: yAxisTicks
|
|
12977
13069
|
}
|
|
12978
13070
|
),
|
|
12979
|
-
/* @__PURE__ */ (0,
|
|
13071
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12980
13072
|
import_recharts3.Bar,
|
|
12981
13073
|
{
|
|
12982
13074
|
dataKey: "blue",
|
|
@@ -12988,7 +13080,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
12988
13080
|
shape: CustomBarShape
|
|
12989
13081
|
}
|
|
12990
13082
|
),
|
|
12991
|
-
/* @__PURE__ */ (0,
|
|
13083
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
12992
13084
|
import_recharts3.Bar,
|
|
12993
13085
|
{
|
|
12994
13086
|
dataKey: "green",
|
|
@@ -13000,7 +13092,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
13000
13092
|
shape: CustomBarShape
|
|
13001
13093
|
}
|
|
13002
13094
|
),
|
|
13003
|
-
/* @__PURE__ */ (0,
|
|
13095
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13004
13096
|
import_recharts3.Bar,
|
|
13005
13097
|
{
|
|
13006
13098
|
dataKey: "pink",
|
|
@@ -13015,7 +13107,7 @@ var BarChartComponent = (0, import_react46.forwardRef)((originalProps, ref) => {
|
|
|
13015
13107
|
]
|
|
13016
13108
|
}
|
|
13017
13109
|
) }),
|
|
13018
|
-
tooltipFormatter ? /* @__PURE__ */ (0,
|
|
13110
|
+
tooltipFormatter ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13019
13111
|
"div",
|
|
13020
13112
|
{
|
|
13021
13113
|
ref: tooltipRef,
|
|
@@ -13049,7 +13141,7 @@ var barChartStyle = tv({
|
|
|
13049
13141
|
defaultVariants: {}
|
|
13050
13142
|
});
|
|
13051
13143
|
function BarChartTooltip({ className = "", children }) {
|
|
13052
|
-
return /* @__PURE__ */ (0,
|
|
13144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13053
13145
|
"div",
|
|
13054
13146
|
{
|
|
13055
13147
|
className: `text-md text-common-white bg-common-black flex max-w-[160px] whitespace-nowrap rounded-[5px] px-[10px] py-[6px] text-center font-bold ${className}`,
|
|
@@ -13060,13 +13152,13 @@ function BarChartTooltip({ className = "", children }) {
|
|
|
13060
13152
|
|
|
13061
13153
|
// src/components/charts/radarChart.tsx
|
|
13062
13154
|
var import_recharts4 = require("recharts");
|
|
13063
|
-
var
|
|
13064
|
-
var
|
|
13065
|
-
var RadarChart = (0,
|
|
13155
|
+
var import_react48 = require("react");
|
|
13156
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
13157
|
+
var RadarChart = (0, import_react48.forwardRef)((originalProps, ref) => {
|
|
13066
13158
|
const [props, variantProps] = mapPropsVariants(originalProps, radarChartStyle.variantKeys);
|
|
13067
13159
|
const { data, label, classNames, tooltipFormatter } = { ...props, ...variantProps };
|
|
13068
|
-
const slots = (0,
|
|
13069
|
-
const normalizedData = (0,
|
|
13160
|
+
const slots = (0, import_react48.useMemo)(() => radarChartStyle({ ...variantProps }), [variantProps]);
|
|
13161
|
+
const normalizedData = (0, import_react48.useMemo)(() => {
|
|
13070
13162
|
if (!data || data.length === 0) return [];
|
|
13071
13163
|
return data.map((item) => ({
|
|
13072
13164
|
...item,
|
|
@@ -13075,25 +13167,25 @@ var RadarChart = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
|
13075
13167
|
originalFullMark: item.fullMark || 100
|
|
13076
13168
|
}));
|
|
13077
13169
|
}, [data]);
|
|
13078
|
-
const containerHeight = (0,
|
|
13170
|
+
const containerHeight = (0, import_react48.useMemo)(() => {
|
|
13079
13171
|
if (!data || data.length === 0) return 250;
|
|
13080
13172
|
return data.length === 3 ? 245 : 306;
|
|
13081
13173
|
}, [data]);
|
|
13082
|
-
const chartMargin = (0,
|
|
13174
|
+
const chartMargin = (0, import_react48.useMemo)(() => {
|
|
13083
13175
|
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
13084
13176
|
}, [data]);
|
|
13085
|
-
const outerRadius = (0,
|
|
13177
|
+
const outerRadius = (0, import_react48.useMemo)(() => {
|
|
13086
13178
|
if (!data || data.length === 0) return 125;
|
|
13087
13179
|
return data.length === 3 ? 135 : 125;
|
|
13088
13180
|
}, [data]);
|
|
13089
|
-
const chartCenter = (0,
|
|
13181
|
+
const chartCenter = (0, import_react48.useMemo)(() => {
|
|
13090
13182
|
if (!data || data.length === 0) return {};
|
|
13091
13183
|
if (data.length === 3) return { cx: "50%", cy: "65%" };
|
|
13092
13184
|
return {};
|
|
13093
13185
|
}, [data]);
|
|
13094
|
-
return /* @__PURE__ */ (0,
|
|
13095
|
-
label ? /* @__PURE__ */ (0,
|
|
13096
|
-
/* @__PURE__ */ (0,
|
|
13186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: [
|
|
13187
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
13188
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { style: { width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_recharts4.ResponsiveContainer, { height: containerHeight, width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
13097
13189
|
import_recharts4.RadarChart,
|
|
13098
13190
|
{
|
|
13099
13191
|
data: normalizedData,
|
|
@@ -13102,8 +13194,8 @@ var RadarChart = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
|
13102
13194
|
...chartCenter,
|
|
13103
13195
|
className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
|
|
13104
13196
|
children: [
|
|
13105
|
-
/* @__PURE__ */ (0,
|
|
13106
|
-
/* @__PURE__ */ (0,
|
|
13197
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_recharts4.PolarGrid, { stroke: "#DFE2E7", strokeWidth: 1.75 }),
|
|
13198
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13107
13199
|
import_recharts4.PolarAngleAxis,
|
|
13108
13200
|
{
|
|
13109
13201
|
dataKey: "name",
|
|
@@ -13112,8 +13204,8 @@ var RadarChart = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
|
13112
13204
|
tickSize: 15
|
|
13113
13205
|
}
|
|
13114
13206
|
),
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
13116
|
-
/* @__PURE__ */ (0,
|
|
13207
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_recharts4.PolarRadiusAxis, { axisLine: false, domain: [0, 100], tick: false, tickCount: 6 }),
|
|
13208
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13117
13209
|
import_recharts4.Radar,
|
|
13118
13210
|
{
|
|
13119
13211
|
activeDot: false,
|
|
@@ -13125,7 +13217,7 @@ var RadarChart = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
|
13125
13217
|
strokeWidth: 1.75
|
|
13126
13218
|
}
|
|
13127
13219
|
),
|
|
13128
|
-
tooltipFormatter ? /* @__PURE__ */ (0,
|
|
13220
|
+
tooltipFormatter ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
13129
13221
|
import_recharts4.Tooltip,
|
|
13130
13222
|
{
|
|
13131
13223
|
allowEscapeViewBox: { x: true, y: true },
|
|
@@ -13134,7 +13226,7 @@ var RadarChart = (0, import_react47.forwardRef)((originalProps, ref) => {
|
|
|
13134
13226
|
const currentData = data == null ? void 0 : data.find((item) => item.name === tooltipLabel);
|
|
13135
13227
|
const shouldShowTooltip = active && payload && payload.length > 0 && tooltipLabel && currentData && ((_b = (_a = payload[0]) == null ? void 0 : _a.payload) == null ? void 0 : _b.value) !== void 0;
|
|
13136
13228
|
if (!shouldShowTooltip) return null;
|
|
13137
|
-
return /* @__PURE__ */ (0,
|
|
13229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: tooltipFormatter({
|
|
13138
13230
|
label: String(tooltipLabel),
|
|
13139
13231
|
data: currentData
|
|
13140
13232
|
}) });
|
|
@@ -13163,10 +13255,10 @@ var radarChartStyle = tv({
|
|
|
13163
13255
|
});
|
|
13164
13256
|
|
|
13165
13257
|
// src/components/charts/simpleBarChart.tsx
|
|
13166
|
-
var
|
|
13258
|
+
var import_react49 = require("react");
|
|
13167
13259
|
var import_recharts5 = require("recharts");
|
|
13168
|
-
var
|
|
13169
|
-
var SimpleBarChartComponent = (0,
|
|
13260
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
13261
|
+
var SimpleBarChartComponent = (0, import_react49.forwardRef)((originalProps, ref) => {
|
|
13170
13262
|
const [props, variantProps] = mapPropsVariants(originalProps, simpleBarChartStyle.variantKeys);
|
|
13171
13263
|
const {
|
|
13172
13264
|
data = [],
|
|
@@ -13177,13 +13269,13 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13177
13269
|
barGap = 20,
|
|
13178
13270
|
tooltipFormatter
|
|
13179
13271
|
} = { ...props, ...variantProps };
|
|
13180
|
-
const slots = (0,
|
|
13181
|
-
const chartRef = (0,
|
|
13182
|
-
const tooltipRef = (0,
|
|
13183
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
13184
|
-
const [tickPositions, setTickPositions] = (0,
|
|
13185
|
-
const [tooltipState, setTooltipState] = (0,
|
|
13186
|
-
(0,
|
|
13272
|
+
const slots = (0, import_react49.useMemo)(() => simpleBarChartStyle({ ...variantProps }), [variantProps]);
|
|
13273
|
+
const chartRef = (0, import_react49.useRef)(null);
|
|
13274
|
+
const tooltipRef = (0, import_react49.useRef)(null);
|
|
13275
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react49.useState)(0);
|
|
13276
|
+
const [tickPositions, setTickPositions] = (0, import_react49.useState)([]);
|
|
13277
|
+
const [tooltipState, setTooltipState] = (0, import_react49.useState)(null);
|
|
13278
|
+
(0, import_react49.useEffect)(() => {
|
|
13187
13279
|
if (!chartRef.current || !data.length) return;
|
|
13188
13280
|
const updateDimensions = () => {
|
|
13189
13281
|
if (!chartRef.current) return;
|
|
@@ -13234,16 +13326,16 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13234
13326
|
const adjustedHeight = height + extraHeight;
|
|
13235
13327
|
const adjustedY = y - extraHeight;
|
|
13236
13328
|
const bottomY = adjustedY + adjustedHeight;
|
|
13237
|
-
return height > 0 ? /* @__PURE__ */ (0,
|
|
13329
|
+
return height > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13238
13330
|
"path",
|
|
13239
13331
|
{
|
|
13240
13332
|
d: `M${x},${bottomY} L${x},${adjustedY + radius} Q${x},${adjustedY} ${x + radius},${adjustedY} L${x + width - radius},${adjustedY} Q${x + width},${adjustedY} ${x + width},${adjustedY + radius} L${x + width},${bottomY} Z`,
|
|
13241
13333
|
fill
|
|
13242
13334
|
}
|
|
13243
|
-
) : /* @__PURE__ */ (0,
|
|
13335
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("rect", { fill, height: 0, width, x, y });
|
|
13244
13336
|
}
|
|
13245
13337
|
function CustomTick({ x, y, payload }) {
|
|
13246
|
-
return /* @__PURE__ */ (0,
|
|
13338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13247
13339
|
"text",
|
|
13248
13340
|
{
|
|
13249
13341
|
className: "text-body-foreground",
|
|
@@ -13257,7 +13349,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13257
13349
|
}
|
|
13258
13350
|
);
|
|
13259
13351
|
}
|
|
13260
|
-
(0,
|
|
13352
|
+
(0, import_react49.useLayoutEffect)(() => {
|
|
13261
13353
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
13262
13354
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
13263
13355
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
@@ -13272,7 +13364,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13272
13364
|
}
|
|
13273
13365
|
setTooltipLeft(left);
|
|
13274
13366
|
}, [tooltipState]);
|
|
13275
|
-
return /* @__PURE__ */ (0,
|
|
13367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13276
13368
|
"div",
|
|
13277
13369
|
{
|
|
13278
13370
|
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
@@ -13285,8 +13377,8 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13285
13377
|
},
|
|
13286
13378
|
ref: chartRef,
|
|
13287
13379
|
children: [
|
|
13288
|
-
label ? /* @__PURE__ */ (0,
|
|
13289
|
-
/* @__PURE__ */ (0,
|
|
13380
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }) : null,
|
|
13381
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_recharts5.ResponsiveContainer, { height: 140, width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
13290
13382
|
import_recharts5.BarChart,
|
|
13291
13383
|
{
|
|
13292
13384
|
barGap,
|
|
@@ -13295,7 +13387,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13295
13387
|
data,
|
|
13296
13388
|
margin: { left: 0, right: 0, top: 0, bottom: 0 },
|
|
13297
13389
|
children: [
|
|
13298
|
-
/* @__PURE__ */ (0,
|
|
13390
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13299
13391
|
import_recharts5.CartesianGrid,
|
|
13300
13392
|
{
|
|
13301
13393
|
className: "stroke-neutral-light",
|
|
@@ -13305,7 +13397,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13305
13397
|
verticalPoints: tickPositions
|
|
13306
13398
|
}
|
|
13307
13399
|
),
|
|
13308
|
-
/* @__PURE__ */ (0,
|
|
13400
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13309
13401
|
import_recharts5.CartesianGrid,
|
|
13310
13402
|
{
|
|
13311
13403
|
className: "stroke-neutral-light",
|
|
@@ -13316,7 +13408,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13316
13408
|
verticalPoints: [0]
|
|
13317
13409
|
}
|
|
13318
13410
|
),
|
|
13319
|
-
/* @__PURE__ */ (0,
|
|
13411
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13320
13412
|
import_recharts5.XAxis,
|
|
13321
13413
|
{
|
|
13322
13414
|
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
@@ -13326,8 +13418,8 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13326
13418
|
tickLine: false
|
|
13327
13419
|
}
|
|
13328
13420
|
),
|
|
13329
|
-
/* @__PURE__ */ (0,
|
|
13330
|
-
/* @__PURE__ */ (0,
|
|
13421
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_recharts5.YAxis, { domain: yAxisDomain, hide: true, ticks: yAxisTicks }),
|
|
13422
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13331
13423
|
import_recharts5.Bar,
|
|
13332
13424
|
{
|
|
13333
13425
|
dataKey: "value",
|
|
@@ -13340,7 +13432,7 @@ var SimpleBarChartComponent = (0, import_react48.forwardRef)((originalProps, ref
|
|
|
13340
13432
|
]
|
|
13341
13433
|
}
|
|
13342
13434
|
) }),
|
|
13343
|
-
tooltipFormatter ? /* @__PURE__ */ (0,
|
|
13435
|
+
tooltipFormatter ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13344
13436
|
"div",
|
|
13345
13437
|
{
|
|
13346
13438
|
ref: tooltipRef,
|
|
@@ -13375,9 +13467,9 @@ var simpleBarChartStyle = tv({
|
|
|
13375
13467
|
});
|
|
13376
13468
|
|
|
13377
13469
|
// src/components/starRating/starRating.tsx
|
|
13378
|
-
var
|
|
13379
|
-
var
|
|
13380
|
-
var StarRating = (0,
|
|
13470
|
+
var import_react50 = require("react");
|
|
13471
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
13472
|
+
var StarRating = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
13381
13473
|
const [props, variantProps] = mapPropsVariants(originalProps, starRatingStyle.variantKeys);
|
|
13382
13474
|
const {
|
|
13383
13475
|
stars,
|
|
@@ -13390,8 +13482,8 @@ var StarRating = (0, import_react49.forwardRef)((originalProps, ref) => {
|
|
|
13390
13482
|
filledColor = "text-primary-main",
|
|
13391
13483
|
emptyColor = "text-neutral-soft"
|
|
13392
13484
|
} = { ...props, ...variantProps };
|
|
13393
|
-
const slots = (0,
|
|
13394
|
-
const [hoverRating, setHoverRating] = (0,
|
|
13485
|
+
const slots = (0, import_react50.useMemo)(() => starRatingStyle({ ...variantProps }), [variantProps]);
|
|
13486
|
+
const [hoverRating, setHoverRating] = (0, import_react50.useState)(0);
|
|
13395
13487
|
const handleStarClick = (starIndex, isHalf = false) => {
|
|
13396
13488
|
if (readOnly || !onChange) return;
|
|
13397
13489
|
let newRating;
|
|
@@ -13425,9 +13517,9 @@ var StarRating = (0, import_react49.forwardRef)((originalProps, ref) => {
|
|
|
13425
13517
|
const isEmpty = currentRating < starIndex - 1;
|
|
13426
13518
|
const isPartial = !isFull && !isEmpty;
|
|
13427
13519
|
const fillPercentage = isPartial ? (currentRating - (starIndex - 1)) * 100 : 0;
|
|
13428
|
-
return /* @__PURE__ */ (0,
|
|
13429
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13430
|
-
/* @__PURE__ */ (0,
|
|
13520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: slots.starWrapper({ class: classNames == null ? void 0 : classNames.starWrapper }), children: [
|
|
13521
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
13522
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13431
13523
|
"div",
|
|
13432
13524
|
{
|
|
13433
13525
|
className: slots.star({ class: classNames == null ? void 0 : classNames.star }),
|
|
@@ -13439,7 +13531,7 @@ var StarRating = (0, import_react49.forwardRef)((originalProps, ref) => {
|
|
|
13439
13531
|
}
|
|
13440
13532
|
}
|
|
13441
13533
|
),
|
|
13442
|
-
allowHalf ? /* @__PURE__ */ (0,
|
|
13534
|
+
allowHalf ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13443
13535
|
"div",
|
|
13444
13536
|
{
|
|
13445
13537
|
className: slots.starHalf({ class: classNames == null ? void 0 : classNames.starHalf }),
|
|
@@ -13452,25 +13544,25 @@ var StarRating = (0, import_react49.forwardRef)((originalProps, ref) => {
|
|
|
13452
13544
|
}
|
|
13453
13545
|
) : null
|
|
13454
13546
|
] }),
|
|
13455
|
-
/* @__PURE__ */ (0,
|
|
13456
|
-
isFull || isPartial ? /* @__PURE__ */ (0,
|
|
13457
|
-
/* @__PURE__ */ (0,
|
|
13458
|
-
/* @__PURE__ */ (0,
|
|
13547
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "relative", children: [
|
|
13548
|
+
isFull || isPartial ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
13549
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon_default, { className: emptyColor, fill: true, name: "star", size }),
|
|
13550
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13459
13551
|
"div",
|
|
13460
13552
|
{
|
|
13461
13553
|
className: "absolute top-0 left-0 h-full w-full",
|
|
13462
13554
|
style: {
|
|
13463
13555
|
clipPath: isFull ? "none" : `inset(0 ${100 - fillPercentage}% 0 0)`
|
|
13464
13556
|
},
|
|
13465
|
-
children: /* @__PURE__ */ (0,
|
|
13557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon_default, { className: filledColor, fill: true, name: "star", size })
|
|
13466
13558
|
}
|
|
13467
13559
|
)
|
|
13468
13560
|
] }) : null,
|
|
13469
|
-
isEmpty ? /* @__PURE__ */ (0,
|
|
13561
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon_default, { className: emptyColor, fill: true, name: "star", size }) : null
|
|
13470
13562
|
] })
|
|
13471
13563
|
] }, starIndex);
|
|
13472
13564
|
};
|
|
13473
|
-
return /* @__PURE__ */ (0,
|
|
13565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onMouseLeave: handleMouseLeave, ref, children: createRange(stars).map(renderStar) });
|
|
13474
13566
|
});
|
|
13475
13567
|
StarRating.displayName = "StarRating";
|
|
13476
13568
|
var starRating_default = StarRating;
|
|
@@ -13495,12 +13587,12 @@ var starRatingStyle = tv({
|
|
|
13495
13587
|
});
|
|
13496
13588
|
|
|
13497
13589
|
// src/components/slider/slider.tsx
|
|
13498
|
-
var
|
|
13499
|
-
var
|
|
13590
|
+
var import_react51 = require("react");
|
|
13591
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13500
13592
|
var clampPercentage2 = (value) => {
|
|
13501
13593
|
return Math.min(100, Math.max(0, value));
|
|
13502
13594
|
};
|
|
13503
|
-
var Slider = (0,
|
|
13595
|
+
var Slider = (0, import_react51.forwardRef)((originalProps, ref) => {
|
|
13504
13596
|
const [props, variantProps] = mapPropsVariants(originalProps, sliderStyle.variantKeys);
|
|
13505
13597
|
const {
|
|
13506
13598
|
children,
|
|
@@ -13514,12 +13606,12 @@ var Slider = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
|
13514
13606
|
disabled = false,
|
|
13515
13607
|
...restProps
|
|
13516
13608
|
} = props;
|
|
13517
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
13518
|
-
const [isDragging, setIsDragging] = (0,
|
|
13609
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react51.useState)(defaultValue);
|
|
13610
|
+
const [isDragging, setIsDragging] = (0, import_react51.useState)(false);
|
|
13519
13611
|
const isControlled = controlledValue !== void 0;
|
|
13520
13612
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
13521
|
-
const innerRef = (0,
|
|
13522
|
-
const calculateValue = (0,
|
|
13613
|
+
const innerRef = (0, import_react51.useRef)(null);
|
|
13614
|
+
const calculateValue = (0, import_react51.useCallback)(
|
|
13523
13615
|
(clientX) => {
|
|
13524
13616
|
if (!innerRef.current) return value;
|
|
13525
13617
|
const { left, width } = innerRef.current.getBoundingClientRect();
|
|
@@ -13530,7 +13622,7 @@ var Slider = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
|
13530
13622
|
},
|
|
13531
13623
|
[minValue, maxValue, step, value]
|
|
13532
13624
|
);
|
|
13533
|
-
const updateValue = (0,
|
|
13625
|
+
const updateValue = (0, import_react51.useCallback)(
|
|
13534
13626
|
(newValue) => {
|
|
13535
13627
|
if (!isControlled) {
|
|
13536
13628
|
setUncontrolledValue(newValue);
|
|
@@ -13577,7 +13669,7 @@ var Slider = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
|
13577
13669
|
updateValue(newValue);
|
|
13578
13670
|
}
|
|
13579
13671
|
};
|
|
13580
|
-
const setRefs = (0,
|
|
13672
|
+
const setRefs = (0, import_react51.useCallback)(
|
|
13581
13673
|
(node) => {
|
|
13582
13674
|
innerRef.current = node;
|
|
13583
13675
|
if (typeof ref === "function") {
|
|
@@ -13589,8 +13681,8 @@ var Slider = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
|
13589
13681
|
[ref]
|
|
13590
13682
|
);
|
|
13591
13683
|
const percentage = clampPercentage2((value - minValue) / (maxValue - minValue) * 100);
|
|
13592
|
-
const slots = (0,
|
|
13593
|
-
return /* @__PURE__ */ (0,
|
|
13684
|
+
const slots = (0, import_react51.useMemo)(() => sliderStyle({ ...variantProps }), [variantProps]);
|
|
13685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
13594
13686
|
"div",
|
|
13595
13687
|
{
|
|
13596
13688
|
"aria-valuemax": maxValue,
|
|
@@ -13606,14 +13698,14 @@ var Slider = (0, import_react50.forwardRef)((originalProps, ref) => {
|
|
|
13606
13698
|
tabIndex: disabled ? void 0 : 0,
|
|
13607
13699
|
...restProps,
|
|
13608
13700
|
children: [
|
|
13609
|
-
/* @__PURE__ */ (0,
|
|
13701
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: slots.track({ class: classNames == null ? void 0 : classNames.track }), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13610
13702
|
"div",
|
|
13611
13703
|
{
|
|
13612
13704
|
className: slots.indicator({ class: classNames == null ? void 0 : classNames.indicator }),
|
|
13613
13705
|
style: { width: `${percentage}%`, transitionDuration: isDragging ? "0ms" : void 0 }
|
|
13614
13706
|
}
|
|
13615
13707
|
) }),
|
|
13616
|
-
/* @__PURE__ */ (0,
|
|
13708
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13617
13709
|
"div",
|
|
13618
13710
|
{
|
|
13619
13711
|
className: slots.thumb({ class: classNames == null ? void 0 : classNames.thumb }),
|
|
@@ -13729,6 +13821,7 @@ var sliderStyle = tv({
|
|
|
13729
13821
|
GlobalModalProvider,
|
|
13730
13822
|
Icon,
|
|
13731
13823
|
IconButton,
|
|
13824
|
+
ImageButton,
|
|
13732
13825
|
Input,
|
|
13733
13826
|
List,
|
|
13734
13827
|
ListItem,
|