@sustaina/shared-ui 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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,13 @@ 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
+ show: components?.columnSeparatorProps?.headerCell?.show ?? showSeparator,
1201
+ ...components?.columnSeparatorProps?.headerCell
1202
+ }
1203
+ ),
953
1204
  /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
954
1205
  ]
955
1206
  },
@@ -973,7 +1224,6 @@ var DataTable = ({
973
1224
  column.columnDef?.meta?.filterCellProps?.className
974
1225
  ),
975
1226
  style: {
976
- // TODO: should we separate styles for filter or use same columns styles
977
1227
  ...style,
978
1228
  width: useColumnSizing ? column.getSize() : void 0,
979
1229
  minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
@@ -994,7 +1244,7 @@ var DataTable = ({
994
1244
  ),
995
1245
  /* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: table.getRowModel().rows.map((row) => {
996
1246
  const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
997
- return /* @__PURE__ */ React4.createElement(
1247
+ return /* @__PURE__ */ React5.createElement(
998
1248
  TableRow,
999
1249
  {
1000
1250
  ...tableDataRowProps,
@@ -1042,20 +1292,39 @@ var DataTable = ({
1042
1292
  );
1043
1293
  }) })
1044
1294
  ] }),
1045
- isTableEmptyAfterFiltering && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderContentSlot(
1046
- statusContent?.emptyFilteredData || {
1047
- content: "No records found. Please try a different search."
1048
- },
1295
+ isTableEmptyAfterFiltering && /* @__PURE__ */ jsxRuntime.jsx(
1296
+ StatusContentSlot_default,
1049
1297
  {
1050
- className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4"
1298
+ content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
1299
+ icon: statusContent?.emptyFilteredData?.icon,
1300
+ wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
1301
+ defaultWrapperProps: {
1302
+ className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4 gap-2"
1303
+ },
1304
+ defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(empty_data_default, { className: "text-[128px]" })
1051
1305
  }
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
- }) })
1306
+ ),
1307
+ scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(
1308
+ StatusContentSlot_default,
1309
+ {
1310
+ content: statusContent?.fetchingMore?.content ?? "Loading more...",
1311
+ wrapperProps: statusContent?.fetchingMore?.wrapperProps,
1312
+ defaultWrapperProps: {
1313
+ className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
1314
+ }
1315
+ }
1316
+ ),
1317
+ scrollFetch?.enabled && !isFiltering && !isInitialLoading && !scrollFetch?.hasMore && !scrollFetch?.isFetchingMore && /* @__PURE__ */ jsxRuntime.jsx(
1318
+ StatusContentSlot_default,
1319
+ {
1320
+ content: statusContent?.noMoreData?.content,
1321
+ icon: statusContent?.noMoreData?.icon,
1322
+ wrapperProps: statusContent?.noMoreData?.wrapperProps,
1323
+ defaultWrapperProps: {
1324
+ className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
1325
+ }
1326
+ }
1327
+ )
1059
1328
  ] }),
1060
1329
  debug && /* @__PURE__ */ jsxRuntime.jsx(DataTableDevTool_default, { table })
1061
1330
  ]
@@ -1072,7 +1341,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
1072
1341
  // src/components/prevent-page-leave/PreventPageLeave.tsx
1073
1342
  var PreventPageLeave = ({ children }) => {
1074
1343
  const { isPreventing } = usePreventPageLeaveStore();
1075
- React4.useEffect(() => {
1344
+ React5.useEffect(() => {
1076
1345
  if (!isPreventing || typeof window === "undefined") {
1077
1346
  return;
1078
1347
  }
@@ -1090,7 +1359,7 @@ var PreventPageLeave = ({ children }) => {
1090
1359
  var PreventPageLeave_default = PreventPageLeave;
1091
1360
  var usePreventPageLeave = ({ isPrevening }) => {
1092
1361
  const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
1093
- React4.useEffect(() => {
1362
+ React5.useEffect(() => {
1094
1363
  setPreventing(isPrevening);
1095
1364
  }, [isPrevening, setPreventing]);
1096
1365
  };
@@ -1163,15 +1432,15 @@ var t2 = function(o3, t3, s2) {
1163
1432
  };
1164
1433
  };
1165
1434
  var Form = reactHookForm.FormProvider;
1166
- var FormFieldContext2 = React4__namespace.createContext({});
1435
+ var FormFieldContext2 = React5__namespace.createContext({});
1167
1436
  var FormField2 = ({
1168
1437
  ...props
1169
1438
  }) => {
1170
1439
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext2.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
1171
1440
  };
1172
1441
  var useFormField2 = () => {
1173
- const fieldContext = React4__namespace.useContext(FormFieldContext2);
1174
- const itemContext = React4__namespace.useContext(FormItemContext2);
1442
+ const fieldContext = React5__namespace.useContext(FormFieldContext2);
1443
+ const itemContext = React5__namespace.useContext(FormItemContext2);
1175
1444
  const { getFieldState } = reactHookForm.useFormContext();
1176
1445
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
1177
1446
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -1188,9 +1457,9 @@ var useFormField2 = () => {
1188
1457
  ...fieldState
1189
1458
  };
1190
1459
  };
1191
- var FormItemContext2 = React4__namespace.createContext({});
1460
+ var FormItemContext2 = React5__namespace.createContext({});
1192
1461
  function FormItem2({ className, ...props }) {
1193
- const id = React4__namespace.useId();
1462
+ const id = React5__namespace.useId();
1194
1463
  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
1464
  }
1196
1465
  function FormControl({ ...props }) {
@@ -1493,7 +1762,7 @@ function SortableRow({
1493
1762
  id: value,
1494
1763
  disabled: name == "columns.0.id"
1495
1764
  });
1496
- const style = React4__namespace.useMemo(
1765
+ const style = React5__namespace.useMemo(
1497
1766
  () => ({
1498
1767
  transform: utilities.CSS.Transform.toString(transform),
1499
1768
  transition
@@ -1656,7 +1925,7 @@ var GridSettingsModal = ({
1656
1925
  onClose,
1657
1926
  onSaveColumns
1658
1927
  }) => {
1659
- const [isDragging, setIsDragging] = React4.useState(false);
1928
+ const [isDragging, setIsDragging] = React5.useState(false);
1660
1929
  const form = reactHookForm.useForm({
1661
1930
  resolver: t2(GridSettingsSchema),
1662
1931
  defaultValues: { columns: currentColumns },
@@ -1668,7 +1937,7 @@ var GridSettingsModal = ({
1668
1937
  name: "columns",
1669
1938
  keyName: "fieldId"
1670
1939
  });
1671
- React4.useEffect(() => {
1940
+ React5.useEffect(() => {
1672
1941
  if (isOpen) {
1673
1942
  form.reset({ columns: currentColumns });
1674
1943
  }
@@ -1717,12 +1986,12 @@ var GridSettingsModal = ({
1717
1986
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-6 h-6 text-white" })
1718
1987
  }
1719
1988
  ) }),
1720
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: cn("bg-[#82B495] text-white h-25 rounded-t-lg", headerClassname), children: [
1721
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-2xl p-4", children: "Grid Settings" }),
1989
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: cn("bg-[#41875C] text-white h-20 rounded-t-lg", headerClassname), children: [
1990
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl p-2 px-4", children: "Grid Settings" }),
1722
1991
  /* @__PURE__ */ jsxRuntime.jsx(
1723
1992
  DialogDescription,
1724
1993
  {
1725
- className: cn("bg-[#8B8B8B] text-white px-4 py-2.5", descriptionClassname),
1994
+ className: cn("bg-[#A7ADB8] text-white px-4 py-2.5", descriptionClassname),
1726
1995
  children: "Add or remove columns. To change the column order, drag and drop a field."
1727
1996
  }
1728
1997
  )
@@ -1926,7 +2195,7 @@ var InfoIcon = (props) => {
1926
2195
  }
1927
2196
  );
1928
2197
  };
1929
- var InfoIcon_default = React4__namespace.default.memo(InfoIcon);
2198
+ var InfoIcon_default = React5__namespace.default.memo(InfoIcon);
1930
2199
  function TooltipProvider2({
1931
2200
  delayDuration = 0,
1932
2201
  ...props
@@ -1997,7 +2266,7 @@ var Navbar = ({
1997
2266
  }) => {
1998
2267
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
1999
2268
  const Icon3 = lucideReact.CircleHelp;
2000
- const shouldShowSeparator = !separatorDisable && React4.isValidElement(searchButton);
2269
+ const shouldShowSeparator = !separatorDisable && React5.isValidElement(searchButton);
2001
2270
  return /* @__PURE__ */ jsxRuntime.jsxs(
2002
2271
  "nav",
2003
2272
  {
@@ -2008,8 +2277,8 @@ var Navbar = ({
2008
2277
  children: [
2009
2278
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
2010
2279
  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 })
2280
+ React5.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
2281
+ React5.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
2013
2282
  ] }),
2014
2283
  tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
2015
2284
  /* @__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 +2309,10 @@ var Navbar = ({
2040
2309
  ),
2041
2310
  children: [
2042
2311
  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" }),
2312
+ React5.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon3, { size: 32, "aria-hidden": "true" }),
2044
2313
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
2045
2314
  ] }),
2046
- React4.isValidElement(tooltipdescription) && tooltipdescription
2315
+ React5.isValidElement(tooltipdescription) && tooltipdescription
2047
2316
  ]
2048
2317
  }
2049
2318
  ),
@@ -2097,19 +2366,19 @@ var Navbar = ({
2097
2366
  }
2098
2367
  ),
2099
2368
  shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
2100
- React4.isValidElement(searchButton) ? searchButton : ""
2369
+ React5.isValidElement(searchButton) ? searchButton : ""
2101
2370
  ] })
2102
2371
  ]
2103
2372
  }
2104
2373
  );
2105
2374
  };
2106
- var navbar_default = React4__namespace.default.memo(Navbar);
2375
+ var navbar_default = React5__namespace.default.memo(Navbar);
2107
2376
  var ExpandCollapse = ({ title, children, portalId }) => {
2108
- const [isOpen, setIsOpen] = React4.useState(false);
2377
+ const [isOpen, setIsOpen] = React5.useState(false);
2109
2378
  const Panel = /* @__PURE__ */ jsxRuntime.jsx(
2110
2379
  "div",
2111
2380
  {
2112
- className: clsx3__default.default(
2381
+ className: clsx2__default.default(
2113
2382
  "overflow-hidden transition-all duration-500 ease-in-out bg-white border-b shadow-md w-full",
2114
2383
  isOpen ? "max-h-[700px] opacity-100" : "max-h-0 opacity-0"
2115
2384
  ),
@@ -2142,7 +2411,6 @@ var ExpandCollapse_default = ExpandCollapse;
2142
2411
 
2143
2412
  // src/components/advanceSearch/operatorMap.ts
2144
2413
  var OPERATOR_MAP = {
2145
- uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
2146
2414
  text: [
2147
2415
  "contains",
2148
2416
  "equals",
@@ -2158,7 +2426,18 @@ var OPERATOR_MAP = {
2158
2426
  datetime: ["on", "after", "before", "between"],
2159
2427
  checkbox: ["is", "isNot"],
2160
2428
  dropdown: ["is", "isNot"],
2161
- lookup: ["containsAny", "containsOnly", "containsAll", "notContains"]
2429
+ lookup: ["containsAny", "containsOnly", "containsAll", "notContains"],
2430
+ uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
2431
+ json: [
2432
+ "contains",
2433
+ "equals",
2434
+ "beginsWith",
2435
+ "endsWith",
2436
+ "notEquals",
2437
+ "notBeginsWith",
2438
+ "notEndsWith",
2439
+ "notContains"
2440
+ ]
2162
2441
  };
2163
2442
 
2164
2443
  // src/components/advanceSearch/hooks/useAdvanceSearch.ts
@@ -2182,7 +2461,8 @@ function makeNewRow(field) {
2182
2461
  operator: "between",
2183
2462
  value: "",
2184
2463
  value2: "",
2185
- multiTableSearch: field.multiTableSearch
2464
+ multiTableSearch: field.multiTableSearch,
2465
+ jsonPath: field.jsonPath
2186
2466
  };
2187
2467
  }
2188
2468
  return {
@@ -2191,34 +2471,35 @@ function makeNewRow(field) {
2191
2471
  fieldType: field.type,
2192
2472
  operator: op,
2193
2473
  value: "",
2194
- multiTableSearch: field.multiTableSearch
2474
+ multiTableSearch: field.multiTableSearch,
2475
+ jsonPath: field.jsonPath
2195
2476
  };
2196
2477
  }
2197
2478
  function useAdvanceSearch({ fields, limitRows }) {
2198
- const [rows, setRows] = React4.useState([makeNewRow(fields[0])]);
2199
- const updateRows = React4.useCallback((next) => {
2479
+ const [rows, setRows] = React5.useState([makeNewRow(fields[0])]);
2480
+ const updateRows = React5.useCallback((next) => {
2200
2481
  setRows(next);
2201
2482
  }, []);
2202
- const operatorsForField = React4.useCallback(
2483
+ const operatorsForField = React5.useCallback(
2203
2484
  (fieldName) => {
2204
2485
  const t3 = getFieldType(fields, fieldName);
2205
2486
  return OPERATOR_MAP[t3];
2206
2487
  },
2207
2488
  [fields]
2208
2489
  );
2209
- const addRow = React4.useCallback(() => {
2490
+ const addRow = React5.useCallback(() => {
2210
2491
  if (!limitRows || rows.length < limitRows) {
2211
2492
  updateRows([...rows, makeNewRow(fields[0])]);
2212
2493
  }
2213
2494
  }, [rows, fields, updateRows, limitRows]);
2214
- const removeRow = React4.useCallback(
2495
+ const removeRow = React5.useCallback(
2215
2496
  (id) => {
2216
2497
  if (rows.length === 1) return;
2217
2498
  updateRows(rows.filter((r2) => r2.id !== id));
2218
2499
  },
2219
2500
  [rows, updateRows]
2220
2501
  );
2221
- const clearRow = React4.useCallback(
2502
+ const clearRow = React5.useCallback(
2222
2503
  (id) => {
2223
2504
  updateRows(
2224
2505
  rows.map((r2) => {
@@ -2237,10 +2518,10 @@ function useAdvanceSearch({ fields, limitRows }) {
2237
2518
  },
2238
2519
  [rows, fields, updateRows]
2239
2520
  );
2240
- const clearAllRow = React4.useCallback(() => {
2521
+ const clearAllRow = React5.useCallback(() => {
2241
2522
  updateRows([makeNewRow(fields[0])]);
2242
2523
  }, [fields, updateRows]);
2243
- const changeField = React4.useCallback(
2524
+ const changeField = React5.useCallback(
2244
2525
  (id, fieldName) => {
2245
2526
  updateRows(
2246
2527
  rows.map((r2) => {
@@ -2252,7 +2533,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2252
2533
  },
2253
2534
  [rows, fields, updateRows]
2254
2535
  );
2255
- const changeOperator = React4.useCallback(
2536
+ const changeOperator = React5.useCallback(
2256
2537
  (id, operator) => {
2257
2538
  updateRows(
2258
2539
  rows.map((r2) => {
@@ -2263,6 +2544,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2263
2544
  fieldName: r2.fieldName,
2264
2545
  fieldType: r2.fieldType,
2265
2546
  multiTableSearch: r2.multiTableSearch,
2547
+ jsonPath: r2.jsonPath,
2266
2548
  operator,
2267
2549
  value: "",
2268
2550
  value2: ""
@@ -2273,6 +2555,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2273
2555
  fieldName: r2.fieldName,
2274
2556
  fieldType: r2.fieldType,
2275
2557
  multiTableSearch: r2.multiTableSearch,
2558
+ jsonPath: r2.jsonPath,
2276
2559
  operator,
2277
2560
  value: ""
2278
2561
  };
@@ -2281,7 +2564,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2281
2564
  },
2282
2565
  [rows, updateRows]
2283
2566
  );
2284
- const changeValue = React4.useCallback(
2567
+ const changeValue = React5.useCallback(
2285
2568
  (id, which, val) => {
2286
2569
  updateRows(
2287
2570
  rows.map((r2) => {
@@ -2293,23 +2576,13 @@ function useAdvanceSearch({ fields, limitRows }) {
2293
2576
  },
2294
2577
  [rows, updateRows]
2295
2578
  );
2296
- const fieldOptions = React4.useMemo(
2579
+ const fieldOptions = React5.useMemo(
2297
2580
  () => fields.map((f) => ({
2298
2581
  value: f.name,
2299
2582
  label: f.label ?? f.name
2300
2583
  })),
2301
2584
  [fields]
2302
2585
  );
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
2586
  return {
2314
2587
  rows,
2315
2588
  addRow,
@@ -2320,8 +2593,7 @@ function useAdvanceSearch({ fields, limitRows }) {
2320
2593
  changeOperator,
2321
2594
  changeValue,
2322
2595
  operatorsForField,
2323
- fieldOptions,
2324
- buildFilter
2596
+ fieldOptions
2325
2597
  };
2326
2598
  }
2327
2599
 
@@ -2349,6 +2621,9 @@ var OPERATOR_LABEL = {
2349
2621
  containsOnly: "Contains only",
2350
2622
  containsAll: "Contains all of"
2351
2623
  };
2624
+ function cn2(...inputs) {
2625
+ return tailwindMerge.twMerge(clsx2.clsx(inputs));
2626
+ }
2352
2627
  function Select2({ ...props }) {
2353
2628
  return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { "data-slot": "select", ...props });
2354
2629
  }
@@ -2630,13 +2905,13 @@ function DatePicker({
2630
2905
  className,
2631
2906
  ...props
2632
2907
  }) {
2633
- const today = React4__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
2634
- const [displayed, setDisplayed] = React4__namespace.useState(
2908
+ const today = React5__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
2909
+ const [displayed, setDisplayed] = React5__namespace.useState(
2635
2910
  selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
2636
2911
  );
2637
2912
  minDate = clampToDay(minDate);
2638
2913
  maxDate = clampToDay(maxDate);
2639
- const disabledSet = React4__namespace.useMemo(() => {
2914
+ const disabledSet = React5__namespace.useMemo(() => {
2640
2915
  const s2 = /* @__PURE__ */ new Set();
2641
2916
  disabledDates?.forEach((d) => s2.add(startOfDay(d).toISOString()));
2642
2917
  return s2;
@@ -2645,7 +2920,7 @@ function DatePicker({
2645
2920
  const displayMonth = displayed.getMonth();
2646
2921
  const monthLabel = callbacks?.monthLabel?.(displayYear, displayMonth) ?? new Intl.DateTimeFormat(void 0, { month: "short" }).format(displayed);
2647
2922
  const yearLabel = callbacks?.yearLabel?.(displayYear) ?? String(displayYear);
2648
- const weekdays = React4__namespace.useMemo(() => {
2923
+ const weekdays = React5__namespace.useMemo(() => {
2649
2924
  const labels = [];
2650
2925
  for (let i2 = 0; i2 < 7; i2++) {
2651
2926
  const idx = i2;
@@ -2654,7 +2929,7 @@ function DatePicker({
2654
2929
  }
2655
2930
  return labels;
2656
2931
  }, [callbacks]);
2657
- const grid = React4__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
2932
+ const grid = React5__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
2658
2933
  const isDateDisabled = (date) => {
2659
2934
  const d = startOfDay(date);
2660
2935
  if (minDate && d < minDate) return true;
@@ -2733,7 +3008,7 @@ function DatePicker({
2733
3008
  ] });
2734
3009
  }
2735
3010
  var TagsInput = ({ value = [], onChange, onClear, error }) => {
2736
- const [inputValue, setInputValue] = React4.useState("");
3011
+ const [inputValue, setInputValue] = React5.useState("");
2737
3012
  const addTag = (val) => {
2738
3013
  const trimmed = val.trim();
2739
3014
  if (!trimmed) return;
@@ -4428,10 +4703,10 @@ function splitDateString(dateString) {
4428
4703
  return dateStrings;
4429
4704
  }
4430
4705
  function parseYear(dateString, additionalDigits) {
4431
- const regex = new RegExp(
4706
+ const regex2 = new RegExp(
4432
4707
  "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
4433
4708
  );
4434
- const captures = dateString.match(regex);
4709
+ const captures = dateString.match(regex2);
4435
4710
  if (!captures) return { year: NaN, restDateString: "" };
4436
4711
  const year = captures[1] ? parseInt(captures[1]) : null;
4437
4712
  const century = captures[2] ? parseInt(captures[2]) : null;
@@ -4537,15 +4812,15 @@ function Label4({ className, ...props }) {
4537
4812
  );
4538
4813
  }
4539
4814
  var Form2 = reactHookForm.FormProvider;
4540
- var FormFieldContext3 = React4__namespace.createContext({});
4815
+ var FormFieldContext3 = React5__namespace.createContext({});
4541
4816
  var FormField3 = ({
4542
4817
  ...props
4543
4818
  }) => {
4544
4819
  return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext3.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
4545
4820
  };
4546
4821
  var useFormField3 = () => {
4547
- const fieldContext = React4__namespace.useContext(FormFieldContext3);
4548
- const itemContext = React4__namespace.useContext(FormItemContext3);
4822
+ const fieldContext = React5__namespace.useContext(FormFieldContext3);
4823
+ const itemContext = React5__namespace.useContext(FormItemContext3);
4549
4824
  const { getFieldState } = reactHookForm.useFormContext();
4550
4825
  const formState = reactHookForm.useFormState({ name: fieldContext.name });
4551
4826
  const fieldState = getFieldState(fieldContext.name, formState);
@@ -4562,9 +4837,9 @@ var useFormField3 = () => {
4562
4837
  ...fieldState
4563
4838
  };
4564
4839
  };
4565
- var FormItemContext3 = React4__namespace.createContext({});
4840
+ var FormItemContext3 = React5__namespace.createContext({});
4566
4841
  function FormItem3({ className, ...props }) {
4567
- const id = React4__namespace.useId();
4842
+ const id = React5__namespace.useId();
4568
4843
  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
4844
  }
4570
4845
  function FormControl2({ ...props }) {
@@ -4596,7 +4871,7 @@ var AdvanceSearchRow = ({
4596
4871
  const { control } = form;
4597
4872
  const fieldSchema = fields.find((f) => f.name === row.fieldName);
4598
4873
  const fieldType = fieldSchema?.type ?? "text";
4599
- React4__namespace.default.useEffect(() => {
4874
+ React5__namespace.default.useEffect(() => {
4600
4875
  if (operators && operators.length > 0 && !operators.includes(row.operator)) {
4601
4876
  onChangeOperator(operators[0]);
4602
4877
  }
@@ -4607,8 +4882,8 @@ var AdvanceSearchRow = ({
4607
4882
  const isLookup = fieldType === "lookup";
4608
4883
  const isNumber = fieldType === "number";
4609
4884
  const isDate2 = fieldType === "date" || fieldType === "datetime";
4610
- const [openDateValue1, setOpenDateValue1] = React4__namespace.default.useState(false);
4611
- const [openDateValue2, setOpenDateValue2] = React4__namespace.default.useState(false);
4885
+ const [openDateValue1, setOpenDateValue1] = React5__namespace.default.useState(false);
4886
+ const [openDateValue2, setOpenDateValue2] = React5__namespace.default.useState(false);
4612
4887
  const toDateFromISO = (v) => {
4613
4888
  if (!v) return void 0;
4614
4889
  try {
@@ -4839,6 +5114,372 @@ var AdvanceSearchRow = ({
4839
5114
  ) })
4840
5115
  ] });
4841
5116
  };
5117
+
5118
+ // src/components/advanceSearch/builder/checkbox.ts
5119
+ var CheckboxBuilder = class {
5120
+ build(row) {
5121
+ switch (row.operator) {
5122
+ case "is":
5123
+ return { [row.fieldName]: row.value };
5124
+ case "isNot":
5125
+ return { [row.fieldName]: { not: row.value } };
5126
+ default:
5127
+ return {};
5128
+ }
5129
+ }
5130
+ };
5131
+
5132
+ // src/components/advanceSearch/builder/helper.ts
5133
+ var helper = (prismaFilter, options) => {
5134
+ return options?.multiTableSearch ? {
5135
+ some: {
5136
+ value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
5137
+ }
5138
+ } : prismaFilter;
5139
+ };
5140
+
5141
+ // src/components/advanceSearch/builder/datetime.ts
5142
+ var DatetimeBuilder = class {
5143
+ build(row) {
5144
+ try {
5145
+ const start = new Date(row.value);
5146
+ start.setHours(0, 0, 0, 0);
5147
+ const end = new Date(row.value);
5148
+ end.setHours(23, 59, 59, 59);
5149
+ switch (row.operator) {
5150
+ case "on": {
5151
+ return {
5152
+ [row.fieldName]: helper(
5153
+ { gte: start.toISOString(), lt: end.toISOString() },
5154
+ { multiTableSearch: row.multiTableSearch }
5155
+ )
5156
+ };
5157
+ }
5158
+ case "after":
5159
+ return {
5160
+ [row.fieldName]: helper(
5161
+ { gte: start.toISOString() },
5162
+ { multiTableSearch: row.multiTableSearch }
5163
+ )
5164
+ };
5165
+ case "before":
5166
+ return {
5167
+ [row.fieldName]: helper(
5168
+ { lt: start.toISOString() },
5169
+ { multiTableSearch: row.multiTableSearch }
5170
+ )
5171
+ };
5172
+ case "between": {
5173
+ const start2 = new Date(row.value);
5174
+ start2.setHours(0, 0, 0, 0);
5175
+ const end2 = new Date(row.value2);
5176
+ end2.setHours(23, 59, 59, 59);
5177
+ return {
5178
+ [row.fieldName]: helper(
5179
+ { gte: start2.toISOString(), lt: end2.toISOString() },
5180
+ { multiTableSearch: row.multiTableSearch }
5181
+ )
5182
+ };
5183
+ }
5184
+ default:
5185
+ return {};
5186
+ }
5187
+ } catch {
5188
+ return {};
5189
+ }
5190
+ }
5191
+ };
5192
+
5193
+ // src/components/advanceSearch/builder/dropdown.ts
5194
+ var DropdownBuilder = class {
5195
+ build(row) {
5196
+ switch (row.operator) {
5197
+ case "is":
5198
+ return { [row.fieldName]: row.value };
5199
+ case "isNot":
5200
+ return { [row.fieldName]: { not: row.value } };
5201
+ default:
5202
+ return {};
5203
+ }
5204
+ }
5205
+ };
5206
+
5207
+ // src/components/advanceSearch/builder/json.ts
5208
+ var JSONBuilder = class {
5209
+ build(row) {
5210
+ switch (row.operator) {
5211
+ case "contains":
5212
+ return { [row.fieldName]: { path: row.jsonPath, string_contains: row.value } };
5213
+ case "equals":
5214
+ return { [row.fieldName]: { path: row.jsonPath, equals: row.value } };
5215
+ case "beginsWith":
5216
+ return { [row.fieldName]: { path: row.jsonPath, string_starts_with: row.value } };
5217
+ case "endsWith":
5218
+ return { [row.fieldName]: { path: row.jsonPath, string_ends_with: row.value } };
5219
+ case "notContains":
5220
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_contains: row.value } } };
5221
+ case "notEquals":
5222
+ return { [row.fieldName]: { path: row.jsonPath, not: { equals: row.value } } };
5223
+ case "notBeginsWith":
5224
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_starts_with: row.value } } };
5225
+ case "notEndsWith":
5226
+ return { [row.fieldName]: { path: row.jsonPath, not: { string_ends_with: row.value } } };
5227
+ default:
5228
+ return {};
5229
+ }
5230
+ }
5231
+ };
5232
+
5233
+ // src/components/advanceSearch/builder/lookup.ts
5234
+ var LookupBuilder = class {
5235
+ build(row) {
5236
+ switch (row.operator) {
5237
+ case "containsAny":
5238
+ return {
5239
+ [row.fieldName]: helper(
5240
+ { hasSome: String(row.value).split(",") },
5241
+ { multiTableSearch: row.multiTableSearch }
5242
+ )
5243
+ };
5244
+ case "containsAll":
5245
+ return {
5246
+ [row.fieldName]: helper(
5247
+ { hasEvery: String(row.value).split(",") },
5248
+ { multiTableSearch: row.multiTableSearch }
5249
+ )
5250
+ };
5251
+ case "containsOnly":
5252
+ return {
5253
+ [row.fieldName]: helper(
5254
+ { equals: String(row.value).split(",") },
5255
+ {
5256
+ multiTableSearch: row.multiTableSearch,
5257
+ insensitive: true
5258
+ }
5259
+ )
5260
+ };
5261
+ case "notContains":
5262
+ return {
5263
+ [row.fieldName]: helper(
5264
+ { not: { contains: row.value } },
5265
+ {
5266
+ multiTableSearch: row.multiTableSearch,
5267
+ insensitive: true
5268
+ }
5269
+ )
5270
+ };
5271
+ default:
5272
+ return {};
5273
+ }
5274
+ }
5275
+ };
5276
+
5277
+ // src/components/advanceSearch/builder/number.ts
5278
+ var NumberBuilder = class {
5279
+ build(row) {
5280
+ const value = Number(row.value);
5281
+ switch (row.operator) {
5282
+ case "gt":
5283
+ return {
5284
+ [row.fieldName]: helper({ gt: value }, { multiTableSearch: row.multiTableSearch })
5285
+ };
5286
+ case "gte":
5287
+ return {
5288
+ [row.fieldName]: helper({ gte: value }, { multiTableSearch: row.multiTableSearch })
5289
+ };
5290
+ case "lt":
5291
+ return {
5292
+ [row.fieldName]: helper({ lt: value }, { multiTableSearch: row.multiTableSearch })
5293
+ };
5294
+ case "lte":
5295
+ return {
5296
+ [row.fieldName]: helper({ lte: value }, { multiTableSearch: row.multiTableSearch })
5297
+ };
5298
+ case "equals":
5299
+ return {
5300
+ [row.fieldName]: helper(
5301
+ { equals: value },
5302
+ {
5303
+ multiTableSearch: row.multiTableSearch
5304
+ }
5305
+ )
5306
+ };
5307
+ case "notEquals":
5308
+ return {
5309
+ [row.fieldName]: helper(
5310
+ { not: value },
5311
+ {
5312
+ multiTableSearch: row.multiTableSearch
5313
+ }
5314
+ )
5315
+ };
5316
+ default:
5317
+ return {};
5318
+ }
5319
+ }
5320
+ };
5321
+
5322
+ // src/components/advanceSearch/builder/text.ts
5323
+ var TextBuilder = class {
5324
+ build(row) {
5325
+ switch (row.operator) {
5326
+ case "contains":
5327
+ return {
5328
+ [row.fieldName]: helper(
5329
+ { contains: row.value },
5330
+ {
5331
+ multiTableSearch: row.multiTableSearch,
5332
+ insensitive: true
5333
+ }
5334
+ )
5335
+ };
5336
+ case "equals":
5337
+ return {
5338
+ [row.fieldName]: helper(
5339
+ { equals: row.value },
5340
+ {
5341
+ multiTableSearch: row.multiTableSearch,
5342
+ insensitive: true
5343
+ }
5344
+ )
5345
+ };
5346
+ case "beginsWith":
5347
+ return {
5348
+ [row.fieldName]: helper(
5349
+ { startsWith: row.value },
5350
+ {
5351
+ multiTableSearch: row.multiTableSearch,
5352
+ insensitive: true
5353
+ }
5354
+ )
5355
+ };
5356
+ case "endsWith":
5357
+ return {
5358
+ [row.fieldName]: helper(
5359
+ { endsWith: row.value },
5360
+ {
5361
+ multiTableSearch: row.multiTableSearch,
5362
+ insensitive: true
5363
+ }
5364
+ )
5365
+ };
5366
+ case "notEquals":
5367
+ return {
5368
+ [row.fieldName]: helper(
5369
+ { not: row.value },
5370
+ {
5371
+ multiTableSearch: row.multiTableSearch,
5372
+ insensitive: true
5373
+ }
5374
+ )
5375
+ };
5376
+ case "notBeginsWith":
5377
+ return {
5378
+ [row.fieldName]: helper(
5379
+ { not: { startsWith: row.value } },
5380
+ {
5381
+ multiTableSearch: row.multiTableSearch,
5382
+ insensitive: true
5383
+ }
5384
+ )
5385
+ };
5386
+ case "notEndsWith":
5387
+ return {
5388
+ [row.fieldName]: helper(
5389
+ { not: { endsWith: row.value } },
5390
+ {
5391
+ multiTableSearch: row.multiTableSearch,
5392
+ insensitive: true
5393
+ }
5394
+ )
5395
+ };
5396
+ case "notContains":
5397
+ return {
5398
+ [row.fieldName]: helper(
5399
+ { not: { contains: row.value } },
5400
+ {
5401
+ multiTableSearch: row.multiTableSearch,
5402
+ insensitive: true
5403
+ }
5404
+ )
5405
+ };
5406
+ default:
5407
+ return {};
5408
+ }
5409
+ }
5410
+ };
5411
+
5412
+ // src/components/advanceSearch/builder/uuid.ts
5413
+ 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;
5414
+ var UUIDBuilder = class {
5415
+ build(row) {
5416
+ if (!regex.test(row.value)) {
5417
+ return { [row.fieldName]: {} };
5418
+ }
5419
+ switch (row.operator) {
5420
+ case "gt":
5421
+ return {
5422
+ [row.fieldName]: helper({ gt: row.value }, { multiTableSearch: row.multiTableSearch })
5423
+ };
5424
+ case "gte":
5425
+ return {
5426
+ [row.fieldName]: helper({ gte: row.value }, { multiTableSearch: row.multiTableSearch })
5427
+ };
5428
+ case "lt":
5429
+ return {
5430
+ [row.fieldName]: helper({ lt: row.value }, { multiTableSearch: row.multiTableSearch })
5431
+ };
5432
+ case "lte":
5433
+ return {
5434
+ [row.fieldName]: helper({ lte: row.value }, { multiTableSearch: row.multiTableSearch })
5435
+ };
5436
+ case "equals":
5437
+ return {
5438
+ [row.fieldName]: helper(
5439
+ { equals: row.value },
5440
+ {
5441
+ multiTableSearch: row.multiTableSearch
5442
+ }
5443
+ )
5444
+ };
5445
+ case "notEquals":
5446
+ return {
5447
+ [row.fieldName]: helper(
5448
+ { not: row.value },
5449
+ {
5450
+ multiTableSearch: row.multiTableSearch
5451
+ }
5452
+ )
5453
+ };
5454
+ default:
5455
+ return {};
5456
+ }
5457
+ }
5458
+ };
5459
+
5460
+ // src/components/advanceSearch/builder/index.ts
5461
+ function getBuilder(fieldType) {
5462
+ switch (fieldType) {
5463
+ case "text":
5464
+ return new TextBuilder();
5465
+ case "number":
5466
+ return new NumberBuilder();
5467
+ case "date":
5468
+ return new DatetimeBuilder();
5469
+ case "datetime":
5470
+ return new DatetimeBuilder();
5471
+ case "checkbox":
5472
+ return new CheckboxBuilder();
5473
+ case "dropdown":
5474
+ return new DropdownBuilder();
5475
+ case "lookup":
5476
+ return new LookupBuilder();
5477
+ case "uuid":
5478
+ return new UUIDBuilder();
5479
+ case "json":
5480
+ return new JSONBuilder();
5481
+ }
5482
+ }
4842
5483
  var AdvanceSearch = ({
4843
5484
  fields,
4844
5485
  portalId,
@@ -4847,7 +5488,7 @@ var AdvanceSearch = ({
4847
5488
  onSearch,
4848
5489
  onClear
4849
5490
  }) => {
4850
- const fieldsData = React4.useMemo(() => {
5491
+ const fieldsData = React5.useMemo(() => {
4851
5492
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
4852
5493
  return fields || [];
4853
5494
  }, [fields]);
@@ -4860,8 +5501,7 @@ var AdvanceSearch = ({
4860
5501
  changeField,
4861
5502
  changeOperator,
4862
5503
  operatorsForField,
4863
- fieldOptions,
4864
- buildFilter
5504
+ fieldOptions
4865
5505
  } = useAdvanceSearch({ fields: fieldsData, limitRows });
4866
5506
  const form = reactHookForm.useForm({
4867
5507
  mode: "onSubmit",
@@ -4869,185 +5509,23 @@ var AdvanceSearch = ({
4869
5509
  defaultValues: {}
4870
5510
  });
4871
5511
  const { handleSubmit, unregister, resetField, getValues, setValue } = form;
4872
- const onSubmit = React4.useCallback(() => {
5512
+ const onSubmit = React5.useCallback(() => {
4873
5513
  const currentValues = getValues();
5514
+ const rawRows = rows.map((r2) => {
5515
+ r2.value = currentValues[`value_${r2.id}`] ?? "";
5516
+ r2.value2 = currentValues[`value2_${r2.id}`] ?? "";
5517
+ return r2;
5518
+ });
4874
5519
  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
- }
5520
+ AND: rawRows.map((r2) => {
5521
+ const builder = getBuilder(r2.fieldType);
5522
+ return builder.build(r2);
5045
5523
  }).filter(Boolean)
5046
5524
  };
5047
5525
  if (onSearch) {
5048
- onSearch(param);
5526
+ onSearch(param, rawRows);
5049
5527
  }
5050
- }, [buildFilter, getValues, rows, onSearch]);
5528
+ }, [getValues, rows, onSearch]);
5051
5529
  return /* @__PURE__ */ jsxRuntime.jsx(
5052
5530
  ExpandCollapse_default,
5053
5531
  {
@@ -5117,7 +5595,7 @@ var AdvanceSearch = ({
5117
5595
  };
5118
5596
  var AdvanceSearch_default = AdvanceSearch;
5119
5597
  function cn3(...inputs) {
5120
- return tailwindMerge.twMerge(clsx3.clsx(inputs));
5598
+ return tailwindMerge.twMerge(clsx2.clsx(inputs));
5121
5599
  }
5122
5600
  function Dialog2({ ...props }) {
5123
5601
  return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
@@ -5273,11 +5751,11 @@ function DialogAlert({
5273
5751
  persistent = false
5274
5752
  }) {
5275
5753
  const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
5276
- const handleCancel = React4.useCallback(() => {
5754
+ const handleCancel = React5.useCallback(() => {
5277
5755
  onCancel?.();
5278
5756
  onOpenChange(false);
5279
5757
  }, [onCancel, onOpenChange]);
5280
- const handleConfirm = React4.useCallback(() => {
5758
+ const handleConfirm = React5.useCallback(() => {
5281
5759
  onConfirm?.();
5282
5760
  }, [onConfirm]);
5283
5761
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog2, { open, onOpenChange: persistent ? () => {
@@ -5329,9 +5807,9 @@ exports.compareAlphanumeric = compareAlphanumeric;
5329
5807
  exports.debounce = debounce;
5330
5808
  exports.isDefined = isDefined;
5331
5809
  exports.isEmptyObject = isEmptyObject;
5332
- exports.renderContentSlot = renderContentSlot;
5333
5810
  exports.selectValueToBoolean = selectValueToBoolean;
5334
5811
  exports.stripNullishObject = stripNullishObject;
5812
+ exports.throttle = throttle;
5335
5813
  exports.useFormField = useFormField;
5336
5814
  exports.useGridSettingsStore = useGridSettingsStore_default;
5337
5815
  exports.useHover = useHover_default;