hazo_ui 4.1.1 → 4.2.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/CHANGE_LOG.md +17 -0
- package/README.md +97 -0
- package/dist/index.cjs +213 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -1
- package/dist/index.d.ts +82 -1
- package/dist/index.js +209 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -934,6 +934,87 @@ interface HazoUiConfirmDialogProps {
|
|
|
934
934
|
*/
|
|
935
935
|
declare function HazoUiConfirmDialog({ open, onOpenChange, title, description, children, variant, confirmLabel, cancelLabel, showCancelButton, onConfirm, onCancel, loading: external_loading, disabled, accentColor, confirmButtonColor, openAnimation, closeAnimation, }: HazoUiConfirmDialogProps): react_jsx_runtime.JSX.Element;
|
|
936
936
|
|
|
937
|
+
/**
|
|
938
|
+
* hazo_ui_image_cropper/index.tsx
|
|
939
|
+
*
|
|
940
|
+
* Purpose: Round profile-photo cropper with pan/zoom, outputs a 512×512 WebP Blob.
|
|
941
|
+
* Wraps react-easy-crop with a Slider for zoom control and exposes an imperative
|
|
942
|
+
* handle so parent components can trigger blob production on demand.
|
|
943
|
+
*/
|
|
944
|
+
|
|
945
|
+
/** Imperative handle exposed via forwardRef for on-demand blob production. */
|
|
946
|
+
interface HazoUiImageCropperHandle {
|
|
947
|
+
/** Produces the cropped WebP blob using the current pan/zoom state. */
|
|
948
|
+
getCroppedBlob: () => Promise<Blob>;
|
|
949
|
+
}
|
|
950
|
+
interface HazoUiImageCropperProps {
|
|
951
|
+
/** URL or object URL of the source image to crop. */
|
|
952
|
+
imageSrc: string;
|
|
953
|
+
/**
|
|
954
|
+
* Optional callback invoked after the blob is produced.
|
|
955
|
+
* The dialog wrapper uses the imperative handle instead, but direct consumers
|
|
956
|
+
* can wire this for convenience.
|
|
957
|
+
*/
|
|
958
|
+
onCropped?: (blob: Blob) => void | Promise<void>;
|
|
959
|
+
/** Output canvas size in pixels (width = height). Defaults to 512. */
|
|
960
|
+
outputSize?: number;
|
|
961
|
+
/** WebP quality 0–1. Defaults to 0.9. */
|
|
962
|
+
quality?: number;
|
|
963
|
+
/** Label for the zoom slider — pass a translated string. Defaults to "Zoom". */
|
|
964
|
+
zoomLabel?: string;
|
|
965
|
+
/** Additional className for the root container. */
|
|
966
|
+
className?: string;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* HazoUiImageCropper
|
|
970
|
+
*
|
|
971
|
+
* Round profile-photo cropper with pan/zoom support.
|
|
972
|
+
* Accepts a `ref` that exposes `getCroppedBlob()` for on-demand production.
|
|
973
|
+
*/
|
|
974
|
+
declare const HazoUiImageCropper: React$1.ForwardRefExoticComponent<HazoUiImageCropperProps & React$1.RefAttributes<HazoUiImageCropperHandle>>;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* hazo_ui_image_cropper_dialog/index.tsx
|
|
978
|
+
*
|
|
979
|
+
* Purpose: Dialog wrapper around HazoUiImageCropper.
|
|
980
|
+
* Manages a File → object URL lifecycle, triggers crop on Confirm,
|
|
981
|
+
* and exposes all string labels as props so consuming apps can pass
|
|
982
|
+
* translated strings without requiring next-intl in this package.
|
|
983
|
+
*/
|
|
984
|
+
interface HazoUiImageCropperDialogProps {
|
|
985
|
+
/** Whether the dialog is open. */
|
|
986
|
+
open: boolean;
|
|
987
|
+
/** Called when the dialog open state should change. */
|
|
988
|
+
onOpenChange: (open: boolean) => void;
|
|
989
|
+
/** The File to crop. Pass null to close / clear the dialog. */
|
|
990
|
+
file: File | null;
|
|
991
|
+
/** Called with the resulting WebP Blob when the user confirms. */
|
|
992
|
+
onConfirm: (blob: Blob) => void | Promise<void>;
|
|
993
|
+
/** Called when the user cancels (before the dialog closes). */
|
|
994
|
+
onCancel?: () => void;
|
|
995
|
+
/** Dialog title. Defaults to "Crop photo". */
|
|
996
|
+
title?: string;
|
|
997
|
+
/** Confirm/Save button label. Defaults to "Save". */
|
|
998
|
+
confirmLabel?: string;
|
|
999
|
+
/** Cancel button label. Defaults to "Cancel". */
|
|
1000
|
+
cancelLabel?: string;
|
|
1001
|
+
/** Zoom slider label. Defaults to "Zoom". */
|
|
1002
|
+
zoomLabel?: string;
|
|
1003
|
+
/** Output canvas size in pixels (width = height). Defaults to 512. */
|
|
1004
|
+
outputSize?: number;
|
|
1005
|
+
/** WebP quality 0–1. Defaults to 0.9. */
|
|
1006
|
+
quality?: number;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* HazoUiImageCropperDialog
|
|
1010
|
+
*
|
|
1011
|
+
* Wraps HazoUiImageCropper inside HazoUiDialog. The Confirm button calls the
|
|
1012
|
+
* cropper's imperative `getCroppedBlob()`, passes the blob to `onConfirm`,
|
|
1013
|
+
* then closes the dialog. `actionButtonLoading` is set while the blob is being
|
|
1014
|
+
* produced to prevent double-clicks.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function HazoUiImageCropperDialog({ open, onOpenChange, file, onConfirm, onCancel, title, confirmLabel, cancelLabel, zoomLabel, outputSize, quality, }: HazoUiImageCropperDialogProps): react_jsx_runtime.JSX.Element;
|
|
1017
|
+
|
|
937
1018
|
declare const Dialog: React$1.FC<DialogPrimitive.DialogProps>;
|
|
938
1019
|
declare const DialogTrigger: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
939
1020
|
declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
@@ -2238,4 +2319,4 @@ interface HazoUiEtaProgressProps {
|
|
|
2238
2319
|
*/
|
|
2239
2320
|
declare function HazoUiEtaProgress({ estimateKey, unitCount, concurrency, windowSize, fallbackUnitMs, level, label, endpoint, handleRef, className, }: HazoUiEtaProgressProps): react_jsx_runtime.JSX.Element;
|
|
2240
2321
|
|
|
2241
|
-
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LoadingTimeout, type LoadingTimeoutProps, type Logger, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
|
2322
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiImageCropper, HazoUiImageCropperDialog, type HazoUiImageCropperDialogProps, type HazoUiImageCropperHandle, type HazoUiImageCropperProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LoadingTimeout, type LoadingTimeoutProps, type Logger, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
package/dist/index.d.ts
CHANGED
|
@@ -934,6 +934,87 @@ interface HazoUiConfirmDialogProps {
|
|
|
934
934
|
*/
|
|
935
935
|
declare function HazoUiConfirmDialog({ open, onOpenChange, title, description, children, variant, confirmLabel, cancelLabel, showCancelButton, onConfirm, onCancel, loading: external_loading, disabled, accentColor, confirmButtonColor, openAnimation, closeAnimation, }: HazoUiConfirmDialogProps): react_jsx_runtime.JSX.Element;
|
|
936
936
|
|
|
937
|
+
/**
|
|
938
|
+
* hazo_ui_image_cropper/index.tsx
|
|
939
|
+
*
|
|
940
|
+
* Purpose: Round profile-photo cropper with pan/zoom, outputs a 512×512 WebP Blob.
|
|
941
|
+
* Wraps react-easy-crop with a Slider for zoom control and exposes an imperative
|
|
942
|
+
* handle so parent components can trigger blob production on demand.
|
|
943
|
+
*/
|
|
944
|
+
|
|
945
|
+
/** Imperative handle exposed via forwardRef for on-demand blob production. */
|
|
946
|
+
interface HazoUiImageCropperHandle {
|
|
947
|
+
/** Produces the cropped WebP blob using the current pan/zoom state. */
|
|
948
|
+
getCroppedBlob: () => Promise<Blob>;
|
|
949
|
+
}
|
|
950
|
+
interface HazoUiImageCropperProps {
|
|
951
|
+
/** URL or object URL of the source image to crop. */
|
|
952
|
+
imageSrc: string;
|
|
953
|
+
/**
|
|
954
|
+
* Optional callback invoked after the blob is produced.
|
|
955
|
+
* The dialog wrapper uses the imperative handle instead, but direct consumers
|
|
956
|
+
* can wire this for convenience.
|
|
957
|
+
*/
|
|
958
|
+
onCropped?: (blob: Blob) => void | Promise<void>;
|
|
959
|
+
/** Output canvas size in pixels (width = height). Defaults to 512. */
|
|
960
|
+
outputSize?: number;
|
|
961
|
+
/** WebP quality 0–1. Defaults to 0.9. */
|
|
962
|
+
quality?: number;
|
|
963
|
+
/** Label for the zoom slider — pass a translated string. Defaults to "Zoom". */
|
|
964
|
+
zoomLabel?: string;
|
|
965
|
+
/** Additional className for the root container. */
|
|
966
|
+
className?: string;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* HazoUiImageCropper
|
|
970
|
+
*
|
|
971
|
+
* Round profile-photo cropper with pan/zoom support.
|
|
972
|
+
* Accepts a `ref` that exposes `getCroppedBlob()` for on-demand production.
|
|
973
|
+
*/
|
|
974
|
+
declare const HazoUiImageCropper: React$1.ForwardRefExoticComponent<HazoUiImageCropperProps & React$1.RefAttributes<HazoUiImageCropperHandle>>;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* hazo_ui_image_cropper_dialog/index.tsx
|
|
978
|
+
*
|
|
979
|
+
* Purpose: Dialog wrapper around HazoUiImageCropper.
|
|
980
|
+
* Manages a File → object URL lifecycle, triggers crop on Confirm,
|
|
981
|
+
* and exposes all string labels as props so consuming apps can pass
|
|
982
|
+
* translated strings without requiring next-intl in this package.
|
|
983
|
+
*/
|
|
984
|
+
interface HazoUiImageCropperDialogProps {
|
|
985
|
+
/** Whether the dialog is open. */
|
|
986
|
+
open: boolean;
|
|
987
|
+
/** Called when the dialog open state should change. */
|
|
988
|
+
onOpenChange: (open: boolean) => void;
|
|
989
|
+
/** The File to crop. Pass null to close / clear the dialog. */
|
|
990
|
+
file: File | null;
|
|
991
|
+
/** Called with the resulting WebP Blob when the user confirms. */
|
|
992
|
+
onConfirm: (blob: Blob) => void | Promise<void>;
|
|
993
|
+
/** Called when the user cancels (before the dialog closes). */
|
|
994
|
+
onCancel?: () => void;
|
|
995
|
+
/** Dialog title. Defaults to "Crop photo". */
|
|
996
|
+
title?: string;
|
|
997
|
+
/** Confirm/Save button label. Defaults to "Save". */
|
|
998
|
+
confirmLabel?: string;
|
|
999
|
+
/** Cancel button label. Defaults to "Cancel". */
|
|
1000
|
+
cancelLabel?: string;
|
|
1001
|
+
/** Zoom slider label. Defaults to "Zoom". */
|
|
1002
|
+
zoomLabel?: string;
|
|
1003
|
+
/** Output canvas size in pixels (width = height). Defaults to 512. */
|
|
1004
|
+
outputSize?: number;
|
|
1005
|
+
/** WebP quality 0–1. Defaults to 0.9. */
|
|
1006
|
+
quality?: number;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* HazoUiImageCropperDialog
|
|
1010
|
+
*
|
|
1011
|
+
* Wraps HazoUiImageCropper inside HazoUiDialog. The Confirm button calls the
|
|
1012
|
+
* cropper's imperative `getCroppedBlob()`, passes the blob to `onConfirm`,
|
|
1013
|
+
* then closes the dialog. `actionButtonLoading` is set while the blob is being
|
|
1014
|
+
* produced to prevent double-clicks.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function HazoUiImageCropperDialog({ open, onOpenChange, file, onConfirm, onCancel, title, confirmLabel, cancelLabel, zoomLabel, outputSize, quality, }: HazoUiImageCropperDialogProps): react_jsx_runtime.JSX.Element;
|
|
1017
|
+
|
|
937
1018
|
declare const Dialog: React$1.FC<DialogPrimitive.DialogProps>;
|
|
938
1019
|
declare const DialogTrigger: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
939
1020
|
declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
@@ -2238,4 +2319,4 @@ interface HazoUiEtaProgressProps {
|
|
|
2238
2319
|
*/
|
|
2239
2320
|
declare function HazoUiEtaProgress({ estimateKey, unitCount, concurrency, windowSize, fallbackUnitMs, level, label, endpoint, handleRef, className, }: HazoUiEtaProgressProps): react_jsx_runtime.JSX.Element;
|
|
2240
2321
|
|
|
2241
|
-
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LoadingTimeout, type LoadingTimeoutProps, type Logger, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
|
2322
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CelebrationPayload, CelebrationProvider, type CelebrationProviderProps, type CelebrationShareableCard, type ChartDataPoint, type ChartDataSeries, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DateRangeOption, DateRangeSelector, type DateRangeSelectorProps, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type EtaProgressHandle, type FilterConfig, type FilterField, FunnelChart, type FunnelChartProps, type FunnelStep, HazoContextProvider, type HazoContextProviderProps, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, type HazoUiEtaProgressProps, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiImageCropper, HazoUiImageCropperDialog, type HazoUiImageCropperDialogProps, type HazoUiImageCropperHandle, type HazoUiImageCropperProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiProgressBar, type HazoUiProgressBarProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, type InputAffixProps, type InsertedCommand, InverseSparkline, type InverseSparklineProps, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LoadingTimeout, type LoadingTimeoutProps, type Logger, MarkdownEditor, type MarkdownEditorProps, type MarkdownEmbed, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, Slider, type SortConfig, type SortField, Sparkline, type SparklineProps, Spinner, type StackedBar, StackedBars, type StackedBarsProps, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCopyToClipboardResult, type UseErrorDisplayResult, type UseEtaProgressOptions, type UseFullscreenRefResult, type UseFullscreenResult, type UseLoadingStateResult, type UseWakeLockResult, applyKanbanFilter, buttonGroupVariants, celebrate, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import Link from '@tiptap/extension-link';
|
|
|
41
41
|
import TextAlign from '@tiptap/extension-text-align';
|
|
42
42
|
import Highlight from '@tiptap/extension-highlight';
|
|
43
43
|
import Color from '@tiptap/extension-color';
|
|
44
|
-
import
|
|
44
|
+
import Image2 from '@tiptap/extension-image';
|
|
45
45
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
46
46
|
import HorizontalRule from '@tiptap/extension-horizontal-rule';
|
|
47
47
|
import { Table } from '@tiptap/extension-table';
|
|
@@ -60,6 +60,8 @@ import '@uiw/react-markdown-preview/markdown.css';
|
|
|
60
60
|
import Suggestion from '@tiptap/suggestion';
|
|
61
61
|
import { PluginKey } from '@tiptap/pm/state';
|
|
62
62
|
import { createPortal } from 'react-dom';
|
|
63
|
+
import Cropper from 'react-easy-crop';
|
|
64
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
63
65
|
import { Drawer as Drawer$1 } from 'vaul';
|
|
64
66
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
65
67
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -72,7 +74,6 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
72
74
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
73
75
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
74
76
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
75
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
76
77
|
import { Toaster, toast } from 'sonner';
|
|
77
78
|
export { toast as rawToast } from 'sonner';
|
|
78
79
|
import { useHazoState } from 'hazo_state/client';
|
|
@@ -4297,7 +4298,7 @@ var HazoUiRte = ({
|
|
|
4297
4298
|
multicolor: true
|
|
4298
4299
|
}),
|
|
4299
4300
|
Color,
|
|
4300
|
-
|
|
4301
|
+
Image2.configure({
|
|
4301
4302
|
inline: true,
|
|
4302
4303
|
allowBase64: true,
|
|
4303
4304
|
HTMLAttributes: {
|
|
@@ -6845,6 +6846,210 @@ function HazoUiConfirmDialog({
|
|
|
6845
6846
|
)
|
|
6846
6847
|
] }) });
|
|
6847
6848
|
}
|
|
6849
|
+
var Slider = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
6850
|
+
SliderPrimitive.Root,
|
|
6851
|
+
{
|
|
6852
|
+
ref,
|
|
6853
|
+
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
6854
|
+
...props,
|
|
6855
|
+
children: [
|
|
6856
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
|
|
6857
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
|
|
6858
|
+
]
|
|
6859
|
+
}
|
|
6860
|
+
));
|
|
6861
|
+
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
6862
|
+
async function getCroppedImg(imageSrc, areaPixels, outputSize, quality) {
|
|
6863
|
+
const img = await new Promise((resolve, reject) => {
|
|
6864
|
+
const image = new Image();
|
|
6865
|
+
image.crossOrigin = "anonymous";
|
|
6866
|
+
image.onload = () => resolve(image);
|
|
6867
|
+
image.onerror = (e) => reject(e);
|
|
6868
|
+
image.src = imageSrc;
|
|
6869
|
+
});
|
|
6870
|
+
const canvas = document.createElement("canvas");
|
|
6871
|
+
canvas.width = outputSize;
|
|
6872
|
+
canvas.height = outputSize;
|
|
6873
|
+
const ctx = canvas.getContext("2d");
|
|
6874
|
+
if (!ctx) {
|
|
6875
|
+
throw new Error("HazoUiImageCropper: canvas 2d context unavailable");
|
|
6876
|
+
}
|
|
6877
|
+
ctx.drawImage(
|
|
6878
|
+
img,
|
|
6879
|
+
areaPixels.x,
|
|
6880
|
+
areaPixels.y,
|
|
6881
|
+
areaPixels.width,
|
|
6882
|
+
areaPixels.height,
|
|
6883
|
+
0,
|
|
6884
|
+
0,
|
|
6885
|
+
outputSize,
|
|
6886
|
+
outputSize
|
|
6887
|
+
);
|
|
6888
|
+
return new Promise((resolve, reject) => {
|
|
6889
|
+
canvas.toBlob(
|
|
6890
|
+
(blob) => {
|
|
6891
|
+
if (blob) {
|
|
6892
|
+
resolve(blob);
|
|
6893
|
+
} else {
|
|
6894
|
+
reject(new Error("HazoUiImageCropper: canvas.toBlob returned null"));
|
|
6895
|
+
}
|
|
6896
|
+
},
|
|
6897
|
+
"image/webp",
|
|
6898
|
+
quality
|
|
6899
|
+
);
|
|
6900
|
+
});
|
|
6901
|
+
}
|
|
6902
|
+
var HazoUiImageCropper = React26.forwardRef(function HazoUiImageCropper2({
|
|
6903
|
+
imageSrc,
|
|
6904
|
+
onCropped,
|
|
6905
|
+
outputSize = 512,
|
|
6906
|
+
quality = 0.9,
|
|
6907
|
+
zoomLabel = "Zoom",
|
|
6908
|
+
className
|
|
6909
|
+
}, ref) {
|
|
6910
|
+
const [crop, set_crop] = React26.useState({
|
|
6911
|
+
x: 0,
|
|
6912
|
+
y: 0
|
|
6913
|
+
});
|
|
6914
|
+
const [zoom, set_zoom] = React26.useState(1);
|
|
6915
|
+
const cropped_area_pixels_ref = React26.useRef(null);
|
|
6916
|
+
const handle_crop_complete = React26.useCallback(
|
|
6917
|
+
(_croppedArea, croppedAreaPixels) => {
|
|
6918
|
+
cropped_area_pixels_ref.current = croppedAreaPixels;
|
|
6919
|
+
},
|
|
6920
|
+
[]
|
|
6921
|
+
);
|
|
6922
|
+
React26.useImperativeHandle(
|
|
6923
|
+
ref,
|
|
6924
|
+
() => ({
|
|
6925
|
+
getCroppedBlob: async () => {
|
|
6926
|
+
if (!cropped_area_pixels_ref.current) {
|
|
6927
|
+
throw new Error(
|
|
6928
|
+
"HazoUiImageCropper: crop area not yet initialised \u2014 wait for the cropper to mount before calling getCroppedBlob."
|
|
6929
|
+
);
|
|
6930
|
+
}
|
|
6931
|
+
const blob = await getCroppedImg(
|
|
6932
|
+
imageSrc,
|
|
6933
|
+
cropped_area_pixels_ref.current,
|
|
6934
|
+
outputSize,
|
|
6935
|
+
quality
|
|
6936
|
+
);
|
|
6937
|
+
await onCropped?.(blob);
|
|
6938
|
+
return blob;
|
|
6939
|
+
}
|
|
6940
|
+
}),
|
|
6941
|
+
[imageSrc, onCropped, outputSize, quality]
|
|
6942
|
+
);
|
|
6943
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("cls_image_cropper_root flex flex-col gap-4", className), children: [
|
|
6944
|
+
/* @__PURE__ */ jsx(
|
|
6945
|
+
"div",
|
|
6946
|
+
{
|
|
6947
|
+
className: "cls_cropper_stage relative w-full overflow-hidden rounded-lg bg-muted",
|
|
6948
|
+
style: { height: "320px" },
|
|
6949
|
+
children: /* @__PURE__ */ jsx(
|
|
6950
|
+
Cropper,
|
|
6951
|
+
{
|
|
6952
|
+
image: imageSrc,
|
|
6953
|
+
crop,
|
|
6954
|
+
zoom,
|
|
6955
|
+
aspect: 1,
|
|
6956
|
+
cropShape: "round",
|
|
6957
|
+
showGrid: false,
|
|
6958
|
+
onCropChange: set_crop,
|
|
6959
|
+
onZoomChange: set_zoom,
|
|
6960
|
+
onCropComplete: handle_crop_complete
|
|
6961
|
+
}
|
|
6962
|
+
)
|
|
6963
|
+
}
|
|
6964
|
+
),
|
|
6965
|
+
/* @__PURE__ */ jsxs("div", { className: "cls_zoom_control flex flex-col gap-1.5", children: [
|
|
6966
|
+
/* @__PURE__ */ jsx(
|
|
6967
|
+
"label",
|
|
6968
|
+
{
|
|
6969
|
+
className: "cls_zoom_label text-sm font-medium text-foreground",
|
|
6970
|
+
id: "hazo-cropper-zoom-label",
|
|
6971
|
+
children: zoomLabel
|
|
6972
|
+
}
|
|
6973
|
+
),
|
|
6974
|
+
/* @__PURE__ */ jsx(
|
|
6975
|
+
Slider,
|
|
6976
|
+
{
|
|
6977
|
+
"aria-labelledby": "hazo-cropper-zoom-label",
|
|
6978
|
+
min: 1,
|
|
6979
|
+
max: 3,
|
|
6980
|
+
step: 0.1,
|
|
6981
|
+
value: [zoom],
|
|
6982
|
+
onValueChange: (values) => set_zoom(values[0])
|
|
6983
|
+
}
|
|
6984
|
+
)
|
|
6985
|
+
] })
|
|
6986
|
+
] });
|
|
6987
|
+
});
|
|
6988
|
+
HazoUiImageCropper.displayName = "HazoUiImageCropper";
|
|
6989
|
+
function HazoUiImageCropperDialog({
|
|
6990
|
+
open,
|
|
6991
|
+
onOpenChange,
|
|
6992
|
+
file,
|
|
6993
|
+
onConfirm,
|
|
6994
|
+
onCancel,
|
|
6995
|
+
title = "Crop photo",
|
|
6996
|
+
confirmLabel = "Save",
|
|
6997
|
+
cancelLabel = "Cancel",
|
|
6998
|
+
zoomLabel = "Zoom",
|
|
6999
|
+
outputSize = 512,
|
|
7000
|
+
quality = 0.9
|
|
7001
|
+
}) {
|
|
7002
|
+
const cropper_ref = React26.useRef(null);
|
|
7003
|
+
const [image_src, set_image_src] = React26.useState(null);
|
|
7004
|
+
const [is_confirming, set_is_confirming] = React26.useState(false);
|
|
7005
|
+
React26.useEffect(() => {
|
|
7006
|
+
if (!file) {
|
|
7007
|
+
set_image_src(null);
|
|
7008
|
+
return;
|
|
7009
|
+
}
|
|
7010
|
+
const url = URL.createObjectURL(file);
|
|
7011
|
+
set_image_src(url);
|
|
7012
|
+
return () => {
|
|
7013
|
+
URL.revokeObjectURL(url);
|
|
7014
|
+
};
|
|
7015
|
+
}, [file]);
|
|
7016
|
+
const handle_confirm = async () => {
|
|
7017
|
+
if (!cropper_ref.current) return;
|
|
7018
|
+
set_is_confirming(true);
|
|
7019
|
+
try {
|
|
7020
|
+
const blob = await cropper_ref.current.getCroppedBlob();
|
|
7021
|
+
await onConfirm(blob);
|
|
7022
|
+
onOpenChange(false);
|
|
7023
|
+
} finally {
|
|
7024
|
+
set_is_confirming(false);
|
|
7025
|
+
}
|
|
7026
|
+
};
|
|
7027
|
+
return /* @__PURE__ */ jsx(
|
|
7028
|
+
HazoUiDialog,
|
|
7029
|
+
{
|
|
7030
|
+
open,
|
|
7031
|
+
onOpenChange,
|
|
7032
|
+
title,
|
|
7033
|
+
actionButtonText: confirmLabel,
|
|
7034
|
+
cancelButtonText: cancelLabel,
|
|
7035
|
+
onConfirm: handle_confirm,
|
|
7036
|
+
onCancel,
|
|
7037
|
+
actionButtonLoading: is_confirming,
|
|
7038
|
+
sizeWidth: "min(90vw, 520px)",
|
|
7039
|
+
contentClassName: "cls_image_cropper_dialog_body",
|
|
7040
|
+
children: image_src && /* @__PURE__ */ jsx(
|
|
7041
|
+
HazoUiImageCropper,
|
|
7042
|
+
{
|
|
7043
|
+
ref: cropper_ref,
|
|
7044
|
+
imageSrc: image_src,
|
|
7045
|
+
outputSize,
|
|
7046
|
+
quality,
|
|
7047
|
+
zoomLabel
|
|
7048
|
+
}
|
|
7049
|
+
)
|
|
7050
|
+
}
|
|
7051
|
+
);
|
|
7052
|
+
}
|
|
6848
7053
|
var Drawer = ({
|
|
6849
7054
|
shouldScaleBackground = true,
|
|
6850
7055
|
...props
|
|
@@ -7391,19 +7596,6 @@ function ButtonGroupText({ className, asChild = false, ...props }) {
|
|
|
7391
7596
|
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
7392
7597
|
return /* @__PURE__ */ jsx(Separator3, { orientation, className: cn("bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto", className), ...props });
|
|
7393
7598
|
}
|
|
7394
|
-
var Slider = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7395
|
-
SliderPrimitive.Root,
|
|
7396
|
-
{
|
|
7397
|
-
ref,
|
|
7398
|
-
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
7399
|
-
...props,
|
|
7400
|
-
children: [
|
|
7401
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
|
|
7402
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
|
|
7403
|
-
]
|
|
7404
|
-
}
|
|
7405
|
-
));
|
|
7406
|
-
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
7407
7599
|
var InputAffix = React26.forwardRef(
|
|
7408
7600
|
({ className, containerClassName, prefix, suffix, type = "text", ...props }, ref) => {
|
|
7409
7601
|
return /* @__PURE__ */ jsxs(
|
|
@@ -10515,6 +10707,6 @@ function HazoUiEtaProgress({
|
|
|
10515
10707
|
);
|
|
10516
10708
|
}
|
|
10517
10709
|
|
|
10518
|
-
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiKanban, HazoUiKanbanFilter, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LoadingTimeout, MarkdownEditor, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
|
10710
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiImageCropper, HazoUiImageCropperDialog, HazoUiKanban, HazoUiKanbanFilter, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LoadingTimeout, MarkdownEditor, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
|
|
10519
10711
|
//# sourceMappingURL=index.js.map
|
|
10520
10712
|
//# sourceMappingURL=index.js.map
|