@herca/r-kit 0.0.49 → 0.0.51

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.
@@ -523,8 +523,9 @@ type UseCalendarHelpersParams = {
523
523
  };
524
524
  disabledDates: Date[];
525
525
  dayConfigs: CalendarDayConfig[];
526
+ disabled?: (date: Date) => boolean;
526
527
  };
527
- declare const createCalendarHelpers: ({ mode, value, rangeValue, disabledDates, dayConfigs, }: UseCalendarHelpersParams) => {
528
+ declare const createCalendarHelpers: ({ mode, value, rangeValue, disabledDates, dayConfigs, disabled, }: UseCalendarHelpersParams) => {
528
529
  isDateDisabled: (day: CalendarDay) => boolean;
529
530
  getDayConfig: (day: CalendarDay) => CalendarDayConfig | undefined;
530
531
  isDateSelected: (day: CalendarDay) => boolean;
@@ -602,6 +603,8 @@ interface CalendarProps {
602
603
  onMonthChange?: (month: number) => void;
603
604
  onYearChange?: (year: number) => void;
604
605
  useLimitEvent?: boolean;
606
+ disabled?: (date: Date) => boolean;
607
+ disabledDateClassName?: string;
605
608
  }
606
609
  type CalendarState = {
607
610
  currentMonth: number;
@@ -629,6 +632,7 @@ interface CalendarGridProps {
629
632
  backdropOnClick?: (day?: CalendarDay) => void;
630
633
  onEventClick?: (event?: CalendarEvent) => void;
631
634
  useLimitEvent?: boolean;
635
+ disabledDateClassName?: string;
632
636
  }
633
637
  interface CalendarDayItemProps {
634
638
  day: CalendarDay;
@@ -640,6 +644,7 @@ interface CalendarDayItemProps {
640
644
  variant?: CalendarProps['variant'];
641
645
  events?: CalendarEvent[];
642
646
  backdropOnClick?: (day?: CalendarDay) => void;
647
+ disabledDateClassName?: string;
643
648
  }
644
649
  interface CalendarEvent {
645
650
  title: string;
@@ -668,7 +673,7 @@ declare const ItemDropdown: ({ active, value, onClick, }: {
668
673
  onClick: () => void;
669
674
  }) => react_jsx_runtime.JSX.Element;
670
675
 
671
- declare const Calendar: ({ showNavigator, showHeader, value, onChange, disabledDates, dayConfigs, defaultMonth, defaultYear, styleConfig, wrapperClassname, weekWrapperClassname, dayWrapperClassname, daysOfWeek, months, showNextNavigator, showPrevNavigator, mode, rangeValue, size, variant, events, showCalendarTooltip, type, onTypeChange, onEventClick, backdropOnClick, onMonthChange, onYearChange, showDefaultController, useLimitEvent, }: CalendarProps) => react_jsx_runtime.JSX.Element;
676
+ declare const Calendar: ({ showNavigator, showHeader, value, onChange, disabledDates, dayConfigs, defaultMonth, defaultYear, styleConfig, wrapperClassname, weekWrapperClassname, dayWrapperClassname, daysOfWeek, months, showNextNavigator, showPrevNavigator, mode, rangeValue, size, variant, events, showCalendarTooltip, type, onTypeChange, onEventClick, backdropOnClick, onMonthChange, onYearChange, showDefaultController, useLimitEvent, disabled, disabledDateClassName, }: CalendarProps) => react_jsx_runtime.JSX.Element;
672
677
 
673
678
  declare const getCalendarDays: ({ currentYear, currentMonth, }: GetCalendarDaysProps) => {
674
679
  date: number;
@@ -727,6 +732,9 @@ interface DatePickerProps {
727
732
  trigger?: ReactNode;
728
733
  onOpenChange?: (open: boolean) => void;
729
734
  open?: boolean;
735
+ minDate?: Date;
736
+ maxDate?: Date;
737
+ disabledDateClassName?: string;
730
738
  calendarProps?: CalendarOverrideProps;
731
739
  startDateCalendarProps?: CalendarRangeOverrideProps;
732
740
  endDateCalendarProps?: CalendarRangeOverrideProps;
@@ -738,7 +746,7 @@ interface DatePickerProps {
738
746
  }
739
747
  type DateFormat = 'DD-MM-YYYY' | 'DD/MM/YYYY' | 'DD MMM YYYY' | 'DD MMMM YYYY' | 'YYYY-MM-DD' | 'MM/DD/YYYY' | 'DD-MM-YYYY HH:mm:ss' | 'DD/MM/YYYY HH:mm:ss' | 'DD MMM YYYY HH:mm:ss' | 'DD MMMM YYYY HH:mm:ss' | 'YYYY-MM-DD HH:mm:ss' | 'MM/DD/YYYY HH:mm:ss' | 'DD MMMM YYYY - HH:mm:ss' | 'DD MMM YYYY - HH:mm:ss';
740
748
 
741
- declare const DatePicker: ({ format, mode, value: controlledValue, rangeValue: controlledRangeValue, onChange: controlledOnChange, onRangeChange: controlledOnRangeChange, trigger, open, onOpenChange, calendarProps, endDateCalendarProps, startDateCalendarProps, wrapperClassName, size, showController, align, containerClassName, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
749
+ declare const DatePicker: ({ format, mode, value: controlledValue, rangeValue: controlledRangeValue, onChange: controlledOnChange, onRangeChange: controlledOnRangeChange, trigger, open, onOpenChange, minDate, maxDate, disabledDateClassName, calendarProps, endDateCalendarProps, startDateCalendarProps, wrapperClassName, size, showController, align, containerClassName, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
742
750
 
743
751
  declare const monthsShort: string[];
744
752
  declare const monthsFull: string[];
@@ -992,6 +1000,10 @@ interface TextEditorProps {
992
1000
  indent?: boolean;
993
1001
  advance?: boolean;
994
1002
  };
1003
+ onDownload?: (data: {
1004
+ src?: string;
1005
+ name?: string;
1006
+ }) => void;
995
1007
  }
996
1008
  interface ToolbarButtonProps {
997
1009
  icon?: IconNameProps;
@@ -1052,6 +1064,6 @@ interface AttachmentField {
1052
1064
  };
1053
1065
  }
1054
1066
 
1055
- declare function TextEditor({ ui, field, toolbar, editor: editorProps, }: TextEditorProps): react_jsx_runtime.JSX.Element | null;
1067
+ declare function TextEditor({ ui, field, toolbar, editor: editorProps, onDownload, }: TextEditorProps): react_jsx_runtime.JSX.Element | null;
1056
1068
 
1057
1069
  export { type AttachmentField, BaseCheckbox, type BaseOption, BaseSwitch, ButtonDropdown, type ButtonDropdownProps, ButtonGroup, ButtonGroupItem, type ButtonGroupProps, type ButtonIconProps, ButtonNavigator, Calendar, type CalendarBaseProps, type CalendarDay, type CalendarDayConfig, type CalendarDayItemProps, type CalendarEvent, type CalendarGridProps, type CalendarOverrideProps, type CalendarProps, type CalendarRangeOverrideProps, type CalendarState, type CalendarStyleConfig, type CalendarTypes, Checkbox, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicatorVariants, type CheckboxProps, CheckboxVariants, Chip, type ChipArrayProps, ChipContext, type ChipContextValue, ChipGroup, type ChipOptionProps, type ChipProps, type ChipSelectedProps, type ChipValue, type ChipVariants, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColorPickerButtonProps, type ColorType$1 as ColorType, type ColorVariantType, Counter, type CounterControllerProps, type CounterProps, type DateFormat, DatePicker, type DatePickerMode, type DatePickerProps, type DateRange, type DateRangeProps, type DotConfig, Dropdown, DropdownContent, DropdownItem, type DropdownState, DropdownTrigger, type FileItem, FormDescription, type FormDescriptionProps, FormErrorMessage, type FormErrorMessageProps, FormErrorMessages, type FormErrorMessagesProps, FormField, type FormFieldProps, FormHint, type FormHintProps, FormLabel, type FormLabelProps, type FormSizeType, type GetCalendarDaysProps, type HeadingLevel, type IconType, type ImageForm, Input, InputFile, type InputFileProps, type InputFileRef, InputOTP, type InputOTPProps, type InputProps, type InputVariantProps, ItemDropdown, type ListItemType, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalPreviewAttachment, ModalTitle, type PlayerProps, PreviewItem, type PreviewItemProps, Select, type SelectOption, type SelectProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarContext, type SidebarContextProps, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuGroup, SidebarMenuItem, SidebarProvider, SidebarTrigger, type SizeType$1 as SizeType, Switch, SwitchThumbVariants, SwitchVariants, Table, type TableAction, TableBody, type TableBodyProps, TableCell, TableCellHead, type TableCellHeadProps, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TablePagination, type TablePaginationProps, type TableRootProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextAlignValue, TextEditor, type TextEditorProps, Textarea, type TextareaProps, ToastProvider, type ToolbarButtonProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UploadConfig, type UploadStatus, type UploadedFile, chipVariants, formatDateLocal, formatDateToString, generatePages, getCalendarDays, getFormatConfig, getWeekEventSegments, handleDecrement, handleIncrement, handleInputChange, handleKeyDown, inputVariants, isSameDate, isToday, monthsFull, monthsShort, normalize, parseLocalDate, parseMonthName, toDateOnly, useCopy, useIsMobile, useSidebar, useToast };
package/dist/clients.d.ts CHANGED
@@ -523,8 +523,9 @@ type UseCalendarHelpersParams = {
523
523
  };
524
524
  disabledDates: Date[];
525
525
  dayConfigs: CalendarDayConfig[];
526
+ disabled?: (date: Date) => boolean;
526
527
  };
527
- declare const createCalendarHelpers: ({ mode, value, rangeValue, disabledDates, dayConfigs, }: UseCalendarHelpersParams) => {
528
+ declare const createCalendarHelpers: ({ mode, value, rangeValue, disabledDates, dayConfigs, disabled, }: UseCalendarHelpersParams) => {
528
529
  isDateDisabled: (day: CalendarDay) => boolean;
529
530
  getDayConfig: (day: CalendarDay) => CalendarDayConfig | undefined;
530
531
  isDateSelected: (day: CalendarDay) => boolean;
@@ -602,6 +603,8 @@ interface CalendarProps {
602
603
  onMonthChange?: (month: number) => void;
603
604
  onYearChange?: (year: number) => void;
604
605
  useLimitEvent?: boolean;
606
+ disabled?: (date: Date) => boolean;
607
+ disabledDateClassName?: string;
605
608
  }
606
609
  type CalendarState = {
607
610
  currentMonth: number;
@@ -629,6 +632,7 @@ interface CalendarGridProps {
629
632
  backdropOnClick?: (day?: CalendarDay) => void;
630
633
  onEventClick?: (event?: CalendarEvent) => void;
631
634
  useLimitEvent?: boolean;
635
+ disabledDateClassName?: string;
632
636
  }
633
637
  interface CalendarDayItemProps {
634
638
  day: CalendarDay;
@@ -640,6 +644,7 @@ interface CalendarDayItemProps {
640
644
  variant?: CalendarProps['variant'];
641
645
  events?: CalendarEvent[];
642
646
  backdropOnClick?: (day?: CalendarDay) => void;
647
+ disabledDateClassName?: string;
643
648
  }
644
649
  interface CalendarEvent {
645
650
  title: string;
@@ -668,7 +673,7 @@ declare const ItemDropdown: ({ active, value, onClick, }: {
668
673
  onClick: () => void;
669
674
  }) => react_jsx_runtime.JSX.Element;
670
675
 
671
- declare const Calendar: ({ showNavigator, showHeader, value, onChange, disabledDates, dayConfigs, defaultMonth, defaultYear, styleConfig, wrapperClassname, weekWrapperClassname, dayWrapperClassname, daysOfWeek, months, showNextNavigator, showPrevNavigator, mode, rangeValue, size, variant, events, showCalendarTooltip, type, onTypeChange, onEventClick, backdropOnClick, onMonthChange, onYearChange, showDefaultController, useLimitEvent, }: CalendarProps) => react_jsx_runtime.JSX.Element;
676
+ declare const Calendar: ({ showNavigator, showHeader, value, onChange, disabledDates, dayConfigs, defaultMonth, defaultYear, styleConfig, wrapperClassname, weekWrapperClassname, dayWrapperClassname, daysOfWeek, months, showNextNavigator, showPrevNavigator, mode, rangeValue, size, variant, events, showCalendarTooltip, type, onTypeChange, onEventClick, backdropOnClick, onMonthChange, onYearChange, showDefaultController, useLimitEvent, disabled, disabledDateClassName, }: CalendarProps) => react_jsx_runtime.JSX.Element;
672
677
 
673
678
  declare const getCalendarDays: ({ currentYear, currentMonth, }: GetCalendarDaysProps) => {
674
679
  date: number;
@@ -727,6 +732,9 @@ interface DatePickerProps {
727
732
  trigger?: ReactNode;
728
733
  onOpenChange?: (open: boolean) => void;
729
734
  open?: boolean;
735
+ minDate?: Date;
736
+ maxDate?: Date;
737
+ disabledDateClassName?: string;
730
738
  calendarProps?: CalendarOverrideProps;
731
739
  startDateCalendarProps?: CalendarRangeOverrideProps;
732
740
  endDateCalendarProps?: CalendarRangeOverrideProps;
@@ -738,7 +746,7 @@ interface DatePickerProps {
738
746
  }
739
747
  type DateFormat = 'DD-MM-YYYY' | 'DD/MM/YYYY' | 'DD MMM YYYY' | 'DD MMMM YYYY' | 'YYYY-MM-DD' | 'MM/DD/YYYY' | 'DD-MM-YYYY HH:mm:ss' | 'DD/MM/YYYY HH:mm:ss' | 'DD MMM YYYY HH:mm:ss' | 'DD MMMM YYYY HH:mm:ss' | 'YYYY-MM-DD HH:mm:ss' | 'MM/DD/YYYY HH:mm:ss' | 'DD MMMM YYYY - HH:mm:ss' | 'DD MMM YYYY - HH:mm:ss';
740
748
 
741
- declare const DatePicker: ({ format, mode, value: controlledValue, rangeValue: controlledRangeValue, onChange: controlledOnChange, onRangeChange: controlledOnRangeChange, trigger, open, onOpenChange, calendarProps, endDateCalendarProps, startDateCalendarProps, wrapperClassName, size, showController, align, containerClassName, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
749
+ declare const DatePicker: ({ format, mode, value: controlledValue, rangeValue: controlledRangeValue, onChange: controlledOnChange, onRangeChange: controlledOnRangeChange, trigger, open, onOpenChange, minDate, maxDate, disabledDateClassName, calendarProps, endDateCalendarProps, startDateCalendarProps, wrapperClassName, size, showController, align, containerClassName, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
742
750
 
743
751
  declare const monthsShort: string[];
744
752
  declare const monthsFull: string[];
@@ -992,6 +1000,10 @@ interface TextEditorProps {
992
1000
  indent?: boolean;
993
1001
  advance?: boolean;
994
1002
  };
1003
+ onDownload?: (data: {
1004
+ src?: string;
1005
+ name?: string;
1006
+ }) => void;
995
1007
  }
996
1008
  interface ToolbarButtonProps {
997
1009
  icon?: IconNameProps;
@@ -1052,6 +1064,6 @@ interface AttachmentField {
1052
1064
  };
1053
1065
  }
1054
1066
 
1055
- declare function TextEditor({ ui, field, toolbar, editor: editorProps, }: TextEditorProps): react_jsx_runtime.JSX.Element | null;
1067
+ declare function TextEditor({ ui, field, toolbar, editor: editorProps, onDownload, }: TextEditorProps): react_jsx_runtime.JSX.Element | null;
1056
1068
 
1057
1069
  export { type AttachmentField, BaseCheckbox, type BaseOption, BaseSwitch, ButtonDropdown, type ButtonDropdownProps, ButtonGroup, ButtonGroupItem, type ButtonGroupProps, type ButtonIconProps, ButtonNavigator, Calendar, type CalendarBaseProps, type CalendarDay, type CalendarDayConfig, type CalendarDayItemProps, type CalendarEvent, type CalendarGridProps, type CalendarOverrideProps, type CalendarProps, type CalendarRangeOverrideProps, type CalendarState, type CalendarStyleConfig, type CalendarTypes, Checkbox, CheckboxGroup, type CheckboxGroupContextValue, type CheckboxGroupProps, CheckboxIndicatorVariants, type CheckboxProps, CheckboxVariants, Chip, type ChipArrayProps, ChipContext, type ChipContextValue, ChipGroup, type ChipOptionProps, type ChipProps, type ChipSelectedProps, type ChipValue, type ChipVariants, Collapsible, CollapsibleContent, CollapsibleTrigger, type ColorPickerButtonProps, type ColorType$1 as ColorType, type ColorVariantType, Counter, type CounterControllerProps, type CounterProps, type DateFormat, DatePicker, type DatePickerMode, type DatePickerProps, type DateRange, type DateRangeProps, type DotConfig, Dropdown, DropdownContent, DropdownItem, type DropdownState, DropdownTrigger, type FileItem, FormDescription, type FormDescriptionProps, FormErrorMessage, type FormErrorMessageProps, FormErrorMessages, type FormErrorMessagesProps, FormField, type FormFieldProps, FormHint, type FormHintProps, FormLabel, type FormLabelProps, type FormSizeType, type GetCalendarDaysProps, type HeadingLevel, type IconType, type ImageForm, Input, InputFile, type InputFileProps, type InputFileRef, InputOTP, type InputOTPProps, type InputProps, type InputVariantProps, ItemDropdown, type ListItemType, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, ModalPreviewAttachment, ModalTitle, type PlayerProps, PreviewItem, type PreviewItemProps, Select, type SelectOption, type SelectProps, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarContext, type SidebarContextProps, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuGroup, SidebarMenuItem, SidebarProvider, SidebarTrigger, type SizeType$1 as SizeType, Switch, SwitchThumbVariants, SwitchVariants, Table, type TableAction, TableBody, type TableBodyProps, TableCell, TableCellHead, type TableCellHeadProps, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TablePagination, type TablePaginationProps, type TableRootProps, TableRow, type TableRowProps, Tabs, TabsContent, TabsList, TabsTrigger, type TextAlignValue, TextEditor, type TextEditorProps, Textarea, type TextareaProps, ToastProvider, type ToolbarButtonProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UploadConfig, type UploadStatus, type UploadedFile, chipVariants, formatDateLocal, formatDateToString, generatePages, getCalendarDays, getFormatConfig, getWeekEventSegments, handleDecrement, handleIncrement, handleInputChange, handleKeyDown, inputVariants, isSameDate, isToday, monthsFull, monthsShort, normalize, parseLocalDate, parseMonthName, toDateOnly, useCopy, useIsMobile, useSidebar, useToast };
package/dist/clients.js CHANGED
@@ -686,10 +686,10 @@ var ChipGroup = ({
686
686
  }, [selected, internalSelected]);
687
687
  const toggleSelection = (value) => {
688
688
  let newSelected;
689
- if (multiple || !multiple && internalSelected.length === 0) {
689
+ if (multiple) {
690
690
  newSelected = internalSelected.includes(value) ? internalSelected.filter((v3) => v3 !== value) : [...internalSelected, value];
691
691
  } else {
692
- newSelected = [value];
692
+ newSelected = internalSelected.includes(value) ? [] : [value];
693
693
  }
694
694
  setInternalSelected(newSelected);
695
695
  onSelect?.(newSelected);
@@ -12848,10 +12848,17 @@ var createCalendarHelpers = ({
12848
12848
  value,
12849
12849
  rangeValue,
12850
12850
  disabledDates,
12851
- dayConfigs
12851
+ dayConfigs,
12852
+ disabled
12852
12853
  }) => {
12853
12854
  const isDateDisabled = (day) => {
12854
- return disabledDates.some((d) => d.getTime() === day.fullDate.getTime());
12855
+ if (disabledDates.some((d) => d.getTime() === day.fullDate.getTime())) {
12856
+ return true;
12857
+ }
12858
+ if (disabled?.(day.fullDate) === true) {
12859
+ return true;
12860
+ }
12861
+ return false;
12855
12862
  };
12856
12863
  const getDayConfig = (day) => {
12857
12864
  return dayConfigs.find((c) => c.date.getTime() === day.fullDate.getTime());
@@ -13129,7 +13136,8 @@ function CalendarDayItem({
13129
13136
  onClick,
13130
13137
  variant,
13131
13138
  events,
13132
- backdropOnClick
13139
+ backdropOnClick,
13140
+ disabledDateClassName
13133
13141
  }) {
13134
13142
  const dayConfig = helpers.getDayConfig(day);
13135
13143
  const isSelected = helpers.isDateSelected(day);
@@ -13165,8 +13173,9 @@ function CalendarDayItem({
13165
13173
  mode === "single" && variant === "compact" && styleHelpers.getBackgroundClass(),
13166
13174
  //prettier-ignore
13167
13175
  mode === "range" && !isDisabled && helpers.getRangeBackgroundClass(day),
13168
- variant === "default" && "h-28 md:h-36 w-full rounded-none flex items-start justify-start group p-1 md:p-3 border-r border-gray-300"
13176
+ variant === "default" && "h-28 md:h-36 w-full rounded-none flex items-start justify-start group p-1 md:p-3 border-r border-gray-300",
13169
13177
  //prettier-ignore
13178
+ isDisabled && disabledDateClassName
13170
13179
  ),
13171
13180
  children: [
13172
13181
  /* @__PURE__ */ jsx382(
@@ -13345,7 +13354,8 @@ function CalendarGrid({
13345
13354
  showCalendarTooltip = true,
13346
13355
  backdropOnClick,
13347
13356
  onEventClick,
13348
- useLimitEvent = true
13357
+ useLimitEvent = true,
13358
+ disabledDateClassName
13349
13359
  }) {
13350
13360
  const isMobile = useIsMobile();
13351
13361
  const weeks = Array.from(
@@ -13473,7 +13483,8 @@ function CalendarGrid({
13473
13483
  onClick,
13474
13484
  variant,
13475
13485
  events,
13476
- backdropOnClick: variant === "default" && backdropOnClick ? (day2) => backdropOnClick?.(day2) : void 0
13486
+ backdropOnClick: variant === "default" && backdropOnClick ? (day2) => backdropOnClick?.(day2) : void 0,
13487
+ disabledDateClassName
13477
13488
  },
13478
13489
  dayIndex
13479
13490
  ))
@@ -13858,7 +13869,9 @@ var Calendar2 = ({
13858
13869
  onMonthChange,
13859
13870
  onYearChange,
13860
13871
  showDefaultController = false,
13861
- useLimitEvent = true
13872
+ useLimitEvent = true,
13873
+ disabled,
13874
+ disabledDateClassName
13862
13875
  }) => {
13863
13876
  const currentDate = /* @__PURE__ */ new Date();
13864
13877
  const [currentMonth, setCurrentMonth] = useState10(defaultMonth ?? currentDate.getMonth());
@@ -13883,7 +13896,8 @@ var Calendar2 = ({
13883
13896
  dayConfigs,
13884
13897
  rangeValue,
13885
13898
  mode,
13886
- value
13899
+ value,
13900
+ disabled
13887
13901
  });
13888
13902
  const calendarState = {
13889
13903
  currentMonth,
@@ -13899,8 +13913,8 @@ var Calendar2 = ({
13899
13913
  };
13900
13914
  const handleDateClick = (day) => {
13901
13915
  const dayConfig = calendarHelpers.getDayConfig(day);
13902
- const disabled = (dayConfig?.disabled ?? false) || calendarHelpers.isDateDisabled(day);
13903
- if (disabled) {
13916
+ const disabled2 = (dayConfig?.disabled ?? false) || calendarHelpers.isDateDisabled(day);
13917
+ if (disabled2) {
13904
13918
  return;
13905
13919
  }
13906
13920
  onChange?.(day.fullDate);
@@ -14115,7 +14129,8 @@ var Calendar2 = ({
14115
14129
  showCalendarTooltip,
14116
14130
  useLimitEvent,
14117
14131
  onEventClick,
14118
- backdropOnClick
14132
+ backdropOnClick,
14133
+ disabledDateClassName
14119
14134
  }
14120
14135
  )
14121
14136
  ] })
@@ -14257,6 +14272,9 @@ var DatePicker = ({
14257
14272
  trigger,
14258
14273
  open,
14259
14274
  onOpenChange,
14275
+ minDate,
14276
+ maxDate,
14277
+ disabledDateClassName,
14260
14278
  calendarProps,
14261
14279
  endDateCalendarProps,
14262
14280
  startDateCalendarProps,
@@ -14537,6 +14555,12 @@ var DatePicker = ({
14537
14555
  dayWrapperClassname: "justify-between",
14538
14556
  onChange: handleCalendarChange,
14539
14557
  value: selectedDate,
14558
+ disabled: (date) => {
14559
+ if (minDate !== void 0 && date < minDate) return true;
14560
+ if (maxDate !== void 0 && date > maxDate) return true;
14561
+ return false;
14562
+ },
14563
+ disabledDateClassName,
14540
14564
  ...calendarProps
14541
14565
  }
14542
14566
  ) : /* @__PURE__ */ jsxs81("div", { className: "flex", children: [
@@ -14648,6 +14672,16 @@ var DatePicker = ({
14648
14672
  value: dateRange.start,
14649
14673
  rangeValue: dateRange,
14650
14674
  mode: "range",
14675
+ disabled: (date) => {
14676
+ if (minDate !== void 0 && date < minDate) {
14677
+ return true;
14678
+ }
14679
+ if (maxDate !== void 0 && date > maxDate) {
14680
+ return true;
14681
+ }
14682
+ return false;
14683
+ },
14684
+ disabledDateClassName,
14651
14685
  ...startDateCalendarProps
14652
14686
  }
14653
14687
  ),
@@ -14665,6 +14699,16 @@ var DatePicker = ({
14665
14699
  mode: "range",
14666
14700
  defaultMonth: nextMonthData.month,
14667
14701
  defaultYear: nextMonthData.year,
14702
+ disabled: (date) => {
14703
+ if (minDate !== void 0 && date < minDate) {
14704
+ return true;
14705
+ }
14706
+ if (maxDate !== void 0 && date > maxDate) {
14707
+ return true;
14708
+ }
14709
+ return false;
14710
+ },
14711
+ disabledDateClassName,
14668
14712
  ...endDateCalendarProps
14669
14713
  }
14670
14714
  )
@@ -26591,6 +26635,11 @@ var FontSize = Extension.create({
26591
26635
 
26592
26636
  // src/components/text-editor/extension/image-node.ts
26593
26637
  import Image2 from "@tiptap/extension-image";
26638
+ var getJustify = (align) => {
26639
+ if (align === "right") return "flex-end";
26640
+ if (align === "center") return "center";
26641
+ return "flex-start";
26642
+ };
26594
26643
  var ImageNode = Image2.extend({
26595
26644
  // jadikan block supaya bisa di-align
26596
26645
  inline: false,
@@ -26629,9 +26678,10 @@ var ImageNode = Image2.extend({
26629
26678
  },
26630
26679
  textAlign: {
26631
26680
  default: "left",
26632
- parseHTML: (el) => el.closest("[data-image-wrapper]")?.getAttribute("data-align") ?? "left",
26633
- renderHTML: () => ({})
26634
- // dihandle di nodeView
26681
+ parseHTML: (el) => el.getAttribute("data-text-align") ?? el.closest("[data-image-wrapper]")?.getAttribute("data-align") ?? "left",
26682
+ renderHTML: (attrs) => ({
26683
+ "data-text-align": attrs["textAlign"]
26684
+ })
26635
26685
  },
26636
26686
  url: {
26637
26687
  default: null,
@@ -26649,26 +26699,23 @@ var ImageNode = Image2.extend({
26649
26699
  },
26650
26700
  renderHTML({ HTMLAttributes }) {
26651
26701
  const {
26652
- textAlign,
26653
26702
  objectFit,
26654
26703
  url,
26655
26704
  urlTarget,
26705
+ "data-text-align": dataTextAlign,
26656
26706
  "data-url": dataUrl,
26657
- // ← ambil dari sini
26658
26707
  "data-url-target": dataUrlTarget,
26659
26708
  ...rest
26660
26709
  } = HTMLAttributes;
26661
- const align = textAlign ?? "left";
26662
- const getJustify2 = (a) => a === "right" ? "flex-end" : a === "center" ? "center" : "flex-start";
26710
+ const align = typeof dataTextAlign === "string" && dataTextAlign.length > 0 ? dataTextAlign : "left";
26663
26711
  const resolvedUrl = url ?? dataUrl ?? null;
26664
26712
  const resolvedTarget = urlTarget ?? dataUrlTarget ?? "_self";
26665
26713
  const img = [
26666
26714
  "img",
26667
26715
  mergeAttributes(rest, {
26668
26716
  style: `object-fit: ${objectFit ?? "contain"}`,
26669
- // tambahkan data-* ke <img> supaya parseHTML bisa baca saat load HTML
26670
- ...url !== null ? { "data-url": url } : {},
26671
- ...urlTarget == null ? { "data-url-target": urlTarget } : {}
26717
+ ...resolvedUrl !== null ? { "data-url": resolvedUrl } : {},
26718
+ ...resolvedTarget != null ? { "data-url-target": resolvedTarget } : {}
26672
26719
  })
26673
26720
  ];
26674
26721
  const content = resolvedUrl != null ? ["a", { href: resolvedUrl, target: resolvedTarget }, img] : img;
@@ -26677,7 +26724,7 @@ var ImageNode = Image2.extend({
26677
26724
  {
26678
26725
  "data-image-wrapper": "",
26679
26726
  "data-align": align,
26680
- "style": `display:flex;justify-content:${getJustify2(align)};`
26727
+ "style": `display:flex;justify-content:${getJustify(align)};`
26681
26728
  },
26682
26729
  content
26683
26730
  ];
@@ -26693,8 +26740,7 @@ var ImageNode = Image2.extend({
26693
26740
  const align = n.attrs["textAlign"] ?? "left";
26694
26741
  const url = n.attrs["url"];
26695
26742
  const urlTarget = n.attrs["urlTarget"] ?? "_self";
26696
- const getJustify2 = (a) => a === "right" ? "flex-end" : a === "center" ? "center" : "flex-start";
26697
- wrapper.style.cssText = `display: flex; justify-content: ${getJustify2(align)};`;
26743
+ wrapper.style.cssText = `display: flex; justify-content: ${getJustify(align)};`;
26698
26744
  wrapper.setAttribute("data-align", align);
26699
26745
  if (n.attrs["src"])
26700
26746
  img.setAttribute("src", n.attrs["src"]);
@@ -26704,6 +26750,17 @@ var ImageNode = Image2.extend({
26704
26750
  img.setAttribute("width", String(n.attrs["width"]));
26705
26751
  if (n.attrs["height"])
26706
26752
  img.setAttribute("height", String(n.attrs["height"]));
26753
+ img.setAttribute("data-text-align", align);
26754
+ if (url !== null) {
26755
+ img.setAttribute("data-url", url);
26756
+ } else {
26757
+ img.removeAttribute("data-url");
26758
+ }
26759
+ if (urlTarget !== null) {
26760
+ img.setAttribute("data-url-target", urlTarget);
26761
+ } else {
26762
+ img.removeAttribute("data-url-target");
26763
+ }
26707
26764
  img.style.objectFit = n.attrs["objectFit"] ?? "contain";
26708
26765
  wrapper.innerHTML = "";
26709
26766
  if (url !== null) {
@@ -26997,7 +27054,7 @@ var TableNode = Table2.extend({
26997
27054
  var table_node_default = TableNode;
26998
27055
 
26999
27056
  // src/components/text-editor/extension/youtube-node.ts
27000
- var getJustify = (align) => {
27057
+ var getJustify2 = (align) => {
27001
27058
  switch (align) {
27002
27059
  case "left":
27003
27060
  return "flex-start";
@@ -27063,7 +27120,7 @@ var YoutubeNode = Node3.create({
27063
27120
  const wrapper = document.createElement("div");
27064
27121
  wrapper.style.cssText = "display: flex; justify-content: center; margin: 0.5rem 0;";
27065
27122
  const updateAlignment = (align) => {
27066
- wrapper.style.justifyContent = getJustify(align);
27123
+ wrapper.style.justifyContent = getJustify2(align);
27067
27124
  };
27068
27125
  const iframe = document.createElement("iframe");
27069
27126
  iframe.setAttribute("src", node.attrs["src"]);
@@ -33621,6 +33678,16 @@ var target_link_options_default = targetOptions;
33621
33678
 
33622
33679
  // src/components/text-editor/partials/modal-insert-image.tsx
33623
33680
  import { jsx as jsx407, jsxs as jsxs92 } from "react/jsx-runtime";
33681
+ var createDefaultImageForm = () => ({
33682
+ url: null,
33683
+ image: {
33684
+ objectFit: object_fit_options_default[0],
33685
+ source: "",
33686
+ altText: "",
33687
+ width: "200",
33688
+ height: "200"
33689
+ }
33690
+ });
33624
33691
  function ModalInsertImage({
33625
33692
  isOpen,
33626
33693
  onClose,
@@ -33639,22 +33706,25 @@ function ModalInsertImage({
33639
33706
  altText: data[0].uploadedData?.data.name ?? ""
33640
33707
  };
33641
33708
  }
33642
- }
33709
+ },
33710
+ onDownload
33643
33711
  }) {
33644
33712
  const [currentTabImage, setCurrentTabImage] = useState19("0");
33713
+ const [uploadInputKey, setUploadInputKey] = useState19(0);
33714
+ const [uploadFiles, setUploadFiles] = useState19([]);
33645
33715
  const [errors, setErrors] = useState19(
33646
33716
  {}
33647
33717
  );
33648
- const [imageForm, setImageForm] = useState19({
33649
- url: null,
33650
- image: {
33651
- objectFit: object_fit_options_default[0],
33652
- source: "",
33653
- altText: "",
33654
- width: "200",
33655
- height: "200"
33656
- }
33657
- });
33718
+ const [imageForm, setImageForm] = useState19(
33719
+ createDefaultImageForm()
33720
+ );
33721
+ const resetFormState = () => {
33722
+ setCurrentTabImage("0");
33723
+ setErrors({});
33724
+ setImageForm(createDefaultImageForm());
33725
+ setUploadFiles([]);
33726
+ setUploadInputKey((prev) => prev + 1);
33727
+ };
33658
33728
  const validate = () => {
33659
33729
  const newErrors = {};
33660
33730
  if (imageForm?.image?.source === "" || imageForm?.image?.source === null || imageForm?.image?.source === void 0) {
@@ -33673,9 +33743,16 @@ function ModalInsertImage({
33673
33743
  return Object.keys(newErrors).length === 0;
33674
33744
  };
33675
33745
  useEffect14(() => {
33676
- if (isOpen && initialValues !== void 0) {
33746
+ if (!isOpen) return;
33747
+ setErrors({});
33748
+ setCurrentTabImage("0");
33749
+ setUploadFiles([]);
33750
+ setUploadInputKey((prev) => prev + 1);
33751
+ if (initialValues !== void 0) {
33677
33752
  setImageForm(initialValues);
33753
+ return;
33678
33754
  }
33755
+ setImageForm(createDefaultImageForm());
33679
33756
  }, [isOpen, initialValues]);
33680
33757
  return /* @__PURE__ */ jsxs92(Modal, { isOpen, onClose: () => onClose(false), closable: false, children: [
33681
33758
  /* @__PURE__ */ jsxs92(ModalHeader, { className: "flex-row! items-center justify-between border-b border-gray-200", children: [
@@ -33699,7 +33776,7 @@ function ModalInsertImage({
33699
33776
  if (!validate()) return;
33700
33777
  onSubmit(imageForm);
33701
33778
  onClose(false);
33702
- setImageForm(null);
33779
+ resetFormState();
33703
33780
  },
33704
33781
  className: "overflow-auto",
33705
33782
  children: [
@@ -33880,8 +33957,11 @@ function ModalInsertImage({
33880
33957
  maxSize: (attachmentField?.maxSize ?? 0) * 1024 * 1024,
33881
33958
  variant: attachmentField?.variant ?? "medium",
33882
33959
  uploadConfig: attachmentField?.uploadConfig,
33883
- onChange: attachmentField?.onChange ? (files) => attachmentField?.onChange?.(files) : void 0,
33884
- value: attachmentField?.value,
33960
+ onChange: (files) => {
33961
+ setUploadFiles(files);
33962
+ attachmentField?.onChange?.(files);
33963
+ },
33964
+ value: uploadFiles,
33885
33965
  onUploadSuccess: (results) => {
33886
33966
  const { url, altText } = attachmentField.extractUploadResult(results);
33887
33967
  setCurrentTabImage("0");
@@ -33897,8 +33977,10 @@ function ModalInsertImage({
33897
33977
  };
33898
33978
  });
33899
33979
  attachmentField?.onUploadSuccess?.(results);
33900
- }
33901
- }
33980
+ },
33981
+ onDownload
33982
+ },
33983
+ uploadInputKey
33902
33984
  ) })
33903
33985
  ]
33904
33986
  }
@@ -33912,7 +33994,7 @@ function ModalInsertImage({
33912
33994
  type: "button",
33913
33995
  onClick: () => {
33914
33996
  onClose(false);
33915
- setImageForm(null);
33997
+ resetFormState();
33916
33998
  },
33917
33999
  children: "Cancel"
33918
34000
  }
@@ -34128,7 +34210,8 @@ import { jsx as jsx409, jsxs as jsxs94 } from "react/jsx-runtime";
34128
34210
  function InsertGroup({
34129
34211
  editor,
34130
34212
  disabled = false,
34131
- attachmentField
34213
+ attachmentField,
34214
+ onDownload
34132
34215
  }) {
34133
34216
  const [isModalImageOpen, setIsModalImageOpen] = useState21(false);
34134
34217
  const [isModalYoutubeOpen, setIsModalYoutubeOpen] = useState21(false);
@@ -34285,7 +34368,8 @@ function InsertGroup({
34285
34368
  url: form.url?.source ?? null,
34286
34369
  urlTarget: form.url?.target?.value ?? "_self"
34287
34370
  }).run();
34288
- }
34371
+ },
34372
+ onDownload
34289
34373
  }
34290
34374
  )
34291
34375
  ] });
@@ -34498,7 +34582,8 @@ function TextEditor({
34498
34582
  ui: ui3,
34499
34583
  field,
34500
34584
  toolbar,
34501
- editor: editorProps
34585
+ editor: editorProps,
34586
+ onDownload
34502
34587
  }) {
34503
34588
  const {
34504
34589
  disabled = false,
@@ -34637,7 +34722,8 @@ function TextEditor({
34637
34722
  {
34638
34723
  disabled: isHtmlMode,
34639
34724
  editor,
34640
- attachmentField
34725
+ attachmentField,
34726
+ onDownload
34641
34727
  }
34642
34728
  ),
34643
34729
  table && /* @__PURE__ */ jsx411(TableGroup, { disabled: isHtmlMode, editor }),