@sustaina/shared-ui 1.13.1 → 1.14.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;
@@ -38,6 +39,7 @@ interface FieldSchemaBase<T extends FieldType> {
38
39
  type: T;
39
40
  label?: string;
40
41
  multiTableSearch?: boolean;
42
+ lookupFieldName?: string;
41
43
  }
42
44
  interface DropdownFieldSchema extends FieldSchemaBase<"dropdown"> {
43
45
  options: Option[];
@@ -77,6 +79,7 @@ type RowState = {
77
79
  value2?: undefined;
78
80
  multiTableSearch?: boolean;
79
81
  jsonPath?: string[];
82
+ lookupFieldName?: string;
80
83
  } | {
81
84
  id: string;
82
85
  fieldName: string;
@@ -86,6 +89,7 @@ type RowState = {
86
89
  value2: string;
87
90
  multiTableSearch?: boolean;
88
91
  jsonPath?: string[];
92
+ lookupFieldName?: string;
89
93
  };
90
94
  interface Params {
91
95
  AND: Record<string, unknown>[];
@@ -1105,7 +1109,7 @@ interface CropperModalBaseProps {
1105
1109
  open?: boolean;
1106
1110
  onOpenChange: (open: boolean) => void;
1107
1111
  onCancel?: () => void;
1108
- onError?: (e: unknown) => void;
1112
+ onError?: (e: CropperModalError | unknown) => void;
1109
1113
  imageSrc?: string | null;
1110
1114
  isSVG?: boolean;
1111
1115
  cropSize?: {
@@ -1117,11 +1121,12 @@ interface CropperModalBaseProps {
1117
1121
  * @description an original image dimension is 1000x1000px, if cropSize is 500x500px, the output image will be exactly 500x500px
1118
1122
  */
1119
1123
  outputExactCropSize?: boolean;
1124
+ targetFileSizeKB?: number;
1120
1125
  title?: string;
1121
1126
  props?: {
1122
1127
  dialogTitleContainer?: React.ComponentProps<"div">;
1123
1128
  dialogTitle?: React.ComponentProps<typeof SheetPrimitive.Title>;
1124
- dialogContent?: DialogContentProps;
1129
+ dialogContent?: DialogContentProps$1;
1125
1130
  cropper?: CropperProps;
1126
1131
  cropperContainer?: React.ComponentProps<"div">;
1127
1132
  };
@@ -1135,7 +1140,18 @@ interface CropperModalNormalProps extends CropperModalBaseProps {
1135
1140
  generateBlobUrlOutput: undefined | false;
1136
1141
  }
1137
1142
  type CropperModalProps = CropperModalWithBlobUrlOutputProps | CropperModalNormalProps;
1138
- declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1143
+ type CropperModalErrorType = "ERROR_GENERATE_BLOB" | "ERROR_CREATE_CANVAS" | "ERROR_INVALID_SVG" | "ERROR_COMPRESSION" | "ERROR_SVG_EXCEED_SIZE";
1144
+ declare class CropperModalError extends Error {
1145
+ readonly error: CropperModalErrorType;
1146
+ constructor(errorType: CropperModalErrorType, message: string);
1147
+ }
1148
+ declare const ErrorGeneratingBlob: CropperModalError;
1149
+ declare const ErrorCreateCanvas: CropperModalError;
1150
+ declare const ErrorInvalidSVG: CropperModalError;
1151
+ declare const ErrorCompression: CropperModalError;
1152
+ declare const ErrorSVGExceedSize: CropperModalError;
1153
+
1154
+ declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, targetFileSizeKB, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1139
1155
 
1140
1156
  declare function isDefined(value: any): boolean;
1141
1157
  declare function isEmptyObject(value: any): boolean;
@@ -1234,4 +1250,4 @@ type UseTruncatedOptions<T> = {
1234
1250
  type UseTruncatedResult = boolean;
1235
1251
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
1236
1252
 
1237
- 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 };
1253
+ 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, 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;
@@ -38,6 +39,7 @@ interface FieldSchemaBase<T extends FieldType> {
38
39
  type: T;
39
40
  label?: string;
40
41
  multiTableSearch?: boolean;
42
+ lookupFieldName?: string;
41
43
  }
42
44
  interface DropdownFieldSchema extends FieldSchemaBase<"dropdown"> {
43
45
  options: Option[];
@@ -77,6 +79,7 @@ type RowState = {
77
79
  value2?: undefined;
78
80
  multiTableSearch?: boolean;
79
81
  jsonPath?: string[];
82
+ lookupFieldName?: string;
80
83
  } | {
81
84
  id: string;
82
85
  fieldName: string;
@@ -86,6 +89,7 @@ type RowState = {
86
89
  value2: string;
87
90
  multiTableSearch?: boolean;
88
91
  jsonPath?: string[];
92
+ lookupFieldName?: string;
89
93
  };
90
94
  interface Params {
91
95
  AND: Record<string, unknown>[];
@@ -1105,7 +1109,7 @@ interface CropperModalBaseProps {
1105
1109
  open?: boolean;
1106
1110
  onOpenChange: (open: boolean) => void;
1107
1111
  onCancel?: () => void;
1108
- onError?: (e: unknown) => void;
1112
+ onError?: (e: CropperModalError | unknown) => void;
1109
1113
  imageSrc?: string | null;
1110
1114
  isSVG?: boolean;
1111
1115
  cropSize?: {
@@ -1117,11 +1121,12 @@ interface CropperModalBaseProps {
1117
1121
  * @description an original image dimension is 1000x1000px, if cropSize is 500x500px, the output image will be exactly 500x500px
1118
1122
  */
1119
1123
  outputExactCropSize?: boolean;
1124
+ targetFileSizeKB?: number;
1120
1125
  title?: string;
1121
1126
  props?: {
1122
1127
  dialogTitleContainer?: React.ComponentProps<"div">;
1123
1128
  dialogTitle?: React.ComponentProps<typeof SheetPrimitive.Title>;
1124
- dialogContent?: DialogContentProps;
1129
+ dialogContent?: DialogContentProps$1;
1125
1130
  cropper?: CropperProps;
1126
1131
  cropperContainer?: React.ComponentProps<"div">;
1127
1132
  };
@@ -1135,7 +1140,18 @@ interface CropperModalNormalProps extends CropperModalBaseProps {
1135
1140
  generateBlobUrlOutput: undefined | false;
1136
1141
  }
1137
1142
  type CropperModalProps = CropperModalWithBlobUrlOutputProps | CropperModalNormalProps;
1138
- declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1143
+ type CropperModalErrorType = "ERROR_GENERATE_BLOB" | "ERROR_CREATE_CANVAS" | "ERROR_INVALID_SVG" | "ERROR_COMPRESSION" | "ERROR_SVG_EXCEED_SIZE";
1144
+ declare class CropperModalError extends Error {
1145
+ readonly error: CropperModalErrorType;
1146
+ constructor(errorType: CropperModalErrorType, message: string);
1147
+ }
1148
+ declare const ErrorGeneratingBlob: CropperModalError;
1149
+ declare const ErrorCreateCanvas: CropperModalError;
1150
+ declare const ErrorInvalidSVG: CropperModalError;
1151
+ declare const ErrorCompression: CropperModalError;
1152
+ declare const ErrorSVGExceedSize: CropperModalError;
1153
+
1154
+ declare const CropperModal: ({ open, onOpenChange, imageSrc, isSVG, onConfirm, onCancel, onError, cropSize, outputExactCropSize, targetFileSizeKB, generateBlobUrlOutput, title, props }: CropperModalProps) => react_jsx_runtime.JSX.Element;
1139
1155
 
1140
1156
  declare function isDefined(value: any): boolean;
1141
1157
  declare function isEmptyObject(value: any): boolean;
@@ -1234,4 +1250,4 @@ type UseTruncatedOptions<T> = {
1234
1250
  type UseTruncatedResult = boolean;
1235
1251
  declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
1236
1252
 
1237
- 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 };
1253
+ 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, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, spinnerVariants, stripNullishObject, throttle, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated };
package/dist/index.js CHANGED
@@ -666,7 +666,19 @@ function makeNewRow(field) {
666
666
  value: "",
667
667
  value2: "",
668
668
  multiTableSearch: field.multiTableSearch,
669
- jsonPath: field.jsonPath
669
+ lookupFieldName: field.lookupFieldName
670
+ };
671
+ }
672
+ if (field.type === "json") {
673
+ return {
674
+ id: crypto.randomUUID(),
675
+ fieldName: field.name,
676
+ fieldType: field.type,
677
+ operator: op,
678
+ value: "",
679
+ multiTableSearch: field.multiTableSearch,
680
+ jsonPath: field.jsonPath,
681
+ lookupFieldName: field.lookupFieldName
670
682
  };
671
683
  }
672
684
  return {
@@ -676,7 +688,7 @@ function makeNewRow(field) {
676
688
  operator: op,
677
689
  value: "",
678
690
  multiTableSearch: field.multiTableSearch,
679
- jsonPath: field.jsonPath
691
+ lookupFieldName: field.lookupFieldName
680
692
  };
681
693
  }
682
694
  function useAdvanceSearch({ fields, limitRows }) {
@@ -718,7 +730,8 @@ function useAdvanceSearch({ fields, limitRows }) {
718
730
  value: "",
719
731
  value2: "",
720
732
  multiTableSearch: r.multiTableSearch,
721
- jsonPath: r.jsonPath
733
+ jsonPath: r.jsonPath,
734
+ lookupFieldName: r.lookupFieldName
722
735
  } : {
723
736
  id: r.id,
724
737
  fieldName: r.fieldName,
@@ -726,7 +739,8 @@ function useAdvanceSearch({ fields, limitRows }) {
726
739
  operator: nextOp,
727
740
  value: "",
728
741
  multiTableSearch: r.multiTableSearch,
729
- jsonPath: r.jsonPath
742
+ jsonPath: r.jsonPath,
743
+ lookupFieldName: r.lookupFieldName
730
744
  };
731
745
  })
732
746
  );
@@ -759,6 +773,7 @@ function useAdvanceSearch({ fields, limitRows }) {
759
773
  fieldName: r.fieldName,
760
774
  fieldType: r.fieldType,
761
775
  multiTableSearch: r.multiTableSearch,
776
+ lookupFieldName: r.lookupFieldName,
762
777
  jsonPath: r.jsonPath,
763
778
  operator,
764
779
  value: "",
@@ -770,6 +785,7 @@ function useAdvanceSearch({ fields, limitRows }) {
770
785
  fieldName: r.fieldName,
771
786
  fieldType: r.fieldType,
772
787
  multiTableSearch: r.multiTableSearch,
788
+ lookupFieldName: r.lookupFieldName,
773
789
  jsonPath: r.jsonPath,
774
790
  operator,
775
791
  value: ""
@@ -3118,40 +3134,29 @@ var JSONBuilder = class {
3118
3134
  // src/components/advanceSearch/builder/lookup.ts
3119
3135
  var LookupBuilder = class {
3120
3136
  build(row) {
3137
+ if (!Array.isArray(row.value)) {
3138
+ return {};
3139
+ }
3140
+ const lookupField = row.lookupFieldName ?? "id";
3121
3141
  switch (row.operator) {
3122
3142
  case "containsAny":
3123
3143
  return {
3124
- [row.fieldName]: helper(
3125
- { hasSome: String(row.value).split(",") },
3126
- { multiTableSearch: row.multiTableSearch }
3127
- )
3144
+ OR: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }))
3128
3145
  };
3129
- case "containsAll":
3146
+ case "containsOnly":
3130
3147
  return {
3131
- [row.fieldName]: helper(
3132
- { hasEvery: String(row.value).split(",") },
3133
- { multiTableSearch: row.multiTableSearch }
3134
- )
3148
+ AND: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }))
3135
3149
  };
3136
- case "containsOnly":
3150
+ case "containsAll": {
3151
+ const includes = row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } }));
3152
+ const excludes = { [row.fieldName]: { none: { [lookupField]: { notIn: row.value } } } };
3137
3153
  return {
3138
- [row.fieldName]: helper(
3139
- { equals: String(row.value).split(",") },
3140
- {
3141
- multiTableSearch: row.multiTableSearch,
3142
- insensitive: true
3143
- }
3144
- )
3154
+ AND: [...includes, excludes]
3145
3155
  };
3156
+ }
3146
3157
  case "notContains":
3147
3158
  return {
3148
- [row.fieldName]: helper(
3149
- { not: { contains: row.value } },
3150
- {
3151
- multiTableSearch: row.multiTableSearch,
3152
- insensitive: true
3153
- }
3154
- )
3159
+ NOT: { OR: row.value.map((v) => ({ [row.fieldName]: { some: { [lookupField]: v } } })) }
3155
3160
  };
3156
3161
  default:
3157
3162
  return {};
@@ -8170,6 +8175,31 @@ function SidebarLayout({
8170
8175
  ] }) });
8171
8176
  }
8172
8177
 
8178
+ // src/components/cropperModal/type.ts
8179
+ var CropperModalError = class extends Error {
8180
+ constructor(errorType, message) {
8181
+ super(message);
8182
+ this.error = errorType;
8183
+ }
8184
+ };
8185
+ var ErrorGeneratingBlob = new CropperModalError(
8186
+ "ERROR_GENERATE_BLOB",
8187
+ "failed to generate a valid Blob"
8188
+ );
8189
+ var ErrorCreateCanvas = new CropperModalError("ERROR_CREATE_CANVAS", "Failed to create canvas");
8190
+ var ErrorInvalidSVG = new CropperModalError(
8191
+ "ERROR_INVALID_SVG",
8192
+ "The file is not a valid SVG document root"
8193
+ );
8194
+ var ErrorCompression = new CropperModalError(
8195
+ "ERROR_COMPRESSION",
8196
+ "Compression failed to generate a valid Blob"
8197
+ );
8198
+ var ErrorSVGExceedSize = new CropperModalError(
8199
+ "ERROR_SVG_EXCEED_SIZE",
8200
+ "The SVG file is too large"
8201
+ );
8202
+
8173
8203
  // src/components/cropperModal/helper.ts
8174
8204
  var createImage = (url) => new Promise((resolve, reject) => {
8175
8205
  const image = new Image();
@@ -8178,12 +8208,38 @@ var createImage = (url) => new Promise((resolve, reject) => {
8178
8208
  image.setAttribute("crossOrigin", "anonymous");
8179
8209
  image.src = url;
8180
8210
  });
8181
- async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8211
+ function toBlobPromise(canvas, quality) {
8212
+ return new Promise((resolve) => {
8213
+ canvas.toBlob((blob) => resolve(blob), "image/jpeg", quality);
8214
+ });
8215
+ }
8216
+ async function resizeImage(canvas, targetSizeKB) {
8217
+ const targetSizeBytes = targetSizeKB * 1024;
8218
+ let quality = 1;
8219
+ const qualityStep = 0.05;
8220
+ let compressedBlob = null;
8221
+ let currentSize = Infinity;
8222
+ while (currentSize > targetSizeBytes && quality > 0) {
8223
+ compressedBlob = await toBlobPromise(canvas, quality);
8224
+ if (compressedBlob === null) {
8225
+ throw ErrorCompression;
8226
+ }
8227
+ currentSize = compressedBlob.size;
8228
+ if (currentSize > targetSizeBytes) {
8229
+ quality = Math.max(0, quality - qualityStep);
8230
+ }
8231
+ }
8232
+ if (compressedBlob && currentSize <= targetSizeBytes) {
8233
+ return URL.createObjectURL(compressedBlob);
8234
+ }
8235
+ throw ErrorCompression;
8236
+ }
8237
+ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension, targetSizeKB = Infinity) {
8182
8238
  const image = await createImage(imageSrc);
8183
8239
  const canvas = document.createElement("canvas");
8184
8240
  const ctx = canvas.getContext("2d");
8185
8241
  if (!ctx) {
8186
- throw new Error("can not create canvas");
8242
+ throw ErrorCreateCanvas;
8187
8243
  }
8188
8244
  canvas.width = image.width;
8189
8245
  canvas.height = image.height;
@@ -8191,7 +8247,7 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8191
8247
  const croppedCanvas = document.createElement("canvas");
8192
8248
  const croppedCtx = croppedCanvas.getContext("2d");
8193
8249
  if (!croppedCtx) {
8194
- throw new Error("can not create canvas");
8250
+ throw ErrorCreateCanvas;
8195
8251
  }
8196
8252
  croppedCanvas.width = desiredDimension?.width ?? pixelCrop.width;
8197
8253
  croppedCanvas.height = desiredDimension?.height ?? pixelCrop.height;
@@ -8206,17 +8262,9 @@ async function getCroppedImg(imageSrc, pixelCrop, desiredDimension) {
8206
8262
  desiredDimension?.width ?? pixelCrop.width,
8207
8263
  desiredDimension?.height ?? pixelCrop.height
8208
8264
  );
8209
- return new Promise((resolve, reject) => {
8210
- croppedCanvas.toBlob((file) => {
8211
- if (file) {
8212
- resolve(URL.createObjectURL(file));
8213
- } else {
8214
- reject("croppedCanvas gave null object");
8215
- }
8216
- }, "image/png");
8217
- });
8265
+ return resizeImage(croppedCanvas, targetSizeKB);
8218
8266
  }
8219
- async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8267
+ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension, targetSizeKB = Infinity) {
8220
8268
  let svgString;
8221
8269
  const parts = imageSrc.split(",");
8222
8270
  const meta = parts[0];
@@ -8230,7 +8278,7 @@ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8230
8278
  const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
8231
8279
  const svgElement = svgDoc.documentElement;
8232
8280
  if (svgElement.tagName.toLowerCase() !== "svg") {
8233
- throw new Error("The file is not a valid SVG document root.");
8281
+ throw ErrorInvalidSVG;
8234
8282
  }
8235
8283
  const newViewBox = `${pixelCrop.x} ${pixelCrop.y} ${pixelCrop.width} ${pixelCrop.height}`;
8236
8284
  svgElement.setAttribute("viewBox", newViewBox);
@@ -8241,6 +8289,10 @@ async function getCroppedSVG(imageSrc, pixelCrop, desiredDimension) {
8241
8289
  const serializer = new XMLSerializer();
8242
8290
  const croppedSvgString = serializer.serializeToString(svgElement);
8243
8291
  const blob = new Blob([croppedSvgString], { type: "image/svg+xml" });
8292
+ const targetSizeBytes = targetSizeKB * 1024;
8293
+ if (blob.size > targetSizeBytes) {
8294
+ throw ErrorSVGExceedSize;
8295
+ }
8244
8296
  return URL.createObjectURL(blob);
8245
8297
  }
8246
8298
  var CropperModal = ({
@@ -8253,6 +8305,7 @@ var CropperModal = ({
8253
8305
  onError,
8254
8306
  cropSize,
8255
8307
  outputExactCropSize,
8308
+ targetFileSizeKB,
8256
8309
  generateBlobUrlOutput,
8257
8310
  title,
8258
8311
  props
@@ -8289,7 +8342,7 @@ var CropperModal = ({
8289
8342
  setIsLoading(true);
8290
8343
  try {
8291
8344
  const desiredDimension = outputExactCropSize ? cropSize : void 0;
8292
- const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension);
8345
+ const croppedImage = isSVG ? await getCroppedSVG(imageSrc, croppedAreaPixels, desiredDimension, targetFileSizeKB) : await getCroppedImg(imageSrc, croppedAreaPixels, desiredDimension, targetFileSizeKB);
8293
8346
  onConfirm({ crop, croppedAreaPixels, croppedImageBlobUrl: croppedImage });
8294
8347
  } catch (e) {
8295
8348
  if (onError) {
@@ -8377,6 +8430,7 @@ exports.Collapsible = Collapsible;
8377
8430
  exports.CollapsibleContent = CollapsibleContent2;
8378
8431
  exports.CollapsibleTrigger = CollapsibleTrigger2;
8379
8432
  exports.CropperModal = CropperModal;
8433
+ exports.CropperModalError = CropperModalError;
8380
8434
  exports.DIALOG_ALERT_I18N_NAMESPACE = DIALOG_ALERT_I18N_NAMESPACE;
8381
8435
  exports.DataTable = DataTable_default;
8382
8436
  exports.DatePicker = DatePicker2;
@@ -8388,6 +8442,11 @@ exports.DialogDescription = DialogDescription;
8388
8442
  exports.DialogFooter = DialogFooter;
8389
8443
  exports.DialogTitle = DialogTitle;
8390
8444
  exports.DialogTrigger = DialogTrigger;
8445
+ exports.ErrorCompression = ErrorCompression;
8446
+ exports.ErrorCreateCanvas = ErrorCreateCanvas;
8447
+ exports.ErrorGeneratingBlob = ErrorGeneratingBlob;
8448
+ exports.ErrorInvalidSVG = ErrorInvalidSVG;
8449
+ exports.ErrorSVGExceedSize = ErrorSVGExceedSize;
8391
8450
  exports.Form = Form;
8392
8451
  exports.FormControl = FormControl;
8393
8452
  exports.FormDescription = FormDescription;
@@ -8461,6 +8520,7 @@ exports.SidebarRail = SidebarRail;
8461
8520
  exports.SidebarSeparator = SidebarSeparator;
8462
8521
  exports.SidebarTrigger = SidebarTrigger;
8463
8522
  exports.Skeleton = Skeleton;
8523
+ exports.Spinner = Spinner;
8464
8524
  exports.SuiCalendarIcon = calendar_default;
8465
8525
  exports.SuiCheckIcon = check_default;
8466
8526
  exports.SuiDotsVerticalIcon = dots_vertical_default;
@@ -8489,6 +8549,7 @@ exports.inputVariants = inputVariants;
8489
8549
  exports.isDefined = isDefined;
8490
8550
  exports.isEmptyObject = isEmptyObject;
8491
8551
  exports.selectValueToBoolean = selectValueToBoolean;
8552
+ exports.spinnerVariants = spinnerVariants;
8492
8553
  exports.stripNullishObject = stripNullishObject;
8493
8554
  exports.throttle = throttle;
8494
8555
  exports.useFormField = useFormField;