tw-react-components 0.0.138 → 0.0.140

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);
@@ -124,6 +123,19 @@ function getDisplayDate(date, format, locale) {
124
123
  return (locale ? dayjs(date).locale(locale) : dayjs(date)).format(format);
125
124
  }
126
125
 
126
+ function getValueFromCookie(key, _default) {
127
+ var _a, _b;
128
+ const transformers = {
129
+ string: String,
130
+ boolean: (value) => value === 'true',
131
+ };
132
+ return typeof window !== 'undefined'
133
+ ? transformers[typeof _default]((_b = (_a = document.cookie
134
+ .split('; ')
135
+ .find((row) => row.startsWith(key))) === null || _a === void 0 ? void 0 : _a.split('=')[1]) !== null && _b !== void 0 ? _b : _default)
136
+ : _default;
137
+ }
138
+
127
139
  function isEmpty(s) {
128
140
  if (Array.isArray(s))
129
141
  return s.length === 0;
@@ -586,26 +598,26 @@ const sizeClassNames = {
586
598
  },
587
599
  },
588
600
  };
589
- const Button = React.forwardRef((_a, ref) => {
590
- 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"]);
601
+ const Button = react.forwardRef((_a, ref) => {
602
+ var { children, className, size = 'medium', color = 'slate', variant = 'filled', rounded, prefixIcon: PrefixIcon, suffixIcon: SuffixIcon, unstyled } = _a, props = __rest(_a, ["children", "className", "size", "color", "variant", "rounded", "prefixIcon", "suffixIcon", "unstyled"]);
591
603
  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
604
  ? 'cursor-not-allowed opacity-50'
593
- : props.onClick
605
+ : !unstyled
594
606
  ? `${variantClassNames[variant][color].hover} ${variantClassNames[variant][color].focus} ${variantClassNames[variant][color].active}`
595
607
  : '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
608
  });
597
609
 
598
- const Badge = React.forwardRef((_a, ref) => {
610
+ const Badge = react.forwardRef((_a, ref) => {
599
611
  var { size = 'small' } = _a, props = __rest(_a, ["size"]);
600
612
  return jsxRuntime.jsx(Button, Object.assign({ size: size }, props, { ref: ref }));
601
613
  });
602
614
 
603
- const Block = React.forwardRef((_a, ref) => {
615
+ const Block = react.forwardRef((_a, ref) => {
604
616
  var { children, className, centered, container, fullWidth, fullHeight } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight"]);
605
617
  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
618
  });
607
619
 
608
- const Card = React.forwardRef((_a, ref) => {
620
+ const Card = react.forwardRef((_a, ref) => {
609
621
  var { children, className } = _a, blockProps = __rest(_a, ["children", "className"]);
610
622
  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
623
  });
@@ -631,14 +643,14 @@ const justifyClasses = {
631
643
  between: 'justify-between',
632
644
  end: 'justify-end',
633
645
  };
634
- const Flex = React.forwardRef((_a, ref) => {
646
+ const Flex = react.forwardRef((_a, ref) => {
635
647
  var { children, className, reverse, wrap, direction = 'row', align = 'start', justify = 'start' } = _a, blockProps = __rest(_a, ["children", "className", "reverse", "wrap", "direction", "align", "justify"]);
636
648
  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
649
  });
638
650
 
639
651
  dayjs.extend(localeData);
640
652
  function useDays(locale = 'en') {
641
- return React.useMemo(() => {
653
+ return react.useMemo(() => {
642
654
  dayjs.extend(localeData).locale(locale);
643
655
  const names = dayjs.weekdays();
644
656
  const shortNames = dayjs.weekdaysShort();
@@ -648,8 +660,8 @@ function useDays(locale = 'en') {
648
660
 
649
661
  const MOBILE_BREAKPOINT = 768;
650
662
  function useIsMobile() {
651
- const [isMobile, setIsMobile] = React.useState(undefined);
652
- React.useEffect(() => {
663
+ const [isMobile, setIsMobile] = react.useState(undefined);
664
+ react.useEffect(() => {
653
665
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
654
666
  const onChange = () => {
655
667
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -662,8 +674,8 @@ function useIsMobile() {
662
674
  }
663
675
 
664
676
  function useLongPress(callback, ms = 100) {
665
- const [startLongPress, setStartLongPress] = React.useState(false);
666
- React.useEffect(() => {
677
+ const [startLongPress, setStartLongPress] = react.useState(false);
678
+ react.useEffect(() => {
667
679
  let timerId;
668
680
  if (startLongPress) {
669
681
  timerId = setTimeout(callback, ms);
@@ -686,7 +698,7 @@ function useLongPress(callback, ms = 100) {
686
698
 
687
699
  dayjs.extend(localeData);
688
700
  function useMonths(locale = 'en') {
689
- return React.useMemo(() => {
701
+ return react.useMemo(() => {
690
702
  dayjs.extend(localeData).locale(locale);
691
703
  const names = dayjs.months();
692
704
  const shortNames = dayjs.monthsShort();
@@ -695,7 +707,7 @@ function useMonths(locale = 'en') {
695
707
  }
696
708
 
697
709
  function useOnSwipe(element, onSwipe, minSwipeDistance = 50) {
698
- React.useEffect(() => {
710
+ react.useEffect(() => {
699
711
  if (!element.current)
700
712
  return;
701
713
  const elem = element.current;
@@ -736,7 +748,7 @@ function useOnSwipe(element, onSwipe, minSwipeDistance = 50) {
736
748
  }
737
749
 
738
750
  function useOutsideClick(ref, callback) {
739
- React.useEffect(() => {
751
+ react.useEffect(() => {
740
752
  const handleClickOutside = (event) => {
741
753
  if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(event.target)) {
742
754
  callback();
@@ -752,7 +764,7 @@ function useOutsideClick(ref, callback) {
752
764
  }
753
765
 
754
766
  function usePagination(currentIndex, totalPages) {
755
- return React.useMemo(() => {
767
+ return react.useMemo(() => {
756
768
  const result = [];
757
769
  result.push(currentIndex);
758
770
  if (totalPages > 7 && currentIndex > 4) {
@@ -841,10 +853,10 @@ const sizeClasses = {
841
853
  },
842
854
  },
843
855
  };
844
- const BasicInput = React.forwardRef(function BasicInput(_a, ref) {
856
+ const BasicInput = react.forwardRef(function BasicInput(_a, ref) {
845
857
  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]);
858
+ const id = react.useId();
859
+ 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
860
  const handleClear = (event) => {
849
861
  var _a;
850
862
  event.stopPropagation();
@@ -878,30 +890,30 @@ const BasicInputExtension = ({ children, className, size, hasErrors, disabled, o
878
890
  'cursor-pointer': onClick,
879
891
  }, className), onClick: !disabled ? onClick : undefined, onPointerDown: (event) => event.stopPropagation(), children: children }));
880
892
 
881
- const CheckboxInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "checkbox" }, props, { ref: ref }))));
893
+ const CheckboxInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "checkbox" }, props, { ref: ref }))));
882
894
 
883
- const EmailInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: lucideReact.AtSignIcon, ref: ref }))));
895
+ const EmailInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: lucideReact.AtSignIcon, ref: ref }))));
884
896
 
885
- const NumberInput = React.forwardRef((_a, ref) => {
897
+ const NumberInput = react.forwardRef((_a, ref) => {
886
898
  var { unit } = _a, props = __rest(_a, ["unit"]);
887
899
  return (jsxRuntime.jsx(BasicInput, Object.assign({ type: "number" }, props, { suffixIcon: unit
888
900
  ? ({ className }) => (jsxRuntime.jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
889
901
  : props.suffixIcon, ref: ref })));
890
902
  });
891
903
 
892
- const PasswordInput = React.forwardRef((props, ref) => {
893
- const [type, setType] = React.useState('password');
904
+ const PasswordInput = react.forwardRef((props, ref) => {
905
+ const [type, setType] = react.useState('password');
894
906
  const toggleType = () => setType((type) => (type === 'text' ? 'password' : 'text'));
895
907
  return (jsxRuntime.jsx(BasicInput, Object.assign({ type: type }, props, { suffixIcon: type === 'password' ? lucideReact.EyeIcon : lucideReact.EyeOffIcon, onSuffixIconClick: toggleType, ref: ref })));
896
908
  });
897
909
 
898
- const TextareaInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "textarea" }, props, { ref: ref }))));
910
+ const TextareaInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "textarea" }, props, { ref: ref }))));
899
911
 
900
- const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "text" }, props, { ref: ref }))));
912
+ const TextInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "text" }, props, { ref: ref }))));
901
913
 
902
914
  const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDate, }) => {
903
915
  const days = useDays(locale);
904
- const monthDays = React.useMemo(() => {
916
+ const monthDays = react.useMemo(() => {
905
917
  const daysInMonth = new Date(year, month + 1, 0).getDate();
906
918
  const daysInMonthArr = [];
907
919
  for (let i = 1; i <= daysInMonth; i++) {
@@ -909,7 +921,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
909
921
  }
910
922
  return daysInMonthArr;
911
923
  }, [month, year]);
912
- const prefixDays = React.useMemo(() => {
924
+ const prefixDays = react.useMemo(() => {
913
925
  const firstDay = new Date(year, month);
914
926
  const dayOfWeek = firstDay.getDay();
915
927
  firstDay.setDate(firstDay.getDate() - 1);
@@ -920,7 +932,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
920
932
  }
921
933
  return prefixDays;
922
934
  }, [month, year]);
923
- const suffixDays = React.useMemo(() => {
935
+ const suffixDays = react.useMemo(() => {
924
936
  const lastDay = new Date(year, month + 1);
925
937
  lastDay.setDate(lastDay.getDate() - 1);
926
938
  const dayOfWeek = lastDay.getDay();
@@ -930,7 +942,7 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
930
942
  }
931
943
  return suffixDays;
932
944
  }, [month, year]);
933
- const setDayNumber = React.useCallback((newDay, newMonth = month, newYear = year) => () => {
945
+ const setDayNumber = react.useCallback((newDay, newMonth = month, newYear = year) => () => {
934
946
  const newDate = new Date(newYear, newMonth, newDay, date.getHours(), date.getMinutes());
935
947
  if (minDate) {
936
948
  const _minDate = new Date(minDate);
@@ -959,11 +971,11 @@ const DaysView = ({ date, value, month, year, minDate, maxDate, locale, setNewDa
959
971
  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
972
  };
961
973
  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) &&
974
+ const dayDate = react.useMemo(() => new Date(year, month, day), [day, month, year]);
975
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'day') >= 0) &&
964
976
  (!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]);
977
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'day'), [dayDate, value]);
978
+ const isEqualToday = react.useMemo(() => !compareDates(dayDate, new Date(), 'day'), [dayDate]);
967
979
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex h-8 w-8 items-center justify-center rounded-lg text-sm', {
968
980
  'border-2 border-blue-500': isEqualToday,
969
981
  'bg-blue-500 text-white': isSelected,
@@ -978,11 +990,11 @@ const MonthsView = ({ date, value, year, minDate, maxDate, locale, selectMonth,
978
990
  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
991
  };
980
992
  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) &&
993
+ const dayDate = react.useMemo(() => new Date(year, month, date.getDate(), date.getHours(), date.getMinutes()), [date, month, year]);
994
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'month') >= 0) &&
983
995
  (!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]);
996
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'month'), [dayDate, value]);
997
+ const isEqualThisMonth = react.useMemo(() => !compareDates(dayDate, new Date(), 'month'), [dayDate]);
986
998
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex w-14 items-center justify-center rounded border py-3 text-sm', {
987
999
  'border-blue-500': isEqualThisMonth,
988
1000
  'border-transparent': !isEqualThisMonth,
@@ -995,11 +1007,11 @@ const Month = ({ date, value, shortName, month, year, minDate, maxDate, selectMo
995
1007
 
996
1008
  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
1009
  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) &&
1010
+ const dayDate = react.useMemo(() => new Date(year, date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()), [date, year]);
1011
+ const isSelectable = react.useMemo(() => (!minDate || compareDates(dayDate, new Date(minDate), 'year') >= 0) &&
1000
1012
  (!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]);
1013
+ const isSelected = react.useMemo(() => !!value && !compareDates(dayDate, new Date(value), 'year'), [dayDate, value]);
1014
+ const isEqualThisYear = react.useMemo(() => !compareDates(dayDate, new Date(), 'year'), [dayDate]);
1003
1015
  return (jsxRuntime.jsx("div", { className: cn('mx-auto flex w-14 items-center justify-center rounded border py-3 text-sm', {
1004
1016
  'border-blue-500': isEqualThisYear,
1005
1017
  'border-transparent': !isEqualThisYear,
@@ -1012,14 +1024,14 @@ const Year = ({ date, value, year, minDate, maxDate, selectYear }) => {
1012
1024
 
1013
1025
  const DateSelector = ({ date, value, minDate, maxDate, locale, calendarView, setCalendarView, setNewDate, }) => {
1014
1026
  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(() => {
1027
+ const [month, setMonth] = react.useState(date.getMonth());
1028
+ const [year, setYear] = react.useState(date.getFullYear());
1029
+ const [yearOffset, setYearOffset] = react.useState(0);
1030
+ react.useEffect(() => {
1019
1031
  setMonth(date.getMonth());
1020
1032
  setYear(date.getFullYear());
1021
1033
  }, [date]);
1022
- const yearsRange = React.useMemo(() => {
1034
+ const yearsRange = react.useMemo(() => {
1023
1035
  const yearsRangeArr = [];
1024
1036
  for (let i = year + yearOffset - 6; i < year + yearOffset + 6; i++) {
1025
1037
  yearsRangeArr.push(i);
@@ -1089,21 +1101,21 @@ const TimeSelector = ({ date, step = 1, minDate, maxDate, setNewDate, }) => {
1089
1101
  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
1102
  };
1091
1103
 
1092
- const DateTimeInput = React.forwardRef((_a, ref) => {
1104
+ const DateTimeInput = react.forwardRef((_a, ref) => {
1093
1105
  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(() => {
1106
+ const [isOpen, setIsOpen] = react.useState();
1107
+ const [calendarView, setCalendarView] = react.useState('days');
1108
+ const date = react.useMemo(() => {
1097
1109
  const result = value
1098
1110
  ? new Date(value)
1099
1111
  : 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
1112
  result.setMinutes(result.getMinutes() - ((result.getMinutes() + step) % step));
1101
1113
  return result;
1102
1114
  }, [step, maxDate, minDate, value]);
1103
- const displayDate = React.useMemo(() => value && getDisplayDate(date, displayFormat, displayLocale), [date, value, displayFormat, displayLocale]);
1104
- const calendarRef = React.useRef(null);
1115
+ const displayDate = react.useMemo(() => value && getDisplayDate(date, displayFormat, displayLocale), [date, value, displayFormat, displayLocale]);
1116
+ const calendarRef = react.useRef(null);
1105
1117
  useOutsideClick(calendarRef, () => setIsOpen(false));
1106
- React.useEffect(() => {
1118
+ react.useEffect(() => {
1107
1119
  if (!isOpen) {
1108
1120
  setCalendarView('days');
1109
1121
  }
@@ -1145,7 +1157,7 @@ const DateTimeInput = React.forwardRef((_a, ref) => {
1145
1157
  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
1158
  });
1147
1159
 
1148
- const ListContent = React.forwardRef((_a, ref) => {
1160
+ const ListContent = react.forwardRef((_a, ref) => {
1149
1161
  var { className } = _a, props = __rest(_a, ["className"]);
1150
1162
  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
1163
  });
@@ -1153,20 +1165,20 @@ const labelSizeClasses = {
1153
1165
  small: 'p-1 text-sm',
1154
1166
  medium: 'px-2 py-1.5',
1155
1167
  };
1156
- const ListItem = React.forwardRef((_a, ref) => {
1168
+ const ListItem = react.forwardRef((_a, ref) => {
1157
1169
  var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
1158
1170
  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
1171
  });
1160
- const ListLabel = React.forwardRef((_a, ref) => {
1172
+ const ListLabel = react.forwardRef((_a, ref) => {
1161
1173
  var { className, size = 'medium', inset } = _a, props = __rest(_a, ["className", "size", "inset"]);
1162
1174
  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
1175
  });
1164
- const ListIndicator = React.forwardRef((_a, ref) => {
1176
+ const ListIndicator = react.forwardRef((_a, ref) => {
1165
1177
  var { className, icon: Icon, iconClassName } = _a, props = __rest(_a, ["className", "icon", "iconClassName"]);
1166
1178
  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
1179
  });
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) => {
1180
+ const ListIcon = react.forwardRef(({ className, icon: Icon }, ref) => jsxRuntime.jsx(Icon, { className: cn('h-4 w-4', className), ref: ref }));
1181
+ const ListSeparator = react.forwardRef((_a, ref) => {
1170
1182
  var { className } = _a, props = __rest(_a, ["className"]);
1171
1183
  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
1184
  });
@@ -1183,42 +1195,42 @@ const DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
1183
1195
  const DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
1184
1196
  const DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
1185
1197
  const DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
1186
- const DropdownMenuSubTrigger = React.forwardRef((_a, ref) => {
1198
+ const DropdownMenuSubTrigger = react.forwardRef((_a, ref) => {
1187
1199
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1188
1200
  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
1201
  });
1190
1202
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
1191
- const DropdownMenuSubContent = React.forwardRef((_a, ref) => {
1203
+ const DropdownMenuSubContent = react.forwardRef((_a, ref) => {
1192
1204
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1193
1205
  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
1206
  });
1195
1207
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
1196
- const DropdownMenuContent = React.forwardRef((_a, ref) => {
1208
+ const DropdownMenuContent = react.forwardRef((_a, ref) => {
1197
1209
  var { className, children, sideOffset = 4 } = _a, props = __rest(_a, ["className", "children", "sideOffset"]);
1198
1210
  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
1211
  });
1200
1212
  DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
1201
- const DropdownMenuItem = React.forwardRef((_a, ref) => {
1213
+ const DropdownMenuItem = react.forwardRef((_a, ref) => {
1202
1214
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1203
1215
  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
1216
  });
1205
1217
  DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
1206
- const DropdownMenuCheckboxItem = React.forwardRef((_a, ref) => {
1218
+ const DropdownMenuCheckboxItem = react.forwardRef((_a, ref) => {
1207
1219
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1208
1220
  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
1221
  });
1210
1222
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
1211
- const DropdownMenuRadioItem = React.forwardRef((_a, ref) => {
1223
+ const DropdownMenuRadioItem = react.forwardRef((_a, ref) => {
1212
1224
  var { className, children } = _a, props = __rest(_a, ["className", "children"]);
1213
1225
  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
1226
  });
1215
1227
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
1216
- const DropdownMenuLabel = React.forwardRef((_a, ref) => {
1228
+ const DropdownMenuLabel = react.forwardRef((_a, ref) => {
1217
1229
  var { className, inset, children } = _a, props = __rest(_a, ["className", "inset", "children"]);
1218
1230
  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
1231
  });
1220
1232
  DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
1221
- const DropdownMenuSeparator = React.forwardRef((_a, ref) => {
1233
+ const DropdownMenuSeparator = react.forwardRef((_a, ref) => {
1222
1234
  var { className } = _a, props = __rest(_a, ["className"]);
1223
1235
  return (jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Separator, Object.assign({ ref: ref }, props, { asChild: true, children: jsxRuntime.jsx(List.Separator, { className: className }) })));
1224
1236
  });
@@ -1246,12 +1258,12 @@ const DropdownMenu = Object.assign(DropdownMenuPrimitive__namespace.Root, {
1246
1258
  RadioGroup: DropdownMenuRadioGroup,
1247
1259
  });
1248
1260
 
1249
- const SelectInput = React.forwardRef((_a, ref) => {
1261
+ const SelectInput = react.forwardRef((_a, ref) => {
1250
1262
  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
1263
+ const [open, setOpen] = react.useState(false);
1264
+ const [searchValue, setSearchValue] = react.useState('');
1265
+ const pureItems = react.useMemo(() => items.flatMap((item) => (item.group ? item.items : [item])), [items]);
1266
+ const selectedItems = react.useMemo(() => value
1255
1267
  ? !multiple
1256
1268
  ? pureItems.find((item) => selectPredicate(item.value, value))
1257
1269
  ? [pureItems.find((item) => selectPredicate(item.value, value))]
@@ -1262,7 +1274,7 @@ const SelectInput = React.forwardRef((_a, ref) => {
1262
1274
  .filter(Boolean)
1263
1275
  : []
1264
1276
  : [], [multiple, pureItems, selectPredicate, value]);
1265
- const filteredItems = React.useMemo(() => !search || !searchValue
1277
+ const filteredItems = react.useMemo(() => !search || !searchValue
1266
1278
  ? items
1267
1279
  : items.flatMap((item) => item.group
1268
1280
  ? item.items.some((subItem) => subItem.label.toLowerCase().includes(searchValue.toLowerCase()))
@@ -1273,13 +1285,13 @@ const SelectInput = React.forwardRef((_a, ref) => {
1273
1285
  : item.label.toLowerCase().includes(searchValue.toLowerCase())
1274
1286
  ? [item]
1275
1287
  : []), [items, search, searchValue]);
1276
- const text = React.useMemo(() => selectedItems.length
1288
+ const text = react.useMemo(() => selectedItems.length
1277
1289
  ? !multiple
1278
1290
  ? selectedItems[0].label
1279
1291
  : selectedItems.map((item) => item.label).join(', ')
1280
1292
  : 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) => {
1293
+ const selectedMap = react.useMemo(() => selectedItems.reduce((prev, curr) => (Object.assign(Object.assign({}, prev), { [curr.id]: curr.value })), {}), [selectedItems]);
1294
+ const handleOnSelect = react.useCallback((id) => {
1283
1295
  var _a, _b, _c;
1284
1296
  !multiple && setOpen(false);
1285
1297
  if (!multiple) {
@@ -1315,7 +1327,7 @@ const SelectInput = React.forwardRef((_a, ref) => {
1315
1327
  };
1316
1328
  const GroupComponent = multiple ? DropdownMenu.Group : DropdownMenu.RadioGroup;
1317
1329
  const ItemComponent = multiple ? DropdownMenu.CheckboxItem : DropdownMenu.RadioItem;
1318
- const RenderOption = React.useCallback((option) => {
1330
+ const RenderOption = react.useCallback((option) => {
1319
1331
  return (jsxRuntime.jsx(ItemComponent, { className: cn('w-full cursor-pointer hover:bg-slate-200 dark:hover:bg-slate-700', {
1320
1332
  'bg-slate-200 dark:bg-slate-700': selectedMap[option.id],
1321
1333
  }), value: String(option.id), checked: !!selectedMap[option.id], onSelect: (event) => {
@@ -1327,9 +1339,9 @@ const SelectInput = React.forwardRef((_a, ref) => {
1327
1339
  (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
1340
  });
1329
1341
 
1330
- const FileInput = React.forwardRef((_a, ref) => {
1342
+ const FileInput = react.forwardRef((_a, ref) => {
1331
1343
  var { className, value, onChange, onFileChange, accept } = _a, props = __rest(_a, ["className", "value", "onChange", "onFileChange", "accept"]);
1332
- const fileInputRef = React.useRef(null);
1344
+ const fileInputRef = react.useRef(null);
1333
1345
  const handleFileChange = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target: { files } }) {
1334
1346
  console.log(files);
1335
1347
  if (files && files.length > 0) {
@@ -1345,7 +1357,7 @@ const FileInput = React.forwardRef((_a, ref) => {
1345
1357
  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
1358
 
1347
1359
  function withForm(Component) {
1348
- return React.forwardRef((props, ref) => {
1360
+ return react.forwardRef((props, ref) => {
1349
1361
  const _a = props, { name, pattern, validate } = _a, restProps = __rest(_a, ["name", "pattern", "validate"]);
1350
1362
  const { control, formState } = reactHookForm.useFormContext();
1351
1363
  return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: {
@@ -1375,7 +1387,7 @@ const FormInputs = {
1375
1387
  File: withForm(FileInput),
1376
1388
  };
1377
1389
 
1378
- const HintRoot = React.forwardRef(({ children }, ref) => (jsxRuntime.jsx(Block, { className: "relative", ref: ref, children: children })));
1390
+ const HintRoot = react.forwardRef(({ children }, ref) => (jsxRuntime.jsx(Block, { className: "relative", ref: ref, children: children })));
1379
1391
  HintRoot.displayName = 'HintRoot';
1380
1392
  const dotSizeClassNames = {
1381
1393
  small: {
@@ -1417,7 +1429,7 @@ const colorClassNames = {
1417
1429
  pink: 'bg-pink-500 dark:bg-pink-600',
1418
1430
  rose: 'bg-rose-500 dark:bg-rose-600',
1419
1431
  };
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, {
1432
+ 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
1433
  [`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].left}`]: placement === 'top-left',
1422
1434
  [`${dotSizeClassNames[size].top} ${dotSizeClassNames[size].right}`]: placement === 'top-right',
1423
1435
  [`${dotSizeClassNames[size].bottom} ${dotSizeClassNames[size].right}`]: placement === 'bottom-right',
@@ -1435,7 +1447,7 @@ const badgeSizeClassNames = {
1435
1447
  bottom: 'bottom-0 translate-y-1/2',
1436
1448
  left: 'left-2 -translate-x-full',
1437
1449
  };
1438
- const HintBadge = React.forwardRef((_a, ref) => {
1450
+ const HintBadge = react.forwardRef((_a, ref) => {
1439
1451
  var { className, size = 'small', placement = 'top-right' } = _a, props = __rest(_a, ["className", "size", "placement"]);
1440
1452
  return (jsxRuntime.jsx(Badge, Object.assign({ className: cn('absolute px-1', size === 'small' ? 'h-5' : 'h-6', {
1441
1453
  [`${badgeSizeClassNames.top} ${badgeSizeClassNames.left}`]: placement === 'top-left',
@@ -1448,9 +1460,9 @@ HintBadge.displayName = 'HintBadge';
1448
1460
  const Hint = Object.assign(HintRoot, { Dot: HintDot, Badge: HintBadge });
1449
1461
 
1450
1462
  const Pagination = ({ disabled, pageSize = 10, currentPage, totalItems, setCurrentPage, }) => {
1451
- const totalPages = React.useMemo(() => Math.ceil(totalItems / pageSize), [pageSize, totalItems]);
1463
+ const totalPages = react.useMemo(() => Math.ceil(totalItems / pageSize), [pageSize, totalItems]);
1452
1464
  const pagination = usePagination(currentPage + 1, totalPages);
1453
- React.useEffect(() => {
1465
+ react.useEffect(() => {
1454
1466
  setCurrentPage((page) => Math.min(page, Math.max(0, totalPages - 1)));
1455
1467
  }, [setCurrentPage, totalPages]);
1456
1468
  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 +1526,11 @@ function defaultRender(item, field) {
1514
1526
  }
1515
1527
  function DataTable({ className, columns, rows, sorting, pagination, actions = [], isLoading, rowExtraContent, noDataMessage, onRowClick, rowClassName, }) {
1516
1528
  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]);
1529
+ const footerRef = react.useRef(null);
1530
+ const [expandedRows, setExpandedRows] = react.useState({});
1531
+ const allRowsExpanded = react.useMemo(() => rowExtraContent ? rows.every((row) => expandedRows[rowExtraContent.idGetter(row)]) : false, [expandedRows, rowExtraContent, rows]);
1532
+ const _columns = react.useMemo(() => (Array.isArray(columns) ? columns : Object.values(columns)).filter((column) => !column.hide), [columns]);
1533
+ const columnsLength = react.useMemo(() => (rowExtraContent ? 1 : 0) + _columns.length + Math.min(1, actions.length), [_columns.length, actions.length, rowExtraContent]);
1522
1534
  const handleSorting = (field, comparator) => () => {
1523
1535
  if (!sorting)
1524
1536
  return;
@@ -1598,18 +1610,19 @@ const ExpandButton = ({ folded, foldComponent, unfoldComponent, onClick, }) => {
1598
1610
  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
1611
  };
1600
1612
 
1601
- const $Dialog = DialogPrimitive__namespace.Root;
1613
+ const $Dialog = (props) => (jsxRuntime.jsx(DialogPrimitive__namespace.Root, Object.assign({}, props)));
1614
+ $Dialog.displayName = DialogPrimitive__namespace.Root.displayName;
1602
1615
  const DialogTrigger = DialogPrimitive__namespace.Trigger;
1603
1616
  const DialogPortal = DialogPrimitive__namespace.Portal;
1604
1617
  const DialogClose = DialogPrimitive__namespace.Close;
1605
- const DialogOverlay = React.forwardRef((_a, ref) => {
1618
+ const DialogOverlay = react.forwardRef((_a, ref) => {
1606
1619
  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)));
1620
+ 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
1621
  });
1609
1622
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1610
- const DialogContent = React.forwardRef((_a, ref) => {
1623
+ const DialogContent = react.forwardRef((_a, ref) => {
1611
1624
  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" }) })] }))] }));
1625
+ 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
1626
  });
1614
1627
  DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1615
1628
  const DialogHeader = (_a) => {
@@ -1622,14 +1635,14 @@ const DialogFooter = (_a) => {
1622
1635
  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
1636
  };
1624
1637
  DialogFooter.displayName = 'DialogFooter';
1625
- const DialogTitle = React.forwardRef((_a, ref) => {
1638
+ const DialogTitle = react.forwardRef((_a, ref) => {
1626
1639
  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)));
1640
+ return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, Object.assign({ ref: ref, className: cn('text-foreground text-lg font-semibold', className) }, props)));
1628
1641
  });
1629
1642
  DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1630
- const DialogDescription = React.forwardRef((_a, ref) => {
1643
+ const DialogDescription = react.forwardRef((_a, ref) => {
1631
1644
  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)));
1645
+ return (jsxRuntime.jsx(DialogPrimitive__namespace.Description, Object.assign({ ref: ref, className: cn('text-muted-foreground text-sm', className) }, props)));
1633
1646
  });
1634
1647
  DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
1635
1648
  const Dialog = Object.assign($Dialog, {
@@ -1644,79 +1657,19 @@ const Dialog = Object.assign($Dialog, {
1644
1657
  Description: DialogDescription,
1645
1658
  });
1646
1659
 
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;
1660
+ 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
1661
 
1710
- const $Sheet = DialogPrimitive__namespace.Root;
1662
+ const $Sheet = (props) => (jsxRuntime.jsx(DialogPrimitive__namespace.Root, Object.assign({}, props)));
1663
+ $Sheet.displayName = DialogPrimitive__namespace.Root.displayName;
1711
1664
  const SheetTrigger = DialogPrimitive__namespace.Trigger;
1712
1665
  const SheetClose = DialogPrimitive__namespace.Close;
1713
1666
  const SheetPortal = DialogPrimitive__namespace.Portal;
1714
- const SheetOverlay = React__namespace.forwardRef((_a, ref) => {
1667
+ const SheetOverlay = react.forwardRef((_a, ref) => {
1715
1668
  var { className } = _a, props = __rest(_a, ["className"]);
1716
1669
  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
1670
  });
1718
1671
  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', {
1672
+ 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
1673
  variants: {
1721
1674
  side: {
1722
1675
  top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
@@ -1729,9 +1682,9 @@ const sheetVariants = classVarianceAuthority.cva('fixed z-50 gap-4 bg-background
1729
1682
  side: 'right',
1730
1683
  },
1731
1684
  });
1732
- const SheetContent = React__namespace.forwardRef((_a, ref) => {
1685
+ const SheetContent = react.forwardRef((_a, ref) => {
1733
1686
  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" })] })] }))] }));
1687
+ 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
1688
  });
1736
1689
  SheetContent.displayName = DialogPrimitive__namespace.Content.displayName;
1737
1690
  const SheetHeader = (_a) => {
@@ -1744,12 +1697,12 @@ const SheetFooter = (_a) => {
1744
1697
  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
1698
  };
1746
1699
  SheetFooter.displayName = 'SheetFooter';
1747
- const SheetTitle = React__namespace.forwardRef((_a, ref) => {
1700
+ const SheetTitle = react.forwardRef((_a, ref) => {
1748
1701
  var { className } = _a, props = __rest(_a, ["className"]);
1749
1702
  return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, Object.assign({ ref: ref, className: cn('text-foreground text-lg font-semibold', className) }, props)));
1750
1703
  });
1751
1704
  SheetTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1752
- const SheetDescription = React__namespace.forwardRef((_a, ref) => {
1705
+ const SheetDescription = react.forwardRef((_a, ref) => {
1753
1706
  var { className } = _a, props = __rest(_a, ["className"]);
1754
1707
  return (jsxRuntime.jsx(DialogPrimitive__namespace.Description, Object.assign({ ref: ref, className: cn('text-muted-foreground text-sm', className) }, props)));
1755
1708
  });
@@ -1766,6 +1719,67 @@ const Sheet = Object.assign($Sheet, {
1766
1719
  Description: SheetDescription,
1767
1720
  });
1768
1721
 
1722
+ const FormDialog = ({ className, formClassName, open, title, form, children, submitLabel = 'Submit', cancelLabel = 'Cancel', extraAction, as: As = Sheet, onSubmit, onInvalid, onClose, }) => {
1723
+ const id = react.useId();
1724
+ const handleSubmit = (data, event) => __awaiter(void 0, void 0, void 0, function* () {
1725
+ try {
1726
+ yield onSubmit(data, event);
1727
+ }
1728
+ catch (_a) {
1729
+ // do nothering
1730
+ }
1731
+ });
1732
+ 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 })] })] })] }) }));
1733
+ };
1734
+
1735
+ function ListSorter({ className, items, idResolver, renderer, onChange, }) {
1736
+ const adaptedItems = react.useMemo(() => items.map((value, index) => ({ id: idResolver(value, index), value })), [idResolver, items]);
1737
+ const sensors = core.useSensors(core.useSensor(core.PointerSensor), core.useSensor(core.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates }));
1738
+ const onDragEnd = ({ active, over }) => {
1739
+ if (!over || active.id === over.id)
1740
+ return;
1741
+ const sortedItems = structuredClone(adaptedItems);
1742
+ const oldIndex = sortedItems.findIndex((item) => item.id === active.id);
1743
+ const newIndex = sortedItems.findIndex((item) => item.id === over.id);
1744
+ const [removed] = sortedItems.splice(oldIndex, 1);
1745
+ sortedItems.splice(newIndex, 0, removed);
1746
+ for (const [index, { value }] of Object.entries(sortedItems)) {
1747
+ if (typeof value === 'object') {
1748
+ value.rank = +index;
1749
+ }
1750
+ }
1751
+ onChange(sortedItems.map(({ value }) => value));
1752
+ };
1753
+ 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))) }) }) }));
1754
+ }
1755
+ function SortableItem({ item, index, renderer, }) {
1756
+ const { attributes, listeners, setNodeRef, transform, transition } = sortable.useSortable({ id: item.id });
1757
+ const style = { transform: utilities.CSS.Transform.toString(transform), transition };
1758
+ return (jsxRuntime.jsx("div", Object.assign({ ref: setNodeRef, style: style }, attributes, { children: renderer(item.value, index, listeners) })));
1759
+ }
1760
+
1761
+ function ListSorterDialog({ className, open, title, items, idResolver, renderer, cancelLabel, submitLabel, onSubmit, onClose, }) {
1762
+ const [sortedItems, setSortedItems] = react.useState(structuredClone(items));
1763
+ react.useEffect(() => {
1764
+ return () => {
1765
+ setSortedItems(structuredClone(items));
1766
+ };
1767
+ }, [items]);
1768
+ const preFinish = () => onSubmit(sortedItems);
1769
+ 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)] }));
1770
+ 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' })] })] }) }));
1771
+ }
1772
+
1773
+ const PdfViewerDialog = ({ open, title, url, data, onClose }) => {
1774
+ 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%" }))] }) }));
1775
+ };
1776
+
1777
+ const Separator = react.forwardRef((_a, ref) => {
1778
+ var { className, orientation = 'horizontal', decorative = true } = _a, props = __rest(_a, ["className", "orientation", "decorative"]);
1779
+ 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)));
1780
+ });
1781
+ Separator.displayName = SeparatorPrimitive__namespace.Root.displayName;
1782
+
1769
1783
  const Skeleton = (_a) => {
1770
1784
  var { className } = _a, props = __rest(_a, ["className"]);
1771
1785
  return (jsxRuntime.jsx("div", Object.assign({ className: cn('bg-muted animate-pulse rounded-md', className) }, props)));
@@ -1778,39 +1792,40 @@ const SIDEBAR_WIDTH = '16rem';
1778
1792
  const SIDEBAR_WIDTH_MOBILE = '18rem';
1779
1793
  const SIDEBAR_WIDTH_ICON = '3rem';
1780
1794
  const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
1781
- const SidebarContext = React.createContext(null);
1795
+ const SidebarContext = react.createContext(null);
1782
1796
  function useSidebar() {
1783
- const context = React.useContext(SidebarContext);
1797
+ const context = react.useContext(SidebarContext);
1784
1798
  if (!context) {
1785
1799
  throw new Error('useSidebar must be used within a SidebarProvider.');
1786
1800
  }
1787
1801
  return context;
1788
1802
  }
1789
- const SidebarContextProvider = React.forwardRef((_a, ref) => {
1803
+ const SidebarContextProvider = react.forwardRef((_a, ref) => {
1790
1804
  var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
1791
1805
  const isMobile = useIsMobile();
1792
- const [openMobile, setOpenMobile] = React.useState(false);
1793
- const screenRef = React.useRef(document.documentElement);
1806
+ const [openMobile, setOpenMobile] = react.useState(false);
1807
+ const screenRef = react.useRef(document.documentElement);
1794
1808
  // This is the internal state of the sidebar.
1795
1809
  // We use openProp and setOpenProp for control from outside the component.
1796
- const [_open, _setOpen] = React.useState(defaultOpen);
1810
+ const [_open, _setOpen] = react.useState(getValueFromCookie(SIDEBAR_COOKIE_NAME, defaultOpen));
1797
1811
  const open = openProp !== null && openProp !== void 0 ? openProp : _open;
1798
- const setOpen = React.useCallback((value) => {
1812
+ const setOpen = react.useCallback((value) => {
1799
1813
  if (setOpenProp) {
1800
1814
  return setOpenProp === null || setOpenProp === void 0 ? void 0 : setOpenProp(typeof value === 'function' ? value(open) : value);
1801
1815
  }
1802
- _setOpen(value);
1816
+ const newValue = typeof value === 'function' ? value(open) : value;
1817
+ _setOpen(newValue);
1803
1818
  // This sets the cookie to keep the sidebar state.
1804
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
1819
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${newValue}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
1805
1820
  }, [setOpenProp, open]);
1806
1821
  // Helper to toggle the sidebar.
1807
- const toggleSidebar = React.useCallback(() => {
1822
+ const toggleSidebar = react.useCallback(() => {
1808
1823
  return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
1809
1824
  }, [isMobile, setOpen, setOpenMobile]);
1810
1825
  // Add swipe gesture support for opening and closing the sidebar.
1811
1826
  useOnSwipe(screenRef, (direction) => direction === 'right' ? setOpen(true) : direction === 'left' && setOpen(false));
1812
1827
  // Adds a keyboard shortcut to toggle the sidebar.
1813
- React.useEffect(() => {
1828
+ react.useEffect(() => {
1814
1829
  const handleKeyDown = (event) => {
1815
1830
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1816
1831
  event.preventDefault();
@@ -1823,7 +1838,7 @@ const SidebarContextProvider = React.forwardRef((_a, ref) => {
1823
1838
  // We add a state so that we can do data-state="expanded" or "collapsed".
1824
1839
  // This makes it easier to style the sidebar with Tailwind classes.
1825
1840
  const state = open ? 'expanded' : 'collapsed';
1826
- const contextValue = React.useMemo(() => ({
1841
+ const contextValue = react.useMemo(() => ({
1827
1842
  state,
1828
1843
  open,
1829
1844
  setOpen,
@@ -1835,7 +1850,7 @@ const SidebarContextProvider = React.forwardRef((_a, ref) => {
1835
1850
  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
1851
  });
1837
1852
  SidebarContextProvider.displayName = 'SidebarContextProvider';
1838
- const $Sidebar = React.forwardRef((_a, ref) => {
1853
+ const $Sidebar = react.forwardRef((_a, ref) => {
1839
1854
  var { side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children } = _a, props = __rest(_a, ["side", "variant", "collapsible", "className", "children"]);
1840
1855
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
1841
1856
  if (collapsible === 'none') {
@@ -1857,63 +1872,63 @@ const $Sidebar = React.forwardRef((_a, ref) => {
1857
1872
  : '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
1873
  });
1859
1874
  $Sidebar.displayName = 'Sidebar';
1860
- const SidebarTrigger = React.forwardRef((_a, ref) => {
1875
+ const SidebarTrigger = react.forwardRef((_a, ref) => {
1861
1876
  var { className, onClick } = _a, props = __rest(_a, ["className", "onClick"]);
1862
1877
  const { toggleSidebar } = useSidebar();
1863
- 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) => {
1878
+ return (jsxRuntime.jsx(Button, Object.assign({ ref: ref, "data-sidebar": "trigger", variant: "text", suffixIcon: lucideReact.PanelLeft, className: className, onClick: (event) => {
1864
1879
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
1865
1880
  toggleSidebar();
1866
1881
  } }, props)));
1867
1882
  });
1868
1883
  SidebarTrigger.displayName = 'SidebarTrigger';
1869
- const SidebarRail = React.forwardRef((_a, ref) => {
1884
+ const SidebarRail = react.forwardRef((_a, ref) => {
1870
1885
  var { className } = _a, props = __rest(_a, ["className"]);
1871
1886
  const { toggleSidebar } = useSidebar();
1872
1887
  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
1888
  });
1874
1889
  SidebarRail.displayName = 'SidebarRail';
1875
- const SidebarInset = React.forwardRef((_a, ref) => {
1890
+ const SidebarInset = react.forwardRef((_a, ref) => {
1876
1891
  var { className } = _a, props = __rest(_a, ["className"]);
1877
1892
  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
1893
  });
1879
1894
  SidebarInset.displayName = 'SidebarInset';
1880
- const SidebarInput = React.forwardRef((_a, ref) => {
1895
+ const SidebarInput = react.forwardRef((_a, ref) => {
1881
1896
  var { className } = _a, props = __rest(_a, ["className"]);
1882
1897
  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
1898
  });
1884
1899
  SidebarInput.displayName = 'SidebarInput';
1885
- const SidebarHeader = React.forwardRef((_a, ref) => {
1900
+ const SidebarHeader = react.forwardRef((_a, ref) => {
1886
1901
  var { className } = _a, props = __rest(_a, ["className"]);
1887
1902
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "header", className: cn('flex flex-col gap-2 p-2', className) }, props)));
1888
1903
  });
1889
1904
  SidebarHeader.displayName = 'SidebarHeader';
1890
- const SidebarFooter = React.forwardRef((_a, ref) => {
1905
+ const SidebarFooter = react.forwardRef((_a, ref) => {
1891
1906
  var { className } = _a, props = __rest(_a, ["className"]);
1892
1907
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "footer", className: cn('flex flex-col gap-2 p-2', className) }, props)));
1893
1908
  });
1894
1909
  SidebarFooter.displayName = 'SidebarFooter';
1895
- const SidebarSeparator = React.forwardRef((_a, ref) => {
1910
+ const SidebarSeparator = react.forwardRef((_a, ref) => {
1896
1911
  var { className } = _a, props = __rest(_a, ["className"]);
1897
1912
  return (jsxRuntime.jsx(Separator, Object.assign({ ref: ref, "data-sidebar": "separator", className: cn('bg-sidebar-border mx-2 w-auto', className) }, props)));
1898
1913
  });
1899
1914
  SidebarSeparator.displayName = 'SidebarSeparator';
1900
- const SidebarContent = React.forwardRef((_a, ref) => {
1915
+ const SidebarContent = react.forwardRef((_a, ref) => {
1901
1916
  var { className } = _a, props = __rest(_a, ["className"]);
1902
1917
  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
1918
  });
1904
1919
  SidebarContent.displayName = 'SidebarContent';
1905
- const SidebarGroup = React.forwardRef((_a, ref) => {
1920
+ const SidebarGroup = react.forwardRef((_a, ref) => {
1906
1921
  var { className } = _a, props = __rest(_a, ["className"]);
1907
1922
  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
1923
  });
1909
1924
  SidebarGroup.displayName = 'SidebarGroup';
1910
- const SidebarGroupLabel = React.forwardRef((_a, ref) => {
1925
+ const SidebarGroupLabel = react.forwardRef((_a, ref) => {
1911
1926
  var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
1912
1927
  const Comp = asChild ? reactSlot.Slot : 'div';
1913
1928
  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
1929
  });
1915
1930
  SidebarGroupLabel.displayName = 'SidebarGroupLabel';
1916
- const SidebarGroupAction = React.forwardRef((_a, ref) => {
1931
+ const SidebarGroupAction = react.forwardRef((_a, ref) => {
1917
1932
  var { className, asChild = false } = _a, props = __rest(_a, ["className", "asChild"]);
1918
1933
  const Comp = asChild ? reactSlot.Slot : 'button';
1919
1934
  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 +1936,17 @@ const SidebarGroupAction = React.forwardRef((_a, ref) => {
1921
1936
  'after:absolute after:-inset-2 after:md:hidden', 'group-data-[collapsible=icon]:hidden', className) }, props)));
1922
1937
  });
1923
1938
  SidebarGroupAction.displayName = 'SidebarGroupAction';
1924
- const SidebarGroupContent = React.forwardRef((_a, ref) => {
1939
+ const SidebarGroupContent = react.forwardRef((_a, ref) => {
1925
1940
  var { className } = _a, props = __rest(_a, ["className"]);
1926
1941
  return (jsxRuntime.jsx("div", Object.assign({ ref: ref, "data-sidebar": "group-content", className: cn('w-full text-sm', className) }, props)));
1927
1942
  });
1928
1943
  SidebarGroupContent.displayName = 'SidebarGroupContent';
1929
- const SidebarMenu = React.forwardRef((_a, ref) => {
1944
+ const SidebarMenu = react.forwardRef((_a, ref) => {
1930
1945
  var { className } = _a, props = __rest(_a, ["className"]);
1931
1946
  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
1947
  });
1933
1948
  SidebarMenu.displayName = 'SidebarMenu';
1934
- const SidebarMenuItem = React.forwardRef((_a, ref) => {
1949
+ const SidebarMenuItem = react.forwardRef((_a, ref) => {
1935
1950
  var { className } = _a, props = __rest(_a, ["className"]);
1936
1951
  return (jsxRuntime.jsx("li", Object.assign({ ref: ref, "data-sidebar": "menu-item", className: cn('group/menu-item relative', className) }, props)));
1937
1952
  });
@@ -1953,7 +1968,7 @@ const sidebarMenuButtonVariants = classVarianceAuthority.cva('peer/menu-button f
1953
1968
  size: 'default',
1954
1969
  },
1955
1970
  });
1956
- const SidebarMenuButton = React.forwardRef((_a, ref) => {
1971
+ const SidebarMenuButton = react.forwardRef((_a, ref) => {
1957
1972
  var { asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className } = _a, props = __rest(_a, ["asChild", "isActive", "variant", "size", "tooltip", "className"]);
1958
1973
  const Comp = asChild ? reactSlot.Slot : 'button';
1959
1974
  const { isMobile, state } = useSidebar();
@@ -1969,7 +1984,7 @@ const SidebarMenuButton = React.forwardRef((_a, ref) => {
1969
1984
  return (jsxRuntime.jsx(Tooltip, Object.assign({ asChild: true, placement: "right" }, tooltip, { children: button })));
1970
1985
  });
1971
1986
  SidebarMenuButton.displayName = 'SidebarMenuButton';
1972
- const SidebarMenuAction = React.forwardRef((_a, ref) => {
1987
+ const SidebarMenuAction = react.forwardRef((_a, ref) => {
1973
1988
  var { className, asChild = false, showOnHover = false } = _a, props = __rest(_a, ["className", "asChild", "showOnHover"]);
1974
1989
  const Comp = asChild ? reactSlot.Slot : 'button';
1975
1990
  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 +1993,15 @@ const SidebarMenuAction = React.forwardRef((_a, ref) => {
1978
1993
  '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
1994
  });
1980
1995
  SidebarMenuAction.displayName = 'SidebarMenuAction';
1981
- const SidebarMenuBadge = React.forwardRef((_a, ref) => {
1996
+ const SidebarMenuBadge = react.forwardRef((_a, ref) => {
1982
1997
  var { className } = _a, props = __rest(_a, ["className"]);
1983
1998
  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
1999
  });
1985
2000
  SidebarMenuBadge.displayName = 'SidebarMenuBadge';
1986
- const SidebarMenuSkeleton = React.forwardRef((_a, ref) => {
2001
+ const SidebarMenuSkeleton = react.forwardRef((_a, ref) => {
1987
2002
  var { className, showIcon = false } = _a, props = __rest(_a, ["className", "showIcon"]);
1988
2003
  // Random width between 50 to 90%.
1989
- const width = React.useMemo(() => {
2004
+ const width = react.useMemo(() => {
1990
2005
  return `${Math.floor(Math.random() * 40) + 50}%`;
1991
2006
  }, []);
1992
2007
  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 +2009,17 @@ const SidebarMenuSkeleton = React.forwardRef((_a, ref) => {
1994
2009
  } })] })));
1995
2010
  });
1996
2011
  SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';
1997
- const SidebarMenuSub = React.forwardRef((_a, ref) => {
2012
+ const SidebarMenuSub = react.forwardRef((_a, ref) => {
1998
2013
  var { className } = _a, props = __rest(_a, ["className"]);
1999
2014
  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
2015
  });
2001
2016
  SidebarMenuSub.displayName = 'SidebarMenuSub';
2002
- const SidebarMenuSubItem = React.forwardRef((_a, ref) => {
2017
+ const SidebarMenuSubItem = react.forwardRef((_a, ref) => {
2003
2018
  var props = __rest(_a, []);
2004
2019
  return (jsxRuntime.jsx("li", Object.assign({ ref: ref }, props)));
2005
2020
  });
2006
2021
  SidebarMenuSubItem.displayName = 'SidebarMenuSubItem';
2007
- const SidebarMenuSubButton = React.forwardRef((_a, ref) => {
2022
+ const SidebarMenuSubButton = react.forwardRef((_a, ref) => {
2008
2023
  var { asChild = false, size = 'md', isActive, className } = _a, props = __rest(_a, ["asChild", "size", "isActive", "className"]);
2009
2024
  const Comp = asChild ? reactSlot.Slot : 'a';
2010
2025
  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)));
@@ -2034,7 +2049,7 @@ const Sidebar = Object.assign($Sidebar, {
2034
2049
  Trigger: SidebarTrigger,
2035
2050
  });
2036
2051
 
2037
- const Navbar = ({ className, leftSlot, rightSlot }) => (jsxRuntime.jsx(Block, { className: cn('border-b p-3 dark:border-slate-700', className), fullWidth: true, children: jsxRuntime.jsxs(Flex, { align: "center", justify: "between", children: [jsxRuntime.jsxs(Flex, { align: "center", children: [jsxRuntime.jsx(Sidebar.Trigger, {}), leftSlot] }), rightSlot] }) }));
2052
+ const Navbar = ({ className, sidebarTriggerClassName, leftSlot, rightSlot, }) => (jsxRuntime.jsx(Block, { className: cn('border-b p-3 dark:border-slate-700', className), fullWidth: true, children: jsxRuntime.jsxs(Flex, { align: "center", justify: "between", children: [jsxRuntime.jsxs(Flex, { align: "center", children: [jsxRuntime.jsx(Sidebar.Trigger, { className: sidebarTriggerClassName }), leftSlot] }), rightSlot] }) }));
2038
2053
 
2039
2054
  const Layout = (_a) => {
2040
2055
  var { children, className } = _a, _b = _a.sidebarProps, { basePath, smallLogo, fullLogo, items } = _b, sidebarProps = __rest(_b, ["basePath", "smallLogo", "fullLogo", "items"]), { navbarProps } = _a;
@@ -2043,7 +2058,7 @@ const Layout = (_a) => {
2043
2058
  const RenderSideBarItem = ({ basePath = '/', pathname, title, Icon, items, }) => {
2044
2059
  const location = reactRouterDom.useLocation();
2045
2060
  const { open } = useSidebar();
2046
- const currentPath = React.useMemo(() => location.pathname.replace(basePath, '').replace(/^\/*/, ''), [basePath, location.pathname]);
2061
+ const currentPath = react.useMemo(() => location.pathname.replace(basePath, '').replace(/^\/*/, ''), [basePath, location.pathname]);
2047
2062
  return (jsxRuntime.jsxs(Sidebar.MenuItem, { children: [jsxRuntime.jsx(Sidebar.MenuButton, { asChild: true, tooltip: title, isActive: isLinkStartsWithPathname(currentPath, pathname) &&
2048
2063
  (!items ||
2049
2064
  (!open &&
@@ -2055,7 +2070,7 @@ function isLinkStartsWithPathname(link, pathname) {
2055
2070
 
2056
2071
  const $Popover = PopoverPrimitive__namespace.Root;
2057
2072
  const PopoverTrigger = PopoverPrimitive__namespace.Trigger;
2058
- const PopoverContent = React.forwardRef((_a, ref) => {
2073
+ const PopoverContent = react.forwardRef((_a, ref) => {
2059
2074
  var { className, align = 'center', sideOffset = 4, container } = _a, props = __rest(_a, ["className", "align", "sideOffset", "container"]);
2060
2075
  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
2076
  });
@@ -2065,23 +2080,23 @@ const Popover = Object.assign($Popover, {
2065
2080
  Content: PopoverContent,
2066
2081
  });
2067
2082
 
2068
- const Switch = React.forwardRef((_a, ref) => {
2083
+ const Switch = react.forwardRef((_a, ref) => {
2069
2084
  var { className } = _a, _b = _a.thumbProps, _c = _b === void 0 ? {} : _b, { className: thumbClassName } = _c, thumbProps = __rest(_c, ["className"]), props = __rest(_a, ["className", "thumbProps"]);
2070
2085
  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
2086
  });
2072
2087
  Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
2073
2088
 
2074
- const $Tabs = React.forwardRef((_a, ref) => {
2089
+ const $Tabs = react.forwardRef((_a, ref) => {
2075
2090
  var { className } = _a, props = __rest(_a, ["className"]);
2076
2091
  return (jsxRuntime.jsx(TabsPrimitive__namespace.Root, Object.assign({ ref: ref, className: cn('flex flex-col gap-2', className) }, props)));
2077
2092
  });
2078
2093
  $Tabs.displayName = TabsPrimitive__namespace.Root.displayName;
2079
- const TabsList = React.forwardRef((_a, ref) => {
2094
+ const TabsList = react.forwardRef((_a, ref) => {
2080
2095
  var { className } = _a, props = __rest(_a, ["className"]);
2081
2096
  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
2097
  });
2083
2098
  TabsList.displayName = TabsPrimitive__namespace.List.displayName;
2084
- const TabsTrigger = React.forwardRef((_a, ref) => {
2099
+ const TabsTrigger = react.forwardRef((_a, ref) => {
2085
2100
  var { className } = _a, props = __rest(_a, ["className"]);
2086
2101
  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
2102
  });
@@ -2093,53 +2108,55 @@ const Tabs = Object.assign($Tabs, {
2093
2108
  Content: TabsContent,
2094
2109
  });
2095
2110
 
2096
- const LayoutContext = React.createContext(undefined);
2111
+ const LayoutContext = react.createContext(undefined);
2112
+ const THEME_MEDIA_QUERY = '(prefers-color-scheme: dark)';
2113
+ const THEME_COOKIE_NAME = 'theme:state';
2114
+ const THEME_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
2097
2115
  const LayoutContextProvider = ({ children }) => {
2098
- const [theme, setTheme] = React.useState(getValueFromLocalStorage(THEME_KEY, 'light'));
2099
- React.useEffect(() => {
2100
- if (theme) {
2101
- if (theme === 'dark') {
2102
- document.documentElement.classList.add('dark');
2103
- }
2104
- else {
2105
- document.documentElement.classList.remove('dark');
2106
- }
2116
+ const [theme, _setTheme] = react.useState(getValueFromCookie(THEME_COOKIE_NAME, 'system'));
2117
+ const [resolvedTheme, setResolvedTheme] = react.useState(() => theme === 'system' ? getSystemTheme() : theme);
2118
+ react.useEffect(() => {
2119
+ if (resolvedTheme === 'dark') {
2120
+ document.documentElement.classList.add('dark');
2121
+ }
2122
+ else {
2123
+ document.documentElement.classList.remove('dark');
2124
+ }
2125
+ }, [resolvedTheme]);
2126
+ react.useEffect(() => {
2127
+ if (theme !== 'system') {
2128
+ setResolvedTheme(theme);
2129
+ return;
2107
2130
  }
2131
+ setResolvedTheme(getSystemTheme());
2132
+ const handleMediaQuery = (e) => setResolvedTheme(getSystemTheme(e));
2133
+ const mediaQuery = window.matchMedia(THEME_MEDIA_QUERY);
2134
+ mediaQuery.addEventListener('change', handleMediaQuery);
2135
+ return () => mediaQuery.removeEventListener('change', handleMediaQuery);
2108
2136
  }, [theme]);
2109
- const toggleTheme = () => {
2110
- setTheme((theme) => {
2111
- const newValue = theme === 'dark' ? 'light' : 'dark';
2112
- window.localStorage.setItem(THEME_KEY, newValue);
2113
- return newValue;
2114
- });
2137
+ const setTheme = (theme) => {
2138
+ _setTheme(theme);
2139
+ // This sets the cookie to keep the theme state.
2140
+ document.cookie = `${THEME_COOKIE_NAME}=${theme}; path=/; max-age=${THEME_COOKIE_MAX_AGE}`;
2115
2141
  };
2116
- return jsxRuntime.jsx(LayoutContext.Provider, { value: { theme, toggleTheme }, children: children });
2142
+ return (jsxRuntime.jsx(LayoutContext.Provider, { value: { theme, resolvedTheme, setTheme }, children: children }));
2117
2143
  };
2118
2144
  function useLayoutContext() {
2119
- const context = React.useContext(LayoutContext);
2145
+ const context = react.useContext(LayoutContext);
2120
2146
  if (!context) {
2121
2147
  throw new Error('Please use LayoutContextProvider!');
2122
2148
  }
2123
2149
  return context;
2124
2150
  }
2125
- const THEME_KEY = 'tw-react-components__theme';
2126
- function getValueFromLocalStorage(key, _default) {
2127
- var _a;
2128
- const transformers = {
2129
- string: String,
2130
- boolean: (value) => value === 'true',
2131
- };
2132
- return typeof window !== 'undefined'
2133
- ? transformers[typeof _default]((_a = window.localStorage.getItem(key)) !== null && _a !== void 0 ? _a : _default)
2134
- : _default;
2151
+ function getSystemTheme(e) {
2152
+ if (!e)
2153
+ e = window.matchMedia(THEME_MEDIA_QUERY);
2154
+ return e.matches ? 'dark' : 'light';
2135
2155
  }
2136
2156
 
2137
- const ThemeSwitcher = ({ className }) => {
2138
- const { theme, toggleTheme } = useLayoutContext();
2139
- const darkMode = theme === 'dark';
2140
- return (jsxRuntime.jsx(Switch, { className: className, checked: darkMode, onCheckedChange: toggleTheme, thumbProps: {
2141
- children: darkMode ? (jsxRuntime.jsx(lucideReact.MoonIcon, { className: "h-6 w-6 rounded-full bg-slate-900 p-1 text-white" })) : (jsxRuntime.jsx(lucideReact.SunIcon, { className: "h-6 w-6 rounded-full bg-white p-1 text-black" })),
2142
- } }));
2157
+ const ThemeSelector = ({ className }) => {
2158
+ const { resolvedTheme, setTheme } = useLayoutContext();
2159
+ return (jsxRuntime.jsxs(DropdownMenu, { children: [jsxRuntime.jsx(DropdownMenu.Trigger, { asChild: true, children: jsxRuntime.jsx(Button, { prefixIcon: resolvedTheme === 'dark' ? lucideReact.MoonIcon : lucideReact.SunIcon, className: className, variant: "text" }) }), jsxRuntime.jsxs(DropdownMenu.Content, { children: [jsxRuntime.jsxs(DropdownMenu.Item, { onClick: () => setTheme('light'), children: [jsxRuntime.jsx(DropdownMenu.Icon, { icon: lucideReact.SunIcon }), "Light"] }), jsxRuntime.jsxs(DropdownMenu.Item, { onClick: () => setTheme('dark'), children: [jsxRuntime.jsx(DropdownMenu.Icon, { icon: lucideReact.MoonIcon }), "Dark"] }), jsxRuntime.jsxs(DropdownMenu.Item, { onClick: () => setTheme('system'), children: [jsxRuntime.jsx(DropdownMenu.Icon, { icon: lucideReact.MonitorIcon }), "System"] })] })] }));
2143
2160
  };
2144
2161
 
2145
2162
  exports.Badge = Badge;
@@ -2174,6 +2191,12 @@ exports.Pagination = Pagination;
2174
2191
  exports.PasswordInput = PasswordInput;
2175
2192
  exports.PdfViewerDialog = PdfViewerDialog;
2176
2193
  exports.Popover = Popover;
2194
+ exports.SIDEBAR_COOKIE_MAX_AGE = SIDEBAR_COOKIE_MAX_AGE;
2195
+ exports.SIDEBAR_COOKIE_NAME = SIDEBAR_COOKIE_NAME;
2196
+ exports.SIDEBAR_KEYBOARD_SHORTCUT = SIDEBAR_KEYBOARD_SHORTCUT;
2197
+ exports.SIDEBAR_WIDTH = SIDEBAR_WIDTH;
2198
+ exports.SIDEBAR_WIDTH_ICON = SIDEBAR_WIDTH_ICON;
2199
+ exports.SIDEBAR_WIDTH_MOBILE = SIDEBAR_WIDTH_MOBILE;
2177
2200
  exports.SelectInput = SelectInput;
2178
2201
  exports.Separator = Separator;
2179
2202
  exports.Sheet = Sheet;
@@ -2183,17 +2206,20 @@ exports.SidebarContextProvider = SidebarContextProvider;
2183
2206
  exports.Skeleton = Skeleton;
2184
2207
  exports.Spinner = Spinner;
2185
2208
  exports.Switch = Switch;
2186
- exports.THEME_KEY = THEME_KEY;
2209
+ exports.THEME_COOKIE_MAX_AGE = THEME_COOKIE_MAX_AGE;
2210
+ exports.THEME_COOKIE_NAME = THEME_COOKIE_NAME;
2211
+ exports.THEME_MEDIA_QUERY = THEME_MEDIA_QUERY;
2187
2212
  exports.Table = Table;
2188
2213
  exports.Tabs = Tabs;
2189
2214
  exports.TextInput = TextInput;
2190
2215
  exports.TextareaInput = TextareaInput;
2191
- exports.ThemeSwitcher = ThemeSwitcher;
2216
+ exports.ThemeSelector = ThemeSelector;
2192
2217
  exports.Tooltip = Tooltip;
2193
2218
  exports.cn = cn;
2194
2219
  exports.compareDates = compareDates;
2195
2220
  exports.generalComparator = generalComparator;
2196
2221
  exports.getDisplayDate = getDisplayDate;
2222
+ exports.getValueFromCookie = getValueFromCookie;
2197
2223
  exports.isEmpty = isEmpty;
2198
2224
  exports.mergeRefs = mergeRefs;
2199
2225
  exports.resolveTargetObject = resolveTargetObject;