@scglab/admin-ui 0.1.7 → 0.1.8
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/index.cjs +190 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +13 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +185 -1
- package/dist/index.js.map +1 -1
- package/dist/stores/index.cjs +89 -0
- package/dist/stores/index.cjs.map +1 -0
- package/dist/stores/index.d.cts +39 -0
- package/dist/stores/index.d.ts +39 -0
- package/dist/stores/index.js +61 -0
- package/dist/stores/index.js.map +1 -0
- package/dist/styles/index.css +16 -1
- package/package.json +10 -3
package/dist/index.cjs
CHANGED
|
@@ -30,10 +30,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AlertConfirmModal: () => AlertConfirmModal_default,
|
|
33
34
|
BorderRadiusBox: () => BorderRadiusBox_default,
|
|
34
35
|
BulletText: () => BulletText_default,
|
|
35
36
|
Button: () => Button_default,
|
|
36
37
|
Checkbox: () => Checkbox_default,
|
|
38
|
+
CommonDataModal: () => CommonDataModal_default,
|
|
37
39
|
CommonTable: () => CommonTable_default,
|
|
38
40
|
Divider: () => Divider_default,
|
|
39
41
|
EmailInput: () => EmailInput_default,
|
|
@@ -65,7 +67,9 @@ __export(index_exports, {
|
|
|
65
67
|
fontWeight: () => fontWeight,
|
|
66
68
|
justifies: () => justifies,
|
|
67
69
|
justifySelfs: () => justifySelfs,
|
|
68
|
-
lineHeightSize: () => lineHeightSize
|
|
70
|
+
lineHeightSize: () => lineHeightSize,
|
|
71
|
+
useDialogStore: () => DialogStore_default,
|
|
72
|
+
useLoadingStore: () => LoadingStore_default
|
|
69
73
|
});
|
|
70
74
|
module.exports = __toCommonJS(index_exports);
|
|
71
75
|
|
|
@@ -3597,12 +3601,194 @@ var WarningBox = ({
|
|
|
3597
3601
|
);
|
|
3598
3602
|
};
|
|
3599
3603
|
var WarningBox_default = WarningBox;
|
|
3604
|
+
|
|
3605
|
+
// src/store/DialogStore.tsx
|
|
3606
|
+
var import_zustand = require("zustand");
|
|
3607
|
+
var useDialogStore = (0, import_zustand.create)((set) => ({
|
|
3608
|
+
isOpen: false,
|
|
3609
|
+
type: "alert",
|
|
3610
|
+
message: "",
|
|
3611
|
+
showAlert: ({ title, message, onConfirm }) => set({
|
|
3612
|
+
isOpen: true,
|
|
3613
|
+
type: "alert",
|
|
3614
|
+
title,
|
|
3615
|
+
message,
|
|
3616
|
+
onConfirm: () => {
|
|
3617
|
+
onConfirm?.();
|
|
3618
|
+
set({ isOpen: false });
|
|
3619
|
+
}
|
|
3620
|
+
}),
|
|
3621
|
+
showConfirm: ({ title, message, onConfirm, onCancel }) => set({
|
|
3622
|
+
isOpen: true,
|
|
3623
|
+
type: "confirm",
|
|
3624
|
+
title,
|
|
3625
|
+
message,
|
|
3626
|
+
onConfirm: () => {
|
|
3627
|
+
onConfirm();
|
|
3628
|
+
set({ isOpen: false });
|
|
3629
|
+
},
|
|
3630
|
+
onCancel: () => {
|
|
3631
|
+
onCancel?.();
|
|
3632
|
+
set({ isOpen: false });
|
|
3633
|
+
}
|
|
3634
|
+
}),
|
|
3635
|
+
showPrompt: ({ title, message, defaultValue, onConfirm, onCancel }) => set({
|
|
3636
|
+
isOpen: true,
|
|
3637
|
+
type: "prompt",
|
|
3638
|
+
title,
|
|
3639
|
+
message,
|
|
3640
|
+
defaultValue,
|
|
3641
|
+
onConfirm: (value) => {
|
|
3642
|
+
onConfirm(value || "");
|
|
3643
|
+
set({ isOpen: false });
|
|
3644
|
+
},
|
|
3645
|
+
onCancel: () => {
|
|
3646
|
+
onCancel?.();
|
|
3647
|
+
set({ isOpen: false });
|
|
3648
|
+
}
|
|
3649
|
+
}),
|
|
3650
|
+
close: () => set({ isOpen: false })
|
|
3651
|
+
}));
|
|
3652
|
+
var DialogStore_default = useDialogStore;
|
|
3653
|
+
|
|
3654
|
+
// src/store/LoadingStore.tsx
|
|
3655
|
+
var import_zustand2 = require("zustand");
|
|
3656
|
+
var useLoadingStore = (0, import_zustand2.create)((set) => ({
|
|
3657
|
+
isLoading: false,
|
|
3658
|
+
setLoading: (loading) => set({ isLoading: loading })
|
|
3659
|
+
}));
|
|
3660
|
+
var LoadingStore_default = useLoadingStore;
|
|
3661
|
+
|
|
3662
|
+
// src/components/modals/AlertConfirmModal.tsx
|
|
3663
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
3664
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3665
|
+
var AlertConfirmModal = () => {
|
|
3666
|
+
const dialog = DialogStore_default();
|
|
3667
|
+
const [inputValue, setInputValue] = (0, import_react13.useState)("");
|
|
3668
|
+
(0, import_react13.useEffect)(() => {
|
|
3669
|
+
if (dialog.isOpen && dialog.type === "prompt") {
|
|
3670
|
+
setInputValue(dialog.defaultValue || "");
|
|
3671
|
+
}
|
|
3672
|
+
}, [dialog.isOpen, dialog.type, dialog.defaultValue]);
|
|
3673
|
+
if (!dialog.isOpen) return null;
|
|
3674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "fixed inset-0 bg-black opacity-50" }),
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BorderRadiusBox_default, { paddingX: 12, paddingY: 12, className: "bg-white z-10 min-w-[320px]", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Stack_default, { direction: "col", gap: 20, wFull: true, className: "pt-12", children: [
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Stack_default, { direction: "col", gap: 12, wFull: true, children: [
|
|
3678
|
+
dialog.title && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { size: "body16", fontWeight: "bold", className: "px-12", children: dialog.title }),
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { size: "body16", fontWeight: "regular", className: "px-12", children: typeof dialog.message === "string" ? dialog.message.split(/\n|<br\s*\/?>/gi).map((line, index, array) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react13.default.Fragment, { children: [
|
|
3680
|
+
line,
|
|
3681
|
+
index < array.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("br", {})
|
|
3682
|
+
] }, index)) : dialog.message }),
|
|
3683
|
+
dialog.type === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3684
|
+
"input",
|
|
3685
|
+
{
|
|
3686
|
+
type: "text",
|
|
3687
|
+
value: inputValue,
|
|
3688
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
3689
|
+
className: "w-full border border-line rounded p-8",
|
|
3690
|
+
autoFocus: true
|
|
3691
|
+
}
|
|
3692
|
+
)
|
|
3693
|
+
] }),
|
|
3694
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Stack_default, { direction: "row", gap: 8, align: "center", justify: "center", children: [
|
|
3695
|
+
dialog.type !== "alert" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3696
|
+
Button_default,
|
|
3697
|
+
{
|
|
3698
|
+
variant: "lower",
|
|
3699
|
+
size: "medium",
|
|
3700
|
+
className: "flex-1",
|
|
3701
|
+
onClick: () => {
|
|
3702
|
+
dialog.onCancel?.();
|
|
3703
|
+
dialog.close();
|
|
3704
|
+
},
|
|
3705
|
+
children: "\uCDE8\uC18C"
|
|
3706
|
+
}
|
|
3707
|
+
),
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3709
|
+
Button_default,
|
|
3710
|
+
{
|
|
3711
|
+
variant: "primary",
|
|
3712
|
+
size: "medium",
|
|
3713
|
+
className: "flex-1",
|
|
3714
|
+
onClick: () => {
|
|
3715
|
+
if (dialog.type === "prompt") {
|
|
3716
|
+
dialog.onConfirm?.(inputValue);
|
|
3717
|
+
} else {
|
|
3718
|
+
dialog.onConfirm?.();
|
|
3719
|
+
}
|
|
3720
|
+
dialog.close();
|
|
3721
|
+
},
|
|
3722
|
+
children: "\uD655\uC778"
|
|
3723
|
+
}
|
|
3724
|
+
)
|
|
3725
|
+
] })
|
|
3726
|
+
] }) })
|
|
3727
|
+
] });
|
|
3728
|
+
};
|
|
3729
|
+
var AlertConfirmModal_default = AlertConfirmModal;
|
|
3730
|
+
|
|
3731
|
+
// src/components/modals/CommonDataModal.tsx
|
|
3732
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3733
|
+
function CommonDataModal({
|
|
3734
|
+
modalWidth = 1100,
|
|
3735
|
+
iconClose = true,
|
|
3736
|
+
title,
|
|
3737
|
+
titleTooltip,
|
|
3738
|
+
subText,
|
|
3739
|
+
data,
|
|
3740
|
+
useScroll = true,
|
|
3741
|
+
onClose
|
|
3742
|
+
}) {
|
|
3743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "fixed inset-0 bg-black opacity-50" }),
|
|
3745
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { width: toRemFunction2(modalWidth) }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3746
|
+
BorderRadiusBox_default,
|
|
3747
|
+
{
|
|
3748
|
+
radius: 12,
|
|
3749
|
+
paddingX: 28,
|
|
3750
|
+
paddingY: 24,
|
|
3751
|
+
className: "bg-white w-full flex flex-col gap-24 relative h-full max-h-[90vh]",
|
|
3752
|
+
children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Stack_default, { direction: "col", gap: 24, wFull: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Stack_default, { direction: "row", justify: "between", children: [
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Stack_default, { direction: "col", gap: 8, align: "start", children: [
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Stack_default, { direction: "row", gap: 20, align: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { size: "h6", fontWeight: "bold", children: title }) }),
|
|
3756
|
+
subText && subText,
|
|
3757
|
+
titleTooltip && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Tooltip_default, { position: "bottom", tooltipInfo: titleTooltip })
|
|
3758
|
+
] }),
|
|
3759
|
+
iconClose && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3760
|
+
"button",
|
|
3761
|
+
{
|
|
3762
|
+
type: "button",
|
|
3763
|
+
className: "cursor-pointer p-0 border-0 bg-transparent flex items-center justify-center",
|
|
3764
|
+
onClick: onClose,
|
|
3765
|
+
"aria-label": "\uB2EB\uAE30",
|
|
3766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ColorIcTagClose_default, { width: 20, height: 20 })
|
|
3767
|
+
}
|
|
3768
|
+
)
|
|
3769
|
+
] }) }),
|
|
3770
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3771
|
+
"div",
|
|
3772
|
+
{
|
|
3773
|
+
className: `h-full ${useScroll ? "overflow-y-auto" : ""}`,
|
|
3774
|
+
style: { maxHeight: "calc(90vh - 120px)" },
|
|
3775
|
+
children: data
|
|
3776
|
+
}
|
|
3777
|
+
)
|
|
3778
|
+
]
|
|
3779
|
+
}
|
|
3780
|
+
) })
|
|
3781
|
+
] });
|
|
3782
|
+
}
|
|
3783
|
+
var CommonDataModal_default = CommonDataModal;
|
|
3600
3784
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3601
3785
|
0 && (module.exports = {
|
|
3786
|
+
AlertConfirmModal,
|
|
3602
3787
|
BorderRadiusBox,
|
|
3603
3788
|
BulletText,
|
|
3604
3789
|
Button,
|
|
3605
3790
|
Checkbox,
|
|
3791
|
+
CommonDataModal,
|
|
3606
3792
|
CommonTable,
|
|
3607
3793
|
Divider,
|
|
3608
3794
|
EmailInput,
|
|
@@ -3634,6 +3820,8 @@ var WarningBox_default = WarningBox;
|
|
|
3634
3820
|
fontWeight,
|
|
3635
3821
|
justifies,
|
|
3636
3822
|
justifySelfs,
|
|
3637
|
-
lineHeightSize
|
|
3823
|
+
lineHeightSize,
|
|
3824
|
+
useDialogStore,
|
|
3825
|
+
useLoadingStore
|
|
3638
3826
|
});
|
|
3639
3827
|
//# sourceMappingURL=index.cjs.map
|