tw-react-components 0.0.138 → 0.0.139

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/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
4
+ var react = require('react');
5
5
  var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
7
7
  var dayjs = require('dayjs');
@@ -12,13 +12,13 @@ var TooltipPrimitive = require('@radix-ui/react-tooltip');
12
12
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
13
13
  var reactHookForm = require('react-hook-form');
14
14
  var DialogPrimitive = require('@radix-ui/react-dialog');
15
+ var classVarianceAuthority = require('class-variance-authority');
15
16
  var core = require('@dnd-kit/core');
16
17
  var modifiers = require('@dnd-kit/modifiers');
17
18
  var sortable = require('@dnd-kit/sortable');
18
19
  var utilities = require('@dnd-kit/utilities');
19
20
  var reactRouterDom = require('react-router-dom');
20
21
  var reactSlot = require('@radix-ui/react-slot');
21
- var classVarianceAuthority = require('class-variance-authority');
22
22
  var SeparatorPrimitive = require('@radix-ui/react-separator');
23
23
  var PopoverPrimitive = require('@radix-ui/react-popover');
24
24
  var SwitchPrimitives = require('@radix-ui/react-switch');
@@ -41,7 +41,6 @@ function _interopNamespaceDefault(e) {
41
41
  return Object.freeze(n);
42
42
  }
43
43
 
44
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
45
44
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TooltipPrimitive);
46
45
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
47
46
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
@@ -586,7 +585,7 @@ const sizeClassNames = {
586
585
  },
587
586
  },
588
587
  };
589
- const Button = React.forwardRef((_a, ref) => {
588
+ const Button = react.forwardRef((_a, ref) => {
590
589
  var { children, className, size = 'medium', color = 'slate', variant = 'filled', rounded, prefixIcon: PrefixIcon, suffixIcon: SuffixIcon } = _a, props = __rest(_a, ["children", "className", "size", "color", "variant", "rounded", "prefixIcon", "suffixIcon"]);
591
590
  return (jsxRuntime.jsxs("button", Object.assign({ className: cn('relative flex aspect-square items-center font-medium duration-200', sizeClassNames[size].base, variantClassNames[variant][color].base, rounded ? 'rounded-full' : 'rounded-md', props.disabled
592
591
  ? 'cursor-not-allowed opacity-50'
@@ -595,17 +594,17 @@ const Button = React.forwardRef((_a, ref) => {
595
594
  : 'cursor-default', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), type: "button" }, props, { ref: ref, children: [PrefixIcon && (jsxRuntime.jsx(PrefixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base })), children, SuffixIcon && (jsxRuntime.jsx(SuffixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))] })));
596
595
  });
597
596
 
598
- const Badge = React.forwardRef((_a, ref) => {
597
+ const Badge = react.forwardRef((_a, ref) => {
599
598
  var { size = 'small' } = _a, props = __rest(_a, ["size"]);
600
599
  return jsxRuntime.jsx(Button, Object.assign({ size: size }, props, { ref: ref }));
601
600
  });
602
601
 
603
- const Block = React.forwardRef((_a, ref) => {
602
+ const Block = react.forwardRef((_a, ref) => {
604
603
  var { children, className, centered, container, fullWidth, fullHeight } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight"]);
605
604
  return (jsxRuntime.jsx("div", Object.assign({ className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { ref: ref, children: children })));
606
605
  });
607
606
 
608
- const Card = React.forwardRef((_a, ref) => {
607
+ const Card = react.forwardRef((_a, ref) => {
609
608
  var { children, className } = _a, blockProps = __rest(_a, ["children", "className"]);
610
609
  return (jsxRuntime.jsx(Block, Object.assign({ className: cn('rounded-lg border p-3 dark:border-slate-700 dark:bg-slate-900', className) }, blockProps, { ref: ref, children: children })));
611
610
  });
@@ -631,14 +630,14 @@ const justifyClasses = {
631
630
  between: 'justify-between',
632
631
  end: 'justify-end',
633
632
  };
634
- const Flex = React.forwardRef((_a, ref) => {
633
+ const Flex = react.forwardRef((_a, ref) => {
635
634
  var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify"]);
636
635
  return (jsxRuntime.jsx(Block, Object.assign({ className: cn('flex gap-3', wrap && 'flex-wrap', directionClasses[direction][reverse ? 'reverse' : 'normal'], alignClasses[align], justifyClasses[justify], className) }, blockProps, { ref: ref, children: children })));
637
636
  });
638
637
 
639
638
  dayjs.extend(localeData);
640
639
  function useDays(locale = 'en') {
641
- return React.useMemo(() => {
640
+ return react.useMemo(() => {
642
641
  dayjs.extend(localeData).locale(locale);
643
642
  const names = dayjs.weekdays();
644
643
  const shortNames = dayjs.weekdaysShort();
@@ -648,8 +647,8 @@ function useDays(locale = 'en') {
648
647
 
649
648
  const MOBILE_BREAKPOINT = 768;
650
649
  function useIsMobile() {
651
- const [isMobile, setIsMobile] = React.useState(undefined);
652
- React.useEffect(() => {
650
+ const [isMobile, setIsMobile] = react.useState(undefined);
651
+ react.useEffect(() => {
653
652
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
654
653
  const onChange = () => {
655
654
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -662,8 +661,8 @@ function useIsMobile() {
662
661
  }
663
662
 
664
663
  function useLongPress(callback, ms = 100) {
665
- const [startLongPress, setStartLongPress] = React.useState(false);
666
- React.useEffect(() => {
664
+ const [startLongPress, setStartLongPress] = react.useState(false);
665
+ react.useEffect(() => {
667
666
  let timerId;
668
667
  if (startLongPress) {
669
668
  timerId = setTimeout(callback, ms);
@@ -686,7 +685,7 @@ function useLongPress(callback, ms = 100) {
686
685
 
687
686
  dayjs.extend(localeData);
688
687
  function useMonths(locale = 'en') {
689
- return React.useMemo(() => {
688
+ return react.useMemo(() => {
690
689
  dayjs.extend(localeData).locale(locale);
691
690
  const names = dayjs.months();
692
691
  const shortNames = dayjs.monthsShort();
@@ -695,7 +694,7 @@ function useMonths(locale = 'en') {
695
694
  }
696
695
 
697
696
  function useOnSwipe(element, onSwipe, minSwipeDistance = 50) {
698
- React.useEffect(() => {
697
+ react.useEffect(() => {
699
698
  if (!element.current)
700
699
  return;
701
700
  const elem = element.current;
@@ -736,7 +735,7 @@ function useOnSwipe(element, onSwipe, minSwipeDistance = 50) {
736
735
  }
737
736
 
738
737
  function useOutsideClick(ref, callback) {
739
- React.useEffect(() => {
738
+ react.useEffect(() => {
740
739
  const handleClickOutside = (event) => {
741
740
  if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(event.target)) {
742
741
  callback();
@@ -752,7 +751,7 @@ function useOutsideClick(ref, callback) {
752
751
  }
753
752
 
754
753
  function usePagination(currentIndex, totalPages) {
755
- return React.useMemo(() => {
754
+ return react.useMemo(() => {
756
755
  const result = [];
757
756
  result.push(currentIndex);
758
757
  if (totalPages > 7 && currentIndex > 4) {
@@ -841,10 +840,10 @@ const sizeClasses = {
841
840
  },
842
841
  },
843
842
  };
844
- const BasicInput = React.forwardRef(function BasicInput(_a, ref) {
843
+ const BasicInput = react.forwardRef(function BasicInput(_a, ref) {
845
844
  var { className, inputClassName, extensionClassName, type = 'text', label, description, size = 'medium', hasErrors, clearable, suffixIcon: SuffixIcon, onClear, onSuffixIconClick } = _a, props = __rest(_a, ["className", "inputClassName", "extensionClassName", "type", "label", "description", "size", "hasErrors", "clearable", "suffixIcon", "onClear", "onSuffixIconClick"]);
846
- const id = React.useId();
847
- const memoLabel = React.useMemo(() => label && (jsxRuntime.jsx(Label, { className: sizeClasses[size].label, htmlFor: id, description: description, required: props.required, hasErrors: hasErrors, children: label })), [description, hasErrors, id, label, props.required, size]);
845
+ const id = react.useId();
846
+ const memoLabel = react.useMemo(() => label && (jsxRuntime.jsx(Label, { className: sizeClasses[size].label, htmlFor: id, description: description, required: props.required, hasErrors: hasErrors, children: label })), [description, hasErrors, id, label, props.required, size]);
848
847
  const handleClear = (event) => {
849
848
  var _a;
850
849
  event.stopPropagation();
@@ -878,30 +877,30 @@ const BasicInputExtension = ({ children, className, size, hasErrors, disabled, o
878
877
  'cursor-pointer': onClick,
879
878
  }, className), onClick: !disabled ? onClick : undefined, onPointerDown: (event) => event.stopPropagation(), children: children }));
880
879
 
881
- const CheckboxInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "checkbox" }, props, { ref: ref }))));
880
+ const CheckboxInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "checkbox" }, props, { ref: ref }))));
882
881
 
883
- const EmailInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: lucideReact.AtSignIcon, ref: ref }))));
882
+ const EmailInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: lucideReact.AtSignIcon, ref: ref }))));
884
883
 
885
- const NumberInput = React.forwardRef((_a, ref) => {
884
+ const NumberInput = react.forwardRef((_a, ref) => {
886
885
  var { unit } = _a, props = __rest(_a, ["unit"]);
887
886
  return (jsxRuntime.jsx(BasicInput, Object.assign({ type: "number" }, props, { suffixIcon: unit
888
887
  ? ({ className }) => (jsxRuntime.jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
889
888
  : props.suffixIcon, ref: ref })));
890
889
  });
891
890
 
892
- const PasswordInput = React.forwardRef((props, ref) => {
893
- const [type, setType] = React.useState('password');
891
+ const PasswordInput = react.forwardRef((props, ref) => {
892
+ const [type, setType] = react.useState('password');
894
893
  const toggleType = () => setType((type) => (type === 'text' ? 'password' : 'text'));
895
894
  return (jsxRuntime.jsx(BasicInput, Object.assign({ type: type }, props, { suffixIcon: type === 'password' ? lucideReact.EyeIcon : lucideReact.EyeOffIcon, onSuffixIconClick: toggleType, ref: ref })));
896
895
  });
897
896
 
898
- const TextareaInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "textarea" }, props, { ref: ref }))));
897
+ const TextareaInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "textarea" }, props, { ref: ref }))));
899
898
 
900
- const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "text" }, props, { ref: ref }))));
899
+ const TextInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "text" }, props, { ref: ref }))));
901
900
 
902
901
  const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDate, }) => {
903
902
  const days = useDays(locale);
904
- const monthDays = React.useMemo(() => {
903
+ const monthDays = react.useMemo(() => {
905
904
  const daysInMonth = new Date(year, month + 1, 0).getDate();
906
905
  const daysInMonthArr = [];
907
906
  for (let i = 1; i <= daysInMonth; i++) {
@@ -909,7 +908,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
909
908
  }
910
909
  return daysInMonthArr;
911
910
  }, [month, year]);
912
- const prefixDays = React.useMemo(() => {
911
+ const prefixDays = react.useMemo(() => {
913
912
  const firstDay = new Date(year, month);
914
913
  const dayOfWeek = firstDay.getDay();
915
914
  firstDay.setDate(firstDay.getDate() - 1);
@@ -920,7 +919,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
920
919
  }
921
920
  return prefixDays;
922
921
  }, [month, year]);
923
- const suffixDays = React.useMemo(() => {
922
+ const suffixDays = react.useMemo(() => {
924
923
  const lastDay = new Date(year, month + 1);
925
924
  lastDay.setDate(lastDay.getDate() - 1);
926
925
  const dayOfWeek = lastDay.getDay();
@@ -930,7 +929,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
930
929
  }
931
930
  return suffixDays;
932
931
  }, [month, year]);
933
- const setDayNumber = React.useCallback((newDay, newMonth = month, newYear = year) => () => {
932
+ const setDayNumber = react.useCallback((newDay, newMonth = month, newYear = year) => () => {
934
933
  const newDate = new Date(newYear, newMonth, newDay, date.getHours(), date.getMinutes());
935
934
  if (minDate) {
936
935
  const _minDate = new Date(minDate);
@@ -959,11 +958,11 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
959
958
  return (jsxRuntime.jsxs("div", { className: "gap-1 px-3 py-2", children: [jsxRuntime.jsx("div", { className: "grid grid-cols-7", children: days.map((day, index) => (jsxRuntime.jsx("span", { className: "flex h-8 w-8 items-center justify-center text-xs uppercase text-slate-500 dark:text-slate-400", children: day.shortName }, index))) }), jsxRuntime.jsxs("div", { className: "grid grid-cols-7 gap-1", children: [prefixDays.map((dayNumber, index) => (jsxRuntime.jsx(Day, { value: value, day: dayNumber, month: (month - 1 + 12) % 12, year: month % 12 ? year : year - 1, minDate: minDate, maxDate: maxDate, setDayNumber: setDayNumber }, `${dayNumber}-${index}`))), monthDays.map((dayNumber, index) => (jsxRuntime.jsx(Day, { value: value, day: dayNumber, month: month, year: year, minDate: minDate, maxDate: maxDate, primary: true, setDayNumber: setDayNumber }, `${dayNumber}-${index}`))), suffixDays.map((dayNumber, index) => (jsxRuntime.jsx(Day, { value: value, day: dayNumber, month: (month + 1) % 12, year: (month + 1) % 12 ? year : year + 1, minDate: minDate, maxDate: maxDate, setDayNumber: setDayNumber }, `${dayNumber}-${index}`)))] })] }));
960
959
  };
961
960
  const Day = ({ value, day, month, year, minDate, maxDate, primary, setDayNumber, }) => {
962
- const dayDate = React.useMemo(() => new Date(year, month, day), [day, month, year]);
963
- const isSelectable = React.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'day') >= 0) &&
961
+ const dayDate = react.useMemo(() => new Date(year, month, day), [day, month, year]);
962
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'day') >= 0) &&
964
963
  (!maxDate || compareDates(dayDate, new Date(maxDate), 'day') <= 0), [minDate, dayDate, maxDate]);
965
- const isSelected = React.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'day'), [dayDate, value]);
966
- const isEqualToday = React.useMemo(() => !compareDates(dayDate, new Date(), 'day'), [dayDate]);
964
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'day'), [dayDate, value]);
965
+ const isEqualToday = react.useMemo(() => !compareDates(dayDate, new Date(), 'day'), [dayDate]);
967
966
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex h-8 w-8 items-center justify-center rounded-lg text-sm', {
968
967
  'border-2 border-blue-500': isEqualToday,
969
968
  'bg-blue-500 text-white': isSelected,
@@ -978,11 +977,11 @@ const MonthsView = ({ date, value, year, minDate, maxDate, locale, selectMonth,
978
977
  return (jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-1 px-3 py-2", children: months.map((month, index) => (jsxRuntime.jsx(Month, { date: date, value: value, shortName: month.shortName, month: index, year: year, minDate: minDate, maxDate: maxDate, selectMonth: selectMonth }, index))) }));
979
978
  };
980
979
  const Month = ({ date, value, shortName, month, year, minDate, maxDate, selectMonth, }) => {
981
- const dayDate = React.useMemo(() => new Date(year, month, date.getDate(), date.getHours(), date.getMinutes()), [date, month, year]);
982
- const isSelectable = React.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'month') >= 0) &&
980
+ const dayDate = react.useMemo(() => new Date(year, month, date.getDate(), date.getHours(), date.getMinutes()), [date, month, year]);
981
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'month') >= 0) &&
983
982
  (!maxDate || compareDates(dayDate, new Date(maxDate), 'month') <= 0), [dayDate, minDate, maxDate]);
984
- const isSelected = React.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'month'), [dayDate, value]);
985
- const isEqualThisMonth = React.useMemo(() => !compareDates(dayDate, new Date(), 'month'), [dayDate]);
983
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'month'), [dayDate, value]);
984
+ const isEqualThisMonth = react.useMemo(() => !compareDates(dayDate, new Date(), 'month'), [dayDate]);
986
985
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex w-14 items-center justify-center rounded border py-3 text-sm', {
987
986
  'border-blue-500': isEqualThisMonth,
988
987
  'border-transparent': !isEqualThisMonth,
@@ -995,11 +994,11 @@ const Month = ({ date, value, shortName, month, year, minDate, maxDate, selectMo
995
994
 
996
995
  const YearsView = ({ date, value, years, minDate, maxDate, selectYear, }) => (jsxRuntime.jsx("div", { className: "grid grid-cols-4 gap-1 px-3 py-2", children: years.map((year, index) => (jsxRuntime.jsx(Year, { date: date, value: value, year: year, minDate: minDate, maxDate: maxDate, selectYear: selectYear }, index))) }));
997
996
  const Year = ({ date, value, year, minDate, maxDate, selectYear }) => {
998
- const dayDate = React.useMemo(() => new Date(year, date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()), [date, year]);
999
- const isSelectable = React.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'year') >= 0) &&
997
+ const dayDate = react.useMemo(() => new Date(year, date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()), [date, year]);
998
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'year') >= 0) &&
1000
999
  (!maxDate || compareDates(dayDate, new Date(maxDate), 'year') <= 0), [dayDate, minDate, maxDate]);
1001
- const isSelected = React.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'year'), [dayDate, value]);
1002
- const isEqualThisYear = React.useMemo(() => !compareDates(dayDate, new Date(), 'year'), [dayDate]);
1000
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'year'), [dayDate, value]);
1001
+ const isEqualThisYear = react.useMemo(() => !compareDates(dayDate, new Date(), 'year'), [dayDate]);
1003
1002
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex w-14 items-center justify-center rounded border py-3 text-sm', {
1004
1003
  'border-blue-500': isEqualThisYear,
1005
1004
  'border-transparent': !isEqualThisYear,
@@ -1012,14 +1011,14 @@ const Year = ({ date, value, year, minDate, maxDate, selectYear }) => {
1012
1011
 
1013
1012
  const DateSelector = ({ date, value, minDate, maxDate, locale, calendarView, setCalendarView, setNewDate, }) => {
1014
1013
  const months = useMonths(locale);
1015
- const [month, setMonth] = React.useState(date.getMonth());
1016
- const [year, setYear] = React.useState(date.getFullYear());
1017
- const [yearOffset, setYearOffset] = React.useState(0);
1018
- React.useEffect(() => {
1014
+ const [month, setMonth] = react.useState(date.getMonth());
1015
+ const [year, setYear] = react.useState(date.getFullYear());
1016
+ const [yearOffset, setYearOffset] = react.useState(0);
1017
+ react.useEffect(() => {
1019
1018
  setMonth(date.getMonth());
1020
1019
  setYear(date.getFullYear());
1021
1020
  }, [date]);
1022
- const yearsRange = React.useMemo(() => {
1021
+ const yearsRange = react.useMemo(() => {
1023
1022
  const yearsRangeArr = [];
1024
1023
  for (let i = year + yearOffset - 6; i < year + yearOffset + 6; i++) {
1025
1024
  yearsRangeArr.push(i);
@@ -1089,21 +1088,21 @@ const TimeSelector = ({ date, step = 1, minDate, maxDate, setNewDate, }) => {
1089
1088
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("label", { className: "text-sm text-slate-700 dark:text-slate-300", children: "Time" }), jsxRuntime.jsxs("div", { className: "flex flex-grow justify-center gap-2", children: [jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [jsxRuntime.jsx(lucideReact.ChevronUpIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('hours', 1) }, increaseHours)), jsxRuntime.jsx(lucideReact.ChevronDownIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('hours', -1) }, decreaseHours))] }), jsxRuntime.jsxs("div", { className: "flex items-center rounded-lg border border-slate-100 bg-slate-100 text-right dark:border-slate-700 dark:bg-slate-800", children: [jsxRuntime.jsx("span", { className: "flex px-2", onWheel: onWheel('hours'), children: date.getHours().toString().padStart(2, '0') }), jsxRuntime.jsx("span", { children: ":" }), jsxRuntime.jsx("span", { className: "flex px-2", onWheel: onWheel('minutes'), children: date.getMinutes().toString().padStart(2, '0') })] }), jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [jsxRuntime.jsx(lucideReact.ChevronUpIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('minutes', step) }, increaseMinutes)), jsxRuntime.jsx(lucideReact.ChevronDownIcon, Object.assign({ className: "h-4 w-4 rounded hover:bg-slate-100 dark:hover:bg-slate-700", onClick: editDateField('minutes', -step) }, decreaseMinutes))] })] })] }));
1090
1089
  };
1091
1090
 
1092
- const DateTimeInput = React.forwardRef((_a, ref) => {
1091
+ const DateTimeInput = react.forwardRef((_a, ref) => {
1093
1092
  var { className, value, clearable, type = 'datetime-local', step = 1, minDate, maxDate, hasErrors, onChange, onBlur, displayFormat = 'dddd, MMMM Do YYYY, HH:mm:ss', displayLocale = 'en' } = _a, props = __rest(_a, ["className", "value", "clearable", "type", "step", "minDate", "maxDate", "hasErrors", "onChange", "onBlur", "displayFormat", "displayLocale"]);
1094
- const [isOpen, setIsOpen] = React.useState();
1095
- const [calendarView, setCalendarView] = React.useState('days');
1096
- const date = React.useMemo(() => {
1093
+ const [isOpen, setIsOpen] = react.useState();
1094
+ const [calendarView, setCalendarView] = react.useState('days');
1095
+ const date = react.useMemo(() => {
1097
1096
  const result = value
1098
1097
  ? new Date(value)
1099
1098
  : new Date(Math.min(Math.max(new Date(minDate !== null && minDate !== void 0 ? minDate : Date.now()).getTime(), Date.now()), new Date(maxDate !== null && maxDate !== void 0 ? maxDate : Date.now()).getTime()));
1100
1099
  result.setMinutes(result.getMinutes() - ((result.getMinutes() + step) % step));
1101
1100
  return result;
1102
1101
  }, [step, maxDate, minDate, value]);
1103
- const displayDate = React.useMemo(() => value && getDisplayDate(date, displayFormat, displayLocale), [date, value, displayFormat, displayLocale]);
1104
- const calendarRef = React.useRef(null);
1102
+ const displayDate = react.useMemo(() => value && getDisplayDate(date, displayFormat, displayLocale), [date, value, displayFormat, displayLocale]);
1103
+ const calendarRef = react.useRef(null);
1105
1104
  useOutsideClick(calendarRef, () => setIsOpen(false));
1106
- React.useEffect(() => {
1105
+ react.useEffect(() => {
1107
1106
  if (!isOpen) {
1108
1107
  setCalendarView('days');
1109
1108
  }
@@ -1145,7 +1144,7 @@ const DateTimeInput = React.forwardRef((_a, ref) => {
1145
1144
  return (jsxRuntime.jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsxRuntime.jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? lucideReact.CalendarIcon : lucideReact.ClockIcon, onSuffixIconClick: handleOnClick })), isOpen && (jsxRuntime.jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsxRuntime.jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxRuntime.jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsxRuntime.jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsxRuntime.jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
1146
1145
  });
1147
1146
 
1148
- const ListContent = React.forwardRef((_a, ref) => {
1147
+ const ListContent = react.forwardRef((_a, ref) => {
1149
1148
  var { className } = _a, props = __rest(_a, ["className"]);
1150
1149
  return (jsxRuntime.jsx(Block, Object.assign({ className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-100 bg-white p-1 text-slate-700 shadow-md dark:border-slate-700 dark:bg-slate-900 dark:text-white', className), ref: ref }, props)));
1151
1150
  });
@@ -1153,20 +1152,20 @@ const labelSizeClasses = {
1153
1152
  small: 'p-1 text-sm',
1154
1153
  medium: 'px-2 py-1.5',
1155
1154
  };
1156
- const ListItem = React.forwardRef((_a, ref) => {
1155
+ const ListItem = react.forwardRef((_a, ref) => {
1157
1156
  var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
1158
1157
  return (jsxRuntime.jsx(Flex, Object.assign({ className: cn(labelSizeClasses[size], 'relative cursor-default select-none gap-2 rounded-md outline-none focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-700', inset && 'pl-8', className), align: "center", ref: ref }, props)));
1159
1158
  });
1160
- const ListLabel = React.forwardRef((_a, ref) => {
1159
+ const ListLabel = react.forwardRef((_a, ref) => {
1161
1160
  var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
1162
1161
  return (jsxRuntime.jsx(Block, Object.assign({ className: cn(labelSizeClasses[size], 'font-semibold text-slate-900 dark:text-slate-300', inset && 'pl-8', className), ref: ref }, props)));
1163
1162
  });
1164
- const ListIndicator = React.forwardRef((_a, ref) => {
1163
+ const ListIndicator = react.forwardRef((_a, ref) => {
1165
1164
  var { className, icon: Icon, iconClassName } = _a, props = __rest(_a, ["className", "icon", "iconClassName"]);
1166
1165
  return (jsxRuntime.jsx(Flex, Object.assign({ className: cn('absolute left-2 h-3.5 w-3.5', className), align: "center", justify: "center", ref: ref }, props, { children: jsxRuntime.jsx(Icon, { className: iconClassName }) })));
1167
1166
  });
1168
- const ListIcon = React.forwardRef(({ className, icon: Icon }, ref) => jsxRuntime.jsx(Icon, { className: cn('h-4 w-4', className), ref: ref }));
1169
- const ListSeparator = React.forwardRef((_a, ref) => {
1167
+ const ListIcon = react.forwardRef(({ className, icon: Icon }, ref) => jsxRuntime.jsx(Icon, { className: cn('h-4 w-4', className), ref: ref }));
1168
+ const ListSeparator = react.forwardRef((_a, ref) => {
1170
1169
  var { className } = _a, props = __rest(_a, ["className"]);
1171
1170
  return (jsxRuntime.jsx(Block, Object.assign({ className: cn('-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-700', className), ref: ref }, props)));
1172
1171
  });
@@ -1183,42 +1182,42 @@ const DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
1183
1182
  const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
1184
1183
  const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
1185
1184
  const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
1186
- const DropdownMenuSubTrigger = React.forwardRef((_a, ref) => {
1185
+ const DropdownMenuSubTrigger = react.forwardRef((_a, ref) => {
1187
1186
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1188
1187
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.SubTrigger, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsxs(List.Item, { className: className, inset: inset, children: [children, jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "ml-auto h-4 w-4" })] }) })));
1189
1188
  });
1190
1189
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
1191
- const DropdownMenuSubContent = React.forwardRef((_a, ref) => {
1190
+ const DropdownMenuSubContent = react.forwardRef((_a, ref) => {
1192
1191
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1193
1192
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: jsxRuntime.jsx(DropdownMenuPrimitive__namespace.SubContent, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsx(List, { className: className, children: children }) })) }));
1194
1193
  });
1195
1194
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
1196
- const DropdownMenuContent = React.forwardRef((_a, ref) => {
1195
+ const DropdownMenuContent = react.forwardRef((_a, ref) => {
1197
1196
  var { className, children, sideOffset = 4 } = _a, props = __rest(_a, ["className", "children", "sideOffset"]);
1198
1197
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Content, Object.assign({ ref: ref, sideOffset: sideOffset }, props, { asChild: true, children: jsxRuntime.jsx(List, { className: className, children: children }) })) }));
1199
1198
  });
1200
1199
  DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
1201
- const DropdownMenuItem = React.forwardRef((_a, ref) => {
1200
+ const DropdownMenuItem = react.forwardRef((_a, ref) => {
1202
1201
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1203
1202
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Item, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsx(List.Item, { inset: inset, className: className, children: children }) })));
1204
1203
  });
1205
1204
  DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
1206
- const DropdownMenuCheckboxItem = React.forwardRef((_a, ref) => {
1205
+ const DropdownMenuCheckboxItem = react.forwardRef((_a, ref) => {
1207
1206
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1208
1207
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.CheckboxItem, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsxs(List.Item, { inset: true, className: className, children: [jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { asChild: true, children: jsxRuntime.jsx(List.Indicator, { icon: lucideReact.CheckIcon, iconClassName: "h-4 w-4" }) }), children] }) })));
1209
1208
  });
1210
1209
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
1211
- const DropdownMenuRadioItem = React.forwardRef((_a, ref) => {
1210
+ const DropdownMenuRadioItem = react.forwardRef((_a, ref) => {
1212
1211
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1213
1212
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.RadioItem, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsxs(List.Item, { inset: true, className: className, children: [jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { asChild: true, children: jsxRuntime.jsx(List.Indicator, { icon: lucideReact.CircleIcon, iconClassName: "h-2 w-2 fill-current" }) }), children] }) })));
1214
1213
  });
1215
1214
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
1216
- const DropdownMenuLabel = React.forwardRef((_a, ref) => {
1215
+ const DropdownMenuLabel = react.forwardRef((_a, ref) => {
1217
1216
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1218
1217
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Label, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsx(List.Label, { className: className, inset: inset, children: children }) })));
1219
1218
  });
1220
1219
  DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
1221
- const DropdownMenuSeparator = React.forwardRef((_a, ref) => {
1220
+ const DropdownMenuSeparator = react.forwardRef((_a, ref) => {
1222
1221
  var { className } = _a, props = __rest(_a, ["className"]);
1223
1222
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Separator, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsx(List.Separator, { className: className }) })));
1224
1223
  });
@@ -1246,12 +1245,12 @@ const DropdownMenu = Object.assign(DropdownMenuPrimitive__namespace.Root, {
1246
1245
  RadioGroup: DropdownMenuRadioGroup,
1247
1246
  });
1248
1247
 
1249
- const SelectInput = React.forwardRef((_a, ref) => {
1248
+ const SelectInput = react.forwardRef((_a, ref) => {
1250
1249
  var { className, items, renderItem = (item) => item.label, value, multiple, clearable, allowAddition, onNewItemAdded, search, searchPredicate = (item, searchValue) => item.label.toLowerCase().includes(searchValue.toLowerCase()), selectPredicate = (a, b) => a === b, onChange, readOnly, parentRef } = _a, props = __rest(_a, ["className", "items", "renderItem", "value", "multiple", "clearable", "allowAddition", "onNewItemAdded", "search", "searchPredicate", "selectPredicate", "onChange", "readOnly", "parentRef"]);
1251
- const [open, setOpen] = React.useState(false);
1252
- const [searchValue, setSearchValue] = React.useState('');
1253
- const pureItems = React.useMemo(() => items.flatMap((item) => (item.group ? item.items : [item])), [items]);
1254
- const selectedItems = React.useMemo(() => value
1250
+ const [open, setOpen] = react.useState(false);
1251
+ const [searchValue, setSearchValue] = react.useState('');
1252
+ const pureItems = react.useMemo(() => items.flatMap((item) => (item.group ? item.items : [item])), [items]);
1253
+ const selectedItems = react.useMemo(() => value
1255
1254
  ? !multiple
1256
1255
  ? pureItems.find((item) => selectPredicate(item.value, value))
1257
1256
  ? [pureItems.find((item) => selectPredicate(item.value, value))]
@@ -1262,7 +1261,7 @@ const SelectInput = React.forwardRef((_a, ref) => {
1262
1261
  .filter(Boolean)
1263
1262
  : []
1264
1263
  : [], [multiple, pureItems, selectPredicate, value]);
1265
- const filteredItems = React.useMemo(() => !search || !searchValue
1264
+ const filteredItems = react.useMemo(() => !search || !searchValue
1266
1265
  ? items
1267
1266
  : items.flatMap((item) => item.group
1268
1267
  ? item.items.some((subItem) => subItem.label.toLowerCase().includes(searchValue.toLowerCase()))
@@ -1273,13 +1272,13 @@ const SelectInput = React.forwardRef((_a, ref) => {
1273
1272
  : item.label.toLowerCase().includes(searchValue.toLowerCase())
1274
1273
  ? [item]
1275
1274
  : []), [items, search, searchValue]);
1276
- const text = React.useMemo(() => selectedItems.length
1275
+ const text = react.useMemo(() => selectedItems.length
1277
1276
  ? !multiple
1278
1277
  ? selectedItems[0].label
1279
1278
  : selectedItems.map((item) => item.label).join(', ')
1280
1279
  : undefined, [multiple, selectedItems]);
1281
- const selectedMap = React.useMemo(() => selectedItems.reduce((prev, curr) => (Object.assign(Object.assign({}, prev), { [curr.id]: curr.value })), {}), [selectedItems]);
1282
- const handleOnSelect = React.useCallback((id) => {
1280
+ const selectedMap = react.useMemo(() => selectedItems.reduce((prev, curr) => (Object.assign(Object.assign({}, prev), { [curr.id]: curr.value })), {}), [selectedItems]);
1281
+ const handleOnSelect = react.useCallback((id) => {
1283
1282
  var _a, _b, _c;
1284
1283
  !multiple && setOpen(false);
1285
1284
  if (!multiple) {
@@ -1315,7 +1314,7 @@ const SelectInput = React.forwardRef((_a, ref) => {
1315
1314
  };
1316
1315
  const GroupComponent = multiple ? DropdownMenu.Group : DropdownMenu.RadioGroup;
1317
1316
  const ItemComponent = multiple ? DropdownMenu.CheckboxItem : DropdownMenu.RadioItem;
1318
- const RenderOption = React.useCallback((option) => {
1317
+ const RenderOption = react.useCallback((option) => {
1319
1318
  return (jsxRuntime.jsx(ItemComponent, { className: cn('w-full cursor-pointer hover:bg-slate-200 dark:hover:bg-slate-700', {
1320
1319
  'bg-slate-200 dark:bg-slate-700': selectedMap[option.id],
1321
1320
  }), value: String(option.id), checked: !!selectedMap[option.id], onSelect: (event) => {
@@ -1327,9 +1326,9 @@ const SelectInput = React.forwardRef((_a, ref) => {
1327
1326
  (allowAddition && searchValue ? (jsxRuntime.jsxs("button", { className: "rounded bg-slate-100 text-center hover:bg-slate-200 dark:bg-slate-900/30 dark:hover:bg-slate-700/30", onClick: handleOnAddItemClicked, children: ["Add '", searchValue, "'"] })) : (jsxRuntime.jsx("div", { className: "text-center text-slate-500", children: "No items." }))), jsxRuntime.jsx(GroupComponent, { className: "flex flex-col gap-1 overflow-auto", value: !multiple && selectedItems.length ? String(selectedItems[0].id) : undefined, children: filteredItems.map((item, index) => item.group ? (jsxRuntime.jsxs(Flex, { className: "gap-1", direction: "column", fullWidth: true, children: [jsxRuntime.jsx(DropdownMenu.Label, { className: "sticky top-0 z-[51] w-full rounded-md border bg-white py-1 dark:bg-slate-900", children: item.label }), item.items.map((subItem) => (jsxRuntime.jsx(RenderOption, Object.assign({}, subItem), subItem.id))), index < filteredItems.length - 1 && (jsxRuntime.jsx("div", { className: "mb-1 h-px w-full bg-slate-200 dark:bg-slate-700" }))] }, item.id)) : (jsxRuntime.jsx(RenderOption, Object.assign({}, item), item.id))) })] })] }));
1328
1327
  });
1329
1328
 
1330
- const FileInput = React.forwardRef((_a, ref) => {
1329
+ const FileInput = react.forwardRef((_a, ref) => {
1331
1330
  var { className, value, onChange, onFileChange, accept } = _a, props = __rest(_a, ["className", "value", "onChange", "onFileChange", "accept"]);
1332
- const fileInputRef = React.useRef(null);
1331
+ const fileInputRef = react.useRef(null);
1333
1332
  const handleFileChange = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target: { files } }) {
1334
1333
  console.log(files);
1335
1334
  if (files && files.length > 0) {
@@ -1345,7 +1344,7 @@ const FileInput = React.forwardRef((_a, ref) => {
1345
1344
  const FormGroup = ({ className, label, children }) => (jsxRuntime.jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-700', className), direction: "column", fullWidth: true, children: [jsxRuntime.jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
1346
1345
 
1347
1346
  function withForm(Component) {
1348
- return React.forwardRef((props, ref) => {
1347
+ return react.forwardRef((props, ref) => {
1349
1348
  const _a = props, { name, pattern, validate } = _a, restProps = __rest(_a, ["name", "pattern", "validate"]);
1350
1349
  const { control, formState } = reactHookForm.useFormContext();
1351
1350
  return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: {
@@ -1375,7 +1374,7 @@ const FormInputs = {
1375
1374
  File: withForm(FileInput),
1376
1375
  };
1377
1376
 
1378
- const HintRoot = React.forwardRef(({ children }, ref) => (jsxRuntime.jsx(Block, { className: "relative", ref: ref, children: children })));
1377
+ const HintRoot = react.forwardRef(({ children }, ref) => (jsxRuntime.jsx(Block, { className: "relative", ref: ref, children: children })));
1379
1378
  HintRoot.displayName = 'HintRoot';
1380
1379
  const dotSizeClassNames = {
1381
1380
  small: {
@@ -1417,7 +1416,7 @@ const colorClassNames = {
1417
1416
  pink: 'bg-pink-500 dark:bg-pink-600',
1418
1417
  rose: 'bg-rose-500 dark:bg-rose-600',
1419
1418
  };
1420
- const HintDot = React.forwardRef(({ size = 'medium', placement = 'top-right', color = 'green', ping }, ref) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Block, { className: cn('absolute rounded-full', colorClassNames[color], dotSizeClassNames[size].base, {
1419
+ const HintDot = react.forwardRef(({ size = 'medium', placement = 'top-right', color = 'green', ping }, ref) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Block, { className: cn('absolute rounded-full', colorClassNames[color], dotSizeClassNames[size].base, {
1421
1420
  [`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].left}`]: placement === 'top-left',
1422
1421
  [`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].right}`]: placement === 'top-right',
1423
1422
  [`${dotSizeClassNames[size].bottom} ${dotSizeClassNames[size].right}`]: placement === 'bottom-right',
@@ -1435,7 +1434,7 @@ const badgeSizeClassNames = {
1435
1434
  bottom: 'bottom-0 translate-y-1/2',
1436
1435
  left: 'left-2 -translate-x-full',
1437
1436
  };
1438
- const HintBadge = React.forwardRef((_a, ref) => {
1437
+ const HintBadge = react.forwardRef((_a, ref) => {
1439
1438
  var { className, size = 'small', placement = 'top-right' } = _a, props = __rest(_a, ["className", "size", "placement"]);
1440
1439
  return (jsxRuntime.jsx(Badge, Object.assign({ className: cn('absolute px-1', size === 'small' ? 'h-5' : 'h-6', {
1441
1440
  [`${badgeSizeClassNames.top} ${badgeSizeClassNames.left}`]: placement === 'top-left',
@@ -1448,9 +1447,9 @@ HintBadge.displayName = 'HintBadge';
1448
1447
  const Hint = Object.assign(HintRoot, { Dot: HintDot, Badge: HintBadge });
1449
1448
 
1450
1449
  const Pagination = ({ disabled, pageSize = 10, currentPage, totalItems, setCurrentPage, }) => {
1451
- const totalPages = React.useMemo(() => Math.ceil(totalItems / pageSize), [pageSize, totalItems]);
1450
+ const totalPages = react.useMemo(() => Math.ceil(totalItems / pageSize), [pageSize, totalItems]);
1452
1451
  const pagination = usePagination(currentPage + 1, totalPages);
1453
- React.useEffect(() => {
1452
+ react.useEffect(() => {
1454
1453
  setCurrentPage((page) => Math.min(page, Math.max(0, totalPages - 1)));
1455
1454
  }, [setCurrentPage, totalPages]);
1456
1455
  return (jsxRuntime.jsx(Flex, { justify: "end", children: jsxRuntime.jsxs(Flex, { className: "h-10 gap-0 divide-x rounded-md border border-slate-300 bg-white dark:divide-slate-700 dark:border-slate-700 dark:bg-slate-800", children: [jsxRuntime.jsx(PaginationItem, { title: "First page", onClick: () => setCurrentPage(0), disabled: !currentPage || disabled, children: jsxRuntime.jsx(lucideReact.ChevronsLeftIcon, { className: "h-5 w-5" }) }), jsxRuntime.jsx(PaginationItem, { title: "Previous page", onClick: () => currentPage && setCurrentPage(currentPage - 1), disabled: !currentPage || disabled, children: jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: "h-5 w-5" }) }), pagination.map((page, index) => (jsxRuntime.jsx(PaginationItem, { active: page !== '...' && page - 1 === currentPage, title: page !== '...' ? `Page ${page}` : undefined, onClick: page !== '...' ? () => setCurrentPage(page - 1) : undefined, disabled: page === '...' || disabled, children: page }, index))), jsxRuntime.jsx(PaginationItem, { title: "Next page", onClick: () => currentPage + 1 < totalPages && setCurrentPage(currentPage + 1), disabled: currentPage + 1 === totalPages || disabled, children: jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "h-5 w-5" }) }), jsxRuntime.jsx(PaginationItem, { title: "Last page", onClick: () => setCurrentPage(Math.floor(totalItems && !(totalItems % pageSize)
@@ -1514,11 +1513,11 @@ function defaultRender(item, field) {
1514
1513
  }
1515
1514
  function DataTable({ className, columns, rows, sorting, pagination, actions = [], isLoading, rowExtraContent, noDataMessage, onRowClick, rowClassName, }) {
1516
1515
  var _a;
1517
- const footerRef = React.useRef(null);
1518
- const [expandedRows, setExpandedRows] = React.useState({});
1519
- const allRowsExpanded = React.useMemo(() => rowExtraContent ? rows.every((row) => expandedRows[rowExtraContent.idGetter(row)]) : false, [expandedRows, rowExtraContent, rows]);
1520
- const _columns = React.useMemo(() => (Array.isArray(columns) ? columns : Object.values(columns)).filter((column) => !column.hide), [columns]);
1521
- const columnsLength = React.useMemo(() => (rowExtraContent ? 1 : 0) + _columns.length + Math.min(1, actions.length), [_columns.length, actions.length, rowExtraContent]);
1516
+ const footerRef = react.useRef(null);
1517
+ const [expandedRows, setExpandedRows] = react.useState({});
1518
+ const allRowsExpanded = react.useMemo(() => rowExtraContent ? rows.every((row) => expandedRows[rowExtraContent.idGetter(row)]) : false, [expandedRows, rowExtraContent, rows]);
1519
+ const _columns = react.useMemo(() => (Array.isArray(columns) ? columns : Object.values(columns)).filter((column) => !column.hide), [columns]);
1520
+ const columnsLength = react.useMemo(() => (rowExtraContent ? 1 : 0) + _columns.length + Math.min(1, actions.length), [_columns.length, actions.length, rowExtraContent]);
1522
1521
  const handleSorting = (field, comparator) => () => {
1523
1522
  if (!sorting)
1524
1523
  return;
@@ -1598,18 +1597,19 @@ const ExpandButton = ({ folded, foldComponent, unfoldComponent, onClick, }) => {
1598
1597
  return (jsxRuntime.jsx(Icon, { className: "h-6 w-6 cursor-pointer rounded p-1 hover:bg-slate-300 hover:dark:bg-slate-600", onClick: onClick }));
1599
1598
  };
1600
1599
 
1601
- const $Dialog = DialogPrimitive__namespace.Root;
1600
+ const $Dialog = (props) => (jsxRuntime.jsx(DialogPrimitive__namespace.Root, Object.assign({}, props)));
1601
+ $Dialog.displayName = DialogPrimitive__namespace.Root.displayName;
1602
1602
  const DialogTrigger = DialogPrimitive__namespace.Trigger;
1603
1603
  const DialogPortal = DialogPrimitive__namespace.Portal;
1604
1604
  const DialogClose = DialogPrimitive__namespace.Close;
1605
- const DialogOverlay = React.forwardRef((_a, ref) => {
1605
+ const DialogOverlay = react.forwardRef((_a, ref) => {
1606
1606
  var { className } = _a, props = __rest(_a, ["className"]);
1607
- return (jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, Object.assign({ ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm', className) }, props)));
1607
+ return (jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, Object.assign({ ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className) }, props)));
1608
1608
  });
1609
1609
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1610
- const DialogContent = React.forwardRef((_a, ref) => {
1610
+ const DialogContent = react.forwardRef((_a, ref) => {
1611
1611
  var { className, fullScreen, children } = _a, props = __rest(_a, ["className", "fullScreen", "children"]);
1612
- return (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, Object.assign({ ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]', 'fixed left-[50%] top-[50%] z-50 flex w-full max-w-lg translate-x-[-50%] translate-y-[-50%] flex-col gap-3 rounded-lg border bg-white p-3 shadow-md duration-200 xl:gap-4 xl:p-4 dark:border-slate-700 dark:bg-slate-900 dark:text-white', className, fullScreen && 'h-full max-h-none w-full max-w-none rounded-none') }, props, { children: [children, jsxRuntime.jsx(DialogPrimitive__namespace.Close, { className: "!absolute right-1 top-1 opacity-70 ring-offset-white transition-opacity hover:opacity-100 disabled:pointer-events-none xl:right-2 xl:top-2", asChild: true, children: jsxRuntime.jsx(Button, { prefixIcon: lucideReact.XIcon, size: "small", variant: "text" }) })] }))] }));
1612
+ return (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, Object.assign({ ref: ref, className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]', 'fixed left-[50%] top-[50%] z-50 flex max-h-[95dvh] w-full max-w-lg translate-x-[-50%] translate-y-[-50%] flex-col gap-4 rounded-lg border p-4 shadow-lg duration-200', className, fullScreen && 'h-full max-h-none w-full max-w-none rounded-none'), "aria-describedby": "dialog-content" }, props, { children: [children, jsxRuntime.jsx(DialogPrimitive__namespace.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", asChild: true, children: jsxRuntime.jsx(Button, { prefixIcon: lucideReact.XIcon, size: "small", variant: "text" }) }), jsxRuntime.jsx(DialogPrimitive__namespace.Description, { className: "hidden" })] }))] }));
1613
1613
  });
1614
1614
  DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1615
1615
  const DialogHeader = (_a) => {
@@ -1622,14 +1622,14 @@ const DialogFooter = (_a) => {
1622
1622
  return (jsxRuntime.jsx("div", Object.assign({ className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className) }, props)));
1623
1623
  };
1624
1624
  DialogFooter.displayName = 'DialogFooter';
1625
- const DialogTitle = React.forwardRef((_a, ref) => {
1625
+ const DialogTitle = react.forwardRef((_a, ref) => {
1626
1626
  var { className } = _a, props = __rest(_a, ["className"]);
1627
- return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, Object.assign({ ref: ref, className: cn('text-lg font-semibold leading-none tracking-tight', className) }, props)));
1627
+ return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, Object.assign({ ref: ref, className: cn('text-foreground text-lg font-semibold', className) }, props)));
1628
1628
  });
1629
1629
  DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1630
- const DialogDescription = React.forwardRef((_a, ref) => {
1630
+ const DialogDescription = react.forwardRef((_a, ref) => {
1631
1631
  var { className } = _a, props = __rest(_a, ["className"]);
1632
- return (jsxRuntime.jsx(DialogPrimitive__namespace.Description, Object.assign({ ref: ref, className: cn('text-sm text-slate-600 dark:text-slate-400', className) }, props)));
1632
+ return (jsxRuntime.jsx(DialogPrimitive__namespace.Description, Object.assign({ ref: ref, className: cn('text-muted-foreground text-sm', className) }, props)));
1633
1633
  });
1634
1634
  DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
1635
1635
  const Dialog = Object.assign($Dialog, {
@@ -1644,79 +1644,19 @@ const Dialog = Object.assign($Dialog, {
1644
1644
  Description: DialogDescription,
1645
1645
  });
1646
1646
 
1647
- const ConfirmDialog = ({ open, title, children, yesLabel, noLabel, onConfirm, onClose, }) => (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { onPointerDownOutside: (event) => event.preventDefault(), children: [jsxRuntime.jsx(Dialog.Header, { children: jsxRuntime.jsx(Dialog.Title, { children: title }) }), children, jsxRuntime.jsxs(Dialog.Footer, { children: [jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: noLabel !== null && noLabel !== void 0 ? noLabel : 'No' }) }), jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "green", onClick: onConfirm, children: yesLabel !== null && yesLabel !== void 0 ? yesLabel : 'Yes' }) })] })] }) }));
1648
-
1649
- const FormDialog = ({ className, open, title, form, children, submitLabel = 'Submit', cancelLabel = 'Cancel', extraAction, onSubmit, onInvalid, onClose, }) => {
1650
- const id = React.useId();
1651
- const handleSubmit = (data, event) => __awaiter(void 0, void 0, void 0, function* () {
1652
- try {
1653
- yield onSubmit(data, event);
1654
- }
1655
- catch (_a) {
1656
- // do nothering
1657
- }
1658
- });
1659
- return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { className: className, onPointerDownOutside: (event) => event.preventDefault(), children: [jsxRuntime.jsx(Dialog.Header, { children: jsxRuntime.jsx(Dialog.Title, { children: title }) }), jsxRuntime.jsx(reactHookForm.FormProvider, Object.assign({}, form, { children: jsxRuntime.jsx("form", { id: `form-${id}`, onSubmit: form.handleSubmit(handleSubmit, onInvalid), children: children }) })), jsxRuntime.jsxs(Dialog.Footer, { className: "w-full sm:justify-between", children: [extraAction, jsxRuntime.jsxs(Dialog.Footer, { className: "ml-auto", children: [jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: cancelLabel }) }), jsxRuntime.jsx(Button, { color: "green", type: "submit", form: `form-${id}`, disabled: form.formState.isSubmitting, children: submitLabel })] })] })] }) }));
1660
- };
1661
-
1662
- function ListSorter({ className, items, idResolver, renderer, onChange, }) {
1663
- const adaptedItems = React.useMemo(() => items.map((value, index) => ({ id: idResolver(value, index), value })), [idResolver, items]);
1664
- const sensors = core.useSensors(core.useSensor(core.PointerSensor), core.useSensor(core.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates }));
1665
- const onDragEnd = ({ active, over }) => {
1666
- if (!over || active.id === over.id)
1667
- return;
1668
- const sortedItems = structuredClone(adaptedItems);
1669
- const oldIndex = sortedItems.findIndex((item) => item.id === active.id);
1670
- const newIndex = sortedItems.findIndex((item) => item.id === over.id);
1671
- const [removed] = sortedItems.splice(oldIndex, 1);
1672
- sortedItems.splice(newIndex, 0, removed);
1673
- for (const [index, { value }] of Object.entries(sortedItems)) {
1674
- if (typeof value === 'object') {
1675
- value.rank = +index;
1676
- }
1677
- }
1678
- onChange(sortedItems.map(({ value }) => value));
1679
- };
1680
- return (jsxRuntime.jsx(core.DndContext, { sensors: sensors, modifiers: [modifiers.restrictToFirstScrollableAncestor], collisionDetection: core.closestCenter, onDragEnd: onDragEnd, children: jsxRuntime.jsx(sortable.SortableContext, { items: adaptedItems, strategy: sortable.verticalListSortingStrategy, children: jsxRuntime.jsx("div", { className: className, children: adaptedItems.map((item, index) => (jsxRuntime.jsx(SortableItem, { item: item, index: index, renderer: renderer }, item.id))) }) }) }));
1681
- }
1682
- function SortableItem({ item, index, renderer, }) {
1683
- const { attributes, listeners, setNodeRef, transform, transition } = sortable.useSortable({ id: item.id });
1684
- const style = { transform: utilities.CSS.Transform.toString(transform), transition };
1685
- return (jsxRuntime.jsx("div", Object.assign({ ref: setNodeRef, style: style }, attributes, { children: renderer(item.value, index, listeners) })));
1686
- }
1687
-
1688
- function ListSorterDialog({ className, open, title, items, idResolver, renderer, cancelLabel, submitLabel, onSubmit, onClose, }) {
1689
- const [sortedItems, setSortedItems] = React.useState(structuredClone(items));
1690
- React.useEffect(() => {
1691
- return () => {
1692
- setSortedItems(structuredClone(items));
1693
- };
1694
- }, [items]);
1695
- const preFinish = () => onSubmit(sortedItems);
1696
- const customRenderer = (item, index, listeners) => (jsxRuntime.jsxs(Flex, { align: "center", className: "gap-4 p-4 focus:outline-none dark:bg-slate-900 hover:dark:bg-slate-800", children: [jsxRuntime.jsx(Flex, Object.assign({ align: "center", justify: "center", className: "cursor-move rounded-lg p-2 hover:bg-slate-200 dark:hover:bg-slate-700" }, listeners, { children: jsxRuntime.jsx(lucideReact.ArrowUpDownIcon, { className: "h-5 w-5" }) })), renderer(item, index, listeners)] }));
1697
- return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { className: cn('max-h-[90dvh]', className), onPointerDownOutside: (event) => event.preventDefault(), children: [jsxRuntime.jsx(Dialog.Header, { children: title }), jsxRuntime.jsx(ListSorter, { className: "divide-y overflow-auto rounded-lg border dark:divide-slate-700 dark:border-slate-700 dark:text-white", items: sortedItems, idResolver: idResolver, renderer: customRenderer, onChange: setSortedItems }), jsxRuntime.jsxs(Dialog.Footer, { children: [jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: cancelLabel !== null && cancelLabel !== void 0 ? cancelLabel : 'Cancel' }) }), jsxRuntime.jsx(Button, { color: "green", onClick: preFinish, children: submitLabel !== null && submitLabel !== void 0 ? submitLabel : 'Submit' })] })] }) }));
1698
- }
1699
-
1700
- const PdfViewerDialog = ({ open, title, url, data, onClose }) => {
1701
- return !(url || data) ? null : (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { className: "h-[90dvh] max-w-[90dvw]", children: [jsxRuntime.jsx(Dialog.Header, { children: title }), (url || data) && (jsxRuntime.jsx("embed", { className: "rounded-lg", src: url !== null && url !== void 0 ? url : `data:application/pdf;base64,${data}`, type: "application/pdf", width: "100%", height: "100%" }))] }) }));
1702
- };
1703
-
1704
- const Separator = React.forwardRef((_a, ref) => {
1705
- var { className, orientation = 'horizontal', decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
1706
- return (jsxRuntime.jsx(SeparatorPrimitive__namespace.Root, Object.assign({ ref: ref, decorative: decorative, orientation: orientation, className: cn('bg-border shrink-0', orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]', className) }, props)));
1707
- });
1708
- Separator.displayName = SeparatorPrimitive__namespace.Root.displayName;
1647
+ const ConfirmDialog = ({ open, title, children, yesLabel, noLabel, onConfirm, onClose, }) => (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { children: [jsxRuntime.jsx(Dialog.Header, { children: jsxRuntime.jsx(Dialog.Title, { children: title }) }), children, jsxRuntime.jsxs(Dialog.Footer, { children: [jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: noLabel !== null && noLabel !== void 0 ? noLabel : 'No' }) }), jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "green", onClick: onConfirm, children: yesLabel !== null && yesLabel !== void 0 ? yesLabel : 'Yes' }) })] })] }) }));
1709
1648
 
1710
- const $Sheet = DialogPrimitive__namespace.Root;
1649
+ const $Sheet = (props) => (jsxRuntime.jsx(DialogPrimitive__namespace.Root, Object.assign({}, props)));
1650
+ $Sheet.displayName = DialogPrimitive__namespace.Root.displayName;
1711
1651
  const SheetTrigger = DialogPrimitive__namespace.Trigger;
1712
1652
  const SheetClose = DialogPrimitive__namespace.Close;
1713
1653
  const SheetPortal = DialogPrimitive__namespace.Portal;
1714
- const SheetOverlay = React__namespace.forwardRef((_a, ref) => {
1654
+ const SheetOverlay = react.forwardRef((_a, ref) => {
1715
1655
  var { className } = _a, props = __rest(_a, ["className"]);
1716
1656
  return (jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, Object.assign({ className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className) }, props, { ref: ref })));
1717
1657
  });
1718
1658
  SheetOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1719
- const sheetVariants = classVarianceAuthority.cva('fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', {
1659
+ const sheetVariants = classVarianceAuthority.cva('fixed flex flex-col z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', {
1720
1660
  variants: {
1721
1661
  side: {
1722
1662
  top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
@@ -1729,9 +1669,9 @@ const sheetVariants = classVarianceAuthority.cva('fixed z-50 gap-4 bg-background
1729
1669
  side: 'right',
1730
1670
  },
1731
1671
  });
1732
- const SheetContent = React__namespace.forwardRef((_a, ref) => {
1672
+ const SheetContent = react.forwardRef((_a, ref) => {
1733
1673
  var { side = 'right', className, children } = _a, props = __rest(_a, ["side", "className", "children"]);
1734
- return (jsxRuntime.jsxs(SheetPortal, { children: [jsxRuntime.jsx(SheetOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, Object.assign({ ref: ref, className: cn(sheetVariants({ side }), className) }, props, { children: [children, jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", children: [jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }), jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })] })] }))] }));
1674
+ return (jsxRuntime.jsxs(SheetPortal, { children: [jsxRuntime.jsx(SheetOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, Object.assign({ ref: ref, className: cn(sheetVariants({ side }), className) }, props, { children: [children, jsxRuntime.jsx(DialogPrimitive__namespace.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-2 top-2 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", asChild: true, children: jsxRuntime.jsx(Button, { prefixIcon: lucideReact.XIcon, size: "small", variant: "text" }) }), jsxRuntime.jsx(DialogPrimitive__namespace.Description, { className: "hidden" })] }))] }));
1735
1675
  });
1736
1676
  SheetContent.displayName = DialogPrimitive__namespace.Content.displayName;
1737
1677
  const SheetHeader = (_a) => {
@@ -1744,12 +1684,12 @@ const SheetFooter = (_a) => {
1744
1684
  return (jsxRuntime.jsx("div", Object.assign({ className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className) }, props)));
1745
1685
  };
1746
1686
  SheetFooter.displayName = 'SheetFooter';
1747
- const SheetTitle = React__namespace.forwardRef((_a, ref) => {
1687
+ const SheetTitle = react.forwardRef((_a, ref) => {
1748
1688
  var { className } = _a, props = __rest(_a, ["className"]);
1749
1689
  return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, Object.assign({ ref: ref, className: cn('text-foreground text-lg font-semibold', className) }, props)));
1750
1690
  });
1751
1691
  SheetTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1752
- const SheetDescription = React__namespace.forwardRef((_a, ref) => {
1692
+ const SheetDescription = react.forwardRef((_a, ref) => {
1753
1693
  var { className } = _a, props = __rest(_a, ["className"]);
1754
1694
  return (jsxRuntime.jsx(DialogPrimitive__namespace.Description, Object.assign({ ref: ref, className: cn('text-muted-foreground text-sm', className) }, props)));
1755
1695
  });
@@ -1766,6 +1706,67 @@ const Sheet = Object.assign($Sheet, {
1766
1706
  Description: SheetDescription,
1767
1707
  });
1768
1708
 
1709
+ const FormDialog = ({ className, formClassName, open, title, form, children, submitLabel = 'Submit', cancelLabel = 'Cancel', extraAction, as: As = Sheet, onSubmit, onInvalid, onClose, }) => {
1710
+ const id = react.useId();
1711
+ const handleSubmit = (data, event) => __awaiter(void 0, void 0, void 0, function* () {
1712
+ try {
1713
+ yield onSubmit(data, event);
1714
+ }
1715
+ catch (_a) {
1716
+ // do nothering
1717
+ }
1718
+ });
1719
+ return (jsxRuntime.jsx(As, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(As.Content, { className: className, children: [jsxRuntime.jsx(As.Header, { children: jsxRuntime.jsx(As.Title, { children: title }) }), jsxRuntime.jsx(reactHookForm.FormProvider, Object.assign({}, form, { children: jsxRuntime.jsx("form", { id: `form-${id}`, className: cn('flex h-full w-full flex-col gap-3 overflow-auto', formClassName), onSubmit: form.handleSubmit(handleSubmit, onInvalid), children: children }) })), jsxRuntime.jsxs(As.Footer, { className: "w-full sm:justify-between", children: [extraAction, jsxRuntime.jsxs(As.Footer, { className: "ml-auto", children: [jsxRuntime.jsx(As.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: cancelLabel }) }), jsxRuntime.jsx(Button, { color: "green", type: "submit", form: `form-${id}`, disabled: form.formState.isSubmitting, children: submitLabel })] })] })] }) }));
1720
+ };
1721
+
1722
+ function ListSorter({ className, items, idResolver, renderer, onChange, }) {
1723
+ const adaptedItems = react.useMemo(() => items.map((value, index) => ({ id: idResolver(value, index), value })), [idResolver, items]);
1724
+ const sensors = core.useSensors(core.useSensor(core.PointerSensor), core.useSensor(core.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates }));
1725
+ const onDragEnd = ({ active, over }) => {
1726
+ if (!over || active.id === over.id)
1727
+ return;
1728
+ const sortedItems = structuredClone(adaptedItems);
1729
+ const oldIndex = sortedItems.findIndex((item) => item.id === active.id);
1730
+ const newIndex = sortedItems.findIndex((item) => item.id === over.id);
1731
+ const [removed] = sortedItems.splice(oldIndex, 1);
1732
+ sortedItems.splice(newIndex, 0, removed);
1733
+ for (const [index, { value }] of Object.entries(sortedItems)) {
1734
+ if (typeof value === 'object') {
1735
+ value.rank = +index;
1736
+ }
1737
+ }
1738
+ onChange(sortedItems.map(({ value }) => value));
1739
+ };
1740
+ return (jsxRuntime.jsx(core.DndContext, { sensors: sensors, modifiers: [modifiers.restrictToFirstScrollableAncestor], collisionDetection: core.closestCenter, onDragEnd: onDragEnd, children: jsxRuntime.jsx(sortable.SortableContext, { items: adaptedItems, strategy: sortable.verticalListSortingStrategy, children: jsxRuntime.jsx("div", { className: className, children: adaptedItems.map((item, index) => (jsxRuntime.jsx(SortableItem, { item: item, index: index, renderer: renderer }, item.id))) }) }) }));
1741
+ }
1742
+ function SortableItem({ item, index, renderer, }) {
1743
+ const { attributes, listeners, setNodeRef, transform, transition } = sortable.useSortable({ id: item.id });
1744
+ const style = { transform: utilities.CSS.Transform.toString(transform), transition };
1745
+ return (jsxRuntime.jsx("div", Object.assign({ ref: setNodeRef, style: style }, attributes, { children: renderer(item.value, index, listeners) })));
1746
+ }
1747
+
1748
+ function ListSorterDialog({ className, open, title, items, idResolver, renderer, cancelLabel, submitLabel, onSubmit, onClose, }) {
1749
+ const [sortedItems, setSortedItems] = react.useState(structuredClone(items));
1750
+ react.useEffect(() => {
1751
+ return () => {
1752
+ setSortedItems(structuredClone(items));
1753
+ };
1754
+ }, [items]);
1755
+ const preFinish = () => onSubmit(sortedItems);
1756
+ const customRenderer = (item, index, listeners) => (jsxRuntime.jsxs(Flex, { align: "center", className: "gap-4 p-4 focus:outline-none dark:bg-slate-900 hover:dark:bg-slate-800", children: [jsxRuntime.jsx(Flex, Object.assign({ align: "center", justify: "center", className: "cursor-move rounded-lg p-2 hover:bg-slate-200 dark:hover:bg-slate-700" }, listeners, { children: jsxRuntime.jsx(lucideReact.ArrowUpDownIcon, { className: "h-5 w-5" }) })), renderer(item, index, listeners)] }));
1757
+ return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { className: className, onPointerDownOutside: (event) => event.preventDefault(), children: [jsxRuntime.jsx(Dialog.Header, { children: jsxRuntime.jsx(Dialog.Title, { children: title }) }), jsxRuntime.jsx(ListSorter, { className: "divide-y overflow-auto rounded-lg border dark:divide-slate-700 dark:border-slate-700 dark:text-white", items: sortedItems, idResolver: idResolver, renderer: customRenderer, onChange: setSortedItems }), jsxRuntime.jsxs(Dialog.Footer, { children: [jsxRuntime.jsx(Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { color: "red", children: cancelLabel !== null && cancelLabel !== void 0 ? cancelLabel : 'Cancel' }) }), jsxRuntime.jsx(Button, { color: "green", onClick: preFinish, children: submitLabel !== null && submitLabel !== void 0 ? submitLabel : 'Submit' })] })] }) }));
1758
+ }
1759
+
1760
+ const PdfViewerDialog = ({ open, title, url, data, onClose }) => {
1761
+ return !(url || data) ? null : (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (value) => !value && onClose(), children: jsxRuntime.jsxs(Dialog.Content, { className: "h-[95dvh] max-w-[95dvw]", children: [jsxRuntime.jsx(Dialog.Header, { children: jsxRuntime.jsx(Dialog.Title, { children: title }) }), (url || data) && (jsxRuntime.jsx("embed", { className: "rounded-lg", src: url !== null && url !== void 0 ? url : `data:application/pdf;base64,${data}`, type: "application/pdf", width: "100%", height: "100%" }))] }) }));
1762
+ };
1763
+
1764
+ const Separator = react.forwardRef((_a, ref) => {
1765
+ var { className, orientation = 'horizontal', decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
1766
+ return (jsxRuntime.jsx(SeparatorPrimitive__namespace.Root, Object.assign({ ref: ref, decorative: decorative, orientation: orientation, className: cn('bg-border shrink-0', orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]', className) }, props)));
1767
+ });
1768
+ Separator.displayName = SeparatorPrimitive__namespace.Root.displayName;
1769
+
1769
1770
  const Skeleton = (_a) => {
1770
1771
  var { className } = _a, props = __rest(_a, ["className"]);
1771
1772
  return (jsxRuntime.jsx("div", Object.assign({ className: cn('bg-muted animate-pulse rounded-md', className) }, props)));
@@ -1778,24 +1779,24 @@ const SIDEBAR_WIDTH = '16rem';
1778
1779
  const SIDEBAR_WIDTH_MOBILE = '18rem';
1779
1780
  const SIDEBAR_WIDTH_ICON = '3rem';
1780
1781
  const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
1781
- const SidebarContext = React.createContext(null);
1782
+ const SidebarContext = react.createContext(null);
1782
1783
  function useSidebar() {
1783
- const context = React.useContext(SidebarContext);
1784
+ const context = react.useContext(SidebarContext);
1784
1785
  if (!context) {
1785
1786
  throw new Error('useSidebar must be used within a SidebarProvider.');
1786
1787
  }
1787
1788
  return context;
1788
1789
  }
1789
- const SidebarContextProvider = React.forwardRef((_a, ref) => {
1790
+ const SidebarContextProvider = react.forwardRef((_a, ref) => {
1790
1791
  var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
1791
1792
  const isMobile = useIsMobile();
1792
- const [openMobile, setOpenMobile] = React.useState(false);
1793
- const screenRef = React.useRef(document.documentElement);
1793
+ const [openMobile, setOpenMobile] = react.useState(false);
1794
+ const screenRef = react.useRef(document.documentElement);
1794
1795
  // This is the internal state of the sidebar.
1795
1796
  // We use openProp and setOpenProp for control from outside the component.
1796
- const [_open, _setOpen] = React.useState(defaultOpen);
1797
+ const [_open, _setOpen] = react.useState(defaultOpen);
1797
1798
  const open = openProp !== null && openProp !== void 0 ? openProp : _open;
1798
- const setOpen = React.useCallback((value) => {
1799
+ const setOpen = react.useCallback((value) => {
1799
1800
  if (setOpenProp) {
1800
1801
  return setOpenProp === null || setOpenProp === void 0 ? void 0 : setOpenProp(typeof value === 'function' ? value(open) : value);
1801
1802
  }
@@ -1804,13 +1805,13 @@ const SidebarContextProvider = React.forwardRef((_a, ref) => {
1804
1805
  document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
1805
1806
  }, [setOpenProp, open]);
1806
1807
  // Helper to toggle the sidebar.
1807
- const toggleSidebar = React.useCallback(() => {
1808
+ const toggleSidebar = react.useCallback(() => {
1808
1809
  return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
1809
1810
  }, [isMobile, setOpen, setOpenMobile]);
1810
1811
  // Add swipe gesture support for opening and closing the sidebar.
1811
1812
  useOnSwipe(screenRef, (direction) => direction === 'right' ? setOpen(true) : direction === 'left' && setOpen(false));
1812
1813
  // Adds a keyboard shortcut to toggle the sidebar.
1813
- React.useEffect(() => {
1814
+ react.useEffect(() => {
1814
1815
  const handleKeyDown = (event) => {
1815
1816
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1816
1817
  event.preventDefault();
@@ -1823,7 +1824,7 @@ const SidebarContextProvider = React.forwardRef((_a, ref) => {
1823
1824
  // We add a state so that we can do data-state="expanded" or "collapsed".
1824
1825
  // This makes it easier to style the sidebar with Tailwind classes.
1825
1826
  const state = open ? 'expanded' : 'collapsed';
1826
- const contextValue = React.useMemo(() => ({
1827
+ const contextValue = react.useMemo(() => ({
1827
1828
  state,
1828
1829
  open,
1829
1830
  setOpen,
@@ -1835,7 +1836,7 @@ const SidebarContextProvider = React.forwardRef((_a, ref) => {
1835
1836
  return (jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: jsxRuntime.jsx("div", Object.assign({ style: Object.assign({ '--sidebar-width': SIDEBAR_WIDTH, '--sidebar-width-icon': SIDEBAR_WIDTH_ICON }, style), className: cn('group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full', className), ref: ref }, props, { children: children })) }));
1836
1837
  });
1837
1838
  SidebarContextProvider.displayName = 'SidebarContextProvider';
1838
- const $Sidebar = React.forwardRef((_a, ref) => {
1839
+ const $Sidebar = react.forwardRef((_a, ref) => {
1839
1840
  var { side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children } = _a, props = __rest(_a, ["side", "variant", "collapsible", "className", "children"]);
1840
1841
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
1841
1842
  if (collapsible === 'none') {
@@ -1857,7 +1858,7 @@ const $Sidebar = React.forwardRef((_a, ref) => {
1857
1858
  : 'border-sidebar-border group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l', className) }, props, { children: jsxRuntime.jsx("div", { "data-sidebar": "sidebar", className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow", children: children }) }))] }));
1858
1859
  });
1859
1860
  $Sidebar.displayName = 'Sidebar';
1860
- const SidebarTrigger = React.forwardRef((_a, ref) => {
1861
+ const SidebarTrigger = react.forwardRef((_a, ref) => {
1861
1862
  var { className, onClick } = _a, props = __rest(_a, ["className", "onClick"]);
1862
1863
  const { toggleSidebar } = useSidebar();
1863
1864
  return (jsxRuntime.jsx(Button, Object.assign({ ref: ref, "data-sidebar": "trigger", variant: "text", suffixIcon: lucideReact.PanelLeft, className: cn('h-7 w-7', className), onClick: (event) => {
@@ -1866,54 +1867,54 @@ const SidebarTrigger = React.forwardRef((_a, ref) => {
1866
1867
  } }, props)));
1867
1868
  });
1868
1869
  SidebarTrigger.displayName = 'SidebarTrigger';
1869
- const SidebarRail = React.forwardRef((_a, ref) => {
1870
+ const SidebarRail = react.forwardRef((_a, ref) => {
1870
1871
  var { className } = _a, props = __rest(_a, ["className"]);
1871
1872
  const { toggleSidebar } = useSidebar();
1872
1873
  return (jsxRuntime.jsx("button", Object.assign({ ref: ref, "data-sidebar": "rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn('hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex', '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize', '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', 'group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full', '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2', '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2', className) }, props)));
1873
1874
  });
1874
1875
  SidebarRail.displayName = 'SidebarRail';
1875
- const SidebarInset = React.forwardRef((_a, ref) => {
1876
+ const SidebarInset = react.forwardRef((_a, ref) => {
1876
1877
  var { className } = _a, props = __rest(_a, ["className"]);
1877
1878
  return (jsxRuntime.jsx("main", Object.assign({ ref: ref, className: cn('bg-background relative flex min-h-svh flex-1 flex-col', 'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow', className) }, props)));
1878
1879
  });
1879
1880
  SidebarInset.displayName = 'SidebarInset';
1880
- const SidebarInput = React.forwardRef((_a, ref) => {
1881
+ const SidebarInput = react.forwardRef((_a, ref) => {
1881
1882
  var { className } = _a, props = __rest(_a, ["className"]);
1882
1883
  return (jsxRuntime.jsx(BasicInput, Object.assign({ ref: ref, "data-sidebar": "input", className: cn('focus-visible:ring-sidebar-ring focus-visible:ring-2', className) }, props)));
1883
1884
  });
1884
1885
  SidebarInput.displayName = 'SidebarInput';
1885
- const SidebarHeader = React.forwardRef((_a, ref) => {
1886
+ const SidebarHeader = react.forwardRef((_a, ref) => {
1886
1887
  var { className } = _a, props = __rest(_a, ["className"]);
1887
1888
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "header", className: cn('flex flex-col gap-2 p-2', className) }, props)));
1888
1889
  });
1889
1890
  SidebarHeader.displayName = 'SidebarHeader';
1890
- const SidebarFooter = React.forwardRef((_a, ref) => {
1891
+ const SidebarFooter = react.forwardRef((_a, ref) => {
1891
1892
  var { className } = _a, props = __rest(_a, ["className"]);
1892
1893
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "footer", className: cn('flex flex-col gap-2 p-2', className) }, props)));
1893
1894
  });
1894
1895
  SidebarFooter.displayName = 'SidebarFooter';
1895
- const SidebarSeparator = React.forwardRef((_a, ref) => {
1896
+ const SidebarSeparator = react.forwardRef((_a, ref) => {
1896
1897
  var { className } = _a, props = __rest(_a, ["className"]);
1897
1898
  return (jsxRuntime.jsx(Separator, Object.assign({ ref: ref, "data-sidebar": "separator", className: cn('bg-sidebar-border mx-2 w-auto', className) }, props)));
1898
1899
  });
1899
1900
  SidebarSeparator.displayName = 'SidebarSeparator';
1900
- const SidebarContent = React.forwardRef((_a, ref) => {
1901
+ const SidebarContent = react.forwardRef((_a, ref) => {
1901
1902
  var { className } = _a, props = __rest(_a, ["className"]);
1902
1903
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "content", className: cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className) }, props)));
1903
1904
  });
1904
1905
  SidebarContent.displayName = 'SidebarContent';
1905
- const SidebarGroup = React.forwardRef((_a, ref) => {
1906
+ const SidebarGroup = react.forwardRef((_a, ref) => {
1906
1907
  var { className } = _a, props = __rest(_a, ["className"]);
1907
1908
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "group", className: cn('relative flex w-full min-w-0 flex-col p-2', className) }, props)));
1908
1909
  });
1909
1910
  SidebarGroup.displayName = 'SidebarGroup';
1910
- const SidebarGroupLabel = React.forwardRef((_a, ref) => {
1911
+ const SidebarGroupLabel = react.forwardRef((_a, ref) => {
1911
1912
  var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
1912
1913
  const Comp = asChild ? reactSlot.Slot : 'div';
1913
1914
  return (jsxRuntime.jsx(Comp, Object.assign({ ref: ref, "data-sidebar": "group-label", className: cn('text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className) }, props)));
1914
1915
  });
1915
1916
  SidebarGroupLabel.displayName = 'SidebarGroupLabel';
1916
- const SidebarGroupAction = React.forwardRef((_a, ref) => {
1917
+ const SidebarGroupAction = react.forwardRef((_a, ref) => {
1917
1918
  var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
1918
1919
  const Comp = asChild ? reactSlot.Slot : 'button';
1919
1920
  return (jsxRuntime.jsx(Comp, Object.assign({ ref: ref, "data-sidebar": "group-action", className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
@@ -1921,17 +1922,17 @@ const SidebarGroupAction = React.forwardRef((_a, ref) => {
1921
1922
  'after:absolute after:-inset-2 after:md:hidden', 'group-data-[collapsible=icon]:hidden', className) }, props)));
1922
1923
  });
1923
1924
  SidebarGroupAction.displayName = 'SidebarGroupAction';
1924
- const SidebarGroupContent = React.forwardRef((_a, ref) => {
1925
+ const SidebarGroupContent = react.forwardRef((_a, ref) => {
1925
1926
  var { className } = _a, props = __rest(_a, ["className"]);
1926
1927
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "group-content", className: cn('w-full text-sm', className) }, props)));
1927
1928
  });
1928
1929
  SidebarGroupContent.displayName = 'SidebarGroupContent';
1929
- const SidebarMenu = React.forwardRef((_a, ref) => {
1930
+ const SidebarMenu = react.forwardRef((_a, ref) => {
1930
1931
  var { className } = _a, props = __rest(_a, ["className"]);
1931
1932
  return (jsxRuntime.jsx("ul", Object.assign({ ref: ref, "data-sidebar": "menu", className: cn('flex w-full min-w-0 flex-col gap-1', className) }, props)));
1932
1933
  });
1933
1934
  SidebarMenu.displayName = 'SidebarMenu';
1934
- const SidebarMenuItem = React.forwardRef((_a, ref) => {
1935
+ const SidebarMenuItem = react.forwardRef((_a, ref) => {
1935
1936
  var { className } = _a, props = __rest(_a, ["className"]);
1936
1937
  return (jsxRuntime.jsx("li", Object.assign({ ref: ref, "data-sidebar": "menu-item", className: cn('group/menu-item relative', className) }, props)));
1937
1938
  });
@@ -1953,7 +1954,7 @@ const sidebarMenuButtonVariants = classVarianceAuthority.cva('peer/menu-button f
1953
1954
  size: 'default',
1954
1955
  },
1955
1956
  });
1956
- const SidebarMenuButton = React.forwardRef((_a, ref) => {
1957
+ const SidebarMenuButton = react.forwardRef((_a, ref) => {
1957
1958
  var { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className } = _a, props = __rest(_a, ["asChild", "isActive", "variant", "size", "tooltip", "className"]);
1958
1959
  const Comp = asChild ? reactSlot.Slot : 'button';
1959
1960
  const { isMobile, state } = useSidebar();
@@ -1969,7 +1970,7 @@ const SidebarMenuButton = React.forwardRef((_a, ref) => {
1969
1970
  return (jsxRuntime.jsx(Tooltip, Object.assign({ asChild: true, placement: "right" }, tooltip, { children: button })));
1970
1971
  });
1971
1972
  SidebarMenuButton.displayName = 'SidebarMenuButton';
1972
- const SidebarMenuAction = React.forwardRef((_a, ref) => {
1973
+ const SidebarMenuAction = react.forwardRef((_a, ref) => {
1973
1974
  var { className, asChild = false, showOnHover = false } = _a, props = __rest(_a, ["className", "asChild", "showOnHover"]);
1974
1975
  const Comp = asChild ? reactSlot.Slot : 'button';
1975
1976
  return (jsxRuntime.jsx(Comp, Object.assign({ ref: ref, "data-sidebar": "menu-action", className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
@@ -1978,15 +1979,15 @@ const SidebarMenuAction = React.forwardRef((_a, ref) => {
1978
1979
  'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0', className) }, props)));
1979
1980
  });
1980
1981
  SidebarMenuAction.displayName = 'SidebarMenuAction';
1981
- const SidebarMenuBadge = React.forwardRef((_a, ref) => {
1982
+ const SidebarMenuBadge = react.forwardRef((_a, ref) => {
1982
1983
  var { className } = _a, props = __rest(_a, ["className"]);
1983
1984
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "menu-badge", className: cn('text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums', 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground', 'peer-data-[size=sm]/menu-button:top-1', 'peer-data-[size=default]/menu-button:top-1.5', 'peer-data-[size=lg]/menu-button:top-2.5', 'group-data-[collapsible=icon]:hidden', className) }, props)));
1984
1985
  });
1985
1986
  SidebarMenuBadge.displayName = 'SidebarMenuBadge';
1986
- const SidebarMenuSkeleton = React.forwardRef((_a, ref) => {
1987
+ const SidebarMenuSkeleton = react.forwardRef((_a, ref) => {
1987
1988
  var { className, showIcon = false } = _a, props = __rest(_a, ["className", "showIcon"]);
1988
1989
  // Random width between 50 to 90%.
1989
- const width = React.useMemo(() => {
1990
+ const width = react.useMemo(() => {
1990
1991
  return `${Math.floor(Math.random() * 40) + 50}%`;
1991
1992
  }, []);
1992
1993
  return (jsxRuntime.jsxs("div", Object.assign({ ref: ref, "data-sidebar": "menu-skeleton", className: cn('flex h-8 items-center gap-2 rounded-md px-2', className) }, props, { children: [showIcon && jsxRuntime.jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), jsxRuntime.jsx(Skeleton, { className: "h-4 max-w-[--skeleton-width] flex-1", "data-sidebar": "menu-skeleton-text", style: {
@@ -1994,17 +1995,17 @@ const SidebarMenuSkeleton = React.forwardRef((_a, ref) => {
1994
1995
  } })] })));
1995
1996
  });
1996
1997
  SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';
1997
- const SidebarMenuSub = React.forwardRef((_a, ref) => {
1998
+ const SidebarMenuSub = react.forwardRef((_a, ref) => {
1998
1999
  var { className } = _a, props = __rest(_a, ["className"]);
1999
2000
  return (jsxRuntime.jsx("ul", Object.assign({ ref: ref, "data-sidebar": "menu-sub", className: cn('border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5', 'group-data-[collapsible=icon]:hidden', className) }, props)));
2000
2001
  });
2001
2002
  SidebarMenuSub.displayName = 'SidebarMenuSub';
2002
- const SidebarMenuSubItem = React.forwardRef((_a, ref) => {
2003
+ const SidebarMenuSubItem = react.forwardRef((_a, ref) => {
2003
2004
  var props = __rest(_a, []);
2004
2005
  return (jsxRuntime.jsx("li", Object.assign({ ref: ref }, props)));
2005
2006
  });
2006
2007
  SidebarMenuSubItem.displayName = 'SidebarMenuSubItem';
2007
- const SidebarMenuSubButton = React.forwardRef((_a, ref) => {
2008
+ const SidebarMenuSubButton = react.forwardRef((_a, ref) => {
2008
2009
  var { asChild = false, size = 'md', isActive, className } = _a, props = __rest(_a, ["asChild", "size", "isActive", "className"]);
2009
2010
  const Comp = asChild ? reactSlot.Slot : 'a';
2010
2011
  return (jsxRuntime.jsx(Comp, Object.assign({ ref: ref, "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className) }, props)));
@@ -2043,7 +2044,7 @@ const Layout = (_a) => {
2043
2044
  const RenderSideBarItem = ({ basePath = '/', pathname, title, Icon, items, }) => {
2044
2045
  const location = reactRouterDom.useLocation();
2045
2046
  const { open } = useSidebar();
2046
- const currentPath = React.useMemo(() => location.pathname.replace(basePath, '').replace(/^\/*/, ''), [basePath, location.pathname]);
2047
+ const currentPath = react.useMemo(() => location.pathname.replace(basePath, '').replace(/^\/*/, ''), [basePath, location.pathname]);
2047
2048
  return (jsxRuntime.jsxs(Sidebar.MenuItem, { children: [jsxRuntime.jsx(Sidebar.MenuButton, { asChild: true, tooltip: title, isActive: isLinkStartsWithPathname(currentPath, pathname) &&
2048
2049
  (!items ||
2049
2050
  (!open &&
@@ -2055,7 +2056,7 @@ function isLinkStartsWithPathname(link, pathname) {
2055
2056
 
2056
2057
  const $Popover = PopoverPrimitive__namespace.Root;
2057
2058
  const PopoverTrigger = PopoverPrimitive__namespace.Trigger;
2058
- const PopoverContent = React.forwardRef((_a, ref) => {
2059
+ const PopoverContent = react.forwardRef((_a, ref) => {
2059
2060
  var { className, align = 'center', sideOffset = 4, container } = _a, props = __rest(_a, ["className", "align", "sideOffset", "container"]);
2060
2061
  return (jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: container, children: jsxRuntime.jsx(PopoverPrimitive__namespace.Content, Object.assign({ ref: ref, align: align, sideOffset: sideOffset, className: cn('z-50 rounded-md border bg-white p-1 shadow-md outline-none dark:border-slate-700 dark:bg-slate-900 dark:text-white', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className) }, props)) }));
2061
2062
  });
@@ -2065,23 +2066,23 @@ const Popover = Object.assign($Popover, {
2065
2066
  Content: PopoverContent,
2066
2067
  });
2067
2068
 
2068
- const Switch = React.forwardRef((_a, ref) => {
2069
+ const Switch = react.forwardRef((_a, ref) => {
2069
2070
  var { className } = _a, _b = _a.thumbProps, _c = _b === void 0 ? {} : _b, { className: thumbClassName } = _c, thumbProps = __rest(_c, ["className"]), props = __rest(_a, ["className", "thumbProps"]);
2070
2071
  return (jsxRuntime.jsx(SwitchPrimitives__namespace.Root, Object.assign({ className: cn('peer inline-flex h-[calc(1.5rem+6px)] w-[calc(3rem+6px)] shrink-0 cursor-pointer items-center rounded-full border-[3px] border-transparent', 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-600 focus-visible:ring-offset-2', 'focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-300', 'dark:focus-visible:ring-slate-200 dark:focus-visible:ring-offset-slate-800 dark:data-[state=checked]:bg-blue-700 dark:data-[state=unchecked]:bg-slate-700', className) }, props, { ref: ref, children: jsxRuntime.jsx(SwitchPrimitives__namespace.Thumb, Object.assign({ className: cn('pointer-events-none block h-6 w-6 rounded-full bg-white shadow-lg ring-0 transition-transform', 'data-[state=checked]:translate-x-6 data-[state=unchecked]:translate-x-0 dark:bg-slate-900', thumbClassName) }, thumbProps)) })));
2071
2072
  });
2072
2073
  Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
2073
2074
 
2074
- const $Tabs = React.forwardRef((_a, ref) => {
2075
+ const $Tabs = react.forwardRef((_a, ref) => {
2075
2076
  var { className } = _a, props = __rest(_a, ["className"]);
2076
2077
  return (jsxRuntime.jsx(TabsPrimitive__namespace.Root, Object.assign({ ref: ref, className: cn('flex flex-col gap-2', className) }, props)));
2077
2078
  });
2078
2079
  $Tabs.displayName = TabsPrimitive__namespace.Root.displayName;
2079
- const TabsList = React.forwardRef((_a, ref) => {
2080
+ const TabsList = react.forwardRef((_a, ref) => {
2080
2081
  var { className } = _a, props = __rest(_a, ["className"]);
2081
2082
  return (jsxRuntime.jsx(TabsPrimitive__namespace.List, Object.assign({ ref: ref, className: cn('inline-flex w-full items-center justify-center gap-1 rounded-lg border bg-slate-100 p-1 text-slate-400 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-500', className) }, props)));
2082
2083
  });
2083
2084
  TabsList.displayName = TabsPrimitive__namespace.List.displayName;
2084
- const TabsTrigger = React.forwardRef((_a, ref) => {
2085
+ const TabsTrigger = react.forwardRef((_a, ref) => {
2085
2086
  var { className } = _a, props = __rest(_a, ["className"]);
2086
2087
  return (jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, Object.assign({ ref: ref, className: cn('inline-flex w-full items-center justify-center whitespace-nowrap rounded-md px-2 py-1.5 font-medium transition-all hover:bg-slate-200 disabled:pointer-events-none disabled:opacity-50 dark:hover:bg-slate-800', 'data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-white', className) }, props)));
2087
2088
  });
@@ -2093,10 +2094,10 @@ const Tabs = Object.assign($Tabs, {
2093
2094
  Content: TabsContent,
2094
2095
  });
2095
2096
 
2096
- const LayoutContext = React.createContext(undefined);
2097
+ const LayoutContext = react.createContext(undefined);
2097
2098
  const LayoutContextProvider = ({ children }) => {
2098
- const [theme, setTheme] = React.useState(getValueFromLocalStorage(THEME_KEY, 'light'));
2099
- React.useEffect(() => {
2099
+ const [theme, setTheme] = react.useState(getValueFromLocalStorage(THEME_KEY, 'light'));
2100
+ react.useEffect(() => {
2100
2101
  if (theme) {
2101
2102
  if (theme === 'dark') {
2102
2103
  document.documentElement.classList.add('dark');
@@ -2116,7 +2117,7 @@ const LayoutContextProvider = ({ children }) => {
2116
2117
  return jsxRuntime.jsx(LayoutContext.Provider, { value: { theme, toggleTheme }, children: children });
2117
2118
  };
2118
2119
  function useLayoutContext() {
2119
- const context = React.useContext(LayoutContext);
2120
+ const context = react.useContext(LayoutContext);
2120
2121
  if (!context) {
2121
2122
  throw new Error('Please use LayoutContextProvider!');
2122
2123
  }