@sustaina/shared-ui 1.13.2 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,6 +8,7 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
8
8
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
9
9
  import { Header, RowData as RowData$1, Column as Column$1, Table as Table$1, ColumnDef, ColumnFiltersState, OnChangeFn, FilterFnOption, SortingState, ColumnOrderState, VisibilityState, ColumnPinningState, GroupingState, GroupingOptions, ColumnResizeMode, RowSelectionState, Row, ExpandedState, Cell, HeaderGroup, HeaderContext } from '@tanstack/react-table';
10
10
  import * as SheetPrimitive from '@radix-ui/react-dialog';
11
+ import { DialogContentProps as DialogContentProps$1 } from '@radix-ui/react-dialog';
11
12
  import * as react_hook_form from 'react-hook-form';
12
13
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
13
14
  import * as LabelPrimitive from '@radix-ui/react-label';
@@ -20,7 +21,7 @@ import * as SelectPrimitive from '@radix-ui/react-select';
20
21
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
21
22
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
22
23
  import * as SwitchPrimitive from '@radix-ui/react-switch';
23
- import { Area, CropperProps } from 'react-easy-crop';
24
+ import { CropperProps, Area } from 'react-easy-crop';
24
25
  import { ClassValue } from 'clsx';
25
26
 
26
27
  declare function Accordion({ ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Root>): react_jsx_runtime.JSX.Element;
@@ -100,6 +101,7 @@ interface AdvanceSearchProps {
100
101
  iconColor?: string;
101
102
  onSearch?: (param: Params) => void;
102
103
  onClear?: () => void;
104
+ shortDateFormat?: string;
103
105
  }
104
106
 
105
107
  declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
@@ -1108,7 +1110,7 @@ interface CropperModalBaseProps {
1108
1110
  open?: boolean;
1109
1111
  onOpenChange: (open: boolean) => void;
1110
1112
  onCancel?: () => void;
1111
- onError?: (e: unknown) => void;
1113
+ onError?: (e: CropperModalError | unknown) => void;
1112
1114
  imageSrc?: string | null;
1113
1115
  isSVG?: boolean;
1114
1116
  cropSize?: {
@@ -1120,11 +1122,12 @@ interface CropperModalBaseProps {
1120
1122
  * @description an original image dimension is 1000x1000px, if cropSize is 500x500px, the output image will be exactly 500x500px
1121
1123
  */
1122
1124
  outputExactCropSize?: boolean;
1125
+ targetFileSizeKB?: number;
1123
1126
  title?: string;
1124
1127
  props?: {
1125
1128
  dialogTitleContainer?: React.ComponentProps<"div">;
1126
1129
  dialogTitle?: React.ComponentProps<typeof SheetPrimitive.Title>;
1127
- dialogContent?: DialogContentProps;
1130
+ dialogContent?: DialogContentProps$1;
1128
1131
  cropper?: CropperProps;
1129
1132
  cropperContainer?: React.ComponentProps<"div">;
1130
1133
  };
@@ -1138,7 +1141,18 @@ interface CropperModalNormalProps extends CropperModalBaseProps {
1138
1141
  generateBlobUrlOutput: undefined | false;
1139
1142
  }
1140
1143
  type CropperModalProps = CropperModalWithBlobUrlOutputProps | CropperModalNormalProps;
1141
- declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1144
+ type CropperModalErrorType = "ERROR_GENERATE_BLOB" | "ERROR_CREATE_CANVAS" | "ERROR_INVALID_SVG" | "ERROR_COMPRESSION" | "ERROR_SVG_EXCEED_SIZE";
1145
+ declare class CropperModalError extends Error {
1146
+ readonly error: CropperModalErrorType;
1147
+ constructor(errorType: CropperModalErrorType, message: string);
1148
+ }
1149
+ declare const ErrorGeneratingBlob: CropperModalError;
1150
+ declare const ErrorCreateCanvas: CropperModalError;
1151
+ declare const ErrorInvalidSVG: CropperModalError;
1152
+ declare const ErrorCompression: CropperModalError;
1153
+ declare const ErrorSVGExceedSize: CropperModalError;
1154
+
1155
+ declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, targetFileSizeKB, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1142
1156
 
1143
1157
  declare function isDefined(value: any): boolean;
1144
1158
  declare function isEmptyObject(value: any): boolean;
@@ -1159,6 +1173,21 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
1159
1173
  [k: string]: any;
1160
1174
  };
1161
1175
 
1176
+ /**
1177
+ * Formats an ISO date string according to a specified format.
1178
+ *
1179
+ * @param isoDateString The input ISO 8601 date string (e.g., '2025-09-22T08:47:15.627Z') or javascript Date object
1180
+ * @param format The format string (e.g., 'd/m/Y H:i:s')
1181
+ * - d / DD: Day (01-31)
1182
+ * - m / MM: Month (01-12)
1183
+ * - Y / YYYY: Full Year (e.g., 2025)
1184
+ * - H: Hour (00-23)
1185
+ * - i: Minute (00-59)
1186
+ * - s: Second (00-59)
1187
+ * @returns A formatted date string.
1188
+ */
1189
+ declare function formatISODate(isoDate: string | Date, format?: string): string;
1190
+
1162
1191
  /**
1163
1192
  * Utility function to intelligently combine class names using `clsx`
1164
1193
  * and resolve Tailwind CSS class conflicts using `tailwind-merge`.
@@ -1237,4 +1266,4 @@ type UseTruncatedOptions<T> = {
1237
1266
  type UseTruncatedResult = boolean;
1238
1267
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
1239
1268
 
1240
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, type CropperModalProps, DIALOG_ALERT_I18N_NAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Input, type InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, stripNullishObject, throttle, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated };
1269
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, CropperModalError, type CropperModalErrorType, type CropperModalProps, DIALOG_ALERT_I18N_NAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Input, type InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, Spinner, type SpinnerProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, spinnerVariants, stripNullishObject, throttle, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
8
8
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
9
9
  import { Header, RowData as RowData$1, Column as Column$1, Table as Table$1, ColumnDef, ColumnFiltersState, OnChangeFn, FilterFnOption, SortingState, ColumnOrderState, VisibilityState, ColumnPinningState, GroupingState, GroupingOptions, ColumnResizeMode, RowSelectionState, Row, ExpandedState, Cell, HeaderGroup, HeaderContext } from '@tanstack/react-table';
10
10
  import * as SheetPrimitive from '@radix-ui/react-dialog';
11
+ import { DialogContentProps as DialogContentProps$1 } from '@radix-ui/react-dialog';
11
12
  import * as react_hook_form from 'react-hook-form';
12
13
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
13
14
  import * as LabelPrimitive from '@radix-ui/react-label';
@@ -20,7 +21,7 @@ import * as SelectPrimitive from '@radix-ui/react-select';
20
21
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
21
22
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
22
23
  import * as SwitchPrimitive from '@radix-ui/react-switch';
23
- import { Area, CropperProps } from 'react-easy-crop';
24
+ import { CropperProps, Area } from 'react-easy-crop';
24
25
  import { ClassValue } from 'clsx';
25
26
 
26
27
  declare function Accordion({ ...props }: React$1.ComponentProps<typeof AccordionPrimitive.Root>): react_jsx_runtime.JSX.Element;
@@ -100,6 +101,7 @@ interface AdvanceSearchProps {
100
101
  iconColor?: string;
101
102
  onSearch?: (param: Params) => void;
102
103
  onClear?: () => void;
104
+ shortDateFormat?: string;
103
105
  }
104
106
 
105
107
  declare const AdvanceSearch: React__default.FC<AdvanceSearchProps>;
@@ -1108,7 +1110,7 @@ interface CropperModalBaseProps {
1108
1110
  open?: boolean;
1109
1111
  onOpenChange: (open: boolean) => void;
1110
1112
  onCancel?: () => void;
1111
- onError?: (e: unknown) => void;
1113
+ onError?: (e: CropperModalError | unknown) => void;
1112
1114
  imageSrc?: string | null;
1113
1115
  isSVG?: boolean;
1114
1116
  cropSize?: {
@@ -1120,11 +1122,12 @@ interface CropperModalBaseProps {
1120
1122
  * @description an original image dimension is 1000x1000px, if cropSize is 500x500px, the output image will be exactly 500x500px
1121
1123
  */
1122
1124
  outputExactCropSize?: boolean;
1125
+ targetFileSizeKB?: number;
1123
1126
  title?: string;
1124
1127
  props?: {
1125
1128
  dialogTitleContainer?: React.ComponentProps<"div">;
1126
1129
  dialogTitle?: React.ComponentProps<typeof SheetPrimitive.Title>;
1127
- dialogContent?: DialogContentProps;
1130
+ dialogContent?: DialogContentProps$1;
1128
1131
  cropper?: CropperProps;
1129
1132
  cropperContainer?: React.ComponentProps<"div">;
1130
1133
  };
@@ -1138,7 +1141,18 @@ interface CropperModalNormalProps extends CropperModalBaseProps {
1138
1141
  generateBlobUrlOutput: undefined | false;
1139
1142
  }
1140
1143
  type CropperModalProps = CropperModalWithBlobUrlOutputProps | CropperModalNormalProps;
1141
- declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1144
+ type CropperModalErrorType = "ERROR_GENERATE_BLOB" | "ERROR_CREATE_CANVAS" | "ERROR_INVALID_SVG" | "ERROR_COMPRESSION" | "ERROR_SVG_EXCEED_SIZE";
1145
+ declare class CropperModalError extends Error {
1146
+ readonly error: CropperModalErrorType;
1147
+ constructor(errorType: CropperModalErrorType, message: string);
1148
+ }
1149
+ declare const ErrorGeneratingBlob: CropperModalError;
1150
+ declare const ErrorCreateCanvas: CropperModalError;
1151
+ declare const ErrorInvalidSVG: CropperModalError;
1152
+ declare const ErrorCompression: CropperModalError;
1153
+ declare const ErrorSVGExceedSize: CropperModalError;
1154
+
1155
+ declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, targetFileSizeKB, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1142
1156
 
1143
1157
  declare function isDefined(value: any): boolean;
1144
1158
  declare function isEmptyObject(value: any): boolean;
@@ -1159,6 +1173,21 @@ declare function stripNullishObject<T extends Record<string, any>>(value: Partia
1159
1173
  [k: string]: any;
1160
1174
  };
1161
1175
 
1176
+ /**
1177
+ * Formats an ISO date string according to a specified format.
1178
+ *
1179
+ * @param isoDateString The input ISO 8601 date string (e.g., '2025-09-22T08:47:15.627Z') or javascript Date object
1180
+ * @param format The format string (e.g., 'd/m/Y H:i:s')
1181
+ * - d / DD: Day (01-31)
1182
+ * - m / MM: Month (01-12)
1183
+ * - Y / YYYY: Full Year (e.g., 2025)
1184
+ * - H: Hour (00-23)
1185
+ * - i: Minute (00-59)
1186
+ * - s: Second (00-59)
1187
+ * @returns A formatted date string.
1188
+ */
1189
+ declare function formatISODate(isoDate: string | Date, format?: string): string;
1190
+
1162
1191
  /**
1163
1192
  * Utility function to intelligently combine class names using `clsx`
1164
1193
  * and resolve Tailwind CSS class conflicts using `tailwind-merge`.
@@ -1237,4 +1266,4 @@ type UseTruncatedOptions<T> = {
1237
1266
  type UseTruncatedResult = boolean;
1238
1267
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
1239
1268
 
1240
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, type CropperModalProps, DIALOG_ALERT_I18N_NAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Input, type InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, stripNullishObject, throttle, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated };
1269
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, CropperModalError, type CropperModalErrorType, type CropperModalProps, DIALOG_ALERT_I18N_NAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Input, type InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, Spinner, type SpinnerProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, spinnerVariants, stripNullishObject, throttle, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated };
package/dist/index.js CHANGED
@@ -214,6 +214,45 @@ function stripNullishObject(value) {
214
214
  return {};
215
215
  }
216
216
  }
217
+
218
+ // src/utils/date.ts
219
+ var pad = (num) => String(num).padStart(2, "0");
220
+ function formatISODate(isoDate, format5 = "d/m/Y H:i") {
221
+ const date = new Date(isoDate);
222
+ if (isNaN(date.getTime())) {
223
+ return "Invalid Date";
224
+ }
225
+ const parts = {
226
+ d: pad(date.getDate()),
227
+ m: pad(date.getMonth() + 1),
228
+ Y: String(date.getFullYear()),
229
+ H: pad(date.getHours()),
230
+ i: pad(date.getMinutes()),
231
+ s: pad(date.getSeconds())
232
+ };
233
+ const tokenMap = {
234
+ // Day
235
+ d: "d",
236
+ DD: "d",
237
+ // Month
238
+ m: "m",
239
+ MM: "m",
240
+ // Year
241
+ Y: "Y",
242
+ // 'Y' and 'YYYY' will both map to the 4-digit year
243
+ YYYY: "Y",
244
+ // Hour
245
+ H: "H",
246
+ // Minute
247
+ i: "i",
248
+ // Second
249
+ s: "s"
250
+ };
251
+ return format5.replace(/YYYY|Y|MM|m|DD|d|H|i|s/g, (match) => {
252
+ const partKey = tokenMap[match];
253
+ return partKey ? parts[partKey] : match;
254
+ });
255
+ }
217
256
  function cn(...args) {
218
257
  return tailwindMerge.twMerge(clsx2.clsx(args));
219
258
  }
@@ -1806,7 +1845,7 @@ var DatePicker2 = ({
1806
1845
  value,
1807
1846
  onChange,
1808
1847
  onValueChange,
1809
- placeholder: placeholder3 = "DD/MM/YYYY",
1848
+ placeholder: placeholder2 = "DD/MM/YYYY",
1810
1849
  allowClear = true,
1811
1850
  displayFormatter,
1812
1851
  valueFormatter,
@@ -1835,7 +1874,7 @@ var DatePicker2 = ({
1835
1874
  const parsed = parser(value);
1836
1875
  return parsed && dateFns.isValid(parsed) ? parsed : void 0;
1837
1876
  }, [parser, value]);
1838
- const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
1877
+ const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
1839
1878
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
1840
1879
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
1841
1880
  const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
@@ -1909,8 +1948,15 @@ var DatePicker2 = ({
1909
1948
  )
1910
1949
  ] }) });
1911
1950
  };
1912
- var placeholder = "DD/MM/YYYY";
1913
- var ConditionDateInput = ({ row, control, onClear }) => {
1951
+
1952
+ // src/components/advanceSearch/components/constants/index.ts
1953
+ var fallbackShortDateFormat = "DD/MM/YYYY";
1954
+ var ConditionDateInput = ({
1955
+ row,
1956
+ control,
1957
+ onClear,
1958
+ shortDateFormat = fallbackShortDateFormat
1959
+ }) => {
1914
1960
  const isBetween = row.operator === "between";
1915
1961
  const buildAriaLabel = (isEnd) => {
1916
1962
  if (isEnd) return "Select end date";
@@ -1942,10 +1988,11 @@ var ConditionDateInput = ({ row, control, onClear }) => {
1942
1988
  ...field,
1943
1989
  value: field.value || void 0,
1944
1990
  onValueChange: handleValueChange,
1945
- placeholder,
1991
+ placeholder: shortDateFormat,
1946
1992
  ariaLabel: buildAriaLabel(options?.isEnd),
1947
1993
  clearAriaLabel: buildClearLabel(options?.isEnd),
1948
1994
  invalid: Boolean(fieldState.error),
1995
+ displayFormatter: (d) => formatISODate(d, shortDateFormat),
1949
1996
  wrapperClassName: "min-w-0"
1950
1997
  }
1951
1998
  ) }),
@@ -2229,7 +2276,7 @@ var MonthPicker2 = ({
2229
2276
  value,
2230
2277
  onChange,
2231
2278
  onValueChange,
2232
- placeholder: placeholder3 = "MM/YYYY",
2279
+ placeholder: placeholder2 = "MM/YYYY",
2233
2280
  allowClear = true,
2234
2281
  displayFormatter,
2235
2282
  valueFormatter,
@@ -2261,7 +2308,7 @@ var MonthPicker2 = ({
2261
2308
  }
2262
2309
  return void 0;
2263
2310
  }, [parser, value]);
2264
- const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder3;
2311
+ const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
2265
2312
  const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
2266
2313
  const shouldShowClear = allowClear && !disabled && !!parsedValue;
2267
2314
  const handleClose = React4__namespace.default.useCallback(() => setOpen(false), []);
@@ -2336,7 +2383,7 @@ var MonthPicker2 = ({
2336
2383
  )
2337
2384
  ] }) });
2338
2385
  };
2339
- var placeholder2 = "MM/YYYY";
2386
+ var placeholder = "MM/YYYY";
2340
2387
  var ConditionMonthInput = ({ row, control, onClear }) => {
2341
2388
  const isBetween = row.operator === "between";
2342
2389
  const buildAriaLabel = (isEnd) => {
@@ -2370,7 +2417,7 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
2370
2417
  ...field,
2371
2418
  value,
2372
2419
  onValueChange: handleValueChange,
2373
- placeholder: placeholder2,
2420
+ placeholder,
2374
2421
  ariaLabel: buildAriaLabel(options?.isEnd),
2375
2422
  clearAriaLabel: buildClearLabel(options?.isEnd),
2376
2423
  displayFormatter: (month) => dateFns.format(month, "MM/yyyy"),
@@ -2482,7 +2529,7 @@ var LookupSelect = ({
2482
2529
  onChange,
2483
2530
  onClear,
2484
2531
  error,
2485
- placeholder: placeholder3,
2532
+ placeholder: placeholder2,
2486
2533
  maxTags = 10,
2487
2534
  fetchSuggestions,
2488
2535
  suggestionDebounce = 250,
@@ -2656,7 +2703,7 @@ var LookupSelect = ({
2656
2703
  window.removeEventListener("scroll", handleReposition, true);
2657
2704
  };
2658
2705
  }, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition]);
2659
- const resolvedPlaceholder = placeholder3 ?? "Select";
2706
+ const resolvedPlaceholder = placeholder2 ?? "Select";
2660
2707
  const showDropdown = isDropdownOpen && !fetchError;
2661
2708
  const dropdownContent = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-md border border-gray-200 bg-white shadow-lg", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: loadingMessage }) : suggestions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center px-3 py-4 text-sm text-inherit text-center", children: [
2662
2709
  /* @__PURE__ */ jsxRuntime.jsx(not_found_default, { className: "w-full max-w-[80px] h-auto" }),
@@ -2849,7 +2896,13 @@ var ConditionJSONInput = ({
2849
2896
  }
2850
2897
  }
2851
2898
  );
2852
- var ConditionValue = ({ row, fields, onClearValue, dropdownPortalId }) => {
2899
+ var ConditionValue = ({
2900
+ row,
2901
+ fields,
2902
+ onClearValue,
2903
+ dropdownPortalId,
2904
+ shortDateFormat
2905
+ }) => {
2853
2906
  const { control } = reactHookForm.useFormContext();
2854
2907
  const fieldSchema = fields.find((f) => f.name === row.fieldName);
2855
2908
  const fieldType = fieldSchema?.type ?? "text";
@@ -2858,7 +2911,15 @@ var ConditionValue = ({ row, fields, onClearValue, dropdownPortalId }) => {
2858
2911
  return /* @__PURE__ */ jsxRuntime.jsx(ConditionNumberInput, { row, control, onClear: onClearValue });
2859
2912
  case "date":
2860
2913
  case "datetime":
2861
- return /* @__PURE__ */ jsxRuntime.jsx(ConditionDateInput, { row, control, onClear: onClearValue });
2914
+ return /* @__PURE__ */ jsxRuntime.jsx(
2915
+ ConditionDateInput,
2916
+ {
2917
+ row,
2918
+ control,
2919
+ onClear: onClearValue,
2920
+ shortDateFormat
2921
+ }
2922
+ );
2862
2923
  case "datemonth":
2863
2924
  return /* @__PURE__ */ jsxRuntime.jsx(ConditionMonthInput, { row, control, onClear: onClearValue });
2864
2925
  case "dropdown":
@@ -2937,7 +2998,8 @@ var AdvanceSearchRow = ({
2937
2998
  onRemove,
2938
2999
  onClearValue,
2939
3000
  disableAdd,
2940
- dropdownPortalId
3001
+ dropdownPortalId,
3002
+ shortDateFormat
2941
3003
  }) => {
2942
3004
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-3 rounded-lg bg-white md:grid-cols-[minmax(150px,0.85fr)_minmax(140px,0.75fr)_minmax(260px,1fr)_auto] md:items-start", children: [
2943
3005
  /* @__PURE__ */ jsxRuntime.jsx(FieldSelect, { row, fieldOptions, onChangeField }),
@@ -2956,7 +3018,8 @@ var AdvanceSearchRow = ({
2956
3018
  row,
2957
3019
  fields,
2958
3020
  onClearValue,
2959
- dropdownPortalId
3021
+ dropdownPortalId,
3022
+ shortDateFormat
2960
3023
  }
2961
3024
  ),
2962
3025
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full", children: /* @__PURE__ */ jsxRuntime.jsx(AddRemoveButtons, { isFirst, onAdd, onRemove, disableAdd }) })
@@ -3378,7 +3441,8 @@ var AdvanceSearch = ({
3378
3441
  iconColor = "#ffffff",
3379
3442
  limitRows = 4,
3380
3443
  onSearch,
3381
- onClear
3444
+ onClear,
3445
+ shortDateFormat
3382
3446
  }) => {
3383
3447
  const fieldsData = React4.useMemo(() => {
3384
3448
  if (fields.length === 0) throw new Error("fields cannot be an empty array");
@@ -3508,6 +3572,7 @@ var AdvanceSearch = ({
3508
3572
  AdvanceSearchRow,
3509
3573
  {
3510
3574
  row,
3575
+ shortDateFormat,
3511
3576
  isFirst: idx === 0,
3512
3577
  fields: fieldsData,
3513
3578
  fieldOptions,
@@ -6331,8 +6396,8 @@ function parseSerializedEditorState(raw) {
6331
6396
  return void 0;
6332
6397
  }
6333
6398
  }
6334
- function Placeholder({ placeholder: placeholder3 }) {
6335
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.placeholder, children: placeholder3 });
6399
+ function Placeholder({ placeholder: placeholder2 }) {
6400
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.placeholder, children: placeholder2 });
6336
6401
  }
6337
6402
  var initialToolbarState = {
6338
6403
  isBold: false,
@@ -7233,7 +7298,7 @@ var RichText = React4.forwardRef(function RichText2({
7233
7298
  defaultValue,
7234
7299
  onChange,
7235
7300
  onHtmlChange,
7236
- placeholder: placeholder3,
7301
+ placeholder: placeholder2,
7237
7302
  readOnly,
7238
7303
  disabled,
7239
7304
  editorClassName,
@@ -7321,7 +7386,7 @@ var RichText = React4.forwardRef(function RichText2({
7321
7386
  )
7322
7387
  }
7323
7388
  ),
7324
- placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder3 || "" }),
7389
+ placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder2 || "" }),
7325
7390
  ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
7326
7391
  }
7327
7392
  ),
@@ -8175,6 +8240,31 @@ function SidebarLayout({
8175
8240
  ] }) });
8176
8241
  }
8177
8242
 
8243
+ // src/components/cropperModal/type.ts
8244
+ var CropperModalError = class extends Error {
8245
+ constructor(errorType, message) {
8246
+ super(message);
8247
+ this.error = errorType;
8248
+ }
8249
+ };
8250
+ var ErrorGeneratingBlob = new CropperModalError(
8251
+ "ERROR_GENERATE_BLOB",
8252
+ "failed to generate a valid Blob"
8253
+ );
8254
+ var ErrorCreateCanvas = new CropperModalError("ERROR_CREATE_CANVAS", "Failed to create canvas");
8255
+ var ErrorInvalidSVG = new CropperModalError(
8256
+ "ERROR_INVALID_SVG",
8257
+ "The file is not a valid SVG document root"
8258
+ );
8259
+ var ErrorCompression = new CropperModalError(
8260
+ "ERROR_COMPRESSION",
8261
+ "Compression failed to generate a valid Blob"
8262
+ );
8263
+ var ErrorSVGExceedSize = new CropperModalError(
8264
+ "ERROR_SVG_EXCEED_SIZE",
8265
+ "The SVG file is too large"
8266
+ );
8267
+
8178
8268
  // src/components/cropperModal/helper.ts
8179
8269
  var createImage = (url) => new Promise((resolve, reject) => {
8180
8270
  const image = new Image();
@@ -8183,12 +8273,38 @@ var createImage = (url) => new Promise((resolve, reject) => {
8183
8273
  image.setAttribute("crossOrigin", "anonymous");
8184
8274
  image.src = url;
8185
8275
  });
8186
- async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8276
+ function toBlobPromise(canvas, quality) {
8277
+ return new Promise((resolve) => {
8278
+ canvas.toBlob((blob) => resolve(blob), "image/jpeg", quality);
8279
+ });
8280
+ }
8281
+ async function resizeImage(canvas, targetSizeKB) {
8282
+ const targetSizeBytes = targetSizeKB * 1024;
8283
+ let quality = 1;
8284
+ const qualityStep = 0.05;
8285
+ let compressedBlob = null;
8286
+ let currentSize = Infinity;
8287
+ while (currentSize > targetSizeBytes && quality > 0) {
8288
+ compressedBlob = await toBlobPromise(canvas, quality);
8289
+ if (compressedBlob === null) {
8290
+ throw ErrorCompression;
8291
+ }
8292
+ currentSize = compressedBlob.size;
8293
+ if (currentSize > targetSizeBytes) {
8294
+ quality = Math.max(0, quality - qualityStep);
8295
+ }
8296
+ }
8297
+ if (compressedBlob && currentSize <= targetSizeBytes) {
8298
+ return URL.createObjectURL(compressedBlob);
8299
+ }
8300
+ throw ErrorCompression;
8301
+ }
8302
+ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension, targetSizeKB = Infinity) {
8187
8303
  const image = await createImage(imageSrc);
8188
8304
  const canvas = document.createElement("canvas");
8189
8305
  const ctx = canvas.getContext("2d");
8190
8306
  if (!ctx) {
8191
- throw new Error("can not create canvas");
8307
+ throw ErrorCreateCanvas;
8192
8308
  }
8193
8309
  canvas.width = image.width;
8194
8310
  canvas.height = image.height;
@@ -8196,7 +8312,7 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8196
8312
  const croppedCanvas = document.createElement("canvas");
8197
8313
  const croppedCtx = croppedCanvas.getContext("2d");
8198
8314
  if (!croppedCtx) {
8199
- throw new Error("can not create canvas");
8315
+ throw ErrorCreateCanvas;
8200
8316
  }
8201
8317
  croppedCanvas.width = desiredDimension?.width ?? pixelCrop.width;
8202
8318
  croppedCanvas.height = desiredDimension?.height ?? pixelCrop.height;
@@ -8211,17 +8327,9 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8211
8327
  desiredDimension?.width ?? pixelCrop.width,
8212
8328
  desiredDimension?.height ?? pixelCrop.height
8213
8329
  );
8214
- return new Promise((resolve, reject) => {
8215
- croppedCanvas.toBlob((file) => {
8216
- if (file) {
8217
- resolve(URL.createObjectURL(file));
8218
- } else {
8219
- reject("croppedCanvas gave null object");
8220
- }
8221
- }, "image/png");
8222
- });
8330
+ return resizeImage(croppedCanvas, targetSizeKB);
8223
8331
  }
8224
- async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8332
+ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension, targetSizeKB = Infinity) {
8225
8333
  let svgString;
8226
8334
  const parts = imageSrc.split(",");
8227
8335
  const meta = parts[0];
@@ -8235,7 +8343,7 @@ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8235
8343
  const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
8236
8344
  const svgElement = svgDoc.documentElement;
8237
8345
  if (svgElement.tagName.toLowerCase() !== "svg") {
8238
- throw new Error("The file is not a valid SVG document root.");
8346
+ throw ErrorInvalidSVG;
8239
8347
  }
8240
8348
  const newViewBox = `${pixelCrop.x} ${pixelCrop.y} ${pixelCrop.width} ${pixelCrop.height}`;
8241
8349
  svgElement.setAttribute("viewBox", newViewBox);
@@ -8246,6 +8354,10 @@ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8246
8354
  const serializer = new XMLSerializer();
8247
8355
  const croppedSvgString = serializer.serializeToString(svgElement);
8248
8356
  const blob = new Blob([croppedSvgString], { type: "image/svg+xml" });
8357
+ const targetSizeBytes = targetSizeKB * 1024;
8358
+ if (blob.size > targetSizeBytes) {
8359
+ throw ErrorSVGExceedSize;
8360
+ }
8249
8361
  return URL.createObjectURL(blob);
8250
8362
  }
8251
8363
  var CropperModal = ({
@@ -8258,6 +8370,7 @@ var CropperModal = ({
8258
8370
  onError,
8259
8371
  cropSize,
8260
8372
  outputExactCropSize,
8373
+ targetFileSizeKB,
8261
8374
  generateBlobUrlOutput,
8262
8375
  title,
8263
8376
  props
@@ -8294,7 +8407,7 @@ var CropperModal = ({
8294
8407
  setIsLoading(true);
8295
8408
  try {
8296
8409
  const desiredDimension = outputExactCropSize ? cropSize : void 0;
8297
- const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
8410
+ const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension, targetFileSizeKB) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension, targetFileSizeKB);
8298
8411
  onConfirm({ crop, croppedAreaPixels, croppedImageBlobUrl: croppedImage });
8299
8412
  } catch (e) {
8300
8413
  if (onError) {
@@ -8382,6 +8495,7 @@ exports.Collapsible = Collapsible;
8382
8495
  exports.CollapsibleContent = CollapsibleContent2;
8383
8496
  exports.CollapsibleTrigger = CollapsibleTrigger2;
8384
8497
  exports.CropperModal = CropperModal;
8498
+ exports.CropperModalError = CropperModalError;
8385
8499
  exports.DIALOG_ALERT_I18N_NAMESPACE = DIALOG_ALERT_I18N_NAMESPACE;
8386
8500
  exports.DataTable = DataTable_default;
8387
8501
  exports.DatePicker = DatePicker2;
@@ -8393,6 +8507,11 @@ exports.DialogDescription = DialogDescription;
8393
8507
  exports.DialogFooter = DialogFooter;
8394
8508
  exports.DialogTitle = DialogTitle;
8395
8509
  exports.DialogTrigger = DialogTrigger;
8510
+ exports.ErrorCompression = ErrorCompression;
8511
+ exports.ErrorCreateCanvas = ErrorCreateCanvas;
8512
+ exports.ErrorGeneratingBlob = ErrorGeneratingBlob;
8513
+ exports.ErrorInvalidSVG = ErrorInvalidSVG;
8514
+ exports.ErrorSVGExceedSize = ErrorSVGExceedSize;
8396
8515
  exports.Form = Form;
8397
8516
  exports.FormControl = FormControl;
8398
8517
  exports.FormDescription = FormDescription;
@@ -8466,6 +8585,7 @@ exports.SidebarRail = SidebarRail;
8466
8585
  exports.SidebarSeparator = SidebarSeparator;
8467
8586
  exports.SidebarTrigger = SidebarTrigger;
8468
8587
  exports.Skeleton = Skeleton;
8588
+ exports.Spinner = Spinner;
8469
8589
  exports.SuiCalendarIcon = calendar_default;
8470
8590
  exports.SuiCheckIcon = check_default;
8471
8591
  exports.SuiDotsVerticalIcon = dots_vertical_default;
@@ -8488,12 +8608,14 @@ exports.buttonVariants = buttonVariants;
8488
8608
  exports.cn = cn;
8489
8609
  exports.compareAlphanumeric = compareAlphanumeric;
8490
8610
  exports.debounce = debounce;
8611
+ exports.formatISODate = formatISODate;
8491
8612
  exports.getDialogAlertControls = getDialogAlertControls;
8492
8613
  exports.getDialogTemplates = getDialogTemplates;
8493
8614
  exports.inputVariants = inputVariants;
8494
8615
  exports.isDefined = isDefined;
8495
8616
  exports.isEmptyObject = isEmptyObject;
8496
8617
  exports.selectValueToBoolean = selectValueToBoolean;
8618
+ exports.spinnerVariants = spinnerVariants;
8497
8619
  exports.stripNullishObject = stripNullishObject;
8498
8620
  exports.throttle = throttle;
8499
8621
  exports.useFormField = useFormField;