@sustaina/shared-ui 1.7.3 → 1.8.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.
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var React4 = require('react');
3
+ var React5 = require('react');
4
4
  var reactHookForm = require('react-hook-form');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var clsx3 = require('clsx');
6
+ var clsx2 = require('clsx');
7
7
  var tailwindMerge = require('tailwind-merge');
8
8
  var reactTable = require('@tanstack/react-table');
9
9
  var lucideReact = require('lucide-react');
10
+ var classVarianceAuthority = require('class-variance-authority');
10
11
  var zustand = require('zustand');
11
12
  var reactSlot = require('@radix-ui/react-slot');
12
13
  var LabelPrimitive2 = require('@radix-ui/react-label');
@@ -17,7 +18,6 @@ var SelectPrimitive = require('@radix-ui/react-select');
17
18
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
18
19
  var core = require('@dnd-kit/core');
19
20
  var modifiers = require('@dnd-kit/modifiers');
20
- var classVarianceAuthority = require('class-variance-authority');
21
21
  var zod = require('zod');
22
22
  var reactDom = require('react-dom');
23
23
  var PopoverPrimitive = require('@radix-ui/react-popover');
@@ -42,8 +42,8 @@ function _interopNamespace(e) {
42
42
  return Object.freeze(n);
43
43
  }
44
44
 
45
- var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
46
- var clsx3__default = /*#__PURE__*/_interopDefault(clsx3);
45
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
46
+ var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
47
47
  var LabelPrimitive2__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive2);
48
48
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
49
49
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
@@ -51,20 +51,20 @@ var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitiv
51
51
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
52
52
 
53
53
  // src/components/form/form-controls/use-form-field.ts
54
- var FormFieldContext = React4.createContext({});
54
+ var FormFieldContext = React5.createContext({});
55
55
  function FormField(props) {
56
56
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
57
57
  }
58
- var FormItemContext = React4.createContext({});
58
+ var FormItemContext = React5.createContext({});
59
59
  function FormItem({ children, ...props }) {
60
- const formItemId = React4.useId();
60
+ const formItemId = React5.useId();
61
61
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext, { value: { id: formItemId }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, children }) });
62
62
  }
63
63
 
64
64
  // src/components/form/form-controls/use-form-field.ts
65
65
  function useFormField(options) {
66
- const { name: formFieldName } = React4.useContext(FormFieldContext);
67
- const { id: formItemId } = React4.useContext(FormItemContext);
66
+ const { name: formFieldName } = React5.useContext(FormFieldContext);
67
+ const { id: formItemId } = React5.useContext(FormItemContext);
68
68
  const formContext = reactHookForm.useFormContext();
69
69
  if ((!formFieldName || !formItemId || !formContext) && options?.skipValidationIfNoContext) {
70
70
  return {
@@ -105,7 +105,7 @@ function useFormField(options) {
105
105
  };
106
106
  }
107
107
  function cn(...args) {
108
- return tailwindMerge.twMerge(clsx3.clsx(args));
108
+ return tailwindMerge.twMerge(clsx2.clsx(args));
109
109
  }
110
110
  function FormErrorMessage({ className, errorClassName, ...props }) {
111
111
  const { formErrorMessageId, invalid, error } = useFormField();
@@ -160,14 +160,105 @@ function isDefined(value) {
160
160
  function isEmptyObject(value) {
161
161
  return !!value && Object.keys(value).length === 0 && value.constructor === Object;
162
162
  }
163
- function debounce(fn, delay = 150) {
164
- let timeout = null;
165
- return (...args) => {
166
- if (timeout) clearTimeout(timeout);
167
- timeout = setTimeout(() => {
168
- fn(...args);
169
- }, delay);
170
- };
163
+ function debounce(func, wait = 150, options) {
164
+ let lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
165
+ if (typeof func !== "function") {
166
+ throw new TypeError("Expected a function");
167
+ }
168
+ wait = Number(wait) || 0;
169
+ if (options && typeof options === "object") {
170
+ leading = !!options.leading;
171
+ maxing = "maxWait" in options;
172
+ maxWait = maxing ? Math.max(Number(options.maxWait) || 0, wait) : void 0;
173
+ trailing = "trailing" in options ? !!options.trailing : trailing;
174
+ }
175
+ function invokeFunc(time) {
176
+ const args = lastArgs;
177
+ const thisArg = lastThis;
178
+ lastArgs = lastThis = void 0;
179
+ lastInvokeTime = time;
180
+ result = func.apply(thisArg, args);
181
+ return result;
182
+ }
183
+ function leadingEdge(time) {
184
+ lastInvokeTime = time;
185
+ timerId = setTimeout(timerExpired, wait);
186
+ return leading ? invokeFunc(time) : result;
187
+ }
188
+ function remainingWait(time) {
189
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
190
+ const timeSinceLastInvoke = time - lastInvokeTime;
191
+ const remaining = wait - timeSinceLastCall;
192
+ return maxing ? Math.min(remaining, (maxWait ?? 0) - timeSinceLastInvoke) : remaining;
193
+ }
194
+ function shouldInvoke(time) {
195
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
196
+ const timeSinceLastInvoke = time - lastInvokeTime;
197
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= (maxWait ?? 0);
198
+ }
199
+ function timerExpired() {
200
+ const time = Date.now();
201
+ if (shouldInvoke(time)) {
202
+ return trailingEdge(time);
203
+ }
204
+ timerId = setTimeout(timerExpired, remainingWait(time));
205
+ }
206
+ function trailingEdge(time) {
207
+ timerId = void 0;
208
+ if (trailing && lastArgs) {
209
+ return invokeFunc(time);
210
+ }
211
+ lastArgs = lastThis = void 0;
212
+ return result;
213
+ }
214
+ function cancel() {
215
+ if (timerId !== void 0) {
216
+ clearTimeout(timerId);
217
+ }
218
+ lastInvokeTime = 0;
219
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
220
+ }
221
+ function flush() {
222
+ return timerId === void 0 ? result : trailingEdge(Date.now());
223
+ }
224
+ function debounced(...args) {
225
+ const time = Date.now();
226
+ const isInvoking = shouldInvoke(time);
227
+ lastArgs = args;
228
+ lastThis = this;
229
+ lastCallTime = time;
230
+ if (isInvoking) {
231
+ if (timerId === void 0) {
232
+ return leadingEdge(lastCallTime);
233
+ }
234
+ if (maxing) {
235
+ timerId = setTimeout(timerExpired, wait);
236
+ return invokeFunc(lastCallTime);
237
+ }
238
+ }
239
+ if (timerId === void 0) {
240
+ timerId = setTimeout(timerExpired, wait);
241
+ }
242
+ return result;
243
+ }
244
+ debounced.cancel = cancel;
245
+ debounced.flush = flush;
246
+ return debounced;
247
+ }
248
+ function throttle(func, wait, options) {
249
+ let leading = true, trailing = true;
250
+ if (typeof func !== "function") {
251
+ throw new TypeError("Expected a function");
252
+ }
253
+ if (options) {
254
+ leading = "leading" in options ? !!options.leading : leading;
255
+ trailing = "trailing" in options ? !!options.trailing : trailing;
256
+ }
257
+ return debounce(func, wait, {
258
+ leading,
259
+ maxWait: wait,
260
+ trailing
261
+ });
171
262
  }
172
263
 
173
264
  // src/utils/filters.ts
@@ -217,9 +308,8 @@ function compareAlphanumeric(aStr, bStr) {
217
308
  }
218
309
  return a.length - b.length;
219
310
  }
220
- function cn2(...inputs) {
221
- return tailwindMerge.twMerge(clsx3.clsx(inputs));
222
- }
311
+
312
+ // src/components/data-table/utils.tsx
223
313
  function booleanToSelectValue(value, options) {
224
314
  if (value === true) return "true";
225
315
  if (value === false) return "false";
@@ -230,24 +320,12 @@ function selectValueToBoolean(value) {
230
320
  if (value === "false") return false;
231
321
  return void 0;
232
322
  }
233
- function renderContentSlot(slot, defaultWrapperProps) {
234
- const { content, wrapperProps = {} } = slot;
235
- const mergedProps = {
236
- ...defaultWrapperProps,
237
- ...wrapperProps,
238
- className: cn2(defaultWrapperProps?.className, wrapperProps?.className)
239
- };
240
- if (!content) {
241
- return null;
242
- }
243
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ...mergedProps, children: content });
244
- }
245
323
  var useHover = () => {
246
- const [hovering, setHovering] = React4.useState(false);
247
- const prevRef = React4.useRef(null);
248
- const onMouseEnter = React4.useCallback(() => setHovering(true), []);
249
- const onMouseLeave = React4.useCallback(() => setHovering(false), []);
250
- const nodeRefCallback = React4.useCallback(
324
+ const [hovering, setHovering] = React5.useState(false);
325
+ const prevRef = React5.useRef(null);
326
+ const onMouseEnter = React5.useCallback(() => setHovering(true), []);
327
+ const onMouseLeave = React5.useCallback(() => setHovering(false), []);
328
+ const nodeRefCallback = React5.useCallback(
251
329
  (node) => {
252
330
  if (prevRef.current) {
253
331
  prevRef.current.removeEventListener("mouseenter", onMouseEnter);
@@ -275,15 +353,15 @@ var useIntersectionObserver = ({
275
353
  initialIsIntersecting = false,
276
354
  onChange
277
355
  } = {}) => {
278
- const [ref, setRef] = React4.useState(null);
279
- const [state, setState] = React4.useState(() => ({
356
+ const [ref, setRef] = React5.useState(null);
357
+ const [state, setState] = React5.useState(() => ({
280
358
  isIntersecting: initialIsIntersecting,
281
359
  entry: void 0
282
360
  }));
283
- const callbackRef = React4.useRef(null);
361
+ const callbackRef = React5.useRef(null);
284
362
  callbackRef.current = onChange;
285
363
  const frozen = state.entry?.isIntersecting && freezeOnceVisible;
286
- React4.useEffect(() => {
364
+ React5.useEffect(() => {
287
365
  if (!ref) return;
288
366
  if (!("IntersectionObserver" in window)) return;
289
367
  if (frozen) return;
@@ -313,8 +391,8 @@ var useIntersectionObserver = ({
313
391
  frozen,
314
392
  freezeOnceVisible
315
393
  ]);
316
- const prevRef = React4.useRef(null);
317
- React4.useEffect(() => {
394
+ const prevRef = React5.useRef(null);
395
+ React5.useEffect(() => {
318
396
  if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
319
397
  prevRef.current = state.entry.target;
320
398
  setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
@@ -331,8 +409,8 @@ var isValidMediaQueryString = (query) => {
331
409
  return query !== "not all";
332
410
  };
333
411
  var useMediaQuery = ({ query }) => {
334
- const [matches, setMatches] = React4.useState(false);
335
- React4.useEffect(() => {
412
+ const [matches, setMatches] = React5.useState(false);
413
+ React5.useEffect(() => {
336
414
  if (typeof window === "undefined") {
337
415
  return;
338
416
  }
@@ -368,8 +446,8 @@ var useTruncated = ({
368
446
  onChange,
369
447
  resizeDetectDelay = 150
370
448
  }) => {
371
- const [isTruncated, setIsTruncated] = React4.useState(false);
372
- React4.useEffect(() => {
449
+ const [isTruncated, setIsTruncated] = React5.useState(false);
450
+ React5.useEffect(() => {
373
451
  const element = elementRef.current;
374
452
  if (!element) return;
375
453
  const checkTruncate = debounce(() => {
@@ -393,7 +471,14 @@ var useTruncated = ({
393
471
  return isTruncated;
394
472
  };
395
473
  var useTruncated_default = useTruncated;
396
- var HeaderCell = ({ rootClassName, labelClassName, context, label, sorterProps }) => {
474
+ var HeaderCell = ({
475
+ rootClassName,
476
+ labelClassName,
477
+ context,
478
+ label,
479
+ sorterProps,
480
+ align = "left"
481
+ }) => {
397
482
  const { ref, hovering } = useHover_default();
398
483
  const showSorter = sorterProps?.show ?? context.column.getCanSort();
399
484
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -401,46 +486,56 @@ var HeaderCell = ({ rootClassName, labelClassName, context, label, sorterProps }
401
486
  {
402
487
  ref,
403
488
  className: cn(
404
- "flex items-center gap-2",
489
+ "flex items-center justify-between gap-2",
405
490
  {
406
491
  "cursor-pointer": context?.column?.getCanSort()
407
492
  },
408
493
  rootClassName
409
494
  ),
410
- ...stripNullishObject({
411
- onClick: (event) => {
412
- event.preventDefault();
413
- if (context?.column?.getCanSort()) {
414
- context?.column?.toggleSorting();
415
- }
495
+ onClick: (event) => {
496
+ event.preventDefault();
497
+ if (context?.column?.getCanSort()) {
498
+ context?.column?.toggleSorting();
416
499
  }
417
- }),
500
+ },
418
501
  children: [
419
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-block font-bold", labelClassName), children: label }),
502
+ /* @__PURE__ */ jsxRuntime.jsx(
503
+ "div",
504
+ {
505
+ className: cn("flex-1 flex items-center", {
506
+ "justify-start": align === "left",
507
+ "justify-center": align === "center",
508
+ "justify-end": align === "right"
509
+ }),
510
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-block font-bold", labelClassName), children: label })
511
+ }
512
+ ),
420
513
  showSorter && /* @__PURE__ */ jsxRuntime.jsxs(
421
514
  "div",
422
515
  {
423
- className: "flex flex-col",
516
+ className: "flex flex-col -space-y-2",
424
517
  title: context.column.getCanSort() ? context.column.getNextSortingOrder() === "asc" ? "Sort ascending" : context.column.getNextSortingOrder() === "desc" ? "Sort descending" : "Clear sort" : void 0,
425
518
  children: [
426
519
  /* @__PURE__ */ jsxRuntime.jsx(
427
- lucideReact.Triangle,
520
+ lucideReact.ChevronUp,
428
521
  {
429
- className: cn("fill-gray-300 stroke-0", {
430
- "fill-[#41875c]": context?.column?.getIsSorted() === "asc",
431
- "fill-[#41875c]/45": context?.column?.getNextSortingOrder() === "asc" && hovering
522
+ className: cn("stroke-[#BBBBBB]", {
523
+ "stroke-[#41875c]": context?.column?.getIsSorted() === "asc",
524
+ "stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "asc" && hovering
432
525
  }),
433
- size: 12
526
+ size: 16,
527
+ strokeWidth: 3
434
528
  }
435
529
  ),
436
530
  /* @__PURE__ */ jsxRuntime.jsx(
437
- lucideReact.Triangle,
531
+ lucideReact.ChevronDown,
438
532
  {
439
- className: cn("rotate-180 fill-gray-300 stroke-0", {
440
- "fill-[#41875c]": context?.column?.getIsSorted() === "desc",
441
- "fill-[#41875c]/45": context?.column?.getNextSortingOrder() === "desc" && hovering
533
+ className: cn("stroke-[#BBBBBB]", {
534
+ "stroke-[#41875c]": context?.column?.getIsSorted() === "desc",
535
+ "stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "desc" && hovering
442
536
  }),
443
- size: 12
537
+ size: 16,
538
+ strokeWidth: 3
444
539
  }
445
540
  )
446
541
  ]
@@ -501,7 +596,7 @@ function TableHead({ className, ...props }) {
501
596
  {
502
597
  "data-slot": "table-head",
503
598
  className: cn(
504
- "text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] hover:bg-gray-200 bg-[#f7f4f4] truncate",
599
+ "text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] hover:bg-gray-200 bg-[#F0F0F0] truncate",
505
600
  className
506
601
  ),
507
602
  ...props
@@ -530,7 +625,7 @@ var ColumnResizer = ({ header, className, style }) => {
530
625
  "div",
531
626
  {
532
627
  className: cn(
533
- "absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
628
+ "z-[2] absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
534
629
  className
535
630
  ),
536
631
  onDoubleClick: () => header.column.resetSize(),
@@ -541,6 +636,37 @@ var ColumnResizer = ({ header, className, style }) => {
541
636
  );
542
637
  };
543
638
  var ColumnResizer_default = ColumnResizer;
639
+ var ColumnSeparator = ({ show, className, ...props }) => {
640
+ if (!show) return null;
641
+ return /* @__PURE__ */ jsxRuntime.jsx(
642
+ "span",
643
+ {
644
+ "data-slot": "table-head-separator",
645
+ className: cn("absolute right-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-300", className),
646
+ ...props
647
+ }
648
+ );
649
+ };
650
+ var ColumnSeparator_default = React5__namespace.default.memo(ColumnSeparator);
651
+ var StatusContentSlot = ({
652
+ content,
653
+ icon,
654
+ wrapperProps = {},
655
+ defaultWrapperProps,
656
+ defaultIcon
657
+ }) => {
658
+ if (!content && !icon && !defaultIcon) return null;
659
+ const mergedProps = {
660
+ ...defaultWrapperProps,
661
+ ...wrapperProps,
662
+ className: cn(defaultWrapperProps?.className, wrapperProps?.className)
663
+ };
664
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...mergedProps, children: [
665
+ icon ?? defaultIcon,
666
+ content
667
+ ] });
668
+ };
669
+ var StatusContentSlot_default = StatusContentSlot;
544
670
  var stateOptions = [
545
671
  "columnFilters",
546
672
  "globalFilter",
@@ -593,9 +719,9 @@ var modelOptions = [
593
719
  "getCenterVisibleLeafColumns"
594
720
  ];
595
721
  var DataTableDevTool = ({ table }) => {
596
- const [open, setOpen] = React4.useState(false);
597
- const [visibleStates, setVisibleStates] = React4.useState([]);
598
- const [visibleModels, setVisibleModels] = React4.useState([]);
722
+ const [open, setOpen] = React5.useState(false);
723
+ const [visibleStates, setVisibleStates] = React5.useState([]);
724
+ const [visibleModels, setVisibleModels] = React5.useState([]);
599
725
  const tableState = table.getState();
600
726
  const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
601
727
  const getCircularReplacer = () => {
@@ -706,12 +832,107 @@ var DataTableDevTool = ({ table }) => {
706
832
  ] });
707
833
  };
708
834
  var DataTableDevTool_default = DataTableDevTool;
835
+ var SuiEmptyDataIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 184 152", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", fillRule: "evenodd", children: [
836
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(24 31.67)", children: [
837
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { fillOpacity: ".8", cx: "67.797", cy: "106.89", rx: "67.797", ry: "12.668", fill: "#B0DFAA" }),
838
+ /* @__PURE__ */ jsxRuntime.jsx(
839
+ "path",
840
+ {
841
+ d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",
842
+ fill: "#CEE5D6"
843
+ }
844
+ ),
845
+ /* @__PURE__ */ jsxRuntime.jsx(
846
+ "path",
847
+ {
848
+ d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
849
+ fill: "#DDEEE3",
850
+ transform: "translate(13.56)"
851
+ }
852
+ ),
853
+ /* @__PURE__ */ jsxRuntime.jsx(
854
+ "path",
855
+ {
856
+ d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",
857
+ fill: "#F9F9F9"
858
+ }
859
+ ),
860
+ /* @__PURE__ */ jsxRuntime.jsx(
861
+ "path",
862
+ {
863
+ d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",
864
+ fill: "#DDEEE3"
865
+ }
866
+ )
867
+ ] }),
868
+ /* @__PURE__ */ jsxRuntime.jsx(
869
+ "path",
870
+ {
871
+ d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",
872
+ fill: "#DDEEE3"
873
+ }
874
+ ),
875
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: "translate(149.65 15.383)", fill: "#FFF", children: [
876
+ /* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }),
877
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })
878
+ ] })
879
+ ] }) });
880
+ var empty_data_default = SuiEmptyDataIcon;
881
+ var spinnerVariants = classVarianceAuthority.cva("relative inline-block aspect-square transform-gpu", {
882
+ variants: {
883
+ variant: {
884
+ primary: "[&>div]:bg-[#77ab8a]",
885
+ secondary: "[&>div]:bg-[#ab9555]",
886
+ destructive: "[&>div]:bg-destructive",
887
+ muted: "[&>div]:bg-muted-foreground"
888
+ },
889
+ size: {
890
+ sm: "size-7",
891
+ default: "size-8",
892
+ lg: "size-9",
893
+ xl: "size-10",
894
+ "2xl": "size-12"
895
+ }
896
+ },
897
+ defaultVariants: { variant: "primary", size: "default" }
898
+ });
899
+ var Spinner = ({ className, variant, size = "default" }) => /* @__PURE__ */ jsxRuntime.jsxs(
900
+ "div",
901
+ {
902
+ role: "status",
903
+ "aria-label": "Loading",
904
+ className: cn(
905
+ typeof size === "string" ? spinnerVariants({ variant, size }) : spinnerVariants({ variant }),
906
+ className
907
+ ),
908
+ style: typeof size === "number" ? { width: size, height: size } : void 0,
909
+ children: [
910
+ Array.from({ length: 12 }).map((_, i2) => /* @__PURE__ */ jsxRuntime.jsx(
911
+ "div",
912
+ {
913
+ className: "animate-sus-spinner absolute left-[46.5%] top-[4.4%] h-[24%] w-[7%] origin-[center_190%] rounded-full opacity-[0.1] will-change-transform",
914
+ style: {
915
+ transform: `rotate(${i2 * 30}deg)`,
916
+ animationDelay: `${(i2 * 0.083).toFixed(3)}s`
917
+ },
918
+ "aria-hidden": "true"
919
+ },
920
+ i2
921
+ )),
922
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
923
+ ]
924
+ }
925
+ );
709
926
 
710
927
  // src/components/data-table/helpers.ts
711
- function getColumnPinningStyles(column) {
928
+ function getColumnPinningInfo(column) {
712
929
  const isPinned = column.getIsPinned();
713
930
  const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
714
931
  const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
932
+ return { isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn };
933
+ }
934
+ function getColumnPinningStyles(column) {
935
+ const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
715
936
  const classes = cn(
716
937
  isPinned ? "sticky" : "relative",
717
938
  isPinned ? "z-[1]" : "z-0",
@@ -846,14 +1067,14 @@ var DataTable = ({
846
1067
  if (isDefined(tableRef) && !isDefined(tableRef?.current)) {
847
1068
  tableRef.current = table;
848
1069
  }
849
- const tableContainerRef = React4.useRef(null);
1070
+ const tableContainerRef = React5.useRef(null);
850
1071
  const isTableEmpty = table.getCoreRowModel().rows.length === 0;
851
1072
  const isTableEmptyAfterFiltering = table.getRowModel().rows.length === 0;
852
1073
  const isFiltering = table.getState().columnFilters.length > 0 || !!table.getState().globalFilter;
853
1074
  const leftVisibleLeftColumns = table.getLeftVisibleLeafColumns();
854
1075
  const centerVisibleLeafColumns = table.getCenterVisibleLeafColumns();
855
1076
  const rightVisibleLeafColumns = table.getRightVisibleLeafColumns();
856
- const { isSomeColumnsFilterable, filterableColumns } = React4.useMemo(() => {
1077
+ const { isSomeColumnsFilterable, filterableColumns } = React5.useMemo(() => {
857
1078
  const mergedColumns = [
858
1079
  ...leftVisibleLeftColumns,
859
1080
  ...centerVisibleLeafColumns,
@@ -864,14 +1085,14 @@ var DataTable = ({
864
1085
  );
865
1086
  return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
866
1087
  }, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
867
- const fetchMoreOnScrollReached = React4.useCallback(
1088
+ const fetchMoreOnScrollReached = React5.useCallback(
868
1089
  (containerRefElement) => {
869
1090
  if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
870
1091
  return;
871
1092
  }
872
1093
  const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
873
1094
  const scrollableHeight = scrollHeight - clientHeight;
874
- const distanceToBottom = scrollHeight - clientHeight - scrollTop;
1095
+ const distanceToBottom = scrollableHeight - scrollTop;
875
1096
  const ratioToBottom = scrollableHeight > 0 ? scrollTop / scrollableHeight : 1;
876
1097
  const info = {
877
1098
  scrollTop,
@@ -898,7 +1119,7 @@ var DataTable = ({
898
1119
  // eslint-disable-next-line react-hooks/exhaustive-deps
899
1120
  [scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
900
1121
  );
901
- React4.useEffect(() => {
1122
+ React5.useEffect(() => {
902
1123
  fetchMoreOnScrollReached(tableContainerRef.current);
903
1124
  }, [fetchMoreOnScrollReached]);
904
1125
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -912,11 +1133,29 @@ var DataTable = ({
912
1133
  ),
913
1134
  onScroll: (e2) => fetchMoreOnScrollReached(e2.currentTarget),
914
1135
  children: [
915
- isInitialLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(statusContent?.initialLoading || { content: "Loading..." }, {
916
- className: "flex flex-col h-full items-center justify-center text-sm py-4"
917
- }) }) : isTableEmpty ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(statusContent?.emptyData || { content: "There's nothing here yet." }, {
918
- className: "flex flex-col h-full items-center justify-center text-sm py-4"
919
- }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1136
+ isInitialLoading ? /* @__PURE__ */ jsxRuntime.jsx(
1137
+ StatusContentSlot_default,
1138
+ {
1139
+ content: statusContent?.initialLoading?.content ?? "Loading...",
1140
+ icon: statusContent?.initialLoading?.icon,
1141
+ wrapperProps: statusContent?.initialLoading?.wrapperProps,
1142
+ defaultWrapperProps: {
1143
+ className: "flex flex-col h-full items-center justify-center text-sm py-4 gap-2"
1144
+ },
1145
+ defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 })
1146
+ }
1147
+ ) : isTableEmpty ? /* @__PURE__ */ jsxRuntime.jsx(
1148
+ StatusContentSlot_default,
1149
+ {
1150
+ content: statusContent?.emptyData?.content ?? "There's nothing here yet.",
1151
+ icon: statusContent?.emptyData?.icon,
1152
+ wrapperProps: statusContent?.emptyData?.wrapperProps,
1153
+ defaultWrapperProps: {
1154
+ className: "flex flex-col h-full items-center justify-center text-sm py-4 gap-2"
1155
+ },
1156
+ defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(empty_data_default, { className: "text-[128px]" })
1157
+ }
1158
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
920
1159
  /* @__PURE__ */ jsxRuntime.jsxs(Table, { ...components?.tableProps, children: [
921
1160
  /* @__PURE__ */ jsxRuntime.jsxs(
922
1161
  TableHeader,
@@ -929,6 +1168,11 @@ var DataTable = ({
929
1168
  const { classes, style } = getColumnPinningStyles(header.column);
930
1169
  const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
931
1170
  const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
1171
+ const nextHeader = headerGroup.headers?.[header.index + 1] || header;
1172
+ const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
1173
+ const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
1174
+ const headerGroupLength = header.headerGroup.headers.length;
1175
+ const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
932
1176
  return /* @__PURE__ */ jsxRuntime.jsxs(
933
1177
  TableHead,
934
1178
  {
@@ -950,6 +1194,14 @@ var DataTable = ({
950
1194
  },
951
1195
  children: [
952
1196
  header.isPlaceholder ? null : reactTable.flexRender(header.column.columnDef.header, header.getContext()),
1197
+ /* @__PURE__ */ jsxRuntime.jsx(
1198
+ ColumnSeparator_default,
1199
+ {
1200
+ ...components?.columnSeparatorProps?.headerCell,
1201
+ ...header.column.columnDef?.meta?.columnSeparatorProps,
1202
+ show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
1203
+ }
1204
+ ),
953
1205
  /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
954
1206
  ]
955
1207
  },
@@ -973,7 +1225,6 @@ var DataTable = ({
973
1225
  column.columnDef?.meta?.filterCellProps?.className
974
1226
  ),
975
1227
  style: {
976
- // TODO: should we separate styles for filter or use same columns styles
977
1228
  ...style,
978
1229
  width: useColumnSizing ? column.getSize() : void 0,
979
1230
  minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
@@ -994,7 +1245,7 @@ var DataTable = ({
994
1245
  ),
995
1246
  /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
996
1247
  const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
997
- return /* @__PURE__ */ React4.createElement(
1248
+ return /* @__PURE__ */ React5.createElement(
998
1249
  TableRow,
999
1250
  {
1000
1251
  ...tableDataRowProps,
@@ -1042,20 +1293,39 @@ var DataTable = ({
1042
1293
  );
1043
1294
  }) })
1044
1295
  ] }),
1045
- isTableEmptyAfterFiltering && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(
1046
- statusContent?.emptyFilteredData || {
1047
- content: "No records found. Please try a different search."
1048
- },
1296
+ isTableEmptyAfterFiltering && /* @__PURE__ */ jsxRuntime.jsx(
1297
+ StatusContentSlot_default,
1049
1298
  {
1050
- className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4"
1299
+ content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
1300
+ icon: statusContent?.emptyFilteredData?.icon,
1301
+ wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
1302
+ defaultWrapperProps: {
1303
+ className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4 gap-2"
1304
+ },
1305
+ defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(empty_data_default, { className: "text-[128px]" })
1051
1306
  }
1052
- ) }),
1053
- scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(statusContent?.fetchingMore || { content: "Loading more..." }, {
1054
- className: "flex items-center justify-center text-sm py-4"
1055
- }) }),
1056
- scrollFetch?.enabled && !isFiltering && !isInitialLoading && !scrollFetch?.hasMore && !scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(statusContent?.noMoreData || { content: null }, {
1057
- className: "flex items-center justify-center text-sm py-4"
1058
- }) })
1307
+ ),
1308
+ scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(
1309
+ StatusContentSlot_default,
1310
+ {
1311
+ content: statusContent?.fetchingMore?.content ?? "Loading more...",
1312
+ wrapperProps: statusContent?.fetchingMore?.wrapperProps,
1313
+ defaultWrapperProps: {
1314
+ className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
1315
+ }
1316
+ }
1317
+ ),
1318
+ scrollFetch?.enabled && !isFiltering && !isInitialLoading && !scrollFetch?.hasMore && !scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(
1319
+ StatusContentSlot_default,
1320
+ {
1321
+ content: statusContent?.noMoreData?.content,
1322
+ icon: statusContent?.noMoreData?.icon,
1323
+ wrapperProps: statusContent?.noMoreData?.wrapperProps,
1324
+ defaultWrapperProps: {
1325
+ className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
1326
+ }
1327
+ }
1328
+ )
1059
1329
  ] }),
1060
1330
  debug && /* @__PURE__ */ jsxRuntime.jsx(DataTableDevTool_default, { table })
1061
1331
  ]
@@ -1072,7 +1342,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
1072
1342
  // src/components/prevent-page-leave/PreventPageLeave.tsx
1073
1343
  var PreventPageLeave = ({ children }) => {
1074
1344
  const { isPreventing } = usePreventPageLeaveStore();
1075
- React4.useEffect(() => {
1345
+ React5.useEffect(() => {
1076
1346
  if (!isPreventing || typeof window === "undefined") {
1077
1347
  return;
1078
1348
  }
@@ -1090,7 +1360,7 @@ var PreventPageLeave = ({ children }) => {
1090
1360
  var PreventPageLeave_default = PreventPageLeave;
1091
1361
  var usePreventPageLeave = ({ isPrevening }) => {
1092
1362
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
1093
- React4.useEffect(() => {
1363
+ React5.useEffect(() => {
1094
1364
  setPreventing(isPrevening);
1095
1365
  }, [isPrevening, setPreventing]);
1096
1366
  };
@@ -1163,15 +1433,15 @@ var t2 = function(o3, t3, s2) {
1163
1433
  };
1164
1434
  };
1165
1435
  var Form = reactHookForm.FormProvider;
1166
- var FormFieldContext2 = React4__namespace.createContext({});
1436
+ var FormFieldContext2 = React5__namespace.createContext({});
1167
1437
  var FormField2 = ({
1168
1438
  ...props
1169
1439
  }) => {
1170
1440
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext2.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
1171
1441
  };
1172
1442
  var useFormField2 = () => {
1173
- const fieldContext = React4__namespace.useContext(FormFieldContext2);
1174
- const itemContext = React4__namespace.useContext(FormItemContext2);
1443
+ const fieldContext = React5__namespace.useContext(FormFieldContext2);
1444
+ const itemContext = React5__namespace.useContext(FormItemContext2);
1175
1445
  const { getFieldState } = reactHookForm.useFormContext();
1176
1446
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
1177
1447
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -1188,9 +1458,9 @@ var useFormField2 = () => {
1188
1458
  ...fieldState
1189
1459
  };
1190
1460
  };
1191
- var FormItemContext2 = React4__namespace.createContext({});
1461
+ var FormItemContext2 = React5__namespace.createContext({});
1192
1462
  function FormItem2({ className, ...props }) {
1193
- const id = React4__namespace.useId();
1463
+ const id = React5__namespace.useId();
1194
1464
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext2.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
1195
1465
  }
1196
1466
  function FormControl({ ...props }) {
@@ -1493,7 +1763,7 @@ function SortableRow({
1493
1763
  id: value,
1494
1764
  disabled: name == "columns.0.id"
1495
1765
  });
1496
- const style = React4__namespace.useMemo(
1766
+ const style = React5__namespace.useMemo(
1497
1767
  () => ({
1498
1768
  transform: utilities.CSS.Transform.toString(transform),
1499
1769
  transition
@@ -1656,7 +1926,7 @@ var GridSettingsModal = ({
1656
1926
  onClose,
1657
1927
  onSaveColumns
1658
1928
  }) => {
1659
- const [isDragging, setIsDragging] = React4.useState(false);
1929
+ const [isDragging, setIsDragging] = React5.useState(false);
1660
1930
  const form = reactHookForm.useForm({
1661
1931
  resolver: t2(GridSettingsSchema),
1662
1932
  defaultValues: { columns: currentColumns },
@@ -1668,7 +1938,7 @@ var GridSettingsModal = ({
1668
1938
  name: "columns",
1669
1939
  keyName: "fieldId"
1670
1940
  });
1671
- React4.useEffect(() => {
1941
+ React5.useEffect(() => {
1672
1942
  if (isOpen) {
1673
1943
  form.reset({ columns: currentColumns });
1674
1944
  }
@@ -1926,7 +2196,7 @@ var InfoIcon = (props) => {
1926
2196
  }
1927
2197
  );
1928
2198
  };
1929
- var InfoIcon_default = React4__namespace.default.memo(InfoIcon);
2199
+ var InfoIcon_default = React5__namespace.default.memo(InfoIcon);
1930
2200
  function TooltipProvider2({
1931
2201
  delayDuration = 0,
1932
2202
  ...props
@@ -1997,7 +2267,7 @@ var Navbar = ({
1997
2267
  }) => {
1998
2268
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
1999
2269
  const Icon3 = lucideReact.CircleHelp;
2000
- const shouldShowSeparator = !separatorDisable && React4.isValidElement(searchButton);
2270
+ const shouldShowSeparator = !separatorDisable && React5.isValidElement(searchButton);
2001
2271
  return /* @__PURE__ */ jsxRuntime.jsxs(
2002
2272
  "nav",
2003
2273
  {
@@ -2008,8 +2278,8 @@ var Navbar = ({
2008
2278
  children: [
2009
2279
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
2010
2280
  headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
2011
- React4.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
2012
- React4.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
2281
+ React5.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
2282
+ React5.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
2013
2283
  ] }),
2014
2284
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
2015
2285
  /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
@@ -2040,10 +2310,10 @@ var Navbar = ({
2040
2310
  ),
2041
2311
  children: [
2042
2312
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
2043
- React4.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon3, { size: 32, "aria-hidden": "true" }),
2313
+ React5.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon3, { size: 32, "aria-hidden": "true" }),
2044
2314
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
2045
2315
  ] }),
2046
- React4.isValidElement(tooltipdescription) && tooltipdescription
2316
+ React5.isValidElement(tooltipdescription) && tooltipdescription
2047
2317
  ]
2048
2318
  }
2049
2319
  ),
@@ -2097,19 +2367,19 @@ var Navbar = ({
2097
2367
  }
2098
2368
  ),
2099
2369
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
2100
- React4.isValidElement(searchButton) ? searchButton : ""
2370
+ React5.isValidElement(searchButton) ? searchButton : ""
2101
2371
  ] })
2102
2372
  ]
2103
2373
  }
2104
2374
  );
2105
2375
  };
2106
- var navbar_default = React4__namespace.default.memo(Navbar);
2376
+ var navbar_default = React5__namespace.default.memo(Navbar);
2107
2377
  var ExpandCollapse = ({ title, children, portalId }) => {
2108
- const [isOpen, setIsOpen] = React4.useState(false);
2378
+ const [isOpen, setIsOpen] = React5.useState(false);
2109
2379
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
2110
2380
  "div",
2111
2381
  {
2112
- className: clsx3__default.default(
2382
+ className: clsx2__default.default(
2113
2383
  "overflow-hidden transition-all duration-500 ease-in-out bg-white border-b shadow-md w-full",
2114
2384
  isOpen ? "max-h-[700px] opacity-100" : "max-h-0 opacity-0"
2115
2385
  ),
@@ -2142,7 +2412,6 @@ var ExpandCollapse_default = ExpandCollapse;
2142
2412
 
2143
2413
  // src/components/advanceSearch/operatorMap.ts
2144
2414
  var OPERATOR_MAP = {
2145
- uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
2146
2415
  text: [
2147
2416
  "contains",
2148
2417
  "equals",
@@ -2158,7 +2427,18 @@ var OPERATOR_MAP = {
2158
2427
  datetime: ["on", "after", "before", "between"],
2159
2428
  checkbox: ["is", "isNot"],
2160
2429
  dropdown: ["is", "isNot"],
2161
- lookup: ["containsAny", "containsOnly", "containsAll", "notContains"]
2430
+ lookup: ["containsAny", "containsOnly", "containsAll", "notContains"],
2431
+ uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
2432
+ json: [
2433
+ "contains",
2434
+ "equals",
2435
+ "beginsWith",
2436
+ "endsWith",
2437
+ "notEquals",
2438
+ "notBeginsWith",
2439
+ "notEndsWith",
2440
+ "notContains"
2441
+ ]
2162
2442
  };
2163
2443
 
2164
2444
  // src/components/advanceSearch/hooks/useAdvanceSearch.ts
@@ -2182,7 +2462,8 @@ function makeNewRow(field) {
2182
2462
  operator: "between",
2183
2463
  value: "",
2184
2464
  value2: "",
2185
- multiTableSearch: field.multiTableSearch
2465
+ multiTableSearch: field.multiTableSearch,
2466
+ jsonPath: field.jsonPath
2186
2467
  };
2187
2468
  }
2188
2469
  return {
@@ -2191,34 +2472,35 @@ function makeNewRow(field) {
2191
2472
  fieldType: field.type,
2192
2473
  operator: op,
2193
2474
  value: "",
2194
- multiTableSearch: field.multiTableSearch
2475
+ multiTableSearch: field.multiTableSearch,
2476
+ jsonPath: field.jsonPath
2195
2477
  };
2196
2478
  }
2197
2479
  function useAdvanceSearch({ fields, limitRows }) {
2198
- const [rows, setRows] = React4.useState([makeNewRow(fields[0])]);
2199
- const updateRows = React4.useCallback((next) => {
2480
+ const [rows, setRows] = React5.useState([makeNewRow(fields[0])]);
2481
+ const updateRows = React5.useCallback((next) => {
2200
2482
  setRows(next);
2201
2483
  }, []);
2202
- const operatorsForField = React4.useCallback(
2484
+ const operatorsForField = React5.useCallback(
2203
2485
  (fieldName) => {
2204
2486
  const t3 = getFieldType(fields, fieldName);
2205
2487
  return OPERATOR_MAP[t3];
2206
2488
  },
2207
2489
  [fields]
2208
2490
  );
2209
- const addRow = React4.useCallback(() => {
2491
+ const addRow = React5.useCallback(() => {
2210
2492
  if (!limitRows || rows.length < limitRows) {
2211
2493
  updateRows([...rows, makeNewRow(fields[0])]);
2212
2494
  }
2213
2495
  }, [rows, fields, updateRows, limitRows]);
2214
- const removeRow = React4.useCallback(
2496
+ const removeRow = React5.useCallback(
2215
2497
  (id) => {
2216
2498
  if (rows.length === 1) return;
2217
2499
  updateRows(rows.filter((r2) => r2.id !== id));
2218
2500
  },
2219
2501
  [rows, updateRows]
2220
2502
  );
2221
- const clearRow = React4.useCallback(
2503
+ const clearRow = React5.useCallback(
2222
2504
  (id) => {
2223
2505
  updateRows(
2224
2506
  rows.map((r2) => {
@@ -2237,10 +2519,10 @@ function useAdvanceSearch({ fields, limitRows }) {
2237
2519
  },
2238
2520
  [rows, fields, updateRows]
2239
2521
  );
2240
- const clearAllRow = React4.useCallback(() => {
2522
+ const clearAllRow = React5.useCallback(() => {
2241
2523
  updateRows([makeNewRow(fields[0])]);
2242
2524
  }, [fields, updateRows]);
2243
- const changeField = React4.useCallback(
2525
+ const changeField = React5.useCallback(
2244
2526
  (id, fieldName) => {
2245
2527
  updateRows(
2246
2528
  rows.map((r2) => {
@@ -2252,7 +2534,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2252
2534
  },
2253
2535
  [rows, fields, updateRows]
2254
2536
  );
2255
- const changeOperator = React4.useCallback(
2537
+ const changeOperator = React5.useCallback(
2256
2538
  (id, operator) => {
2257
2539
  updateRows(
2258
2540
  rows.map((r2) => {
@@ -2263,6 +2545,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2263
2545
  fieldName: r2.fieldName,
2264
2546
  fieldType: r2.fieldType,
2265
2547
  multiTableSearch: r2.multiTableSearch,
2548
+ jsonPath: r2.jsonPath,
2266
2549
  operator,
2267
2550
  value: "",
2268
2551
  value2: ""
@@ -2273,6 +2556,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2273
2556
  fieldName: r2.fieldName,
2274
2557
  fieldType: r2.fieldType,
2275
2558
  multiTableSearch: r2.multiTableSearch,
2559
+ jsonPath: r2.jsonPath,
2276
2560
  operator,
2277
2561
  value: ""
2278
2562
  };
@@ -2281,7 +2565,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2281
2565
  },
2282
2566
  [rows, updateRows]
2283
2567
  );
2284
- const changeValue = React4.useCallback(
2568
+ const changeValue = React5.useCallback(
2285
2569
  (id, which, val) => {
2286
2570
  updateRows(
2287
2571
  rows.map((r2) => {
@@ -2293,23 +2577,13 @@ function useAdvanceSearch({ fields, limitRows }) {
2293
2577
  },
2294
2578
  [rows, updateRows]
2295
2579
  );
2296
- const fieldOptions = React4.useMemo(
2580
+ const fieldOptions = React5.useMemo(
2297
2581
  () => fields.map((f) => ({
2298
2582
  value: f.name,
2299
2583
  label: f.label ?? f.name
2300
2584
  })),
2301
2585
  [fields]
2302
2586
  );
2303
- const buildFilter = React4.useCallback(
2304
- (prismaFilter, options) => {
2305
- return options?.multiTableSearch ? {
2306
- some: {
2307
- value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
2308
- }
2309
- } : prismaFilter;
2310
- },
2311
- []
2312
- );
2313
2587
  return {
2314
2588
  rows,
2315
2589
  addRow,
@@ -2320,8 +2594,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2320
2594
  changeOperator,
2321
2595
  changeValue,
2322
2596
  operatorsForField,
2323
- fieldOptions,
2324
- buildFilter
2597
+ fieldOptions
2325
2598
  };
2326
2599
  }
2327
2600
 
@@ -2349,6 +2622,9 @@ var OPERATOR_LABEL = {
2349
2622
  containsOnly: "Contains only",
2350
2623
  containsAll: "Contains all of"
2351
2624
  };
2625
+ function cn2(...inputs) {
2626
+ return tailwindMerge.twMerge(clsx2.clsx(inputs));
2627
+ }
2352
2628
  function Select2({ ...props }) {
2353
2629
  return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
2354
2630
  }
@@ -2630,13 +2906,13 @@ function DatePicker({
2630
2906
  className,
2631
2907
  ...props
2632
2908
  }) {
2633
- const today = React4__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
2634
- const [displayed, setDisplayed] = React4__namespace.useState(
2909
+ const today = React5__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
2910
+ const [displayed, setDisplayed] = React5__namespace.useState(
2635
2911
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
2636
2912
  );
2637
2913
  minDate = clampToDay(minDate);
2638
2914
  maxDate = clampToDay(maxDate);
2639
- const disabledSet = React4__namespace.useMemo(() => {
2915
+ const disabledSet = React5__namespace.useMemo(() => {
2640
2916
  const s2 = /* @__PURE__ */ new Set();
2641
2917
  disabledDates?.forEach((d) => s2.add(startOfDay(d).toISOString()));
2642
2918
  return s2;
@@ -2645,7 +2921,7 @@ function DatePicker({
2645
2921
  const displayMonth = displayed.getMonth();
2646
2922
  const monthLabel = callbacks?.monthLabel?.(displayYear, displayMonth) ?? new Intl.DateTimeFormat(void 0, { month: "short" }).format(displayed);
2647
2923
  const yearLabel = callbacks?.yearLabel?.(displayYear) ?? String(displayYear);
2648
- const weekdays = React4__namespace.useMemo(() => {
2924
+ const weekdays = React5__namespace.useMemo(() => {
2649
2925
  const labels = [];
2650
2926
  for (let i2 = 0; i2 < 7; i2++) {
2651
2927
  const idx = i2;
@@ -2654,7 +2930,7 @@ function DatePicker({
2654
2930
  }
2655
2931
  return labels;
2656
2932
  }, [callbacks]);
2657
- const grid = React4__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
2933
+ const grid = React5__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
2658
2934
  const isDateDisabled = (date) => {
2659
2935
  const d = startOfDay(date);
2660
2936
  if (minDate && d < minDate) return true;
@@ -2733,7 +3009,7 @@ function DatePicker({
2733
3009
  ] });
2734
3010
  }
2735
3011
  var TagsInput = ({ value = [], onChange, onClear, error }) => {
2736
- const [inputValue, setInputValue] = React4.useState("");
3012
+ const [inputValue, setInputValue] = React5.useState("");
2737
3013
  const addTag = (val) => {
2738
3014
  const trimmed = val.trim();
2739
3015
  if (!trimmed) return;
@@ -4428,10 +4704,10 @@ function splitDateString(dateString) {
4428
4704
  return dateStrings;
4429
4705
  }
4430
4706
  function parseYear(dateString, additionalDigits) {
4431
- const regex = new RegExp(
4707
+ const regex2 = new RegExp(
4432
4708
  "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
4433
4709
  );
4434
- const captures = dateString.match(regex);
4710
+ const captures = dateString.match(regex2);
4435
4711
  if (!captures) return { year: NaN, restDateString: "" };
4436
4712
  const year = captures[1] ? parseInt(captures[1]) : null;
4437
4713
  const century = captures[2] ? parseInt(captures[2]) : null;
@@ -4537,15 +4813,15 @@ function Label4({ className, ...props }) {
4537
4813
  );
4538
4814
  }
4539
4815
  var Form2 = reactHookForm.FormProvider;
4540
- var FormFieldContext3 = React4__namespace.createContext({});
4816
+ var FormFieldContext3 = React5__namespace.createContext({});
4541
4817
  var FormField3 = ({
4542
4818
  ...props
4543
4819
  }) => {
4544
4820
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext3.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
4545
4821
  };
4546
4822
  var useFormField3 = () => {
4547
- const fieldContext = React4__namespace.useContext(FormFieldContext3);
4548
- const itemContext = React4__namespace.useContext(FormItemContext3);
4823
+ const fieldContext = React5__namespace.useContext(FormFieldContext3);
4824
+ const itemContext = React5__namespace.useContext(FormItemContext3);
4549
4825
  const { getFieldState } = reactHookForm.useFormContext();
4550
4826
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
4551
4827
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -4562,9 +4838,9 @@ var useFormField3 = () => {
4562
4838
  ...fieldState
4563
4839
  };
4564
4840
  };
4565
- var FormItemContext3 = React4__namespace.createContext({});
4841
+ var FormItemContext3 = React5__namespace.createContext({});
4566
4842
  function FormItem3({ className, ...props }) {
4567
- const id = React4__namespace.useId();
4843
+ const id = React5__namespace.useId();
4568
4844
  return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext3.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn2("grid gap-2", className), ...props }) });
4569
4845
  }
4570
4846
  function FormControl2({ ...props }) {
@@ -4596,7 +4872,7 @@ var AdvanceSearchRow = ({
4596
4872
  const { control } = form;
4597
4873
  const fieldSchema = fields.find((f) => f.name === row.fieldName);
4598
4874
  const fieldType = fieldSchema?.type ?? "text";
4599
- React4__namespace.default.useEffect(() => {
4875
+ React5__namespace.default.useEffect(() => {
4600
4876
  if (operators && operators.length > 0 && !operators.includes(row.operator)) {
4601
4877
  onChangeOperator(operators[0]);
4602
4878
  }
@@ -4607,8 +4883,8 @@ var AdvanceSearchRow = ({
4607
4883
  const isLookup = fieldType === "lookup";
4608
4884
  const isNumber = fieldType === "number";
4609
4885
  const isDate2 = fieldType === "date" || fieldType === "datetime";
4610
- const [openDateValue1, setOpenDateValue1] = React4__namespace.default.useState(false);
4611
- const [openDateValue2, setOpenDateValue2] = React4__namespace.default.useState(false);
4886
+ const [openDateValue1, setOpenDateValue1] = React5__namespace.default.useState(false);
4887
+ const [openDateValue2, setOpenDateValue2] = React5__namespace.default.useState(false);
4612
4888
  const toDateFromISO = (v) => {
4613
4889
  if (!v) return void 0;
4614
4890
  try {
@@ -4839,6 +5115,372 @@ var AdvanceSearchRow = ({
4839
5115
  ) })
4840
5116
  ] });
4841
5117
  };
5118
+
5119
+ // src/components/advanceSearch/builder/checkbox.ts
5120
+ var CheckboxBuilder = class {
5121
+ build(row) {
5122
+ switch (row.operator) {
5123
+ case "is":
5124
+ return { [row.fieldName]: row.value };
5125
+ case "isNot":
5126
+ return { [row.fieldName]: { not: row.value } };
5127
+ default:
5128
+ return {};
5129
+ }
5130
+ }
5131
+ };
5132
+
5133
+ // src/components/advanceSearch/builder/helper.ts
5134
+ var helper = (prismaFilter, options) => {
5135
+ return options?.multiTableSearch ? {
5136
+ some: {
5137
+ value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
5138
+ }
5139
+ } : prismaFilter;
5140
+ };
5141
+
5142
+ // src/components/advanceSearch/builder/datetime.ts
5143
+ var DatetimeBuilder = class {
5144
+ build(row) {
5145
+ try {
5146
+ const start = new Date(row.value);
5147
+ start.setHours(0, 0, 0, 0);
5148
+ const end = new Date(row.value);
5149
+ end.setHours(23, 59, 59, 59);
5150
+ switch (row.operator) {
5151
+ case "on": {
5152
+ return {
5153
+ [row.fieldName]: helper(
5154
+ { gte: start.toISOString(), lt: end.toISOString() },
5155
+ { multiTableSearch: row.multiTableSearch }
5156
+ )
5157
+ };
5158
+ }
5159
+ case "after":
5160
+ return {
5161
+ [row.fieldName]: helper(
5162
+ { gte: start.toISOString() },
5163
+ { multiTableSearch: row.multiTableSearch }
5164
+ )
5165
+ };
5166
+ case "before":
5167
+ return {
5168
+ [row.fieldName]: helper(
5169
+ { lt: start.toISOString() },
5170
+ { multiTableSearch: row.multiTableSearch }
5171
+ )
5172
+ };
5173
+ case "between": {
5174
+ const start2 = new Date(row.value);
5175
+ start2.setHours(0, 0, 0, 0);
5176
+ const end2 = new Date(row.value2);
5177
+ end2.setHours(23, 59, 59, 59);
5178
+ return {
5179
+ [row.fieldName]: helper(
5180
+ { gte: start2.toISOString(), lt: end2.toISOString() },
5181
+ { multiTableSearch: row.multiTableSearch }
5182
+ )
5183
+ };
5184
+ }
5185
+ default:
5186
+ return {};
5187
+ }
5188
+ } catch {
5189
+ return {};
5190
+ }
5191
+ }
5192
+ };
5193
+
5194
+ // src/components/advanceSearch/builder/dropdown.ts
5195
+ var DropdownBuilder = class {
5196
+ build(row) {
5197
+ switch (row.operator) {
5198
+ case "is":
5199
+ return { [row.fieldName]: row.value };
5200
+ case "isNot":
5201
+ return { [row.fieldName]: { not: row.value } };
5202
+ default:
5203
+ return {};
5204
+ }
5205
+ }
5206
+ };
5207
+
5208
+ // src/components/advanceSearch/builder/json.ts
5209
+ var JSONBuilder = class {
5210
+ build(row) {
5211
+ switch (row.operator) {
5212
+ case "contains":
5213
+ return { [row.fieldName]: { path: row.jsonPath, string_contains: row.value } };
5214
+ case "equals":
5215
+ return { [row.fieldName]: { path: row.jsonPath, equals: row.value } };
5216
+ case "beginsWith":
5217
+ return { [row.fieldName]: { path: row.jsonPath, string_starts_with: row.value } };
5218
+ case "endsWith":
5219
+ return { [row.fieldName]: { path: row.jsonPath, string_ends_with: row.value } };
5220
+ case "notContains":
5221
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_contains: row.value } } };
5222
+ case "notEquals":
5223
+ return { [row.fieldName]: { path: row.jsonPath, not: { equals: row.value } } };
5224
+ case "notBeginsWith":
5225
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_starts_with: row.value } } };
5226
+ case "notEndsWith":
5227
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_ends_with: row.value } } };
5228
+ default:
5229
+ return {};
5230
+ }
5231
+ }
5232
+ };
5233
+
5234
+ // src/components/advanceSearch/builder/lookup.ts
5235
+ var LookupBuilder = class {
5236
+ build(row) {
5237
+ switch (row.operator) {
5238
+ case "containsAny":
5239
+ return {
5240
+ [row.fieldName]: helper(
5241
+ { hasSome: String(row.value).split(",") },
5242
+ { multiTableSearch: row.multiTableSearch }
5243
+ )
5244
+ };
5245
+ case "containsAll":
5246
+ return {
5247
+ [row.fieldName]: helper(
5248
+ { hasEvery: String(row.value).split(",") },
5249
+ { multiTableSearch: row.multiTableSearch }
5250
+ )
5251
+ };
5252
+ case "containsOnly":
5253
+ return {
5254
+ [row.fieldName]: helper(
5255
+ { equals: String(row.value).split(",") },
5256
+ {
5257
+ multiTableSearch: row.multiTableSearch,
5258
+ insensitive: true
5259
+ }
5260
+ )
5261
+ };
5262
+ case "notContains":
5263
+ return {
5264
+ [row.fieldName]: helper(
5265
+ { not: { contains: row.value } },
5266
+ {
5267
+ multiTableSearch: row.multiTableSearch,
5268
+ insensitive: true
5269
+ }
5270
+ )
5271
+ };
5272
+ default:
5273
+ return {};
5274
+ }
5275
+ }
5276
+ };
5277
+
5278
+ // src/components/advanceSearch/builder/number.ts
5279
+ var NumberBuilder = class {
5280
+ build(row) {
5281
+ const value = Number(row.value);
5282
+ switch (row.operator) {
5283
+ case "gt":
5284
+ return {
5285
+ [row.fieldName]: helper({ gt: value }, { multiTableSearch: row.multiTableSearch })
5286
+ };
5287
+ case "gte":
5288
+ return {
5289
+ [row.fieldName]: helper({ gte: value }, { multiTableSearch: row.multiTableSearch })
5290
+ };
5291
+ case "lt":
5292
+ return {
5293
+ [row.fieldName]: helper({ lt: value }, { multiTableSearch: row.multiTableSearch })
5294
+ };
5295
+ case "lte":
5296
+ return {
5297
+ [row.fieldName]: helper({ lte: value }, { multiTableSearch: row.multiTableSearch })
5298
+ };
5299
+ case "equals":
5300
+ return {
5301
+ [row.fieldName]: helper(
5302
+ { equals: value },
5303
+ {
5304
+ multiTableSearch: row.multiTableSearch
5305
+ }
5306
+ )
5307
+ };
5308
+ case "notEquals":
5309
+ return {
5310
+ [row.fieldName]: helper(
5311
+ { not: value },
5312
+ {
5313
+ multiTableSearch: row.multiTableSearch
5314
+ }
5315
+ )
5316
+ };
5317
+ default:
5318
+ return {};
5319
+ }
5320
+ }
5321
+ };
5322
+
5323
+ // src/components/advanceSearch/builder/text.ts
5324
+ var TextBuilder = class {
5325
+ build(row) {
5326
+ switch (row.operator) {
5327
+ case "contains":
5328
+ return {
5329
+ [row.fieldName]: helper(
5330
+ { contains: row.value },
5331
+ {
5332
+ multiTableSearch: row.multiTableSearch,
5333
+ insensitive: true
5334
+ }
5335
+ )
5336
+ };
5337
+ case "equals":
5338
+ return {
5339
+ [row.fieldName]: helper(
5340
+ { equals: row.value },
5341
+ {
5342
+ multiTableSearch: row.multiTableSearch,
5343
+ insensitive: true
5344
+ }
5345
+ )
5346
+ };
5347
+ case "beginsWith":
5348
+ return {
5349
+ [row.fieldName]: helper(
5350
+ { startsWith: row.value },
5351
+ {
5352
+ multiTableSearch: row.multiTableSearch,
5353
+ insensitive: true
5354
+ }
5355
+ )
5356
+ };
5357
+ case "endsWith":
5358
+ return {
5359
+ [row.fieldName]: helper(
5360
+ { endsWith: row.value },
5361
+ {
5362
+ multiTableSearch: row.multiTableSearch,
5363
+ insensitive: true
5364
+ }
5365
+ )
5366
+ };
5367
+ case "notEquals":
5368
+ return {
5369
+ [row.fieldName]: helper(
5370
+ { not: row.value },
5371
+ {
5372
+ multiTableSearch: row.multiTableSearch,
5373
+ insensitive: true
5374
+ }
5375
+ )
5376
+ };
5377
+ case "notBeginsWith":
5378
+ return {
5379
+ [row.fieldName]: helper(
5380
+ { not: { startsWith: row.value } },
5381
+ {
5382
+ multiTableSearch: row.multiTableSearch,
5383
+ insensitive: true
5384
+ }
5385
+ )
5386
+ };
5387
+ case "notEndsWith":
5388
+ return {
5389
+ [row.fieldName]: helper(
5390
+ { not: { endsWith: row.value } },
5391
+ {
5392
+ multiTableSearch: row.multiTableSearch,
5393
+ insensitive: true
5394
+ }
5395
+ )
5396
+ };
5397
+ case "notContains":
5398
+ return {
5399
+ [row.fieldName]: helper(
5400
+ { not: { contains: row.value } },
5401
+ {
5402
+ multiTableSearch: row.multiTableSearch,
5403
+ insensitive: true
5404
+ }
5405
+ )
5406
+ };
5407
+ default:
5408
+ return {};
5409
+ }
5410
+ }
5411
+ };
5412
+
5413
+ // src/components/advanceSearch/builder/uuid.ts
5414
+ var regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
5415
+ var UUIDBuilder = class {
5416
+ build(row) {
5417
+ if (!regex.test(row.value)) {
5418
+ return { [row.fieldName]: {} };
5419
+ }
5420
+ switch (row.operator) {
5421
+ case "gt":
5422
+ return {
5423
+ [row.fieldName]: helper({ gt: row.value }, { multiTableSearch: row.multiTableSearch })
5424
+ };
5425
+ case "gte":
5426
+ return {
5427
+ [row.fieldName]: helper({ gte: row.value }, { multiTableSearch: row.multiTableSearch })
5428
+ };
5429
+ case "lt":
5430
+ return {
5431
+ [row.fieldName]: helper({ lt: row.value }, { multiTableSearch: row.multiTableSearch })
5432
+ };
5433
+ case "lte":
5434
+ return {
5435
+ [row.fieldName]: helper({ lte: row.value }, { multiTableSearch: row.multiTableSearch })
5436
+ };
5437
+ case "equals":
5438
+ return {
5439
+ [row.fieldName]: helper(
5440
+ { equals: row.value },
5441
+ {
5442
+ multiTableSearch: row.multiTableSearch
5443
+ }
5444
+ )
5445
+ };
5446
+ case "notEquals":
5447
+ return {
5448
+ [row.fieldName]: helper(
5449
+ { not: row.value },
5450
+ {
5451
+ multiTableSearch: row.multiTableSearch
5452
+ }
5453
+ )
5454
+ };
5455
+ default:
5456
+ return {};
5457
+ }
5458
+ }
5459
+ };
5460
+
5461
+ // src/components/advanceSearch/builder/index.ts
5462
+ function getBuilder(fieldType) {
5463
+ switch (fieldType) {
5464
+ case "text":
5465
+ return new TextBuilder();
5466
+ case "number":
5467
+ return new NumberBuilder();
5468
+ case "date":
5469
+ return new DatetimeBuilder();
5470
+ case "datetime":
5471
+ return new DatetimeBuilder();
5472
+ case "checkbox":
5473
+ return new CheckboxBuilder();
5474
+ case "dropdown":
5475
+ return new DropdownBuilder();
5476
+ case "lookup":
5477
+ return new LookupBuilder();
5478
+ case "uuid":
5479
+ return new UUIDBuilder();
5480
+ case "json":
5481
+ return new JSONBuilder();
5482
+ }
5483
+ }
4842
5484
  var AdvanceSearch = ({
4843
5485
  fields,
4844
5486
  portalId,
@@ -4847,7 +5489,7 @@ var AdvanceSearch = ({
4847
5489
  onSearch,
4848
5490
  onClear
4849
5491
  }) => {
4850
- const fieldsData = React4.useMemo(() => {
5492
+ const fieldsData = React5.useMemo(() => {
4851
5493
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
4852
5494
  return fields || [];
4853
5495
  }, [fields]);
@@ -4860,8 +5502,7 @@ var AdvanceSearch = ({
4860
5502
  changeField,
4861
5503
  changeOperator,
4862
5504
  operatorsForField,
4863
- fieldOptions,
4864
- buildFilter
5505
+ fieldOptions
4865
5506
  } = useAdvanceSearch({ fields: fieldsData, limitRows });
4866
5507
  const form = reactHookForm.useForm({
4867
5508
  mode: "onSubmit",
@@ -4869,185 +5510,23 @@ var AdvanceSearch = ({
4869
5510
  defaultValues: {}
4870
5511
  });
4871
5512
  const { handleSubmit, unregister, resetField, getValues, setValue } = form;
4872
- const onSubmit = React4.useCallback(() => {
5513
+ const onSubmit = React5.useCallback(() => {
4873
5514
  const currentValues = getValues();
5515
+ const rawRows = rows.map((r2) => {
5516
+ r2.value = currentValues[`value_${r2.id}`] ?? "";
5517
+ r2.value2 = currentValues[`value2_${r2.id}`] ?? "";
5518
+ return r2;
5519
+ });
4874
5520
  const param = {
4875
- AND: rows.map((r2) => {
4876
- let val1 = currentValues[`value_${r2.id}`];
4877
- const val2 = currentValues[`value2_${r2.id}`];
4878
- if (r2.operator === "between") {
4879
- if (!val1 || !val2) return null;
4880
- const start = new Date(val1);
4881
- start.setHours(0, 0, 0, 0);
4882
- const end = new Date(val2);
4883
- end.setHours(23, 59, 59, 59);
4884
- return {
4885
- [r2.fieldName]: {
4886
- gte: start.toISOString(),
4887
- lt: end.toISOString()
4888
- }
4889
- };
4890
- }
4891
- if (!val1) return null;
4892
- val1 = r2.fieldType === "number" ? Number(val1) : val1;
4893
- switch (r2.operator) {
4894
- case "contains":
4895
- return {
4896
- [r2.fieldName]: buildFilter(
4897
- { contains: val1 },
4898
- {
4899
- multiTableSearch: r2.multiTableSearch,
4900
- insensitive: true
4901
- }
4902
- )
4903
- };
4904
- case "beginsWith":
4905
- return {
4906
- [r2.fieldName]: buildFilter(
4907
- { startsWith: val1 },
4908
- {
4909
- multiTableSearch: r2.multiTableSearch,
4910
- insensitive: true
4911
- }
4912
- )
4913
- };
4914
- case "endsWith":
4915
- return {
4916
- [r2.fieldName]: buildFilter(
4917
- { endsWith: val1 },
4918
- {
4919
- multiTableSearch: r2.multiTableSearch,
4920
- insensitive: true
4921
- }
4922
- )
4923
- };
4924
- case "equals":
4925
- return {
4926
- [r2.fieldName]: buildFilter(
4927
- { equals: val1 },
4928
- {
4929
- multiTableSearch: r2.multiTableSearch,
4930
- insensitive: true
4931
- }
4932
- )
4933
- };
4934
- case "notEquals":
4935
- return {
4936
- [r2.fieldName]: buildFilter(
4937
- { not: val1 },
4938
- {
4939
- multiTableSearch: r2.multiTableSearch,
4940
- insensitive: true
4941
- }
4942
- )
4943
- };
4944
- case "gt":
4945
- return {
4946
- [r2.fieldName]: buildFilter({ gt: val1 }, { multiTableSearch: r2.multiTableSearch })
4947
- };
4948
- case "gte":
4949
- return {
4950
- [r2.fieldName]: buildFilter({ gte: val1 }, { multiTableSearch: r2.multiTableSearch })
4951
- };
4952
- case "lt":
4953
- return {
4954
- [r2.fieldName]: buildFilter({ lt: val1 }, { multiTableSearch: r2.multiTableSearch })
4955
- };
4956
- case "lte":
4957
- return {
4958
- [r2.fieldName]: buildFilter({ lte: val1 }, { multiTableSearch: r2.multiTableSearch })
4959
- };
4960
- case "is":
4961
- return { [r2.fieldName]: val1 };
4962
- case "isNot":
4963
- return { [r2.fieldName]: { not: val1 } };
4964
- case "notContains":
4965
- return {
4966
- [r2.fieldName]: buildFilter(
4967
- { not: { contains: val1 } },
4968
- {
4969
- multiTableSearch: r2.multiTableSearch,
4970
- insensitive: true
4971
- }
4972
- )
4973
- };
4974
- case "notBeginsWith":
4975
- return {
4976
- [r2.fieldName]: buildFilter(
4977
- { not: { startsWith: val1 } },
4978
- {
4979
- multiTableSearch: r2.multiTableSearch,
4980
- insensitive: true
4981
- }
4982
- )
4983
- };
4984
- case "notEndsWith":
4985
- return {
4986
- [r2.fieldName]: buildFilter(
4987
- { not: { endsWith: val1 } },
4988
- {
4989
- multiTableSearch: r2.multiTableSearch,
4990
- insensitive: true
4991
- }
4992
- )
4993
- };
4994
- case "containsAny":
4995
- return {
4996
- [r2.fieldName]: buildFilter(
4997
- { hasSome: String(val1).split(",") },
4998
- { multiTableSearch: r2.multiTableSearch }
4999
- )
5000
- };
5001
- case "containsAll":
5002
- return {
5003
- [r2.fieldName]: buildFilter(
5004
- { hasEvery: String(val1).split(",") },
5005
- { multiTableSearch: r2.multiTableSearch }
5006
- )
5007
- };
5008
- case "containsOnly":
5009
- return {
5010
- [r2.fieldName]: buildFilter(
5011
- { equals: String(val1).split(",") },
5012
- {
5013
- multiTableSearch: r2.multiTableSearch,
5014
- insensitive: true
5015
- }
5016
- )
5017
- };
5018
- case "on": {
5019
- const start = new Date(val1);
5020
- start.setHours(0, 0, 0, 0);
5021
- const end = new Date(val1);
5022
- end.setHours(23, 59, 59, 59);
5023
- return {
5024
- [r2.fieldName]: buildFilter(
5025
- { gte: start.toISOString(), lt: end.toISOString() },
5026
- { multiTableSearch: r2.multiTableSearch }
5027
- )
5028
- };
5029
- }
5030
- case "after":
5031
- return {
5032
- [r2.fieldName]: buildFilter(
5033
- { gte: new Date(val1).toISOString() },
5034
- { multiTableSearch: r2.multiTableSearch }
5035
- )
5036
- };
5037
- case "before":
5038
- return {
5039
- [r2.fieldName]: buildFilter(
5040
- { lt: new Date(val1).toISOString() },
5041
- { multiTableSearch: r2.multiTableSearch }
5042
- )
5043
- };
5044
- }
5521
+ AND: rawRows.map((r2) => {
5522
+ const builder = getBuilder(r2.fieldType);
5523
+ return builder.build(r2);
5045
5524
  }).filter(Boolean)
5046
5525
  };
5047
5526
  if (onSearch) {
5048
- onSearch(param);
5527
+ onSearch(param, rawRows);
5049
5528
  }
5050
- }, [buildFilter, getValues, rows, onSearch]);
5529
+ }, [getValues, rows, onSearch]);
5051
5530
  return /* @__PURE__ */ jsxRuntime.jsx(
5052
5531
  ExpandCollapse_default,
5053
5532
  {
@@ -5117,7 +5596,7 @@ var AdvanceSearch = ({
5117
5596
  };
5118
5597
  var AdvanceSearch_default = AdvanceSearch;
5119
5598
  function cn3(...inputs) {
5120
- return tailwindMerge.twMerge(clsx3.clsx(inputs));
5599
+ return tailwindMerge.twMerge(clsx2.clsx(inputs));
5121
5600
  }
5122
5601
  function Dialog2({ ...props }) {
5123
5602
  return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
@@ -5273,11 +5752,11 @@ function DialogAlert({
5273
5752
  persistent = false
5274
5753
  }) {
5275
5754
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
5276
- const handleCancel = React4.useCallback(() => {
5755
+ const handleCancel = React5.useCallback(() => {
5277
5756
  onCancel?.();
5278
5757
  onOpenChange(false);
5279
5758
  }, [onCancel, onOpenChange]);
5280
- const handleConfirm = React4.useCallback(() => {
5759
+ const handleConfirm = React5.useCallback(() => {
5281
5760
  onConfirm?.();
5282
5761
  }, [onConfirm]);
5283
5762
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open, onOpenChange: persistent ? () => {
@@ -5329,9 +5808,9 @@ exports.compareAlphanumeric = compareAlphanumeric;
5329
5808
  exports.debounce = debounce;
5330
5809
  exports.isDefined = isDefined;
5331
5810
  exports.isEmptyObject = isEmptyObject;
5332
- exports.renderContentSlot = renderContentSlot;
5333
5811
  exports.selectValueToBoolean = selectValueToBoolean;
5334
5812
  exports.stripNullishObject = stripNullishObject;
5813
+ exports.throttle = throttle;
5335
5814
  exports.useFormField = useFormField;
5336
5815
  exports.useGridSettingsStore = useGridSettingsStore_default;
5337
5816
  exports.useHover = useHover_default;