@choco-vanille/ui 1.15.1 → 1.17.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/components/_common/rotating-chevron/styles/RotatingChevron.css.cjs +1 -1
- package/dist/components/_common/rotating-chevron/styles/RotatingChevron.css.js +1 -1
- package/dist/components/actions/_shared/buttons/styles/buttonShared.css.cjs +1 -1
- package/dist/components/actions/_shared/buttons/styles/buttonShared.css.js +1 -1
- package/dist/components/actions/button/styles/Button.css.cjs +1 -1
- package/dist/components/actions/button/styles/Button.css.js +1 -1
- package/dist/components/actions/icon-button/styles/IconButton.css.cjs +1 -1
- package/dist/components/actions/icon-button/styles/IconButton.css.js +1 -1
- package/dist/components/actions/toggle/styles/Toggle.css.cjs +1 -1
- package/dist/components/actions/toggle/styles/Toggle.css.js +1 -1
- package/dist/components/actions/toggle-group/styles/ToggleGroup.css.cjs +1 -1
- package/dist/components/actions/toggle-group/styles/ToggleGroup.css.js +1 -1
- package/dist/components/data-display/avatar/components/avatar-fallback/styles/AvatarFallback.css.cjs +1 -1
- package/dist/components/data-display/avatar/components/avatar-fallback/styles/AvatarFallback.css.js +1 -1
- package/dist/components/data-display/avatar/components/avatar-image/styles/AvatarImage.css.cjs +1 -1
- package/dist/components/data-display/avatar/components/avatar-image/styles/AvatarImage.css.js +1 -1
- package/dist/components/data-display/avatar/components/avatar-root/styles/AvatarRoot.css.cjs +1 -1
- package/dist/components/data-display/avatar/components/avatar-root/styles/AvatarRoot.css.js +1 -1
- package/dist/components/data-display/avatar/components/avatar-status/styles/AvatarStatus.css.cjs +1 -1
- package/dist/components/data-display/avatar/components/avatar-status/styles/AvatarStatus.css.js +1 -1
- package/dist/components/data-display/badge/styles/Badge.css.cjs +1 -1
- package/dist/components/data-display/badge/styles/Badge.css.js +1 -1
- package/dist/components/data-display/rich-text-renderer/styles/RichTextRenderer.css.cjs +1 -1
- package/dist/components/data-display/rich-text-renderer/styles/RichTextRenderer.css.js +1 -1
- package/dist/components/data-display/status-badge/styles/StatusBadge.css.cjs +1 -1
- package/dist/components/data-display/status-badge/styles/StatusBadge.css.js +1 -1
- package/dist/components/data-display/table/components/table-body/styles/TableBody.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-body/styles/TableBody.css.js +1 -1
- package/dist/components/data-display/table/components/table-caption/styles/TableCaption.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-caption/styles/TableCaption.css.js +1 -1
- package/dist/components/data-display/table/components/table-cell/styles/TableCell.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-cell/styles/TableCell.css.js +1 -1
- package/dist/components/data-display/table/components/table-footer/styles/TableFooter.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-footer/styles/TableFooter.css.js +1 -1
- package/dist/components/data-display/table/components/table-head/styles/TableHead.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-head/styles/TableHead.css.js +1 -1
- package/dist/components/data-display/table/components/table-header/styles/TableHeader.css.cjs +1 -1
- package/dist/components/data-display/table/components/table-header/styles/TableHeader.css.js +1 -1
- package/dist/components/data-display/table/styles/Table.css.cjs +1 -1
- package/dist/components/data-display/table/styles/Table.css.js +1 -1
- package/dist/components/feedback/callout/components/callout-icon/styles/CalloutIcon.css.cjs +1 -1
- package/dist/components/feedback/callout/components/callout-icon/styles/CalloutIcon.css.js +1 -1
- package/dist/components/feedback/callout/styles/Callout.css.cjs +1 -1
- package/dist/components/feedback/callout/styles/Callout.css.js +1 -1
- package/dist/components/feedback/empty-state/styles/EmptyState.css.cjs +1 -1
- package/dist/components/feedback/empty-state/styles/EmptyState.css.js +1 -1
- package/dist/components/feedback/progress/styles/Progress.css.cjs +1 -1
- package/dist/components/feedback/progress/styles/Progress.css.js +1 -1
- package/dist/components/feedback/skeleton/styles/Skeleton.css.cjs +1 -1
- package/dist/components/feedback/skeleton/styles/Skeleton.css.js +1 -1
- package/dist/components/feedback/spinner/styles/Spinner.css.cjs +1 -1
- package/dist/components/feedback/spinner/styles/Spinner.css.js +1 -1
- package/dist/components/feedback/toast/Toast.cjs +1 -1
- package/dist/components/feedback/toast/Toast.js +1 -1
- package/dist/components/feedback/toast/components/toast-actions/styles/ToastActions.css.cjs +1 -1
- package/dist/components/feedback/toast/components/toast-actions/styles/ToastActions.css.js +1 -1
- package/dist/components/feedback/toast/components/toast-close/styles/ToastClose.css.cjs +1 -1
- package/dist/components/feedback/toast/components/toast-close/styles/ToastClose.css.js +1 -1
- package/dist/components/feedback/toast/components/toast-description/styles/ToastDescription.css.cjs +1 -1
- package/dist/components/feedback/toast/components/toast-description/styles/ToastDescription.css.js +1 -1
- package/dist/components/feedback/toast/components/toast-icon/styles/ToastIcon.css.cjs +1 -1
- package/dist/components/feedback/toast/components/toast-icon/styles/ToastIcon.css.js +1 -1
- package/dist/components/feedback/toast/components/toast-title/styles/ToastTitle.css.cjs +1 -1
- package/dist/components/feedback/toast/components/toast-title/styles/ToastTitle.css.js +1 -1
- package/dist/components/feedback/toast/styles/Toast.css.cjs +1 -1
- package/dist/components/feedback/toast/styles/Toast.css.js +1 -1
- package/dist/components/forms/_shared/components/form-label/styles/FormLabel.css.cjs +1 -1
- package/dist/components/forms/_shared/components/form-label/styles/FormLabel.css.js +1 -1
- package/dist/components/forms/_shared/components/helper-text/HelperText.css.cjs +1 -1
- package/dist/components/forms/_shared/components/helper-text/HelperText.css.js +1 -1
- package/dist/components/forms/_shared/styles/checkboxVisual.css.cjs +1 -1
- package/dist/components/forms/_shared/styles/checkboxVisual.css.js +1 -1
- package/dist/components/forms/_shared/styles/radioVisual.css.cjs +1 -1
- package/dist/components/forms/_shared/styles/radioVisual.css.js +1 -1
- package/dist/components/forms/autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/forms/autocomplete/Autocomplete.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-content/styles/AutocompleteContent.css.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-content/styles/AutocompleteContent.css.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-field/AutocompleteField.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-field/AutocompleteField.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-input/AutocompleteInput.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-input/AutocompleteInput.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-input/styles/AutocompleteInput.css.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-input/styles/AutocompleteInput.css.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-item/styles/AutocompleteItem.css.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-item/styles/AutocompleteItem.css.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-separator/styles/AutocompleteSeparator.css.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-separator/styles/AutocompleteSeparator.css.js +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-trigger/styles/AutocompleteTrigger.css.cjs +1 -1
- package/dist/components/forms/autocomplete/components/autocomplete-trigger/styles/AutocompleteTrigger.css.js +1 -1
- package/dist/components/forms/autocomplete/styles/Autocomplete.css.cjs +1 -1
- package/dist/components/forms/autocomplete/styles/Autocomplete.css.js +1 -1
- package/dist/components/forms/calendar/Calendar.cjs +1 -1
- package/dist/components/forms/calendar/Calendar.js +1 -1
- package/dist/components/forms/calendar/components/calendar-caption/styles/CalendarCaption.css.cjs +1 -1
- package/dist/components/forms/calendar/components/calendar-caption/styles/CalendarCaption.css.js +1 -1
- package/dist/components/forms/calendar/components/calendar-month-view/components/calendar-month-button/CalendarMonthButton.cjs +1 -1
- package/dist/components/forms/calendar/components/calendar-month-view/components/calendar-month-button/CalendarMonthButton.cjs.map +1 -1
- package/dist/components/forms/calendar/components/calendar-month-view/components/calendar-month-button/CalendarMonthButton.js +5 -1
- package/dist/components/forms/calendar/components/calendar-month-view/components/calendar-month-button/CalendarMonthButton.js.map +1 -1
- package/dist/components/forms/calendar/components/calendar-month-view/styles/CalendarMonthView.css.cjs +1 -1
- package/dist/components/forms/calendar/components/calendar-month-view/styles/CalendarMonthView.css.js +1 -1
- package/dist/components/forms/calendar/components/calendar-year-view/components/calendar-year-button/CalendarYearButton.cjs +1 -1
- package/dist/components/forms/calendar/components/calendar-year-view/components/calendar-year-button/CalendarYearButton.cjs.map +1 -1
- package/dist/components/forms/calendar/components/calendar-year-view/components/calendar-year-button/CalendarYearButton.js +5 -1
- package/dist/components/forms/calendar/components/calendar-year-view/components/calendar-year-button/CalendarYearButton.js.map +1 -1
- package/dist/components/forms/calendar/components/calendar-year-view/styles/CalendarYearView.css.cjs +1 -1
- package/dist/components/forms/calendar/components/calendar-year-view/styles/CalendarYearView.css.js +1 -1
- package/dist/components/forms/calendar/styles/calendarDayButton.css.cjs +1 -1
- package/dist/components/forms/calendar/styles/calendarDayButton.css.js +1 -1
- package/dist/components/forms/calendar/styles/calendarGrid.css.cjs +1 -1
- package/dist/components/forms/calendar/styles/calendarGrid.css.js +1 -1
- package/dist/components/forms/calendar/styles/calendarRoot.css.cjs +1 -1
- package/dist/components/forms/calendar/styles/calendarRoot.css.js +1 -1
- package/dist/components/forms/checkbox/styles/Checkbox.css.cjs +1 -1
- package/dist/components/forms/checkbox/styles/Checkbox.css.js +1 -1
- package/dist/components/forms/date-picker/DatePicker.cjs +1 -1
- package/dist/components/forms/date-picker/DatePicker.js +1 -1
- package/dist/components/forms/date-picker/styles/DatePicker.css.cjs +1 -1
- package/dist/components/forms/date-picker/styles/DatePicker.css.js +1 -1
- package/dist/components/forms/image-picker/ImagePicker.cjs +2 -0
- package/dist/components/forms/image-picker/ImagePicker.cjs.map +1 -0
- package/dist/components/forms/image-picker/ImagePicker.d.ts +33 -0
- package/dist/components/forms/image-picker/ImagePicker.js +198 -0
- package/dist/components/forms/image-picker/ImagePicker.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/ImagePickerActions.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/ImagePickerActions.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/ImagePickerActions.d.ts +3 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/ImagePickerActions.js +50 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/ImagePickerActions.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-actions/types/ImagePickerActions.props.d.ts +10 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/ImagePickerCropDialog.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/ImagePickerCropDialog.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/ImagePickerCropDialog.d.ts +9 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/ImagePickerCropDialog.js +165 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/ImagePickerCropDialog.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/index.d.ts +1 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/styles/ImagePickerCropDialog.css.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/styles/ImagePickerCropDialog.css.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/styles/ImagePickerCropDialog.css.d.ts +4 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/styles/ImagePickerCropDialog.css.js +7 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/styles/ImagePickerCropDialog.css.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-crop-dialog/types/ImagePickerCropDialog.props.d.ts +18 -0
- package/dist/components/forms/image-picker/components/image-picker-input/ImagePickerInput.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-input/ImagePickerInput.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-input/ImagePickerInput.d.ts +3 -0
- package/dist/components/forms/image-picker/components/image-picker-input/ImagePickerInput.js +34 -0
- package/dist/components/forms/image-picker/components/image-picker-input/ImagePickerInput.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-input/types/ImagePickerInput.props.d.ts +11 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/ImagePickerPreview.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/ImagePickerPreview.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/ImagePickerPreview.d.ts +3 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/ImagePickerPreview.js +136 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/ImagePickerPreview.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-preview/types/ImagePickerPreview.props.d.ts +28 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/ImagePickerRemoveButton.cjs +2 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/ImagePickerRemoveButton.cjs.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/ImagePickerRemoveButton.d.ts +3 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/ImagePickerRemoveButton.js +30 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/ImagePickerRemoveButton.js.map +1 -0
- package/dist/components/forms/image-picker/components/image-picker-remove-button/types/ImagePickerRemoveButton.props.d.ts +7 -0
- package/dist/components/forms/image-picker/components/index.d.ts +5 -0
- package/dist/components/forms/image-picker/constants/imagePickerDefaults.const.cjs +2 -0
- package/dist/components/forms/image-picker/constants/imagePickerDefaults.const.cjs.map +1 -0
- package/dist/components/forms/image-picker/constants/imagePickerDefaults.const.d.ts +4 -0
- package/dist/components/forms/image-picker/constants/imagePickerDefaults.const.js +24 -0
- package/dist/components/forms/image-picker/constants/imagePickerDefaults.const.js.map +1 -0
- package/dist/components/forms/image-picker/constants/imagePickerShapes.const.cjs +2 -0
- package/dist/components/forms/image-picker/constants/imagePickerShapes.const.cjs.map +1 -0
- package/dist/components/forms/image-picker/constants/imagePickerShapes.const.d.ts +6 -0
- package/dist/components/forms/image-picker/constants/imagePickerShapes.const.js +8 -0
- package/dist/components/forms/image-picker/constants/imagePickerShapes.const.js.map +1 -0
- package/dist/components/forms/image-picker/constants/index.d.ts +1 -0
- package/dist/components/forms/image-picker/hooks/types/index.d.ts +79 -0
- package/dist/components/forms/image-picker/hooks/useImagePicker.hook.cjs +2 -0
- package/dist/components/forms/image-picker/hooks/useImagePicker.hook.cjs.map +1 -0
- package/dist/components/forms/image-picker/hooks/useImagePicker.hook.d.ts +11 -0
- package/dist/components/forms/image-picker/hooks/useImagePicker.hook.js +132 -0
- package/dist/components/forms/image-picker/hooks/useImagePicker.hook.js.map +1 -0
- package/dist/components/forms/image-picker/hooks/useImagePickerCrop.hook.cjs +2 -0
- package/dist/components/forms/image-picker/hooks/useImagePickerCrop.hook.cjs.map +1 -0
- package/dist/components/forms/image-picker/hooks/useImagePickerCrop.hook.d.ts +8 -0
- package/dist/components/forms/image-picker/hooks/useImagePickerCrop.hook.js +69 -0
- package/dist/components/forms/image-picker/hooks/useImagePickerCrop.hook.js.map +1 -0
- package/dist/components/forms/image-picker/index.d.ts +4 -0
- package/dist/components/forms/image-picker/styles/ImagePicker.css.cjs +2 -0
- package/dist/components/forms/image-picker/styles/ImagePicker.css.cjs.map +1 -0
- package/dist/components/forms/image-picker/styles/ImagePicker.css.d.ts +47 -0
- package/dist/components/forms/image-picker/styles/ImagePicker.css.js +8 -0
- package/dist/components/forms/image-picker/styles/ImagePicker.css.js.map +1 -0
- package/dist/components/forms/image-picker/types/ImagePicker.props.d.ts +81 -0
- package/dist/components/forms/image-picker/types/ImagePicker.types.d.ts +50 -0
- package/dist/components/forms/image-picker/types/index.d.ts +2 -0
- package/dist/components/forms/image-picker/utils/imagePicker.utils.cjs +2 -0
- package/dist/components/forms/image-picker/utils/imagePicker.utils.cjs.map +1 -0
- package/dist/components/forms/image-picker/utils/imagePicker.utils.d.ts +62 -0
- package/dist/components/forms/image-picker/utils/imagePicker.utils.js +81 -0
- package/dist/components/forms/image-picker/utils/imagePicker.utils.js.map +1 -0
- package/dist/components/forms/index.d.ts +1 -0
- package/dist/components/forms/number-field/components/number-field-input/styles/NumberFieldInput.css.cjs +1 -1
- package/dist/components/forms/number-field/components/number-field-input/styles/NumberFieldInput.css.js +1 -1
- package/dist/components/forms/number-field/components/number-field-steppers/styles/NumberFieldSteppers.css.cjs +1 -1
- package/dist/components/forms/number-field/components/number-field-steppers/styles/NumberFieldSteppers.css.js +1 -1
- package/dist/components/forms/number-field/styles/NumberField.css.cjs +1 -1
- package/dist/components/forms/number-field/styles/NumberField.css.js +1 -1
- package/dist/components/forms/radio-group/components/radio-item/styles/RadioItem.css.cjs +1 -1
- package/dist/components/forms/radio-group/components/radio-item/styles/RadioItem.css.js +1 -1
- package/dist/components/forms/rich-text-editor/RichTextEditor.cjs +1 -1
- package/dist/components/forms/rich-text-editor/RichTextEditor.js +1 -1
- package/dist/components/forms/rich-text-editor/RichTextEditorField.cjs +1 -1
- package/dist/components/forms/rich-text-editor/RichTextEditorField.js +1 -1
- package/dist/components/forms/rich-text-editor/components/alignment-group/AlignmentGroup.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/alignment-group/AlignmentGroup.js +1 -1
- package/dist/components/forms/rich-text-editor/components/alignment-group/styles/AlignmentGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/alignment-group/styles/AlignmentGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/block-format-group/BlockFormatGroup.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/block-format-group/BlockFormatGroup.js +1 -1
- package/dist/components/forms/rich-text-editor/components/block-format-group/styles/BlockFormatGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/block-format-group/styles/BlockFormatGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/editor-field/EditorField.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/editor-field/EditorField.js +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/Redo.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/Redo.js +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/Undo.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/Undo.js +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/styles/HistoryGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/history-group/styles/HistoryGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/image-group/ImageGroup.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/image-group/ImageGroup.js +1 -1
- package/dist/components/forms/rich-text-editor/components/image-group/styles/ImageGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/image-group/styles/ImageGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/LinkGroup.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/LinkGroup.js +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/SetLink.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/SetLink.js +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/UnsetLink.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/UnsetLink.js +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/styles/LinkGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/link-group/styles/LinkGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/lists-group/ListsGroup.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/lists-group/ListsGroup.js +1 -1
- package/dist/components/forms/rich-text-editor/components/lists-group/styles/ListsGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/lists-group/styles/ListsGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/read-only-field/ReadOnlyField.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/read-only-field/ReadOnlyField.js +1 -1
- package/dist/components/forms/rich-text-editor/components/rich-text-editor-form-field/styles/RichTextEditorFormField.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/rich-text-editor-form-field/styles/RichTextEditorFormField.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/rich-text-editor-label/styles/RichTextEditorLabel.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/rich-text-editor-label/styles/RichTextEditorLabel.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/TextColorMenu.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/TextColorMenu.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextAppearanceGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextAppearanceGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextColorMenu.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextColorMenu.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextSizeMenu.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-appearance-group/styles/TextSizeMenu.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-style-group/TextStyleAction.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-style-group/TextStyleAction.js +1 -1
- package/dist/components/forms/rich-text-editor/components/text-style-group/styles/TextStyleGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/text-style-group/styles/TextStyleGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar/styles/Toolbar.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar/styles/Toolbar.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar-group/styles/ToolbarGroup.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar-group/styles/ToolbarGroup.css.js +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar-separator/styles/ToolbarSeparator.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/components/toolbar-separator/styles/ToolbarSeparator.css.js +1 -1
- package/dist/components/forms/rich-text-editor/styles/RichTextEditor.css.cjs +1 -1
- package/dist/components/forms/rich-text-editor/styles/RichTextEditor.css.js +1 -1
- package/dist/components/forms/select/Select.cjs +1 -1
- package/dist/components/forms/select/Select.js +1 -1
- package/dist/components/forms/select/components/select-content/styles/SelectContent.css.cjs +1 -1
- package/dist/components/forms/select/components/select-content/styles/SelectContent.css.js +1 -1
- package/dist/components/forms/select/components/select-item/styles/SelectItem.css.cjs +1 -1
- package/dist/components/forms/select/components/select-item/styles/SelectItem.css.js +1 -1
- package/dist/components/forms/select/components/select-label/styles/SelectLabel.css.cjs +1 -1
- package/dist/components/forms/select/components/select-label/styles/SelectLabel.css.js +1 -1
- package/dist/components/forms/select/components/select-separator/styles/SelectSeparator.css.cjs +1 -1
- package/dist/components/forms/select/components/select-separator/styles/SelectSeparator.css.js +1 -1
- package/dist/components/forms/select/components/select-trigger/SelectTrigger.cjs +1 -1
- package/dist/components/forms/select/components/select-trigger/SelectTrigger.js +1 -1
- package/dist/components/forms/select/components/select-trigger/styles/SelectTrigger.css.cjs +1 -1
- package/dist/components/forms/select/components/select-trigger/styles/SelectTrigger.css.js +1 -1
- package/dist/components/forms/select/styles/Select.css.cjs +1 -1
- package/dist/components/forms/select/styles/Select.css.js +1 -1
- package/dist/components/forms/slider/components/slider-header/styles/SliderHeader.css.cjs +1 -1
- package/dist/components/forms/slider/components/slider-header/styles/SliderHeader.css.js +1 -1
- package/dist/components/forms/slider/components/slider-track/styles/SliderTrack.css.cjs +1 -1
- package/dist/components/forms/slider/components/slider-track/styles/SliderTrack.css.js +1 -1
- package/dist/components/forms/slider/styles/Slider.css.cjs +1 -1
- package/dist/components/forms/slider/styles/Slider.css.js +1 -1
- package/dist/components/forms/switch/styles/Switch.css.cjs +1 -1
- package/dist/components/forms/switch/styles/Switch.css.js +1 -1
- package/dist/components/forms/text-area/TextArea.cjs +1 -1
- package/dist/components/forms/text-area/TextArea.js +1 -1
- package/dist/components/forms/text-area/components/text-area-end-action/styles/TextAreaEndAction.css.cjs +1 -1
- package/dist/components/forms/text-area/components/text-area-end-action/styles/TextAreaEndAction.css.js +1 -1
- package/dist/components/forms/text-area/components/text-area-start-icon/styles/TextAreaStartIcon.css.cjs +1 -1
- package/dist/components/forms/text-area/components/text-area-start-icon/styles/TextAreaStartIcon.css.js +1 -1
- package/dist/components/forms/text-area/styles/TextArea.css.cjs +1 -1
- package/dist/components/forms/text-area/styles/TextArea.css.js +1 -1
- package/dist/components/forms/text-field/TextField.cjs +1 -1
- package/dist/components/forms/text-field/TextField.js +1 -1
- package/dist/components/forms/text-field/components/text-field-start-icon/styles/TextFieldStartIcon.css.cjs +1 -1
- package/dist/components/forms/text-field/components/text-field-start-icon/styles/TextFieldStartIcon.css.js +1 -1
- package/dist/components/forms/text-field/styles/TextField.css.cjs +1 -1
- package/dist/components/forms/text-field/styles/TextField.css.js +1 -1
- package/dist/components/foundation/icon/styles/Icon.css.cjs +1 -1
- package/dist/components/foundation/icon/styles/Icon.css.js +1 -1
- package/dist/components/foundation/typography/styles/Typography.css.cjs +1 -1
- package/dist/components/foundation/typography/styles/Typography.css.js +1 -1
- package/dist/components/layout/box/styles/Box.css.cjs +1 -1
- package/dist/components/layout/box/styles/Box.css.js +1 -1
- package/dist/components/layout/fieldset/styles/Fieldset.css.cjs +1 -1
- package/dist/components/layout/fieldset/styles/Fieldset.css.js +1 -1
- package/dist/components/layout/flex/styles/Flex.css.cjs +1 -1
- package/dist/components/layout/flex/styles/Flex.css.js +1 -1
- package/dist/components/layout/form/styles/Form.css.cjs +1 -1
- package/dist/components/layout/form/styles/Form.css.js +1 -1
- package/dist/components/layout/grid/styles/Grid.css.cjs +1 -1
- package/dist/components/layout/grid/styles/Grid.css.js +1 -1
- package/dist/components/layout/image/styles/Image.css.cjs +1 -1
- package/dist/components/layout/image/styles/Image.css.js +1 -1
- package/dist/components/layout/inset/styles/Inset.css.cjs +1 -1
- package/dist/components/layout/inset/styles/Inset.css.js +1 -1
- package/dist/components/layout/legend/styles/Legend.css.cjs +1 -1
- package/dist/components/layout/legend/styles/Legend.css.js +1 -1
- package/dist/components/layout/separator/styles/Separator.css.cjs +1 -1
- package/dist/components/layout/separator/styles/Separator.css.js +1 -1
- package/dist/components/layout/svg-image/styles/SvgImage.css.cjs +1 -1
- package/dist/components/layout/svg-image/styles/SvgImage.css.js +1 -1
- package/dist/components/navigation/bottom-navigation/BottomNavigation.cjs +2 -0
- package/dist/components/navigation/bottom-navigation/BottomNavigation.cjs.map +1 -0
- package/dist/components/navigation/bottom-navigation/BottomNavigation.d.ts +10 -0
- package/dist/components/navigation/bottom-navigation/BottomNavigation.js +56 -0
- package/dist/components/navigation/bottom-navigation/BottomNavigation.js.map +1 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.cjs +2 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.cjs.map +1 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.d.ts +9 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.js +95 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/BottomNavigationItem.js.map +1 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/index.d.ts +2 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-item/types/BottomNavigationItem.props.d.ts +36 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.cjs +2 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.cjs.map +1 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.d.ts +8 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.js +27 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/BottomNavigationList.js.map +1 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/index.d.ts +2 -0
- package/dist/components/navigation/bottom-navigation/components/bottom-navigation-list/types/BottomNavigationList.props.d.ts +12 -0
- package/dist/components/navigation/bottom-navigation/context/BottomNavigation.context.cjs +2 -0
- package/dist/components/navigation/bottom-navigation/context/BottomNavigation.context.cjs.map +1 -0
- package/dist/components/navigation/bottom-navigation/context/BottomNavigation.context.d.ts +6 -0
- package/dist/components/navigation/bottom-navigation/context/BottomNavigation.context.js +6 -0
- package/dist/components/navigation/bottom-navigation/context/BottomNavigation.context.js.map +1 -0
- package/dist/components/navigation/bottom-navigation/index.d.ts +5 -0
- package/dist/components/navigation/bottom-navigation/styles/BottomNavigation.css.cjs +2 -0
- package/dist/components/navigation/bottom-navigation/styles/BottomNavigation.css.cjs.map +1 -0
- package/dist/components/navigation/bottom-navigation/styles/BottomNavigation.css.d.ts +9 -0
- package/dist/components/navigation/bottom-navigation/styles/BottomNavigation.css.js +7 -0
- package/dist/components/navigation/bottom-navigation/styles/BottomNavigation.css.js.map +1 -0
- package/dist/components/navigation/bottom-navigation/types/BottomNavigation.props.d.ts +15 -0
- package/dist/components/navigation/bottom-navigation/types/BottomNavigationCompound.d.ts +8 -0
- package/dist/components/navigation/bottom-navigation/types/index.d.ts +2 -0
- package/dist/components/navigation/breadcrumbs/styles/Breadcrumbs.css.cjs +1 -1
- package/dist/components/navigation/breadcrumbs/styles/Breadcrumbs.css.js +1 -1
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/navigation/link/styles/Link.css.cjs +1 -1
- package/dist/components/navigation/link/styles/Link.css.js +1 -1
- package/dist/components/navigation/pagination/styles/Pagination.css.cjs +1 -1
- package/dist/components/navigation/pagination/styles/Pagination.css.js +1 -1
- package/dist/components/navigation/step-indicator/components/step-indicator-item/styles/StepIndicatorItem.css.cjs +1 -1
- package/dist/components/navigation/step-indicator/components/step-indicator-item/styles/StepIndicatorItem.css.js +1 -1
- package/dist/components/navigation/step-indicator/styles/StepIndicator.css.cjs +1 -1
- package/dist/components/navigation/step-indicator/styles/StepIndicator.css.js +1 -1
- package/dist/components/navigation/stepper/styles/Stepper.css.cjs +1 -1
- package/dist/components/navigation/stepper/styles/Stepper.css.js +1 -1
- package/dist/components/navigation/tabs/components/tabs-content/styles/TabsContent.css.cjs +1 -1
- package/dist/components/navigation/tabs/components/tabs-content/styles/TabsContent.css.js +1 -1
- package/dist/components/navigation/tabs/components/tabs-list/styles/TabsList.css.cjs +1 -1
- package/dist/components/navigation/tabs/components/tabs-list/styles/TabsList.css.js +1 -1
- package/dist/components/navigation/tabs/components/tabs-trigger/styles/TabsTrigger.css.cjs +1 -1
- package/dist/components/navigation/tabs/components/tabs-trigger/styles/TabsTrigger.css.js +1 -1
- package/dist/components/overlay/_shared/styles/OverlayBackdrop.css.cjs +1 -1
- package/dist/components/overlay/_shared/styles/OverlayBackdrop.css.js +1 -1
- package/dist/components/overlay/alert-dialog/AlertDialog.cjs +1 -1
- package/dist/components/overlay/alert-dialog/AlertDialog.js +1 -1
- package/dist/components/overlay/alert-dialog/styles/AlertDialog.css.cjs +1 -1
- package/dist/components/overlay/alert-dialog/styles/AlertDialog.css.js +1 -1
- package/dist/components/overlay/command/components/command-empty/styles/CommandEmpty.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-empty/styles/CommandEmpty.css.js +1 -1
- package/dist/components/overlay/command/components/command-group/styles/CommandGroup.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-group/styles/CommandGroup.css.js +1 -1
- package/dist/components/overlay/command/components/command-input/styles/CommandInput.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-input/styles/CommandInput.css.js +1 -1
- package/dist/components/overlay/command/components/command-item/styles/CommandItem.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-item/styles/CommandItem.css.js +1 -1
- package/dist/components/overlay/command/components/command-list/styles/CommandList.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-list/styles/CommandList.css.js +1 -1
- package/dist/components/overlay/command/components/command-separator/styles/CommandSeparator.css.cjs +1 -1
- package/dist/components/overlay/command/components/command-separator/styles/CommandSeparator.css.js +1 -1
- package/dist/components/overlay/command/styles/Command.css.cjs +1 -1
- package/dist/components/overlay/command/styles/Command.css.js +1 -1
- package/dist/components/overlay/context-menu/components/content/styles/ContextMenuContent.css.cjs +1 -1
- package/dist/components/overlay/context-menu/components/content/styles/ContextMenuContent.css.js +1 -1
- package/dist/components/overlay/dialog/components/dialog-header/styles/DialogHeader.css.cjs +1 -1
- package/dist/components/overlay/dialog/components/dialog-header/styles/DialogHeader.css.js +1 -1
- package/dist/components/overlay/dialog/styles/Dialog.css.cjs +1 -1
- package/dist/components/overlay/dialog/styles/Dialog.css.js +1 -1
- package/dist/components/overlay/drawer/components/items/_shared/components/drawer-item-content/DrawerItemContent.cjs +1 -1
- package/dist/components/overlay/drawer/components/items/_shared/components/drawer-item-content/DrawerItemContent.js +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-action-item/DrawerActionItem.cjs +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-action-item/DrawerActionItem.cjs.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-action-item/DrawerActionItem.js +5 -1
- package/dist/components/overlay/drawer/components/items/drawer-action-item/DrawerActionItem.js.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-nav-item/DrawerNavItem.cjs +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-nav-item/DrawerNavItem.cjs.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-nav-item/DrawerNavItem.js +5 -1
- package/dist/components/overlay/drawer/components/items/drawer-nav-item/DrawerNavItem.js.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/DrawerSectionItem.cjs +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/DrawerSectionItem.cjs.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/DrawerSectionItem.js +5 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/DrawerSectionItem.js.map +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/styles/DrawerSectionItem.css.cjs +1 -1
- package/dist/components/overlay/drawer/components/items/drawer-section-item/styles/DrawerSectionItem.css.js +1 -1
- package/dist/components/overlay/drawer/components/variants/drawer-inline/styles/DrawerInline.css.cjs +1 -1
- package/dist/components/overlay/drawer/components/variants/drawer-inline/styles/DrawerInline.css.js +1 -1
- package/dist/components/overlay/drawer/components/variants/drawer-mini/styles/DrawerMini.css.cjs +1 -1
- package/dist/components/overlay/drawer/components/variants/drawer-mini/styles/DrawerMini.css.js +1 -1
- package/dist/components/overlay/drawer/styles/Drawer.css.cjs +1 -1
- package/dist/components/overlay/drawer/styles/Drawer.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/_shared/item.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/_shared/item.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/content/styles/DropdownMenuContent.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/content/styles/DropdownMenuContent.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/label/styles/DropdownMenuLabel.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/label/styles/DropdownMenuLabel.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/separator/styles/DropdownMenuSeparator.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/separator/styles/DropdownMenuSeparator.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/shortcut/styles/DropdownMenuShortcut.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/shortcut/styles/DropdownMenuShortcut.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/sub/dropdown-menu-sub-content/styles/DropdownMenuSubContent.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/sub/dropdown-menu-sub-content/styles/DropdownMenuSubContent.css.js +1 -1
- package/dist/components/overlay/dropdown-menu/components/sub/dropdown-menu-sub-trigger/styles/DropdownMenuSubTrigger.css.cjs +1 -1
- package/dist/components/overlay/dropdown-menu/components/sub/dropdown-menu-sub-trigger/styles/DropdownMenuSubTrigger.css.js +1 -1
- package/dist/components/overlay/panel/components/panel-header/styles/PanelHeader.css.cjs +1 -1
- package/dist/components/overlay/panel/components/panel-header/styles/PanelHeader.css.js +1 -1
- package/dist/components/overlay/panel/styles/Panel.css.cjs +1 -1
- package/dist/components/overlay/panel/styles/Panel.css.js +1 -1
- package/dist/components/overlay/popover/components/content/styles/PopoverContent.css.cjs +1 -1
- package/dist/components/overlay/popover/components/content/styles/PopoverContent.css.js +1 -1
- package/dist/components/overlay/popover/components/item/styles/PopoverItem.css.cjs +1 -1
- package/dist/components/overlay/popover/components/item/styles/PopoverItem.css.js +1 -1
- package/dist/components/overlay/tooltip/styles/Tooltip.css.cjs +1 -1
- package/dist/components/overlay/tooltip/styles/Tooltip.css.js +1 -1
- package/dist/components/surfaces/accordion/components/accordion-content/styles/AccordionContent.css.cjs +1 -1
- package/dist/components/surfaces/accordion/components/accordion-content/styles/AccordionContent.css.js +1 -1
- package/dist/components/surfaces/accordion/components/accordion-item/styles/AccordionItem.css.cjs +1 -1
- package/dist/components/surfaces/accordion/components/accordion-item/styles/AccordionItem.css.js +1 -1
- package/dist/components/surfaces/accordion/components/accordion-trigger/AccordionTrigger.cjs +1 -1
- package/dist/components/surfaces/accordion/components/accordion-trigger/AccordionTrigger.js +1 -1
- package/dist/components/surfaces/accordion/components/accordion-trigger/styles/AccordionTrigger.css.cjs +1 -1
- package/dist/components/surfaces/accordion/components/accordion-trigger/styles/AccordionTrigger.css.js +1 -1
- package/dist/components/surfaces/accordion/styles/Accordion.css.cjs +1 -1
- package/dist/components/surfaces/accordion/styles/Accordion.css.js +1 -1
- package/dist/components/surfaces/card/components/card-header/styles/CardHeader.css.cjs +1 -1
- package/dist/components/surfaces/card/components/card-header/styles/CardHeader.css.js +1 -1
- package/dist/components/surfaces/card/styles/Card.css.cjs +1 -1
- package/dist/components/surfaces/card/styles/Card.css.js +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-panel/styles/CollapsiblePanel.css.cjs +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-panel/styles/CollapsiblePanel.css.js +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-trigger/CollapsibleTrigger.cjs +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-trigger/CollapsibleTrigger.js +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-trigger/styles/CollapsibleTrigger.css.cjs +1 -1
- package/dist/components/surfaces/collapsible/components/collapsible-trigger/styles/CollapsibleTrigger.css.js +1 -1
- package/dist/components/surfaces/collapsible/styles/Collapsible.css.cjs +1 -1
- package/dist/components/surfaces/collapsible/styles/Collapsible.css.js +1 -1
- package/dist/components/theme-provider/ThemeProvider.cjs +1 -1
- package/dist/components/theme-provider/ThemeProvider.js +1 -1
- package/dist/constants/animations/fade/fadeIn.css.cjs +1 -1
- package/dist/constants/animations/fade/fadeIn.css.js +1 -1
- package/dist/constants/animations/fade/fadeOut.css.cjs +1 -1
- package/dist/constants/animations/fade/fadeOut.css.js +1 -1
- package/dist/constants/animations/pulse/pulseAnimation.css.cjs +1 -1
- package/dist/constants/animations/pulse/pulseAnimation.css.js +1 -1
- package/dist/constants/animations/slide/slideDownIn.css.cjs +1 -1
- package/dist/constants/animations/slide/slideDownIn.css.js +1 -1
- package/dist/constants/animations/slide/slideDownOut.css.cjs +1 -1
- package/dist/constants/animations/slide/slideDownOut.css.js +1 -1
- package/dist/constants/animations/slide/slideLeftIn.css.cjs +1 -1
- package/dist/constants/animations/slide/slideLeftIn.css.js +1 -1
- package/dist/constants/animations/slide/slideLeftOut.css.cjs +1 -1
- package/dist/constants/animations/slide/slideLeftOut.css.js +1 -1
- package/dist/constants/animations/slide/slideRightIn.css.cjs +1 -1
- package/dist/constants/animations/slide/slideRightIn.css.js +1 -1
- package/dist/constants/animations/slide/slideRightOut.css.cjs +1 -1
- package/dist/constants/animations/slide/slideRightOut.css.js +1 -1
- package/dist/constants/animations/slide/slideUpIn.css.cjs +1 -1
- package/dist/constants/animations/slide/slideUpIn.css.js +1 -1
- package/dist/constants/animations/slide/slideUpOut.css.cjs +1 -1
- package/dist/constants/animations/slide/slideUpOut.css.js +1 -1
- package/dist/constants/animations/spin/spinAnimation.css.cjs +1 -1
- package/dist/constants/animations/spin/spinAnimation.css.js +1 -1
- package/dist/hooks/use-notification/useNotification.hook.cjs +1 -1
- package/dist/hooks/use-notification/useNotification.hook.js +1 -1
- package/dist/hooks/use-toast/useToast.hook.cjs +1 -1
- package/dist/hooks/use-toast/useToast.hook.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +278 -270
- package/dist/index.js.map +1 -1
- package/dist/styles.css +144 -138
- package/dist/ui-kit10.css +1 -1
- package/dist/ui-kit100.css +1 -1
- package/dist/ui-kit101.css +1 -1
- package/dist/ui-kit103.css +1 -1
- package/dist/ui-kit104.css +1 -1
- package/dist/ui-kit105.css +1 -1
- package/dist/ui-kit106.css +1 -1
- package/dist/ui-kit107.css +1 -1
- package/dist/ui-kit108.css +1 -1
- package/dist/ui-kit109.css +1 -1
- package/dist/ui-kit11.css +1 -1
- package/dist/ui-kit110.css +1 -1
- package/dist/ui-kit111.css +1 -1
- package/dist/ui-kit112.css +1 -1
- package/dist/ui-kit113.css +1 -1
- package/dist/ui-kit114.css +1 -1
- package/dist/ui-kit115.css +1 -1
- package/dist/ui-kit117.css +1 -1
- package/dist/ui-kit118.css +1 -1
- package/dist/ui-kit119.css +1 -1
- package/dist/ui-kit12.css +1 -1
- package/dist/ui-kit120.css +1 -1
- package/dist/ui-kit121.css +1 -1
- package/dist/ui-kit122.css +1 -1
- package/dist/ui-kit123.css +1 -1
- package/dist/ui-kit124.css +1 -1
- package/dist/ui-kit125.css +1 -1
- package/dist/ui-kit126.css +1 -1
- package/dist/ui-kit127.css +1 -1
- package/dist/ui-kit128.css +1 -1
- package/dist/ui-kit129.css +1 -1
- package/dist/ui-kit13.css +1 -1
- package/dist/ui-kit130.css +1 -1
- package/dist/ui-kit131.css +1 -1
- package/dist/ui-kit132.css +1 -1
- package/dist/ui-kit133.css +1 -1
- package/dist/ui-kit134.css +1 -1
- package/dist/ui-kit135.css +1 -1
- package/dist/ui-kit136.css +1 -1
- package/dist/ui-kit137.css +1 -1
- package/dist/ui-kit138.css +1 -1
- package/dist/ui-kit139.css +1 -1
- package/dist/ui-kit14.css +1 -1
- package/dist/ui-kit140.css +1 -1
- package/dist/ui-kit141.css +1 -1
- package/dist/ui-kit142.css +1 -1
- package/dist/ui-kit144.css +1 -1
- package/dist/ui-kit145.css +1 -1
- package/dist/ui-kit146.css +1 -1
- package/dist/ui-kit147.css +1 -1
- package/dist/ui-kit148.css +1 -1
- package/dist/ui-kit149.css +1 -1
- package/dist/ui-kit15.css +1 -1
- package/dist/ui-kit150.css +1 -1
- package/dist/ui-kit151.css +1 -1
- package/dist/ui-kit152.css +1 -1
- package/dist/ui-kit153.css +1 -1
- package/dist/ui-kit154.css +1 -1
- package/dist/ui-kit155.css +1 -1
- package/dist/ui-kit156.css +1 -1
- package/dist/ui-kit157.css +1 -1
- package/dist/ui-kit158.css +1 -1
- package/dist/ui-kit159.css +1 -1
- package/dist/ui-kit16.css +1 -1
- package/dist/ui-kit160.css +1 -0
- package/dist/ui-kit161.css +1 -0
- package/dist/ui-kit162.css +1 -0
- package/dist/ui-kit17.css +1 -1
- package/dist/ui-kit18.css +1 -1
- package/dist/ui-kit19.css +1 -1
- package/dist/ui-kit20.css +1 -1
- package/dist/ui-kit21.css +1 -1
- package/dist/ui-kit22.css +1 -1
- package/dist/ui-kit23.css +1 -1
- package/dist/ui-kit24.css +1 -1
- package/dist/ui-kit25.css +1 -1
- package/dist/ui-kit26.css +1 -1
- package/dist/ui-kit27.css +1 -1
- package/dist/ui-kit28.css +1 -1
- package/dist/ui-kit29.css +1 -1
- package/dist/ui-kit3.css +1 -1
- package/dist/ui-kit30.css +1 -1
- package/dist/ui-kit31.css +1 -1
- package/dist/ui-kit32.css +1 -1
- package/dist/ui-kit33.css +1 -1
- package/dist/ui-kit34.css +1 -1
- package/dist/ui-kit35.css +1 -1
- package/dist/ui-kit36.css +1 -1
- package/dist/ui-kit37.css +1 -1
- package/dist/ui-kit38.css +1 -1
- package/dist/ui-kit39.css +1 -1
- package/dist/ui-kit4.css +1 -1
- package/dist/ui-kit40.css +1 -1
- package/dist/ui-kit41.css +1 -1
- package/dist/ui-kit42.css +1 -1
- package/dist/ui-kit43.css +1 -1
- package/dist/ui-kit44.css +1 -1
- package/dist/ui-kit45.css +1 -1
- package/dist/ui-kit46.css +1 -1
- package/dist/ui-kit47.css +1 -1
- package/dist/ui-kit48.css +1 -1
- package/dist/ui-kit49.css +1 -1
- package/dist/ui-kit5.css +1 -1
- package/dist/ui-kit50.css +1 -1
- package/dist/ui-kit51.css +1 -1
- package/dist/ui-kit52.css +1 -1
- package/dist/ui-kit53.css +1 -1
- package/dist/ui-kit54.css +1 -1
- package/dist/ui-kit55.css +1 -1
- package/dist/ui-kit57.css +1 -1
- package/dist/ui-kit58.css +1 -1
- package/dist/ui-kit59.css +1 -1
- package/dist/ui-kit6.css +1 -1
- package/dist/ui-kit60.css +1 -1
- package/dist/ui-kit61.css +1 -1
- package/dist/ui-kit62.css +1 -1
- package/dist/ui-kit63.css +1 -1
- package/dist/ui-kit64.css +1 -1
- package/dist/ui-kit65.css +1 -1
- package/dist/ui-kit66.css +1 -1
- package/dist/ui-kit67.css +1 -1
- package/dist/ui-kit68.css +1 -1
- package/dist/ui-kit69.css +1 -1
- package/dist/ui-kit7.css +1 -1
- package/dist/ui-kit70.css +1 -1
- package/dist/ui-kit71.css +1 -1
- package/dist/ui-kit72.css +1 -1
- package/dist/ui-kit73.css +1 -1
- package/dist/ui-kit74.css +1 -1
- package/dist/ui-kit75.css +1 -1
- package/dist/ui-kit76.css +1 -1
- package/dist/ui-kit77.css +1 -1
- package/dist/ui-kit78.css +1 -1
- package/dist/ui-kit79.css +1 -1
- package/dist/ui-kit8.css +1 -1
- package/dist/ui-kit80.css +1 -1
- package/dist/ui-kit81.css +1 -1
- package/dist/ui-kit82.css +1 -1
- package/dist/ui-kit83.css +1 -1
- package/dist/ui-kit84.css +1 -1
- package/dist/ui-kit85.css +1 -1
- package/dist/ui-kit86.css +1 -1
- package/dist/ui-kit87.css +1 -1
- package/dist/ui-kit89.css +1 -1
- package/dist/ui-kit9.css +1 -1
- package/dist/ui-kit90.css +1 -1
- package/dist/ui-kit91.css +1 -1
- package/dist/ui-kit92.css +1 -1
- package/dist/ui-kit93.css +1 -1
- package/dist/ui-kit94.css +1 -1
- package/dist/ui-kit95.css +1 -1
- package/dist/ui-kit96.css +1 -1
- package/dist/ui-kit97.css +1 -1
- package/dist/ui-kit98.css +1 -1
- package/dist/ui-kit99.css +1 -1
- package/package.json +120 -119
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useRef as X, useState as i, useEffect as F, useCallback as r } from "react";
|
|
2
|
+
import { IMAGE_PICKER_MOBILE_LABELS as Y, IMAGE_PICKER_DEFAULT_LABELS as Z, IMAGE_PICKER_DEFAULT_ACCEPT as $ } from "../constants/imagePickerDefaults.const.js";
|
|
3
|
+
import { isImagePickerFile as x, syncImagePickerInput as a, acceptsImagePickerFile as ee, hasImagePickerFiles as T } from "../utils/imagePicker.utils.js";
|
|
4
|
+
const oe = ({
|
|
5
|
+
value: R,
|
|
6
|
+
defaultValue: k = null,
|
|
7
|
+
onValueChange: U,
|
|
8
|
+
accept: C = $,
|
|
9
|
+
maxSize: c,
|
|
10
|
+
onValidationError: I,
|
|
11
|
+
disabled: m = !1,
|
|
12
|
+
disableChange: _ = !1,
|
|
13
|
+
disableRemove: b = !1,
|
|
14
|
+
isMobile: y = !1,
|
|
15
|
+
labels: A,
|
|
16
|
+
crop: E = !1
|
|
17
|
+
}) => {
|
|
18
|
+
const s = X(null), [O, j] = i(k), [M, h] = i(), [P, l] = i(), [w, f] = i(!1), [B, u] = i(), L = R !== void 0, n = L ? R : O, G = n !== null, o = m || _, v = m || b, D = {
|
|
19
|
+
...y ? Y : Z,
|
|
20
|
+
...A
|
|
21
|
+
}, K = typeof n == "string" ? n : M, V = P ? D[P] : void 0;
|
|
22
|
+
F(() => {
|
|
23
|
+
if (!x(n) || typeof URL > "u" || typeof URL.createObjectURL != "function") {
|
|
24
|
+
h(void 0);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const e = URL.createObjectURL(n);
|
|
28
|
+
return h(e), () => {
|
|
29
|
+
typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(e);
|
|
30
|
+
};
|
|
31
|
+
}, [n]), F(() => {
|
|
32
|
+
a(s.current, n);
|
|
33
|
+
}, [n]);
|
|
34
|
+
const d = r(
|
|
35
|
+
(e) => {
|
|
36
|
+
L || j(e), U?.(e);
|
|
37
|
+
},
|
|
38
|
+
[L, U]
|
|
39
|
+
), N = r(() => {
|
|
40
|
+
o || s.current?.click();
|
|
41
|
+
}, [o]), p = r(
|
|
42
|
+
(e) => {
|
|
43
|
+
l(void 0), a(s.current, e), d(e);
|
|
44
|
+
},
|
|
45
|
+
[d]
|
|
46
|
+
), g = r(
|
|
47
|
+
(e) => {
|
|
48
|
+
if (o)
|
|
49
|
+
return;
|
|
50
|
+
let t;
|
|
51
|
+
if (ee(e, C) ? c !== void 0 && e.size > c && (t = "maxSize") : t = "invalidType", t) {
|
|
52
|
+
l(t), a(s.current, n), I?.(
|
|
53
|
+
t === "maxSize" ? { reason: t, file: e, maxSize: c } : { reason: t, file: e }
|
|
54
|
+
);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (l(void 0), E) {
|
|
58
|
+
a(s.current, n), u(e);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
p(e);
|
|
62
|
+
},
|
|
63
|
+
[
|
|
64
|
+
C,
|
|
65
|
+
p,
|
|
66
|
+
E,
|
|
67
|
+
n,
|
|
68
|
+
o,
|
|
69
|
+
c,
|
|
70
|
+
I
|
|
71
|
+
]
|
|
72
|
+
), S = r(
|
|
73
|
+
(e) => {
|
|
74
|
+
const t = e.target.files?.[0];
|
|
75
|
+
t && g(t);
|
|
76
|
+
},
|
|
77
|
+
[g]
|
|
78
|
+
), q = r(
|
|
79
|
+
(e) => {
|
|
80
|
+
T(e) && (e.preventDefault(), e.dataTransfer.dropEffect = o ? "none" : "copy", o || f(!0));
|
|
81
|
+
},
|
|
82
|
+
[o]
|
|
83
|
+
), z = r(
|
|
84
|
+
(e) => {
|
|
85
|
+
if (e.target !== e.currentTarget)
|
|
86
|
+
return;
|
|
87
|
+
const t = e.relatedTarget;
|
|
88
|
+
typeof Node < "u" && t instanceof Node && e.currentTarget.contains(t) || f(!1);
|
|
89
|
+
},
|
|
90
|
+
[]
|
|
91
|
+
), H = r(
|
|
92
|
+
(e) => {
|
|
93
|
+
if (!T(e) || (e.preventDefault(), f(!1), o))
|
|
94
|
+
return;
|
|
95
|
+
const t = e.dataTransfer.files?.[0];
|
|
96
|
+
t && g(t);
|
|
97
|
+
},
|
|
98
|
+
[g, o]
|
|
99
|
+
), J = r(() => {
|
|
100
|
+
v || (u(void 0), l(void 0), f(!1), d(null), s.current && (s.current.value = ""));
|
|
101
|
+
}, [v, d]), Q = r(() => {
|
|
102
|
+
u(void 0), a(s.current, n);
|
|
103
|
+
}, [n]), W = r(
|
|
104
|
+
(e) => {
|
|
105
|
+
u(void 0), p(e);
|
|
106
|
+
},
|
|
107
|
+
[p]
|
|
108
|
+
);
|
|
109
|
+
return {
|
|
110
|
+
inputRef: s,
|
|
111
|
+
previewUrl: K,
|
|
112
|
+
resolvedLabels: D,
|
|
113
|
+
validationMessage: V,
|
|
114
|
+
hasValue: G,
|
|
115
|
+
isChangeDisabled: o,
|
|
116
|
+
isRemoveDisabled: v,
|
|
117
|
+
isDragging: w,
|
|
118
|
+
pendingCropFile: B,
|
|
119
|
+
handleOpen: N,
|
|
120
|
+
handleInputChange: S,
|
|
121
|
+
handleDragOver: q,
|
|
122
|
+
handleDragLeave: z,
|
|
123
|
+
handleDrop: H,
|
|
124
|
+
handleClear: J,
|
|
125
|
+
handleCropCancel: Q,
|
|
126
|
+
handleCropConfirm: W
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export {
|
|
130
|
+
oe as useImagePicker
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=useImagePicker.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImagePicker.hook.js","sources":["../../../../../src/components/forms/image-picker/hooks/useImagePicker.hook.ts"],"sourcesContent":["import {\r\n useCallback,\r\n useEffect,\r\n useRef,\r\n useState,\r\n type ChangeEvent,\r\n type DragEvent,\r\n} from 'react'\r\n\r\nimport {\r\n IMAGE_PICKER_DEFAULT_ACCEPT,\r\n IMAGE_PICKER_DEFAULT_LABELS,\r\n IMAGE_PICKER_MOBILE_LABELS,\r\n} from '@components/forms/image-picker/constants/imagePickerDefaults.const.ts'\r\nimport type {\r\n UseImagePickerOptions,\r\n UseImagePickerReturn,\r\n} from '@components/forms/image-picker/hooks/types'\r\nimport type {\r\n ImagePickerValidationReason,\r\n ImagePickerValue,\r\n} from '@components/forms/image-picker/types/ImagePicker.types.ts'\r\nimport {\r\n acceptsImagePickerFile,\r\n hasImagePickerFiles,\r\n isImagePickerFile,\r\n syncImagePickerInput,\r\n} from '@components/forms/image-picker/utils/imagePicker.utils.ts'\r\n\r\n/**\r\n * Manages value state and browser interactions for ImagePicker.\r\n *\r\n * Supports controlled and uncontrolled values, local preview URLs, native\r\n * input synchronization, file validation, chooser opening, drag and drop, and\r\n * removal. When cropping is enabled, accepted files wait in a pending state\r\n * until the crop dialog confirms them. The returned handlers are ready to pass\r\n * to the ImagePicker subcomponents.\r\n */\r\nexport const useImagePicker = ({\r\n value,\r\n defaultValue = null,\r\n onValueChange,\r\n accept = IMAGE_PICKER_DEFAULT_ACCEPT,\r\n maxSize,\r\n onValidationError,\r\n disabled = false,\r\n disableChange = false,\r\n disableRemove = false,\r\n isMobile = false,\r\n labels,\r\n crop = false,\r\n}: UseImagePickerOptions): UseImagePickerReturn => {\r\n const inputRef = useRef<HTMLInputElement>(null)\r\n const [uncontrolledValue, setUncontrolledValue] =\r\n useState<ImagePickerValue>(defaultValue)\r\n const [filePreviewUrl, setFilePreviewUrl] = useState<string>()\r\n const [validationReason, setValidationReason] =\r\n useState<ImagePickerValidationReason>()\r\n const [isDragging, setIsDragging] = useState(false)\r\n const [pendingCropFile, setPendingCropFile] = useState<File>()\r\n\r\n const isControlled = value !== undefined\r\n const currentValue = isControlled ? value : uncontrolledValue\r\n const hasValue = currentValue !== null\r\n const isChangeDisabled = disabled || disableChange\r\n const isRemoveDisabled = disabled || disableRemove\r\n const resolvedLabels = {\r\n ...(isMobile ? IMAGE_PICKER_MOBILE_LABELS : IMAGE_PICKER_DEFAULT_LABELS),\r\n ...labels,\r\n }\r\n const previewUrl = typeof currentValue === 'string'\r\n ? currentValue\r\n : filePreviewUrl\r\n const validationMessage = validationReason\r\n ? resolvedLabels[validationReason]\r\n : undefined\r\n\r\n useEffect(() => {\r\n if (\r\n !isImagePickerFile(currentValue) ||\r\n typeof URL === 'undefined' ||\r\n typeof URL.createObjectURL !== 'function'\r\n ) {\r\n setFilePreviewUrl(undefined)\r\n return\r\n }\r\n\r\n const objectUrl = URL.createObjectURL(currentValue)\r\n setFilePreviewUrl(objectUrl)\r\n\r\n return () => {\r\n if (typeof URL.revokeObjectURL === 'function') {\r\n URL.revokeObjectURL(objectUrl)\r\n }\r\n }\r\n }, [currentValue])\r\n\r\n useEffect(() => {\r\n syncImagePickerInput(inputRef.current, currentValue)\r\n }, [currentValue])\r\n\r\n const updateValue = useCallback(\r\n (nextValue: ImagePickerValue) => {\r\n if (!isControlled) {\r\n setUncontrolledValue(nextValue)\r\n }\r\n onValueChange?.(nextValue)\r\n },\r\n [isControlled, onValueChange],\r\n )\r\n\r\n const handleOpen = useCallback(() => {\r\n if (!isChangeDisabled) {\r\n inputRef.current?.click()\r\n }\r\n }, [isChangeDisabled])\r\n\r\n const commitFile = useCallback(\r\n (file: File) => {\r\n setValidationReason(undefined)\r\n syncImagePickerInput(inputRef.current, file)\r\n updateValue(file)\r\n },\r\n [updateValue],\r\n )\r\n\r\n const handleFile = useCallback(\r\n (file: File) => {\r\n if (isChangeDisabled) {\r\n return\r\n }\r\n\r\n let reason: ImagePickerValidationReason | undefined\r\n\r\n if (!acceptsImagePickerFile(file, accept)) {\r\n reason = 'invalidType'\r\n } else if (maxSize !== undefined && file.size > maxSize) {\r\n reason = 'maxSize'\r\n }\r\n\r\n if (reason) {\r\n setValidationReason(reason)\r\n syncImagePickerInput(inputRef.current, currentValue)\r\n onValidationError?.(\r\n reason === 'maxSize'\r\n ? { reason, file, maxSize }\r\n : { reason, file },\r\n )\r\n return\r\n }\r\n\r\n setValidationReason(undefined)\r\n if (crop) {\r\n syncImagePickerInput(inputRef.current, currentValue)\r\n setPendingCropFile(file)\r\n return\r\n }\r\n\r\n commitFile(file)\r\n },\r\n [\r\n accept,\r\n commitFile,\r\n crop,\r\n currentValue,\r\n isChangeDisabled,\r\n maxSize,\r\n onValidationError,\r\n ],\r\n )\r\n\r\n const handleInputChange = useCallback(\r\n (event: ChangeEvent<HTMLInputElement>) => {\r\n const file = event.target.files?.[0]\r\n if (file) {\r\n handleFile(file)\r\n }\r\n },\r\n [handleFile],\r\n )\r\n\r\n const handleDragOver = useCallback(\r\n (event: DragEvent<HTMLButtonElement>) => {\r\n if (!hasImagePickerFiles(event)) {\r\n return\r\n }\r\n\r\n event.preventDefault()\r\n event.dataTransfer.dropEffect = isChangeDisabled ? 'none' : 'copy'\r\n if (!isChangeDisabled) {\r\n setIsDragging(true)\r\n }\r\n },\r\n [isChangeDisabled],\r\n )\r\n\r\n const handleDragLeave = useCallback(\r\n (event: DragEvent<HTMLButtonElement>) => {\r\n if (event.target !== event.currentTarget) {\r\n return\r\n }\r\n\r\n const relatedTarget = event.relatedTarget\r\n if (\r\n typeof Node !== 'undefined'\r\n && relatedTarget instanceof Node\r\n && event.currentTarget.contains(relatedTarget)\r\n ) {\r\n return\r\n }\r\n\r\n setIsDragging(false)\r\n },\r\n [],\r\n )\r\n\r\n const handleDrop = useCallback(\r\n (event: DragEvent<HTMLButtonElement>) => {\r\n if (!hasImagePickerFiles(event)) {\r\n return\r\n }\r\n\r\n event.preventDefault()\r\n setIsDragging(false)\r\n if (isChangeDisabled) {\r\n return\r\n }\r\n\r\n const file = event.dataTransfer.files?.[0]\r\n if (file) {\r\n handleFile(file)\r\n }\r\n },\r\n [handleFile, isChangeDisabled],\r\n )\r\n\r\n const handleClear = useCallback(() => {\r\n if (isRemoveDisabled) {\r\n return\r\n }\r\n\r\n setPendingCropFile(undefined)\r\n setValidationReason(undefined)\r\n setIsDragging(false)\r\n updateValue(null)\r\n if (inputRef.current) {\r\n inputRef.current.value = ''\r\n }\r\n }, [isRemoveDisabled, updateValue])\r\n\r\n const handleCropCancel = useCallback(() => {\r\n setPendingCropFile(undefined)\r\n syncImagePickerInput(inputRef.current, currentValue)\r\n }, [currentValue])\r\n\r\n const handleCropConfirm = useCallback(\r\n (file: File) => {\r\n setPendingCropFile(undefined)\r\n commitFile(file)\r\n },\r\n [commitFile],\r\n )\r\n\r\n return {\r\n inputRef,\r\n previewUrl,\r\n resolvedLabels,\r\n validationMessage,\r\n hasValue,\r\n isChangeDisabled,\r\n isRemoveDisabled,\r\n isDragging,\r\n pendingCropFile,\r\n handleOpen,\r\n handleInputChange,\r\n handleDragOver,\r\n handleDragLeave,\r\n handleDrop,\r\n handleClear,\r\n handleCropCancel,\r\n handleCropConfirm,\r\n }\r\n}\r\n"],"names":["useImagePicker","value","defaultValue","onValueChange","accept","IMAGE_PICKER_DEFAULT_ACCEPT","maxSize","onValidationError","disabled","disableChange","disableRemove","isMobile","labels","crop","inputRef","useRef","uncontrolledValue","setUncontrolledValue","useState","filePreviewUrl","setFilePreviewUrl","validationReason","setValidationReason","isDragging","setIsDragging","pendingCropFile","setPendingCropFile","isControlled","currentValue","hasValue","isChangeDisabled","isRemoveDisabled","resolvedLabels","IMAGE_PICKER_MOBILE_LABELS","IMAGE_PICKER_DEFAULT_LABELS","previewUrl","validationMessage","useEffect","isImagePickerFile","objectUrl","syncImagePickerInput","updateValue","useCallback","nextValue","handleOpen","commitFile","file","handleFile","reason","acceptsImagePickerFile","handleInputChange","event","handleDragOver","hasImagePickerFiles","handleDragLeave","relatedTarget","handleDrop","handleClear","handleCropCancel","handleCropConfirm"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),v=require("../utils/imagePicker.utils.cjs"),S=({file:c,cropErrorLabel:t,onConfirm:u})=>{const[r,d]=e.useState(),[C,l]=e.useState({x:0,y:0}),[U,p]=e.useState(1),[a,f]=e.useState(),[n,i]=e.useState(!1),[g,s]=e.useState();e.useEffect(()=>{if(l({x:0,y:0}),p(1),f(void 0),s(void 0),typeof URL>"u"||typeof URL.createObjectURL!="function"){d(void 0),s(t);return}const o=URL.createObjectURL(c);return d(o),()=>{typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(o)}},[t,c]);const k=e.useCallback((o,P)=>{f(P)},[]),m=e.useCallback(()=>{s(void 0)},[]),R=e.useCallback(()=>{s(t)},[t]),y=e.useCallback(async()=>{if(!r||!a||n)return;i(!0),s(void 0);let o;try{o=await v.createImagePickerCroppedFile(c,a)}catch{s(t),i(!1);return}i(!1),u(o)},[t,a,c,r,n,u]);return{imageUrl:r,crop:C,setCrop:l,zoom:U,setZoom:p,croppedAreaPixels:a,handleCropComplete:k,handleMediaLoaded:m,handleMediaError:R,isProcessing:n,cropError:g,handleConfirm:y}};exports.useImagePickerCrop=S;
|
|
2
|
+
//# sourceMappingURL=useImagePickerCrop.hook.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImagePickerCrop.hook.cjs","sources":["../../../../../src/components/forms/image-picker/hooks/useImagePickerCrop.hook.ts"],"sourcesContent":["import type { Area, Point } from 'react-easy-crop'\r\nimport { useCallback, useEffect, useState } from 'react'\r\n\r\nimport type {\r\n UseImagePickerCropOptions,\r\n UseImagePickerCropReturn,\r\n} from '@components/forms/image-picker/hooks/types'\r\nimport { createImagePickerCroppedFile } from '@components/forms/image-picker/utils/imagePicker.utils.ts'\r\n\r\n/**\r\n * Manages cropper state and turns a selected crop area into a local file.\r\n *\r\n * The hook does not update picker state itself. Its caller decides when the\r\n * generated file becomes the committed ImagePicker value.\r\n */\r\nexport const useImagePickerCrop = ({\r\n file,\r\n cropErrorLabel,\r\n onConfirm,\r\n}: UseImagePickerCropOptions): UseImagePickerCropReturn => {\r\n const [imageUrl, setImageUrl] = useState<string>()\r\n const [crop, setCrop] = useState<Point>({ x: 0, y: 0 })\r\n const [zoom, setZoom] = useState(1)\r\n const [croppedAreaPixels, setCroppedAreaPixels] = useState<Area>()\r\n const [isProcessing, setIsProcessing] = useState(false)\r\n const [cropError, setCropError] = useState<string>()\r\n\r\n useEffect(() => {\r\n setCrop({ x: 0, y: 0 })\r\n setZoom(1)\r\n setCroppedAreaPixels(undefined)\r\n setCropError(undefined)\r\n\r\n if (\r\n typeof URL === 'undefined'\r\n || typeof URL.createObjectURL !== 'function'\r\n ) {\r\n setImageUrl(undefined)\r\n setCropError(cropErrorLabel)\r\n return\r\n }\r\n\r\n const objectUrl = URL.createObjectURL(file)\r\n setImageUrl(objectUrl)\r\n\r\n return () => {\r\n if (typeof URL.revokeObjectURL === 'function') {\r\n URL.revokeObjectURL(objectUrl)\r\n }\r\n }\r\n }, [cropErrorLabel, file])\r\n\r\n const handleCropComplete = useCallback(\r\n (_croppedArea: Area, nextCroppedAreaPixels: Area) => {\r\n setCroppedAreaPixels(nextCroppedAreaPixels)\r\n },\r\n [],\r\n )\r\n\r\n const handleMediaLoaded = useCallback(() => {\r\n setCropError(undefined)\r\n }, [])\r\n\r\n const handleMediaError = useCallback(() => {\r\n setCropError(cropErrorLabel)\r\n }, [cropErrorLabel])\r\n\r\n const handleConfirm = useCallback(async () => {\r\n if (!imageUrl || !croppedAreaPixels || isProcessing) {\r\n return\r\n }\r\n\r\n setIsProcessing(true)\r\n setCropError(undefined)\r\n\r\n let croppedFile: File\r\n try {\r\n croppedFile = await createImagePickerCroppedFile(\r\n file,\r\n croppedAreaPixels,\r\n )\r\n } catch {\r\n setCropError(cropErrorLabel)\r\n setIsProcessing(false)\r\n return\r\n }\r\n\r\n setIsProcessing(false)\r\n onConfirm(croppedFile)\r\n }, [\r\n cropErrorLabel,\r\n croppedAreaPixels,\r\n file,\r\n imageUrl,\r\n isProcessing,\r\n onConfirm,\r\n ])\r\n\r\n return {\r\n imageUrl,\r\n crop,\r\n setCrop,\r\n zoom,\r\n setZoom,\r\n croppedAreaPixels,\r\n handleCropComplete,\r\n handleMediaLoaded,\r\n handleMediaError,\r\n isProcessing,\r\n cropError,\r\n handleConfirm,\r\n }\r\n}\r\n"],"names":["useImagePickerCrop","file","cropErrorLabel","onConfirm","imageUrl","setImageUrl","useState","crop","setCrop","zoom","setZoom","croppedAreaPixels","setCroppedAreaPixels","isProcessing","setIsProcessing","cropError","setCropError","useEffect","objectUrl","handleCropComplete","useCallback","_croppedArea","nextCroppedAreaPixels","handleMediaLoaded","handleMediaError","handleConfirm","croppedFile","createImagePickerCroppedFile"],"mappings":"qJAeaA,EAAqB,CAAC,CAC/B,KAAAC,EACA,eAAAC,EACA,UAAAC,CACJ,IAA2D,CACvD,KAAM,CAACC,EAAUC,CAAW,EAAIC,WAAA,EAC1B,CAACC,EAAMC,CAAO,EAAIF,EAAAA,SAAgB,CAAE,EAAG,EAAG,EAAG,EAAG,EAChD,CAACG,EAAMC,CAAO,EAAIJ,EAAAA,SAAS,CAAC,EAC5B,CAACK,EAAmBC,CAAoB,EAAIN,WAAA,EAC5C,CAACO,EAAcC,CAAe,EAAIR,EAAAA,SAAS,EAAK,EAChD,CAACS,EAAWC,CAAY,EAAIV,WAAA,EAElCW,EAAAA,UAAU,IAAM,CAMZ,GALAT,EAAQ,CAAE,EAAG,EAAG,EAAG,EAAG,EACtBE,EAAQ,CAAC,EACTE,EAAqB,MAAS,EAC9BI,EAAa,MAAS,EAGlB,OAAO,IAAQ,KACZ,OAAO,IAAI,iBAAoB,WACpC,CACEX,EAAY,MAAS,EACrBW,EAAad,CAAc,EAC3B,MACJ,CAEA,MAAMgB,EAAY,IAAI,gBAAgBjB,CAAI,EAC1C,OAAAI,EAAYa,CAAS,EAEd,IAAM,CACL,OAAO,IAAI,iBAAoB,YAC/B,IAAI,gBAAgBA,CAAS,CAErC,CACJ,EAAG,CAAChB,EAAgBD,CAAI,CAAC,EAEzB,MAAMkB,EAAqBC,EAAAA,YACvB,CAACC,EAAoBC,IAAgC,CACjDV,EAAqBU,CAAqB,CAC9C,EACA,CAAA,CAAC,EAGCC,EAAoBH,EAAAA,YAAY,IAAM,CACxCJ,EAAa,MAAS,CAC1B,EAAG,CAAA,CAAE,EAECQ,EAAmBJ,EAAAA,YAAY,IAAM,CACvCJ,EAAad,CAAc,CAC/B,EAAG,CAACA,CAAc,CAAC,EAEbuB,EAAgBL,EAAAA,YAAY,SAAY,CAC1C,GAAI,CAAChB,GAAY,CAACO,GAAqBE,EACnC,OAGJC,EAAgB,EAAI,EACpBE,EAAa,MAAS,EAEtB,IAAIU,EACJ,GAAI,CACAA,EAAc,MAAMC,EAAAA,6BAChB1B,EACAU,CAAA,CAER,MAAQ,CACJK,EAAad,CAAc,EAC3BY,EAAgB,EAAK,EACrB,MACJ,CAEAA,EAAgB,EAAK,EACrBX,EAAUuB,CAAW,CACzB,EAAG,CACCxB,EACAS,EACAV,EACAG,EACAS,EACAV,CAAA,CACH,EAED,MAAO,CACH,SAAAC,EACA,KAAAG,EACA,QAAAC,EACA,KAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,mBAAAQ,EACA,kBAAAI,EACA,iBAAAC,EACA,aAAAX,EACA,UAAAE,EACA,cAAAU,CAAA,CAER"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseImagePickerCropOptions, UseImagePickerCropReturn } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Manages cropper state and turns a selected crop area into a local file.
|
|
4
|
+
*
|
|
5
|
+
* The hook does not update picker state itself. Its caller decides when the
|
|
6
|
+
* generated file becomes the committed ImagePicker value.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useImagePickerCrop: ({ file, cropErrorLabel, onConfirm, }: UseImagePickerCropOptions) => UseImagePickerCropReturn;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useState as s, useEffect as j, useCallback as n } from "react";
|
|
2
|
+
import { createImagePickerCroppedFile as k } from "../utils/imagePicker.utils.js";
|
|
3
|
+
const I = ({
|
|
4
|
+
file: r,
|
|
5
|
+
cropErrorLabel: e,
|
|
6
|
+
onConfirm: p
|
|
7
|
+
}) => {
|
|
8
|
+
const [i, f] = s(), [l, u] = s({ x: 0, y: 0 }), [R, U] = s(1), [c, m] = s(), [a, d] = s(!1), [C, t] = s();
|
|
9
|
+
j(() => {
|
|
10
|
+
if (u({ x: 0, y: 0 }), U(1), m(void 0), t(void 0), typeof URL > "u" || typeof URL.createObjectURL != "function") {
|
|
11
|
+
f(void 0), t(e);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const o = URL.createObjectURL(r);
|
|
15
|
+
return f(o), () => {
|
|
16
|
+
typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(o);
|
|
17
|
+
};
|
|
18
|
+
}, [e, r]);
|
|
19
|
+
const v = n(
|
|
20
|
+
(o, h) => {
|
|
21
|
+
m(h);
|
|
22
|
+
},
|
|
23
|
+
[]
|
|
24
|
+
), y = n(() => {
|
|
25
|
+
t(void 0);
|
|
26
|
+
}, []), g = n(() => {
|
|
27
|
+
t(e);
|
|
28
|
+
}, [e]), P = n(async () => {
|
|
29
|
+
if (!i || !c || a)
|
|
30
|
+
return;
|
|
31
|
+
d(!0), t(void 0);
|
|
32
|
+
let o;
|
|
33
|
+
try {
|
|
34
|
+
o = await k(
|
|
35
|
+
r,
|
|
36
|
+
c
|
|
37
|
+
);
|
|
38
|
+
} catch {
|
|
39
|
+
t(e), d(!1);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
d(!1), p(o);
|
|
43
|
+
}, [
|
|
44
|
+
e,
|
|
45
|
+
c,
|
|
46
|
+
r,
|
|
47
|
+
i,
|
|
48
|
+
a,
|
|
49
|
+
p
|
|
50
|
+
]);
|
|
51
|
+
return {
|
|
52
|
+
imageUrl: i,
|
|
53
|
+
crop: l,
|
|
54
|
+
setCrop: u,
|
|
55
|
+
zoom: R,
|
|
56
|
+
setZoom: U,
|
|
57
|
+
croppedAreaPixels: c,
|
|
58
|
+
handleCropComplete: v,
|
|
59
|
+
handleMediaLoaded: y,
|
|
60
|
+
handleMediaError: g,
|
|
61
|
+
isProcessing: a,
|
|
62
|
+
cropError: C,
|
|
63
|
+
handleConfirm: P
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
I as useImagePickerCrop
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=useImagePickerCrop.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImagePickerCrop.hook.js","sources":["../../../../../src/components/forms/image-picker/hooks/useImagePickerCrop.hook.ts"],"sourcesContent":["import type { Area, Point } from 'react-easy-crop'\r\nimport { useCallback, useEffect, useState } from 'react'\r\n\r\nimport type {\r\n UseImagePickerCropOptions,\r\n UseImagePickerCropReturn,\r\n} from '@components/forms/image-picker/hooks/types'\r\nimport { createImagePickerCroppedFile } from '@components/forms/image-picker/utils/imagePicker.utils.ts'\r\n\r\n/**\r\n * Manages cropper state and turns a selected crop area into a local file.\r\n *\r\n * The hook does not update picker state itself. Its caller decides when the\r\n * generated file becomes the committed ImagePicker value.\r\n */\r\nexport const useImagePickerCrop = ({\r\n file,\r\n cropErrorLabel,\r\n onConfirm,\r\n}: UseImagePickerCropOptions): UseImagePickerCropReturn => {\r\n const [imageUrl, setImageUrl] = useState<string>()\r\n const [crop, setCrop] = useState<Point>({ x: 0, y: 0 })\r\n const [zoom, setZoom] = useState(1)\r\n const [croppedAreaPixels, setCroppedAreaPixels] = useState<Area>()\r\n const [isProcessing, setIsProcessing] = useState(false)\r\n const [cropError, setCropError] = useState<string>()\r\n\r\n useEffect(() => {\r\n setCrop({ x: 0, y: 0 })\r\n setZoom(1)\r\n setCroppedAreaPixels(undefined)\r\n setCropError(undefined)\r\n\r\n if (\r\n typeof URL === 'undefined'\r\n || typeof URL.createObjectURL !== 'function'\r\n ) {\r\n setImageUrl(undefined)\r\n setCropError(cropErrorLabel)\r\n return\r\n }\r\n\r\n const objectUrl = URL.createObjectURL(file)\r\n setImageUrl(objectUrl)\r\n\r\n return () => {\r\n if (typeof URL.revokeObjectURL === 'function') {\r\n URL.revokeObjectURL(objectUrl)\r\n }\r\n }\r\n }, [cropErrorLabel, file])\r\n\r\n const handleCropComplete = useCallback(\r\n (_croppedArea: Area, nextCroppedAreaPixels: Area) => {\r\n setCroppedAreaPixels(nextCroppedAreaPixels)\r\n },\r\n [],\r\n )\r\n\r\n const handleMediaLoaded = useCallback(() => {\r\n setCropError(undefined)\r\n }, [])\r\n\r\n const handleMediaError = useCallback(() => {\r\n setCropError(cropErrorLabel)\r\n }, [cropErrorLabel])\r\n\r\n const handleConfirm = useCallback(async () => {\r\n if (!imageUrl || !croppedAreaPixels || isProcessing) {\r\n return\r\n }\r\n\r\n setIsProcessing(true)\r\n setCropError(undefined)\r\n\r\n let croppedFile: File\r\n try {\r\n croppedFile = await createImagePickerCroppedFile(\r\n file,\r\n croppedAreaPixels,\r\n )\r\n } catch {\r\n setCropError(cropErrorLabel)\r\n setIsProcessing(false)\r\n return\r\n }\r\n\r\n setIsProcessing(false)\r\n onConfirm(croppedFile)\r\n }, [\r\n cropErrorLabel,\r\n croppedAreaPixels,\r\n file,\r\n imageUrl,\r\n isProcessing,\r\n onConfirm,\r\n ])\r\n\r\n return {\r\n imageUrl,\r\n crop,\r\n setCrop,\r\n zoom,\r\n setZoom,\r\n croppedAreaPixels,\r\n handleCropComplete,\r\n handleMediaLoaded,\r\n handleMediaError,\r\n isProcessing,\r\n cropError,\r\n handleConfirm,\r\n }\r\n}\r\n"],"names":["useImagePickerCrop","file","cropErrorLabel","onConfirm","imageUrl","setImageUrl","useState","crop","setCrop","zoom","setZoom","croppedAreaPixels","setCroppedAreaPixels","isProcessing","setIsProcessing","cropError","setCropError","useEffect","objectUrl","handleCropComplete","useCallback","_croppedArea","nextCroppedAreaPixels","handleMediaLoaded","handleMediaError","handleConfirm","croppedFile","createImagePickerCroppedFile"],"mappings":";;AAeO,MAAMA,IAAqB,CAAC;AAAA,EAC/B,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AACJ,MAA2D;AACvD,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAA,GAC1B,CAACC,GAAMC,CAAO,IAAIF,EAAgB,EAAE,GAAG,GAAG,GAAG,GAAG,GAChD,CAACG,GAAMC,CAAO,IAAIJ,EAAS,CAAC,GAC5B,CAACK,GAAmBC,CAAoB,IAAIN,EAAA,GAC5C,CAACO,GAAcC,CAAe,IAAIR,EAAS,EAAK,GAChD,CAACS,GAAWC,CAAY,IAAIV,EAAA;AAElC,EAAAW,EAAU,MAAM;AAMZ,QALAT,EAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GACtBE,EAAQ,CAAC,GACTE,EAAqB,MAAS,GAC9BI,EAAa,MAAS,GAGlB,OAAO,MAAQ,OACZ,OAAO,IAAI,mBAAoB,YACpC;AACE,MAAAX,EAAY,MAAS,GACrBW,EAAad,CAAc;AAC3B;AAAA,IACJ;AAEA,UAAMgB,IAAY,IAAI,gBAAgBjB,CAAI;AAC1C,WAAAI,EAAYa,CAAS,GAEd,MAAM;AACT,MAAI,OAAO,IAAI,mBAAoB,cAC/B,IAAI,gBAAgBA,CAAS;AAAA,IAErC;AAAA,EACJ,GAAG,CAAChB,GAAgBD,CAAI,CAAC;AAEzB,QAAMkB,IAAqBC;AAAA,IACvB,CAACC,GAAoBC,MAAgC;AACjD,MAAAV,EAAqBU,CAAqB;AAAA,IAC9C;AAAA,IACA,CAAA;AAAA,EAAC,GAGCC,IAAoBH,EAAY,MAAM;AACxC,IAAAJ,EAAa,MAAS;AAAA,EAC1B,GAAG,CAAA,CAAE,GAECQ,IAAmBJ,EAAY,MAAM;AACvC,IAAAJ,EAAad,CAAc;AAAA,EAC/B,GAAG,CAACA,CAAc,CAAC,GAEbuB,IAAgBL,EAAY,YAAY;AAC1C,QAAI,CAAChB,KAAY,CAACO,KAAqBE;AACnC;AAGJ,IAAAC,EAAgB,EAAI,GACpBE,EAAa,MAAS;AAEtB,QAAIU;AACJ,QAAI;AACA,MAAAA,IAAc,MAAMC;AAAA,QAChB1B;AAAA,QACAU;AAAA,MAAA;AAAA,IAER,QAAQ;AACJ,MAAAK,EAAad,CAAc,GAC3BY,EAAgB,EAAK;AACrB;AAAA,IACJ;AAEA,IAAAA,EAAgB,EAAK,GACrBX,EAAUuB,CAAW;AAAA,EACzB,GAAG;AAAA,IACCxB;AAAA,IACAS;AAAA,IACAV;AAAA,IACAG;AAAA,IACAS;AAAA,IACAV;AAAA,EAAA,CACH;AAED,SAAO;AAAA,IACH,UAAAC;AAAA,IACA,MAAAG;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAQ;AAAA,IACA,mBAAAI;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAX;AAAA,IACA,WAAAE;AAAA,IACA,eAAAU;AAAA,EAAA;AAER;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as ImagePicker } from './ImagePicker.tsx';
|
|
2
|
+
export { IMAGE_PICKER_STYLES } from './styles/ImagePicker.css.ts';
|
|
3
|
+
export type { ImagePickerProps } from './types/ImagePicker.props.ts';
|
|
4
|
+
export type { ImagePickerLabels, ImagePickerObjectFit, ImagePickerShape, ImagePickerValidationError, ImagePickerValidationReason, ImagePickerValue, } from './types/ImagePicker.types.ts';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../../ui-kit34.css');require('../../../../ui-kit.css');;/* empty css */;/* empty css */const e=require("@vanilla-extract/recipes/createRuntimeFn");var a={root:"_8x2wlj1",wrapper:"_8x2wlj2",preview:e.createRuntimeFn({defaultClassName:"_8x2wlj3",variantClassNames:{shape:{square:"_8x2wlj4",rounded:"_8x2wlj5",circle:"_8x2wlj6"}},defaultVariants:{shape:"rounded"},compoundVariants:[]}),empty:"_8x2wlj7",emptyIcon:"_8x2wlj8",emptyText:"_8x2wlj9",image:"_8x2wlja",scrim:"_8x2wljb",scrimText:"_8x2wljc",removeButton:e.createRuntimeFn({defaultClassName:"_8x2wljd",variantClassNames:{shape:{square:"_8x2wlje",rounded:"_8x2wljf",circle:"_8x2wljg"}},defaultVariants:{shape:"rounded"},compoundVariants:[]}),actions:"_8x2wljh",visuallyHidden:"_8x2wlji",input:"_8x2wljj"};exports.IMAGE_PICKER_STYLES=a;
|
|
2
|
+
//# sourceMappingURL=ImagePicker.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePicker.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { RuntimeFn } from '@vanilla-extract/recipes';
|
|
2
|
+
export declare const IMAGE_PICKER_STYLES: {
|
|
3
|
+
root: string;
|
|
4
|
+
wrapper: string;
|
|
5
|
+
preview: RuntimeFn<{
|
|
6
|
+
shape: {
|
|
7
|
+
square: {
|
|
8
|
+
borderRadius: `var(--${string})`;
|
|
9
|
+
};
|
|
10
|
+
rounded: {
|
|
11
|
+
borderRadius: `var(--${string})`;
|
|
12
|
+
};
|
|
13
|
+
circle: {
|
|
14
|
+
borderRadius: `var(--${string})`;
|
|
15
|
+
aspectRatio: "1";
|
|
16
|
+
height: "auto";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
empty: string;
|
|
21
|
+
emptyIcon: string;
|
|
22
|
+
emptyText: string;
|
|
23
|
+
image: string;
|
|
24
|
+
scrim: string;
|
|
25
|
+
scrimText: string;
|
|
26
|
+
removeButton: RuntimeFn<{
|
|
27
|
+
shape: {
|
|
28
|
+
square: {
|
|
29
|
+
top: `var(--${string})`;
|
|
30
|
+
right: `var(--${string})`;
|
|
31
|
+
};
|
|
32
|
+
rounded: {
|
|
33
|
+
top: `var(--${string})`;
|
|
34
|
+
right: `var(--${string})`;
|
|
35
|
+
};
|
|
36
|
+
circle: {
|
|
37
|
+
top: "7%";
|
|
38
|
+
right: "7%";
|
|
39
|
+
transform: "translate(35%, -35%)";
|
|
40
|
+
borderRadius: `var(--${string})`;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
actions: string;
|
|
45
|
+
visuallyHidden: string;
|
|
46
|
+
input: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../../../../ui-kit34.css';import '../../../../ui-kit.css';/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { createRuntimeFn as a } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
|
+
var t = { root: "_8x2wlj1", wrapper: "_8x2wlj2", preview: a({ defaultClassName: "_8x2wlj3", variantClassNames: { shape: { square: "_8x2wlj4", rounded: "_8x2wlj5", circle: "_8x2wlj6" } }, defaultVariants: { shape: "rounded" }, compoundVariants: [] }), empty: "_8x2wlj7", emptyIcon: "_8x2wlj8", emptyText: "_8x2wlj9", image: "_8x2wlja", scrim: "_8x2wljb", scrimText: "_8x2wljc", removeButton: a({ defaultClassName: "_8x2wljd", variantClassNames: { shape: { square: "_8x2wlje", rounded: "_8x2wljf", circle: "_8x2wljg" } }, defaultVariants: { shape: "rounded" }, compoundVariants: [] }), actions: "_8x2wljh", visuallyHidden: "_8x2wlji", input: "_8x2wljj" };
|
|
5
|
+
export {
|
|
6
|
+
t as IMAGE_PICKER_STYLES
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=ImagePicker.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePicker.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CSSProperties, HTMLAttributes, RefAttributes } from 'react';
|
|
2
|
+
import { IconComponent } from '../../../foundation/icon';
|
|
3
|
+
import { ImagePickerLabels, ImagePickerObjectFit, ImagePickerShape, ImagePickerValidationError, ImagePickerValue } from './ImagePicker.types.ts';
|
|
4
|
+
import type * as React from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the ImagePicker component.
|
|
7
|
+
*
|
|
8
|
+
* All other supported `HTMLAttributes<HTMLDivElement>` are forwarded to the
|
|
9
|
+
* root wrapper. Use `onValueChange` rather than a native `onChange` handler to
|
|
10
|
+
* observe image selection and removal.
|
|
11
|
+
*/
|
|
12
|
+
export type ImagePickerProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange' | 'defaultValue'> & RefAttributes<HTMLDivElement> & {
|
|
13
|
+
/** The controlled image value. Use a URL for an existing image or a File for a newly selected image. */
|
|
14
|
+
value?: ImagePickerValue;
|
|
15
|
+
/** The initial image value for uncontrolled usage. @default null */
|
|
16
|
+
defaultValue?: ImagePickerValue;
|
|
17
|
+
/** Called whenever the selected image changes or is cleared. */
|
|
18
|
+
onValueChange?: (value: ImagePickerValue) => void;
|
|
19
|
+
/** Visible field label. Also names the picker button unless `aria-label` or `aria-labelledby` is provided. */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Alternative text of the image preview. Defaults to `label`, then `labels.selected`. */
|
|
22
|
+
alt?: string;
|
|
23
|
+
/** Helper text rendered below the picker. Hidden when `error` is provided. */
|
|
24
|
+
helperText?: string;
|
|
25
|
+
/** Error text rendered below the picker, takes precedence over validation feedback, and sets `aria-invalid`. */
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Accepted file types passed to the native file input and used for file validation. @default 'image/*' */
|
|
28
|
+
accept?: string;
|
|
29
|
+
/** Maximum accepted file size in bytes. Files larger than this value are rejected. */
|
|
30
|
+
maxSize?: number;
|
|
31
|
+
/** Called when a file does not match `accept` or exceeds `maxSize`. */
|
|
32
|
+
onValidationError?: (error: ImagePickerValidationError) => void;
|
|
33
|
+
/** Disables opening the file picker, drag and drop, and all image actions. @default false */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Disables the choose/change action, native input, and drag and drop while leaving removal available. @default false */
|
|
36
|
+
disableChange?: boolean;
|
|
37
|
+
/** Disables the remove action while leaving choosing or changing the image available. @default false */
|
|
38
|
+
disableRemove?: boolean;
|
|
39
|
+
/** Marks the field as required. Native validation applies only while no image is selected. @default false */
|
|
40
|
+
required?: boolean;
|
|
41
|
+
/** Shows the remove action when an image is selected. @default true */
|
|
42
|
+
clearable?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Touch-first layout: disables drag and drop and renders explicit, full-size
|
|
45
|
+
* action buttons below the preview instead of the hover overlay and the
|
|
46
|
+
* corner remove button. @default false
|
|
47
|
+
*/
|
|
48
|
+
isMobile?: boolean;
|
|
49
|
+
/** Icon shown in the empty state. @default the bundled image-plus icon */
|
|
50
|
+
icon?: IconComponent;
|
|
51
|
+
/** Id applied to the native file input. An id is generated when omitted. */
|
|
52
|
+
inputId?: string;
|
|
53
|
+
/** Name applied to the native file input for native form submission. */
|
|
54
|
+
name?: string;
|
|
55
|
+
/** Native file-input capture hint. Leave unset to let users pick from their gallery. */
|
|
56
|
+
capture?: React.InputHTMLAttributes<HTMLInputElement>['capture'];
|
|
57
|
+
/** Localizable labels merged over the desktop or mobile defaults. */
|
|
58
|
+
labels?: Partial<ImagePickerLabels>;
|
|
59
|
+
/**
|
|
60
|
+
* Opens a crop editor for newly selected or dropped local files before
|
|
61
|
+
* committing them as the picker value. Existing URL values are not cropped.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
crop?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Fixed aspect ratio used by the crop editor. Defaults to `1` for a
|
|
67
|
+
* circular picker, the numeric value represented by `aspectRatio` when
|
|
68
|
+
* provided, or `4 / 3`.
|
|
69
|
+
*/
|
|
70
|
+
cropAspectRatio?: number;
|
|
71
|
+
/** CSS width of the picker wrapper. @default '100%' */
|
|
72
|
+
width?: CSSProperties['width'];
|
|
73
|
+
/** CSS height of the preview surface. Ignored when `shape` is `circle`. */
|
|
74
|
+
height?: CSSProperties['height'];
|
|
75
|
+
/** CSS aspect ratio of the preview surface. Ignored when `shape` is `circle`. */
|
|
76
|
+
aspectRatio?: CSSProperties['aspectRatio'];
|
|
77
|
+
/** Shape of the clickable preview. Use `circle` for profile pictures. @default 'rounded' */
|
|
78
|
+
shape?: ImagePickerShape;
|
|
79
|
+
/** Object-fit value applied to the image preview. @default 'cover' */
|
|
80
|
+
objectFit?: ImagePickerObjectFit;
|
|
81
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ImageObjectFit } from '../../../layout/image/types/Image.types.ts';
|
|
2
|
+
import { IMAGE_PICKER_SHAPES } from '../constants/imagePickerShapes.const.ts';
|
|
3
|
+
/** A remote image URL, a locally selected image file, or no image. */
|
|
4
|
+
export type ImagePickerValue = File | string | null;
|
|
5
|
+
/** Reasons why a selected or dropped file can be rejected before it becomes the value. */
|
|
6
|
+
export type ImagePickerValidationReason = 'invalidType' | 'maxSize';
|
|
7
|
+
/** Details passed to `onValidationError` when a file is rejected. */
|
|
8
|
+
export type ImagePickerValidationError = {
|
|
9
|
+
/** The validation rule that rejected the file. */
|
|
10
|
+
reason: ImagePickerValidationReason;
|
|
11
|
+
/** The file that failed validation. */
|
|
12
|
+
file: File;
|
|
13
|
+
/** The configured byte limit when `reason` is `maxSize`. */
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
};
|
|
16
|
+
/** Localizable text used by picker actions, crop controls, empty state, and validation feedback. */
|
|
17
|
+
export type ImagePickerLabels = {
|
|
18
|
+
/** Label for the choose action when no image is selected. */
|
|
19
|
+
choose: string;
|
|
20
|
+
/** Label for the choose action when an image is already selected. */
|
|
21
|
+
change: string;
|
|
22
|
+
/** Label for the remove action. */
|
|
23
|
+
remove: string;
|
|
24
|
+
/** Title shown above the crop editor. @default 'Crop image' */
|
|
25
|
+
crop?: string;
|
|
26
|
+
/** Label for the action that discards the current crop. @default 'Cancel' */
|
|
27
|
+
cancel?: string;
|
|
28
|
+
/** Label for the action that applies the current crop. @default 'Apply crop' */
|
|
29
|
+
apply?: string;
|
|
30
|
+
/** Label for the crop zoom control. @default 'Zoom' */
|
|
31
|
+
zoom?: string;
|
|
32
|
+
/** Accessible label for the interactive crop area. @default 'Adjust crop' */
|
|
33
|
+
cropArea?: string;
|
|
34
|
+
/** Feedback shown when the selected crop cannot be generated. */
|
|
35
|
+
cropError?: string;
|
|
36
|
+
/** Instruction shown in the empty preview state. */
|
|
37
|
+
empty: string;
|
|
38
|
+
/** Fallback alternative text for a selected image. */
|
|
39
|
+
selected: string;
|
|
40
|
+
/** Validation message shown for an unsupported file type. */
|
|
41
|
+
invalidType: string;
|
|
42
|
+
/** Validation message shown when a file exceeds `maxSize`. */
|
|
43
|
+
maxSize: string;
|
|
44
|
+
};
|
|
45
|
+
/** Object-fit values supported by the image preview. */
|
|
46
|
+
export type ImagePickerObjectFit = ImageObjectFit;
|
|
47
|
+
/** Fully resolved labels used internally after defaults are merged. */
|
|
48
|
+
export type ImagePickerResolvedLabels = Required<ImagePickerLabels>;
|
|
49
|
+
/** Shape values supported by the clickable image dropzone. */
|
|
50
|
+
export type ImagePickerShape = (typeof IMAGE_PICKER_SHAPES)[keyof typeof IMAGE_PICKER_SHAPES];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>typeof File<"u"&&e instanceof File,g=e=>{const t=e.dataTransfer;return Array.from(t?.types??[]).includes("Files")||!!t?.files?.length},h=e=>{if(typeof e=="number")return Number.isFinite(e)&&e>0?e:void 0;if(typeof e!="string")return;const t=Number(e.trim());if(Number.isFinite(t)&&t>0)return t;const r=e.split("/").map(n=>Number(n.trim()));if(!(r.length!==2||r.some(n=>!Number.isFinite(n)||n<=0)))return r[0]/r[1]},y=(e,t)=>{const r=t.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean);if(r.length===0)return!0;const n=e.type.toLowerCase(),o=e.name.toLowerCase();return r.some(i=>i.startsWith(".")?o.endsWith(i):i.endsWith("/*")?n.startsWith(i.slice(0,-1)):n===i)},w=(e,t)=>{if(!e)return;if(!u(t)){e.value="";return}if(e.files?.[0]===t||(e.value="",typeof DataTransfer!="function"))return;const r=new DataTransfer;r.items.add(t),e.files=r.files},b=e=>new Promise((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=()=>r(new Error("The image could not be loaded.")),n.src=e}),p=async(e,t)=>{if(typeof document>"u"||typeof URL>"u"||typeof URL.createObjectURL!="function")throw new Error("Image cropping is not available in this environment.");const r=URL.createObjectURL(e);try{const n=await b(r),o=Math.max(1,Math.round(t.width)),i=Math.max(1,Math.round(t.height)),a=document.createElement("canvas");a.width=o,a.height=i;const s=a.getContext("2d");if(!s)throw new Error("The image crop canvas is not available.");s.drawImage(n,Math.round(t.x),Math.round(t.y),o,i,0,0,o,i);const c=e.type||"image/png",m=await new Promise((d,l)=>{a.toBlob(f=>{if(f){d(f);return}l(new Error("The cropped image could not be encoded."))},c)});return new File([m],e.name,{type:m.type||c,lastModified:e.lastModified})}finally{typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(r)}};exports.acceptsImagePickerFile=y;exports.createImagePickerCroppedFile=p;exports.hasImagePickerFiles=g;exports.isImagePickerFile=u;exports.resolveImagePickerAspectRatio=h;exports.syncImagePickerInput=w;
|
|
2
|
+
//# sourceMappingURL=imagePicker.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imagePicker.utils.cjs","sources":["../../../../../src/components/forms/image-picker/utils/imagePicker.utils.ts"],"sourcesContent":["import type { CSSProperties, DragEvent } from 'react'\r\nimport type { Area } from 'react-easy-crop'\r\n\r\nimport type { ImagePickerValue } from '@components/forms/image-picker/types/ImagePicker.types.ts'\r\n\r\n/**\r\n * Checks whether a picker value is a locally selected file.\r\n *\r\n * @param value The current picker value to narrow.\r\n * @returns `true` when `value` is a `File`.\r\n */\r\nexport const isImagePickerFile = (\r\n value: ImagePickerValue,\r\n): value is File =>\r\n typeof File !== 'undefined' && value instanceof File\r\n\r\n/**\r\n * Checks whether a drag event contains files rather than unrelated data.\r\n *\r\n * @param event The drag event emitted by the preview button.\r\n * @returns `true` when the event advertises files or contains at least one file.\r\n */\r\nexport const hasImagePickerFiles = (event: DragEvent): boolean => {\r\n const dataTransfer = event.dataTransfer\r\n const types = Array.from(dataTransfer?.types ?? [])\r\n\r\n return types.includes('Files') || Boolean(dataTransfer?.files?.length)\r\n}\r\n\r\n/**\r\n * Resolves a CSS aspect-ratio value to the numeric ratio required by the\r\n * cropper.\r\n *\r\n * @param aspectRatio The CSS ratio, such as `16 / 9`, or a numeric ratio.\r\n * @returns The positive numeric ratio, or `undefined` for non-fixed values.\r\n */\r\nexport const resolveImagePickerAspectRatio = (\r\n aspectRatio: CSSProperties['aspectRatio'],\r\n): number | undefined => {\r\n if (typeof aspectRatio === 'number') {\r\n return Number.isFinite(aspectRatio) && aspectRatio > 0\r\n ? aspectRatio\r\n : undefined\r\n }\r\n\r\n if (typeof aspectRatio !== 'string') {\r\n return undefined\r\n }\r\n\r\n const numericRatio = Number(aspectRatio.trim())\r\n if (Number.isFinite(numericRatio) && numericRatio > 0) {\r\n return numericRatio\r\n }\r\n\r\n const ratioParts = aspectRatio.split('/').map((part) => Number(part.trim()))\r\n if (\r\n ratioParts.length !== 2\r\n || ratioParts.some((part) => !Number.isFinite(part) || part <= 0)\r\n ) {\r\n return undefined\r\n }\r\n\r\n return ratioParts[0] / ratioParts[1]\r\n}\r\n\r\n/**\r\n * Tests a file against a native-style comma-separated `accept` value.\r\n *\r\n * MIME types, MIME wildcards such as `image/*`, and file extensions are\r\n * supported. An empty `accept` value accepts every file.\r\n *\r\n * @param file The file to validate.\r\n * @param accept The comma-separated accepted MIME types or extensions.\r\n * @returns `true` when the file matches at least one accepted value.\r\n */\r\nexport const acceptsImagePickerFile = (\r\n file: File,\r\n accept: string,\r\n): boolean => {\r\n const acceptedTypes = accept\r\n .split(',')\r\n .map((type) => type.trim().toLowerCase())\r\n .filter(Boolean)\r\n\r\n if (acceptedTypes.length === 0) {\r\n return true\r\n }\r\n\r\n const fileType = file.type.toLowerCase()\r\n const fileName = file.name.toLowerCase()\r\n\r\n return acceptedTypes.some((acceptedType) => {\r\n if (acceptedType.startsWith('.')) {\r\n return fileName.endsWith(acceptedType)\r\n }\r\n\r\n if (acceptedType.endsWith('/*')) {\r\n return fileType.startsWith(acceptedType.slice(0, -1))\r\n }\r\n\r\n return fileType === acceptedType\r\n })\r\n}\r\n\r\n/**\r\n * Mirrors a local file value into the native file input so form submission and\r\n * validation stay consistent with the picker preview.\r\n *\r\n * URL and empty values clear the input. Local files are assigned through\r\n * `DataTransfer` when the browser supports it; unsupported environments leave\r\n * the input cleared.\r\n *\r\n * @param input The native file input to synchronize, if mounted.\r\n * @param value The current picker value.\r\n */\r\nexport const syncImagePickerInput = (\r\n input: HTMLInputElement | null,\r\n value: ImagePickerValue,\r\n) => {\r\n if (!input) {\r\n return\r\n }\r\n\r\n if (!isImagePickerFile(value)) {\r\n input.value = ''\r\n return\r\n }\r\n\r\n if (input.files?.[0] === value) {\r\n return\r\n }\r\n\r\n input.value = ''\r\n\r\n if (typeof DataTransfer !== 'function') {\r\n return\r\n }\r\n\r\n const dataTransfer = new DataTransfer()\r\n dataTransfer.items.add(value)\r\n input.files = dataTransfer.files\r\n}\r\n\r\nconst loadImagePickerImage = (source: string): Promise<HTMLImageElement> =>\r\n new Promise((resolve, reject) => {\r\n const image = new Image()\r\n image.onload = () => resolve(image)\r\n image.onerror = () => reject(new Error('The image could not be loaded.'))\r\n image.src = source\r\n })\r\n\r\n/**\r\n * Renders a crop area into a new local image file.\r\n *\r\n * The crop coordinates emitted by `react-easy-crop` are already expressed in\r\n * the source image's natural pixels, so no additional scale conversion is\r\n * needed before drawing to the canvas.\r\n *\r\n * @param file The original local image file.\r\n * @param cropAreaPixels The selected crop rectangle in source-image pixels.\r\n * @returns A new file with the original name and image MIME type.\r\n * @throws When the browser cannot load the image, create a canvas context, or\r\n * encode the cropped canvas.\r\n */\r\nexport const createImagePickerCroppedFile = async (\r\n file: File,\r\n cropAreaPixels: Area,\r\n): Promise<File> => {\r\n if (\r\n typeof document === 'undefined'\r\n || typeof URL === 'undefined'\r\n || typeof URL.createObjectURL !== 'function'\r\n ) {\r\n throw new Error('Image cropping is not available in this environment.')\r\n }\r\n\r\n const sourceUrl = URL.createObjectURL(file)\r\n\r\n try {\r\n const image = await loadImagePickerImage(sourceUrl)\r\n const width = Math.max(1, Math.round(cropAreaPixels.width))\r\n const height = Math.max(1, Math.round(cropAreaPixels.height))\r\n const canvas = document.createElement('canvas')\r\n canvas.width = width\r\n canvas.height = height\r\n\r\n const context = canvas.getContext('2d')\r\n if (!context) {\r\n throw new Error('The image crop canvas is not available.')\r\n }\r\n\r\n context.drawImage(\r\n image,\r\n Math.round(cropAreaPixels.x),\r\n Math.round(cropAreaPixels.y),\r\n width,\r\n height,\r\n 0,\r\n 0,\r\n width,\r\n height,\r\n )\r\n\r\n const outputType = file.type || 'image/png'\r\n const blob = await new Promise<Blob>((resolve, reject) => {\r\n canvas.toBlob((result) => {\r\n if (result) {\r\n resolve(result)\r\n return\r\n }\r\n\r\n reject(new Error('The cropped image could not be encoded.'))\r\n }, outputType)\r\n })\r\n\r\n return new File([blob], file.name, {\r\n type: blob.type || outputType,\r\n lastModified: file.lastModified,\r\n })\r\n } finally {\r\n if (typeof URL.revokeObjectURL === 'function') {\r\n URL.revokeObjectURL(sourceUrl)\r\n }\r\n }\r\n}\r\n"],"names":["isImagePickerFile","value","hasImagePickerFiles","event","dataTransfer","resolveImagePickerAspectRatio","aspectRatio","numericRatio","ratioParts","part","acceptsImagePickerFile","file","accept","acceptedTypes","type","fileType","fileName","acceptedType","syncImagePickerInput","input","loadImagePickerImage","source","resolve","reject","image","createImagePickerCroppedFile","cropAreaPixels","sourceUrl","width","height","canvas","context","outputType","blob","result"],"mappings":"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"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CSSProperties, DragEvent } from 'react';
|
|
2
|
+
import { Area } from 'react-easy-crop';
|
|
3
|
+
import { ImagePickerValue } from '../types/ImagePicker.types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Checks whether a picker value is a locally selected file.
|
|
6
|
+
*
|
|
7
|
+
* @param value The current picker value to narrow.
|
|
8
|
+
* @returns `true` when `value` is a `File`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isImagePickerFile: (value: ImagePickerValue) => value is File;
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether a drag event contains files rather than unrelated data.
|
|
13
|
+
*
|
|
14
|
+
* @param event The drag event emitted by the preview button.
|
|
15
|
+
* @returns `true` when the event advertises files or contains at least one file.
|
|
16
|
+
*/
|
|
17
|
+
export declare const hasImagePickerFiles: (event: DragEvent) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves a CSS aspect-ratio value to the numeric ratio required by the
|
|
20
|
+
* cropper.
|
|
21
|
+
*
|
|
22
|
+
* @param aspectRatio The CSS ratio, such as `16 / 9`, or a numeric ratio.
|
|
23
|
+
* @returns The positive numeric ratio, or `undefined` for non-fixed values.
|
|
24
|
+
*/
|
|
25
|
+
export declare const resolveImagePickerAspectRatio: (aspectRatio: CSSProperties["aspectRatio"]) => number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Tests a file against a native-style comma-separated `accept` value.
|
|
28
|
+
*
|
|
29
|
+
* MIME types, MIME wildcards such as `image/*`, and file extensions are
|
|
30
|
+
* supported. An empty `accept` value accepts every file.
|
|
31
|
+
*
|
|
32
|
+
* @param file The file to validate.
|
|
33
|
+
* @param accept The comma-separated accepted MIME types or extensions.
|
|
34
|
+
* @returns `true` when the file matches at least one accepted value.
|
|
35
|
+
*/
|
|
36
|
+
export declare const acceptsImagePickerFile: (file: File, accept: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Mirrors a local file value into the native file input so form submission and
|
|
39
|
+
* validation stay consistent with the picker preview.
|
|
40
|
+
*
|
|
41
|
+
* URL and empty values clear the input. Local files are assigned through
|
|
42
|
+
* `DataTransfer` when the browser supports it; unsupported environments leave
|
|
43
|
+
* the input cleared.
|
|
44
|
+
*
|
|
45
|
+
* @param input The native file input to synchronize, if mounted.
|
|
46
|
+
* @param value The current picker value.
|
|
47
|
+
*/
|
|
48
|
+
export declare const syncImagePickerInput: (input: HTMLInputElement | null, value: ImagePickerValue) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Renders a crop area into a new local image file.
|
|
51
|
+
*
|
|
52
|
+
* The crop coordinates emitted by `react-easy-crop` are already expressed in
|
|
53
|
+
* the source image's natural pixels, so no additional scale conversion is
|
|
54
|
+
* needed before drawing to the canvas.
|
|
55
|
+
*
|
|
56
|
+
* @param file The original local image file.
|
|
57
|
+
* @param cropAreaPixels The selected crop rectangle in source-image pixels.
|
|
58
|
+
* @returns A new file with the original name and image MIME type.
|
|
59
|
+
* @throws When the browser cannot load the image, create a canvas context, or
|
|
60
|
+
* encode the cropped canvas.
|
|
61
|
+
*/
|
|
62
|
+
export declare const createImagePickerCroppedFile: (file: File, cropAreaPixels: Area) => Promise<File>;
|