@duskmoon-dev/components 0.3.3 → 0.4.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.
Files changed (82) hide show
  1. package/README.md +61 -2
  2. package/dist/classes/chat.d.ts +9 -1
  3. package/dist/classes/console-page.d.ts +16 -0
  4. package/dist/classes/dropdown.d.ts +5 -5
  5. package/dist/classes/fab.d.ts +11 -0
  6. package/dist/classes/index.d.ts +5 -0
  7. package/dist/classes/index.js +180 -34
  8. package/dist/classes/megamenu.d.ts +10 -0
  9. package/dist/classes/otp-input.d.ts +12 -0
  10. package/dist/classes/popover.d.ts +1 -3
  11. package/dist/classes/swap.d.ts +12 -0
  12. package/dist/classes/tree-select.d.ts +6 -6
  13. package/dist/components/app/index.js +128 -68
  14. package/dist/components/avatar/Avatar.types.d.ts +1 -1
  15. package/dist/components/avatar/index.js +2 -1
  16. package/dist/components/badge/index.js +1 -1
  17. package/dist/components/button/Button.d.ts +1 -1
  18. package/dist/components/button/Button.types.d.ts +8 -0
  19. package/dist/components/button/index.js +253 -24
  20. package/dist/components/calendar/index.js +44 -19
  21. package/dist/components/chat/Chat.d.ts +9 -1
  22. package/dist/components/chat/Chat.types.d.ts +26 -0
  23. package/dist/components/chat/index.js +92 -3
  24. package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
  25. package/dist/components/color-picker/index.js +206 -9
  26. package/dist/components/console-page/ConsolePage.d.ts +2 -0
  27. package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
  28. package/dist/components/console-page/index.d.ts +2 -0
  29. package/dist/components/console-page/index.js +205 -0
  30. package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
  31. package/dist/components/date-picker/index.js +537 -35
  32. package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
  33. package/dist/components/dm-date-picker/index.js +545 -43
  34. package/dist/components/dm-drawer/index.js +253 -24
  35. package/dist/components/dm-layout/index.js +391 -24
  36. package/dist/components/dm-menu/index.js +380 -13
  37. package/dist/components/dm-page-header/index.js +404 -114
  38. package/dist/components/dm-pro-table/index.js +1183 -368
  39. package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
  40. package/dist/components/dm-query/index.js +931 -188
  41. package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
  42. package/dist/components/dm-search/index.js +917 -163
  43. package/dist/components/dm-table/index.js +1001 -247
  44. package/dist/components/dm-toolbar/index.js +400 -110
  45. package/dist/components/dm-truncate/index.js +115 -35
  46. package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
  47. package/dist/components/dropdown/index.js +400 -110
  48. package/dist/components/fab/Fab.d.ts +4 -0
  49. package/dist/components/fab/Fab.types.d.ts +25 -0
  50. package/dist/components/fab/index.d.ts +2 -0
  51. package/dist/components/fab/index.js +480 -0
  52. package/dist/components/form/Form.types.d.ts +1 -0
  53. package/dist/components/form/index.js +14 -3
  54. package/dist/components/megamenu/Megamenu.d.ts +2 -0
  55. package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
  56. package/dist/components/megamenu/index.d.ts +2 -0
  57. package/dist/components/megamenu/index.js +214 -0
  58. package/dist/components/modal/index.js +128 -68
  59. package/dist/components/otp-input/OtpInput.d.ts +2 -0
  60. package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
  61. package/dist/components/otp-input/index.d.ts +2 -0
  62. package/dist/components/otp-input/index.js +112 -0
  63. package/dist/components/popconfirm/index.js +255 -26
  64. package/dist/components/popover/index.js +24 -4
  65. package/dist/components/swap/Swap.d.ts +3 -0
  66. package/dist/components/swap/Swap.types.d.ts +22 -0
  67. package/dist/components/swap/index.d.ts +2 -0
  68. package/dist/components/swap/index.js +109 -0
  69. package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
  70. package/dist/components/time-picker/index.js +167 -29
  71. package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
  72. package/dist/components/tooltip/index.js +107 -27
  73. package/dist/components/tour/index.js +253 -24
  74. package/dist/components/tree-select/index.js +8 -8
  75. package/dist/components/upload/Upload.types.d.ts +1 -0
  76. package/dist/components/upload/index.js +2 -0
  77. package/dist/generated/version.d.ts +1 -1
  78. package/dist/index.d.ts +5 -0
  79. package/dist/index.js +3330 -1632
  80. package/dist/infrastructure.js +1 -1
  81. package/dist/styles.css +1190 -906
  82. package/package.json +23 -3
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/components/dm-table/DmTable.tsx
4
- import { useMemo as useMemo7, useState as useState8 } from "react";
4
+ import { useMemo as useMemo8, useState as useState10 } from "react";
5
5
 
6
6
  // ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
7
7
  function r(e) {
@@ -43,6 +43,10 @@ function getDmTableClasses({ className }) {
43
43
  return cn(dmTableBaseClass, className);
44
44
  }
45
45
 
46
+ // src/components/button/Button.tsx
47
+ import React from "react";
48
+ import { createPortal } from "react-dom";
49
+
46
50
  // src/classes/button.ts
47
51
  var buttonBaseClass = "btn";
48
52
  var buttonColorClasses = {
@@ -66,7 +70,7 @@ var buttonAppearanceClasses = {
66
70
  };
67
71
  var buttonShapeClasses = {
68
72
  rect: "",
69
- circle: "btn-circle",
73
+ circle: "btn-circle btn-icon",
70
74
  square: "btn-square"
71
75
  };
72
76
  var buttonSizeClasses = {
@@ -86,11 +90,14 @@ function getButtonClasses({
86
90
  isLoading,
87
91
  className
88
92
  }) {
89
- return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
93
+ return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], shape === "circle" && size === "xs" && "btn-icon-sm", shape === "circle" && size === "sm" && "btn-icon-sm", shape === "circle" && size === "lg" && "btn-icon-lg", block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
90
94
  }
91
95
 
92
96
  // src/components/button/Button.tsx
93
- import { jsx, jsxs } from "react/jsx-runtime";
97
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
98
+ function isPromiseLike(value) {
99
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
100
+ }
94
101
  function Button({
95
102
  color = "primary",
96
103
  appearance = "filled",
@@ -104,8 +111,155 @@ function Button({
104
111
  children,
105
112
  disabled,
106
113
  ref,
114
+ confirm,
115
+ onClick,
107
116
  ...props
108
117
  }) {
118
+ const buttonRef = React.useRef(null);
119
+ const popoverRef = React.useRef(null);
120
+ const cancelRef = React.useRef(null);
121
+ const approvalRef = React.useRef("idle");
122
+ const pendingRef = React.useRef(false);
123
+ const actionRef = React.useRef(0);
124
+ const operationRef = React.useRef(0);
125
+ const mountedRef = React.useRef(false);
126
+ const [portalTarget, setPortalTarget] = React.useState(null);
127
+ const [confirmLoading, setConfirmLoading] = React.useState(false);
128
+ const [confirmError, setConfirmError] = React.useState(false);
129
+ const generatedId = React.useId().replace(/:/g, "");
130
+ const popoverId = `button-confirm-${generatedId}`;
131
+ const titleId = `${popoverId}-title`;
132
+ const descriptionId = `${popoverId}-description`;
133
+ const anchor = `--${popoverId}-anchor`;
134
+ const hasConfirm = Boolean(confirm);
135
+ const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
136
+ const title = confirmation ? confirmation.title : "Confirm action";
137
+ const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
138
+ const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
139
+ const hasContent = content !== undefined && content !== null && content !== false && content !== "";
140
+ const mergedRef = React.useCallback((node) => {
141
+ buttonRef.current = node;
142
+ if (!node) {
143
+ if (typeof ref === "function")
144
+ ref(null);
145
+ else if (ref)
146
+ ref.current = null;
147
+ return;
148
+ }
149
+ const cleanup = typeof ref === "function" ? ref(node) : undefined;
150
+ if (ref && typeof ref !== "function")
151
+ ref.current = node;
152
+ return () => {
153
+ buttonRef.current = null;
154
+ if (typeof cleanup === "function")
155
+ cleanup();
156
+ else if (typeof ref === "function")
157
+ ref(null);
158
+ else if (ref)
159
+ ref.current = null;
160
+ };
161
+ }, [ref]);
162
+ React.useEffect(() => {
163
+ mountedRef.current = true;
164
+ return () => {
165
+ mountedRef.current = false;
166
+ operationRef.current += 1;
167
+ };
168
+ }, []);
169
+ React.useEffect(() => {
170
+ operationRef.current += 1;
171
+ approvalRef.current = "idle";
172
+ setConfirmError(false);
173
+ setPortalTarget(hasConfirm ? document.body : null);
174
+ }, [hasConfirm]);
175
+ function closePopover() {
176
+ if (popoverRef.current?.matches(":popover-open")) {
177
+ popoverRef.current.hidePopover();
178
+ }
179
+ buttonRef.current?.focus();
180
+ }
181
+ function handleClick(event) {
182
+ if (!confirm) {
183
+ onClick?.(event);
184
+ return;
185
+ }
186
+ if (approvalRef.current === "native") {
187
+ approvalRef.current = "idle";
188
+ return;
189
+ }
190
+ if (approvalRef.current === "action") {
191
+ approvalRef.current = "idle";
192
+ let result;
193
+ try {
194
+ result = onClick?.(event);
195
+ } catch {
196
+ event.preventDefault();
197
+ pendingRef.current = false;
198
+ setConfirmError(true);
199
+ return;
200
+ }
201
+ if (!isPromiseLike(result)) {
202
+ pendingRef.current = false;
203
+ closePopover();
204
+ return;
205
+ }
206
+ const userPreventedDefault = event.defaultPrevented;
207
+ event.preventDefault();
208
+ setConfirmLoading(true);
209
+ const action = actionRef.current;
210
+ const operation = operationRef.current;
211
+ Promise.resolve(result).then(() => {
212
+ if (!mountedRef.current || action !== actionRef.current)
213
+ return;
214
+ pendingRef.current = false;
215
+ setConfirmLoading(false);
216
+ if (operation !== operationRef.current)
217
+ return;
218
+ closePopover();
219
+ if (!userPreventedDefault && !buttonRef.current?.disabled) {
220
+ approvalRef.current = "native";
221
+ buttonRef.current?.click();
222
+ approvalRef.current = "idle";
223
+ }
224
+ }, () => {
225
+ if (!mountedRef.current || action !== actionRef.current)
226
+ return;
227
+ pendingRef.current = false;
228
+ setConfirmLoading(false);
229
+ if (operation !== operationRef.current)
230
+ return;
231
+ setConfirmError(true);
232
+ cancelRef.current?.focus();
233
+ });
234
+ return;
235
+ }
236
+ event.preventDefault();
237
+ if (disabled || isLoading || pendingRef.current)
238
+ return;
239
+ if (popoverRef.current?.matches(":popover-open")) {
240
+ closePopover();
241
+ return;
242
+ }
243
+ setConfirmError(false);
244
+ popoverRef.current?.showPopover();
245
+ cancelRef.current?.focus();
246
+ }
247
+ function handleConfirm(event) {
248
+ event.preventDefault();
249
+ event.stopPropagation();
250
+ const trigger = buttonRef.current;
251
+ if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
252
+ return;
253
+ setConfirmError(false);
254
+ pendingRef.current = true;
255
+ actionRef.current += 1;
256
+ approvalRef.current = "action";
257
+ trigger.click();
258
+ if (approvalRef.current === "action") {
259
+ approvalRef.current = "idle";
260
+ pendingRef.current = false;
261
+ }
262
+ }
109
263
  const classes = getButtonClasses({
110
264
  color,
111
265
  appearance,
@@ -115,29 +269,104 @@ function Button({
115
269
  isLoading,
116
270
  className
117
271
  });
118
- return /* @__PURE__ */ jsxs("button", {
119
- ref,
120
- className: classes,
121
- disabled: disabled || isLoading,
122
- "aria-busy": isLoading,
123
- "aria-disabled": disabled || isLoading,
124
- ...props,
272
+ const confirmClasses = getButtonClasses({
273
+ color,
274
+ size: "sm",
275
+ isLoading: confirmLoading
276
+ });
277
+ return /* @__PURE__ */ jsxs(Fragment, {
125
278
  children: [
126
- isLoading && /* @__PURE__ */ jsx("span", {
127
- className: "btn-spinner"
128
- }),
129
- !isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
130
- className: "btn-icon-left",
131
- children: leftIcon
132
- }),
133
- /* @__PURE__ */ jsx("span", {
134
- className: "btn-content",
135
- children
279
+ /* @__PURE__ */ jsxs("button", {
280
+ ref: confirm ? mergedRef : ref,
281
+ className: classes,
282
+ disabled: disabled || isLoading,
283
+ "aria-busy": isLoading,
284
+ "aria-disabled": disabled || isLoading,
285
+ ...props,
286
+ style: confirm ? { ...props.style, anchorName: anchor } : props.style,
287
+ "aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
288
+ "aria-controls": confirm ? popoverId : props["aria-controls"],
289
+ onClick: confirm ? handleClick : onClick,
290
+ children: [
291
+ isLoading && /* @__PURE__ */ jsx("span", {
292
+ className: "btn-spinner"
293
+ }),
294
+ !isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
295
+ className: "btn-icon-left",
296
+ children: leftIcon
297
+ }),
298
+ /* @__PURE__ */ jsx("span", {
299
+ className: "btn-content",
300
+ children
301
+ }),
302
+ !isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
303
+ className: "btn-icon-right",
304
+ children: rightIcon
305
+ })
306
+ ]
136
307
  }),
137
- !isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
138
- className: "btn-icon-right",
139
- children: rightIcon
140
- })
308
+ confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs("form", {
309
+ id: popoverId,
310
+ ref: popoverRef,
311
+ popover: "auto",
312
+ role: "dialog",
313
+ "aria-labelledby": hasTitle ? titleId : undefined,
314
+ "aria-label": hasTitle ? undefined : "Confirm action",
315
+ "aria-describedby": hasContent ? descriptionId : undefined,
316
+ className: "popover popover-confirm popover-bottom",
317
+ style: { positionAnchor: anchor },
318
+ onSubmit: handleConfirm,
319
+ onClick: (event) => event.stopPropagation(),
320
+ onToggle: (event) => {
321
+ if (!event.currentTarget.matches(":popover-open")) {
322
+ operationRef.current += 1;
323
+ if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
324
+ buttonRef.current?.focus();
325
+ }
326
+ }
327
+ },
328
+ children: [
329
+ hasTitle && /* @__PURE__ */ jsx("div", {
330
+ className: "popover-header",
331
+ children: /* @__PURE__ */ jsx("h3", {
332
+ id: titleId,
333
+ className: "popover-title",
334
+ children: title
335
+ })
336
+ }),
337
+ hasContent && /* @__PURE__ */ jsx("div", {
338
+ id: descriptionId,
339
+ className: "popover-body",
340
+ children: content
341
+ }),
342
+ confirmError && /* @__PURE__ */ jsx("div", {
343
+ role: "alert",
344
+ className: "popover-body",
345
+ children: "The action failed. Please try again."
346
+ }),
347
+ /* @__PURE__ */ jsxs("div", {
348
+ className: "popover-footer",
349
+ children: [
350
+ /* @__PURE__ */ jsx("button", {
351
+ ref: cancelRef,
352
+ type: "button",
353
+ className: "btn btn-text btn-sm",
354
+ popoverTarget: popoverId,
355
+ popoverTargetAction: "hide",
356
+ disabled: confirmLoading,
357
+ children: confirmation?.cancelText ?? "Cancel"
358
+ }),
359
+ /* @__PURE__ */ jsx("button", {
360
+ type: "submit",
361
+ className: confirmClasses,
362
+ disabled: disabled || isLoading || confirmLoading,
363
+ "aria-busy": confirmLoading,
364
+ children: confirmation?.confirmText ?? "Confirm"
365
+ })
366
+ ]
367
+ })
368
+ ]
369
+ }), portalTarget)
141
370
  ]
142
371
  });
143
372
  }
@@ -625,11 +854,11 @@ var DmPagination = forwardRef2(({
625
854
  DmPagination.displayName = "DmPagination";
626
855
  // src/components/dm-search/DmSearch.tsx
627
856
  import {
628
- forwardRef as forwardRef6,
629
- useEffect as useEffect2,
630
- useImperativeHandle as useImperativeHandle2,
631
- useMemo as useMemo5,
632
- useState as useState6
857
+ forwardRef as forwardRef7,
858
+ useEffect as useEffect3,
859
+ useImperativeHandle as useImperativeHandle3,
860
+ useMemo as useMemo6,
861
+ useState as useState8
633
862
  } from "react";
634
863
 
635
864
  // src/classes/dm-search.ts
@@ -649,8 +878,425 @@ function getDmSearchClasses({
649
878
  }
650
879
 
651
880
  // src/components/date-picker/DatePicker.tsx
881
+ import { forwardRef as forwardRef4, useMemo as useMemo4, useState as useState5 } from "react";
882
+
883
+ // src/components/calendar/Calendar.tsx
652
884
  import { forwardRef as forwardRef3, useMemo as useMemo3, useState as useState3 } from "react";
653
885
 
886
+ // src/classes/calendar.ts
887
+ var calendarBaseClass = "datepicker calendar";
888
+ var calendarHeaderClass = "calendar-header";
889
+ var calendarTitleClass = "calendar-title";
890
+ var calendarControlsClass = "calendar-controls";
891
+ var calendarNavClass = "calendar-nav";
892
+ var calendarModeClass = "calendar-mode";
893
+ var calendarWeekdaysClass = "calendar-weekdays";
894
+ var calendarWeekdayClass = "calendar-weekday";
895
+ var calendarBodyClass = "calendar-body";
896
+ var calendarDateGridClass = "calendar-date-grid";
897
+ var calendarMonthGridClass = "calendar-month-grid";
898
+ var calendarCellContentClass = "calendar-cell-content";
899
+ function getCalendarClasses({
900
+ fullscreen = true,
901
+ mode = "month",
902
+ className
903
+ }) {
904
+ return cn(calendarBaseClass, fullscreen ? "calendar-fullscreen" : "calendar-card", mode === "year" && "calendar-year-mode", className);
905
+ }
906
+ function getCalendarCellClasses({
907
+ selected,
908
+ today,
909
+ outside,
910
+ disabled,
911
+ className
912
+ }) {
913
+ return cn("calendar-cell", selected && "calendar-cell-selected", today && "calendar-cell-today", outside && "calendar-cell-outside", disabled && "calendar-cell-disabled", className);
914
+ }
915
+
916
+ // src/components/calendar/Calendar.tsx
917
+ import { jsx as jsx5, jsxs as jsxs4, Fragment as Fragment2 } from "react/jsx-runtime";
918
+ var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
919
+ var MONTHS = [
920
+ "Jan",
921
+ "Feb",
922
+ "Mar",
923
+ "Apr",
924
+ "May",
925
+ "Jun",
926
+ "Jul",
927
+ "Aug",
928
+ "Sep",
929
+ "Oct",
930
+ "Nov",
931
+ "Dec"
932
+ ];
933
+ function pad(value) {
934
+ return String(value).padStart(2, "0");
935
+ }
936
+ function formatDate(date) {
937
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
938
+ }
939
+ function formatMonth(date) {
940
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-01`;
941
+ }
942
+ function parseDate(value) {
943
+ if (value instanceof Date && !Number.isNaN(value.getTime())) {
944
+ return new Date(value.getFullYear(), value.getMonth(), value.getDate());
945
+ }
946
+ if (typeof value === "string" && value.length > 0) {
947
+ const [year, month = "1", day = "1"] = value.split("-");
948
+ const parsed = new Date(Number(year), Number(month) - 1, Number(day));
949
+ if (!Number.isNaN(parsed.getTime())) {
950
+ return parsed;
951
+ }
952
+ }
953
+ const today = new Date;
954
+ return new Date(today.getFullYear(), today.getMonth(), today.getDate());
955
+ }
956
+ function addMonths(date, amount) {
957
+ return new Date(date.getFullYear(), date.getMonth() + amount, 1);
958
+ }
959
+ function addYears(date, amount) {
960
+ return new Date(date.getFullYear() + amount, date.getMonth(), 1);
961
+ }
962
+ function startOfCalendarGrid(panelDate) {
963
+ const firstOfMonth = new Date(panelDate.getFullYear(), panelDate.getMonth(), 1);
964
+ const start = new Date(firstOfMonth);
965
+ start.setDate(firstOfMonth.getDate() - firstOfMonth.getDay());
966
+ return start;
967
+ }
968
+ function buildDateGrid(panelDate) {
969
+ const start = startOfCalendarGrid(panelDate);
970
+ return Array.from({ length: 42 }, (_, index) => {
971
+ const date = new Date(start);
972
+ date.setDate(start.getDate() + index);
973
+ return date;
974
+ });
975
+ }
976
+ function isSameMonth(left, right) {
977
+ return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
978
+ }
979
+ function isOutsideRange(date, validRange) {
980
+ if (!validRange) {
981
+ return false;
982
+ }
983
+ const current = formatDate(date);
984
+ const start = formatDate(parseDate(validRange[0]));
985
+ const end = formatDate(parseDate(validRange[1]));
986
+ return current < start || current > end;
987
+ }
988
+ function Header({
989
+ panelDate,
990
+ mode,
991
+ setPanelDate,
992
+ setMode
993
+ }) {
994
+ const title = mode === "year" ? String(panelDate.getFullYear()) : `${MONTHS[panelDate.getMonth()]} ${panelDate.getFullYear()}`;
995
+ return /* @__PURE__ */ jsxs4("div", {
996
+ className: calendarHeaderClass,
997
+ children: [
998
+ /* @__PURE__ */ jsx5("button", {
999
+ type: "button",
1000
+ className: calendarNavClass,
1001
+ "aria-label": "Previous panel",
1002
+ onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, -1) : addMonths(panelDate, -1), mode),
1003
+ children: /* @__PURE__ */ jsx5("svg", {
1004
+ "aria-hidden": "true",
1005
+ focusable: "false",
1006
+ width: "16",
1007
+ height: "16",
1008
+ viewBox: "0 0 24 24",
1009
+ fill: "none",
1010
+ stroke: "currentColor",
1011
+ strokeWidth: "2",
1012
+ strokeLinecap: "round",
1013
+ strokeLinejoin: "round",
1014
+ children: /* @__PURE__ */ jsx5("path", {
1015
+ d: "m15 18-6-6 6-6"
1016
+ })
1017
+ })
1018
+ }),
1019
+ /* @__PURE__ */ jsxs4("div", {
1020
+ className: calendarControlsClass,
1021
+ children: [
1022
+ /* @__PURE__ */ jsx5("div", {
1023
+ className: calendarTitleClass,
1024
+ children: title
1025
+ }),
1026
+ /* @__PURE__ */ jsxs4("div", {
1027
+ className: calendarModeClass,
1028
+ children: [
1029
+ /* @__PURE__ */ jsx5("button", {
1030
+ type: "button",
1031
+ "aria-pressed": mode === "month",
1032
+ onClick: () => setMode("month"),
1033
+ children: "Month"
1034
+ }),
1035
+ /* @__PURE__ */ jsx5("button", {
1036
+ type: "button",
1037
+ "aria-pressed": mode === "year",
1038
+ onClick: () => setMode("year"),
1039
+ children: "Year"
1040
+ })
1041
+ ]
1042
+ })
1043
+ ]
1044
+ }),
1045
+ /* @__PURE__ */ jsx5("button", {
1046
+ type: "button",
1047
+ className: calendarNavClass,
1048
+ "aria-label": "Next panel",
1049
+ onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, 1) : addMonths(panelDate, 1), mode),
1050
+ children: /* @__PURE__ */ jsx5("svg", {
1051
+ "aria-hidden": "true",
1052
+ focusable: "false",
1053
+ width: "16",
1054
+ height: "16",
1055
+ viewBox: "0 0 24 24",
1056
+ fill: "none",
1057
+ stroke: "currentColor",
1058
+ strokeWidth: "2",
1059
+ strokeLinecap: "round",
1060
+ strokeLinejoin: "round",
1061
+ children: /* @__PURE__ */ jsx5("path", {
1062
+ d: "m9 18 6-6-6-6"
1063
+ })
1064
+ })
1065
+ })
1066
+ ]
1067
+ });
1068
+ }
1069
+ var Calendar = forwardRef3(({
1070
+ className,
1071
+ value,
1072
+ defaultValue,
1073
+ mode,
1074
+ defaultMode = "month",
1075
+ fullscreen = true,
1076
+ validRange,
1077
+ disabledDate,
1078
+ dateCellRender,
1079
+ dateFullCellRender,
1080
+ monthCellRender,
1081
+ monthFullCellRender,
1082
+ cellRender,
1083
+ fullCellRender,
1084
+ headerRender,
1085
+ onChange,
1086
+ onSelect,
1087
+ onPanelChange,
1088
+ ...props
1089
+ }, ref) => {
1090
+ const selectedDate = parseDate(value ?? defaultValue);
1091
+ const [innerValue, setInnerValue] = useState3(() => formatDate(selectedDate));
1092
+ const [panelDate, setInnerPanelDate] = useState3(selectedDate);
1093
+ const [innerMode, setInnerMode] = useState3(mode ?? defaultMode);
1094
+ const currentMode = mode ?? innerMode;
1095
+ const currentValue = value === undefined ? innerValue : formatDate(parseDate(value));
1096
+ const today = useMemo3(() => formatDate(new Date), []);
1097
+ const dateGrid = useMemo3(() => buildDateGrid(panelDate), [panelDate]);
1098
+ function emitPanelChange(nextDate, nextMode = currentMode) {
1099
+ setInnerPanelDate(nextDate);
1100
+ onPanelChange?.(formatDate(nextDate), nextMode);
1101
+ }
1102
+ function setCalendarMode(nextMode) {
1103
+ if (mode === undefined) {
1104
+ setInnerMode(nextMode);
1105
+ }
1106
+ onPanelChange?.(formatDate(panelDate), nextMode);
1107
+ }
1108
+ function commitValue(nextDate, source) {
1109
+ const nextValue = source === "month" ? formatMonth(nextDate) : formatDate(nextDate);
1110
+ if (disabledDate?.(nextValue) || isOutsideRange(nextDate, validRange)) {
1111
+ return;
1112
+ }
1113
+ if (value === undefined) {
1114
+ setInnerValue(nextValue);
1115
+ }
1116
+ setInnerPanelDate(nextDate);
1117
+ onSelect?.(nextValue, { source });
1118
+ onChange?.(nextValue);
1119
+ }
1120
+ function renderDateCell(date) {
1121
+ const dateValue = formatDate(date);
1122
+ const originNode = /* @__PURE__ */ jsxs4("div", {
1123
+ className: calendarCellContentClass,
1124
+ children: [
1125
+ /* @__PURE__ */ jsx5("span", {
1126
+ children: date.getDate()
1127
+ }),
1128
+ dateCellRender?.(dateValue)
1129
+ ]
1130
+ });
1131
+ const info = {
1132
+ originNode,
1133
+ today,
1134
+ type: "month"
1135
+ };
1136
+ const content = fullCellRender?.(dateValue, info) ?? dateFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
1137
+ const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
1138
+ return /* @__PURE__ */ jsx5("button", {
1139
+ type: "button",
1140
+ "aria-label": dateValue,
1141
+ disabled,
1142
+ className: getCalendarCellClasses({
1143
+ selected: dateValue === currentValue,
1144
+ today: dateValue === today,
1145
+ outside: !isSameMonth(date, panelDate),
1146
+ disabled
1147
+ }),
1148
+ onClick: () => commitValue(date, "date"),
1149
+ children: content
1150
+ }, dateValue);
1151
+ }
1152
+ function renderMonthCell(month) {
1153
+ const date = new Date(panelDate.getFullYear(), month, 1);
1154
+ const dateValue = formatMonth(date);
1155
+ const originNode = /* @__PURE__ */ jsxs4("div", {
1156
+ className: calendarCellContentClass,
1157
+ children: [
1158
+ /* @__PURE__ */ jsx5("span", {
1159
+ children: MONTHS[month]
1160
+ }),
1161
+ monthCellRender?.(dateValue)
1162
+ ]
1163
+ });
1164
+ const info = {
1165
+ originNode,
1166
+ today,
1167
+ type: "year"
1168
+ };
1169
+ const content = fullCellRender?.(dateValue, info) ?? monthFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
1170
+ const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
1171
+ return /* @__PURE__ */ jsx5("button", {
1172
+ type: "button",
1173
+ "aria-label": dateValue,
1174
+ disabled,
1175
+ className: getCalendarCellClasses({
1176
+ selected: dateValue === formatMonth(parseDate(currentValue)),
1177
+ today: dateValue === formatMonth(new Date),
1178
+ disabled
1179
+ }),
1180
+ onClick: () => commitValue(date, "month"),
1181
+ children: content
1182
+ }, dateValue);
1183
+ }
1184
+ return /* @__PURE__ */ jsxs4("div", {
1185
+ ...props,
1186
+ ref,
1187
+ className: getCalendarClasses({
1188
+ fullscreen,
1189
+ mode: currentMode,
1190
+ className
1191
+ }),
1192
+ children: [
1193
+ headerRender ? headerRender({
1194
+ value: formatDate(panelDate),
1195
+ type: currentMode,
1196
+ onChange: (nextValue) => emitPanelChange(parseDate(nextValue)),
1197
+ onTypeChange: setCalendarMode
1198
+ }) : /* @__PURE__ */ jsx5(Header, {
1199
+ panelDate,
1200
+ mode: currentMode,
1201
+ setPanelDate: emitPanelChange,
1202
+ setMode: setCalendarMode
1203
+ }),
1204
+ /* @__PURE__ */ jsx5("div", {
1205
+ className: calendarBodyClass,
1206
+ children: currentMode === "month" ? /* @__PURE__ */ jsxs4(Fragment2, {
1207
+ children: [
1208
+ /* @__PURE__ */ jsx5("div", {
1209
+ className: calendarWeekdaysClass,
1210
+ "aria-hidden": "true",
1211
+ children: WEEKDAYS.map((weekday) => /* @__PURE__ */ jsx5("span", {
1212
+ className: calendarWeekdayClass,
1213
+ children: weekday
1214
+ }, weekday))
1215
+ }),
1216
+ /* @__PURE__ */ jsx5("div", {
1217
+ className: calendarDateGridClass,
1218
+ children: dateGrid.map(renderDateCell)
1219
+ })
1220
+ ]
1221
+ }) : /* @__PURE__ */ jsx5("div", {
1222
+ className: calendarMonthGridClass,
1223
+ children: MONTHS.map((_, month) => renderMonthCell(month))
1224
+ })
1225
+ })
1226
+ ]
1227
+ });
1228
+ });
1229
+ Calendar.displayName = "Calendar";
1230
+ // src/components/date-picker/usePickerDropdown.ts
1231
+ import { useEffect as useEffect2, useId, useImperativeHandle, useRef as useRef2, useState as useState4 } from "react";
1232
+ function usePickerDropdown({
1233
+ open,
1234
+ defaultOpen,
1235
+ disabled,
1236
+ onOpenChange,
1237
+ ref
1238
+ }) {
1239
+ const rootRef = useRef2(null);
1240
+ const inputRef = useRef2(null);
1241
+ const skipFocus = useRef2(false);
1242
+ const panelId = useId();
1243
+ const [innerOpen, setInnerOpen] = useState4(Boolean(defaultOpen));
1244
+ const visible = !disabled && (open ?? innerOpen);
1245
+ useImperativeHandle(ref, () => rootRef.current, []);
1246
+ function setVisible(next) {
1247
+ if (disabled || next === visible)
1248
+ return;
1249
+ if (open === undefined)
1250
+ setInnerOpen(next);
1251
+ onOpenChange?.(next);
1252
+ }
1253
+ function closeAndFocus() {
1254
+ skipFocus.current = true;
1255
+ inputRef.current?.focus();
1256
+ skipFocus.current = false;
1257
+ setVisible(false);
1258
+ }
1259
+ useEffect2(() => {
1260
+ function handleOutside(event) {
1261
+ if (visible && !rootRef.current?.contains(event.target))
1262
+ setVisible(false);
1263
+ }
1264
+ function handleKeyDown(event) {
1265
+ if (event.defaultPrevented || !rootRef.current?.contains(event.target))
1266
+ return;
1267
+ if (event.key === "Escape" && visible) {
1268
+ event.preventDefault();
1269
+ closeAndFocus();
1270
+ } else if (event.key === "ArrowDown" && event.target === inputRef.current) {
1271
+ event.preventDefault();
1272
+ setVisible(true);
1273
+ }
1274
+ }
1275
+ document.addEventListener("pointerdown", handleOutside);
1276
+ document.addEventListener("keydown", handleKeyDown);
1277
+ return () => {
1278
+ document.removeEventListener("pointerdown", handleOutside);
1279
+ document.removeEventListener("keydown", handleKeyDown);
1280
+ };
1281
+ });
1282
+ return {
1283
+ rootRef,
1284
+ inputRef,
1285
+ panelId,
1286
+ visible,
1287
+ setVisible,
1288
+ closeAndFocus,
1289
+ onInputFocus: () => {
1290
+ if (!skipFocus.current)
1291
+ setVisible(true);
1292
+ },
1293
+ onRootBlur: (event) => {
1294
+ if (!event.currentTarget.contains(event.relatedTarget))
1295
+ setVisible(false);
1296
+ }
1297
+ };
1298
+ }
1299
+
654
1300
  // src/classes/date-picker.ts
655
1301
  var datePickerBaseClass = "datepicker";
656
1302
  var datePickerInputClass = "datepicker-input";
@@ -698,7 +1344,7 @@ function getDatePickerDropdownClasses({
698
1344
  }
699
1345
 
700
1346
  // src/components/date-picker/DatePicker.tsx
701
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1347
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
702
1348
  function todayValue(picker) {
703
1349
  const today = new Date;
704
1350
  const year = today.getFullYear();
@@ -737,9 +1383,10 @@ function placeholderForPicker(picker) {
737
1383
  function normalizeDateValue(value) {
738
1384
  return typeof value === "string" && value.length > 0 ? value : undefined;
739
1385
  }
740
- var DatePickerRoot = forwardRef3(({
1386
+ var DatePickerRoot = forwardRef4(({
741
1387
  allowClear,
742
1388
  className,
1389
+ inputProps,
743
1390
  defaultOpen,
744
1391
  defaultValue,
745
1392
  disabled,
@@ -758,19 +1405,19 @@ var DatePickerRoot = forwardRef3(({
758
1405
  value,
759
1406
  ...props
760
1407
  }, ref) => {
1408
+ const [calendarMode, setCalendarMode] = useState5("month");
761
1409
  const isValueControlled = value !== undefined;
762
- const isOpenControlled = open !== undefined;
763
- const [innerValue, setInnerValue] = useState3(() => normalizeDateValue(defaultValue));
764
- const [innerOpen, setInnerOpen] = useState3(Boolean(defaultOpen));
1410
+ const [innerValue, setInnerValue] = useState5(() => normalizeDateValue(defaultValue));
1411
+ const dropdown = usePickerDropdown({
1412
+ open,
1413
+ defaultOpen,
1414
+ disabled,
1415
+ onOpenChange,
1416
+ ref
1417
+ });
765
1418
  const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
766
- const visible = isOpenControlled ? Boolean(open) : innerOpen;
1419
+ const { visible, setVisible } = dropdown;
767
1420
  const inputType = inputTypeForPicker(picker);
768
- function setVisible(nextOpen) {
769
- if (!isOpenControlled) {
770
- setInnerOpen(nextOpen);
771
- }
772
- onOpenChange?.(nextOpen);
773
- }
774
1421
  function emitChange(nextValue) {
775
1422
  if (nextValue && disabledDate?.(nextValue)) {
776
1423
  return;
@@ -780,10 +1427,17 @@ var DatePickerRoot = forwardRef3(({
780
1427
  }
781
1428
  onChange?.(nextValue, nextValue ?? "");
782
1429
  }
783
- const presetItems = useMemo3(() => presets ?? [], [presets]);
784
- return /* @__PURE__ */ jsxs4("div", {
1430
+ function selectValue(nextValue) {
1431
+ if (disabledDate?.(nextValue))
1432
+ return;
1433
+ emitChange(nextValue);
1434
+ dropdown.closeAndFocus();
1435
+ }
1436
+ const presetItems = useMemo4(() => presets ?? [], [presets]);
1437
+ return /* @__PURE__ */ jsxs5("div", {
785
1438
  ...props,
786
- ref,
1439
+ ref: dropdown.rootRef,
1440
+ onBlur: dropdown.onRootBlur,
787
1441
  className: getDatePickerClasses({
788
1442
  size,
789
1443
  status,
@@ -793,7 +1447,11 @@ var DatePickerRoot = forwardRef3(({
793
1447
  className
794
1448
  }),
795
1449
  children: [
796
- /* @__PURE__ */ jsx5("input", {
1450
+ /* @__PURE__ */ jsx6("input", {
1451
+ ...inputProps,
1452
+ ref: dropdown.inputRef,
1453
+ "aria-haspopup": "dialog",
1454
+ "aria-controls": visible ? dropdown.panelId : undefined,
797
1455
  className: datePickerInputClass,
798
1456
  disabled,
799
1457
  type: inputType,
@@ -801,15 +1459,15 @@ var DatePickerRoot = forwardRef3(({
801
1459
  placeholder: placeholder ?? placeholderForPicker(picker),
802
1460
  onFocus: (event) => {
803
1461
  onFocus?.(event);
804
- setVisible(true);
1462
+ dropdown.onInputFocus();
805
1463
  },
806
1464
  onBlur: (event) => {
807
1465
  onBlur?.(event);
808
- setVisible(false);
809
1466
  },
1467
+ onClick: () => setVisible(true),
810
1468
  onChange: (event) => emitChange(event.currentTarget.value || undefined)
811
1469
  }),
812
- allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx5("button", {
1470
+ allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx6("button", {
813
1471
  type: "button",
814
1472
  className: datePickerClearClass,
815
1473
  "aria-label": "Clear date",
@@ -817,26 +1475,95 @@ var DatePickerRoot = forwardRef3(({
817
1475
  onClick: () => emitChange(undefined),
818
1476
  children: "x"
819
1477
  }) : null,
820
- /* @__PURE__ */ jsx5("span", {
1478
+ /* @__PURE__ */ jsx6("button", {
1479
+ type: "button",
821
1480
  className: datePickerIconClass,
822
- "aria-hidden": "true"
1481
+ "aria-label": "Open date picker",
1482
+ "aria-haspopup": "dialog",
1483
+ "aria-expanded": visible,
1484
+ "aria-controls": visible ? dropdown.panelId : undefined,
1485
+ disabled,
1486
+ onMouseDown: (event) => event.preventDefault(),
1487
+ onClick: () => setVisible(!visible),
1488
+ children: /* @__PURE__ */ jsxs5("svg", {
1489
+ "aria-hidden": "true",
1490
+ focusable: "false",
1491
+ width: "18",
1492
+ height: "18",
1493
+ viewBox: "0 0 24 24",
1494
+ fill: "none",
1495
+ stroke: "currentColor",
1496
+ strokeWidth: "1.75",
1497
+ strokeLinecap: "round",
1498
+ strokeLinejoin: "round",
1499
+ children: [
1500
+ /* @__PURE__ */ jsx6("rect", {
1501
+ x: "3",
1502
+ y: "5",
1503
+ width: "18",
1504
+ height: "16",
1505
+ rx: "2"
1506
+ }),
1507
+ /* @__PURE__ */ jsx6("path", {
1508
+ d: "M8 3v4M16 3v4M3 10h18"
1509
+ })
1510
+ ]
1511
+ })
823
1512
  }),
824
- (presetItems.length > 0 || showNow) && visible ? /* @__PURE__ */ jsxs4("div", {
1513
+ visible ? /* @__PURE__ */ jsxs5("div", {
1514
+ id: dropdown.panelId,
1515
+ role: "dialog",
1516
+ "aria-label": "Choose date",
825
1517
  className: getDatePickerDropdownClasses({ open: visible }),
826
1518
  children: [
827
- presetItems.map((preset, index) => /* @__PURE__ */ jsx5("button", {
1519
+ picker === "date" || picker === "month" ? /* @__PURE__ */ jsx6(Calendar, {
1520
+ fullscreen: false,
1521
+ value: currentValue,
1522
+ mode: picker === "month" ? "year" : calendarMode,
1523
+ onPanelChange: (_, mode) => {
1524
+ if (picker === "date")
1525
+ setCalendarMode(mode);
1526
+ },
1527
+ disabledDate: (date) => {
1528
+ if (!disabledDate)
1529
+ return false;
1530
+ if (picker === "month")
1531
+ return disabledDate(date.slice(0, 7));
1532
+ if (calendarMode === "year") {
1533
+ const [year, month] = date.split("-").map(Number);
1534
+ const days = new Date(year, month, 0).getDate();
1535
+ return Array.from({ length: days }, (_, index) => `${date.slice(0, 7)}-${String(index + 1).padStart(2, "0")}`).every((day) => disabledDate(day));
1536
+ }
1537
+ return disabledDate(date);
1538
+ },
1539
+ onSelect: (date, info) => {
1540
+ if (picker === "date" && info.source === "month") {
1541
+ setCalendarMode("month");
1542
+ return;
1543
+ }
1544
+ selectValue(picker === "month" ? date.slice(0, 7) : date);
1545
+ }
1546
+ }) : /* @__PURE__ */ jsx6("input", {
1547
+ type: inputType,
1548
+ "aria-label": placeholderForPicker(picker),
1549
+ value: currentValue ?? "",
1550
+ onChange: (event) => selectValue(event.currentTarget.value)
1551
+ }),
1552
+ presetItems.map((preset, index) => /* @__PURE__ */ jsx6("button", {
828
1553
  type: "button",
829
1554
  className: datePickerPresetClass,
830
1555
  onMouseDown: (event) => event.preventDefault(),
831
- onClick: () => emitChange(preset.value),
1556
+ disabled: Boolean(disabledDate?.(preset.value)),
1557
+ onClick: () => selectValue(preset.value),
832
1558
  children: preset.label
833
1559
  }, index)),
834
- showNow ? /* @__PURE__ */ jsx5("div", {
1560
+ showNow ? /* @__PURE__ */ jsx6("div", {
835
1561
  className: datePickerFooterClass,
836
- children: /* @__PURE__ */ jsx5("button", {
1562
+ children: /* @__PURE__ */ jsx6("button", {
837
1563
  type: "button",
838
1564
  onMouseDown: (event) => event.preventDefault(),
839
- onClick: () => emitChange(todayValue(picker)),
1565
+ disabled: Boolean(disabledDate?.(todayValue(picker))),
1566
+ onClick: () => selectValue(todayValue(picker)),
840
1567
  children: "Now"
841
1568
  })
842
1569
  }) : null
@@ -846,9 +1573,10 @@ var DatePickerRoot = forwardRef3(({
846
1573
  });
847
1574
  });
848
1575
  DatePickerRoot.displayName = "DatePicker";
849
- var RangePicker = forwardRef3(({
1576
+ var RangePicker = forwardRef4(({
850
1577
  allowClear,
851
1578
  className,
1579
+ inputProps,
852
1580
  defaultValue,
853
1581
  disabled,
854
1582
  disabledDate,
@@ -862,7 +1590,7 @@ var RangePicker = forwardRef3(({
862
1590
  ...props
863
1591
  }, ref) => {
864
1592
  const isControlled = value !== undefined;
865
- const [innerValue, setInnerValue] = useState3(defaultValue ?? [undefined, undefined]);
1593
+ const [innerValue, setInnerValue] = useState5(defaultValue ?? [undefined, undefined]);
866
1594
  const currentValue = isControlled ? value : innerValue;
867
1595
  const inputType = inputTypeForPicker(picker);
868
1596
  function emitChange(nextValue) {
@@ -877,7 +1605,7 @@ var RangePicker = forwardRef3(({
877
1605
  function updateIndex(index, nextItem) {
878
1606
  emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
879
1607
  }
880
- return /* @__PURE__ */ jsxs4("div", {
1608
+ return /* @__PURE__ */ jsxs5("div", {
881
1609
  ...props,
882
1610
  ref,
883
1611
  className: getDatePickerClasses({
@@ -889,7 +1617,8 @@ var RangePicker = forwardRef3(({
889
1617
  className
890
1618
  }),
891
1619
  children: [
892
- /* @__PURE__ */ jsx5("input", {
1620
+ /* @__PURE__ */ jsx6("input", {
1621
+ ...inputProps,
893
1622
  className: datePickerInputClass,
894
1623
  disabled,
895
1624
  type: inputType,
@@ -897,11 +1626,13 @@ var RangePicker = forwardRef3(({
897
1626
  placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
898
1627
  onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
899
1628
  }),
900
- /* @__PURE__ */ jsx5("span", {
1629
+ /* @__PURE__ */ jsx6("span", {
901
1630
  className: datePickerSeparatorClass,
902
1631
  children: separator
903
1632
  }),
904
- /* @__PURE__ */ jsx5("input", {
1633
+ /* @__PURE__ */ jsx6("input", {
1634
+ ...inputProps,
1635
+ id: inputProps?.id ? `${inputProps.id}-end` : undefined,
905
1636
  className: datePickerInputClass,
906
1637
  disabled,
907
1638
  type: inputType,
@@ -909,7 +1640,7 @@ var RangePicker = forwardRef3(({
909
1640
  placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
910
1641
  onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
911
1642
  }),
912
- allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx5("button", {
1643
+ allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx6("button", {
913
1644
  type: "button",
914
1645
  className: datePickerClearClass,
915
1646
  "aria-label": "Clear date range",
@@ -921,7 +1652,7 @@ var RangePicker = forwardRef3(({
921
1652
  });
922
1653
  RangePicker.displayName = "DatePicker.RangePicker";
923
1654
  function withPicker(picker, displayName) {
924
- const Picker = forwardRef3((props, ref) => /* @__PURE__ */ jsx5(DatePickerRoot, {
1655
+ const Picker = forwardRef4((props, ref) => /* @__PURE__ */ jsx6(DatePickerRoot, {
925
1656
  ...props,
926
1657
  ref,
927
1658
  picker
@@ -938,10 +1669,10 @@ var DatePicker = Object.assign(DatePickerRoot, {
938
1669
  });
939
1670
  // src/components/input/Input.tsx
940
1671
  import {
941
- forwardRef as forwardRef4,
942
- useImperativeHandle,
943
- useRef as useRef2,
944
- useState as useState4
1672
+ forwardRef as forwardRef5,
1673
+ useImperativeHandle as useImperativeHandle2,
1674
+ useRef as useRef3,
1675
+ useState as useState6
945
1676
  } from "react";
946
1677
 
947
1678
  // src/classes/input.ts
@@ -1030,14 +1761,14 @@ function getTextAreaCountClasses({ exceeded }) {
1030
1761
  }
1031
1762
 
1032
1763
  // src/components/input/Input.tsx
1033
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1764
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1034
1765
  function toTextValue(value) {
1035
1766
  if (Array.isArray(value)) {
1036
1767
  return value.join(",");
1037
1768
  }
1038
1769
  return value == null ? "" : String(value);
1039
1770
  }
1040
- var InputRoot = forwardRef4(({
1771
+ var InputRoot = forwardRef5(({
1041
1772
  allowClear,
1042
1773
  className,
1043
1774
  defaultValue,
@@ -1052,12 +1783,12 @@ var InputRoot = forwardRef4(({
1052
1783
  variant = "outlined",
1053
1784
  ...props
1054
1785
  }, ref) => {
1055
- const inputRef = useRef2(null);
1056
- const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
1786
+ const inputRef = useRef3(null);
1787
+ const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
1057
1788
  const isControlled = value !== undefined;
1058
1789
  const currentValue = isControlled ? toTextValue(value) : internalValue;
1059
1790
  const hasAffix = prefix != null || suffix != null || allowClear;
1060
- useImperativeHandle(ref, () => inputRef.current);
1791
+ useImperativeHandle2(ref, () => inputRef.current);
1061
1792
  function handleChange(event) {
1062
1793
  if (!isControlled) {
1063
1794
  setInternalValue(event.currentTarget.value);
@@ -1080,7 +1811,7 @@ var InputRoot = forwardRef4(({
1080
1811
  });
1081
1812
  input.focus();
1082
1813
  }
1083
- const control = /* @__PURE__ */ jsx6("input", {
1814
+ const control = /* @__PURE__ */ jsx7("input", {
1084
1815
  ...props,
1085
1816
  ref: inputRef,
1086
1817
  type,
@@ -1093,22 +1824,22 @@ var InputRoot = forwardRef4(({
1093
1824
  return control;
1094
1825
  }
1095
1826
  const showClear = allowClear && !disabled && currentValue.length > 0;
1096
- return /* @__PURE__ */ jsxs5("span", {
1827
+ return /* @__PURE__ */ jsxs6("span", {
1097
1828
  className: getInputWrapperClasses({ affixed: hasAffix }),
1098
1829
  children: [
1099
- prefix != null ? /* @__PURE__ */ jsx6("span", {
1830
+ prefix != null ? /* @__PURE__ */ jsx7("span", {
1100
1831
  className: inputPrefixClass,
1101
1832
  children: prefix
1102
1833
  }) : null,
1103
1834
  control,
1104
- showClear ? /* @__PURE__ */ jsx6("button", {
1835
+ showClear ? /* @__PURE__ */ jsx7("button", {
1105
1836
  type: "button",
1106
1837
  className: inputClearClass,
1107
1838
  "aria-label": "Clear input",
1108
1839
  onClick: handleClear,
1109
1840
  children: "x"
1110
1841
  }) : null,
1111
- suffix != null ? /* @__PURE__ */ jsx6("span", {
1842
+ suffix != null ? /* @__PURE__ */ jsx7("span", {
1112
1843
  className: inputSuffixClass,
1113
1844
  children: suffix
1114
1845
  }) : null
@@ -1116,7 +1847,7 @@ var InputRoot = forwardRef4(({
1116
1847
  });
1117
1848
  });
1118
1849
  InputRoot.displayName = "Input";
1119
- var Search = forwardRef4(({
1850
+ var Search = forwardRef5(({
1120
1851
  className,
1121
1852
  disabled,
1122
1853
  enterButton,
@@ -1125,8 +1856,8 @@ var Search = forwardRef4(({
1125
1856
  onSearch,
1126
1857
  ...props
1127
1858
  }, ref) => {
1128
- const inputRef = useRef2(null);
1129
- useImperativeHandle(ref, () => inputRef.current);
1859
+ const inputRef = useRef3(null);
1860
+ useImperativeHandle2(ref, () => inputRef.current);
1130
1861
  function emitSearch(event) {
1131
1862
  onSearch?.(inputRef.current?.value ?? "", event);
1132
1863
  }
@@ -1137,16 +1868,16 @@ var Search = forwardRef4(({
1137
1868
  }
1138
1869
  }
1139
1870
  const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
1140
- return /* @__PURE__ */ jsxs5("span", {
1871
+ return /* @__PURE__ */ jsxs6("span", {
1141
1872
  className: getSearchWrapperClasses({ className }),
1142
1873
  children: [
1143
- /* @__PURE__ */ jsx6(InputRoot, {
1874
+ /* @__PURE__ */ jsx7(InputRoot, {
1144
1875
  ...props,
1145
1876
  ref: inputRef,
1146
1877
  disabled,
1147
1878
  onKeyDown: handleKeyDown
1148
1879
  }),
1149
- enterButton || loading ? /* @__PURE__ */ jsx6("button", {
1880
+ enterButton || loading ? /* @__PURE__ */ jsx7("button", {
1150
1881
  type: "button",
1151
1882
  className: inputSearchButtonClass,
1152
1883
  disabled: disabled || loading,
@@ -1158,10 +1889,10 @@ var Search = forwardRef4(({
1158
1889
  });
1159
1890
  });
1160
1891
  Search.displayName = "Input.Search";
1161
- var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
1162
- const [visible, setVisible] = useState4(false);
1892
+ var Password = forwardRef5(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
1893
+ const [visible, setVisible] = useState6(false);
1163
1894
  const type = visible ? "text" : "password";
1164
- const toggle = visibilityToggle ? /* @__PURE__ */ jsx6("button", {
1895
+ const toggle = visibilityToggle ? /* @__PURE__ */ jsx7("button", {
1165
1896
  type: "button",
1166
1897
  className: inputPasswordToggleClass,
1167
1898
  disabled,
@@ -1171,9 +1902,9 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
1171
1902
  },
1172
1903
  children: visible ? "Hide" : "Show"
1173
1904
  }) : undefined;
1174
- return /* @__PURE__ */ jsx6("span", {
1905
+ return /* @__PURE__ */ jsx7("span", {
1175
1906
  className: getPasswordWrapperClasses({ className }),
1176
- children: /* @__PURE__ */ jsx6(InputRoot, {
1907
+ children: /* @__PURE__ */ jsx7(InputRoot, {
1177
1908
  ...props,
1178
1909
  ref,
1179
1910
  disabled,
@@ -1183,7 +1914,7 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
1183
1914
  });
1184
1915
  });
1185
1916
  Password.displayName = "Input.Password";
1186
- var TextArea = forwardRef4(({
1917
+ var TextArea = forwardRef5(({
1187
1918
  autoSize,
1188
1919
  className,
1189
1920
  defaultValue,
@@ -1197,7 +1928,7 @@ var TextArea = forwardRef4(({
1197
1928
  variant = "outlined",
1198
1929
  ...props
1199
1930
  }, ref) => {
1200
- const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
1931
+ const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
1201
1932
  const isControlled = value !== undefined;
1202
1933
  const currentValue = isControlled ? toTextValue(value) : internalValue;
1203
1934
  const count = currentValue.length;
@@ -1208,7 +1939,7 @@ var TextArea = forwardRef4(({
1208
1939
  }
1209
1940
  onChange?.(event);
1210
1941
  }
1211
- const control = /* @__PURE__ */ jsx6("textarea", {
1942
+ const control = /* @__PURE__ */ jsx7("textarea", {
1212
1943
  ...props,
1213
1944
  ref,
1214
1945
  className: getTextAreaClasses({
@@ -1226,11 +1957,11 @@ var TextArea = forwardRef4(({
1226
1957
  if (!showCount) {
1227
1958
  return control;
1228
1959
  }
1229
- return /* @__PURE__ */ jsxs5("span", {
1960
+ return /* @__PURE__ */ jsxs6("span", {
1230
1961
  className: textAreaWrapperClass,
1231
1962
  children: [
1232
1963
  control,
1233
- /* @__PURE__ */ jsxs5("span", {
1964
+ /* @__PURE__ */ jsxs6("span", {
1234
1965
  className: getTextAreaCountClasses({ exceeded }),
1235
1966
  children: [
1236
1967
  count,
@@ -1241,7 +1972,7 @@ var TextArea = forwardRef4(({
1241
1972
  });
1242
1973
  });
1243
1974
  TextArea.displayName = "Input.TextArea";
1244
- var Group = forwardRef4(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
1975
+ var Group = forwardRef5(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
1245
1976
  ...props,
1246
1977
  ref,
1247
1978
  className: cn(inputGroupClass, className),
@@ -1255,7 +1986,7 @@ var Input = Object.assign(InputRoot, {
1255
1986
  Group
1256
1987
  });
1257
1988
  // src/components/select/Select.tsx
1258
- import React5, { forwardRef as forwardRef5, useMemo as useMemo4, useState as useState5 } from "react";
1989
+ import React7, { forwardRef as forwardRef6, useMemo as useMemo5, useState as useState7 } from "react";
1259
1990
 
1260
1991
  // src/classes/select.ts
1261
1992
  var selectContainerClass = "select-container";
@@ -1311,7 +2042,7 @@ function getSelectOptionClasses({
1311
2042
  }
1312
2043
 
1313
2044
  // src/components/select/Select.tsx
1314
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2045
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1315
2046
  function isGroup(option) {
1316
2047
  return "options" in option;
1317
2048
  }
@@ -1336,8 +2067,8 @@ function normalizeMultiValue(value) {
1336
2067
  }
1337
2068
  function optionsFromChildren(children) {
1338
2069
  const result = [];
1339
- React5.Children.forEach(children, (child) => {
1340
- if (!React5.isValidElement(child)) {
2070
+ React7.Children.forEach(children, (child) => {
2071
+ if (!React7.isValidElement(child)) {
1341
2072
  return;
1342
2073
  }
1343
2074
  if (child.type === Option) {
@@ -1387,19 +2118,19 @@ function filterOptions(options, searchValue, filterOption) {
1387
2118
  function renderValue(option) {
1388
2119
  return option ? optionLabel(option) : null;
1389
2120
  }
1390
- var Option = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2121
+ var Option = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
1391
2122
  ...props,
1392
2123
  ref,
1393
2124
  children
1394
2125
  }));
1395
2126
  Option.displayName = "Select.Option";
1396
- var OptGroup = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2127
+ var OptGroup = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
1397
2128
  ...props,
1398
2129
  ref,
1399
2130
  children
1400
2131
  }));
1401
2132
  OptGroup.displayName = "Select.OptGroup";
1402
- var SelectRoot = forwardRef5(({
2133
+ var SelectRoot = forwardRef6(({
1403
2134
  allowClear,
1404
2135
  children,
1405
2136
  className,
@@ -1418,11 +2149,11 @@ var SelectRoot = forwardRef5(({
1418
2149
  ...props
1419
2150
  }, ref) => {
1420
2151
  const multiple = mode === "multiple" || mode === "tags";
1421
- const sourceOptions = useMemo4(() => options ?? optionsFromChildren(children), [children, options]);
1422
- const flatOptions = useMemo4(() => flattenOptions(sourceOptions), [sourceOptions]);
1423
- const [open, setOpen] = useState5(false);
1424
- const [searchValue, setSearchValue] = useState5("");
1425
- const [internalValue, setInternalValue] = useState5(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
2152
+ const sourceOptions = useMemo5(() => options ?? optionsFromChildren(children), [children, options]);
2153
+ const flatOptions = useMemo5(() => flattenOptions(sourceOptions), [sourceOptions]);
2154
+ const [open, setOpen] = useState7(false);
2155
+ const [searchValue, setSearchValue] = useState7("");
2156
+ const [internalValue, setInternalValue] = useState7(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
1426
2157
  const controlled = value !== undefined;
1427
2158
  const currentValue = controlled ? value : internalValue;
1428
2159
  const selectedValues = multiple ? normalizeMultiValue(currentValue) : normalizeSingleValue(currentValue) === undefined ? [] : [normalizeSingleValue(currentValue)];
@@ -1479,7 +2210,7 @@ var SelectRoot = forwardRef5(({
1479
2210
  }
1480
2211
  function renderOption(option) {
1481
2212
  const selected = selectedKeys.has(valueKey(option.value));
1482
- return /* @__PURE__ */ jsx7("button", {
2213
+ return /* @__PURE__ */ jsx8("button", {
1483
2214
  type: "button",
1484
2215
  role: "option",
1485
2216
  "aria-selected": selected,
@@ -1498,11 +2229,11 @@ var SelectRoot = forwardRef5(({
1498
2229
  if (!isGroup(option)) {
1499
2230
  return renderOption(option);
1500
2231
  }
1501
- return /* @__PURE__ */ jsxs6("div", {
2232
+ return /* @__PURE__ */ jsxs7("div", {
1502
2233
  className: cn(selectGroupClass, option.className),
1503
2234
  role: "group",
1504
2235
  children: [
1505
- /* @__PURE__ */ jsx7("div", {
2236
+ /* @__PURE__ */ jsx8("div", {
1506
2237
  className: selectGroupLabelClass,
1507
2238
  children: option.label
1508
2239
  }),
@@ -1511,11 +2242,11 @@ var SelectRoot = forwardRef5(({
1511
2242
  }, `group-${index}`);
1512
2243
  });
1513
2244
  }
1514
- const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx7("span", {
2245
+ const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx8("span", {
1515
2246
  className: selectTagClass,
1516
2247
  children: renderValue(option)
1517
2248
  }, valueKey(option.value))) : renderValue(selectedOptions[0]);
1518
- return /* @__PURE__ */ jsxs6("div", {
2249
+ return /* @__PURE__ */ jsxs7("div", {
1519
2250
  ...props,
1520
2251
  ref,
1521
2252
  className: getSelectContainerClasses({
@@ -1526,7 +2257,7 @@ var SelectRoot = forwardRef5(({
1526
2257
  className
1527
2258
  }),
1528
2259
  children: [
1529
- /* @__PURE__ */ jsxs6("button", {
2260
+ /* @__PURE__ */ jsxs7("button", {
1530
2261
  type: "button",
1531
2262
  className: getSelectClasses({ size, status, disabled }),
1532
2263
  disabled: disabled || loading,
@@ -1534,33 +2265,33 @@ var SelectRoot = forwardRef5(({
1534
2265
  "aria-expanded": open,
1535
2266
  onClick: () => setOpen((current) => !current),
1536
2267
  children: [
1537
- /* @__PURE__ */ jsx7("span", {
2268
+ /* @__PURE__ */ jsx8("span", {
1538
2269
  className: selectSelectionClass,
1539
- children: hasValue ? selection : /* @__PURE__ */ jsx7("span", {
2270
+ children: hasValue ? selection : /* @__PURE__ */ jsx8("span", {
1540
2271
  className: selectPlaceholderClass,
1541
2272
  children: placeholder
1542
2273
  })
1543
2274
  }),
1544
- /* @__PURE__ */ jsx7("span", {
2275
+ /* @__PURE__ */ jsx8("span", {
1545
2276
  className: selectIconClass,
1546
2277
  "aria-hidden": "true",
1547
2278
  children: "v"
1548
2279
  })
1549
2280
  ]
1550
2281
  }),
1551
- allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx7("button", {
2282
+ allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx8("button", {
1552
2283
  type: "button",
1553
2284
  className: selectClearClass,
1554
2285
  "aria-label": "Clear selection",
1555
2286
  onClick: clearValue,
1556
2287
  children: "x"
1557
2288
  }) : null,
1558
- open ? /* @__PURE__ */ jsxs6("div", {
2289
+ open ? /* @__PURE__ */ jsxs7("div", {
1559
2290
  className: selectDropdownClass,
1560
2291
  role: "listbox",
1561
2292
  "aria-multiselectable": multiple || undefined,
1562
2293
  children: [
1563
- searchable ? /* @__PURE__ */ jsx7("input", {
2294
+ searchable ? /* @__PURE__ */ jsx8("input", {
1564
2295
  className: selectSearchClass,
1565
2296
  value: searchValue,
1566
2297
  placeholder: typeof placeholder === "string" ? placeholder : undefined,
@@ -1572,7 +2303,7 @@ var SelectRoot = forwardRef5(({
1572
2303
  }
1573
2304
  }
1574
2305
  }) : null,
1575
- visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx7("div", {
2306
+ visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx8("div", {
1576
2307
  className: selectEmptyClass,
1577
2308
  children: "No data"
1578
2309
  })
@@ -1586,7 +2317,7 @@ var Select = SelectRoot;
1586
2317
  Select.Option = Option;
1587
2318
  Select.OptGroup = OptGroup;
1588
2319
  // src/components/dm-search/DmSearch.tsx
1589
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2320
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1590
2321
  function initialValues(items, searchParams, useSearchParams = true) {
1591
2322
  return items.reduce((acc, item) => {
1592
2323
  const defaultValue = item.search.extraProps?.value ?? item.search.formProps?.initialValue;
@@ -1610,7 +2341,7 @@ function renderField({
1610
2341
  return item.search.render?.(value, setValue, item) ?? null;
1611
2342
  }
1612
2343
  if (item.search.type === "select") {
1613
- return /* @__PURE__ */ jsx8(Select, {
2344
+ return /* @__PURE__ */ jsx9(Select, {
1614
2345
  ...extraProps,
1615
2346
  disabled: Boolean(loading || extraProps.disabled),
1616
2347
  value,
@@ -1619,25 +2350,25 @@ function renderField({
1619
2350
  });
1620
2351
  }
1621
2352
  if (item.search.type === "dateRange") {
1622
- return /* @__PURE__ */ jsx8(DatePicker.RangePicker, {
2353
+ return /* @__PURE__ */ jsx9(DatePicker.RangePicker, {
1623
2354
  ...extraProps,
1624
2355
  value,
1625
2356
  onChange: (nextValue) => setValue(nextValue)
1626
2357
  });
1627
2358
  }
1628
2359
  if (item.search.type === "date") {
1629
- return /* @__PURE__ */ jsx8(DatePicker, {
2360
+ return /* @__PURE__ */ jsx9(DatePicker, {
1630
2361
  ...extraProps,
1631
2362
  value,
1632
2363
  onChange: (nextValue) => setValue(nextValue)
1633
2364
  });
1634
2365
  }
1635
2366
  if (item.search.type === "radio" || item.search.type === "checkbox") {
1636
- return /* @__PURE__ */ jsx8("div", {
2367
+ return /* @__PURE__ */ jsx9("div", {
1637
2368
  role: item.search.type === "radio" ? "radiogroup" : "group",
1638
- children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs7("label", {
2369
+ children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs8("label", {
1639
2370
  children: [
1640
- /* @__PURE__ */ jsx8("input", {
2371
+ /* @__PURE__ */ jsx9("input", {
1641
2372
  type: item.search.type,
1642
2373
  disabled: loading,
1643
2374
  checked: item.search.type === "checkbox" ? Array.isArray(value) && value.includes(option.value) : value === option.value,
@@ -1655,7 +2386,7 @@ function renderField({
1655
2386
  }, String(option.value)))
1656
2387
  });
1657
2388
  }
1658
- return /* @__PURE__ */ jsx8(Input, {
2389
+ return /* @__PURE__ */ jsx9(Input, {
1659
2390
  ...extraProps,
1660
2391
  type: item.search.type === "input-number" ? "number" : "text",
1661
2392
  disabled: Boolean(loading || extraProps.disabled),
@@ -1669,8 +2400,11 @@ function renderField({
1669
2400
  }
1670
2401
  });
1671
2402
  }
1672
- var DmSearch = forwardRef6(({
2403
+ var DmSearch = forwardRef7(({
1673
2404
  items = [],
2405
+ values: controlledValues,
2406
+ onValuesChange,
2407
+ onReset,
1674
2408
  onSearch,
1675
2409
  extra,
1676
2410
  fastFilterItem,
@@ -1679,27 +2413,37 @@ var DmSearch = forwardRef6(({
1679
2413
  compact = false,
1680
2414
  searchParams,
1681
2415
  loading = false,
2416
+ noValidate,
1682
2417
  enableDefaultPlaceHolder = false,
1683
2418
  className
1684
2419
  }, ref) => {
1685
- const allItems = useMemo5(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
1686
- const [collapsed, setCollapsed] = useState6(defaultCollapsed);
1687
- const [values, setValues] = useState6(() => initialValues(allItems, searchParams));
2420
+ const allItems = useMemo6(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
2421
+ const [collapsed, setCollapsed] = useState8(defaultCollapsed);
2422
+ const [internalValues, setValues] = useState8(() => initialValues(allItems, searchParams));
2423
+ const controlled = controlledValues !== undefined;
2424
+ const values = controlled ? controlledValues : internalValues;
1688
2425
  const visibleItems = collapsed ? allItems.slice(0, 1) : allItems;
1689
- useEffect2(() => {
1690
- setValues(initialValues(allItems, searchParams));
1691
- }, [allItems, searchParams]);
2426
+ useEffect3(() => {
2427
+ if (!controlled)
2428
+ setValues(initialValues(allItems, searchParams));
2429
+ }, [allItems, searchParams, controlled]);
1692
2430
  function reset(useSearchParams = false) {
1693
2431
  const nextValues = initialValues(allItems, searchParams, useSearchParams);
1694
- setValues(nextValues);
2432
+ if (!controlled)
2433
+ setValues(nextValues);
2434
+ if (onReset)
2435
+ onReset(nextValues);
2436
+ else if (controlled)
2437
+ onValuesChange?.(nextValues);
1695
2438
  return nextValues;
1696
2439
  }
1697
- useImperativeHandle2(ref, () => ({
2440
+ useImperativeHandle3(ref, () => ({
1698
2441
  onReset: () => {
1699
2442
  reset(false);
1700
2443
  }
1701
2444
  }));
1702
- return /* @__PURE__ */ jsxs7("form", {
2445
+ return /* @__PURE__ */ jsxs8("form", {
2446
+ noValidate,
1703
2447
  id: "searchForm",
1704
2448
  className: getDmSearchClasses({ compact, collapsed, className }),
1705
2449
  onSubmit: (event) => {
@@ -1707,53 +2451,63 @@ var DmSearch = forwardRef6(({
1707
2451
  onSearch?.(values);
1708
2452
  },
1709
2453
  children: [
1710
- fastFilterItem ? /* @__PURE__ */ jsx8("div", {
2454
+ fastFilterItem ? /* @__PURE__ */ jsx9("div", {
1711
2455
  className: dmSearchFastFilterClass,
1712
2456
  children: fastFilterItem.title
1713
2457
  }) : null,
1714
- /* @__PURE__ */ jsx8("div", {
2458
+ /* @__PURE__ */ jsx9("div", {
1715
2459
  className: dmSearchFieldsClass,
1716
- children: visibleItems.map((item) => /* @__PURE__ */ jsxs7("label", {
1717
- className: dmSearchFieldClass,
1718
- children: [
1719
- compact ? null : /* @__PURE__ */ jsx8("span", {
1720
- children: item.title
1721
- }),
1722
- renderField({
1723
- item,
1724
- value: values[item.dataIndex],
1725
- loading,
1726
- enableDefaultPlaceHolder,
1727
- setValue: (value) => setValues((current) => ({
1728
- ...current,
1729
- [item.dataIndex]: value
1730
- }))
1731
- })
1732
- ]
1733
- }, item.key))
2460
+ children: visibleItems.map((item) => {
2461
+ const Field = item.search.type === "custom" ? "div" : "label";
2462
+ return /* @__PURE__ */ jsxs8(Field, {
2463
+ className: dmSearchFieldClass,
2464
+ children: [
2465
+ compact ? null : /* @__PURE__ */ jsx9("span", {
2466
+ children: item.title
2467
+ }),
2468
+ renderField({
2469
+ item,
2470
+ value: values[item.dataIndex],
2471
+ loading,
2472
+ enableDefaultPlaceHolder,
2473
+ setValue: (value) => {
2474
+ const nextValues = { ...values, [item.dataIndex]: value };
2475
+ if (!controlled)
2476
+ setValues(nextValues);
2477
+ onValuesChange?.(nextValues);
2478
+ }
2479
+ })
2480
+ ]
2481
+ }, item.key);
2482
+ })
1734
2483
  }),
1735
- /* @__PURE__ */ jsxs7("div", {
2484
+ /* @__PURE__ */ jsxs8("div", {
1736
2485
  className: dmSearchActionsClass,
1737
2486
  children: [
1738
- /* @__PURE__ */ jsx8(Button, {
2487
+ /* @__PURE__ */ jsx9(Button, {
1739
2488
  type: "submit",
1740
2489
  isLoading: loading,
1741
2490
  children: "Search"
1742
2491
  }),
1743
- /* @__PURE__ */ jsx8(Button, {
2492
+ /* @__PURE__ */ jsx9(Button, {
1744
2493
  type: "button",
1745
2494
  color: "secondary",
1746
2495
  appearance: "outline",
1747
- onClick: () => onSearch?.(reset(false)),
2496
+ onClick: () => {
2497
+ const nextValues = reset(false);
2498
+ if (!onReset)
2499
+ onSearch?.(nextValues);
2500
+ },
1748
2501
  children: "Reset"
1749
2502
  }),
1750
- !hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx8(Button, {
2503
+ !hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx9(Button, {
1751
2504
  type: "button",
1752
2505
  color: "secondary",
1753
2506
  appearance: "text",
1754
2507
  onClick: () => {
1755
2508
  setCollapsed((current) => !current);
1756
- setValues(initialValues(allItems, searchParams));
2509
+ if (!controlled)
2510
+ setValues(initialValues(allItems, searchParams));
1757
2511
  },
1758
2512
  children: collapsed ? "Expand" : "Collapse"
1759
2513
  }) : null,
@@ -1765,10 +2519,10 @@ var DmSearch = forwardRef6(({
1765
2519
  });
1766
2520
  DmSearch.displayName = "DmSearch";
1767
2521
  // src/components/table/Table.tsx
1768
- import React7, {
1769
- forwardRef as forwardRef7,
1770
- useMemo as useMemo6,
1771
- useState as useState7
2522
+ import React9, {
2523
+ forwardRef as forwardRef8,
2524
+ useMemo as useMemo7,
2525
+ useState as useState9
1772
2526
  } from "react";
1773
2527
 
1774
2528
  // src/classes/table.ts
@@ -1818,7 +2572,7 @@ function getTableSorterClasses(active) {
1818
2572
  }
1819
2573
 
1820
2574
  // src/components/table/Table.tsx
1821
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2575
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1822
2576
  import { createElement } from "react";
1823
2577
  var defaultPageSize = 10;
1824
2578
  var defaultSortDirections = ["ascend", "descend", null];
@@ -1934,24 +2688,24 @@ function selectedRowsForKeys(data, keys, rowKey) {
1934
2688
  const keySet = new Set(normalizeKeys(keys));
1935
2689
  return data.filter((record, index) => keySet.has(String(getRecordKey(record, index, rowKey))));
1936
2690
  }
1937
- var Column = forwardRef7(() => null);
2691
+ var Column = forwardRef8(() => null);
1938
2692
  Column.displayName = "Table.Column";
1939
- var ColumnGroup = forwardRef7(() => null);
2693
+ var ColumnGroup = forwardRef8(() => null);
1940
2694
  ColumnGroup.displayName = "Table.ColumnGroup";
1941
- var SummaryRow = forwardRef7((props, ref) => /* @__PURE__ */ jsx9("tr", {
2695
+ var SummaryRow = forwardRef8((props, ref) => /* @__PURE__ */ jsx10("tr", {
1942
2696
  ...props,
1943
2697
  ref
1944
2698
  }));
1945
2699
  SummaryRow.displayName = "Table.Summary.Row";
1946
- var SummaryCell = forwardRef7(({ index, ...props }, ref) => {
1947
- return /* @__PURE__ */ jsx9("td", {
2700
+ var SummaryCell = forwardRef8(({ index, ...props }, ref) => {
2701
+ return /* @__PURE__ */ jsx10("td", {
1948
2702
  ...props,
1949
2703
  ref
1950
2704
  });
1951
2705
  });
1952
2706
  SummaryCell.displayName = "Table.Summary.Cell";
1953
- var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
1954
- return /* @__PURE__ */ jsx9("tfoot", {
2707
+ var Summary = Object.assign(forwardRef8(({ fixed, ...props }, ref) => {
2708
+ return /* @__PURE__ */ jsx10("tfoot", {
1955
2709
  ...props,
1956
2710
  ref
1957
2711
  });
@@ -1961,8 +2715,8 @@ var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
1961
2715
  });
1962
2716
  Summary.displayName = "Table.Summary";
1963
2717
  function columnsFromChildren(children) {
1964
- return React7.Children.toArray(children).flatMap((child) => {
1965
- if (!React7.isValidElement(child)) {
2718
+ return React9.Children.toArray(children).flatMap((child) => {
2719
+ if (!React9.isValidElement(child)) {
1966
2720
  return [];
1967
2721
  }
1968
2722
  if (child.type === Column) {
@@ -1988,12 +2742,12 @@ function renderSummary(summary, pageData, colSpan) {
1988
2742
  return null;
1989
2743
  }
1990
2744
  const node = summary(pageData);
1991
- if (React7.isValidElement(node) && node.type === Summary) {
2745
+ if (React9.isValidElement(node) && node.type === Summary) {
1992
2746
  return node;
1993
2747
  }
1994
- return /* @__PURE__ */ jsx9("tfoot", {
1995
- children: /* @__PURE__ */ jsx9("tr", {
1996
- children: /* @__PURE__ */ jsx9("td", {
2748
+ return /* @__PURE__ */ jsx10("tfoot", {
2749
+ children: /* @__PURE__ */ jsx10("tr", {
2750
+ children: /* @__PURE__ */ jsx10("td", {
1997
2751
  className: tableCellClass,
1998
2752
  colSpan,
1999
2753
  children: node
@@ -2037,18 +2791,18 @@ function TableRoot({
2037
2791
  className,
2038
2792
  ...props
2039
2793
  }, ref) {
2040
- const childColumns = useMemo6(() => columnsFromChildren(children), [children]);
2041
- const normalizedColumns = useMemo6(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
2042
- const leaves = useMemo6(() => leafColumns(normalizedColumns), [normalizedColumns]);
2043
- const headerRows = useMemo6(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
2044
- const [sortStates, setSortStates] = useState7({});
2045
- const [filterStates, setFilterStates] = useState7({});
2046
- const [internalCurrent, setInternalCurrent] = useState7(1);
2047
- const [internalPageSize, setInternalPageSize] = useState7(defaultPageSize);
2048
- const [internalSelectedKeys, setInternalSelectedKeys] = useState7(rowSelection?.defaultSelectedRowKeys ?? []);
2049
- const [internalExpandedKeys, setInternalExpandedKeys] = useState7(expandable?.defaultExpandedRowKeys ?? []);
2794
+ const childColumns = useMemo7(() => columnsFromChildren(children), [children]);
2795
+ const normalizedColumns = useMemo7(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
2796
+ const leaves = useMemo7(() => leafColumns(normalizedColumns), [normalizedColumns]);
2797
+ const headerRows = useMemo7(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
2798
+ const [sortStates, setSortStates] = useState9({});
2799
+ const [filterStates, setFilterStates] = useState9({});
2800
+ const [internalCurrent, setInternalCurrent] = useState9(1);
2801
+ const [internalPageSize, setInternalPageSize] = useState9(defaultPageSize);
2802
+ const [internalSelectedKeys, setInternalSelectedKeys] = useState9(rowSelection?.defaultSelectedRowKeys ?? []);
2803
+ const [internalExpandedKeys, setInternalExpandedKeys] = useState9(expandable?.defaultExpandedRowKeys ?? []);
2050
2804
  const spinning = typeof loading === "object" ? loading.spinning : Boolean(loading);
2051
- const activeFilters = useMemo6(() => {
2805
+ const activeFilters = useMemo7(() => {
2052
2806
  return leaves.reduce((result, column) => {
2053
2807
  const value = filterValueFor(column, filterStates) ?? null;
2054
2808
  if (value !== null) {
@@ -2057,7 +2811,7 @@ function TableRoot({
2057
2811
  return result;
2058
2812
  }, {});
2059
2813
  }, [filterStates, leaves]);
2060
- const activeSorter = useMemo6(() => {
2814
+ const activeSorter = useMemo7(() => {
2061
2815
  const column = leaves.find((item) => sortOrderFor(item, sortStates));
2062
2816
  if (!column) {
2063
2817
  return {};
@@ -2069,7 +2823,7 @@ function TableRoot({
2069
2823
  order: sortOrderFor(column, sortStates) ?? null
2070
2824
  };
2071
2825
  }, [leaves, sortStates]);
2072
- const filteredData = useMemo6(() => {
2826
+ const filteredData = useMemo7(() => {
2073
2827
  return leaves.reduce((records, column) => {
2074
2828
  const values = filterValueFor(column, filterStates);
2075
2829
  if (!values?.length || !column.onFilter) {
@@ -2078,7 +2832,7 @@ function TableRoot({
2078
2832
  return records.filter((record) => values.some((value) => column.onFilter?.(value, record)));
2079
2833
  }, dataSource);
2080
2834
  }, [dataSource, filterStates, leaves]);
2081
- const sortedData = useMemo6(() => {
2835
+ const sortedData = useMemo7(() => {
2082
2836
  const sorterColumn = leaves.find((column) => sortOrderFor(column, sortStates));
2083
2837
  const order = sorterColumn ? sortOrderFor(sorterColumn, sortStates) : null;
2084
2838
  const compare = sorterColumn ? sortCompare(sorterColumn.sorter) : undefined;
@@ -2221,18 +2975,18 @@ function TableRoot({
2221
2975
  return null;
2222
2976
  }
2223
2977
  if (rowSelection.type === "radio" || rowSelection.hideSelectAll) {
2224
- return /* @__PURE__ */ jsx9("th", {
2978
+ return /* @__PURE__ */ jsx10("th", {
2225
2979
  className: cn(tableHeaderCellClass, tableSelectionCellClass),
2226
2980
  children: rowSelection.columnTitle
2227
2981
  });
2228
2982
  }
2229
2983
  const pageKeys = pageData.map((record, index) => getRecordKey(record, index, rowKey));
2230
2984
  const allSelected = pageKeys.length > 0 && pageKeys.every((key) => selectedKeySet.has(String(key)));
2231
- return /* @__PURE__ */ jsx9("th", {
2985
+ return /* @__PURE__ */ jsx10("th", {
2232
2986
  className: cn(tableHeaderCellClass, tableSelectionCellClass),
2233
- children: /* @__PURE__ */ jsxs8("label", {
2987
+ children: /* @__PURE__ */ jsxs9("label", {
2234
2988
  children: [
2235
- /* @__PURE__ */ jsx9("input", {
2989
+ /* @__PURE__ */ jsx10("input", {
2236
2990
  type: "checkbox",
2237
2991
  "aria-label": "Select all rows",
2238
2992
  checked: allSelected,
@@ -2259,26 +3013,26 @@ function TableRoot({
2259
3013
  textAlign: column.align,
2260
3014
  ...headerProps.style
2261
3015
  }
2262
- }, /* @__PURE__ */ jsx9("span", {
3016
+ }, /* @__PURE__ */ jsx10("span", {
2263
3017
  children: title
2264
- }), column.sorter ? /* @__PURE__ */ jsx9("button", {
3018
+ }), column.sorter ? /* @__PURE__ */ jsx10("button", {
2265
3019
  type: "button",
2266
3020
  className: getTableSorterClasses(Boolean(sortOrder)),
2267
3021
  "aria-label": `Sort ${textFromNode(title, String(column.columnKey))}`,
2268
3022
  onClick: () => changeSorter(column),
2269
3023
  children: sortOrder === "ascend" ? "Asc" : sortOrder === "descend" ? "Desc" : "Sort"
2270
- }) : null, column.filters?.length ? /* @__PURE__ */ jsxs8("select", {
3024
+ }) : null, column.filters?.length ? /* @__PURE__ */ jsxs9("select", {
2271
3025
  className: tableFilterClass,
2272
3026
  "aria-label": `Filter ${textFromNode(title, String(column.columnKey))}`,
2273
3027
  multiple: column.filterMultiple !== false,
2274
3028
  value: column.filterMultiple === false ? String((filterValueFor(column, filterStates) ?? [])[0] ?? "") : (filterValueFor(column, filterStates) ?? []).map(String),
2275
3029
  onChange: (event) => changeFilter(column, event),
2276
3030
  children: [
2277
- column.filterMultiple === false ? /* @__PURE__ */ jsx9("option", {
3031
+ column.filterMultiple === false ? /* @__PURE__ */ jsx10("option", {
2278
3032
  value: "",
2279
3033
  children: "All"
2280
3034
  }) : null,
2281
- optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx9("option", {
3035
+ optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx10("option", {
2282
3036
  value: String(filter.value),
2283
3037
  children: filter.text
2284
3038
  }, String(filter.value)))
@@ -2303,14 +3057,14 @@ function TableRoot({
2303
3057
  const key = getRecordKey(record, index, rowKey);
2304
3058
  const checked = selectedKeySet.has(String(key));
2305
3059
  const checkboxProps = rowSelection.getCheckboxProps?.(record) ?? {};
2306
- const originNode = /* @__PURE__ */ jsx9("input", {
3060
+ const originNode = /* @__PURE__ */ jsx10("input", {
2307
3061
  ...checkboxProps,
2308
3062
  type: rowSelection.type === "radio" ? "radio" : "checkbox",
2309
3063
  "aria-label": `Select row ${index + 1}`,
2310
3064
  checked,
2311
3065
  onChange: (event) => toggleRowSelection(record, index, event)
2312
3066
  });
2313
- return /* @__PURE__ */ jsx9("td", {
3067
+ return /* @__PURE__ */ jsx10("td", {
2314
3068
  className: cn(tableCellClass, tableSelectionCellClass),
2315
3069
  children: rowSelection.renderCell ? rowSelection.renderCell(checked, record, index, originNode) : originNode
2316
3070
  });
@@ -2322,9 +3076,9 @@ function TableRoot({
2322
3076
  const key = getRecordKey(record, index, rowKey);
2323
3077
  const expanded = expandedKeySet.has(String(key));
2324
3078
  const expandableRow = expandable.rowExpandable?.(record) ?? true;
2325
- return /* @__PURE__ */ jsx9("td", {
3079
+ return /* @__PURE__ */ jsx10("td", {
2326
3080
  className: cn(tableCellClass, tableExpandCellClass),
2327
- children: expandableRow ? /* @__PURE__ */ jsx9("button", {
3081
+ children: expandableRow ? /* @__PURE__ */ jsx10("button", {
2328
3082
  type: "button",
2329
3083
  className: tableExpandButtonClass,
2330
3084
  "aria-label": `${expanded ? "Collapse" : "Expand"} row ${index + 1}`,
@@ -2337,7 +3091,7 @@ function TableRoot({
2337
3091
  const key = getRecordKey(record, index, rowKey);
2338
3092
  const expanded = expandedKeySet.has(String(key));
2339
3093
  const selected = selectedKeySet.has(String(key));
2340
- const row = /* @__PURE__ */ jsxs8("tr", {
3094
+ const row = /* @__PURE__ */ jsxs9("tr", {
2341
3095
  className: getTableRowClasses({ selected, expanded }),
2342
3096
  onClick: () => {
2343
3097
  if (expandable?.expandRowByClick) {
@@ -2353,12 +3107,12 @@ function TableRoot({
2353
3107
  if (!expanded || !expandable?.expandedRowRender) {
2354
3108
  return row;
2355
3109
  }
2356
- return /* @__PURE__ */ jsxs8(React7.Fragment, {
3110
+ return /* @__PURE__ */ jsxs9(React9.Fragment, {
2357
3111
  children: [
2358
3112
  row,
2359
- /* @__PURE__ */ jsx9("tr", {
3113
+ /* @__PURE__ */ jsx10("tr", {
2360
3114
  className: "table-expanded-row",
2361
- children: /* @__PURE__ */ jsx9("td", {
3115
+ children: /* @__PURE__ */ jsx10("td", {
2362
3116
  className: tableCellClass,
2363
3117
  colSpan: structuralColumnCount,
2364
3118
  children: expandable.expandedRowRender(record, index, 0, expanded)
@@ -2367,15 +3121,15 @@ function TableRoot({
2367
3121
  ]
2368
3122
  }, String(key));
2369
3123
  }
2370
- const tableNode = /* @__PURE__ */ jsxs8("table", {
3124
+ const tableNode = /* @__PURE__ */ jsxs9("table", {
2371
3125
  className: getTableClasses({ bordered, size }),
2372
3126
  style: { tableLayout },
2373
3127
  children: [
2374
- /* @__PURE__ */ jsx9("thead", {
2375
- children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs8("tr", {
3128
+ /* @__PURE__ */ jsx10("thead", {
3129
+ children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs9("tr", {
2376
3130
  children: [
2377
3131
  rowIndex === 0 ? renderSelectionHeader() : null,
2378
- rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx9("th", {
3132
+ rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx10("th", {
2379
3133
  className: cn(tableHeaderCellClass, tableExpandCellClass),
2380
3134
  children: expandable?.columnTitle
2381
3135
  }) : null,
@@ -2383,9 +3137,9 @@ function TableRoot({
2383
3137
  ]
2384
3138
  }, rowIndex))
2385
3139
  }),
2386
- /* @__PURE__ */ jsx9("tbody", {
2387
- children: bodyEmpty ? /* @__PURE__ */ jsx9("tr", {
2388
- children: /* @__PURE__ */ jsx9("td", {
3140
+ /* @__PURE__ */ jsx10("tbody", {
3141
+ children: bodyEmpty ? /* @__PURE__ */ jsx10("tr", {
3142
+ children: /* @__PURE__ */ jsx10("td", {
2389
3143
  className: tableEmptyClass,
2390
3144
  colSpan: structuralColumnCount,
2391
3145
  children: locale?.emptyText ?? "No data"
@@ -2395,12 +3149,12 @@ function TableRoot({
2395
3149
  renderSummary(summary, pageData, structuralColumnCount)
2396
3150
  ]
2397
3151
  });
2398
- return /* @__PURE__ */ jsxs8("div", {
3152
+ return /* @__PURE__ */ jsxs9("div", {
2399
3153
  ...props,
2400
3154
  ref,
2401
3155
  className: getTableWrapperClasses({ loading: spinning, className }),
2402
3156
  children: [
2403
- scroll?.x || scroll?.y ? /* @__PURE__ */ jsx9("div", {
3157
+ scroll?.x || scroll?.y ? /* @__PURE__ */ jsx10("div", {
2404
3158
  style: {
2405
3159
  overflow: "auto",
2406
3160
  maxHeight: scroll.y,
@@ -2408,30 +3162,30 @@ function TableRoot({
2408
3162
  },
2409
3163
  children: tableNode
2410
3164
  }) : tableNode,
2411
- spinning ? /* @__PURE__ */ jsx9("div", {
3165
+ spinning ? /* @__PURE__ */ jsx10("div", {
2412
3166
  className: tableLoadingIndicatorClass,
2413
3167
  role: "status",
2414
3168
  children: typeof loading === "object" && loading.indicator ? loading.indicator : "Loading"
2415
3169
  }) : null,
2416
- paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs8("nav", {
3170
+ paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs9("nav", {
2417
3171
  className: tablePaginationClass,
2418
3172
  "aria-label": "Table pagination",
2419
3173
  children: [
2420
- /* @__PURE__ */ jsx9("button", {
3174
+ /* @__PURE__ */ jsx10("button", {
2421
3175
  type: "button",
2422
3176
  className: tablePaginationButtonClass,
2423
3177
  disabled: paginationConfig.disabled || current <= 1,
2424
3178
  onClick: () => changePage(current - 1),
2425
3179
  children: "Previous"
2426
3180
  }),
2427
- /* @__PURE__ */ jsx9("span", {
3181
+ /* @__PURE__ */ jsx10("span", {
2428
3182
  className: tablePaginationInfoClass,
2429
3183
  children: paginationConfig.showTotal ? paginationConfig.showTotal(paginationConfig.total ?? sortedData.length, [
2430
3184
  bodyEmpty ? 0 : (current - 1) * pageSize + 1,
2431
3185
  Math.min(current * pageSize, sortedData.length)
2432
3186
  ]) : `${current} / ${pageCount}`
2433
3187
  }),
2434
- /* @__PURE__ */ jsx9("button", {
3188
+ /* @__PURE__ */ jsx10("button", {
2435
3189
  type: "button",
2436
3190
  className: tablePaginationButtonClass,
2437
3191
  disabled: paginationConfig.disabled || current >= pageCount,
@@ -2443,7 +3197,7 @@ function TableRoot({
2443
3197
  ]
2444
3198
  });
2445
3199
  }
2446
- var TableWithRef = forwardRef7(TableRoot);
3200
+ var TableWithRef = forwardRef8(TableRoot);
2447
3201
  var Table = Object.assign(TableWithRef, {
2448
3202
  Column,
2449
3203
  ColumnGroup,
@@ -2456,7 +3210,7 @@ var Table = Object.assign(TableWithRef, {
2456
3210
  });
2457
3211
  Table.displayName = "Table";
2458
3212
  // src/components/dm-table/DmTable.tsx
2459
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3213
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2460
3214
  function mapAndFilter(list, mapper) {
2461
3215
  return list.map(mapper).filter((item) => item !== false && item != null);
2462
3216
  }
@@ -2507,9 +3261,9 @@ function DmTable({
2507
3261
  rowSelection,
2508
3262
  ...props
2509
3263
  }) {
2510
- const tableColumns = useMemo7(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
2511
- const [columns, setColumns] = useState8(tableColumns);
2512
- const [columnSettingsOpen, setColumnSettingsOpen] = useState8(false);
3264
+ const tableColumns = useMemo8(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
3265
+ const [columns, setColumns] = useState10(tableColumns);
3266
+ const [columnSettingsOpen, setColumnSettingsOpen] = useState10(false);
2513
3267
  const items = searchProps?.items?.length ? searchProps.items : searchItems(inputColumns);
2514
3268
  const paginationObj = typeof pagination === "object" ? pagination : undefined;
2515
3269
  const paginationProps = paginationObj ? Object.fromEntries(Object.entries(paginationObj).filter(([key]) => key !== "ref")) : {};
@@ -2522,37 +3276,37 @@ function DmTable({
2522
3276
  globalThis.localStorage?.removeItem(columnState.persistenceKey);
2523
3277
  }
2524
3278
  }
2525
- return /* @__PURE__ */ jsxs9("div", {
3279
+ return /* @__PURE__ */ jsxs10("div", {
2526
3280
  className: getDmTableClasses({ className }),
2527
3281
  children: [
2528
- items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx10(Card, {
3282
+ items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx11(Card, {
2529
3283
  className: dmTableSearchClass,
2530
3284
  padding: "md",
2531
- children: /* @__PURE__ */ jsx10(DmSearch, {
3285
+ children: /* @__PURE__ */ jsx11(DmSearch, {
2532
3286
  ...searchProps,
2533
3287
  items
2534
3288
  })
2535
3289
  }) : null,
2536
- indicators ? /* @__PURE__ */ jsx10("div", {
3290
+ indicators ? /* @__PURE__ */ jsx11("div", {
2537
3291
  className: dmTableIndicatorsClass,
2538
3292
  children: indicators
2539
3293
  }) : null,
2540
- /* @__PURE__ */ jsxs9(Card, {
3294
+ /* @__PURE__ */ jsxs10(Card, {
2541
3295
  className: dmTableCardClass,
2542
3296
  padding: "md",
2543
3297
  children: [
2544
- name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs9("div", {
3298
+ name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs10("div", {
2545
3299
  className: dmTableHeaderClass,
2546
3300
  children: [
2547
- /* @__PURE__ */ jsx10("div", {
3301
+ /* @__PURE__ */ jsx11("div", {
2548
3302
  className: dmTableTitleClass,
2549
3303
  children: name
2550
3304
  }),
2551
- /* @__PURE__ */ jsxs9("div", {
3305
+ /* @__PURE__ */ jsxs10("div", {
2552
3306
  className: dmTableExtraClass,
2553
3307
  children: [
2554
3308
  extra,
2555
- columnSettingVisible ? /* @__PURE__ */ jsx10(Button, {
3309
+ columnSettingVisible ? /* @__PURE__ */ jsx11(Button, {
2556
3310
  type: "button",
2557
3311
  color: "secondary",
2558
3312
  appearance: "outline",
@@ -2564,20 +3318,20 @@ function DmTable({
2564
3318
  })
2565
3319
  ]
2566
3320
  }) : null,
2567
- columnSettingsOpen ? /* @__PURE__ */ jsx10("div", {
3321
+ columnSettingsOpen ? /* @__PURE__ */ jsx11("div", {
2568
3322
  role: "dialog",
2569
3323
  "aria-label": "Column settings",
2570
- children: /* @__PURE__ */ jsx10(Button, {
3324
+ children: /* @__PURE__ */ jsx11(Button, {
2571
3325
  type: "button",
2572
3326
  onClick: resetColumns,
2573
3327
  children: "Reset columns"
2574
3328
  })
2575
3329
  }) : null,
2576
- tableExtra ? /* @__PURE__ */ jsx10("div", {
3330
+ tableExtra ? /* @__PURE__ */ jsx11("div", {
2577
3331
  className: dmTableTableExtraClass,
2578
3332
  children: tableExtra
2579
3333
  }) : null,
2580
- /* @__PURE__ */ jsx10(Table, {
3334
+ /* @__PURE__ */ jsx11(Table, {
2581
3335
  ...props,
2582
3336
  dataSource,
2583
3337
  rowSelection,
@@ -2593,7 +3347,7 @@ function DmTable({
2593
3347
  onChange: paginationObj?.onChange
2594
3348
  } : false
2595
3349
  }),
2596
- pagination ? /* @__PURE__ */ jsx10(DmPagination, {
3350
+ pagination ? /* @__PURE__ */ jsx11(DmPagination, {
2597
3351
  ...paginationProps,
2598
3352
  className: dmTablePaginationClass,
2599
3353
  total,