jongsultest 0.1.0
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.d.mts +339 -0
- package/dist/index.d.ts +339 -0
- package/dist/index.js +1280 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1234 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
- package/src/atoms/Badge.stories.tsx +136 -0
- package/src/atoms/Badge.tsx +46 -0
- package/src/atoms/Button.stories.tsx +142 -0
- package/src/atoms/Button.tsx +50 -0
- package/src/atoms/ComboboxAutocomplete.stories.tsx +43 -0
- package/src/atoms/ComboboxAutocomplete.tsx +6 -0
- package/src/atoms/ComboboxSelect.stories.tsx +56 -0
- package/src/atoms/ComboboxSelect.tsx +6 -0
- package/src/atoms/DateTimePicker.stories.tsx +42 -0
- package/src/atoms/DateTimePicker.tsx +6 -0
- package/src/atoms/Icon.stories.tsx +86 -0
- package/src/atoms/Icon.tsx +81 -0
- package/src/atoms/IconButton.stories.tsx +59 -0
- package/src/atoms/IconButton.tsx +19 -0
- package/src/atoms/InputColor.stories.tsx +42 -0
- package/src/atoms/InputColor.tsx +6 -0
- package/src/atoms/InputDatePicker.stories.tsx +55 -0
- package/src/atoms/InputDatePicker.tsx +6 -0
- package/src/atoms/InputFile.stories.tsx +57 -0
- package/src/atoms/InputFile.tsx +15 -0
- package/src/atoms/InputNumber.stories.tsx +58 -0
- package/src/atoms/InputNumber.tsx +15 -0
- package/src/atoms/InputPassword.stories.tsx +42 -0
- package/src/atoms/InputPassword.tsx +24 -0
- package/src/atoms/InputRadio.stories.tsx +65 -0
- package/src/atoms/InputRadio.tsx +19 -0
- package/src/atoms/InputSegmentedControl.stories.tsx +44 -0
- package/src/atoms/InputSegmentedControl.tsx +15 -0
- package/src/atoms/InputSwitch.stories.tsx +45 -0
- package/src/atoms/InputSwitch.tsx +23 -0
- package/src/atoms/InputSwitchInTable.stories.tsx +43 -0
- package/src/atoms/InputSwitchInTable.tsx +35 -0
- package/src/atoms/InputText.stories.tsx +42 -0
- package/src/atoms/InputText.tsx +7 -0
- package/src/atoms/InputTextarea.stories.tsx +50 -0
- package/src/atoms/InputTextarea.tsx +6 -0
- package/src/atoms/index.ts +20 -0
- package/src/atoms/inputClassNames.ts +20 -0
- package/src/blocks/Accordion.stories.tsx +102 -0
- package/src/blocks/Accordion.tsx +124 -0
- package/src/blocks/AccordionDraggable.stories.tsx +169 -0
- package/src/blocks/AccordionDraggable.tsx +200 -0
- package/src/blocks/BoxContainer.stories.tsx +34 -0
- package/src/blocks/BoxContainer.tsx +16 -0
- package/src/blocks/DataTable.tsx +127 -0
- package/src/blocks/DescriptionRow.stories.tsx +34 -0
- package/src/blocks/DescriptionRow.tsx +22 -0
- package/src/blocks/EditorLayout.stories.tsx +79 -0
- package/src/blocks/EditorLayout.tsx +43 -0
- package/src/blocks/ImageUpload.tsx +292 -0
- package/src/blocks/LabeledField.stories.tsx +34 -0
- package/src/blocks/LabeledField.tsx +31 -0
- package/src/blocks/MediDrawer.stories.tsx +58 -0
- package/src/blocks/MediDrawer.tsx +34 -0
- package/src/blocks/Modal.stories.tsx +42 -0
- package/src/blocks/Modal.tsx +31 -0
- package/src/blocks/ModalDeleteConfirm.stories.tsx +31 -0
- package/src/blocks/ModalDeleteConfirm.tsx +56 -0
- package/src/blocks/ModalTokenExpired.tsx +52 -0
- package/src/blocks/NavigationBanner.tsx +100 -0
- package/src/blocks/PageHeader.tsx +24 -0
- package/src/blocks/PageLoading.stories.tsx +22 -0
- package/src/blocks/PageLoading.tsx +19 -0
- package/src/blocks/PageTitle.stories.tsx +39 -0
- package/src/blocks/PageTitle.tsx +25 -0
- package/src/blocks/Pagination.tsx +49 -0
- package/src/blocks/Panel.stories.tsx +84 -0
- package/src/blocks/Panel.tsx +97 -0
- package/src/blocks/SectionGroupWithTitle.stories.tsx +24 -0
- package/src/blocks/SectionGroupWithTitle.tsx +21 -0
- package/src/blocks/Table.tsx +114 -0
- package/src/blocks/TagInput.stories.tsx +74 -0
- package/src/blocks/TagInput.tsx +93 -0
- package/src/blocks/index.ts +25 -0
- package/src/index.ts +51 -0
- package/src/utils/file.ts +7 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@mantine/core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var iconsReact = require('@tabler/icons-react');
|
|
6
|
+
var dates = require('@mantine/dates');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var react = require('react');
|
|
9
|
+
var notifications = require('@mantine/notifications');
|
|
10
|
+
var navigation = require('next/navigation');
|
|
11
|
+
var dnd = require('@hello-pangea/dnd');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
|
|
15
|
+
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __defProps = Object.defineProperties;
|
|
19
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
20
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
21
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
23
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
+
var __spreadValues = (a, b) => {
|
|
25
|
+
for (var prop in b || (b = {}))
|
|
26
|
+
if (__hasOwnProp.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
if (__getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
30
|
+
if (__propIsEnum.call(b, prop))
|
|
31
|
+
__defNormalProp(a, prop, b[prop]);
|
|
32
|
+
}
|
|
33
|
+
return a;
|
|
34
|
+
};
|
|
35
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
36
|
+
var __objRest = (source, exclude) => {
|
|
37
|
+
var target = {};
|
|
38
|
+
for (var prop in source)
|
|
39
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
40
|
+
target[prop] = source[prop];
|
|
41
|
+
if (source != null && __getOwnPropSymbols)
|
|
42
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
43
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
44
|
+
target[prop] = source[prop];
|
|
45
|
+
}
|
|
46
|
+
return target;
|
|
47
|
+
};
|
|
48
|
+
var COMMON_STYLES = {
|
|
49
|
+
"--button-fz": "14px",
|
|
50
|
+
"--button-radius": "6px"
|
|
51
|
+
};
|
|
52
|
+
var SIZE_STYLES = {
|
|
53
|
+
xs: {
|
|
54
|
+
"--button-height": "24px",
|
|
55
|
+
"--button-padding-x": "6px"
|
|
56
|
+
},
|
|
57
|
+
sm: {
|
|
58
|
+
"--button-height": "38px",
|
|
59
|
+
"--button-padding-x": "16px"
|
|
60
|
+
},
|
|
61
|
+
md: {
|
|
62
|
+
"--button-height": "40px",
|
|
63
|
+
"--button-padding-x": "24px"
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var getVariantStyles = (variant, color) => {
|
|
67
|
+
if (variant === "outline" && color === "gray") {
|
|
68
|
+
return { color: "var(--color-body)", borderColor: "var(--color-gray-3)" };
|
|
69
|
+
}
|
|
70
|
+
if (variant === "default") {
|
|
71
|
+
return { backgroundColor: "var(--mantine-color-blue-6)", color: "#FFFFFF", border: "none" };
|
|
72
|
+
}
|
|
73
|
+
if (variant === "light" && !color) {
|
|
74
|
+
return { backgroundColor: "var(--color-button-light)", color: "var(--color-body)", border: "none" };
|
|
75
|
+
}
|
|
76
|
+
return {};
|
|
77
|
+
};
|
|
78
|
+
var Button = (_a) => {
|
|
79
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
80
|
+
var _a2;
|
|
81
|
+
const sizeVars = (_a2 = SIZE_STYLES[props.size]) != null ? _a2 : SIZE_STYLES.md;
|
|
82
|
+
const variantStyles = getVariantStyles(props.variant, props.color);
|
|
83
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
84
|
+
core.Button,
|
|
85
|
+
__spreadProps(__spreadValues({}, props), {
|
|
86
|
+
classNames: { label: "!font-bold" },
|
|
87
|
+
style: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, COMMON_STYLES), sizeVars), variantStyles), style)
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// src/atoms/inputClassNames.ts
|
|
93
|
+
var inputClassNames = {
|
|
94
|
+
input: `!rounded-[8px] !border-input
|
|
95
|
+
!text-sm !h-12
|
|
96
|
+
|
|
97
|
+
data-[error=true]:!border-error-line
|
|
98
|
+
data-[error=true]:!border-2
|
|
99
|
+
data-[error=true]:!bg-error-fill
|
|
100
|
+
data-[error=true]:!text-body
|
|
101
|
+
|
|
102
|
+
data-[disabled=true]:!text-body
|
|
103
|
+
data-[disabled=true]:!bg-disabled-input
|
|
104
|
+
data-[disabled=true]:!opacity-100
|
|
105
|
+
data-[disabled=true]:!border-default
|
|
106
|
+
`,
|
|
107
|
+
label: "!text-sm !text-[#999] !font-bold !tracking-tight !mb-2",
|
|
108
|
+
placeholder: "!text-sm !tracking-normal",
|
|
109
|
+
error: "!mt-2 !ml-2",
|
|
110
|
+
description: "!-mt-[.5px] !mb-2",
|
|
111
|
+
root: "!leading-0"
|
|
112
|
+
};
|
|
113
|
+
var InputText = (props) => {
|
|
114
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.TextInput, __spreadValues({ classNames: inputClassNames }, props));
|
|
115
|
+
};
|
|
116
|
+
var InputPassword = (props) => {
|
|
117
|
+
const { error } = props;
|
|
118
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
core.PasswordInput,
|
|
120
|
+
__spreadValues({
|
|
121
|
+
classNames: inputClassNames,
|
|
122
|
+
error: typeof error === "string" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start gap-2", children: [
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconAlertCircle, { size: 16, className: "mt-[2px] shrink-0" }),
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
|
|
125
|
+
] }) : error
|
|
126
|
+
}, props)
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
var InputNumber = (props) => {
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
core.NumberInput,
|
|
132
|
+
__spreadValues({
|
|
133
|
+
classNames: __spreadProps(__spreadValues({}, inputClassNames), {
|
|
134
|
+
controls: "!h-8 !border-input",
|
|
135
|
+
control: "!border-input"
|
|
136
|
+
})
|
|
137
|
+
}, props)
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
var InputColor = (props) => {
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.ColorInput, __spreadValues({ classNames: inputClassNames }, props));
|
|
142
|
+
};
|
|
143
|
+
var InputFile = ((props) => {
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.FileInput, __spreadValues({ classNames: inputClassNames }, props));
|
|
145
|
+
});
|
|
146
|
+
var InputDatePicker = (props) => {
|
|
147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dates.DatePickerInput, __spreadProps(__spreadValues({ classNames: inputClassNames }, props), { valueFormat: "YYYY-MM-DD" }));
|
|
148
|
+
};
|
|
149
|
+
var InputTextarea = (props) => {
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Textarea, __spreadValues({ classNames: __spreadProps(__spreadValues({}, inputClassNames), { input: `${inputClassNames.input} !py-3` }) }, props));
|
|
151
|
+
};
|
|
152
|
+
var RadioBase = (props) => {
|
|
153
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Radio, __spreadValues({}, props));
|
|
154
|
+
};
|
|
155
|
+
var RadioGroup = (props) => {
|
|
156
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Radio.Group, __spreadValues({ classNames: { label: inputClassNames.label } }, props));
|
|
157
|
+
};
|
|
158
|
+
var InputRadio = Object.assign(RadioBase, {
|
|
159
|
+
Group: RadioGroup
|
|
160
|
+
});
|
|
161
|
+
var InputSwitch = (_a) => {
|
|
162
|
+
var _b = _a, { checked, style, classNames } = _b, props = __objRest(_b, ["checked", "style", "classNames"]);
|
|
163
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
+
core.Switch,
|
|
165
|
+
__spreadProps(__spreadValues({
|
|
166
|
+
checked,
|
|
167
|
+
thumbIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconCheck, { size: 10, color: "white", stroke: 3 })
|
|
168
|
+
}, props), {
|
|
169
|
+
style: __spreadValues(__spreadValues({}, typeof style === "object" && style || {}), !checked && { "--switch-thumb-start": "6px" }),
|
|
170
|
+
classNames: __spreadValues({
|
|
171
|
+
thumb: "!w-[10px] !h-[10px] text-white",
|
|
172
|
+
label: "!text-gray-6 !font-medium"
|
|
173
|
+
}, classNames)
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
var InputSwitchInTable = ({
|
|
178
|
+
status,
|
|
179
|
+
onStatusChange,
|
|
180
|
+
id,
|
|
181
|
+
activeValue = "ACTIVE",
|
|
182
|
+
inactiveValue = "HIDDEN",
|
|
183
|
+
activeLabel = "\uD65C\uC131",
|
|
184
|
+
inactiveLabel = "\uC228\uAE40"
|
|
185
|
+
}) => {
|
|
186
|
+
const isActive = status === activeValue;
|
|
187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
InputSwitch,
|
|
189
|
+
{
|
|
190
|
+
checked: isActive,
|
|
191
|
+
onChange: () => onStatusChange(id, isActive ? inactiveValue : activeValue),
|
|
192
|
+
size: "sm",
|
|
193
|
+
classNames: { label: "!font-semibold" }
|
|
194
|
+
}
|
|
195
|
+
) });
|
|
196
|
+
};
|
|
197
|
+
var InputSegmentedControl = (props) => {
|
|
198
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
+
core.SegmentedControl,
|
|
200
|
+
__spreadValues({
|
|
201
|
+
classNames: {
|
|
202
|
+
root: "p-2! rounded-md!",
|
|
203
|
+
// 루트
|
|
204
|
+
control: "",
|
|
205
|
+
// 버튼
|
|
206
|
+
label: "h-10 px-4 text-sm",
|
|
207
|
+
// 텍스트 패딩/타이포
|
|
208
|
+
innerLabel: "leading-9 color-white"
|
|
209
|
+
// 선택 인디케이터 높이도 같이
|
|
210
|
+
}
|
|
211
|
+
}, props)
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
var ComboboxSelect = (props) => {
|
|
215
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Select, __spreadValues({ classNames: inputClassNames }, props));
|
|
216
|
+
};
|
|
217
|
+
var ComboboxAutocomplete = (props) => {
|
|
218
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Autocomplete, __spreadValues({ classNames: inputClassNames }, props));
|
|
219
|
+
};
|
|
220
|
+
var DateTimePicker = (props) => {
|
|
221
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dates.DateTimePicker, __spreadValues({ classNames: inputClassNames }, props));
|
|
222
|
+
};
|
|
223
|
+
var REMOVE_ABLE_BADGE_STYLES = {
|
|
224
|
+
light: "gray",
|
|
225
|
+
blue: "gray"
|
|
226
|
+
// blue 임시 작업 blue 인 경우 생기면 컬러 변경 하셔도 됩니다.
|
|
227
|
+
};
|
|
228
|
+
var Badge = (_a) => {
|
|
229
|
+
var _b = _a, {
|
|
230
|
+
className,
|
|
231
|
+
classNames,
|
|
232
|
+
isRemoveAble = false,
|
|
233
|
+
onRemove
|
|
234
|
+
} = _b, props = __objRest(_b, [
|
|
235
|
+
"className",
|
|
236
|
+
"classNames",
|
|
237
|
+
"isRemoveAble",
|
|
238
|
+
"onRemove"
|
|
239
|
+
]);
|
|
240
|
+
var _a2;
|
|
241
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
242
|
+
core.Badge,
|
|
243
|
+
__spreadProps(__spreadValues({}, props), {
|
|
244
|
+
className,
|
|
245
|
+
classNames: __spreadProps(__spreadValues({}, classNames), {
|
|
246
|
+
label: clsx__default.default("!text-xs !font-semibold", classNames == null ? void 0 : classNames.label)
|
|
247
|
+
}),
|
|
248
|
+
rightSection: props.rightSection || (isRemoveAble ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
249
|
+
core.ActionIcon,
|
|
250
|
+
{
|
|
251
|
+
size: "xs",
|
|
252
|
+
variant: "transparent",
|
|
253
|
+
color: REMOVE_ABLE_BADGE_STYLES[(_a2 = props.variant) != null ? _a2 : "blue"],
|
|
254
|
+
onClick: onRemove,
|
|
255
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconX, { size: 12 })
|
|
256
|
+
}
|
|
257
|
+
) : void 0),
|
|
258
|
+
styles: {
|
|
259
|
+
root: {
|
|
260
|
+
"--mantine-color-gray-light-color": "var(--color-body)",
|
|
261
|
+
"--mantine-color-green-light-color": "#166534"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
var IconButton = (_a) => {
|
|
268
|
+
var _b = _a, { icon: Icon, iconSize, iconColor, disabled, children } = _b, props = __objRest(_b, ["icon", "iconSize", "iconColor", "disabled", "children"]);
|
|
269
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.ActionIcon, __spreadProps(__spreadValues({ variant: "subtle", color: "gray", disabled }, props), { children: Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: iconSize, color: iconColor, disabled }) : children }));
|
|
270
|
+
};
|
|
271
|
+
var colorPreset = {
|
|
272
|
+
red: "#FF4242",
|
|
273
|
+
white: "#FFFFFF",
|
|
274
|
+
gray: "#666666",
|
|
275
|
+
disabled: "#DDDDDD"
|
|
276
|
+
};
|
|
277
|
+
var resolveColor = (color) => {
|
|
278
|
+
var _a;
|
|
279
|
+
return (_a = colorPreset[color]) != null ? _a : color;
|
|
280
|
+
};
|
|
281
|
+
var PlusIcon = ({ size = 20, color = "gray", disabled }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: [
|
|
282
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "10", fill: disabled ? resolveColor("disabled") : resolveColor(color) }),
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 5.5V14.5M14.5 10L5.5 10", stroke: "white", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
284
|
+
] });
|
|
285
|
+
var TrashIcon = ({ size = 20, color = "gray" }) => {
|
|
286
|
+
const c = resolveColor(color);
|
|
287
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: [
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
"path",
|
|
290
|
+
{
|
|
291
|
+
d: "M14 4.5V2C14 1.72386 13.7761 1.5 13.5 1.5H6.5C6.22386 1.5 6 1.72386 6 2V4.5",
|
|
292
|
+
stroke: c,
|
|
293
|
+
strokeWidth: "1.2"
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4H18", stroke: c, strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
297
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
298
|
+
"path",
|
|
299
|
+
{
|
|
300
|
+
d: "M4 7.00028V17C4 17.5523 4.44772 18 5 18H15C15.5523 18 16 17.5523 16 17V7",
|
|
301
|
+
stroke: c,
|
|
302
|
+
strokeWidth: "1.2",
|
|
303
|
+
strokeLinecap: "round"
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 7V13", stroke: c, strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 7V13", stroke: c, strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
308
|
+
] });
|
|
309
|
+
};
|
|
310
|
+
var GripVerticalIcon = ({ size = 20, color = "gray" }) => {
|
|
311
|
+
const c = resolveColor(color);
|
|
312
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
313
|
+
"svg",
|
|
314
|
+
{
|
|
315
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
316
|
+
width: size,
|
|
317
|
+
height: size,
|
|
318
|
+
viewBox: "0 0 20 20",
|
|
319
|
+
fill: "none",
|
|
320
|
+
className: "cursor-grab",
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "6.5", y: "3.5", width: "1.2", height: "1.2", rx: "0.6", stroke: c }),
|
|
323
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "6.5", y: "9.39844", width: "1.2", height: "1.2", rx: "0.6", stroke: c }),
|
|
324
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "6.5", y: "15.3008", width: "1.2", height: "1.2", rx: "0.6", stroke: c }),
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "12.3008", y: "3.5", width: "1.2", height: "1.2", rx: "0.6", stroke: c }),
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "12.3008", y: "9.39844", width: "1.2", height: "1.2", rx: "0.6", stroke: c }),
|
|
327
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "12.3008", y: "15.3008", width: "1.2", height: "1.2", rx: "0.6", stroke: c })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
};
|
|
332
|
+
var ChevronDownIcon = ({ size = 20, color = "#191919" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
333
|
+
"path",
|
|
334
|
+
{
|
|
335
|
+
d: "M16 7L10.0007 13L4 7",
|
|
336
|
+
stroke: resolveColor(color),
|
|
337
|
+
strokeWidth: "1.2",
|
|
338
|
+
strokeLinecap: "round",
|
|
339
|
+
strokeLinejoin: "round"
|
|
340
|
+
}
|
|
341
|
+
) });
|
|
342
|
+
function Table({
|
|
343
|
+
columns,
|
|
344
|
+
data,
|
|
345
|
+
rowKey,
|
|
346
|
+
emptyMessage = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
347
|
+
highlightOnHover = false,
|
|
348
|
+
onRowClick
|
|
349
|
+
}) {
|
|
350
|
+
const getRowKey = (row, index) => {
|
|
351
|
+
if (!rowKey) return String(index);
|
|
352
|
+
if (typeof rowKey === "function") return rowKey(row, index);
|
|
353
|
+
return String(row[rowKey]);
|
|
354
|
+
};
|
|
355
|
+
const getCellValue = (row, column, index) => {
|
|
356
|
+
if (column.render) {
|
|
357
|
+
return column.render(row, index);
|
|
358
|
+
}
|
|
359
|
+
if (column.accessor) {
|
|
360
|
+
return row[column.accessor];
|
|
361
|
+
}
|
|
362
|
+
return null;
|
|
363
|
+
};
|
|
364
|
+
if (data.length === 0) {
|
|
365
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { py: "xl", style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "dimmed", children: emptyMessage }) });
|
|
366
|
+
}
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
368
|
+
core.Table,
|
|
369
|
+
{
|
|
370
|
+
highlightOnHover,
|
|
371
|
+
verticalSpacing: "md",
|
|
372
|
+
classNames: {
|
|
373
|
+
table: "!border-default !overflow-hidden !border-separate",
|
|
374
|
+
thead: "!bg-gray-0",
|
|
375
|
+
th: "!text-center !border-b !border-default",
|
|
376
|
+
td: "!text-center !border-b !border-default"
|
|
377
|
+
},
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Table.Thead, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Table.Tr, { children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
380
|
+
core.Table.Th,
|
|
381
|
+
{
|
|
382
|
+
style: {
|
|
383
|
+
textAlign: column.align || "left",
|
|
384
|
+
width: column.width
|
|
385
|
+
},
|
|
386
|
+
children: column.header
|
|
387
|
+
},
|
|
388
|
+
column.id
|
|
389
|
+
)) }) }),
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Table.Tbody, { children: data.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
391
|
+
core.Table.Tr,
|
|
392
|
+
{
|
|
393
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row, index),
|
|
394
|
+
style: { cursor: onRowClick ? "pointer" : void 0 },
|
|
395
|
+
children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
396
|
+
core.Table.Td,
|
|
397
|
+
{
|
|
398
|
+
style: {
|
|
399
|
+
textAlign: column.align || "left",
|
|
400
|
+
width: column.width
|
|
401
|
+
},
|
|
402
|
+
children: getCellValue(row, column, index)
|
|
403
|
+
},
|
|
404
|
+
column.id
|
|
405
|
+
))
|
|
406
|
+
},
|
|
407
|
+
getRowKey(row, index)
|
|
408
|
+
)) })
|
|
409
|
+
]
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
function Pagination({
|
|
414
|
+
total,
|
|
415
|
+
page,
|
|
416
|
+
onChange,
|
|
417
|
+
siblings = 1,
|
|
418
|
+
boundaries = 1,
|
|
419
|
+
size = "sm",
|
|
420
|
+
withEdges = true,
|
|
421
|
+
position = "center"
|
|
422
|
+
}) {
|
|
423
|
+
if (total <= 0) return null;
|
|
424
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Group, { justify: position, mt: "xl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
425
|
+
core.Pagination,
|
|
426
|
+
{
|
|
427
|
+
total,
|
|
428
|
+
value: page,
|
|
429
|
+
onChange,
|
|
430
|
+
siblings,
|
|
431
|
+
boundaries,
|
|
432
|
+
size,
|
|
433
|
+
withEdges
|
|
434
|
+
}
|
|
435
|
+
) });
|
|
436
|
+
}
|
|
437
|
+
function Accordion({
|
|
438
|
+
items,
|
|
439
|
+
defaultOpen = [],
|
|
440
|
+
multiple = true,
|
|
441
|
+
variant = "separated",
|
|
442
|
+
onChange
|
|
443
|
+
}) {
|
|
444
|
+
if (multiple) {
|
|
445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
|
+
core.Accordion,
|
|
447
|
+
{
|
|
448
|
+
variant,
|
|
449
|
+
multiple: true,
|
|
450
|
+
defaultValue: defaultOpen,
|
|
451
|
+
chevron: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {}),
|
|
452
|
+
styles: accordionStyles,
|
|
453
|
+
onChange,
|
|
454
|
+
classNames: { label: "!py-4" },
|
|
455
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(AccordionItem, { item }, item.id))
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
460
|
+
core.Accordion,
|
|
461
|
+
{
|
|
462
|
+
variant,
|
|
463
|
+
defaultValue: defaultOpen[0],
|
|
464
|
+
chevron: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {}),
|
|
465
|
+
styles: accordionStyles,
|
|
466
|
+
onChange,
|
|
467
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(AccordionItem, { item }, item.id))
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function AccordionItem({ item }) {
|
|
472
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Accordion.Item, { value: item.id, children: [
|
|
473
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Accordion.Control, { disabled: item.disabled, icon: item.icon, children: /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { justify: "space-between", wrap: "nowrap", style: { flex: 1 }, children: [
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 500, children: item.title }),
|
|
475
|
+
item.rightSection && /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: (e) => e.stopPropagation(), children: item.rightSection })
|
|
476
|
+
] }) }),
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Accordion.Panel, { children: /* @__PURE__ */ jsxRuntime.jsxs(core.Stack, { gap: "md", children: [
|
|
478
|
+
item.description && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "sm", c: "dimmed", children: item.description }),
|
|
479
|
+
item.content
|
|
480
|
+
] }) })
|
|
481
|
+
] });
|
|
482
|
+
}
|
|
483
|
+
var accordionStyles = {
|
|
484
|
+
control: { padding: "17px 24px" },
|
|
485
|
+
item: { "--item-filled-color": "#F3F9FF" }
|
|
486
|
+
};
|
|
487
|
+
Accordion.Root = ((props) => /* @__PURE__ */ jsxRuntime.jsx(core.Accordion, __spreadValues({ chevron: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {}), styles: accordionStyles }, props)));
|
|
488
|
+
Accordion.Item = core.Accordion.Item;
|
|
489
|
+
Accordion.Control = core.Accordion.Control;
|
|
490
|
+
Accordion.Panel = core.Accordion.Panel;
|
|
491
|
+
function NavigationBanner({
|
|
492
|
+
items,
|
|
493
|
+
currentIndex: controlledIndex,
|
|
494
|
+
onIndexChange,
|
|
495
|
+
imageSize = 275,
|
|
496
|
+
emptyText = "\uC774\uBBF8\uC9C0\uB97C \uCD94\uAC00\uD558\uC138\uC694",
|
|
497
|
+
showNavigation = true,
|
|
498
|
+
className
|
|
499
|
+
}) {
|
|
500
|
+
const [internalIndex, setInternalIndex] = react.useState(0);
|
|
501
|
+
const currentIndex = controlledIndex != null ? controlledIndex : internalIndex;
|
|
502
|
+
const setCurrentIndex = onIndexChange != null ? onIndexChange : setInternalIndex;
|
|
503
|
+
react.useEffect(() => {
|
|
504
|
+
if (currentIndex >= items.length && items.length > 0) {
|
|
505
|
+
setCurrentIndex(items.length - 1);
|
|
506
|
+
}
|
|
507
|
+
}, [items.length, currentIndex, setCurrentIndex]);
|
|
508
|
+
const isItems = items.length > 0;
|
|
509
|
+
const currentItem = items[currentIndex];
|
|
510
|
+
const isMultiple = items.length > 1;
|
|
511
|
+
const handlePrev = () => {
|
|
512
|
+
const newIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
|
|
513
|
+
setCurrentIndex(newIndex);
|
|
514
|
+
};
|
|
515
|
+
const handleNext = () => {
|
|
516
|
+
const newIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
|
|
517
|
+
setCurrentIndex(newIndex);
|
|
518
|
+
};
|
|
519
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className, children: [
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { className: "overflow-hidden rounded-sm bg-gray-100", style: { width: imageSize, height: imageSize }, children: isItems && currentItem ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: currentItem.image, alt: currentItem.title, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsx(core.Box, { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "dimmed", children: emptyText }) }) }),
|
|
521
|
+
showNavigation && /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { justify: "center", gap: "md", mt: "sm", style: { width: imageSize }, children: [
|
|
522
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.ActionIcon, { variant: "subtle", color: "gray", size: "sm", onClick: handlePrev, disabled: !isMultiple, children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconChevronLeft, { size: 18 }) }),
|
|
523
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", fw: 600, className: "flex-1 text-center tracking-wider uppercase", lineClamp: 1, children: (currentItem == null ? void 0 : currentItem.title) || "\uC81C\uBAA9 \uC5C6\uC74C" }),
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.ActionIcon, { variant: "subtle", color: "gray", size: "sm", onClick: handleNext, disabled: !isMultiple, children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconChevronRight, { size: 18 }) })
|
|
525
|
+
] })
|
|
526
|
+
] });
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// src/utils/file.ts
|
|
530
|
+
function readFileAsDataURL(file) {
|
|
531
|
+
return new Promise((resolve) => {
|
|
532
|
+
const reader = new FileReader();
|
|
533
|
+
reader.onloadend = () => resolve(reader.result);
|
|
534
|
+
reader.readAsDataURL(file);
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
function DeleteIndicator({ onClick }) {
|
|
538
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
core.ActionIcon,
|
|
540
|
+
{
|
|
541
|
+
size: 18,
|
|
542
|
+
radius: "xl",
|
|
543
|
+
color: "red",
|
|
544
|
+
variant: "filled",
|
|
545
|
+
style: { position: "absolute", top: -6, right: -6, zIndex: 10 },
|
|
546
|
+
className: "shadow-sm",
|
|
547
|
+
onClick: (e) => {
|
|
548
|
+
e.stopPropagation();
|
|
549
|
+
onClick();
|
|
550
|
+
},
|
|
551
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconX, { size: 10, stroke: 3 })
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
function validateImageDimensions(file, maxW, maxH) {
|
|
556
|
+
if (!maxW && !maxH) return Promise.resolve(true);
|
|
557
|
+
return new Promise((resolve) => {
|
|
558
|
+
const img = new window.Image();
|
|
559
|
+
img.onload = () => {
|
|
560
|
+
URL.revokeObjectURL(img.src);
|
|
561
|
+
const isWidthOk = !maxW || img.naturalWidth <= maxW;
|
|
562
|
+
const isHeightOk = !maxH || img.naturalHeight <= maxH;
|
|
563
|
+
resolve(isWidthOk && isHeightOk);
|
|
564
|
+
};
|
|
565
|
+
img.onerror = () => {
|
|
566
|
+
URL.revokeObjectURL(img.src);
|
|
567
|
+
resolve(false);
|
|
568
|
+
};
|
|
569
|
+
img.src = URL.createObjectURL(file);
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
function ImageUpload({
|
|
573
|
+
value,
|
|
574
|
+
onChange,
|
|
575
|
+
maxCount,
|
|
576
|
+
variant = "gallery",
|
|
577
|
+
previewWidth = 80,
|
|
578
|
+
previewHeight,
|
|
579
|
+
previewFit = "cover",
|
|
580
|
+
label,
|
|
581
|
+
buttonText = "\uC774\uBBF8\uC9C0 \uC5C5\uB85C\uB4DC",
|
|
582
|
+
placeholder = "No Image",
|
|
583
|
+
description,
|
|
584
|
+
accept = "image/png,image/jpeg,image/gif",
|
|
585
|
+
showCount = false,
|
|
586
|
+
maxWidth,
|
|
587
|
+
maxHeight
|
|
588
|
+
}) {
|
|
589
|
+
const effectiveHeight = previewHeight != null ? previewHeight : previewWidth;
|
|
590
|
+
const [dimensionError, setDimensionError] = react.useState(null);
|
|
591
|
+
const buildDimensionErrorMessage = () => {
|
|
592
|
+
if (maxWidth && maxHeight) return `\uC774\uBBF8\uC9C0 \uD06C\uAE30\uB294 \uCD5C\uB300 ${maxWidth}x${maxHeight}px \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.`;
|
|
593
|
+
if (maxWidth) return `\uC774\uBBF8\uC9C0 \uAC00\uB85C \uD06C\uAE30\uB294 \uCD5C\uB300 ${maxWidth}px \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.`;
|
|
594
|
+
return `\uC774\uBBF8\uC9C0 \uC138\uB85C \uD06C\uAE30\uB294 \uCD5C\uB300 ${maxHeight}px \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.`;
|
|
595
|
+
};
|
|
596
|
+
const MAX_FILE_SIZE = 20 * 1024 * 1024;
|
|
597
|
+
const handleFileSelect = async (file) => {
|
|
598
|
+
if (!file) return;
|
|
599
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
600
|
+
notifications.notifications.show({ title: "\uC5C5\uB85C\uB4DC \uC2E4\uD328", message: "\uD30C\uC77C \uD06C\uAE30\uB294 20MB \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.", color: "red" });
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
setDimensionError(null);
|
|
604
|
+
const isValid = await validateImageDimensions(file, maxWidth, maxHeight);
|
|
605
|
+
if (!isValid) {
|
|
606
|
+
const msg = buildDimensionErrorMessage();
|
|
607
|
+
setDimensionError(msg);
|
|
608
|
+
notifications.notifications.show({ title: "\uC5C5\uB85C\uB4DC \uC2E4\uD328", message: msg, color: "red" });
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const src = await readFileAsDataURL(file);
|
|
612
|
+
if (maxCount === 1) {
|
|
613
|
+
onChange([src]);
|
|
614
|
+
} else {
|
|
615
|
+
onChange([...value, src]);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
const handleMultipleFileSelect = async (files) => {
|
|
619
|
+
if (!files || files.length === 0) return;
|
|
620
|
+
setDimensionError(null);
|
|
621
|
+
const sizeOverCount = files.filter((f) => f.size > MAX_FILE_SIZE).length;
|
|
622
|
+
const sizeValidFiles = files.filter((f) => f.size <= MAX_FILE_SIZE);
|
|
623
|
+
if (sizeOverCount > 0) {
|
|
624
|
+
notifications.notifications.show({
|
|
625
|
+
title: "\uC5C5\uB85C\uB4DC \uC2E4\uD328",
|
|
626
|
+
message: `${sizeOverCount}\uAC1C\uC758 \uD30C\uC77C\uC774 20MB\uB97C \uCD08\uACFC\uD558\uC5EC \uC81C\uC678\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`,
|
|
627
|
+
color: "red"
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
if (sizeValidFiles.length === 0) return;
|
|
631
|
+
const validFiles = [];
|
|
632
|
+
for (const file of sizeValidFiles) {
|
|
633
|
+
const isValid = await validateImageDimensions(file, maxWidth, maxHeight);
|
|
634
|
+
if (isValid) {
|
|
635
|
+
validFiles.push(file);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (validFiles.length < sizeValidFiles.length) {
|
|
639
|
+
const msg = buildDimensionErrorMessage();
|
|
640
|
+
setDimensionError(msg);
|
|
641
|
+
notifications.notifications.show({
|
|
642
|
+
title: "\uC5C5\uB85C\uB4DC \uC2E4\uD328",
|
|
643
|
+
message: `${sizeValidFiles.length - validFiles.length}\uAC1C\uC758 \uC774\uBBF8\uC9C0\uAC00 \uD06C\uAE30 \uC81C\uD55C\uC744 \uCD08\uACFC\uD558\uC5EC \uC81C\uC678\uB418\uC5C8\uC2B5\uB2C8\uB2E4. ${msg}`,
|
|
644
|
+
color: "red"
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
if (validFiles.length === 0) return;
|
|
648
|
+
const results = await Promise.all(validFiles.map(readFileAsDataURL));
|
|
649
|
+
onChange([...value, ...results]);
|
|
650
|
+
};
|
|
651
|
+
const handleRemove = (index) => {
|
|
652
|
+
onChange(value.filter((_, i) => i !== index));
|
|
653
|
+
};
|
|
654
|
+
const isAdd = maxCount === void 0 || value.length < maxCount;
|
|
655
|
+
if (variant === "gallery") {
|
|
656
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Box, { style: { display: "flex", flexWrap: "wrap", gap: 12, paddingTop: 6, paddingRight: 6 }, children: [
|
|
658
|
+
value.map((src, index) => /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { style: { position: "relative", width: previewWidth, height: effectiveHeight }, children: [
|
|
659
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Image, { src, alt: "", w: previewWidth, h: effectiveHeight, fit: previewFit, radius: "sm" }),
|
|
660
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeleteIndicator, { onClick: () => handleRemove(index) })
|
|
661
|
+
] }, index)),
|
|
662
|
+
isAdd && /* @__PURE__ */ jsxRuntime.jsx(core.FileButton, { onChange: handleFileSelect, accept, children: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
663
|
+
core.Box,
|
|
664
|
+
__spreadProps(__spreadValues({}, props), {
|
|
665
|
+
className: "flex cursor-pointer items-center justify-center rounded border-2 border-dashed border-gray-300 hover:border-blue-400",
|
|
666
|
+
style: { width: previewWidth, height: effectiveHeight },
|
|
667
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconPlus, { size: 24, className: "text-gray-400" })
|
|
668
|
+
})
|
|
669
|
+
) })
|
|
670
|
+
] }),
|
|
671
|
+
showCount && /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { size: "xs", c: "dimmed", mt: "xs", children: [
|
|
672
|
+
"\uB4F1\uB85D\uB41C \uC0AC\uC9C4: ",
|
|
673
|
+
value.length,
|
|
674
|
+
"\uC7A5"
|
|
675
|
+
] }),
|
|
676
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "dimmed", mt: "xs", children: description }),
|
|
677
|
+
dimensionError && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "red", mt: "xs", children: dimensionError })
|
|
678
|
+
] });
|
|
679
|
+
}
|
|
680
|
+
if (variant === "area") {
|
|
681
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "flex flex-col items-center", children: [
|
|
682
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.FileButton, { onChange: handleFileSelect, accept, children: (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
683
|
+
core.Box,
|
|
684
|
+
__spreadProps(__spreadValues({
|
|
685
|
+
style: { position: "relative", width: previewWidth, height: effectiveHeight }
|
|
686
|
+
}, props), {
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
core.Box,
|
|
690
|
+
{
|
|
691
|
+
className: "flex h-full w-full cursor-pointer items-center justify-center overflow-hidden rounded-md border border-gray-200 bg-gray-50 transition-colors hover:border-blue-400 hover:bg-gray-100",
|
|
692
|
+
children: value[0] ? /* @__PURE__ */ jsxRuntime.jsx(core.Image, { src: value[0], alt: "", fit: previewFit, className: "p-4" }) : /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "flex flex-col items-center gap-1", children: [
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconUpload, { size: 20, className: "text-gray-400" }),
|
|
694
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "dimmed", className: "font-medium", children: placeholder })
|
|
695
|
+
] })
|
|
696
|
+
}
|
|
697
|
+
),
|
|
698
|
+
value[0] && /* @__PURE__ */ jsxRuntime.jsx(DeleteIndicator, { onClick: () => onChange([]) })
|
|
699
|
+
]
|
|
700
|
+
})
|
|
701
|
+
) }),
|
|
702
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "dimmed", mt: "xs", children: description }),
|
|
703
|
+
dimensionError && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "red", mt: "xs", children: dimensionError })
|
|
704
|
+
] });
|
|
705
|
+
}
|
|
706
|
+
const isMultiple = maxCount === void 0 || maxCount > 1;
|
|
707
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
|
|
708
|
+
isMultiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
709
|
+
InputFile,
|
|
710
|
+
{
|
|
711
|
+
label,
|
|
712
|
+
placeholder: "\uC774\uBBF8\uC9C0\uB97C \uC120\uD0DD\uD558\uC138\uC694",
|
|
713
|
+
accept,
|
|
714
|
+
leftSection: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconUpload, { size: 16 }),
|
|
715
|
+
onChange: handleMultipleFileSelect,
|
|
716
|
+
multiple: true,
|
|
717
|
+
value: []
|
|
718
|
+
}
|
|
719
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
720
|
+
InputFile,
|
|
721
|
+
{
|
|
722
|
+
label,
|
|
723
|
+
placeholder: "\uC774\uBBF8\uC9C0\uB97C \uC120\uD0DD\uD558\uC138\uC694",
|
|
724
|
+
accept,
|
|
725
|
+
leftSection: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconUpload, { size: 16 }),
|
|
726
|
+
onChange: handleFileSelect
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(core.Box, { style: { display: "flex", flexWrap: "wrap", gap: 12, paddingTop: 6, paddingRight: 6, marginTop: 8 }, children: value.map((src, index) => /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { style: { position: "relative", width: previewWidth, height: effectiveHeight }, children: [
|
|
730
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Image, { src, alt: "", w: previewWidth, h: effectiveHeight, fit: previewFit, radius: "sm" }),
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx(DeleteIndicator, { onClick: () => handleRemove(index) })
|
|
732
|
+
] }, index)) }),
|
|
733
|
+
showCount && /* @__PURE__ */ jsxRuntime.jsxs(core.Text, { size: "xs", c: "dimmed", mt: "xs", children: [
|
|
734
|
+
value.length,
|
|
735
|
+
"\uAC1C\uC758 \uC774\uBBF8\uC9C0\uAC00 \uB4F1\uB85D\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
|
|
736
|
+
] }),
|
|
737
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "dimmed", mt: "xs", children: description }),
|
|
738
|
+
dimensionError && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "red", mt: "xs", children: dimensionError })
|
|
739
|
+
] });
|
|
740
|
+
}
|
|
741
|
+
function PageTitle(_a) {
|
|
742
|
+
var _b = _a, {
|
|
743
|
+
title,
|
|
744
|
+
subText,
|
|
745
|
+
rightContent,
|
|
746
|
+
leftContent
|
|
747
|
+
} = _b, props = __objRest(_b, [
|
|
748
|
+
"title",
|
|
749
|
+
"subText",
|
|
750
|
+
"rightContent",
|
|
751
|
+
"leftContent"
|
|
752
|
+
]);
|
|
753
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { justify: "space-between", align: "end", mb: "xl", children: [
|
|
754
|
+
leftContent,
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Title, __spreadProps(__spreadValues({ order: 2, c: "var(--color-brand-dark)" }, props), { children: [
|
|
756
|
+
title,
|
|
757
|
+
subText && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "md", c: "var(--color-subtitle)", mt: "5", children: subText })
|
|
758
|
+
] })),
|
|
759
|
+
rightContent
|
|
760
|
+
] });
|
|
761
|
+
}
|
|
762
|
+
function PageLoading({ bg = "transparent" }) {
|
|
763
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { pos: "fixed", top: 0, left: "var(--sidebar-width)", right: 0, bottom: 0, style: { zIndex: 400 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
764
|
+
core.LoadingOverlay,
|
|
765
|
+
{
|
|
766
|
+
visible: true,
|
|
767
|
+
overlayProps: {
|
|
768
|
+
backgroundOpacity: bg === "transparent" ? 0 : 1,
|
|
769
|
+
color: bg
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
) });
|
|
773
|
+
}
|
|
774
|
+
var Panel = (_a) => {
|
|
775
|
+
var _b = _a, {
|
|
776
|
+
title,
|
|
777
|
+
totalCount,
|
|
778
|
+
description,
|
|
779
|
+
children,
|
|
780
|
+
headerRightContent,
|
|
781
|
+
contentBottomPadding = 40,
|
|
782
|
+
footer
|
|
783
|
+
} = _b, props = __objRest(_b, [
|
|
784
|
+
"title",
|
|
785
|
+
"totalCount",
|
|
786
|
+
"description",
|
|
787
|
+
"children",
|
|
788
|
+
"headerRightContent",
|
|
789
|
+
"contentBottomPadding",
|
|
790
|
+
"footer"
|
|
791
|
+
]);
|
|
792
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Paper, __spreadProps(__spreadValues({ bg: "white", radius: "lg", shadow: "xs", className: "border-default border-1" }, props), { children: [
|
|
793
|
+
title && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-[30px]", children: [
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Group, { justify: "space-between", align: "center", gap: "xs", py: "24", children: [
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Group, { align: "baseline", gap: "10", children: [
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Title, { c: "blue", order: 2, fz: 20, fw: 700, lh: "2", children: title }),
|
|
797
|
+
totalCount && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "blue", size: "20", lh: "1", children: totalCount })
|
|
798
|
+
] }),
|
|
799
|
+
headerRightContent
|
|
800
|
+
] }),
|
|
801
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "#666", fz: 14, fw: 400, lh: "160%", mb: "24", children: description })
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[30px]", style: { paddingBottom: `${contentBottomPadding}px` }, children }),
|
|
804
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-gray-2 border-t px-[30px] py-5", children: footer })
|
|
805
|
+
] }));
|
|
806
|
+
};
|
|
807
|
+
function Section({ title, children }) {
|
|
808
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 last:mb-0", children: [
|
|
809
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "blue", fz: 20, fw: 700, lh: "2", py: "24", children: title }),
|
|
810
|
+
children
|
|
811
|
+
] });
|
|
812
|
+
}
|
|
813
|
+
Panel.Section = Section;
|
|
814
|
+
function BoxContainer({ children }) {
|
|
815
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
816
|
+
core.Box,
|
|
817
|
+
{
|
|
818
|
+
component: "main",
|
|
819
|
+
style: {
|
|
820
|
+
flexGrow: 1,
|
|
821
|
+
padding: 24
|
|
822
|
+
},
|
|
823
|
+
children
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
function EditorLayout({
|
|
828
|
+
leftPanel,
|
|
829
|
+
centerPanel,
|
|
830
|
+
rightPanel,
|
|
831
|
+
leftSpan = 2,
|
|
832
|
+
centerSpan = 5,
|
|
833
|
+
rightSpan = 5
|
|
834
|
+
}) {
|
|
835
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Grid, { gutter: "md", children: [
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: leftSpan, children: leftPanel }),
|
|
837
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: centerSpan, children: centerPanel }),
|
|
838
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Grid.Col, { span: rightSpan, children: rightPanel })
|
|
839
|
+
] });
|
|
840
|
+
}
|
|
841
|
+
function Modal(_a) {
|
|
842
|
+
var _b = _a, {
|
|
843
|
+
opened,
|
|
844
|
+
onClose,
|
|
845
|
+
title,
|
|
846
|
+
size,
|
|
847
|
+
styles,
|
|
848
|
+
children
|
|
849
|
+
} = _b, props = __objRest(_b, [
|
|
850
|
+
"opened",
|
|
851
|
+
"onClose",
|
|
852
|
+
"title",
|
|
853
|
+
"size",
|
|
854
|
+
"styles",
|
|
855
|
+
"children"
|
|
856
|
+
]);
|
|
857
|
+
var _a2, _b2, _c, _d;
|
|
858
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
859
|
+
core.Modal,
|
|
860
|
+
__spreadProps(__spreadValues({
|
|
861
|
+
opened,
|
|
862
|
+
onClose,
|
|
863
|
+
title,
|
|
864
|
+
size,
|
|
865
|
+
styles
|
|
866
|
+
}, props), {
|
|
867
|
+
classNames: __spreadProps(__spreadValues({}, props.classNames), {
|
|
868
|
+
header: "!-mt-8 !p-6",
|
|
869
|
+
title: `text-center !font-bold ${(_b2 = (_a2 = props.classNames) == null ? void 0 : _a2.title) != null ? _b2 : ""}`,
|
|
870
|
+
body: `!p-6 ${(_d = (_c = props.classNames) == null ? void 0 : _c.body) != null ? _d : ""}`
|
|
871
|
+
}),
|
|
872
|
+
children
|
|
873
|
+
})
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
function ModalDeleteConfirm({ opened, onClose, onConfirm, message }) {
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
+
Modal,
|
|
879
|
+
{
|
|
880
|
+
opened,
|
|
881
|
+
onClose,
|
|
882
|
+
size: "md",
|
|
883
|
+
centered: true,
|
|
884
|
+
withCloseButton: false,
|
|
885
|
+
classNames: { body: "text-center" },
|
|
886
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "flex flex-col items-center gap-5", children: [
|
|
887
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "text-error text-2xl", "data-fa-i2svg": "", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
888
|
+
"svg",
|
|
889
|
+
{
|
|
890
|
+
width: "24",
|
|
891
|
+
height: "24",
|
|
892
|
+
"aria-hidden": "true",
|
|
893
|
+
focusable: "false",
|
|
894
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
895
|
+
viewBox: "0 0 448 512",
|
|
896
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
897
|
+
"path",
|
|
898
|
+
{
|
|
899
|
+
fill: "currentColor",
|
|
900
|
+
d: "M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"
|
|
901
|
+
}
|
|
902
|
+
)
|
|
903
|
+
}
|
|
904
|
+
) }) }),
|
|
905
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl leading-tight font-bold text-gray-900", children: "\uC815\uB9D0 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?" }),
|
|
906
|
+
message && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "-mt-2 text-sm leading-relaxed text-gray-600", children: message }),
|
|
907
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Group, { justify: "center", gap: "xs", children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", color: "gray", size: "md", onClick: onClose, children: "\uCDE8\uC18C" }),
|
|
909
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "filled", color: "red", size: "md", onClick: onConfirm, children: "\uC0AD\uC81C" })
|
|
910
|
+
] })
|
|
911
|
+
] })
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
}
|
|
915
|
+
function ModalTokenExpired() {
|
|
916
|
+
const [isOpened, setIsOpened] = react.useState(false);
|
|
917
|
+
react.useEffect(() => {
|
|
918
|
+
const handleTokenExpired = () => {
|
|
919
|
+
setIsOpened(true);
|
|
920
|
+
setTimeout(() => {
|
|
921
|
+
localStorage.removeItem("accessToken");
|
|
922
|
+
localStorage.removeItem("tokenExpiresAt");
|
|
923
|
+
localStorage.removeItem("featureVersion");
|
|
924
|
+
localStorage.removeItem("units");
|
|
925
|
+
window.location.href = "/login";
|
|
926
|
+
}, 3e3);
|
|
927
|
+
};
|
|
928
|
+
window.addEventListener("token-expired", handleTokenExpired);
|
|
929
|
+
return () => window.removeEventListener("token-expired", handleTokenExpired);
|
|
930
|
+
}, []);
|
|
931
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Modal, { opened: isOpened, onClose: () => {
|
|
932
|
+
}, withCloseButton: false, centered: true, size: "sm", zIndex: 1e3, children: /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { className: "flex flex-col items-center gap-5", children: [
|
|
933
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-red-50", children: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "text-error text-2xl", "data-fa-i2svg": "", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
934
|
+
"svg",
|
|
935
|
+
{
|
|
936
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
937
|
+
width: "32",
|
|
938
|
+
height: "32",
|
|
939
|
+
viewBox: "0 0 24 24",
|
|
940
|
+
fill: "currentColor",
|
|
941
|
+
className: "icon icon-tabler icons-tabler-filled icon-tabler-exclamation-circle",
|
|
942
|
+
children: [
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 3.34a10 10 0 1 1 -15 8.66l.005 -.324a10 10 0 0 1 14.995 -8.336m-5 11.66a1 1 0 0 0 -1 1v.01a1 1 0 0 0 2 0v-.01a1 1 0 0 0 -1 -1m0 -7a1 1 0 0 0 -1 1v4a1 1 0 0 0 2 0v-4a1 1 0 0 0 -1 -1" })
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
) }) }),
|
|
948
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Text, { ta: "center", fw: 600, size: "lg", mb: "xs", children: [
|
|
949
|
+
"\uD1A0\uD070\uC774 \uB9CC\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4 ",
|
|
950
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
951
|
+
"\uC7A0\uC2DC \uD6C4 \uB85C\uADF8\uC778 \uD398\uC774\uC9C0\uB85C \uC774\uB3D9\uD569\uB2C8\uB2E4."
|
|
952
|
+
] })
|
|
953
|
+
] }) });
|
|
954
|
+
}
|
|
955
|
+
function DataTable({
|
|
956
|
+
columns,
|
|
957
|
+
data,
|
|
958
|
+
getRowId,
|
|
959
|
+
onRowClick,
|
|
960
|
+
rowsPerPageOptions = [5, 10, 25, 50],
|
|
961
|
+
defaultRowsPerPage = 10,
|
|
962
|
+
style,
|
|
963
|
+
containerStyle,
|
|
964
|
+
rowStyle,
|
|
965
|
+
emptyMessage = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
966
|
+
}) {
|
|
967
|
+
const [page, setPage] = react.useState(1);
|
|
968
|
+
const [rowsPerPage, setRowsPerPage] = react.useState(defaultRowsPerPage);
|
|
969
|
+
const [mounted, setMounted] = react.useState(false);
|
|
970
|
+
react.useEffect(() => {
|
|
971
|
+
setMounted(true);
|
|
972
|
+
}, []);
|
|
973
|
+
const paginatedData = react.useMemo(() => {
|
|
974
|
+
const startIndex = (page - 1) * rowsPerPage;
|
|
975
|
+
const endIndex = startIndex + rowsPerPage;
|
|
976
|
+
return data.slice(startIndex, endIndex);
|
|
977
|
+
}, [data, page, rowsPerPage]);
|
|
978
|
+
const totalPages = Math.ceil(data.length / rowsPerPage);
|
|
979
|
+
const handleRowClick = (row) => {
|
|
980
|
+
if (onRowClick) {
|
|
981
|
+
onRowClick(row);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Paper, { shadow: "xs", p: "md", mt: "md", style: containerStyle, children: [
|
|
985
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Table, { style, highlightOnHover: !!onRowClick, children: [
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Table.Thead, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Table.Tr, { children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
987
|
+
core.Table.Th,
|
|
988
|
+
{
|
|
989
|
+
style: __spreadValues({
|
|
990
|
+
minWidth: column.minWidth,
|
|
991
|
+
fontWeight: "bold",
|
|
992
|
+
textAlign: column.align || "left"
|
|
993
|
+
}, column.headerStyle),
|
|
994
|
+
children: column.label
|
|
995
|
+
},
|
|
996
|
+
column.id
|
|
997
|
+
)) }) }),
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Table.Tbody, { children: paginatedData.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(core.Table.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Table.Td, { colSpan: columns.length, style: { textAlign: "center", padding: "32px" }, children: emptyMessage }) }) : paginatedData.map((row, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
999
|
+
core.Table.Tr,
|
|
1000
|
+
{
|
|
1001
|
+
onClick: () => handleRowClick(row),
|
|
1002
|
+
style: __spreadValues({
|
|
1003
|
+
cursor: onRowClick ? "pointer" : "default"
|
|
1004
|
+
}, rowStyle),
|
|
1005
|
+
children: columns.map((column) => {
|
|
1006
|
+
const value = row[column.id];
|
|
1007
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1008
|
+
core.Table.Td,
|
|
1009
|
+
{
|
|
1010
|
+
suppressHydrationWarning: true,
|
|
1011
|
+
style: __spreadValues({
|
|
1012
|
+
textAlign: column.align || "left"
|
|
1013
|
+
}, column.style),
|
|
1014
|
+
children: [
|
|
1015
|
+
column.id === "no" ? mounted ? (page - 1) * rowsPerPage + index + 1 : null : null,
|
|
1016
|
+
column.id !== "no" && (column.format ? column.format(value, row) : value)
|
|
1017
|
+
]
|
|
1018
|
+
},
|
|
1019
|
+
column.id
|
|
1020
|
+
);
|
|
1021
|
+
})
|
|
1022
|
+
},
|
|
1023
|
+
getRowId(row)
|
|
1024
|
+
)) })
|
|
1025
|
+
] }),
|
|
1026
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Box, { mt: "md", className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(core.Pagination, { value: page, onChange: setPage, total: totalPages }) })
|
|
1027
|
+
] });
|
|
1028
|
+
}
|
|
1029
|
+
function PageHeader({ headerText, back }) {
|
|
1030
|
+
const router = navigation.useRouter();
|
|
1031
|
+
const handleBack = () => {
|
|
1032
|
+
router.back();
|
|
1033
|
+
};
|
|
1034
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
1035
|
+
back && /* @__PURE__ */ jsxRuntime.jsx(core.ActionIcon, { variant: "subtle", size: "lg", onClick: handleBack, children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconArrowLeft, { size: 20 }) }),
|
|
1036
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Title, { order: 2, children: headerText })
|
|
1037
|
+
] });
|
|
1038
|
+
}
|
|
1039
|
+
var SectionGroupWithTitle = ({ title, children }) => {
|
|
1040
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
|
|
1041
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 600, mb: "sm", children: title }),
|
|
1042
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Divider, { mb: "xs" }),
|
|
1043
|
+
children
|
|
1044
|
+
] });
|
|
1045
|
+
};
|
|
1046
|
+
var SectionGroupWithTitle_default = SectionGroupWithTitle;
|
|
1047
|
+
function TagInput({
|
|
1048
|
+
label,
|
|
1049
|
+
placeholder,
|
|
1050
|
+
items,
|
|
1051
|
+
onAdd,
|
|
1052
|
+
onRemove,
|
|
1053
|
+
badgeVariant = "filled",
|
|
1054
|
+
badgeColor = "blue"
|
|
1055
|
+
}) {
|
|
1056
|
+
const [inputValue, setInputValue] = react.useState("");
|
|
1057
|
+
const handleAdd = () => {
|
|
1058
|
+
if (!inputValue.trim()) return;
|
|
1059
|
+
const values = inputValue.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
1060
|
+
onAdd(values);
|
|
1061
|
+
setInputValue("");
|
|
1062
|
+
};
|
|
1063
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { children: [
|
|
1064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1065
|
+
InputText,
|
|
1066
|
+
{
|
|
1067
|
+
size: "xs",
|
|
1068
|
+
label,
|
|
1069
|
+
placeholder,
|
|
1070
|
+
value: inputValue,
|
|
1071
|
+
onChange: (e) => setInputValue(e.currentTarget.value),
|
|
1072
|
+
onKeyDown: (e) => {
|
|
1073
|
+
if (e.key === "Enter" && !e.nativeEvent.isComposing) {
|
|
1074
|
+
e.preventDefault();
|
|
1075
|
+
handleAdd();
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
rightSection: /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "xs", variant: "light", onClick: handleAdd, children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconPlus, { size: 10 }) }),
|
|
1079
|
+
rightSectionWidth: 27,
|
|
1080
|
+
mb: "xs"
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(core.Group, { gap: 4, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1084
|
+
Badge,
|
|
1085
|
+
{
|
|
1086
|
+
size: "sm",
|
|
1087
|
+
variant: badgeVariant,
|
|
1088
|
+
color: badgeColor,
|
|
1089
|
+
h: "24",
|
|
1090
|
+
rightSection: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1091
|
+
core.ActionIcon,
|
|
1092
|
+
{
|
|
1093
|
+
size: 14,
|
|
1094
|
+
variant: "transparent",
|
|
1095
|
+
c: badgeVariant === "light" ? "gray" : "white",
|
|
1096
|
+
onClick: () => onRemove(item.id),
|
|
1097
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconX, { size: 10 })
|
|
1098
|
+
}
|
|
1099
|
+
),
|
|
1100
|
+
children: item.label
|
|
1101
|
+
},
|
|
1102
|
+
item.id
|
|
1103
|
+
)) })
|
|
1104
|
+
] });
|
|
1105
|
+
}
|
|
1106
|
+
function StrictModeDroppable(_a) {
|
|
1107
|
+
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
1108
|
+
const [isEnabled, setIsEnabled] = react.useState(false);
|
|
1109
|
+
react.useEffect(() => {
|
|
1110
|
+
const animation = requestAnimationFrame(() => setIsEnabled(true));
|
|
1111
|
+
return () => {
|
|
1112
|
+
cancelAnimationFrame(animation);
|
|
1113
|
+
setIsEnabled(false);
|
|
1114
|
+
};
|
|
1115
|
+
}, []);
|
|
1116
|
+
if (!isEnabled) return null;
|
|
1117
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, __spreadProps(__spreadValues({}, props), { children }));
|
|
1118
|
+
}
|
|
1119
|
+
function AccordionDraggable({
|
|
1120
|
+
items,
|
|
1121
|
+
droppableId = "draggable-accordion",
|
|
1122
|
+
activeId = null,
|
|
1123
|
+
onActiveChange,
|
|
1124
|
+
onReorder,
|
|
1125
|
+
onDelete,
|
|
1126
|
+
onRequiredChange,
|
|
1127
|
+
onUsedChange,
|
|
1128
|
+
emptyMessage = "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1129
|
+
showDeleteButton = true,
|
|
1130
|
+
showRequiredToggle = false,
|
|
1131
|
+
showUsedToggle = false,
|
|
1132
|
+
draggingBgColor = "var(--color-dragging)"
|
|
1133
|
+
}) {
|
|
1134
|
+
if (items.length === 0) {
|
|
1135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Box, { style: { padding: 40, textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "dimmed", children: emptyMessage }) });
|
|
1136
|
+
}
|
|
1137
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd: onReorder, children: /* @__PURE__ */ jsxRuntime.jsx(StrictModeDroppable, { droppableId, children: (provided) => /* @__PURE__ */ jsxRuntime.jsx(core.Box, __spreadProps(__spreadValues({ ref: provided.innerRef }, provided.droppableProps), { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1138
|
+
Accordion.Root,
|
|
1139
|
+
{
|
|
1140
|
+
variant: "separated",
|
|
1141
|
+
value: activeId,
|
|
1142
|
+
onChange: onActiveChange,
|
|
1143
|
+
classNames: { label: "!py-0", content: "!p-6 !pb-10" },
|
|
1144
|
+
children: [
|
|
1145
|
+
items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: item.id, index, children: (provided2) => {
|
|
1146
|
+
var _a, _b;
|
|
1147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1148
|
+
core.Box,
|
|
1149
|
+
__spreadProps(__spreadValues({
|
|
1150
|
+
ref: provided2.innerRef
|
|
1151
|
+
}, provided2.draggableProps), {
|
|
1152
|
+
style: __spreadProps(__spreadValues({}, provided2.draggableProps.style), {
|
|
1153
|
+
marginBottom: 8
|
|
1154
|
+
}),
|
|
1155
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1156
|
+
Accordion.Item,
|
|
1157
|
+
{
|
|
1158
|
+
value: item.id,
|
|
1159
|
+
"data-active": activeId === item.id || void 0,
|
|
1160
|
+
style: { backgroundColor: draggingBgColor },
|
|
1161
|
+
className: "group data-[active]:!bg-[var(--color-active,transparent)]",
|
|
1162
|
+
children: [
|
|
1163
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1164
|
+
Accordion.Control,
|
|
1165
|
+
{
|
|
1166
|
+
icon: item.icon,
|
|
1167
|
+
className: "group-data-[active]:!border-b group-data-[active]:!border-gray-200",
|
|
1168
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { gap: "xs", wrap: "nowrap", style: { width: "100%" }, children: [
|
|
1169
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues({}, provided2.dragHandleProps), { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(GripVerticalIcon, {}) })),
|
|
1170
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { fw: 500, className: "flex-1 !text-[15px]", children: item.title }),
|
|
1171
|
+
item.rightSection && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1172
|
+
core.Box,
|
|
1173
|
+
{
|
|
1174
|
+
onClick: (e) => e.stopPropagation(),
|
|
1175
|
+
style: {
|
|
1176
|
+
marginRight: 16,
|
|
1177
|
+
padding: "4px 8px",
|
|
1178
|
+
borderRadius: 4,
|
|
1179
|
+
backgroundColor: "var(--color-right-section)"
|
|
1180
|
+
},
|
|
1181
|
+
children: item.rightSection
|
|
1182
|
+
}
|
|
1183
|
+
),
|
|
1184
|
+
(showRequiredToggle || showUsedToggle) && !item.rightSection && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1185
|
+
core.Group,
|
|
1186
|
+
{
|
|
1187
|
+
gap: "sm",
|
|
1188
|
+
wrap: "nowrap",
|
|
1189
|
+
className: "mr-6 h-5 border-r border-[#E1E4E8] pr-6",
|
|
1190
|
+
onClick: (e) => e.stopPropagation(),
|
|
1191
|
+
children: [
|
|
1192
|
+
showUsedToggle && onUsedChange && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1193
|
+
core.Checkbox,
|
|
1194
|
+
{
|
|
1195
|
+
checked: (_a = item.isUsed) != null ? _a : false,
|
|
1196
|
+
onChange: (e) => onUsedChange(item.id, e.currentTarget.checked),
|
|
1197
|
+
label: "\uC0AC\uC6A9"
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
showRequiredToggle && onRequiredChange && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1201
|
+
core.Checkbox,
|
|
1202
|
+
{
|
|
1203
|
+
checked: (_b = item.isRequired) != null ? _b : false,
|
|
1204
|
+
onChange: (e) => onRequiredChange(item.id, e.currentTarget.checked),
|
|
1205
|
+
label: "\uD544\uC218"
|
|
1206
|
+
}
|
|
1207
|
+
)
|
|
1208
|
+
]
|
|
1209
|
+
}
|
|
1210
|
+
),
|
|
1211
|
+
showDeleteButton && onDelete && !item.rightSection && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1212
|
+
"span",
|
|
1213
|
+
{
|
|
1214
|
+
className: "mr-6 h-5 border-r border-[#E1E4E8] pr-6",
|
|
1215
|
+
onClick: (e) => {
|
|
1216
|
+
e.stopPropagation();
|
|
1217
|
+
onDelete(item.id);
|
|
1218
|
+
},
|
|
1219
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, { color: "red" })
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] })
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx(Accordion.Panel, { children: /* @__PURE__ */ jsxRuntime.jsx(core.Stack, { gap: "24", children: item.content }) })
|
|
1226
|
+
]
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1229
|
+
})
|
|
1230
|
+
);
|
|
1231
|
+
} }, item.id)),
|
|
1232
|
+
provided.placeholder
|
|
1233
|
+
]
|
|
1234
|
+
}
|
|
1235
|
+
) })) }) });
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
exports.Accordion = Accordion;
|
|
1239
|
+
exports.AccordionDraggable = AccordionDraggable;
|
|
1240
|
+
exports.Badge = Badge;
|
|
1241
|
+
exports.BoxContainer = BoxContainer;
|
|
1242
|
+
exports.Button = Button;
|
|
1243
|
+
exports.ChevronDownIcon = ChevronDownIcon;
|
|
1244
|
+
exports.ComboboxAutocomplete = ComboboxAutocomplete;
|
|
1245
|
+
exports.ComboboxSelect = ComboboxSelect;
|
|
1246
|
+
exports.DataTable = DataTable;
|
|
1247
|
+
exports.DateTimePicker = DateTimePicker;
|
|
1248
|
+
exports.EditorLayout = EditorLayout;
|
|
1249
|
+
exports.GripVerticalIcon = GripVerticalIcon;
|
|
1250
|
+
exports.IconButton = IconButton;
|
|
1251
|
+
exports.ImageUpload = ImageUpload;
|
|
1252
|
+
exports.InputColor = InputColor;
|
|
1253
|
+
exports.InputDatePicker = InputDatePicker;
|
|
1254
|
+
exports.InputFile = InputFile;
|
|
1255
|
+
exports.InputNumber = InputNumber;
|
|
1256
|
+
exports.InputPassword = InputPassword;
|
|
1257
|
+
exports.InputRadio = InputRadio;
|
|
1258
|
+
exports.InputSegmentedControl = InputSegmentedControl;
|
|
1259
|
+
exports.InputSwitch = InputSwitch;
|
|
1260
|
+
exports.InputSwitchInTable = InputSwitchInTable;
|
|
1261
|
+
exports.InputText = InputText;
|
|
1262
|
+
exports.InputTextarea = InputTextarea;
|
|
1263
|
+
exports.Modal = Modal;
|
|
1264
|
+
exports.ModalDeleteConfirm = ModalDeleteConfirm;
|
|
1265
|
+
exports.ModalTokenExpired = ModalTokenExpired;
|
|
1266
|
+
exports.NavigationBanner = NavigationBanner;
|
|
1267
|
+
exports.PageHeader = PageHeader;
|
|
1268
|
+
exports.PageLoading = PageLoading;
|
|
1269
|
+
exports.PageTitle = PageTitle;
|
|
1270
|
+
exports.Pagination = Pagination;
|
|
1271
|
+
exports.Panel = Panel;
|
|
1272
|
+
exports.PlusIcon = PlusIcon;
|
|
1273
|
+
exports.SectionGroupWithTitle = SectionGroupWithTitle_default;
|
|
1274
|
+
exports.Table = Table;
|
|
1275
|
+
exports.TagInput = TagInput;
|
|
1276
|
+
exports.TrashIcon = TrashIcon;
|
|
1277
|
+
exports.inputClassNames = inputClassNames;
|
|
1278
|
+
exports.readFileAsDataURL = readFileAsDataURL;
|
|
1279
|
+
//# sourceMappingURL=index.js.map
|
|
1280
|
+
//# sourceMappingURL=index.js.map
|