@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
@@ -35,6 +35,10 @@ function getDmProTableClasses({ className }) {
35
35
  return cn(dmProTableBaseClass, className);
36
36
  }
37
37
 
38
+ // src/components/button/Button.tsx
39
+ import React from "react";
40
+ import { createPortal } from "react-dom";
41
+
38
42
  // src/classes/button.ts
39
43
  var buttonBaseClass = "btn";
40
44
  var buttonColorClasses = {
@@ -58,7 +62,7 @@ var buttonAppearanceClasses = {
58
62
  };
59
63
  var buttonShapeClasses = {
60
64
  rect: "",
61
- circle: "btn-circle",
65
+ circle: "btn-circle btn-icon",
62
66
  square: "btn-square"
63
67
  };
64
68
  var buttonSizeClasses = {
@@ -78,11 +82,14 @@ function getButtonClasses({
78
82
  isLoading,
79
83
  className
80
84
  }) {
81
- return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
85
+ 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);
82
86
  }
83
87
 
84
88
  // src/components/button/Button.tsx
85
- import { jsx, jsxs } from "react/jsx-runtime";
89
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
90
+ function isPromiseLike(value) {
91
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
92
+ }
86
93
  function Button({
87
94
  color = "primary",
88
95
  appearance = "filled",
@@ -96,8 +103,155 @@ function Button({
96
103
  children,
97
104
  disabled,
98
105
  ref,
106
+ confirm,
107
+ onClick,
99
108
  ...props
100
109
  }) {
110
+ const buttonRef = React.useRef(null);
111
+ const popoverRef = React.useRef(null);
112
+ const cancelRef = React.useRef(null);
113
+ const approvalRef = React.useRef("idle");
114
+ const pendingRef = React.useRef(false);
115
+ const actionRef = React.useRef(0);
116
+ const operationRef = React.useRef(0);
117
+ const mountedRef = React.useRef(false);
118
+ const [portalTarget, setPortalTarget] = React.useState(null);
119
+ const [confirmLoading, setConfirmLoading] = React.useState(false);
120
+ const [confirmError, setConfirmError] = React.useState(false);
121
+ const generatedId = React.useId().replace(/:/g, "");
122
+ const popoverId = `button-confirm-${generatedId}`;
123
+ const titleId = `${popoverId}-title`;
124
+ const descriptionId = `${popoverId}-description`;
125
+ const anchor = `--${popoverId}-anchor`;
126
+ const hasConfirm = Boolean(confirm);
127
+ const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
128
+ const title = confirmation ? confirmation.title : "Confirm action";
129
+ const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
130
+ const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
131
+ const hasContent = content !== undefined && content !== null && content !== false && content !== "";
132
+ const mergedRef = React.useCallback((node) => {
133
+ buttonRef.current = node;
134
+ if (!node) {
135
+ if (typeof ref === "function")
136
+ ref(null);
137
+ else if (ref)
138
+ ref.current = null;
139
+ return;
140
+ }
141
+ const cleanup = typeof ref === "function" ? ref(node) : undefined;
142
+ if (ref && typeof ref !== "function")
143
+ ref.current = node;
144
+ return () => {
145
+ buttonRef.current = null;
146
+ if (typeof cleanup === "function")
147
+ cleanup();
148
+ else if (typeof ref === "function")
149
+ ref(null);
150
+ else if (ref)
151
+ ref.current = null;
152
+ };
153
+ }, [ref]);
154
+ React.useEffect(() => {
155
+ mountedRef.current = true;
156
+ return () => {
157
+ mountedRef.current = false;
158
+ operationRef.current += 1;
159
+ };
160
+ }, []);
161
+ React.useEffect(() => {
162
+ operationRef.current += 1;
163
+ approvalRef.current = "idle";
164
+ setConfirmError(false);
165
+ setPortalTarget(hasConfirm ? document.body : null);
166
+ }, [hasConfirm]);
167
+ function closePopover() {
168
+ if (popoverRef.current?.matches(":popover-open")) {
169
+ popoverRef.current.hidePopover();
170
+ }
171
+ buttonRef.current?.focus();
172
+ }
173
+ function handleClick(event) {
174
+ if (!confirm) {
175
+ onClick?.(event);
176
+ return;
177
+ }
178
+ if (approvalRef.current === "native") {
179
+ approvalRef.current = "idle";
180
+ return;
181
+ }
182
+ if (approvalRef.current === "action") {
183
+ approvalRef.current = "idle";
184
+ let result;
185
+ try {
186
+ result = onClick?.(event);
187
+ } catch {
188
+ event.preventDefault();
189
+ pendingRef.current = false;
190
+ setConfirmError(true);
191
+ return;
192
+ }
193
+ if (!isPromiseLike(result)) {
194
+ pendingRef.current = false;
195
+ closePopover();
196
+ return;
197
+ }
198
+ const userPreventedDefault = event.defaultPrevented;
199
+ event.preventDefault();
200
+ setConfirmLoading(true);
201
+ const action = actionRef.current;
202
+ const operation = operationRef.current;
203
+ Promise.resolve(result).then(() => {
204
+ if (!mountedRef.current || action !== actionRef.current)
205
+ return;
206
+ pendingRef.current = false;
207
+ setConfirmLoading(false);
208
+ if (operation !== operationRef.current)
209
+ return;
210
+ closePopover();
211
+ if (!userPreventedDefault && !buttonRef.current?.disabled) {
212
+ approvalRef.current = "native";
213
+ buttonRef.current?.click();
214
+ approvalRef.current = "idle";
215
+ }
216
+ }, () => {
217
+ if (!mountedRef.current || action !== actionRef.current)
218
+ return;
219
+ pendingRef.current = false;
220
+ setConfirmLoading(false);
221
+ if (operation !== operationRef.current)
222
+ return;
223
+ setConfirmError(true);
224
+ cancelRef.current?.focus();
225
+ });
226
+ return;
227
+ }
228
+ event.preventDefault();
229
+ if (disabled || isLoading || pendingRef.current)
230
+ return;
231
+ if (popoverRef.current?.matches(":popover-open")) {
232
+ closePopover();
233
+ return;
234
+ }
235
+ setConfirmError(false);
236
+ popoverRef.current?.showPopover();
237
+ cancelRef.current?.focus();
238
+ }
239
+ function handleConfirm(event) {
240
+ event.preventDefault();
241
+ event.stopPropagation();
242
+ const trigger = buttonRef.current;
243
+ if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
244
+ return;
245
+ setConfirmError(false);
246
+ pendingRef.current = true;
247
+ actionRef.current += 1;
248
+ approvalRef.current = "action";
249
+ trigger.click();
250
+ if (approvalRef.current === "action") {
251
+ approvalRef.current = "idle";
252
+ pendingRef.current = false;
253
+ }
254
+ }
101
255
  const classes = getButtonClasses({
102
256
  color,
103
257
  appearance,
@@ -107,34 +261,109 @@ function Button({
107
261
  isLoading,
108
262
  className
109
263
  });
110
- return /* @__PURE__ */ jsxs("button", {
111
- ref,
112
- className: classes,
113
- disabled: disabled || isLoading,
114
- "aria-busy": isLoading,
115
- "aria-disabled": disabled || isLoading,
116
- ...props,
264
+ const confirmClasses = getButtonClasses({
265
+ color,
266
+ size: "sm",
267
+ isLoading: confirmLoading
268
+ });
269
+ return /* @__PURE__ */ jsxs(Fragment, {
117
270
  children: [
118
- isLoading && /* @__PURE__ */ jsx("span", {
119
- className: "btn-spinner"
120
- }),
121
- !isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
122
- className: "btn-icon-left",
123
- children: leftIcon
124
- }),
125
- /* @__PURE__ */ jsx("span", {
126
- className: "btn-content",
127
- children
271
+ /* @__PURE__ */ jsxs("button", {
272
+ ref: confirm ? mergedRef : ref,
273
+ className: classes,
274
+ disabled: disabled || isLoading,
275
+ "aria-busy": isLoading,
276
+ "aria-disabled": disabled || isLoading,
277
+ ...props,
278
+ style: confirm ? { ...props.style, anchorName: anchor } : props.style,
279
+ "aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
280
+ "aria-controls": confirm ? popoverId : props["aria-controls"],
281
+ onClick: confirm ? handleClick : onClick,
282
+ children: [
283
+ isLoading && /* @__PURE__ */ jsx("span", {
284
+ className: "btn-spinner"
285
+ }),
286
+ !isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
287
+ className: "btn-icon-left",
288
+ children: leftIcon
289
+ }),
290
+ /* @__PURE__ */ jsx("span", {
291
+ className: "btn-content",
292
+ children
293
+ }),
294
+ !isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
295
+ className: "btn-icon-right",
296
+ children: rightIcon
297
+ })
298
+ ]
128
299
  }),
129
- !isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
130
- className: "btn-icon-right",
131
- children: rightIcon
132
- })
300
+ confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs("form", {
301
+ id: popoverId,
302
+ ref: popoverRef,
303
+ popover: "auto",
304
+ role: "dialog",
305
+ "aria-labelledby": hasTitle ? titleId : undefined,
306
+ "aria-label": hasTitle ? undefined : "Confirm action",
307
+ "aria-describedby": hasContent ? descriptionId : undefined,
308
+ className: "popover popover-confirm popover-bottom",
309
+ style: { positionAnchor: anchor },
310
+ onSubmit: handleConfirm,
311
+ onClick: (event) => event.stopPropagation(),
312
+ onToggle: (event) => {
313
+ if (!event.currentTarget.matches(":popover-open")) {
314
+ operationRef.current += 1;
315
+ if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
316
+ buttonRef.current?.focus();
317
+ }
318
+ }
319
+ },
320
+ children: [
321
+ hasTitle && /* @__PURE__ */ jsx("div", {
322
+ className: "popover-header",
323
+ children: /* @__PURE__ */ jsx("h3", {
324
+ id: titleId,
325
+ className: "popover-title",
326
+ children: title
327
+ })
328
+ }),
329
+ hasContent && /* @__PURE__ */ jsx("div", {
330
+ id: descriptionId,
331
+ className: "popover-body",
332
+ children: content
333
+ }),
334
+ confirmError && /* @__PURE__ */ jsx("div", {
335
+ role: "alert",
336
+ className: "popover-body",
337
+ children: "The action failed. Please try again."
338
+ }),
339
+ /* @__PURE__ */ jsxs("div", {
340
+ className: "popover-footer",
341
+ children: [
342
+ /* @__PURE__ */ jsx("button", {
343
+ ref: cancelRef,
344
+ type: "button",
345
+ className: "btn btn-text btn-sm",
346
+ popoverTarget: popoverId,
347
+ popoverTargetAction: "hide",
348
+ disabled: confirmLoading,
349
+ children: confirmation?.cancelText ?? "Cancel"
350
+ }),
351
+ /* @__PURE__ */ jsx("button", {
352
+ type: "submit",
353
+ className: confirmClasses,
354
+ disabled: disabled || isLoading || confirmLoading,
355
+ "aria-busy": confirmLoading,
356
+ children: confirmation?.confirmText ?? "Confirm"
357
+ })
358
+ ]
359
+ })
360
+ ]
361
+ }), portalTarget)
133
362
  ]
134
363
  });
135
364
  }
136
365
  // src/components/dm-table/DmTable.tsx
137
- import { useMemo as useMemo7, useState as useState8 } from "react";
366
+ import { useMemo as useMemo8, useState as useState10 } from "react";
138
367
 
139
368
  // src/classes/dm-table.ts
140
369
  var dmTableBaseClass = "dm-table";
@@ -635,11 +864,11 @@ var DmPagination = forwardRef2(({
635
864
  DmPagination.displayName = "DmPagination";
636
865
  // src/components/dm-search/DmSearch.tsx
637
866
  import {
638
- forwardRef as forwardRef6,
639
- useEffect as useEffect2,
640
- useImperativeHandle as useImperativeHandle2,
641
- useMemo as useMemo5,
642
- useState as useState6
867
+ forwardRef as forwardRef7,
868
+ useEffect as useEffect3,
869
+ useImperativeHandle as useImperativeHandle3,
870
+ useMemo as useMemo6,
871
+ useState as useState8
643
872
  } from "react";
644
873
 
645
874
  // src/classes/dm-search.ts
@@ -659,8 +888,425 @@ function getDmSearchClasses({
659
888
  }
660
889
 
661
890
  // src/components/date-picker/DatePicker.tsx
891
+ import { forwardRef as forwardRef4, useMemo as useMemo4, useState as useState5 } from "react";
892
+
893
+ // src/components/calendar/Calendar.tsx
662
894
  import { forwardRef as forwardRef3, useMemo as useMemo3, useState as useState3 } from "react";
663
895
 
896
+ // src/classes/calendar.ts
897
+ var calendarBaseClass = "datepicker calendar";
898
+ var calendarHeaderClass = "calendar-header";
899
+ var calendarTitleClass = "calendar-title";
900
+ var calendarControlsClass = "calendar-controls";
901
+ var calendarNavClass = "calendar-nav";
902
+ var calendarModeClass = "calendar-mode";
903
+ var calendarWeekdaysClass = "calendar-weekdays";
904
+ var calendarWeekdayClass = "calendar-weekday";
905
+ var calendarBodyClass = "calendar-body";
906
+ var calendarDateGridClass = "calendar-date-grid";
907
+ var calendarMonthGridClass = "calendar-month-grid";
908
+ var calendarCellContentClass = "calendar-cell-content";
909
+ function getCalendarClasses({
910
+ fullscreen = true,
911
+ mode = "month",
912
+ className
913
+ }) {
914
+ return cn(calendarBaseClass, fullscreen ? "calendar-fullscreen" : "calendar-card", mode === "year" && "calendar-year-mode", className);
915
+ }
916
+ function getCalendarCellClasses({
917
+ selected,
918
+ today,
919
+ outside,
920
+ disabled,
921
+ className
922
+ }) {
923
+ return cn("calendar-cell", selected && "calendar-cell-selected", today && "calendar-cell-today", outside && "calendar-cell-outside", disabled && "calendar-cell-disabled", className);
924
+ }
925
+
926
+ // src/components/calendar/Calendar.tsx
927
+ import { jsx as jsx5, jsxs as jsxs4, Fragment as Fragment2 } from "react/jsx-runtime";
928
+ var WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
929
+ var MONTHS = [
930
+ "Jan",
931
+ "Feb",
932
+ "Mar",
933
+ "Apr",
934
+ "May",
935
+ "Jun",
936
+ "Jul",
937
+ "Aug",
938
+ "Sep",
939
+ "Oct",
940
+ "Nov",
941
+ "Dec"
942
+ ];
943
+ function pad(value) {
944
+ return String(value).padStart(2, "0");
945
+ }
946
+ function formatDate(date) {
947
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
948
+ }
949
+ function formatMonth(date) {
950
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-01`;
951
+ }
952
+ function parseDate(value) {
953
+ if (value instanceof Date && !Number.isNaN(value.getTime())) {
954
+ return new Date(value.getFullYear(), value.getMonth(), value.getDate());
955
+ }
956
+ if (typeof value === "string" && value.length > 0) {
957
+ const [year, month = "1", day = "1"] = value.split("-");
958
+ const parsed = new Date(Number(year), Number(month) - 1, Number(day));
959
+ if (!Number.isNaN(parsed.getTime())) {
960
+ return parsed;
961
+ }
962
+ }
963
+ const today = new Date;
964
+ return new Date(today.getFullYear(), today.getMonth(), today.getDate());
965
+ }
966
+ function addMonths(date, amount) {
967
+ return new Date(date.getFullYear(), date.getMonth() + amount, 1);
968
+ }
969
+ function addYears(date, amount) {
970
+ return new Date(date.getFullYear() + amount, date.getMonth(), 1);
971
+ }
972
+ function startOfCalendarGrid(panelDate) {
973
+ const firstOfMonth = new Date(panelDate.getFullYear(), panelDate.getMonth(), 1);
974
+ const start = new Date(firstOfMonth);
975
+ start.setDate(firstOfMonth.getDate() - firstOfMonth.getDay());
976
+ return start;
977
+ }
978
+ function buildDateGrid(panelDate) {
979
+ const start = startOfCalendarGrid(panelDate);
980
+ return Array.from({ length: 42 }, (_, index) => {
981
+ const date = new Date(start);
982
+ date.setDate(start.getDate() + index);
983
+ return date;
984
+ });
985
+ }
986
+ function isSameMonth(left, right) {
987
+ return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth();
988
+ }
989
+ function isOutsideRange(date, validRange) {
990
+ if (!validRange) {
991
+ return false;
992
+ }
993
+ const current = formatDate(date);
994
+ const start = formatDate(parseDate(validRange[0]));
995
+ const end = formatDate(parseDate(validRange[1]));
996
+ return current < start || current > end;
997
+ }
998
+ function Header({
999
+ panelDate,
1000
+ mode,
1001
+ setPanelDate,
1002
+ setMode
1003
+ }) {
1004
+ const title = mode === "year" ? String(panelDate.getFullYear()) : `${MONTHS[panelDate.getMonth()]} ${panelDate.getFullYear()}`;
1005
+ return /* @__PURE__ */ jsxs4("div", {
1006
+ className: calendarHeaderClass,
1007
+ children: [
1008
+ /* @__PURE__ */ jsx5("button", {
1009
+ type: "button",
1010
+ className: calendarNavClass,
1011
+ "aria-label": "Previous panel",
1012
+ onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, -1) : addMonths(panelDate, -1), mode),
1013
+ children: /* @__PURE__ */ jsx5("svg", {
1014
+ "aria-hidden": "true",
1015
+ focusable: "false",
1016
+ width: "16",
1017
+ height: "16",
1018
+ viewBox: "0 0 24 24",
1019
+ fill: "none",
1020
+ stroke: "currentColor",
1021
+ strokeWidth: "2",
1022
+ strokeLinecap: "round",
1023
+ strokeLinejoin: "round",
1024
+ children: /* @__PURE__ */ jsx5("path", {
1025
+ d: "m15 18-6-6 6-6"
1026
+ })
1027
+ })
1028
+ }),
1029
+ /* @__PURE__ */ jsxs4("div", {
1030
+ className: calendarControlsClass,
1031
+ children: [
1032
+ /* @__PURE__ */ jsx5("div", {
1033
+ className: calendarTitleClass,
1034
+ children: title
1035
+ }),
1036
+ /* @__PURE__ */ jsxs4("div", {
1037
+ className: calendarModeClass,
1038
+ children: [
1039
+ /* @__PURE__ */ jsx5("button", {
1040
+ type: "button",
1041
+ "aria-pressed": mode === "month",
1042
+ onClick: () => setMode("month"),
1043
+ children: "Month"
1044
+ }),
1045
+ /* @__PURE__ */ jsx5("button", {
1046
+ type: "button",
1047
+ "aria-pressed": mode === "year",
1048
+ onClick: () => setMode("year"),
1049
+ children: "Year"
1050
+ })
1051
+ ]
1052
+ })
1053
+ ]
1054
+ }),
1055
+ /* @__PURE__ */ jsx5("button", {
1056
+ type: "button",
1057
+ className: calendarNavClass,
1058
+ "aria-label": "Next panel",
1059
+ onClick: () => setPanelDate(mode === "year" ? addYears(panelDate, 1) : addMonths(panelDate, 1), mode),
1060
+ children: /* @__PURE__ */ jsx5("svg", {
1061
+ "aria-hidden": "true",
1062
+ focusable: "false",
1063
+ width: "16",
1064
+ height: "16",
1065
+ viewBox: "0 0 24 24",
1066
+ fill: "none",
1067
+ stroke: "currentColor",
1068
+ strokeWidth: "2",
1069
+ strokeLinecap: "round",
1070
+ strokeLinejoin: "round",
1071
+ children: /* @__PURE__ */ jsx5("path", {
1072
+ d: "m9 18 6-6-6-6"
1073
+ })
1074
+ })
1075
+ })
1076
+ ]
1077
+ });
1078
+ }
1079
+ var Calendar = forwardRef3(({
1080
+ className,
1081
+ value,
1082
+ defaultValue,
1083
+ mode,
1084
+ defaultMode = "month",
1085
+ fullscreen = true,
1086
+ validRange,
1087
+ disabledDate,
1088
+ dateCellRender,
1089
+ dateFullCellRender,
1090
+ monthCellRender,
1091
+ monthFullCellRender,
1092
+ cellRender,
1093
+ fullCellRender,
1094
+ headerRender,
1095
+ onChange,
1096
+ onSelect,
1097
+ onPanelChange,
1098
+ ...props
1099
+ }, ref) => {
1100
+ const selectedDate = parseDate(value ?? defaultValue);
1101
+ const [innerValue, setInnerValue] = useState3(() => formatDate(selectedDate));
1102
+ const [panelDate, setInnerPanelDate] = useState3(selectedDate);
1103
+ const [innerMode, setInnerMode] = useState3(mode ?? defaultMode);
1104
+ const currentMode = mode ?? innerMode;
1105
+ const currentValue = value === undefined ? innerValue : formatDate(parseDate(value));
1106
+ const today = useMemo3(() => formatDate(new Date), []);
1107
+ const dateGrid = useMemo3(() => buildDateGrid(panelDate), [panelDate]);
1108
+ function emitPanelChange(nextDate, nextMode = currentMode) {
1109
+ setInnerPanelDate(nextDate);
1110
+ onPanelChange?.(formatDate(nextDate), nextMode);
1111
+ }
1112
+ function setCalendarMode(nextMode) {
1113
+ if (mode === undefined) {
1114
+ setInnerMode(nextMode);
1115
+ }
1116
+ onPanelChange?.(formatDate(panelDate), nextMode);
1117
+ }
1118
+ function commitValue(nextDate, source) {
1119
+ const nextValue = source === "month" ? formatMonth(nextDate) : formatDate(nextDate);
1120
+ if (disabledDate?.(nextValue) || isOutsideRange(nextDate, validRange)) {
1121
+ return;
1122
+ }
1123
+ if (value === undefined) {
1124
+ setInnerValue(nextValue);
1125
+ }
1126
+ setInnerPanelDate(nextDate);
1127
+ onSelect?.(nextValue, { source });
1128
+ onChange?.(nextValue);
1129
+ }
1130
+ function renderDateCell(date) {
1131
+ const dateValue = formatDate(date);
1132
+ const originNode = /* @__PURE__ */ jsxs4("div", {
1133
+ className: calendarCellContentClass,
1134
+ children: [
1135
+ /* @__PURE__ */ jsx5("span", {
1136
+ children: date.getDate()
1137
+ }),
1138
+ dateCellRender?.(dateValue)
1139
+ ]
1140
+ });
1141
+ const info = {
1142
+ originNode,
1143
+ today,
1144
+ type: "month"
1145
+ };
1146
+ const content = fullCellRender?.(dateValue, info) ?? dateFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
1147
+ const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
1148
+ return /* @__PURE__ */ jsx5("button", {
1149
+ type: "button",
1150
+ "aria-label": dateValue,
1151
+ disabled,
1152
+ className: getCalendarCellClasses({
1153
+ selected: dateValue === currentValue,
1154
+ today: dateValue === today,
1155
+ outside: !isSameMonth(date, panelDate),
1156
+ disabled
1157
+ }),
1158
+ onClick: () => commitValue(date, "date"),
1159
+ children: content
1160
+ }, dateValue);
1161
+ }
1162
+ function renderMonthCell(month) {
1163
+ const date = new Date(panelDate.getFullYear(), month, 1);
1164
+ const dateValue = formatMonth(date);
1165
+ const originNode = /* @__PURE__ */ jsxs4("div", {
1166
+ className: calendarCellContentClass,
1167
+ children: [
1168
+ /* @__PURE__ */ jsx5("span", {
1169
+ children: MONTHS[month]
1170
+ }),
1171
+ monthCellRender?.(dateValue)
1172
+ ]
1173
+ });
1174
+ const info = {
1175
+ originNode,
1176
+ today,
1177
+ type: "year"
1178
+ };
1179
+ const content = fullCellRender?.(dateValue, info) ?? monthFullCellRender?.(dateValue) ?? cellRender?.(dateValue, info) ?? originNode;
1180
+ const disabled = disabledDate?.(dateValue) || isOutsideRange(date, validRange);
1181
+ return /* @__PURE__ */ jsx5("button", {
1182
+ type: "button",
1183
+ "aria-label": dateValue,
1184
+ disabled,
1185
+ className: getCalendarCellClasses({
1186
+ selected: dateValue === formatMonth(parseDate(currentValue)),
1187
+ today: dateValue === formatMonth(new Date),
1188
+ disabled
1189
+ }),
1190
+ onClick: () => commitValue(date, "month"),
1191
+ children: content
1192
+ }, dateValue);
1193
+ }
1194
+ return /* @__PURE__ */ jsxs4("div", {
1195
+ ...props,
1196
+ ref,
1197
+ className: getCalendarClasses({
1198
+ fullscreen,
1199
+ mode: currentMode,
1200
+ className
1201
+ }),
1202
+ children: [
1203
+ headerRender ? headerRender({
1204
+ value: formatDate(panelDate),
1205
+ type: currentMode,
1206
+ onChange: (nextValue) => emitPanelChange(parseDate(nextValue)),
1207
+ onTypeChange: setCalendarMode
1208
+ }) : /* @__PURE__ */ jsx5(Header, {
1209
+ panelDate,
1210
+ mode: currentMode,
1211
+ setPanelDate: emitPanelChange,
1212
+ setMode: setCalendarMode
1213
+ }),
1214
+ /* @__PURE__ */ jsx5("div", {
1215
+ className: calendarBodyClass,
1216
+ children: currentMode === "month" ? /* @__PURE__ */ jsxs4(Fragment2, {
1217
+ children: [
1218
+ /* @__PURE__ */ jsx5("div", {
1219
+ className: calendarWeekdaysClass,
1220
+ "aria-hidden": "true",
1221
+ children: WEEKDAYS.map((weekday) => /* @__PURE__ */ jsx5("span", {
1222
+ className: calendarWeekdayClass,
1223
+ children: weekday
1224
+ }, weekday))
1225
+ }),
1226
+ /* @__PURE__ */ jsx5("div", {
1227
+ className: calendarDateGridClass,
1228
+ children: dateGrid.map(renderDateCell)
1229
+ })
1230
+ ]
1231
+ }) : /* @__PURE__ */ jsx5("div", {
1232
+ className: calendarMonthGridClass,
1233
+ children: MONTHS.map((_, month) => renderMonthCell(month))
1234
+ })
1235
+ })
1236
+ ]
1237
+ });
1238
+ });
1239
+ Calendar.displayName = "Calendar";
1240
+ // src/components/date-picker/usePickerDropdown.ts
1241
+ import { useEffect as useEffect2, useId, useImperativeHandle, useRef as useRef2, useState as useState4 } from "react";
1242
+ function usePickerDropdown({
1243
+ open,
1244
+ defaultOpen,
1245
+ disabled,
1246
+ onOpenChange,
1247
+ ref
1248
+ }) {
1249
+ const rootRef = useRef2(null);
1250
+ const inputRef = useRef2(null);
1251
+ const skipFocus = useRef2(false);
1252
+ const panelId = useId();
1253
+ const [innerOpen, setInnerOpen] = useState4(Boolean(defaultOpen));
1254
+ const visible = !disabled && (open ?? innerOpen);
1255
+ useImperativeHandle(ref, () => rootRef.current, []);
1256
+ function setVisible(next) {
1257
+ if (disabled || next === visible)
1258
+ return;
1259
+ if (open === undefined)
1260
+ setInnerOpen(next);
1261
+ onOpenChange?.(next);
1262
+ }
1263
+ function closeAndFocus() {
1264
+ skipFocus.current = true;
1265
+ inputRef.current?.focus();
1266
+ skipFocus.current = false;
1267
+ setVisible(false);
1268
+ }
1269
+ useEffect2(() => {
1270
+ function handleOutside(event) {
1271
+ if (visible && !rootRef.current?.contains(event.target))
1272
+ setVisible(false);
1273
+ }
1274
+ function handleKeyDown(event) {
1275
+ if (event.defaultPrevented || !rootRef.current?.contains(event.target))
1276
+ return;
1277
+ if (event.key === "Escape" && visible) {
1278
+ event.preventDefault();
1279
+ closeAndFocus();
1280
+ } else if (event.key === "ArrowDown" && event.target === inputRef.current) {
1281
+ event.preventDefault();
1282
+ setVisible(true);
1283
+ }
1284
+ }
1285
+ document.addEventListener("pointerdown", handleOutside);
1286
+ document.addEventListener("keydown", handleKeyDown);
1287
+ return () => {
1288
+ document.removeEventListener("pointerdown", handleOutside);
1289
+ document.removeEventListener("keydown", handleKeyDown);
1290
+ };
1291
+ });
1292
+ return {
1293
+ rootRef,
1294
+ inputRef,
1295
+ panelId,
1296
+ visible,
1297
+ setVisible,
1298
+ closeAndFocus,
1299
+ onInputFocus: () => {
1300
+ if (!skipFocus.current)
1301
+ setVisible(true);
1302
+ },
1303
+ onRootBlur: (event) => {
1304
+ if (!event.currentTarget.contains(event.relatedTarget))
1305
+ setVisible(false);
1306
+ }
1307
+ };
1308
+ }
1309
+
664
1310
  // src/classes/date-picker.ts
665
1311
  var datePickerBaseClass = "datepicker";
666
1312
  var datePickerInputClass = "datepicker-input";
@@ -708,7 +1354,7 @@ function getDatePickerDropdownClasses({
708
1354
  }
709
1355
 
710
1356
  // src/components/date-picker/DatePicker.tsx
711
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1357
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
712
1358
  function todayValue(picker) {
713
1359
  const today = new Date;
714
1360
  const year = today.getFullYear();
@@ -747,9 +1393,10 @@ function placeholderForPicker(picker) {
747
1393
  function normalizeDateValue(value) {
748
1394
  return typeof value === "string" && value.length > 0 ? value : undefined;
749
1395
  }
750
- var DatePickerRoot = forwardRef3(({
1396
+ var DatePickerRoot = forwardRef4(({
751
1397
  allowClear,
752
1398
  className,
1399
+ inputProps,
753
1400
  defaultOpen,
754
1401
  defaultValue,
755
1402
  disabled,
@@ -768,19 +1415,19 @@ var DatePickerRoot = forwardRef3(({
768
1415
  value,
769
1416
  ...props
770
1417
  }, ref) => {
1418
+ const [calendarMode, setCalendarMode] = useState5("month");
771
1419
  const isValueControlled = value !== undefined;
772
- const isOpenControlled = open !== undefined;
773
- const [innerValue, setInnerValue] = useState3(() => normalizeDateValue(defaultValue));
774
- const [innerOpen, setInnerOpen] = useState3(Boolean(defaultOpen));
1420
+ const [innerValue, setInnerValue] = useState5(() => normalizeDateValue(defaultValue));
1421
+ const dropdown = usePickerDropdown({
1422
+ open,
1423
+ defaultOpen,
1424
+ disabled,
1425
+ onOpenChange,
1426
+ ref
1427
+ });
775
1428
  const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
776
- const visible = isOpenControlled ? Boolean(open) : innerOpen;
1429
+ const { visible, setVisible } = dropdown;
777
1430
  const inputType = inputTypeForPicker(picker);
778
- function setVisible(nextOpen) {
779
- if (!isOpenControlled) {
780
- setInnerOpen(nextOpen);
781
- }
782
- onOpenChange?.(nextOpen);
783
- }
784
1431
  function emitChange(nextValue) {
785
1432
  if (nextValue && disabledDate?.(nextValue)) {
786
1433
  return;
@@ -790,10 +1437,17 @@ var DatePickerRoot = forwardRef3(({
790
1437
  }
791
1438
  onChange?.(nextValue, nextValue ?? "");
792
1439
  }
793
- const presetItems = useMemo3(() => presets ?? [], [presets]);
794
- return /* @__PURE__ */ jsxs4("div", {
1440
+ function selectValue(nextValue) {
1441
+ if (disabledDate?.(nextValue))
1442
+ return;
1443
+ emitChange(nextValue);
1444
+ dropdown.closeAndFocus();
1445
+ }
1446
+ const presetItems = useMemo4(() => presets ?? [], [presets]);
1447
+ return /* @__PURE__ */ jsxs5("div", {
795
1448
  ...props,
796
- ref,
1449
+ ref: dropdown.rootRef,
1450
+ onBlur: dropdown.onRootBlur,
797
1451
  className: getDatePickerClasses({
798
1452
  size,
799
1453
  status,
@@ -803,7 +1457,11 @@ var DatePickerRoot = forwardRef3(({
803
1457
  className
804
1458
  }),
805
1459
  children: [
806
- /* @__PURE__ */ jsx5("input", {
1460
+ /* @__PURE__ */ jsx6("input", {
1461
+ ...inputProps,
1462
+ ref: dropdown.inputRef,
1463
+ "aria-haspopup": "dialog",
1464
+ "aria-controls": visible ? dropdown.panelId : undefined,
807
1465
  className: datePickerInputClass,
808
1466
  disabled,
809
1467
  type: inputType,
@@ -811,15 +1469,15 @@ var DatePickerRoot = forwardRef3(({
811
1469
  placeholder: placeholder ?? placeholderForPicker(picker),
812
1470
  onFocus: (event) => {
813
1471
  onFocus?.(event);
814
- setVisible(true);
1472
+ dropdown.onInputFocus();
815
1473
  },
816
1474
  onBlur: (event) => {
817
1475
  onBlur?.(event);
818
- setVisible(false);
819
1476
  },
1477
+ onClick: () => setVisible(true),
820
1478
  onChange: (event) => emitChange(event.currentTarget.value || undefined)
821
1479
  }),
822
- allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx5("button", {
1480
+ allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx6("button", {
823
1481
  type: "button",
824
1482
  className: datePickerClearClass,
825
1483
  "aria-label": "Clear date",
@@ -827,26 +1485,95 @@ var DatePickerRoot = forwardRef3(({
827
1485
  onClick: () => emitChange(undefined),
828
1486
  children: "x"
829
1487
  }) : null,
830
- /* @__PURE__ */ jsx5("span", {
1488
+ /* @__PURE__ */ jsx6("button", {
1489
+ type: "button",
831
1490
  className: datePickerIconClass,
832
- "aria-hidden": "true"
1491
+ "aria-label": "Open date picker",
1492
+ "aria-haspopup": "dialog",
1493
+ "aria-expanded": visible,
1494
+ "aria-controls": visible ? dropdown.panelId : undefined,
1495
+ disabled,
1496
+ onMouseDown: (event) => event.preventDefault(),
1497
+ onClick: () => setVisible(!visible),
1498
+ children: /* @__PURE__ */ jsxs5("svg", {
1499
+ "aria-hidden": "true",
1500
+ focusable: "false",
1501
+ width: "18",
1502
+ height: "18",
1503
+ viewBox: "0 0 24 24",
1504
+ fill: "none",
1505
+ stroke: "currentColor",
1506
+ strokeWidth: "1.75",
1507
+ strokeLinecap: "round",
1508
+ strokeLinejoin: "round",
1509
+ children: [
1510
+ /* @__PURE__ */ jsx6("rect", {
1511
+ x: "3",
1512
+ y: "5",
1513
+ width: "18",
1514
+ height: "16",
1515
+ rx: "2"
1516
+ }),
1517
+ /* @__PURE__ */ jsx6("path", {
1518
+ d: "M8 3v4M16 3v4M3 10h18"
1519
+ })
1520
+ ]
1521
+ })
833
1522
  }),
834
- (presetItems.length > 0 || showNow) && visible ? /* @__PURE__ */ jsxs4("div", {
1523
+ visible ? /* @__PURE__ */ jsxs5("div", {
1524
+ id: dropdown.panelId,
1525
+ role: "dialog",
1526
+ "aria-label": "Choose date",
835
1527
  className: getDatePickerDropdownClasses({ open: visible }),
836
1528
  children: [
837
- presetItems.map((preset, index) => /* @__PURE__ */ jsx5("button", {
1529
+ picker === "date" || picker === "month" ? /* @__PURE__ */ jsx6(Calendar, {
1530
+ fullscreen: false,
1531
+ value: currentValue,
1532
+ mode: picker === "month" ? "year" : calendarMode,
1533
+ onPanelChange: (_, mode) => {
1534
+ if (picker === "date")
1535
+ setCalendarMode(mode);
1536
+ },
1537
+ disabledDate: (date) => {
1538
+ if (!disabledDate)
1539
+ return false;
1540
+ if (picker === "month")
1541
+ return disabledDate(date.slice(0, 7));
1542
+ if (calendarMode === "year") {
1543
+ const [year, month] = date.split("-").map(Number);
1544
+ const days = new Date(year, month, 0).getDate();
1545
+ return Array.from({ length: days }, (_, index) => `${date.slice(0, 7)}-${String(index + 1).padStart(2, "0")}`).every((day) => disabledDate(day));
1546
+ }
1547
+ return disabledDate(date);
1548
+ },
1549
+ onSelect: (date, info) => {
1550
+ if (picker === "date" && info.source === "month") {
1551
+ setCalendarMode("month");
1552
+ return;
1553
+ }
1554
+ selectValue(picker === "month" ? date.slice(0, 7) : date);
1555
+ }
1556
+ }) : /* @__PURE__ */ jsx6("input", {
1557
+ type: inputType,
1558
+ "aria-label": placeholderForPicker(picker),
1559
+ value: currentValue ?? "",
1560
+ onChange: (event) => selectValue(event.currentTarget.value)
1561
+ }),
1562
+ presetItems.map((preset, index) => /* @__PURE__ */ jsx6("button", {
838
1563
  type: "button",
839
1564
  className: datePickerPresetClass,
840
1565
  onMouseDown: (event) => event.preventDefault(),
841
- onClick: () => emitChange(preset.value),
1566
+ disabled: Boolean(disabledDate?.(preset.value)),
1567
+ onClick: () => selectValue(preset.value),
842
1568
  children: preset.label
843
1569
  }, index)),
844
- showNow ? /* @__PURE__ */ jsx5("div", {
1570
+ showNow ? /* @__PURE__ */ jsx6("div", {
845
1571
  className: datePickerFooterClass,
846
- children: /* @__PURE__ */ jsx5("button", {
1572
+ children: /* @__PURE__ */ jsx6("button", {
847
1573
  type: "button",
848
1574
  onMouseDown: (event) => event.preventDefault(),
849
- onClick: () => emitChange(todayValue(picker)),
1575
+ disabled: Boolean(disabledDate?.(todayValue(picker))),
1576
+ onClick: () => selectValue(todayValue(picker)),
850
1577
  children: "Now"
851
1578
  })
852
1579
  }) : null
@@ -856,9 +1583,10 @@ var DatePickerRoot = forwardRef3(({
856
1583
  });
857
1584
  });
858
1585
  DatePickerRoot.displayName = "DatePicker";
859
- var RangePicker = forwardRef3(({
1586
+ var RangePicker = forwardRef4(({
860
1587
  allowClear,
861
1588
  className,
1589
+ inputProps,
862
1590
  defaultValue,
863
1591
  disabled,
864
1592
  disabledDate,
@@ -872,7 +1600,7 @@ var RangePicker = forwardRef3(({
872
1600
  ...props
873
1601
  }, ref) => {
874
1602
  const isControlled = value !== undefined;
875
- const [innerValue, setInnerValue] = useState3(defaultValue ?? [undefined, undefined]);
1603
+ const [innerValue, setInnerValue] = useState5(defaultValue ?? [undefined, undefined]);
876
1604
  const currentValue = isControlled ? value : innerValue;
877
1605
  const inputType = inputTypeForPicker(picker);
878
1606
  function emitChange(nextValue) {
@@ -887,7 +1615,7 @@ var RangePicker = forwardRef3(({
887
1615
  function updateIndex(index, nextItem) {
888
1616
  emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
889
1617
  }
890
- return /* @__PURE__ */ jsxs4("div", {
1618
+ return /* @__PURE__ */ jsxs5("div", {
891
1619
  ...props,
892
1620
  ref,
893
1621
  className: getDatePickerClasses({
@@ -899,7 +1627,8 @@ var RangePicker = forwardRef3(({
899
1627
  className
900
1628
  }),
901
1629
  children: [
902
- /* @__PURE__ */ jsx5("input", {
1630
+ /* @__PURE__ */ jsx6("input", {
1631
+ ...inputProps,
903
1632
  className: datePickerInputClass,
904
1633
  disabled,
905
1634
  type: inputType,
@@ -907,11 +1636,13 @@ var RangePicker = forwardRef3(({
907
1636
  placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
908
1637
  onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
909
1638
  }),
910
- /* @__PURE__ */ jsx5("span", {
1639
+ /* @__PURE__ */ jsx6("span", {
911
1640
  className: datePickerSeparatorClass,
912
1641
  children: separator
913
1642
  }),
914
- /* @__PURE__ */ jsx5("input", {
1643
+ /* @__PURE__ */ jsx6("input", {
1644
+ ...inputProps,
1645
+ id: inputProps?.id ? `${inputProps.id}-end` : undefined,
915
1646
  className: datePickerInputClass,
916
1647
  disabled,
917
1648
  type: inputType,
@@ -919,7 +1650,7 @@ var RangePicker = forwardRef3(({
919
1650
  placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
920
1651
  onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
921
1652
  }),
922
- allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx5("button", {
1653
+ allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx6("button", {
923
1654
  type: "button",
924
1655
  className: datePickerClearClass,
925
1656
  "aria-label": "Clear date range",
@@ -931,7 +1662,7 @@ var RangePicker = forwardRef3(({
931
1662
  });
932
1663
  RangePicker.displayName = "DatePicker.RangePicker";
933
1664
  function withPicker(picker, displayName) {
934
- const Picker = forwardRef3((props, ref) => /* @__PURE__ */ jsx5(DatePickerRoot, {
1665
+ const Picker = forwardRef4((props, ref) => /* @__PURE__ */ jsx6(DatePickerRoot, {
935
1666
  ...props,
936
1667
  ref,
937
1668
  picker
@@ -948,10 +1679,10 @@ var DatePicker = Object.assign(DatePickerRoot, {
948
1679
  });
949
1680
  // src/components/input/Input.tsx
950
1681
  import {
951
- forwardRef as forwardRef4,
952
- useImperativeHandle,
953
- useRef as useRef2,
954
- useState as useState4
1682
+ forwardRef as forwardRef5,
1683
+ useImperativeHandle as useImperativeHandle2,
1684
+ useRef as useRef3,
1685
+ useState as useState6
955
1686
  } from "react";
956
1687
 
957
1688
  // src/classes/input.ts
@@ -1040,14 +1771,14 @@ function getTextAreaCountClasses({ exceeded }) {
1040
1771
  }
1041
1772
 
1042
1773
  // src/components/input/Input.tsx
1043
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1774
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1044
1775
  function toTextValue(value) {
1045
1776
  if (Array.isArray(value)) {
1046
1777
  return value.join(",");
1047
1778
  }
1048
1779
  return value == null ? "" : String(value);
1049
1780
  }
1050
- var InputRoot = forwardRef4(({
1781
+ var InputRoot = forwardRef5(({
1051
1782
  allowClear,
1052
1783
  className,
1053
1784
  defaultValue,
@@ -1062,12 +1793,12 @@ var InputRoot = forwardRef4(({
1062
1793
  variant = "outlined",
1063
1794
  ...props
1064
1795
  }, ref) => {
1065
- const inputRef = useRef2(null);
1066
- const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
1796
+ const inputRef = useRef3(null);
1797
+ const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
1067
1798
  const isControlled = value !== undefined;
1068
1799
  const currentValue = isControlled ? toTextValue(value) : internalValue;
1069
1800
  const hasAffix = prefix != null || suffix != null || allowClear;
1070
- useImperativeHandle(ref, () => inputRef.current);
1801
+ useImperativeHandle2(ref, () => inputRef.current);
1071
1802
  function handleChange(event) {
1072
1803
  if (!isControlled) {
1073
1804
  setInternalValue(event.currentTarget.value);
@@ -1090,7 +1821,7 @@ var InputRoot = forwardRef4(({
1090
1821
  });
1091
1822
  input.focus();
1092
1823
  }
1093
- const control = /* @__PURE__ */ jsx6("input", {
1824
+ const control = /* @__PURE__ */ jsx7("input", {
1094
1825
  ...props,
1095
1826
  ref: inputRef,
1096
1827
  type,
@@ -1103,22 +1834,22 @@ var InputRoot = forwardRef4(({
1103
1834
  return control;
1104
1835
  }
1105
1836
  const showClear = allowClear && !disabled && currentValue.length > 0;
1106
- return /* @__PURE__ */ jsxs5("span", {
1837
+ return /* @__PURE__ */ jsxs6("span", {
1107
1838
  className: getInputWrapperClasses({ affixed: hasAffix }),
1108
1839
  children: [
1109
- prefix != null ? /* @__PURE__ */ jsx6("span", {
1840
+ prefix != null ? /* @__PURE__ */ jsx7("span", {
1110
1841
  className: inputPrefixClass,
1111
1842
  children: prefix
1112
1843
  }) : null,
1113
1844
  control,
1114
- showClear ? /* @__PURE__ */ jsx6("button", {
1845
+ showClear ? /* @__PURE__ */ jsx7("button", {
1115
1846
  type: "button",
1116
1847
  className: inputClearClass,
1117
1848
  "aria-label": "Clear input",
1118
1849
  onClick: handleClear,
1119
1850
  children: "x"
1120
1851
  }) : null,
1121
- suffix != null ? /* @__PURE__ */ jsx6("span", {
1852
+ suffix != null ? /* @__PURE__ */ jsx7("span", {
1122
1853
  className: inputSuffixClass,
1123
1854
  children: suffix
1124
1855
  }) : null
@@ -1126,7 +1857,7 @@ var InputRoot = forwardRef4(({
1126
1857
  });
1127
1858
  });
1128
1859
  InputRoot.displayName = "Input";
1129
- var Search = forwardRef4(({
1860
+ var Search = forwardRef5(({
1130
1861
  className,
1131
1862
  disabled,
1132
1863
  enterButton,
@@ -1135,8 +1866,8 @@ var Search = forwardRef4(({
1135
1866
  onSearch,
1136
1867
  ...props
1137
1868
  }, ref) => {
1138
- const inputRef = useRef2(null);
1139
- useImperativeHandle(ref, () => inputRef.current);
1869
+ const inputRef = useRef3(null);
1870
+ useImperativeHandle2(ref, () => inputRef.current);
1140
1871
  function emitSearch(event) {
1141
1872
  onSearch?.(inputRef.current?.value ?? "", event);
1142
1873
  }
@@ -1147,16 +1878,16 @@ var Search = forwardRef4(({
1147
1878
  }
1148
1879
  }
1149
1880
  const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
1150
- return /* @__PURE__ */ jsxs5("span", {
1881
+ return /* @__PURE__ */ jsxs6("span", {
1151
1882
  className: getSearchWrapperClasses({ className }),
1152
1883
  children: [
1153
- /* @__PURE__ */ jsx6(InputRoot, {
1884
+ /* @__PURE__ */ jsx7(InputRoot, {
1154
1885
  ...props,
1155
1886
  ref: inputRef,
1156
1887
  disabled,
1157
1888
  onKeyDown: handleKeyDown
1158
1889
  }),
1159
- enterButton || loading ? /* @__PURE__ */ jsx6("button", {
1890
+ enterButton || loading ? /* @__PURE__ */ jsx7("button", {
1160
1891
  type: "button",
1161
1892
  className: inputSearchButtonClass,
1162
1893
  disabled: disabled || loading,
@@ -1168,10 +1899,10 @@ var Search = forwardRef4(({
1168
1899
  });
1169
1900
  });
1170
1901
  Search.displayName = "Input.Search";
1171
- var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
1172
- const [visible, setVisible] = useState4(false);
1902
+ var Password = forwardRef5(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
1903
+ const [visible, setVisible] = useState6(false);
1173
1904
  const type = visible ? "text" : "password";
1174
- const toggle = visibilityToggle ? /* @__PURE__ */ jsx6("button", {
1905
+ const toggle = visibilityToggle ? /* @__PURE__ */ jsx7("button", {
1175
1906
  type: "button",
1176
1907
  className: inputPasswordToggleClass,
1177
1908
  disabled,
@@ -1181,9 +1912,9 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
1181
1912
  },
1182
1913
  children: visible ? "Hide" : "Show"
1183
1914
  }) : undefined;
1184
- return /* @__PURE__ */ jsx6("span", {
1915
+ return /* @__PURE__ */ jsx7("span", {
1185
1916
  className: getPasswordWrapperClasses({ className }),
1186
- children: /* @__PURE__ */ jsx6(InputRoot, {
1917
+ children: /* @__PURE__ */ jsx7(InputRoot, {
1187
1918
  ...props,
1188
1919
  ref,
1189
1920
  disabled,
@@ -1193,7 +1924,7 @@ var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...p
1193
1924
  });
1194
1925
  });
1195
1926
  Password.displayName = "Input.Password";
1196
- var TextArea = forwardRef4(({
1927
+ var TextArea = forwardRef5(({
1197
1928
  autoSize,
1198
1929
  className,
1199
1930
  defaultValue,
@@ -1207,7 +1938,7 @@ var TextArea = forwardRef4(({
1207
1938
  variant = "outlined",
1208
1939
  ...props
1209
1940
  }, ref) => {
1210
- const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
1941
+ const [internalValue, setInternalValue] = useState6(() => toTextValue(defaultValue));
1211
1942
  const isControlled = value !== undefined;
1212
1943
  const currentValue = isControlled ? toTextValue(value) : internalValue;
1213
1944
  const count = currentValue.length;
@@ -1218,7 +1949,7 @@ var TextArea = forwardRef4(({
1218
1949
  }
1219
1950
  onChange?.(event);
1220
1951
  }
1221
- const control = /* @__PURE__ */ jsx6("textarea", {
1952
+ const control = /* @__PURE__ */ jsx7("textarea", {
1222
1953
  ...props,
1223
1954
  ref,
1224
1955
  className: getTextAreaClasses({
@@ -1236,11 +1967,11 @@ var TextArea = forwardRef4(({
1236
1967
  if (!showCount) {
1237
1968
  return control;
1238
1969
  }
1239
- return /* @__PURE__ */ jsxs5("span", {
1970
+ return /* @__PURE__ */ jsxs6("span", {
1240
1971
  className: textAreaWrapperClass,
1241
1972
  children: [
1242
1973
  control,
1243
- /* @__PURE__ */ jsxs5("span", {
1974
+ /* @__PURE__ */ jsxs6("span", {
1244
1975
  className: getTextAreaCountClasses({ exceeded }),
1245
1976
  children: [
1246
1977
  count,
@@ -1251,7 +1982,7 @@ var TextArea = forwardRef4(({
1251
1982
  });
1252
1983
  });
1253
1984
  TextArea.displayName = "Input.TextArea";
1254
- var Group = forwardRef4(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
1985
+ var Group = forwardRef5(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
1255
1986
  ...props,
1256
1987
  ref,
1257
1988
  className: cn(inputGroupClass, className),
@@ -1265,7 +1996,7 @@ var Input = Object.assign(InputRoot, {
1265
1996
  Group
1266
1997
  });
1267
1998
  // src/components/select/Select.tsx
1268
- import React5, { forwardRef as forwardRef5, useMemo as useMemo4, useState as useState5 } from "react";
1999
+ import React7, { forwardRef as forwardRef6, useMemo as useMemo5, useState as useState7 } from "react";
1269
2000
 
1270
2001
  // src/classes/select.ts
1271
2002
  var selectContainerClass = "select-container";
@@ -1321,7 +2052,7 @@ function getSelectOptionClasses({
1321
2052
  }
1322
2053
 
1323
2054
  // src/components/select/Select.tsx
1324
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
2055
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1325
2056
  function isGroup(option) {
1326
2057
  return "options" in option;
1327
2058
  }
@@ -1346,8 +2077,8 @@ function normalizeMultiValue(value) {
1346
2077
  }
1347
2078
  function optionsFromChildren(children) {
1348
2079
  const result = [];
1349
- React5.Children.forEach(children, (child) => {
1350
- if (!React5.isValidElement(child)) {
2080
+ React7.Children.forEach(children, (child) => {
2081
+ if (!React7.isValidElement(child)) {
1351
2082
  return;
1352
2083
  }
1353
2084
  if (child.type === Option) {
@@ -1397,19 +2128,19 @@ function filterOptions(options, searchValue, filterOption) {
1397
2128
  function renderValue(option) {
1398
2129
  return option ? optionLabel(option) : null;
1399
2130
  }
1400
- var Option = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2131
+ var Option = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
1401
2132
  ...props,
1402
2133
  ref,
1403
2134
  children
1404
2135
  }));
1405
2136
  Option.displayName = "Select.Option";
1406
- var OptGroup = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
2137
+ var OptGroup = forwardRef6(({ children, ...props }, ref) => /* @__PURE__ */ jsx8("div", {
1407
2138
  ...props,
1408
2139
  ref,
1409
2140
  children
1410
2141
  }));
1411
2142
  OptGroup.displayName = "Select.OptGroup";
1412
- var SelectRoot = forwardRef5(({
2143
+ var SelectRoot = forwardRef6(({
1413
2144
  allowClear,
1414
2145
  children,
1415
2146
  className,
@@ -1428,11 +2159,11 @@ var SelectRoot = forwardRef5(({
1428
2159
  ...props
1429
2160
  }, ref) => {
1430
2161
  const multiple = mode === "multiple" || mode === "tags";
1431
- const sourceOptions = useMemo4(() => options ?? optionsFromChildren(children), [children, options]);
1432
- const flatOptions = useMemo4(() => flattenOptions(sourceOptions), [sourceOptions]);
1433
- const [open, setOpen] = useState5(false);
1434
- const [searchValue, setSearchValue] = useState5("");
1435
- const [internalValue, setInternalValue] = useState5(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
2162
+ const sourceOptions = useMemo5(() => options ?? optionsFromChildren(children), [children, options]);
2163
+ const flatOptions = useMemo5(() => flattenOptions(sourceOptions), [sourceOptions]);
2164
+ const [open, setOpen] = useState7(false);
2165
+ const [searchValue, setSearchValue] = useState7("");
2166
+ const [internalValue, setInternalValue] = useState7(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
1436
2167
  const controlled = value !== undefined;
1437
2168
  const currentValue = controlled ? value : internalValue;
1438
2169
  const selectedValues = multiple ? normalizeMultiValue(currentValue) : normalizeSingleValue(currentValue) === undefined ? [] : [normalizeSingleValue(currentValue)];
@@ -1489,7 +2220,7 @@ var SelectRoot = forwardRef5(({
1489
2220
  }
1490
2221
  function renderOption(option) {
1491
2222
  const selected = selectedKeys.has(valueKey(option.value));
1492
- return /* @__PURE__ */ jsx7("button", {
2223
+ return /* @__PURE__ */ jsx8("button", {
1493
2224
  type: "button",
1494
2225
  role: "option",
1495
2226
  "aria-selected": selected,
@@ -1508,11 +2239,11 @@ var SelectRoot = forwardRef5(({
1508
2239
  if (!isGroup(option)) {
1509
2240
  return renderOption(option);
1510
2241
  }
1511
- return /* @__PURE__ */ jsxs6("div", {
2242
+ return /* @__PURE__ */ jsxs7("div", {
1512
2243
  className: cn(selectGroupClass, option.className),
1513
2244
  role: "group",
1514
2245
  children: [
1515
- /* @__PURE__ */ jsx7("div", {
2246
+ /* @__PURE__ */ jsx8("div", {
1516
2247
  className: selectGroupLabelClass,
1517
2248
  children: option.label
1518
2249
  }),
@@ -1521,11 +2252,11 @@ var SelectRoot = forwardRef5(({
1521
2252
  }, `group-${index}`);
1522
2253
  });
1523
2254
  }
1524
- const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx7("span", {
2255
+ const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx8("span", {
1525
2256
  className: selectTagClass,
1526
2257
  children: renderValue(option)
1527
2258
  }, valueKey(option.value))) : renderValue(selectedOptions[0]);
1528
- return /* @__PURE__ */ jsxs6("div", {
2259
+ return /* @__PURE__ */ jsxs7("div", {
1529
2260
  ...props,
1530
2261
  ref,
1531
2262
  className: getSelectContainerClasses({
@@ -1536,7 +2267,7 @@ var SelectRoot = forwardRef5(({
1536
2267
  className
1537
2268
  }),
1538
2269
  children: [
1539
- /* @__PURE__ */ jsxs6("button", {
2270
+ /* @__PURE__ */ jsxs7("button", {
1540
2271
  type: "button",
1541
2272
  className: getSelectClasses({ size, status, disabled }),
1542
2273
  disabled: disabled || loading,
@@ -1544,33 +2275,33 @@ var SelectRoot = forwardRef5(({
1544
2275
  "aria-expanded": open,
1545
2276
  onClick: () => setOpen((current) => !current),
1546
2277
  children: [
1547
- /* @__PURE__ */ jsx7("span", {
2278
+ /* @__PURE__ */ jsx8("span", {
1548
2279
  className: selectSelectionClass,
1549
- children: hasValue ? selection : /* @__PURE__ */ jsx7("span", {
2280
+ children: hasValue ? selection : /* @__PURE__ */ jsx8("span", {
1550
2281
  className: selectPlaceholderClass,
1551
2282
  children: placeholder
1552
2283
  })
1553
2284
  }),
1554
- /* @__PURE__ */ jsx7("span", {
2285
+ /* @__PURE__ */ jsx8("span", {
1555
2286
  className: selectIconClass,
1556
2287
  "aria-hidden": "true",
1557
2288
  children: "v"
1558
2289
  })
1559
2290
  ]
1560
2291
  }),
1561
- allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx7("button", {
2292
+ allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx8("button", {
1562
2293
  type: "button",
1563
2294
  className: selectClearClass,
1564
2295
  "aria-label": "Clear selection",
1565
2296
  onClick: clearValue,
1566
2297
  children: "x"
1567
2298
  }) : null,
1568
- open ? /* @__PURE__ */ jsxs6("div", {
2299
+ open ? /* @__PURE__ */ jsxs7("div", {
1569
2300
  className: selectDropdownClass,
1570
2301
  role: "listbox",
1571
2302
  "aria-multiselectable": multiple || undefined,
1572
2303
  children: [
1573
- searchable ? /* @__PURE__ */ jsx7("input", {
2304
+ searchable ? /* @__PURE__ */ jsx8("input", {
1574
2305
  className: selectSearchClass,
1575
2306
  value: searchValue,
1576
2307
  placeholder: typeof placeholder === "string" ? placeholder : undefined,
@@ -1582,7 +2313,7 @@ var SelectRoot = forwardRef5(({
1582
2313
  }
1583
2314
  }
1584
2315
  }) : null,
1585
- visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx7("div", {
2316
+ visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx8("div", {
1586
2317
  className: selectEmptyClass,
1587
2318
  children: "No data"
1588
2319
  })
@@ -1596,7 +2327,7 @@ var Select = SelectRoot;
1596
2327
  Select.Option = Option;
1597
2328
  Select.OptGroup = OptGroup;
1598
2329
  // src/components/dm-search/DmSearch.tsx
1599
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
2330
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1600
2331
  function initialValues(items, searchParams, useSearchParams = true) {
1601
2332
  return items.reduce((acc, item) => {
1602
2333
  const defaultValue = item.search.extraProps?.value ?? item.search.formProps?.initialValue;
@@ -1620,7 +2351,7 @@ function renderField({
1620
2351
  return item.search.render?.(value, setValue, item) ?? null;
1621
2352
  }
1622
2353
  if (item.search.type === "select") {
1623
- return /* @__PURE__ */ jsx8(Select, {
2354
+ return /* @__PURE__ */ jsx9(Select, {
1624
2355
  ...extraProps,
1625
2356
  disabled: Boolean(loading || extraProps.disabled),
1626
2357
  value,
@@ -1629,25 +2360,25 @@ function renderField({
1629
2360
  });
1630
2361
  }
1631
2362
  if (item.search.type === "dateRange") {
1632
- return /* @__PURE__ */ jsx8(DatePicker.RangePicker, {
2363
+ return /* @__PURE__ */ jsx9(DatePicker.RangePicker, {
1633
2364
  ...extraProps,
1634
2365
  value,
1635
2366
  onChange: (nextValue) => setValue(nextValue)
1636
2367
  });
1637
2368
  }
1638
2369
  if (item.search.type === "date") {
1639
- return /* @__PURE__ */ jsx8(DatePicker, {
2370
+ return /* @__PURE__ */ jsx9(DatePicker, {
1640
2371
  ...extraProps,
1641
2372
  value,
1642
2373
  onChange: (nextValue) => setValue(nextValue)
1643
2374
  });
1644
2375
  }
1645
2376
  if (item.search.type === "radio" || item.search.type === "checkbox") {
1646
- return /* @__PURE__ */ jsx8("div", {
2377
+ return /* @__PURE__ */ jsx9("div", {
1647
2378
  role: item.search.type === "radio" ? "radiogroup" : "group",
1648
- children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs7("label", {
2379
+ children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs8("label", {
1649
2380
  children: [
1650
- /* @__PURE__ */ jsx8("input", {
2381
+ /* @__PURE__ */ jsx9("input", {
1651
2382
  type: item.search.type,
1652
2383
  disabled: loading,
1653
2384
  checked: item.search.type === "checkbox" ? Array.isArray(value) && value.includes(option.value) : value === option.value,
@@ -1665,7 +2396,7 @@ function renderField({
1665
2396
  }, String(option.value)))
1666
2397
  });
1667
2398
  }
1668
- return /* @__PURE__ */ jsx8(Input, {
2399
+ return /* @__PURE__ */ jsx9(Input, {
1669
2400
  ...extraProps,
1670
2401
  type: item.search.type === "input-number" ? "number" : "text",
1671
2402
  disabled: Boolean(loading || extraProps.disabled),
@@ -1679,8 +2410,11 @@ function renderField({
1679
2410
  }
1680
2411
  });
1681
2412
  }
1682
- var DmSearch = forwardRef6(({
2413
+ var DmSearch = forwardRef7(({
1683
2414
  items = [],
2415
+ values: controlledValues,
2416
+ onValuesChange,
2417
+ onReset,
1684
2418
  onSearch,
1685
2419
  extra,
1686
2420
  fastFilterItem,
@@ -1689,27 +2423,37 @@ var DmSearch = forwardRef6(({
1689
2423
  compact = false,
1690
2424
  searchParams,
1691
2425
  loading = false,
2426
+ noValidate,
1692
2427
  enableDefaultPlaceHolder = false,
1693
2428
  className
1694
2429
  }, ref) => {
1695
- const allItems = useMemo5(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
1696
- const [collapsed, setCollapsed] = useState6(defaultCollapsed);
1697
- const [values, setValues] = useState6(() => initialValues(allItems, searchParams));
2430
+ const allItems = useMemo6(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
2431
+ const [collapsed, setCollapsed] = useState8(defaultCollapsed);
2432
+ const [internalValues, setValues] = useState8(() => initialValues(allItems, searchParams));
2433
+ const controlled = controlledValues !== undefined;
2434
+ const values = controlled ? controlledValues : internalValues;
1698
2435
  const visibleItems = collapsed ? allItems.slice(0, 1) : allItems;
1699
- useEffect2(() => {
1700
- setValues(initialValues(allItems, searchParams));
1701
- }, [allItems, searchParams]);
2436
+ useEffect3(() => {
2437
+ if (!controlled)
2438
+ setValues(initialValues(allItems, searchParams));
2439
+ }, [allItems, searchParams, controlled]);
1702
2440
  function reset(useSearchParams = false) {
1703
2441
  const nextValues = initialValues(allItems, searchParams, useSearchParams);
1704
- setValues(nextValues);
2442
+ if (!controlled)
2443
+ setValues(nextValues);
2444
+ if (onReset)
2445
+ onReset(nextValues);
2446
+ else if (controlled)
2447
+ onValuesChange?.(nextValues);
1705
2448
  return nextValues;
1706
2449
  }
1707
- useImperativeHandle2(ref, () => ({
2450
+ useImperativeHandle3(ref, () => ({
1708
2451
  onReset: () => {
1709
2452
  reset(false);
1710
2453
  }
1711
2454
  }));
1712
- return /* @__PURE__ */ jsxs7("form", {
2455
+ return /* @__PURE__ */ jsxs8("form", {
2456
+ noValidate,
1713
2457
  id: "searchForm",
1714
2458
  className: getDmSearchClasses({ compact, collapsed, className }),
1715
2459
  onSubmit: (event) => {
@@ -1717,53 +2461,63 @@ var DmSearch = forwardRef6(({
1717
2461
  onSearch?.(values);
1718
2462
  },
1719
2463
  children: [
1720
- fastFilterItem ? /* @__PURE__ */ jsx8("div", {
2464
+ fastFilterItem ? /* @__PURE__ */ jsx9("div", {
1721
2465
  className: dmSearchFastFilterClass,
1722
2466
  children: fastFilterItem.title
1723
2467
  }) : null,
1724
- /* @__PURE__ */ jsx8("div", {
2468
+ /* @__PURE__ */ jsx9("div", {
1725
2469
  className: dmSearchFieldsClass,
1726
- children: visibleItems.map((item) => /* @__PURE__ */ jsxs7("label", {
1727
- className: dmSearchFieldClass,
1728
- children: [
1729
- compact ? null : /* @__PURE__ */ jsx8("span", {
1730
- children: item.title
1731
- }),
1732
- renderField({
1733
- item,
1734
- value: values[item.dataIndex],
1735
- loading,
1736
- enableDefaultPlaceHolder,
1737
- setValue: (value) => setValues((current) => ({
1738
- ...current,
1739
- [item.dataIndex]: value
1740
- }))
1741
- })
1742
- ]
1743
- }, item.key))
2470
+ children: visibleItems.map((item) => {
2471
+ const Field = item.search.type === "custom" ? "div" : "label";
2472
+ return /* @__PURE__ */ jsxs8(Field, {
2473
+ className: dmSearchFieldClass,
2474
+ children: [
2475
+ compact ? null : /* @__PURE__ */ jsx9("span", {
2476
+ children: item.title
2477
+ }),
2478
+ renderField({
2479
+ item,
2480
+ value: values[item.dataIndex],
2481
+ loading,
2482
+ enableDefaultPlaceHolder,
2483
+ setValue: (value) => {
2484
+ const nextValues = { ...values, [item.dataIndex]: value };
2485
+ if (!controlled)
2486
+ setValues(nextValues);
2487
+ onValuesChange?.(nextValues);
2488
+ }
2489
+ })
2490
+ ]
2491
+ }, item.key);
2492
+ })
1744
2493
  }),
1745
- /* @__PURE__ */ jsxs7("div", {
2494
+ /* @__PURE__ */ jsxs8("div", {
1746
2495
  className: dmSearchActionsClass,
1747
2496
  children: [
1748
- /* @__PURE__ */ jsx8(Button, {
2497
+ /* @__PURE__ */ jsx9(Button, {
1749
2498
  type: "submit",
1750
2499
  isLoading: loading,
1751
2500
  children: "Search"
1752
2501
  }),
1753
- /* @__PURE__ */ jsx8(Button, {
2502
+ /* @__PURE__ */ jsx9(Button, {
1754
2503
  type: "button",
1755
2504
  color: "secondary",
1756
2505
  appearance: "outline",
1757
- onClick: () => onSearch?.(reset(false)),
2506
+ onClick: () => {
2507
+ const nextValues = reset(false);
2508
+ if (!onReset)
2509
+ onSearch?.(nextValues);
2510
+ },
1758
2511
  children: "Reset"
1759
2512
  }),
1760
- !hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx8(Button, {
2513
+ !hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx9(Button, {
1761
2514
  type: "button",
1762
2515
  color: "secondary",
1763
2516
  appearance: "text",
1764
2517
  onClick: () => {
1765
2518
  setCollapsed((current) => !current);
1766
- setValues(initialValues(allItems, searchParams));
2519
+ if (!controlled)
2520
+ setValues(initialValues(allItems, searchParams));
1767
2521
  },
1768
2522
  children: collapsed ? "Expand" : "Collapse"
1769
2523
  }) : null,
@@ -1775,10 +2529,10 @@ var DmSearch = forwardRef6(({
1775
2529
  });
1776
2530
  DmSearch.displayName = "DmSearch";
1777
2531
  // src/components/table/Table.tsx
1778
- import React7, {
1779
- forwardRef as forwardRef7,
1780
- useMemo as useMemo6,
1781
- useState as useState7
2532
+ import React9, {
2533
+ forwardRef as forwardRef8,
2534
+ useMemo as useMemo7,
2535
+ useState as useState9
1782
2536
  } from "react";
1783
2537
 
1784
2538
  // src/classes/table.ts
@@ -1828,7 +2582,7 @@ function getTableSorterClasses(active) {
1828
2582
  }
1829
2583
 
1830
2584
  // src/components/table/Table.tsx
1831
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
2585
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1832
2586
  import { createElement } from "react";
1833
2587
  var defaultPageSize = 10;
1834
2588
  var defaultSortDirections = ["ascend", "descend", null];
@@ -1944,24 +2698,24 @@ function selectedRowsForKeys(data, keys, rowKey) {
1944
2698
  const keySet = new Set(normalizeKeys(keys));
1945
2699
  return data.filter((record, index) => keySet.has(String(getRecordKey(record, index, rowKey))));
1946
2700
  }
1947
- var Column = forwardRef7(() => null);
2701
+ var Column = forwardRef8(() => null);
1948
2702
  Column.displayName = "Table.Column";
1949
- var ColumnGroup = forwardRef7(() => null);
2703
+ var ColumnGroup = forwardRef8(() => null);
1950
2704
  ColumnGroup.displayName = "Table.ColumnGroup";
1951
- var SummaryRow = forwardRef7((props, ref) => /* @__PURE__ */ jsx9("tr", {
2705
+ var SummaryRow = forwardRef8((props, ref) => /* @__PURE__ */ jsx10("tr", {
1952
2706
  ...props,
1953
2707
  ref
1954
2708
  }));
1955
2709
  SummaryRow.displayName = "Table.Summary.Row";
1956
- var SummaryCell = forwardRef7(({ index, ...props }, ref) => {
1957
- return /* @__PURE__ */ jsx9("td", {
2710
+ var SummaryCell = forwardRef8(({ index, ...props }, ref) => {
2711
+ return /* @__PURE__ */ jsx10("td", {
1958
2712
  ...props,
1959
2713
  ref
1960
2714
  });
1961
2715
  });
1962
2716
  SummaryCell.displayName = "Table.Summary.Cell";
1963
- var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
1964
- return /* @__PURE__ */ jsx9("tfoot", {
2717
+ var Summary = Object.assign(forwardRef8(({ fixed, ...props }, ref) => {
2718
+ return /* @__PURE__ */ jsx10("tfoot", {
1965
2719
  ...props,
1966
2720
  ref
1967
2721
  });
@@ -1971,8 +2725,8 @@ var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
1971
2725
  });
1972
2726
  Summary.displayName = "Table.Summary";
1973
2727
  function columnsFromChildren(children) {
1974
- return React7.Children.toArray(children).flatMap((child) => {
1975
- if (!React7.isValidElement(child)) {
2728
+ return React9.Children.toArray(children).flatMap((child) => {
2729
+ if (!React9.isValidElement(child)) {
1976
2730
  return [];
1977
2731
  }
1978
2732
  if (child.type === Column) {
@@ -1998,12 +2752,12 @@ function renderSummary(summary, pageData, colSpan) {
1998
2752
  return null;
1999
2753
  }
2000
2754
  const node = summary(pageData);
2001
- if (React7.isValidElement(node) && node.type === Summary) {
2755
+ if (React9.isValidElement(node) && node.type === Summary) {
2002
2756
  return node;
2003
2757
  }
2004
- return /* @__PURE__ */ jsx9("tfoot", {
2005
- children: /* @__PURE__ */ jsx9("tr", {
2006
- children: /* @__PURE__ */ jsx9("td", {
2758
+ return /* @__PURE__ */ jsx10("tfoot", {
2759
+ children: /* @__PURE__ */ jsx10("tr", {
2760
+ children: /* @__PURE__ */ jsx10("td", {
2007
2761
  className: tableCellClass,
2008
2762
  colSpan,
2009
2763
  children: node
@@ -2047,18 +2801,18 @@ function TableRoot({
2047
2801
  className,
2048
2802
  ...props
2049
2803
  }, ref) {
2050
- const childColumns = useMemo6(() => columnsFromChildren(children), [children]);
2051
- const normalizedColumns = useMemo6(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
2052
- const leaves = useMemo6(() => leafColumns(normalizedColumns), [normalizedColumns]);
2053
- const headerRows = useMemo6(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
2054
- const [sortStates, setSortStates] = useState7({});
2055
- const [filterStates, setFilterStates] = useState7({});
2056
- const [internalCurrent, setInternalCurrent] = useState7(1);
2057
- const [internalPageSize, setInternalPageSize] = useState7(defaultPageSize);
2058
- const [internalSelectedKeys, setInternalSelectedKeys] = useState7(rowSelection?.defaultSelectedRowKeys ?? []);
2059
- const [internalExpandedKeys, setInternalExpandedKeys] = useState7(expandable?.defaultExpandedRowKeys ?? []);
2804
+ const childColumns = useMemo7(() => columnsFromChildren(children), [children]);
2805
+ const normalizedColumns = useMemo7(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
2806
+ const leaves = useMemo7(() => leafColumns(normalizedColumns), [normalizedColumns]);
2807
+ const headerRows = useMemo7(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
2808
+ const [sortStates, setSortStates] = useState9({});
2809
+ const [filterStates, setFilterStates] = useState9({});
2810
+ const [internalCurrent, setInternalCurrent] = useState9(1);
2811
+ const [internalPageSize, setInternalPageSize] = useState9(defaultPageSize);
2812
+ const [internalSelectedKeys, setInternalSelectedKeys] = useState9(rowSelection?.defaultSelectedRowKeys ?? []);
2813
+ const [internalExpandedKeys, setInternalExpandedKeys] = useState9(expandable?.defaultExpandedRowKeys ?? []);
2060
2814
  const spinning = typeof loading === "object" ? loading.spinning : Boolean(loading);
2061
- const activeFilters = useMemo6(() => {
2815
+ const activeFilters = useMemo7(() => {
2062
2816
  return leaves.reduce((result, column) => {
2063
2817
  const value = filterValueFor(column, filterStates) ?? null;
2064
2818
  if (value !== null) {
@@ -2067,7 +2821,7 @@ function TableRoot({
2067
2821
  return result;
2068
2822
  }, {});
2069
2823
  }, [filterStates, leaves]);
2070
- const activeSorter = useMemo6(() => {
2824
+ const activeSorter = useMemo7(() => {
2071
2825
  const column = leaves.find((item) => sortOrderFor(item, sortStates));
2072
2826
  if (!column) {
2073
2827
  return {};
@@ -2079,7 +2833,7 @@ function TableRoot({
2079
2833
  order: sortOrderFor(column, sortStates) ?? null
2080
2834
  };
2081
2835
  }, [leaves, sortStates]);
2082
- const filteredData = useMemo6(() => {
2836
+ const filteredData = useMemo7(() => {
2083
2837
  return leaves.reduce((records, column) => {
2084
2838
  const values = filterValueFor(column, filterStates);
2085
2839
  if (!values?.length || !column.onFilter) {
@@ -2088,7 +2842,7 @@ function TableRoot({
2088
2842
  return records.filter((record) => values.some((value) => column.onFilter?.(value, record)));
2089
2843
  }, dataSource);
2090
2844
  }, [dataSource, filterStates, leaves]);
2091
- const sortedData = useMemo6(() => {
2845
+ const sortedData = useMemo7(() => {
2092
2846
  const sorterColumn = leaves.find((column) => sortOrderFor(column, sortStates));
2093
2847
  const order = sorterColumn ? sortOrderFor(sorterColumn, sortStates) : null;
2094
2848
  const compare = sorterColumn ? sortCompare(sorterColumn.sorter) : undefined;
@@ -2231,18 +2985,18 @@ function TableRoot({
2231
2985
  return null;
2232
2986
  }
2233
2987
  if (rowSelection.type === "radio" || rowSelection.hideSelectAll) {
2234
- return /* @__PURE__ */ jsx9("th", {
2988
+ return /* @__PURE__ */ jsx10("th", {
2235
2989
  className: cn(tableHeaderCellClass, tableSelectionCellClass),
2236
2990
  children: rowSelection.columnTitle
2237
2991
  });
2238
2992
  }
2239
2993
  const pageKeys = pageData.map((record, index) => getRecordKey(record, index, rowKey));
2240
2994
  const allSelected = pageKeys.length > 0 && pageKeys.every((key) => selectedKeySet.has(String(key)));
2241
- return /* @__PURE__ */ jsx9("th", {
2995
+ return /* @__PURE__ */ jsx10("th", {
2242
2996
  className: cn(tableHeaderCellClass, tableSelectionCellClass),
2243
- children: /* @__PURE__ */ jsxs8("label", {
2997
+ children: /* @__PURE__ */ jsxs9("label", {
2244
2998
  children: [
2245
- /* @__PURE__ */ jsx9("input", {
2999
+ /* @__PURE__ */ jsx10("input", {
2246
3000
  type: "checkbox",
2247
3001
  "aria-label": "Select all rows",
2248
3002
  checked: allSelected,
@@ -2269,26 +3023,26 @@ function TableRoot({
2269
3023
  textAlign: column.align,
2270
3024
  ...headerProps.style
2271
3025
  }
2272
- }, /* @__PURE__ */ jsx9("span", {
3026
+ }, /* @__PURE__ */ jsx10("span", {
2273
3027
  children: title
2274
- }), column.sorter ? /* @__PURE__ */ jsx9("button", {
3028
+ }), column.sorter ? /* @__PURE__ */ jsx10("button", {
2275
3029
  type: "button",
2276
3030
  className: getTableSorterClasses(Boolean(sortOrder)),
2277
3031
  "aria-label": `Sort ${textFromNode(title, String(column.columnKey))}`,
2278
3032
  onClick: () => changeSorter(column),
2279
3033
  children: sortOrder === "ascend" ? "Asc" : sortOrder === "descend" ? "Desc" : "Sort"
2280
- }) : null, column.filters?.length ? /* @__PURE__ */ jsxs8("select", {
3034
+ }) : null, column.filters?.length ? /* @__PURE__ */ jsxs9("select", {
2281
3035
  className: tableFilterClass,
2282
3036
  "aria-label": `Filter ${textFromNode(title, String(column.columnKey))}`,
2283
3037
  multiple: column.filterMultiple !== false,
2284
3038
  value: column.filterMultiple === false ? String((filterValueFor(column, filterStates) ?? [])[0] ?? "") : (filterValueFor(column, filterStates) ?? []).map(String),
2285
3039
  onChange: (event) => changeFilter(column, event),
2286
3040
  children: [
2287
- column.filterMultiple === false ? /* @__PURE__ */ jsx9("option", {
3041
+ column.filterMultiple === false ? /* @__PURE__ */ jsx10("option", {
2288
3042
  value: "",
2289
3043
  children: "All"
2290
3044
  }) : null,
2291
- optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx9("option", {
3045
+ optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx10("option", {
2292
3046
  value: String(filter.value),
2293
3047
  children: filter.text
2294
3048
  }, String(filter.value)))
@@ -2313,14 +3067,14 @@ function TableRoot({
2313
3067
  const key = getRecordKey(record, index, rowKey);
2314
3068
  const checked = selectedKeySet.has(String(key));
2315
3069
  const checkboxProps = rowSelection.getCheckboxProps?.(record) ?? {};
2316
- const originNode = /* @__PURE__ */ jsx9("input", {
3070
+ const originNode = /* @__PURE__ */ jsx10("input", {
2317
3071
  ...checkboxProps,
2318
3072
  type: rowSelection.type === "radio" ? "radio" : "checkbox",
2319
3073
  "aria-label": `Select row ${index + 1}`,
2320
3074
  checked,
2321
3075
  onChange: (event) => toggleRowSelection(record, index, event)
2322
3076
  });
2323
- return /* @__PURE__ */ jsx9("td", {
3077
+ return /* @__PURE__ */ jsx10("td", {
2324
3078
  className: cn(tableCellClass, tableSelectionCellClass),
2325
3079
  children: rowSelection.renderCell ? rowSelection.renderCell(checked, record, index, originNode) : originNode
2326
3080
  });
@@ -2332,9 +3086,9 @@ function TableRoot({
2332
3086
  const key = getRecordKey(record, index, rowKey);
2333
3087
  const expanded = expandedKeySet.has(String(key));
2334
3088
  const expandableRow = expandable.rowExpandable?.(record) ?? true;
2335
- return /* @__PURE__ */ jsx9("td", {
3089
+ return /* @__PURE__ */ jsx10("td", {
2336
3090
  className: cn(tableCellClass, tableExpandCellClass),
2337
- children: expandableRow ? /* @__PURE__ */ jsx9("button", {
3091
+ children: expandableRow ? /* @__PURE__ */ jsx10("button", {
2338
3092
  type: "button",
2339
3093
  className: tableExpandButtonClass,
2340
3094
  "aria-label": `${expanded ? "Collapse" : "Expand"} row ${index + 1}`,
@@ -2347,7 +3101,7 @@ function TableRoot({
2347
3101
  const key = getRecordKey(record, index, rowKey);
2348
3102
  const expanded = expandedKeySet.has(String(key));
2349
3103
  const selected = selectedKeySet.has(String(key));
2350
- const row = /* @__PURE__ */ jsxs8("tr", {
3104
+ const row = /* @__PURE__ */ jsxs9("tr", {
2351
3105
  className: getTableRowClasses({ selected, expanded }),
2352
3106
  onClick: () => {
2353
3107
  if (expandable?.expandRowByClick) {
@@ -2363,12 +3117,12 @@ function TableRoot({
2363
3117
  if (!expanded || !expandable?.expandedRowRender) {
2364
3118
  return row;
2365
3119
  }
2366
- return /* @__PURE__ */ jsxs8(React7.Fragment, {
3120
+ return /* @__PURE__ */ jsxs9(React9.Fragment, {
2367
3121
  children: [
2368
3122
  row,
2369
- /* @__PURE__ */ jsx9("tr", {
3123
+ /* @__PURE__ */ jsx10("tr", {
2370
3124
  className: "table-expanded-row",
2371
- children: /* @__PURE__ */ jsx9("td", {
3125
+ children: /* @__PURE__ */ jsx10("td", {
2372
3126
  className: tableCellClass,
2373
3127
  colSpan: structuralColumnCount,
2374
3128
  children: expandable.expandedRowRender(record, index, 0, expanded)
@@ -2377,15 +3131,15 @@ function TableRoot({
2377
3131
  ]
2378
3132
  }, String(key));
2379
3133
  }
2380
- const tableNode = /* @__PURE__ */ jsxs8("table", {
3134
+ const tableNode = /* @__PURE__ */ jsxs9("table", {
2381
3135
  className: getTableClasses({ bordered, size }),
2382
3136
  style: { tableLayout },
2383
3137
  children: [
2384
- /* @__PURE__ */ jsx9("thead", {
2385
- children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs8("tr", {
3138
+ /* @__PURE__ */ jsx10("thead", {
3139
+ children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs9("tr", {
2386
3140
  children: [
2387
3141
  rowIndex === 0 ? renderSelectionHeader() : null,
2388
- rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx9("th", {
3142
+ rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx10("th", {
2389
3143
  className: cn(tableHeaderCellClass, tableExpandCellClass),
2390
3144
  children: expandable?.columnTitle
2391
3145
  }) : null,
@@ -2393,9 +3147,9 @@ function TableRoot({
2393
3147
  ]
2394
3148
  }, rowIndex))
2395
3149
  }),
2396
- /* @__PURE__ */ jsx9("tbody", {
2397
- children: bodyEmpty ? /* @__PURE__ */ jsx9("tr", {
2398
- children: /* @__PURE__ */ jsx9("td", {
3150
+ /* @__PURE__ */ jsx10("tbody", {
3151
+ children: bodyEmpty ? /* @__PURE__ */ jsx10("tr", {
3152
+ children: /* @__PURE__ */ jsx10("td", {
2399
3153
  className: tableEmptyClass,
2400
3154
  colSpan: structuralColumnCount,
2401
3155
  children: locale?.emptyText ?? "No data"
@@ -2405,12 +3159,12 @@ function TableRoot({
2405
3159
  renderSummary(summary, pageData, structuralColumnCount)
2406
3160
  ]
2407
3161
  });
2408
- return /* @__PURE__ */ jsxs8("div", {
3162
+ return /* @__PURE__ */ jsxs9("div", {
2409
3163
  ...props,
2410
3164
  ref,
2411
3165
  className: getTableWrapperClasses({ loading: spinning, className }),
2412
3166
  children: [
2413
- scroll?.x || scroll?.y ? /* @__PURE__ */ jsx9("div", {
3167
+ scroll?.x || scroll?.y ? /* @__PURE__ */ jsx10("div", {
2414
3168
  style: {
2415
3169
  overflow: "auto",
2416
3170
  maxHeight: scroll.y,
@@ -2418,30 +3172,30 @@ function TableRoot({
2418
3172
  },
2419
3173
  children: tableNode
2420
3174
  }) : tableNode,
2421
- spinning ? /* @__PURE__ */ jsx9("div", {
3175
+ spinning ? /* @__PURE__ */ jsx10("div", {
2422
3176
  className: tableLoadingIndicatorClass,
2423
3177
  role: "status",
2424
3178
  children: typeof loading === "object" && loading.indicator ? loading.indicator : "Loading"
2425
3179
  }) : null,
2426
- paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs8("nav", {
3180
+ paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs9("nav", {
2427
3181
  className: tablePaginationClass,
2428
3182
  "aria-label": "Table pagination",
2429
3183
  children: [
2430
- /* @__PURE__ */ jsx9("button", {
3184
+ /* @__PURE__ */ jsx10("button", {
2431
3185
  type: "button",
2432
3186
  className: tablePaginationButtonClass,
2433
3187
  disabled: paginationConfig.disabled || current <= 1,
2434
3188
  onClick: () => changePage(current - 1),
2435
3189
  children: "Previous"
2436
3190
  }),
2437
- /* @__PURE__ */ jsx9("span", {
3191
+ /* @__PURE__ */ jsx10("span", {
2438
3192
  className: tablePaginationInfoClass,
2439
3193
  children: paginationConfig.showTotal ? paginationConfig.showTotal(paginationConfig.total ?? sortedData.length, [
2440
3194
  bodyEmpty ? 0 : (current - 1) * pageSize + 1,
2441
3195
  Math.min(current * pageSize, sortedData.length)
2442
3196
  ]) : `${current} / ${pageCount}`
2443
3197
  }),
2444
- /* @__PURE__ */ jsx9("button", {
3198
+ /* @__PURE__ */ jsx10("button", {
2445
3199
  type: "button",
2446
3200
  className: tablePaginationButtonClass,
2447
3201
  disabled: paginationConfig.disabled || current >= pageCount,
@@ -2453,7 +3207,7 @@ function TableRoot({
2453
3207
  ]
2454
3208
  });
2455
3209
  }
2456
- var TableWithRef = forwardRef7(TableRoot);
3210
+ var TableWithRef = forwardRef8(TableRoot);
2457
3211
  var Table = Object.assign(TableWithRef, {
2458
3212
  Column,
2459
3213
  ColumnGroup,
@@ -2466,7 +3220,7 @@ var Table = Object.assign(TableWithRef, {
2466
3220
  });
2467
3221
  Table.displayName = "Table";
2468
3222
  // src/components/dm-table/DmTable.tsx
2469
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3223
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2470
3224
  function mapAndFilter(list, mapper) {
2471
3225
  return list.map(mapper).filter((item) => item !== false && item != null);
2472
3226
  }
@@ -2517,9 +3271,9 @@ function DmTable({
2517
3271
  rowSelection,
2518
3272
  ...props
2519
3273
  }) {
2520
- const tableColumns = useMemo7(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
2521
- const [columns, setColumns] = useState8(tableColumns);
2522
- const [columnSettingsOpen, setColumnSettingsOpen] = useState8(false);
3274
+ const tableColumns = useMemo8(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
3275
+ const [columns, setColumns] = useState10(tableColumns);
3276
+ const [columnSettingsOpen, setColumnSettingsOpen] = useState10(false);
2523
3277
  const items = searchProps?.items?.length ? searchProps.items : searchItems(inputColumns);
2524
3278
  const paginationObj = typeof pagination === "object" ? pagination : undefined;
2525
3279
  const paginationProps = paginationObj ? Object.fromEntries(Object.entries(paginationObj).filter(([key]) => key !== "ref")) : {};
@@ -2532,37 +3286,37 @@ function DmTable({
2532
3286
  globalThis.localStorage?.removeItem(columnState.persistenceKey);
2533
3287
  }
2534
3288
  }
2535
- return /* @__PURE__ */ jsxs9("div", {
3289
+ return /* @__PURE__ */ jsxs10("div", {
2536
3290
  className: getDmTableClasses({ className }),
2537
3291
  children: [
2538
- items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx10(Card, {
3292
+ items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx11(Card, {
2539
3293
  className: dmTableSearchClass,
2540
3294
  padding: "md",
2541
- children: /* @__PURE__ */ jsx10(DmSearch, {
3295
+ children: /* @__PURE__ */ jsx11(DmSearch, {
2542
3296
  ...searchProps,
2543
3297
  items
2544
3298
  })
2545
3299
  }) : null,
2546
- indicators ? /* @__PURE__ */ jsx10("div", {
3300
+ indicators ? /* @__PURE__ */ jsx11("div", {
2547
3301
  className: dmTableIndicatorsClass,
2548
3302
  children: indicators
2549
3303
  }) : null,
2550
- /* @__PURE__ */ jsxs9(Card, {
3304
+ /* @__PURE__ */ jsxs10(Card, {
2551
3305
  className: dmTableCardClass,
2552
3306
  padding: "md",
2553
3307
  children: [
2554
- name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs9("div", {
3308
+ name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs10("div", {
2555
3309
  className: dmTableHeaderClass,
2556
3310
  children: [
2557
- /* @__PURE__ */ jsx10("div", {
3311
+ /* @__PURE__ */ jsx11("div", {
2558
3312
  className: dmTableTitleClass,
2559
3313
  children: name
2560
3314
  }),
2561
- /* @__PURE__ */ jsxs9("div", {
3315
+ /* @__PURE__ */ jsxs10("div", {
2562
3316
  className: dmTableExtraClass,
2563
3317
  children: [
2564
3318
  extra,
2565
- columnSettingVisible ? /* @__PURE__ */ jsx10(Button, {
3319
+ columnSettingVisible ? /* @__PURE__ */ jsx11(Button, {
2566
3320
  type: "button",
2567
3321
  color: "secondary",
2568
3322
  appearance: "outline",
@@ -2574,20 +3328,20 @@ function DmTable({
2574
3328
  })
2575
3329
  ]
2576
3330
  }) : null,
2577
- columnSettingsOpen ? /* @__PURE__ */ jsx10("div", {
3331
+ columnSettingsOpen ? /* @__PURE__ */ jsx11("div", {
2578
3332
  role: "dialog",
2579
3333
  "aria-label": "Column settings",
2580
- children: /* @__PURE__ */ jsx10(Button, {
3334
+ children: /* @__PURE__ */ jsx11(Button, {
2581
3335
  type: "button",
2582
3336
  onClick: resetColumns,
2583
3337
  children: "Reset columns"
2584
3338
  })
2585
3339
  }) : null,
2586
- tableExtra ? /* @__PURE__ */ jsx10("div", {
3340
+ tableExtra ? /* @__PURE__ */ jsx11("div", {
2587
3341
  className: dmTableTableExtraClass,
2588
3342
  children: tableExtra
2589
3343
  }) : null,
2590
- /* @__PURE__ */ jsx10(Table, {
3344
+ /* @__PURE__ */ jsx11(Table, {
2591
3345
  ...props,
2592
3346
  dataSource,
2593
3347
  rowSelection,
@@ -2603,7 +3357,7 @@ function DmTable({
2603
3357
  onChange: paginationObj?.onChange
2604
3358
  } : false
2605
3359
  }),
2606
- pagination ? /* @__PURE__ */ jsx10(DmPagination, {
3360
+ pagination ? /* @__PURE__ */ jsx11(DmPagination, {
2607
3361
  ...paginationProps,
2608
3362
  className: dmTablePaginationClass,
2609
3363
  total,
@@ -2617,7 +3371,7 @@ function DmTable({
2617
3371
  }
2618
3372
  DmTable.displayName = "DmTable";
2619
3373
  // src/components/dm-toolbar/DmToolbar.tsx
2620
- import { useMemo as useMemo8 } from "react";
3374
+ import { useMemo as useMemo9 } from "react";
2621
3375
 
2622
3376
  // src/classes/dm-toolbar.ts
2623
3377
  var dmToolbarBaseClass = "dm-toolbar";
@@ -2638,36 +3392,34 @@ function getDmToolbarItemClasses({
2638
3392
  // src/components/dropdown/Dropdown.tsx
2639
3393
  import {
2640
3394
  cloneElement,
2641
- forwardRef as forwardRef8,
3395
+ forwardRef as forwardRef9,
2642
3396
  isValidElement,
2643
- useId,
2644
- useState as useState9
3397
+ useEffect as useEffect4,
3398
+ useId as useId2,
3399
+ useRef as useRef4,
3400
+ useState as useState11
2645
3401
  } from "react";
2646
3402
 
2647
3403
  // src/classes/dropdown.ts
2648
- var dropdownWrapperClass = "dropdown-wrapper";
2649
- var dropdownBaseClass = "popover dropdown";
2650
- var dropdownOpenClass = "popover-show dropdown-open";
2651
- var dropdownArrowClass = "popover-arrow dropdown-arrow";
3404
+ var dropdownWrapperClass = "dropdown";
3405
+ var dropdownBaseClass = "dropdown-content";
3406
+ var dropdownArrowClass = "dropdown-arrow";
2652
3407
  var dropdownMenuClass = "menu dropdown-menu";
2653
3408
  var dropdownButtonClass = "dropdown-button";
2654
3409
  var dropdownPlacementClasses = {
2655
- top: "popover-top dropdown-top",
2656
- bottom: "popover-bottom dropdown-bottom",
2657
- left: "popover-left dropdown-left",
2658
- right: "popover-right dropdown-right",
2659
- topLeft: "popover-top dropdown-top-left",
2660
- topRight: "popover-top dropdown-top-right",
2661
- bottomLeft: "popover-bottom dropdown-bottom-left",
2662
- bottomRight: "popover-bottom dropdown-bottom-right"
3410
+ top: "dropdown-block-start",
3411
+ bottom: "dropdown-block-end",
3412
+ left: "dropdown-inline-start",
3413
+ right: "dropdown-inline-end",
3414
+ topLeft: "dropdown-block-start",
3415
+ topRight: "dropdown-block-start",
3416
+ bottomLeft: "dropdown-block-end",
3417
+ bottomRight: "dropdown-block-end"
2663
3418
  };
2664
3419
  function getDropdownClasses({
2665
- placement = "bottomLeft",
2666
- open,
2667
- arrow,
2668
3420
  className
2669
3421
  }) {
2670
- return cn(dropdownBaseClass, dropdownPlacementClasses[placement], open && dropdownOpenClass, !arrow && "popover-no-arrow dropdown-no-arrow", className);
3422
+ return cn(dropdownBaseClass, className);
2671
3423
  }
2672
3424
 
2673
3425
  // src/classes/menu.ts
@@ -2719,21 +3471,18 @@ function getMenuItemClasses({
2719
3471
  }
2720
3472
 
2721
3473
  // src/components/dropdown/Dropdown.tsx
2722
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2723
- function hasTrigger(triggers, trigger) {
2724
- return (triggers ?? ["hover"]).includes(trigger);
2725
- }
3474
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2726
3475
  function callHandler(handler, event) {
2727
3476
  handler?.(event);
2728
3477
  }
2729
3478
  function renderMenuItem(item, onClick, close) {
2730
3479
  if (item.type === "divider") {
2731
- return /* @__PURE__ */ jsx11("li", {
3480
+ return /* @__PURE__ */ jsx12("li", {
2732
3481
  className: menuDividerClass
2733
3482
  }, String(item.key));
2734
3483
  }
2735
- return /* @__PURE__ */ jsx11("li", {
2736
- children: /* @__PURE__ */ jsxs10("button", {
3484
+ return /* @__PURE__ */ jsx12("li", {
3485
+ children: /* @__PURE__ */ jsxs11("button", {
2737
3486
  type: "button",
2738
3487
  className: cn(menuItemClass, item.danger && "menu-item-danger", item.className),
2739
3488
  disabled: item.disabled,
@@ -2742,18 +3491,18 @@ function renderMenuItem(item, onClick, close) {
2742
3491
  close();
2743
3492
  },
2744
3493
  children: [
2745
- item.icon ? /* @__PURE__ */ jsx11("span", {
3494
+ item.icon ? /* @__PURE__ */ jsx12("span", {
2746
3495
  className: "menu-item-icon",
2747
3496
  children: item.icon
2748
3497
  }) : null,
2749
- /* @__PURE__ */ jsx11("span", {
3498
+ /* @__PURE__ */ jsx12("span", {
2750
3499
  children: item.label
2751
3500
  })
2752
3501
  ]
2753
3502
  })
2754
3503
  }, String(item.key));
2755
3504
  }
2756
- var DropdownRoot = forwardRef8(({
3505
+ var DropdownRoot = forwardRef9(({
2757
3506
  arrow,
2758
3507
  children,
2759
3508
  className,
@@ -2773,148 +3522,214 @@ var DropdownRoot = forwardRef8(({
2773
3522
  trigger = ["hover"],
2774
3523
  ...props
2775
3524
  }, ref) => {
2776
- const [internalOpen, setInternalOpen] = useState9(Boolean(defaultOpen));
2777
- const isControlled = open !== undefined;
2778
- const visible = isControlled ? open : internalOpen;
2779
- const overlayId = useId();
2780
- function setVisible(nextOpen) {
2781
- if (disabled)
3525
+ const [internalOpen, setInternalOpen] = useState11(Boolean(defaultOpen));
3526
+ const [nativeOpen, setNativeOpen] = useState11(Boolean(open ?? defaultOpen));
3527
+ const visible = open ?? internalOpen;
3528
+ const popupRef = useRef4(null);
3529
+ const popupId = useId2();
3530
+ const anchorName = `--dm-dropdown-${popupId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
3531
+ const clickTrigger = trigger.includes("click") || trigger.includes("hover");
3532
+ useEffect4(() => {
3533
+ const popup = popupRef.current;
3534
+ if (!popup?.showPopover || !popup?.hidePopover)
2782
3535
  return;
2783
- if (!isControlled) {
3536
+ if (visible && !popup.matches(":popover-open"))
3537
+ popup.showPopover();
3538
+ if (!visible && popup.matches(":popover-open"))
3539
+ popup.hidePopover();
3540
+ }, [visible]);
3541
+ function setVisible(nextOpen) {
3542
+ if (open === undefined)
2784
3543
  setInternalOpen(nextOpen);
2785
- }
2786
3544
  onOpenChange?.(nextOpen);
2787
3545
  }
2788
- const close = () => setVisible(false);
2789
- const toggleVisible = () => setVisible(!visible);
2790
- const menuNode = overlay ?? (menu?.items ? /* @__PURE__ */ jsx11("ul", {
3546
+ function close() {
3547
+ const popup = popupRef.current;
3548
+ if (popup?.matches(":popover-open"))
3549
+ popup.hidePopover();
3550
+ else
3551
+ setVisible(false);
3552
+ }
3553
+ const menuNode = overlay ?? (menu?.items ? /* @__PURE__ */ jsx12("ul", {
2791
3554
  className: dropdownMenuClass,
2792
3555
  children: menu.items.map((item) => renderMenuItem(item, menu.onClick, close))
2793
3556
  }) : null);
2794
3557
  const popup = dropdownRender ? dropdownRender(menuNode) : menuNode;
2795
- const shouldRenderPopup = !destroyPopupOnHide || visible;
2796
- const triggerProps = {
2797
- "aria-controls": visible ? overlayId : undefined,
2798
- "aria-expanded": visible || undefined,
2799
- onMouseEnter: hasTrigger(trigger, "hover") ? () => setVisible(true) : undefined,
2800
- onMouseLeave: hasTrigger(trigger, "hover") ? () => setVisible(false) : undefined,
2801
- onClick: hasTrigger(trigger, "click") ? toggleVisible : undefined,
2802
- onContextMenu: hasTrigger(trigger, "contextMenu") ? (event) => {
2803
- event.preventDefault();
2804
- toggleVisible();
2805
- } : undefined
3558
+ const show = () => !disabled && popupRef.current?.showPopover?.();
3559
+ const hide = () => !disabled && popupRef.current?.hidePopover?.();
3560
+ const toggle = () => {
3561
+ if (disabled)
3562
+ return;
3563
+ if (popupRef.current?.matches(":popover-open"))
3564
+ hide();
3565
+ else
3566
+ show();
2806
3567
  };
3568
+ const childIsButton = isValidElement(children) && (children.type === "button" || children.type === Button);
2807
3569
  const triggerNode = isValidElement(children) ? cloneElement(children, {
2808
- "aria-controls": triggerProps["aria-controls"] ?? children.props["aria-controls"],
2809
- "aria-expanded": triggerProps["aria-expanded"] ?? children.props["aria-expanded"],
3570
+ popoverTarget: childIsButton && clickTrigger && !disabled ? popupId : undefined,
3571
+ style: {
3572
+ ...children.props.style,
3573
+ anchorName
3574
+ },
3575
+ "aria-controls": popupId,
3576
+ "aria-expanded": nativeOpen,
3577
+ disabled: disabled || children.props.disabled,
2810
3578
  onMouseEnter: (event) => {
2811
3579
  callHandler(children.props.onMouseEnter, event);
2812
- triggerProps.onMouseEnter?.();
3580
+ if (trigger.includes("hover"))
3581
+ show();
2813
3582
  onMouseEnter?.(event);
2814
3583
  },
2815
3584
  onMouseLeave: (event) => {
2816
3585
  callHandler(children.props.onMouseLeave, event);
2817
- triggerProps.onMouseLeave?.();
2818
3586
  onMouseLeave?.(event);
2819
3587
  },
2820
3588
  onClick: (event) => {
2821
3589
  callHandler(children.props.onClick, event);
2822
- triggerProps.onClick?.();
2823
3590
  onClick?.(event);
3591
+ if (!childIsButton && clickTrigger && !event.defaultPrevented)
3592
+ toggle();
2824
3593
  },
2825
3594
  onContextMenu: (event) => {
2826
3595
  callHandler(children.props.onContextMenu, event);
2827
- triggerProps.onContextMenu?.(event);
3596
+ if (trigger.includes("contextMenu")) {
3597
+ event.preventDefault();
3598
+ toggle();
3599
+ }
2828
3600
  onContextMenu?.(event);
2829
3601
  }
2830
- }) : /* @__PURE__ */ jsx11("span", {
2831
- role: "button",
2832
- tabIndex: disabled ? -1 : 0,
2833
- "aria-disabled": disabled || undefined,
2834
- "aria-controls": triggerProps["aria-controls"],
2835
- "aria-expanded": triggerProps["aria-expanded"],
3602
+ }) : /* @__PURE__ */ jsx12("button", {
3603
+ type: "button",
3604
+ disabled,
3605
+ popoverTarget: clickTrigger && !disabled ? popupId : undefined,
3606
+ style: { anchorName },
3607
+ "aria-controls": popupId,
3608
+ "aria-expanded": nativeOpen,
2836
3609
  onMouseEnter: (event) => {
2837
- triggerProps.onMouseEnter?.();
3610
+ if (trigger.includes("hover"))
3611
+ show();
2838
3612
  onMouseEnter?.(event);
2839
3613
  },
2840
3614
  onMouseLeave: (event) => {
2841
- triggerProps.onMouseLeave?.();
2842
3615
  onMouseLeave?.(event);
2843
3616
  },
2844
- onClick: (event) => {
2845
- triggerProps.onClick?.();
2846
- onClick?.(event);
2847
- },
2848
- onKeyDown: (event) => {
2849
- if (event.key === "Enter" || event.key === " ") {
3617
+ onClick,
3618
+ onContextMenu: (event) => {
3619
+ if (trigger.includes("contextMenu")) {
2850
3620
  event.preventDefault();
2851
- triggerProps.onClick?.();
3621
+ toggle();
2852
3622
  }
2853
- },
2854
- onContextMenu: (event) => {
2855
- triggerProps.onContextMenu?.(event);
2856
3623
  onContextMenu?.(event);
2857
3624
  },
2858
3625
  children
2859
3626
  });
2860
- return /* @__PURE__ */ jsxs10("span", {
3627
+ return /* @__PURE__ */ jsxs11("span", {
2861
3628
  ...props,
2862
3629
  ref,
2863
- className: dropdownWrapperClass,
3630
+ className: cn(dropdownWrapperClass, dropdownPlacementClasses[placement]),
3631
+ onMouseLeave: trigger.includes("hover") ? hide : undefined,
2864
3632
  children: [
2865
3633
  triggerNode,
2866
- shouldRenderPopup ? /* @__PURE__ */ jsxs10("span", {
2867
- id: overlayId,
2868
- role: "menu",
2869
- className: getDropdownClasses({
2870
- placement,
2871
- open: visible,
2872
- arrow,
2873
- className
2874
- }),
3634
+ /* @__PURE__ */ jsxs11("span", {
3635
+ id: popupId,
3636
+ ref: popupRef,
3637
+ popover: "auto",
3638
+ style: { positionAnchor: anchorName },
3639
+ className: getDropdownClasses({ className, arrow }),
3640
+ onToggle: (event) => {
3641
+ if (event.target !== event.currentTarget)
3642
+ return;
3643
+ const nextOpen = event.nativeEvent.newState === "open";
3644
+ setNativeOpen(nextOpen);
3645
+ setVisible(nextOpen);
3646
+ },
2875
3647
  children: [
2876
- popup,
2877
- arrow ? /* @__PURE__ */ jsx11("span", {
3648
+ !destroyPopupOnHide || visible ? popup : null,
3649
+ arrow ? /* @__PURE__ */ jsx12("span", {
2878
3650
  className: dropdownArrowClass
2879
3651
  }) : null
2880
3652
  ]
2881
- }) : null
3653
+ })
2882
3654
  ]
2883
3655
  });
2884
3656
  });
2885
3657
  DropdownRoot.displayName = "Dropdown";
2886
- var DropdownButton = forwardRef8(({
3658
+ var DropdownButton = forwardRef9(({
2887
3659
  buttonsRender,
2888
3660
  children,
2889
3661
  disabled,
2890
3662
  menu,
2891
3663
  onClick,
2892
3664
  trigger = ["click"],
3665
+ color = "base",
3666
+ appearance = "outline",
3667
+ size,
3668
+ shape,
3669
+ block,
3670
+ isLoading,
3671
+ leftIcon,
3672
+ rightIcon,
3673
+ confirm,
2893
3674
  ...props
2894
3675
  }, ref) => {
3676
+ const buttonStyle = { color, appearance, size, shape };
2895
3677
  const buttons = [
2896
- /* @__PURE__ */ jsx11(Button, {
3678
+ /* @__PURE__ */ jsx12(Button, {
3679
+ ...buttonStyle,
2897
3680
  disabled,
3681
+ isLoading,
3682
+ leftIcon,
3683
+ rightIcon,
3684
+ confirm,
2898
3685
  onClick,
2899
3686
  children
2900
3687
  }, "primary"),
2901
- /* @__PURE__ */ jsx11(Button, {
3688
+ /* @__PURE__ */ jsx12(Button, {
3689
+ ...buttonStyle,
3690
+ type: "button",
2902
3691
  "aria-label": "Open dropdown",
2903
- disabled,
2904
- children: "v"
3692
+ disabled: disabled || isLoading,
3693
+ children: /* @__PURE__ */ jsxs11("svg", {
3694
+ "aria-hidden": "true",
3695
+ width: "18",
3696
+ height: "18",
3697
+ viewBox: "0 0 24 24",
3698
+ fill: "currentColor",
3699
+ children: [
3700
+ /* @__PURE__ */ jsx12("circle", {
3701
+ cx: "5",
3702
+ cy: "12",
3703
+ r: "1.75"
3704
+ }),
3705
+ /* @__PURE__ */ jsx12("circle", {
3706
+ cx: "12",
3707
+ cy: "12",
3708
+ r: "1.75"
3709
+ }),
3710
+ /* @__PURE__ */ jsx12("circle", {
3711
+ cx: "19",
3712
+ cy: "12",
3713
+ r: "1.75"
3714
+ })
3715
+ ]
3716
+ })
2905
3717
  }, "trigger")
2906
3718
  ];
2907
3719
  const renderedButtons = buttonsRender ? buttonsRender(buttons) : buttons;
2908
- return /* @__PURE__ */ jsx11(DropdownRoot, {
2909
- ...props,
3720
+ return /* @__PURE__ */ jsxs11("span", {
2910
3721
  ref,
2911
- menu,
2912
- trigger,
2913
- disabled,
2914
- children: /* @__PURE__ */ jsx11("span", {
2915
- className: dropdownButtonClass,
2916
- children: renderedButtons
2917
- })
3722
+ className: cn(dropdownButtonClass, block && "dropdown-button-block"),
3723
+ children: [
3724
+ renderedButtons[0],
3725
+ /* @__PURE__ */ jsx12(DropdownRoot, {
3726
+ ...props,
3727
+ menu,
3728
+ trigger,
3729
+ disabled: disabled || isLoading,
3730
+ children: renderedButtons[1]
3731
+ })
3732
+ ]
2918
3733
  });
2919
3734
  });
2920
3735
  DropdownButton.displayName = "Dropdown.Button";
@@ -2922,7 +3737,7 @@ var Dropdown = Object.assign(DropdownRoot, {
2922
3737
  Button: DropdownButton
2923
3738
  });
2924
3739
  // src/components/dm-toolbar/DmToolbar.tsx
2925
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
3740
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2926
3741
  function isPrimary(item) {
2927
3742
  return item.type === "primary";
2928
3743
  }
@@ -2938,7 +3753,7 @@ function renderToolbarItem(item, index) {
2938
3753
  } = item;
2939
3754
  const buttonProps = { ...buttonPropsWithKey };
2940
3755
  delete buttonProps.key;
2941
- const button = /* @__PURE__ */ jsx12(Button, {
3756
+ const button = /* @__PURE__ */ jsx13(Button, {
2942
3757
  ...buttonProps,
2943
3758
  type: htmlType,
2944
3759
  color: color ?? (type === "primary" ? "primary" : "secondary"),
@@ -2947,7 +3762,7 @@ function renderToolbarItem(item, index) {
2947
3762
  });
2948
3763
  if (!menu?.items?.length)
2949
3764
  return button;
2950
- return /* @__PURE__ */ jsx12(Dropdown, {
3765
+ return /* @__PURE__ */ jsx13(Dropdown, {
2951
3766
  trigger: ["click"],
2952
3767
  menu,
2953
3768
  children: button
@@ -2973,7 +3788,7 @@ function DmToolbar({
2973
3788
  moreText = "More",
2974
3789
  maxVisibleSecondaryItems
2975
3790
  }) {
2976
- const { visibleSecondaryItems, overflowSecondaryItems, primaryItems } = useMemo8(() => {
3791
+ const { visibleSecondaryItems, overflowSecondaryItems, primaryItems } = useMemo9(() => {
2977
3792
  const primaryItems = items.filter(isPrimary);
2978
3793
  const secondaryItems = items.filter((item) => !isPrimary(item));
2979
3794
  const visibleLimit = maxVisibleSecondaryItems === undefined ? secondaryItems.length : Math.max(0, maxVisibleSecondaryItems);
@@ -2982,18 +3797,18 @@ function DmToolbar({
2982
3797
  return { visibleSecondaryItems, overflowSecondaryItems, primaryItems };
2983
3798
  }, [items, maxVisibleSecondaryItems]);
2984
3799
  const showMore = overflowSecondaryItems.length > 0;
2985
- return /* @__PURE__ */ jsxs11("div", {
3800
+ return /* @__PURE__ */ jsxs12("div", {
2986
3801
  className: getDmToolbarClasses({ className }),
2987
3802
  style,
2988
3803
  children: [
2989
- visibleSecondaryItems.map((item, index) => /* @__PURE__ */ jsx12("span", {
3804
+ visibleSecondaryItems.map((item, index) => /* @__PURE__ */ jsx13("span", {
2990
3805
  className: getDmToolbarItemClasses({}),
2991
3806
  children: renderToolbarItem(item, index)
2992
3807
  }, item.key ?? `secondary-${index}`)),
2993
- showMore ? /* @__PURE__ */ jsx12(Dropdown, {
3808
+ showMore ? /* @__PURE__ */ jsx13(Dropdown, {
2994
3809
  trigger: ["click"],
2995
3810
  menu: toOverflowMenu(overflowSecondaryItems),
2996
- children: /* @__PURE__ */ jsx12(Button, {
3811
+ children: /* @__PURE__ */ jsx13(Button, {
2997
3812
  type: "button",
2998
3813
  className: dmToolbarMoreClass,
2999
3814
  color: "secondary",
@@ -3001,7 +3816,7 @@ function DmToolbar({
3001
3816
  children: moreText
3002
3817
  })
3003
3818
  }) : null,
3004
- primaryItems.map((item, index) => /* @__PURE__ */ jsx12("span", {
3819
+ primaryItems.map((item, index) => /* @__PURE__ */ jsx13("span", {
3005
3820
  className: getDmToolbarItemClasses({ primary: true }),
3006
3821
  children: renderToolbarItem(item, index)
3007
3822
  }, item.key ?? `primary-${index}`))
@@ -3010,7 +3825,7 @@ function DmToolbar({
3010
3825
  }
3011
3826
  DmToolbar.displayName = "DmToolbar";
3012
3827
  // src/components/dm-pro-table/DmProTable.tsx
3013
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
3828
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3014
3829
  function renderToolbar(toolBarRender) {
3015
3830
  if (typeof toolBarRender === "function")
3016
3831
  return toolBarRender();
@@ -3026,23 +3841,23 @@ function DmProTable({
3026
3841
  rowData,
3027
3842
  ...props
3028
3843
  }) {
3029
- return /* @__PURE__ */ jsxs12("div", {
3844
+ return /* @__PURE__ */ jsxs13("div", {
3030
3845
  className: getDmProTableClasses({ className }),
3031
3846
  children: [
3032
- showTitleBar ? /* @__PURE__ */ jsxs12("div", {
3847
+ showTitleBar ? /* @__PURE__ */ jsxs13("div", {
3033
3848
  className: dmProTableHeaderClass,
3034
3849
  children: [
3035
- /* @__PURE__ */ jsx13("div", {
3850
+ /* @__PURE__ */ jsx14("div", {
3036
3851
  className: dmProTableTitleClass,
3037
3852
  children: headerTitle
3038
3853
  }),
3039
- /* @__PURE__ */ jsxs12("div", {
3854
+ /* @__PURE__ */ jsxs13("div", {
3040
3855
  className: dmProTableToolbarClass,
3041
3856
  children: [
3042
- toolbarItems?.length ? /* @__PURE__ */ jsx13(DmToolbar, {
3857
+ toolbarItems?.length ? /* @__PURE__ */ jsx14(DmToolbar, {
3043
3858
  items: toolbarItems
3044
3859
  }) : renderToolbar(toolBarRender),
3045
- columnSettingVisible ? /* @__PURE__ */ jsx13(Button, {
3860
+ columnSettingVisible ? /* @__PURE__ */ jsx14(Button, {
3046
3861
  type: "button",
3047
3862
  color: "secondary",
3048
3863
  appearance: "outline",
@@ -3053,7 +3868,7 @@ function DmProTable({
3053
3868
  })
3054
3869
  ]
3055
3870
  }) : null,
3056
- /* @__PURE__ */ jsx13(DmTable, {
3871
+ /* @__PURE__ */ jsx14(DmTable, {
3057
3872
  ...props,
3058
3873
  columnSettingVisible: showTitleBar ? false : columnSettingVisible,
3059
3874
  dataSource: rowData