@duskmoon-dev/components 0.3.3 → 0.4.1

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