@amsintegra/design-system 1.0.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.cjs ADDED
@@ -0,0 +1,1127 @@
1
+ 'use strict';
2
+
3
+ var antd = require('antd');
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var icons = require('@ant-design/icons');
7
+
8
+ // src/theme/AmsConfigProvider.tsx
9
+
10
+ // src/theme/tokens.ts
11
+ var primitives = {
12
+ brandRed: "#A72432",
13
+ brandRedActive: "#8B1D28",
14
+ // darken 10%
15
+ brandRedLight: "#f1faff",
16
+ green: "#50cd89",
17
+ greenActive: "#47be7d",
18
+ greenLight: "#e8fff3",
19
+ purple: "#7239ea",
20
+ purpleActive: "#5014d0",
21
+ purpleLight: "#f8f5ff",
22
+ pink: "#f1416c",
23
+ pinkActive: "#d9214e",
24
+ pinkLight: "#fff5f8",
25
+ yellow: "#ffc700",
26
+ yellowActive: "#f1bc00",
27
+ yellowLight: "#fff8dd",
28
+ white: "#ffffff",
29
+ gray: {
30
+ 100: "#f9f9f9",
31
+ 200: "#f4f4f4",
32
+ 300: "#e1e3ea",
33
+ 400: "#b5b5c3",
34
+ 500: "#a1a5b7",
35
+ 600: "#7e8299",
36
+ 700: "#5e6278",
37
+ 800: "#3f4254",
38
+ 900: "#181c32"
39
+ },
40
+ background: {
41
+ app: "#f5f8fa",
42
+ body: "#ffffff",
43
+ appDark: "#151521",
44
+ bodyDark: "#1e1e2d"
45
+ },
46
+ dark: {
47
+ base: "#181c32",
48
+ bg: "#151521",
49
+ header: "#1e1e2d",
50
+ active: "#2a2a3c",
51
+ separator: "#393945",
52
+ // Dark-mode surfaces (from mf-container's antdTheme).
53
+ inputBg: "#1b1b29",
54
+ cardBg: "#1e1e2d",
55
+ // Dark-mode gray scale — DISTINCT from the light `gray` scale (Metronic).
56
+ gray: {
57
+ 100: "#2b2b40",
58
+ 200: "#323248",
59
+ 300: "#3b3b64",
60
+ 400: "#474761",
61
+ 500: "#565674",
62
+ 600: "#6d6d80",
63
+ 700: "#92929f",
64
+ 800: "#cdcdde"
65
+ }
66
+ }
67
+ };
68
+ var radius = {
69
+ sm: 2,
70
+ base: 4,
71
+ md: 6,
72
+ lg: 8,
73
+ xl: 12
74
+ };
75
+ var typography = {
76
+ fontFamily: "Inter, Helvetica, Arial, sans-serif",
77
+ fontSizeBase: 13,
78
+ weight: {
79
+ light: 300,
80
+ normal: 400,
81
+ medium: 500,
82
+ semibold: 600,
83
+ bold: 700
84
+ }
85
+ };
86
+ var sizing = {
87
+ controlHeight: 32,
88
+ buttonMinWidth: 110
89
+ };
90
+ var semantic = {
91
+ colorPrimary: primitives.brandRed,
92
+ colorPrimaryActive: primitives.brandRedActive,
93
+ colorSuccess: primitives.green,
94
+ colorInfo: primitives.purple,
95
+ colorError: primitives.pink,
96
+ colorWarning: primitives.yellow,
97
+ // Links. Metronic inherits link color from the (red) primary, which reads as
98
+ // "danger" in dense UIs. The AMS default uses a neutral dark gray so links
99
+ // don't look like errors; consumers can override `colorLink`/`colorLinkHover`
100
+ // via AmsConfigProvider's `theme` prop (e.g. back to the brand red or blue).
101
+ colorLink: primitives.gray[800],
102
+ colorLinkHover: primitives.brandRed,
103
+ colorLinkActive: primitives.brandRedActive,
104
+ colorBgLayout: primitives.background.app,
105
+ colorBgContainer: primitives.background.body,
106
+ borderRadius: radius.base,
107
+ fontFamily: typography.fontFamily,
108
+ fontSize: typography.fontSizeBase,
109
+ controlHeight: sizing.controlHeight
110
+ };
111
+
112
+ // src/theme/theme.ts
113
+ var sharedToken = {
114
+ colorPrimary: semantic.colorPrimary,
115
+ colorSuccess: semantic.colorSuccess,
116
+ colorInfo: semantic.colorInfo,
117
+ colorError: semantic.colorError,
118
+ colorWarning: semantic.colorWarning,
119
+ colorLink: semantic.colorLink,
120
+ colorLinkHover: semantic.colorLinkHover,
121
+ colorLinkActive: semantic.colorLinkActive,
122
+ borderRadius: semantic.borderRadius,
123
+ fontFamily: semantic.fontFamily,
124
+ fontSize: semantic.fontSize,
125
+ controlHeight: semantic.controlHeight
126
+ };
127
+ var lightToken = {
128
+ ...sharedToken,
129
+ colorBgLayout: semantic.colorBgLayout,
130
+ colorBgContainer: semantic.colorBgContainer,
131
+ colorBgElevated: primitives.background.body,
132
+ colorText: primitives.gray[900],
133
+ colorTextSecondary: primitives.gray[700],
134
+ colorTextTertiary: primitives.gray[500],
135
+ colorTextQuaternary: primitives.gray[400],
136
+ colorBorder: primitives.gray[300],
137
+ colorBorderSecondary: primitives.gray[200]
138
+ };
139
+ var darkToken = {
140
+ ...sharedToken,
141
+ colorBgLayout: primitives.background.appDark,
142
+ colorBgContainer: primitives.background.bodyDark,
143
+ colorBgElevated: primitives.background.bodyDark,
144
+ colorText: "#ffffff",
145
+ colorTextHeading: "#ffffff",
146
+ colorTextSecondary: primitives.dark.gray[800],
147
+ colorTextTertiary: primitives.dark.gray[700],
148
+ colorTextQuaternary: primitives.dark.gray[600],
149
+ colorBorder: primitives.dark.gray[300],
150
+ colorBorderSecondary: primitives.dark.gray[200],
151
+ boxShadow: "0 6px 16px 0 rgba(0, 0, 0, 0.48), 0 3px 6px -4px rgba(0, 0, 0, 0.36), 0 9px 28px 8px rgba(0, 0, 0, 0.15)"
152
+ };
153
+ var sharedComponents = {
154
+ Button: { controlHeight: 32 },
155
+ Tabs: {
156
+ itemColor: primitives.gray[600],
157
+ itemSelectedColor: semantic.colorPrimary,
158
+ itemHoverColor: semantic.colorPrimary
159
+ }
160
+ };
161
+ var lightComponents = {
162
+ ...sharedComponents,
163
+ Table: {
164
+ headerBg: primitives.gray[100],
165
+ headerColor: primitives.gray[800],
166
+ borderColor: primitives.gray[300],
167
+ cellPaddingBlock: 8,
168
+ cellPaddingInline: 8
169
+ }
170
+ };
171
+ var darkComponents = {
172
+ ...sharedComponents,
173
+ Table: {
174
+ headerBg: primitives.dark.gray[200],
175
+ headerColor: primitives.dark.gray[800],
176
+ borderColor: primitives.dark.gray[400],
177
+ rowHoverBg: primitives.dark.gray[200],
178
+ cellPaddingBlock: 8,
179
+ cellPaddingInline: 8
180
+ },
181
+ Input: {
182
+ colorBgContainer: primitives.dark.inputBg,
183
+ colorBorder: primitives.dark.gray[400],
184
+ colorText: "#ffffff"
185
+ },
186
+ Select: {
187
+ colorBgContainer: primitives.dark.inputBg,
188
+ colorBorder: primitives.dark.gray[400],
189
+ colorText: "#ffffff"
190
+ },
191
+ DatePicker: {
192
+ colorBgContainer: primitives.dark.inputBg
193
+ },
194
+ Card: {
195
+ colorBgContainer: primitives.dark.cardBg,
196
+ colorBorderSecondary: primitives.dark.cardBg
197
+ },
198
+ Modal: {
199
+ contentBg: primitives.dark.gray[100],
200
+ headerBg: primitives.dark.gray[100]
201
+ },
202
+ Drawer: {
203
+ colorBgElevated: primitives.dark.gray[100]
204
+ },
205
+ Notification: {
206
+ colorBgElevated: primitives.dark.gray[100]
207
+ },
208
+ Message: {
209
+ contentBg: primitives.dark.gray[100]
210
+ },
211
+ Menu: {
212
+ itemBg: primitives.background.bodyDark,
213
+ itemHoverBg: primitives.dark.gray[100],
214
+ itemSelectedBg: primitives.dark.active,
215
+ itemSelectedColor: semantic.colorPrimary,
216
+ itemActiveBg: primitives.dark.active,
217
+ subMenuItemBg: primitives.background.bodyDark
218
+ },
219
+ Dropdown: {
220
+ colorBgElevated: primitives.background.bodyDark,
221
+ controlItemBgHover: primitives.dark.gray[100]
222
+ }
223
+ };
224
+ function buildTheme(mode = "light") {
225
+ const isDark = mode === "dark";
226
+ return {
227
+ algorithm: isDark ? antd.theme.darkAlgorithm : antd.theme.defaultAlgorithm,
228
+ token: isDark ? darkToken : lightToken,
229
+ components: isDark ? darkComponents : lightComponents
230
+ };
231
+ }
232
+ var amsTheme = buildTheme("light");
233
+ var amsThemeDark = buildTheme("dark");
234
+ var STORAGE_KEY = "ams-theme";
235
+ function getInitialThemeMode(defaultMode = "light") {
236
+ if (typeof window === "undefined") return defaultMode;
237
+ const saved = window.localStorage.getItem(STORAGE_KEY);
238
+ if (saved === "light" || saved === "dark") return saved;
239
+ if (window.matchMedia?.("(prefers-color-scheme: dark)").matches) return "dark";
240
+ return defaultMode;
241
+ }
242
+ function applyThemeModeToDOM(mode) {
243
+ if (typeof document === "undefined") return;
244
+ document.documentElement.setAttribute("data-theme", mode);
245
+ document.body?.setAttribute("data-theme", mode);
246
+ }
247
+ var ThemeModeContext = react.createContext(null);
248
+ function useThemeMode() {
249
+ const ctx = react.useContext(ThemeModeContext);
250
+ if (!ctx) {
251
+ throw new Error("useThemeMode must be used within an AmsConfigProvider");
252
+ }
253
+ return ctx;
254
+ }
255
+ function useThemeModeState(controlledMode, defaultMode, persist) {
256
+ const isControlled = controlledMode !== void 0;
257
+ const [internalMode, setInternalMode] = react.useState(
258
+ () => isControlled ? controlledMode : persist ? getInitialThemeMode(defaultMode) : defaultMode
259
+ );
260
+ const mode = isControlled ? controlledMode : internalMode;
261
+ react.useEffect(() => {
262
+ applyThemeModeToDOM(mode);
263
+ }, [mode]);
264
+ const setMode = react.useCallback(
265
+ (next) => {
266
+ if (!isControlled) {
267
+ setInternalMode(next);
268
+ if (persist && typeof window !== "undefined") {
269
+ window.localStorage.setItem(STORAGE_KEY, next);
270
+ }
271
+ }
272
+ },
273
+ [isControlled, persist]
274
+ );
275
+ const toggle = react.useCallback(() => {
276
+ setMode(mode === "light" ? "dark" : "light");
277
+ }, [mode, setMode]);
278
+ return react.useMemo(
279
+ () => ({ mode, setMode, toggle, isDark: mode === "dark" }),
280
+ [mode, setMode, toggle]
281
+ );
282
+ }
283
+ function mergeTheme(base, override) {
284
+ if (!override) return base;
285
+ return {
286
+ ...base,
287
+ ...override,
288
+ token: { ...base.token, ...override.token },
289
+ components: { ...base.components, ...override.components },
290
+ // A caller-provided algorithm wins; otherwise keep the mode's algorithm.
291
+ algorithm: override.algorithm ?? base.algorithm
292
+ };
293
+ }
294
+ function AmsConfigProvider({
295
+ mode,
296
+ defaultMode = "light",
297
+ persistMode = true,
298
+ locale,
299
+ theme,
300
+ children
301
+ }) {
302
+ const themeMode = useThemeModeState(mode, defaultMode, persistMode);
303
+ const resolvedTheme = mergeTheme(buildTheme(themeMode.mode), theme);
304
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeModeContext.Provider, { value: themeMode, children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { theme: resolvedTheme, locale, children: /* @__PURE__ */ jsxRuntime.jsx(antd.App, { children }) }) });
305
+ }
306
+ var Button = react.forwardRef(
307
+ function Button2(props, ref) {
308
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { ref, ...props });
309
+ }
310
+ );
311
+ var INTENT_COLOR = {
312
+ success: semantic.colorSuccess,
313
+ error: semantic.colorError,
314
+ warning: semantic.colorWarning,
315
+ info: semantic.colorInfo,
316
+ primary: semantic.colorPrimary
317
+ };
318
+ var Tag = react.forwardRef(function Tag2({ intent, color, ...rest }, ref) {
319
+ const resolvedColor = intent ? INTENT_COLOR[intent] : color;
320
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { ref, color: resolvedColor, ...rest });
321
+ });
322
+ function useAmsMessage() {
323
+ return antd.App.useApp().message;
324
+ }
325
+ function useAmsNotification() {
326
+ return antd.App.useApp().notification;
327
+ }
328
+ function buildLocale(labels) {
329
+ if (!labels) return void 0;
330
+ const locale = {};
331
+ if (labels.itemsPerPage !== void 0) locale.items_per_page = labels.itemsPerPage;
332
+ if (labels.jumpTo !== void 0) locale.jump_to = labels.jumpTo;
333
+ if (labels.jumpToConfirm !== void 0) locale.jump_to_confirm = labels.jumpToConfirm;
334
+ if (labels.page !== void 0) locale.page = labels.page;
335
+ if (labels.prevPage !== void 0) locale.prev_page = labels.prevPage;
336
+ if (labels.nextPage !== void 0) locale.next_page = labels.nextPage;
337
+ if (labels.pageSize !== void 0) locale.page_size = labels.pageSize;
338
+ return Object.keys(locale).length > 0 ? locale : void 0;
339
+ }
340
+ function Pagination({
341
+ labels,
342
+ showTotal,
343
+ itemRender,
344
+ locale,
345
+ ...rest
346
+ }) {
347
+ const mergedLocale = { ...buildLocale(labels), ...locale };
348
+ const resolvedShowTotal = showTotal ?? (labels?.total ? (total, range) => labels.total(total, range) : labels?.totalText ? (total, range) => {
349
+ const { prefix, suffix, showRange } = labels.totalText;
350
+ const middle = showRange ? `${range[0]}-${range[1]}` : String(total);
351
+ return [prefix, middle, suffix].filter(Boolean).join(" ");
352
+ } : void 0);
353
+ const resolvedItemRender = itemRender ?? (labels?.previousText || labels?.nextText ? (_page, type, element) => {
354
+ if (type === "prev" && labels?.previousText !== void 0) return labels.previousText;
355
+ if (type === "next" && labels?.nextText !== void 0) return labels.nextText;
356
+ return element;
357
+ } : void 0);
358
+ return /* @__PURE__ */ jsxRuntime.jsx(
359
+ antd.Pagination,
360
+ {
361
+ ...rest,
362
+ locale: Object.keys(mergedLocale).length > 0 ? mergedLocale : void 0,
363
+ showTotal: resolvedShowTotal,
364
+ itemRender: resolvedItemRender
365
+ }
366
+ );
367
+ }
368
+ function ThemeToggle(props) {
369
+ const { isDark, toggle } = useThemeMode();
370
+ return /* @__PURE__ */ jsxRuntime.jsx(
371
+ antd.Switch,
372
+ {
373
+ checked: isDark,
374
+ onChange: toggle,
375
+ checkedChildren: /* @__PURE__ */ jsxRuntime.jsx(icons.BulbFilled, {}),
376
+ unCheckedChildren: /* @__PURE__ */ jsxRuntime.jsx(icons.BulbOutlined, {}),
377
+ ...props
378
+ }
379
+ );
380
+ }
381
+ function buildPaginationLocale(labels) {
382
+ if (!labels) return void 0;
383
+ const locale = {};
384
+ if (labels.itemsPerPage !== void 0) locale.items_per_page = labels.itemsPerPage;
385
+ if (labels.jumpTo !== void 0) locale.jump_to = labels.jumpTo;
386
+ if (labels.jumpToConfirm !== void 0) locale.jump_to_confirm = labels.jumpToConfirm;
387
+ if (labels.page !== void 0) locale.page = labels.page;
388
+ if (labels.prevPage !== void 0) locale.prev_page = labels.prevPage;
389
+ if (labels.nextPage !== void 0) locale.next_page = labels.nextPage;
390
+ if (labels.pageSize !== void 0) locale.page_size = labels.pageSize;
391
+ return Object.keys(locale).length > 0 ? locale : void 0;
392
+ }
393
+ var DEFAULT_LABELS = {
394
+ emptyText: "No data",
395
+ sortAsc: "Sort ascending",
396
+ sortDesc: "Sort descending",
397
+ cancelSort: "Cancel sort"
398
+ };
399
+ function toNumericValue(value) {
400
+ if (value === null || value === void 0 || value === "") return null;
401
+ const num = typeof value === "string" ? parseFloat(value.replace(/,/g, "")) : Number(value);
402
+ return Number.isNaN(num) || !Number.isFinite(num) ? null : num;
403
+ }
404
+ function buildTotalText(labels) {
405
+ if (!labels) return void 0;
406
+ if (labels.total) return (total, range) => labels.total(total, range);
407
+ if (labels.totalText) {
408
+ return (total, range) => {
409
+ const { prefix, suffix, showRange } = labels.totalText;
410
+ const middle = showRange ? `${range[0]}-${range[1]}` : String(total);
411
+ return [prefix, middle, suffix].filter(Boolean).join(" ");
412
+ };
413
+ }
414
+ return void 0;
415
+ }
416
+ function buildItemRender(labels) {
417
+ if (!labels || labels.previousText === void 0 && labels.nextText === void 0) {
418
+ return void 0;
419
+ }
420
+ return (_page, type, element) => {
421
+ if (type === "prev" && labels.previousText !== void 0) return labels.previousText;
422
+ if (type === "next" && labels.nextText !== void 0) return labels.nextText;
423
+ return element;
424
+ };
425
+ }
426
+ function DataTable({
427
+ heading,
428
+ extra,
429
+ loading = false,
430
+ labels,
431
+ paginationLabels,
432
+ firstColumnNumericTag = false,
433
+ columns,
434
+ dataSource,
435
+ scroll,
436
+ bordered = true,
437
+ pagination,
438
+ className,
439
+ ...rest
440
+ }) {
441
+ const mergedLabels = { ...DEFAULT_LABELS, ...labels };
442
+ const resolvedPagination = pagination === false || pagination === void 0 ? pagination : (() => {
443
+ const paginationLocale = buildPaginationLocale(paginationLabels);
444
+ const totalFn = buildTotalText(paginationLabels);
445
+ const itemRenderFn = buildItemRender(paginationLabels);
446
+ return {
447
+ ...totalFn ? { showTotal: totalFn } : {},
448
+ ...itemRenderFn ? { itemRender: itemRenderFn } : {},
449
+ ...paginationLocale ? { locale: paginationLocale } : {},
450
+ ...pagination
451
+ };
452
+ })();
453
+ const resolvedColumns = firstColumnNumericTag && columns && columns.length > 0 ? columns.map((col, index) => {
454
+ if (index !== 0) return col;
455
+ const originalRender = col.render;
456
+ return {
457
+ ...col,
458
+ render: (value, record, i) => {
459
+ const content = originalRender ? originalRender(value, record, i) : value;
460
+ const numeric = toNumericValue(value);
461
+ if (numeric === null) return content;
462
+ return /* @__PURE__ */ jsxRuntime.jsx(
463
+ Tag,
464
+ {
465
+ intent: numeric < 0 ? "error" : "success",
466
+ style: { minWidth: 72, textAlign: "center" },
467
+ children: content
468
+ }
469
+ );
470
+ }
471
+ };
472
+ }) : columns;
473
+ const resolvedScroll = scroll ?? { x: "max-content" };
474
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
475
+ heading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: 0, fontWeight: 600 }, children: heading }) }) : null,
476
+ extra ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: 8 }, children: extra }) : null,
477
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton, { active: true, paragraph: { rows: 0 }, title: { width: "100%" } }, i)) }) : /* @__PURE__ */ jsxRuntime.jsx(
478
+ antd.Table,
479
+ {
480
+ columns: resolvedColumns,
481
+ dataSource,
482
+ bordered,
483
+ scroll: resolvedScroll,
484
+ pagination: resolvedPagination,
485
+ locale: {
486
+ emptyText: mergedLabels.emptyText,
487
+ triggerAsc: mergedLabels.sortAsc,
488
+ triggerDesc: mergedLabels.sortDesc,
489
+ cancelSort: mergedLabels.cancelSort
490
+ },
491
+ ...rest
492
+ }
493
+ )
494
+ ] });
495
+ }
496
+ function useControllableState({
497
+ value,
498
+ defaultValue,
499
+ onChange
500
+ }) {
501
+ const isControlled = value !== void 0;
502
+ const [internal, setInternal] = react.useState(defaultValue);
503
+ const current = isControlled ? value : internal;
504
+ const setValue = react.useCallback(
505
+ (next) => {
506
+ if (!isControlled) {
507
+ setInternal(next);
508
+ }
509
+ onChange?.(next);
510
+ },
511
+ [isControlled, onChange]
512
+ );
513
+ return [current, setValue];
514
+ }
515
+ function isPromise(value) {
516
+ return !!value && typeof value.then === "function";
517
+ }
518
+ function ModalDialog({
519
+ trigger,
520
+ children,
521
+ open,
522
+ defaultOpen = false,
523
+ closeOnOk = true,
524
+ closeOnCancel = true,
525
+ onOk,
526
+ onCancel,
527
+ onOpenChange,
528
+ ...modalProps
529
+ }) {
530
+ const [isOpen, setOpen] = useControllableState({
531
+ value: open,
532
+ defaultValue: defaultOpen,
533
+ onChange: onOpenChange
534
+ });
535
+ const handleOpen = react.useCallback(() => setOpen(true), [setOpen]);
536
+ const handleCancel = react.useCallback(
537
+ (event) => {
538
+ onCancel?.(event);
539
+ if (closeOnCancel) setOpen(false);
540
+ },
541
+ [onCancel, closeOnCancel, setOpen]
542
+ );
543
+ const handleOk = react.useCallback(
544
+ async (event) => {
545
+ const result = onOk?.(event);
546
+ if (!closeOnOk) return;
547
+ if (isPromise(result)) {
548
+ try {
549
+ await result;
550
+ } finally {
551
+ setOpen(false);
552
+ }
553
+ } else {
554
+ setOpen(false);
555
+ }
556
+ },
557
+ [onOk, closeOnOk, setOpen]
558
+ );
559
+ const triggerNode = react.useMemo(() => {
560
+ if (!trigger) return null;
561
+ if (typeof trigger === "function") {
562
+ return trigger(handleOpen);
563
+ }
564
+ if (react.isValidElement(trigger)) {
565
+ const el = trigger;
566
+ const originalOnClick = el.props.onClick;
567
+ return react.cloneElement(el, {
568
+ onClick: (event) => {
569
+ originalOnClick?.(event);
570
+ handleOpen();
571
+ }
572
+ });
573
+ }
574
+ return trigger;
575
+ }, [trigger, handleOpen]);
576
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
577
+ triggerNode,
578
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Modal, { open: isOpen, onOk: handleOk, onCancel: handleCancel, ...modalProps, children })
579
+ ] });
580
+ }
581
+ var normalize = (value) => (value ?? "").toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
582
+ var extractText = (node) => {
583
+ if (node === null || node === void 0) return "";
584
+ if (typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
585
+ return String(node);
586
+ }
587
+ if (Array.isArray(node)) return node.map(extractText).join(" ");
588
+ if (typeof node === "object" && "props" in node) {
589
+ const props = node.props;
590
+ return extractText(props?.children);
591
+ }
592
+ return "";
593
+ };
594
+ function FilterSelect({
595
+ options,
596
+ showSearch = false,
597
+ filterOption,
598
+ className,
599
+ style,
600
+ ...rest
601
+ }) {
602
+ const defaultFilter = (input, option) => {
603
+ if (!option) return false;
604
+ const query = normalize(input);
605
+ const label = normalize(extractText(option.label));
606
+ const value = normalize(typeof option.value === "string" ? option.value : "");
607
+ return label.includes(query) || value.includes(query);
608
+ };
609
+ const resolvedFilter = showSearch && !filterOption ? defaultFilter : filterOption;
610
+ return /* @__PURE__ */ jsxRuntime.jsx(
611
+ antd.Select,
612
+ {
613
+ options,
614
+ showSearch,
615
+ filterOption: resolvedFilter,
616
+ optionFilterProp: "label",
617
+ className,
618
+ style: { width: "100%", ...style },
619
+ ...rest
620
+ }
621
+ );
622
+ }
623
+ var resolveMessage = (template, fileName, fallback) => {
624
+ if (!template) return fallback.replace("{file}", fileName);
625
+ return typeof template === "function" ? template(fileName) : template.replace("{file}", fileName);
626
+ };
627
+ function FileUploadDragger({
628
+ successMessage,
629
+ errorMessage,
630
+ showStatusMessages = true,
631
+ hintText = "Click or drag a file to this area to upload",
632
+ onUploadSuccess,
633
+ onUploadError,
634
+ onChange: externalOnChange,
635
+ children,
636
+ ...uploadProps
637
+ }) {
638
+ const message = useAmsMessage();
639
+ const mergedProps = react.useMemo(
640
+ () => ({
641
+ ...uploadProps,
642
+ onChange(info) {
643
+ const { status, name: fileName } = info.file;
644
+ if (showStatusMessages) {
645
+ if (status === "done") {
646
+ message.success(resolveMessage(successMessage, fileName, `${fileName} uploaded successfully.`));
647
+ onUploadSuccess?.(info);
648
+ } else if (status === "error") {
649
+ message.error(resolveMessage(errorMessage, fileName, `${fileName} failed to upload.`));
650
+ onUploadError?.(info);
651
+ }
652
+ }
653
+ externalOnChange?.(info);
654
+ }
655
+ }),
656
+ [uploadProps, showStatusMessages, message, successMessage, errorMessage, onUploadSuccess, onUploadError, externalOnChange]
657
+ );
658
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Upload.Dragger, { ...mergedProps, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
659
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsxRuntime.jsx(icons.InboxOutlined, {}) }),
660
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ant-upload-text", children: hintText })
661
+ ] }) });
662
+ }
663
+ function PageHeader({
664
+ title,
665
+ breadcrumbs,
666
+ separator = ">",
667
+ uppercaseTitle = true,
668
+ extra,
669
+ className
670
+ }) {
671
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { marginBottom: 32 }, children: [
672
+ /* @__PURE__ */ jsxRuntime.jsxs(
673
+ "div",
674
+ {
675
+ style: {
676
+ display: "flex",
677
+ alignItems: "center",
678
+ justifyContent: "space-between",
679
+ gap: 16
680
+ },
681
+ children: [
682
+ /* @__PURE__ */ jsxRuntime.jsx(
683
+ "h1",
684
+ {
685
+ style: {
686
+ fontSize: 20,
687
+ fontWeight: 700,
688
+ margin: 0,
689
+ textTransform: uppercaseTitle ? "uppercase" : void 0
690
+ },
691
+ children: title
692
+ }
693
+ ),
694
+ extra ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: extra }) : null
695
+ ]
696
+ }
697
+ ),
698
+ breadcrumbs && breadcrumbs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
699
+ antd.Breadcrumb,
700
+ {
701
+ separator,
702
+ items: breadcrumbs,
703
+ style: { fontSize: 13, marginTop: 8 }
704
+ }
705
+ ) : null
706
+ ] });
707
+ }
708
+ var DownloadButton = react.forwardRef(function DownloadButton2({ label = "CSV", icon, type = "primary", children, ...rest }, ref) {
709
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { ref, type, icon: icon ?? /* @__PURE__ */ jsxRuntime.jsx(icons.DownloadOutlined, {}), ...rest, children: children ?? label });
710
+ });
711
+ function ConfirmModal({
712
+ message,
713
+ danger = false,
714
+ okButtonProps,
715
+ children,
716
+ ...rest
717
+ }) {
718
+ return /* @__PURE__ */ jsxRuntime.jsx(
719
+ ModalDialog,
720
+ {
721
+ okButtonProps: { danger, ...okButtonProps },
722
+ ...rest,
723
+ children: children ?? (message ? /* @__PURE__ */ jsxRuntime.jsx("p", { children: message }) : null)
724
+ }
725
+ );
726
+ }
727
+
728
+ Object.defineProperty(exports, "Affix", {
729
+ enumerable: true,
730
+ get: function () { return antd.Affix; }
731
+ });
732
+ Object.defineProperty(exports, "Alert", {
733
+ enumerable: true,
734
+ get: function () { return antd.Alert; }
735
+ });
736
+ Object.defineProperty(exports, "Anchor", {
737
+ enumerable: true,
738
+ get: function () { return antd.Anchor; }
739
+ });
740
+ Object.defineProperty(exports, "AutoComplete", {
741
+ enumerable: true,
742
+ get: function () { return antd.AutoComplete; }
743
+ });
744
+ Object.defineProperty(exports, "Avatar", {
745
+ enumerable: true,
746
+ get: function () { return antd.Avatar; }
747
+ });
748
+ Object.defineProperty(exports, "BackTop", {
749
+ enumerable: true,
750
+ get: function () { return antd.BackTop; }
751
+ });
752
+ Object.defineProperty(exports, "Badge", {
753
+ enumerable: true,
754
+ get: function () { return antd.Badge; }
755
+ });
756
+ Object.defineProperty(exports, "Breadcrumb", {
757
+ enumerable: true,
758
+ get: function () { return antd.Breadcrumb; }
759
+ });
760
+ Object.defineProperty(exports, "Calendar", {
761
+ enumerable: true,
762
+ get: function () { return antd.Calendar; }
763
+ });
764
+ Object.defineProperty(exports, "Card", {
765
+ enumerable: true,
766
+ get: function () { return antd.Card; }
767
+ });
768
+ Object.defineProperty(exports, "Carousel", {
769
+ enumerable: true,
770
+ get: function () { return antd.Carousel; }
771
+ });
772
+ Object.defineProperty(exports, "Cascader", {
773
+ enumerable: true,
774
+ get: function () { return antd.Cascader; }
775
+ });
776
+ Object.defineProperty(exports, "Checkbox", {
777
+ enumerable: true,
778
+ get: function () { return antd.Checkbox; }
779
+ });
780
+ Object.defineProperty(exports, "Col", {
781
+ enumerable: true,
782
+ get: function () { return antd.Col; }
783
+ });
784
+ Object.defineProperty(exports, "Collapse", {
785
+ enumerable: true,
786
+ get: function () { return antd.Collapse; }
787
+ });
788
+ Object.defineProperty(exports, "ColorPicker", {
789
+ enumerable: true,
790
+ get: function () { return antd.ColorPicker; }
791
+ });
792
+ Object.defineProperty(exports, "DatePicker", {
793
+ enumerable: true,
794
+ get: function () { return antd.DatePicker; }
795
+ });
796
+ Object.defineProperty(exports, "Descriptions", {
797
+ enumerable: true,
798
+ get: function () { return antd.Descriptions; }
799
+ });
800
+ Object.defineProperty(exports, "Divider", {
801
+ enumerable: true,
802
+ get: function () { return antd.Divider; }
803
+ });
804
+ Object.defineProperty(exports, "Drawer", {
805
+ enumerable: true,
806
+ get: function () { return antd.Drawer; }
807
+ });
808
+ Object.defineProperty(exports, "Dropdown", {
809
+ enumerable: true,
810
+ get: function () { return antd.Dropdown; }
811
+ });
812
+ Object.defineProperty(exports, "Empty", {
813
+ enumerable: true,
814
+ get: function () { return antd.Empty; }
815
+ });
816
+ Object.defineProperty(exports, "Flex", {
817
+ enumerable: true,
818
+ get: function () { return antd.Flex; }
819
+ });
820
+ Object.defineProperty(exports, "FloatButton", {
821
+ enumerable: true,
822
+ get: function () { return antd.FloatButton; }
823
+ });
824
+ Object.defineProperty(exports, "Form", {
825
+ enumerable: true,
826
+ get: function () { return antd.Form; }
827
+ });
828
+ Object.defineProperty(exports, "Image", {
829
+ enumerable: true,
830
+ get: function () { return antd.Image; }
831
+ });
832
+ Object.defineProperty(exports, "Input", {
833
+ enumerable: true,
834
+ get: function () { return antd.Input; }
835
+ });
836
+ Object.defineProperty(exports, "InputNumber", {
837
+ enumerable: true,
838
+ get: function () { return antd.InputNumber; }
839
+ });
840
+ Object.defineProperty(exports, "Layout", {
841
+ enumerable: true,
842
+ get: function () { return antd.Layout; }
843
+ });
844
+ Object.defineProperty(exports, "List", {
845
+ enumerable: true,
846
+ get: function () { return antd.List; }
847
+ });
848
+ Object.defineProperty(exports, "Mentions", {
849
+ enumerable: true,
850
+ get: function () { return antd.Mentions; }
851
+ });
852
+ Object.defineProperty(exports, "Menu", {
853
+ enumerable: true,
854
+ get: function () { return antd.Menu; }
855
+ });
856
+ Object.defineProperty(exports, "Modal", {
857
+ enumerable: true,
858
+ get: function () { return antd.Modal; }
859
+ });
860
+ Object.defineProperty(exports, "Popconfirm", {
861
+ enumerable: true,
862
+ get: function () { return antd.Popconfirm; }
863
+ });
864
+ Object.defineProperty(exports, "Popover", {
865
+ enumerable: true,
866
+ get: function () { return antd.Popover; }
867
+ });
868
+ Object.defineProperty(exports, "Progress", {
869
+ enumerable: true,
870
+ get: function () { return antd.Progress; }
871
+ });
872
+ Object.defineProperty(exports, "QRCode", {
873
+ enumerable: true,
874
+ get: function () { return antd.QRCode; }
875
+ });
876
+ Object.defineProperty(exports, "Radio", {
877
+ enumerable: true,
878
+ get: function () { return antd.Radio; }
879
+ });
880
+ Object.defineProperty(exports, "Rate", {
881
+ enumerable: true,
882
+ get: function () { return antd.Rate; }
883
+ });
884
+ Object.defineProperty(exports, "Result", {
885
+ enumerable: true,
886
+ get: function () { return antd.Result; }
887
+ });
888
+ Object.defineProperty(exports, "Row", {
889
+ enumerable: true,
890
+ get: function () { return antd.Row; }
891
+ });
892
+ Object.defineProperty(exports, "Segmented", {
893
+ enumerable: true,
894
+ get: function () { return antd.Segmented; }
895
+ });
896
+ Object.defineProperty(exports, "Select", {
897
+ enumerable: true,
898
+ get: function () { return antd.Select; }
899
+ });
900
+ Object.defineProperty(exports, "Skeleton", {
901
+ enumerable: true,
902
+ get: function () { return antd.Skeleton; }
903
+ });
904
+ Object.defineProperty(exports, "Slider", {
905
+ enumerable: true,
906
+ get: function () { return antd.Slider; }
907
+ });
908
+ Object.defineProperty(exports, "Space", {
909
+ enumerable: true,
910
+ get: function () { return antd.Space; }
911
+ });
912
+ Object.defineProperty(exports, "Spin", {
913
+ enumerable: true,
914
+ get: function () { return antd.Spin; }
915
+ });
916
+ Object.defineProperty(exports, "Splitter", {
917
+ enumerable: true,
918
+ get: function () { return antd.Splitter; }
919
+ });
920
+ Object.defineProperty(exports, "Statistic", {
921
+ enumerable: true,
922
+ get: function () { return antd.Statistic; }
923
+ });
924
+ Object.defineProperty(exports, "Steps", {
925
+ enumerable: true,
926
+ get: function () { return antd.Steps; }
927
+ });
928
+ Object.defineProperty(exports, "Switch", {
929
+ enumerable: true,
930
+ get: function () { return antd.Switch; }
931
+ });
932
+ Object.defineProperty(exports, "Table", {
933
+ enumerable: true,
934
+ get: function () { return antd.Table; }
935
+ });
936
+ Object.defineProperty(exports, "Tabs", {
937
+ enumerable: true,
938
+ get: function () { return antd.Tabs; }
939
+ });
940
+ Object.defineProperty(exports, "TimePicker", {
941
+ enumerable: true,
942
+ get: function () { return antd.TimePicker; }
943
+ });
944
+ Object.defineProperty(exports, "Timeline", {
945
+ enumerable: true,
946
+ get: function () { return antd.Timeline; }
947
+ });
948
+ Object.defineProperty(exports, "Tooltip", {
949
+ enumerable: true,
950
+ get: function () { return antd.Tooltip; }
951
+ });
952
+ Object.defineProperty(exports, "Tour", {
953
+ enumerable: true,
954
+ get: function () { return antd.Tour; }
955
+ });
956
+ Object.defineProperty(exports, "Transfer", {
957
+ enumerable: true,
958
+ get: function () { return antd.Transfer; }
959
+ });
960
+ Object.defineProperty(exports, "Tree", {
961
+ enumerable: true,
962
+ get: function () { return antd.Tree; }
963
+ });
964
+ Object.defineProperty(exports, "TreeSelect", {
965
+ enumerable: true,
966
+ get: function () { return antd.TreeSelect; }
967
+ });
968
+ Object.defineProperty(exports, "Typography", {
969
+ enumerable: true,
970
+ get: function () { return antd.Typography; }
971
+ });
972
+ Object.defineProperty(exports, "Upload", {
973
+ enumerable: true,
974
+ get: function () { return antd.Upload; }
975
+ });
976
+ Object.defineProperty(exports, "Watermark", {
977
+ enumerable: true,
978
+ get: function () { return antd.Watermark; }
979
+ });
980
+ Object.defineProperty(exports, "CheckCircleOutlined", {
981
+ enumerable: true,
982
+ get: function () { return icons.CheckCircleOutlined; }
983
+ });
984
+ Object.defineProperty(exports, "CheckOutlined", {
985
+ enumerable: true,
986
+ get: function () { return icons.CheckOutlined; }
987
+ });
988
+ Object.defineProperty(exports, "CloseCircleOutlined", {
989
+ enumerable: true,
990
+ get: function () { return icons.CloseCircleOutlined; }
991
+ });
992
+ Object.defineProperty(exports, "CloseOutlined", {
993
+ enumerable: true,
994
+ get: function () { return icons.CloseOutlined; }
995
+ });
996
+ Object.defineProperty(exports, "DeleteOutlined", {
997
+ enumerable: true,
998
+ get: function () { return icons.DeleteOutlined; }
999
+ });
1000
+ Object.defineProperty(exports, "DownOutlined", {
1001
+ enumerable: true,
1002
+ get: function () { return icons.DownOutlined; }
1003
+ });
1004
+ Object.defineProperty(exports, "DownloadOutlined", {
1005
+ enumerable: true,
1006
+ get: function () { return icons.DownloadOutlined; }
1007
+ });
1008
+ Object.defineProperty(exports, "EditOutlined", {
1009
+ enumerable: true,
1010
+ get: function () { return icons.EditOutlined; }
1011
+ });
1012
+ Object.defineProperty(exports, "ExclamationCircleOutlined", {
1013
+ enumerable: true,
1014
+ get: function () { return icons.ExclamationCircleOutlined; }
1015
+ });
1016
+ Object.defineProperty(exports, "EyeInvisibleOutlined", {
1017
+ enumerable: true,
1018
+ get: function () { return icons.EyeInvisibleOutlined; }
1019
+ });
1020
+ Object.defineProperty(exports, "EyeOutlined", {
1021
+ enumerable: true,
1022
+ get: function () { return icons.EyeOutlined; }
1023
+ });
1024
+ Object.defineProperty(exports, "FileExcelOutlined", {
1025
+ enumerable: true,
1026
+ get: function () { return icons.FileExcelOutlined; }
1027
+ });
1028
+ Object.defineProperty(exports, "FileOutlined", {
1029
+ enumerable: true,
1030
+ get: function () { return icons.FileOutlined; }
1031
+ });
1032
+ Object.defineProperty(exports, "FilePdfOutlined", {
1033
+ enumerable: true,
1034
+ get: function () { return icons.FilePdfOutlined; }
1035
+ });
1036
+ Object.defineProperty(exports, "FilterOutlined", {
1037
+ enumerable: true,
1038
+ get: function () { return icons.FilterOutlined; }
1039
+ });
1040
+ Object.defineProperty(exports, "FolderOutlined", {
1041
+ enumerable: true,
1042
+ get: function () { return icons.FolderOutlined; }
1043
+ });
1044
+ Object.defineProperty(exports, "InfoCircleOutlined", {
1045
+ enumerable: true,
1046
+ get: function () { return icons.InfoCircleOutlined; }
1047
+ });
1048
+ Object.defineProperty(exports, "LeftOutlined", {
1049
+ enumerable: true,
1050
+ get: function () { return icons.LeftOutlined; }
1051
+ });
1052
+ Object.defineProperty(exports, "LoadingOutlined", {
1053
+ enumerable: true,
1054
+ get: function () { return icons.LoadingOutlined; }
1055
+ });
1056
+ Object.defineProperty(exports, "LogoutOutlined", {
1057
+ enumerable: true,
1058
+ get: function () { return icons.LogoutOutlined; }
1059
+ });
1060
+ Object.defineProperty(exports, "MenuOutlined", {
1061
+ enumerable: true,
1062
+ get: function () { return icons.MenuOutlined; }
1063
+ });
1064
+ Object.defineProperty(exports, "PlusOutlined", {
1065
+ enumerable: true,
1066
+ get: function () { return icons.PlusOutlined; }
1067
+ });
1068
+ Object.defineProperty(exports, "ReloadOutlined", {
1069
+ enumerable: true,
1070
+ get: function () { return icons.ReloadOutlined; }
1071
+ });
1072
+ Object.defineProperty(exports, "RightOutlined", {
1073
+ enumerable: true,
1074
+ get: function () { return icons.RightOutlined; }
1075
+ });
1076
+ Object.defineProperty(exports, "SearchOutlined", {
1077
+ enumerable: true,
1078
+ get: function () { return icons.SearchOutlined; }
1079
+ });
1080
+ Object.defineProperty(exports, "SettingOutlined", {
1081
+ enumerable: true,
1082
+ get: function () { return icons.SettingOutlined; }
1083
+ });
1084
+ Object.defineProperty(exports, "UpOutlined", {
1085
+ enumerable: true,
1086
+ get: function () { return icons.UpOutlined; }
1087
+ });
1088
+ Object.defineProperty(exports, "UploadOutlined", {
1089
+ enumerable: true,
1090
+ get: function () { return icons.UploadOutlined; }
1091
+ });
1092
+ Object.defineProperty(exports, "UserOutlined", {
1093
+ enumerable: true,
1094
+ get: function () { return icons.UserOutlined; }
1095
+ });
1096
+ Object.defineProperty(exports, "WarningOutlined", {
1097
+ enumerable: true,
1098
+ get: function () { return icons.WarningOutlined; }
1099
+ });
1100
+ exports.AmsConfigProvider = AmsConfigProvider;
1101
+ exports.Button = Button;
1102
+ exports.ConfirmModal = ConfirmModal;
1103
+ exports.DataTable = DataTable;
1104
+ exports.DownloadButton = DownloadButton;
1105
+ exports.FileUploadDragger = FileUploadDragger;
1106
+ exports.FilterSelect = FilterSelect;
1107
+ exports.ModalDialog = ModalDialog;
1108
+ exports.PageHeader = PageHeader;
1109
+ exports.Pagination = Pagination;
1110
+ exports.Tag = Tag;
1111
+ exports.ThemeToggle = ThemeToggle;
1112
+ exports.amsTheme = amsTheme;
1113
+ exports.amsThemeDark = amsThemeDark;
1114
+ exports.applyThemeModeToDOM = applyThemeModeToDOM;
1115
+ exports.buildTheme = buildTheme;
1116
+ exports.getInitialThemeMode = getInitialThemeMode;
1117
+ exports.primitives = primitives;
1118
+ exports.radius = radius;
1119
+ exports.semantic = semantic;
1120
+ exports.sizing = sizing;
1121
+ exports.typography = typography;
1122
+ exports.useAmsMessage = useAmsMessage;
1123
+ exports.useAmsNotification = useAmsNotification;
1124
+ exports.useControllableState = useControllableState;
1125
+ exports.useThemeMode = useThemeMode;
1126
+ //# sourceMappingURL=index.cjs.map
1127
+ //# sourceMappingURL=index.cjs.map