mood-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs +6 -6
- package/dist/components/data-display/calendar/AgendaView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/data-display/calendar/Calendar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/DayView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/calendar/MonthView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/Scheduler.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs +7 -7
- package/dist/components/data-display/calendar/WeekView.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/data-display/date-picker/DateTimePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/Table.cjs +1 -1
- package/dist/components/data-display/table/Table.cjs.map +1 -1
- package/dist/components/data-display/table/Table.mjs +1 -1
- package/dist/components/data-display/table/Table.mjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +37 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +38 -2
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs +4 -4
- package/dist/components/feedback/Banner.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Drawer.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs +5 -5
- package/dist/components/feedback/Modal.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs +369 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs +368 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.cjs +6 -0
- package/dist/components/feedback/tour/Tour2.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.mjs +7 -0
- package/dist/components/feedback/tour/Tour2.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.cjs +6 -0
- package/dist/components/feedback/tour/TourCard.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.mjs +7 -0
- package/dist/components/feedback/tour/TourCard.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs +102 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs +101 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.cjs +75 -0
- package/dist/components/feedback/tour/tourAnchor.cjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.mjs +72 -0
- package/dist/components/feedback/tour/tourAnchor.mjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.cjs +108 -0
- package/dist/components/feedback/tour/tourPlace.cjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.mjs +107 -0
- package/dist/components/feedback/tour/tourPlace.mjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.cjs +121 -0
- package/dist/components/feedback/tour/tourShape.cjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.mjs +118 -0
- package/dist/components/feedback/tour/tourShape.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs +60 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs +59 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.cjs +108 -0
- package/dist/components/feedback/tour/useTourSteps.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.mjs +107 -0
- package/dist/components/feedback/tour/useTourSteps.mjs.map +1 -0
- package/dist/components/forms/Button.cjs +1 -1
- package/dist/components/forms/Button.cjs.map +1 -1
- package/dist/components/forms/Button.mjs +1 -1
- package/dist/components/forms/Button.mjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/FileInput.cjs +1 -1
- package/dist/components/forms/FileInput.cjs.map +1 -1
- package/dist/components/forms/FileInput.mjs +1 -1
- package/dist/components/forms/FileInput.mjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.cjs +1 -1
- package/dist/components/forms/MultiSelect.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.mjs +1 -1
- package/dist/components/forms/MultiSelect.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/TagInput.cjs.map +1 -1
- package/dist/components/forms/TagInput.mjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Textarea.cjs.map +1 -1
- package/dist/components/forms/Textarea.mjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.mjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/dist/components/forms/morph-select/MorphSelectTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/Canvas.cjs +1 -1
- package/dist/components/layout/Canvas.cjs.map +1 -1
- package/dist/components/layout/Canvas.mjs +1 -1
- package/dist/components/layout/Canvas.mjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.cjs +1 -1
- package/dist/components/layout/PopoverPanel.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.mjs +1 -1
- package/dist/components/layout/PopoverPanel.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/Switcher.cjs.map +1 -1
- package/dist/components/navigation/Switcher.mjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/composables/useField.cjs +28 -8
- package/dist/composables/useField.cjs.map +1 -1
- package/dist/composables/useField.mjs +28 -8
- package/dist/composables/useField.mjs.map +1 -1
- package/dist/config/ModoLocale.cjs +10 -1
- package/dist/config/ModoLocale.cjs.map +1 -1
- package/dist/config/ModoLocale.mjs +10 -1
- package/dist/config/ModoLocale.mjs.map +1 -1
- package/dist/config/locales/es.cjs +10 -1
- package/dist/config/locales/es.cjs.map +1 -1
- package/dist/config/locales/es.mjs +10 -1
- package/dist/config/locales/es.mjs.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.mjs +3 -1
- package/dist/mood-ui.css +293 -117
- package/dist/types/components/data-display/surface-card/SurfaceCardBody.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardFooter.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardHeader.vue.d.ts +1 -1
- package/dist/types/components/feedback/dialog/DialogContent.vue.d.ts +1 -1
- package/dist/types/components/feedback/tour/Tour.vue.d.ts +31 -0
- package/dist/types/components/feedback/tour/TourCard.vue.d.ts +25 -0
- package/dist/types/components/feedback/tour/index.d.ts +2 -0
- package/dist/types/components/feedback/tour/tourAnchor.d.ts +12 -0
- package/dist/types/components/feedback/tour/tourPlace.d.ts +60 -0
- package/dist/types/components/feedback/tour/tourShape.d.ts +36 -0
- package/dist/types/components/feedback/tour/useTourSpotlight.d.ts +14 -0
- package/dist/types/components/feedback/tour/useTourSteps.d.ts +31 -0
- package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
- package/dist/types/components/layout/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/types/components/navigation/menu/MenuContent.vue.d.ts +1 -1
- package/dist/types/composables/useField.d.ts +23 -0
- package/dist/types/config/ModoLocale.d.ts +14 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/feedback/Tour.interface.d.ts +73 -0
- package/dist/types/interfaces/navigation/Switcher.interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.mjs","names":[],"sources":["../../../src/components/forms/FileInput.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div \n :class=\"[ \n 'modo-field-wrapper transition-colors', \n dashed ? dashedWrapperClasses : wrapperVariantClasses, \n isAreaVariant ? '' : wrapperSizeClasses, \n radiusClasses, \n colorBorderClass, \n fullWidth ? 'w-full' : '', \n isDisabled ? 'opacity-60 cursor-not-allowed' : '', \n isDragOver ? dragOverRingClass : '', \n isAreaVariant && clickToSelect && !isDisabled && !readonly ? 'cursor-pointer' : '', \n ]\" \n :role=\"isAreaVariant ? 'button' : undefined\" \n :tabindex=\"isAreaVariant && !isDisabled && !readonly ? 0 : undefined\" \n :aria-label=\"isAreaVariant ? (ariaLabel ?? label ?? dropzoneLabel ?? loc.fileInput.uploadFiles) : undefined\" \n @dragover.prevent=\"onDragOver\" \n @dragleave.prevent=\"onDragLeave\" \n @drop.prevent=\"onDrop\" \n @click=\"onWrapperClick\" \n @keydown=\"onWrapperKeydown\" \n > \n <!-- Area variant --> \n <div \n v-if=\"isAreaVariant\" \n :class=\"[ \n 'flex flex-col items-center justify-center text-center gap-2 px-4', \n areaHeightClasses, \n ]\" \n > \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 transition-colors duration-base ease-standard', \n isDragOver ? accentTextClass : accentTextIdleClass, \n areaIconSizeClasses, \n ]\" \n /> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\"> \n {{ areaPrimaryText }} \n </Typography> \n <Typography v-if=\"areaSecondaryText\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\"> \n {{ areaSecondaryText }} \n </Typography> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n class=\"mt-1\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Inline variant (default) --> \n <div v-else class=\"flex items-center gap-3\"> \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"['shrink-0', accentTextIdleClass, iconSizeClasses]\" \n /> \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\" :truncate=\"true\"> \n {{ files.length === 0 ? (placeholder ?? loc.fileInput.placeholder) : headlineText }} \n </Typography> \n <Typography v-if=\"helperInlineText\" variant=\"caption\" size=\"medium\" color=\"muted\" :truncate=\"true\" as=\"p\"> \n {{ helperInlineText }} \n </Typography> \n </div> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Hidden native input --> \n <input \n :id=\"fieldId\" \n ref=\"inputEl\" \n type=\"file\" \n class=\"sr-only\" \n :name=\"name\" \n :accept=\"accept\" \n :multiple=\"multiple\" \n :disabled=\"isDisabled\" \n :required=\"required\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n @change=\"onPickerChange\" \n /> \n </div> \n \n <!-- File list / previews (fuera del dropzone para no romper su forma) --> \n <TransitionGroup \n v-show=\"files.length\" \n appear \n name=\"modo-file\" \n tag=\"ul\" \n :class=\"[ \n 'flex flex-col mt-1', \n previews ? 'md:grid md:grid-cols-2 lg:grid-cols-3 md:gap-2' : '', \n ]\" \n > \n <li \n v-for=\"entry in files\" \n :key=\"entry.id\" \n :class=\"[ \n 'modo-file-item relative flex items-center gap-2 p-2 border border-border bg-background', \n // Vertical spacing via margin-bottom (not parent gap) so \n // it can animate to 0 on leave without causing a sibling \n // snap. Using mb (not mt) means when an item is removed \n // the newly-exposed sibling keeps its position. \n '[&:not(:last-child)]:mb-1.5 md:[&:not(:last-child)]:mb-0', \n itemRadiusClass, \n ]\" \n > \n <div \n v-if=\"previews && entry.previewUrl\" \n :class=\"[ \n 'shrink-0 w-10 h-10 overflow-hidden bg-muted', \n itemThumbRadiusClass, \n ]\" \n > \n <img :src=\"entry.previewUrl\" :alt=\"entry.name\" class=\"w-full h-full object-cover\" /> \n </div> \n <component \n v-else \n :is=\"isImage(entry) ? PhotoIcon : DocumentIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 w-8 h-8 text-muted-foreground p-1.5 bg-muted', \n itemThumbRadiusClass, \n ]\" \n /> \n \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"caption\" size=\"medium\" weight=\"medium\" :truncate=\"true\" as=\"p\">{{ entry.name }}</Typography> \n <p class=\"text-[11px] text-muted-foreground\"> \n {{ formatBytes(entry.size) }} \n <span v-if=\"entry.error\" class=\"text-destructive\">· {{ entry.error }}</span> \n </p> \n <!-- Progress bar --> \n <div \n v-if=\"typeof entry.progress === 'number' && entry.progress >= 0 && entry.progress < 100\" \n :class=\"['mt-1 h-1 overflow-hidden', progressRadiusClass, 'bg-muted']\" \n > \n <div \n :class=\"['h-full transition-all duration-base ease-standard', progressFillClass]\" \n :style=\"{ width: `${entry.progress}%` }\" \n /> \n </div> \n </div> \n \n <div v-if=\"!isDisabled && !readonly\" @click.stop> \n <Button \n variant=\"text\" \n :color=\"color\" \n size=\"small\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"`Remove ${entry.name}`\" \n @click=\"removeFile(entry.id)\" \n /> \n </div> \n </li> \n </TransitionGroup> \n \n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\"> \n <Typography v-if=\"errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography> \n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport type { \n FileInput, \n FileInputFile, \n FileInputRejectCode, \n FileInputRejectContext, \n FileInputRejection, \n} from '../../interfaces/forms/FileInput.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\nimport { interpolate } from '../../config/ModoLocale'; \nimport { ArrowUpTrayIcon, XMarkIcon, PhotoIcon, DocumentIcon } from '@heroicons/vue/24/outline'; \nimport Button from './Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \n \nconst props = withDefaults(defineProps<FileInput>(), { \n modelValue: null, \n multiple: false, \n previews: true, \n dropzone: true, \n dropzoneVariant: 'inline', \n dropzoneHeight: 'medium', \n dashed: false, \n clickToSelect: true, \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n fullWidth: false, \n // `placeholder` is resolved at render time against the locale fallback. \n // Leaving the default undefined so `props.placeholder ?? loc...` works. \n autofocus: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst emit = defineEmits<{ \n 'update:modelValue': [files: File[] | null]; \n change: [files: File[] | null]; \n add: [files: File[]]; \n remove: [file: File]; \n reject: [rejections: FileInputRejection[]]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst { \n fieldId, hasError, isDisabled, errorId, helperId, describedBy, \n stateColor, radius, \n} = useFieldState(props, { componentName: 'FileInput', idPrefix: 'modo-file' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, hasError, radius, \n forceFocus: () => isDragOver.value, \n halo: () => props.halo, \n}); \n \nconst inputEl = ref<HTMLInputElement | null>(null); \nconst isDragOver = ref(false); \nconst internalFiles = ref<FileInputFile[]>([]); \nconst autoId = useId(); \nlet counter = 0; \nconst makeId = () => `modo-file-${autoId}-${++counter}`; \n \nfunction isImage(entry: FileInputFile) { \n return entry.type.startsWith('image/'); \n} \n \nfunction formatBytes(n: number) { \n if (n < 1024) return `${n} B`; \n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; \n if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`; \n return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`; \n} \n \nfunction openFilePicker() { \n if (isDisabled.value || props.readonly) return; \n inputEl.value?.click(); \n} \n \nfunction validate(file: File): { code: FileInputRejectCode; limit?: number | string } | null { \n if (props.maxSize && file.size > props.maxSize) { \n return { code: 'size', limit: props.maxSize }; \n } \n // Accept check (simple prefix + ext match) \n if (props.accept) { \n const tokens = props.accept.split(',').map((t) => t.trim().toLowerCase()); \n const name = file.name.toLowerCase(); \n const type = file.type.toLowerCase(); \n const ok = tokens.some((t) => { \n if (t.startsWith('.')) return name.endsWith(t); \n if (t.endsWith('/*')) return type.startsWith(t.slice(0, -1)); \n return type === t; \n }); \n if (!ok) return { code: 'type', limit: props.accept }; \n } \n return null; \n} \n \n/** \n * Reject message resolver with three-tier precedence: \n * 1. Per-component prop `rejectMessages` (fn > string with `{limit}`). \n * 2. `ModoProvider`-level `locale.fileInput.reject`. \n * 3. Built-in English defaults in `defaultLocale`. \n */ \nfunction resolveRejectMessage(ctx: FileInputRejectContext): string { \n const override = props.rejectMessages?.[ctx.code]; \n if (typeof override === 'function') return override(ctx); \n if (typeof override === 'string') { \n return applyLimit(override, ctx); \n } \n // Fall back to locale (which itself falls back to defaultLocale EN). \n const reject = loc.value.fileInput.reject; \n let template: string; \n if (ctx.code === 'size') { \n template = typeof ctx.limit === 'number' ? reject.size : reject.sizeNoLimit; \n } else if (ctx.code === 'count') { \n template = typeof ctx.limit === 'number' ? reject.count : reject.countNoLimit; \n } else { \n template = reject.type; \n } \n return applyLimit(template, ctx); \n} \n \nfunction applyLimit(template: string, ctx: FileInputRejectContext): string { \n if (!template.includes('{limit}')) return template; \n const value = \n typeof ctx.limit === 'number' && ctx.code === 'size' \n ? ctx.formatBytes(ctx.limit) \n : String(ctx.limit ?? ''); \n return template.split('{limit}').join(value); \n} \n \nfunction buildRejection( \n file: File, \n code: FileInputRejectCode, \n limit?: number | string, \n): FileInputRejection { \n const ctx: FileInputRejectContext = { file, code, limit, formatBytes }; \n return { file, code, limit, message: resolveRejectMessage(ctx) }; \n} \n \nfunction addFiles(list: FileList | File[]) { \n const incoming = Array.from(list); \n const accepted: FileInputFile[] = []; \n const rejected: FileInputRejection[] = []; \n \n for (const file of incoming) { \n const err = validate(file); \n if (err) { \n rejected.push(buildRejection(file, err.code, err.limit)); \n continue; \n } \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n accepted.push(entry); \n } \n \n // Respect multiple + maxFiles \n if (!props.multiple) { \n // Replace with first \n revokeAll(); \n internalFiles.value = accepted.slice(0, 1); \n } else { \n const next = [...internalFiles.value, ...accepted]; \n if (props.maxFiles && next.length > props.maxFiles) { \n const overflow = next.slice(props.maxFiles); \n overflow.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = next.slice(0, props.maxFiles); \n overflow.forEach((e) => \n rejected.push(buildRejection(e.file, 'count', props.maxFiles)), \n ); \n } else { \n internalFiles.value = next; \n } \n } \n \n if (accepted.length) emit('add', accepted.map((e) => e.file)); \n if (rejected.length) emit('reject', rejected); \n emitUpdate(); \n} \n \nfunction removeFile(id: string) { \n const idx = internalFiles.value.findIndex((e) => e.id === id); \n if (idx === -1) return; \n const [removed] = internalFiles.value.splice(idx, 1); \n if (removed.previewUrl) URL.revokeObjectURL(removed.previewUrl); \n emit('remove', removed.file); \n emitUpdate(); \n} \n \nfunction emitUpdate() { \n const out = internalFiles.value.map((e) => e.file); \n emit('update:modelValue', out.length ? out : null); \n emit('change', out.length ? out : null); \n} \n \nfunction revokeAll() { \n internalFiles.value.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = []; \n} \n \nonBeforeUnmount(() => revokeAll()); \n \n/* ---------- Events ---------- */ \n \nfunction onPickerChange(e: Event) { \n const input = e.target as HTMLInputElement; \n if (input.files && input.files.length) { \n addFiles(input.files); \n } \n // Reset para permitir re-seleccionar el mismo archivo \n input.value = ''; \n} \n \nfunction onDragOver(e: DragEvent) { \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy'; \n isDragOver.value = true; \n} \nfunction onDragLeave() { \n isDragOver.value = false; \n} \nfunction onDrop(e: DragEvent) { \n isDragOver.value = false; \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer?.files?.length) { \n addFiles(e.dataTransfer.files); \n } \n} \n \nfunction onWrapperClick(e: MouseEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n // Ignora clicks provenientes de elementos interactivos (botones, remove) \n const target = e.target as HTMLElement | null; \n if (target?.closest('button, a, input, [role=\"button\"][data-modo-item]')) return; \n openFilePicker(); \n} \nfunction onWrapperKeydown(e: KeyboardEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n if (e.key === 'Enter' || e.key === ' ') { \n e.preventDefault(); \n openFilePicker(); \n } \n} \n \n/* ---------- Merge external progress / errors ---------- */ \nconst files = computed<FileInputFile[]>(() => \n internalFiles.value.map((e) => ({ \n ...e, \n progress: props.progress?.[e.id] ?? e.progress, \n error: props.errors?.[e.id] ?? e.error, \n })), \n); \n \n/* ---------- v-model sync from outside ---------- */ \nwatch(() => props.modelValue, (v) => { \n if (!v) { \n if (internalFiles.value.length) revokeAll(); \n return; \n } \n // Solo sincroniza si el caller reemplazó la lista entera con otras refs. \n const current = internalFiles.value.map((e) => e.file); \n if (v.length === current.length && v.every((f, i) => f === current[i])) return; \n revokeAll(); \n const wrapped: FileInputFile[] = v.map((file) => { \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n return entry; \n }); \n internalFiles.value = wrapped; \n}, { immediate: true }); \n \n/* ---------- Display ---------- */ \n \nconst headlineText = computed(() => { \n if (files.value.length === 1) return files.value[0].name; \n return interpolate(loc.value.fileInput.filesSelected, { count: files.value.length }); \n}); \n \nconst helperInlineText = computed(() => { \n const bits: string[] = []; \n if (props.accept) bits.push(props.accept); \n if (props.maxSize) bits.push(interpolate(loc.value.fileInput.hintUpTo, { limit: formatBytes(props.maxSize) })); \n if (props.multiple && props.maxFiles) bits.push(interpolate(loc.value.fileInput.hintMax, { limit: props.maxFiles })); \n return bits.join(' · '); \n}); \n \nconst browseLabel = computed(() => \n props.multiple \n ? (files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse) \n : (files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse), \n); \n \n/* ---------- Size maps ---------- */\nconst wrapperSizeClasses = computed(() => `${sz.value.control} ${sz.value.padX}`);\nconst iconSizeClasses = computed(() => sz.value.icon); \n \n/* ---------- Area variant ---------- */ \nconst isAreaVariant = computed(() => props.dropzoneVariant === 'area'); \n \nconst areaHeightClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'min-h-[120px] py-4'; \n case 'large': return 'min-h-[240px] py-10'; \n default: return 'min-h-[180px] py-8'; \n } \n}); \n \nconst areaIconSizeClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'w-8 h-8'; \n case 'large': return 'w-14 h-14'; \n default: return 'w-10 h-10'; \n } \n}); \n \nconst areaPrimaryText = computed(() => { \n if (props.dropzoneLabel) return props.dropzoneLabel; \n if (files.value.length === 0) { \n return props.multiple \n ? loc.value.fileInput.dropzoneLabelMultiple \n : loc.value.fileInput.dropzoneLabel; \n } \n return headlineText.value; \n}); \n \nconst areaSecondaryText = computed<string | undefined>(() => { \n if (props.dropzoneHint) return props.dropzoneHint; \n return helperInlineText.value || undefined; \n}); \n \n/* ---------- Color / dashed accents ---------- */ \nconst ACCENT_TEXT_BY_COLOR: Record<string, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \nconst ACCENT_TEXT_IDLE_BY_COLOR: Record<string, string> = { \n default: 'text-muted-foreground', \n primary: 'text-primary/70', \n danger: 'text-destructive/70', \n success: 'text-success/70', \n warning: 'text-warning/70', \n}; \n// Dashed variant keeps a transparent surface — colored fills felt heavy \n// against form backgrounds. Color only surfaces via icon/button accents. \nconst DRAG_OVER_RING_BY_COLOR: Record<string, string> = { \n default: 'ring-4 ring-foreground/25 border-foreground', \n primary: 'ring-4 ring-primary/40 border-primary', \n danger: 'ring-4 ring-destructive/40 border-destructive', \n success: 'ring-4 ring-success/40 border-success', \n warning: 'ring-4 ring-warning/40 border-warning', \n}; \nconst PROGRESS_FILL_BY_COLOR: Record<string, string> = { \n default: 'bg-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst accentTextClass = computed(() => ACCENT_TEXT_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_BY_COLOR.default); \nconst accentTextIdleClass = computed(() => ACCENT_TEXT_IDLE_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_IDLE_BY_COLOR.default); \n// Idle border is always neutral — the color only surfaces as accent on \n// drag-over, focus, or in the upload Button. Matches Modal/Card surface pattern. \nconst colorBorderClass = computed(() => ''); \nconst dragOverRingClass = computed(() => \n DRAG_OVER_RING_BY_COLOR[stateColor.value] ?? DRAG_OVER_RING_BY_COLOR.default, \n); \nconst progressFillClass = computed(() => \n PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default, \n); \n \n/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */ \nconst dashedWrapperClasses = computed(() => { \n // Border stays neutral; only error state gets a colored border. \n const borderTint = hasError.value ? 'border-destructive/50' : 'border-border'; \n return [ \n 'border-2 border-dashed', \n borderTint, \n ].join(' '); \n}); \n \n/* ---------- Radius helpers ---------- */ \nconst itemRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-lg'; \n case 'full': return 'rounded-xl'; \n default: return 'rounded-md'; \n } \n}); \nconst itemThumbRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-md'; \n case 'full': return 'rounded-lg'; \n default: return 'rounded-md'; \n } \n}); \nconst progressRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n default: return 'rounded-full'; \n } \n}); \n</script> \n \n<style scoped> \n/* File item enter/leave + move. Mirrors the MultiSelect chip pattern but \n * collapses vertical space (max-height + margin-bottom + padding) so siblings \n * slide cleanly when files are added or removed. \n * \n * NOTE: spacing between items uses margin-bottom (see template), NOT the \n * parent's `gap`. `gap` cannot animate per-item so removing the first \n * file would leave a 6px gap that snaps closed when the node unmounts. \n */ \n.modo-file-enter-active, \n.modo-file-leave-active { \n transition: \n opacity 220ms cubic-bezier(0.2, 0, 0, 1), \n transform 260ms cubic-bezier(0.2, 0, 0, 1), \n max-height 260ms cubic-bezier(0.2, 0, 0, 1), \n margin-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-top 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n border-width 260ms cubic-bezier(0.2, 0, 0, 1); \n overflow: hidden; \n} \n.modo-file-move { \n transition: transform 260ms cubic-bezier(0.2, 0, 0, 1); \n} \n.modo-file-enter-from, \n.modo-file-leave-to { \n opacity: 0; \n transform: translateY(-4px) scale(0.98); \n max-height: 0; \n margin-bottom: 0 !important; \n padding-top: 0; \n padding-bottom: 0; \n border-width: 0; \n} \n.modo-file-enter-to, \n.modo-file-leave-from { \n /* 5rem comfortably fits the tallest file row (40px thumb + padding). */ \n max-height: 5rem; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-file-enter-active, \n .modo-file-leave-active, \n .modo-file-move { \n transition: none; \n } \n .modo-file-enter-from, \n .modo-file-leave-to { \n opacity: 1; \n transform: none; \n max-height: none; \n margin-bottom: initial !important; \n padding: initial; \n border-width: initial; \n } \n} \n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"FileInput.mjs","names":[],"sources":["../../../src/components/forms/FileInput.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div \n :class=\"[ \n 'modo-field-wrapper transition-colors', \n dashed ? dashedWrapperClasses : wrapperVariantClasses, \n isAreaVariant ? '' : `flex items-center ${wrapperSizeClasses}`, \n radiusClasses, \n colorBorderClass, \n fullWidth ? 'w-full' : '', \n isDisabled ? 'opacity-60 cursor-not-allowed' : '', \n isDragOver ? dragOverRingClass : '', \n isAreaVariant && clickToSelect && !isDisabled && !readonly ? 'cursor-pointer' : '', \n ]\" \n :role=\"isAreaVariant ? 'button' : undefined\" \n :tabindex=\"isAreaVariant && !isDisabled && !readonly ? 0 : undefined\" \n :aria-label=\"isAreaVariant ? (ariaLabel ?? label ?? dropzoneLabel ?? loc.fileInput.uploadFiles) : undefined\" \n @dragover.prevent=\"onDragOver\" \n @dragleave.prevent=\"onDragLeave\" \n @drop.prevent=\"onDrop\" \n @click=\"onWrapperClick\" \n @keydown=\"onWrapperKeydown\" \n > \n <!-- Area variant --> \n <div \n v-if=\"isAreaVariant\" \n :class=\"[ \n 'flex flex-col items-center justify-center text-center gap-2 px-4', \n areaHeightClasses, \n ]\" \n > \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 transition-colors duration-base ease-standard', \n isDragOver ? accentTextClass : accentTextIdleClass, \n areaIconSizeClasses, \n ]\" \n /> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\"> \n {{ areaPrimaryText }} \n </Typography> \n <Typography v-if=\"areaSecondaryText\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\"> \n {{ areaSecondaryText }} \n </Typography> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n class=\"mt-1\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Inline variant (default) --> \n <div v-else class=\"flex items-center gap-3 w-full min-w-0\"> \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"['shrink-0', accentTextIdleClass, iconSizeClasses]\" \n /> \n <div class=\"flex-1 min-w-0\"> \n <p :class=\"['truncate', inputTextClasses, files.length === 0 ? 'text-muted-foreground' : 'text-foreground']\"> \n {{ files.length === 0 ? (placeholder ?? loc.fileInput.placeholder) : headlineText }} \n </p> \n <Typography v-if=\"helperInlineText\" variant=\"caption\" size=\"medium\" color=\"muted\" :truncate=\"true\" as=\"p\"> \n {{ helperInlineText }} \n </Typography> \n </div> \n <div class=\"flex shrink-0 items-center\" @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"inlineButtonSize\" \n :class=\"['shrink-0', inlineButtonHeight]\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Hidden native input --> \n <input \n :id=\"fieldId\" \n ref=\"inputEl\" \n type=\"file\" \n class=\"sr-only\" \n :name=\"name\" \n :accept=\"accept\" \n :multiple=\"multiple\" \n :disabled=\"isDisabled\" \n :required=\"required\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n @change=\"onPickerChange\" \n /> \n </div> \n \n <!-- File list / previews (fuera del dropzone para no romper su forma) --> \n <TransitionGroup \n v-show=\"files.length\" \n appear \n name=\"modo-file\" \n tag=\"ul\" \n :class=\"[ \n 'flex flex-col mt-1', \n previews ? 'md:grid md:grid-cols-2 lg:grid-cols-3 md:gap-2' : '', \n ]\" \n > \n <li \n v-for=\"entry in files\" \n :key=\"entry.id\" \n :class=\"[ \n 'modo-file-item relative flex items-center gap-2 p-2 border border-border bg-background', \n // Vertical spacing via margin-bottom (not parent gap) so \n // it can animate to 0 on leave without causing a sibling \n // snap. Using mb (not mt) means when an item is removed \n // the newly-exposed sibling keeps its position. \n '[&:not(:last-child)]:mb-1.5 md:[&:not(:last-child)]:mb-0', \n itemRadiusClass, \n ]\" \n > \n <div \n v-if=\"previews && entry.previewUrl\" \n :class=\"[ \n 'shrink-0 w-10 h-10 overflow-hidden bg-muted', \n itemThumbRadiusClass, \n ]\" \n > \n <img :src=\"entry.previewUrl\" :alt=\"entry.name\" class=\"w-full h-full object-cover\" /> \n </div> \n <component \n v-else \n :is=\"isImage(entry) ? PhotoIcon : DocumentIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 w-8 h-8 text-muted-foreground p-1.5 bg-muted', \n itemThumbRadiusClass, \n ]\" \n /> \n \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"caption\" size=\"medium\" weight=\"medium\" :truncate=\"true\" as=\"p\">{{ entry.name }}</Typography> \n <p class=\"text-[11px] text-muted-foreground\"> \n {{ formatBytes(entry.size) }} \n <span v-if=\"entry.error\" class=\"text-destructive\">· {{ entry.error }}</span> \n </p> \n <!-- Progress bar --> \n <div \n v-if=\"typeof entry.progress === 'number' && entry.progress >= 0 && entry.progress < 100\" \n :class=\"['mt-1 h-1 overflow-hidden', progressRadiusClass, 'bg-muted']\" \n > \n <div \n :class=\"['h-full transition-all duration-base ease-standard', progressFillClass]\" \n :style=\"{ width: `${entry.progress}%` }\" \n /> \n </div> \n </div> \n \n <div v-if=\"!isDisabled && !readonly\" @click.stop> \n <Button \n variant=\"text\" \n :color=\"color\" \n size=\"small\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"`Remove ${entry.name}`\" \n @click=\"removeFile(entry.id)\" \n /> \n </div> \n </li> \n </TransitionGroup> \n \n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\"> \n <Typography v-if=\"errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography> \n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport type { \n FileInput, \n FileInputFile, \n FileInputRejectCode, \n FileInputRejectContext, \n FileInputRejection, \n} from '../../interfaces/forms/FileInput.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\nimport { interpolate } from '../../config/ModoLocale'; \nimport { ArrowUpTrayIcon, XMarkIcon, PhotoIcon, DocumentIcon } from '@heroicons/vue/24/outline'; \nimport Button from './Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \n \nconst props = withDefaults(defineProps<FileInput>(), { \n modelValue: null, \n multiple: false, \n previews: true, \n dropzone: true, \n dropzoneVariant: 'inline', \n dropzoneHeight: 'medium', \n dashed: false, \n clickToSelect: true, \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n fullWidth: false, \n // `placeholder` is resolved at render time against the locale fallback. \n // Leaving the default undefined so `props.placeholder ?? loc...` works. \n autofocus: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst emit = defineEmits<{ \n 'update:modelValue': [files: File[] | null]; \n change: [files: File[] | null]; \n add: [files: File[]]; \n remove: [file: File]; \n reject: [rejections: FileInputRejection[]]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst { \n fieldId, hasError, isDisabled, errorId, helperId, describedBy, \n stateColor, radius, \n} = useFieldState(props, { componentName: 'FileInput', idPrefix: 'modo-file' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, hasError, radius, \n // The drop zone is a big box: `radius=\"full\"` caps at a card-like radius.\n radiusKind: () => (props.dropzoneVariant === 'area' ? 'surface' : 'control'), \n forceFocus: () => isDragOver.value, \n halo: () => props.halo, \n}); \n \nconst inputEl = ref<HTMLInputElement | null>(null); \nconst isDragOver = ref(false); \nconst internalFiles = ref<FileInputFile[]>([]); \nconst autoId = useId(); \nlet counter = 0; \nconst makeId = () => `modo-file-${autoId}-${++counter}`; \n \nfunction isImage(entry: FileInputFile) { \n return entry.type.startsWith('image/'); \n} \n \nfunction formatBytes(n: number) { \n if (n < 1024) return `${n} B`; \n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; \n if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`; \n return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`; \n} \n \nfunction openFilePicker() { \n if (isDisabled.value || props.readonly) return; \n inputEl.value?.click(); \n} \n \nfunction validate(file: File): { code: FileInputRejectCode; limit?: number | string } | null { \n if (props.maxSize && file.size > props.maxSize) { \n return { code: 'size', limit: props.maxSize }; \n } \n // Accept check (simple prefix + ext match) \n if (props.accept) { \n const tokens = props.accept.split(',').map((t) => t.trim().toLowerCase()); \n const name = file.name.toLowerCase(); \n const type = file.type.toLowerCase(); \n const ok = tokens.some((t) => { \n if (t.startsWith('.')) return name.endsWith(t); \n if (t.endsWith('/*')) return type.startsWith(t.slice(0, -1)); \n return type === t; \n }); \n if (!ok) return { code: 'type', limit: props.accept }; \n } \n return null; \n} \n \n/** \n * Reject message resolver with three-tier precedence: \n * 1. Per-component prop `rejectMessages` (fn > string with `{limit}`). \n * 2. `ModoProvider`-level `locale.fileInput.reject`. \n * 3. Built-in English defaults in `defaultLocale`. \n */ \nfunction resolveRejectMessage(ctx: FileInputRejectContext): string { \n const override = props.rejectMessages?.[ctx.code]; \n if (typeof override === 'function') return override(ctx); \n if (typeof override === 'string') { \n return applyLimit(override, ctx); \n } \n // Fall back to locale (which itself falls back to defaultLocale EN). \n const reject = loc.value.fileInput.reject; \n let template: string; \n if (ctx.code === 'size') { \n template = typeof ctx.limit === 'number' ? reject.size : reject.sizeNoLimit; \n } else if (ctx.code === 'count') { \n template = typeof ctx.limit === 'number' ? reject.count : reject.countNoLimit; \n } else { \n template = reject.type; \n } \n return applyLimit(template, ctx); \n} \n \nfunction applyLimit(template: string, ctx: FileInputRejectContext): string { \n if (!template.includes('{limit}')) return template; \n const value = \n typeof ctx.limit === 'number' && ctx.code === 'size' \n ? ctx.formatBytes(ctx.limit) \n : String(ctx.limit ?? ''); \n return template.split('{limit}').join(value); \n} \n \nfunction buildRejection( \n file: File, \n code: FileInputRejectCode, \n limit?: number | string, \n): FileInputRejection { \n const ctx: FileInputRejectContext = { file, code, limit, formatBytes }; \n return { file, code, limit, message: resolveRejectMessage(ctx) }; \n} \n \nfunction addFiles(list: FileList | File[]) { \n const incoming = Array.from(list); \n const accepted: FileInputFile[] = []; \n const rejected: FileInputRejection[] = []; \n \n for (const file of incoming) { \n const err = validate(file); \n if (err) { \n rejected.push(buildRejection(file, err.code, err.limit)); \n continue; \n } \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n accepted.push(entry); \n } \n \n // Respect multiple + maxFiles \n if (!props.multiple) { \n // Replace with first \n revokeAll(); \n internalFiles.value = accepted.slice(0, 1); \n } else { \n const next = [...internalFiles.value, ...accepted]; \n if (props.maxFiles && next.length > props.maxFiles) { \n const overflow = next.slice(props.maxFiles); \n overflow.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = next.slice(0, props.maxFiles); \n overflow.forEach((e) => \n rejected.push(buildRejection(e.file, 'count', props.maxFiles)), \n ); \n } else { \n internalFiles.value = next; \n } \n } \n \n if (accepted.length) emit('add', accepted.map((e) => e.file)); \n if (rejected.length) emit('reject', rejected); \n emitUpdate(); \n} \n \nfunction removeFile(id: string) { \n const idx = internalFiles.value.findIndex((e) => e.id === id); \n if (idx === -1) return; \n const [removed] = internalFiles.value.splice(idx, 1); \n if (removed.previewUrl) URL.revokeObjectURL(removed.previewUrl); \n emit('remove', removed.file); \n emitUpdate(); \n} \n \nfunction emitUpdate() { \n const out = internalFiles.value.map((e) => e.file); \n emit('update:modelValue', out.length ? out : null); \n emit('change', out.length ? out : null); \n} \n \nfunction revokeAll() { \n internalFiles.value.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = []; \n} \n \nonBeforeUnmount(() => revokeAll()); \n \n/* ---------- Events ---------- */ \n \nfunction onPickerChange(e: Event) { \n const input = e.target as HTMLInputElement; \n if (input.files && input.files.length) { \n addFiles(input.files); \n } \n // Reset para permitir re-seleccionar el mismo archivo \n input.value = ''; \n} \n \nfunction onDragOver(e: DragEvent) { \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy'; \n isDragOver.value = true; \n} \nfunction onDragLeave() { \n isDragOver.value = false; \n} \nfunction onDrop(e: DragEvent) { \n isDragOver.value = false; \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer?.files?.length) { \n addFiles(e.dataTransfer.files); \n } \n} \n \nfunction onWrapperClick(e: MouseEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n // Ignora clicks provenientes de elementos interactivos (botones, remove) \n const target = e.target as HTMLElement | null; \n if (target?.closest('button, a, input, [role=\"button\"][data-modo-item]')) return; \n openFilePicker(); \n} \nfunction onWrapperKeydown(e: KeyboardEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n if (e.key === 'Enter' || e.key === ' ') { \n e.preventDefault(); \n openFilePicker(); \n } \n} \n \n/* ---------- Merge external progress / errors ---------- */ \nconst files = computed<FileInputFile[]>(() => \n internalFiles.value.map((e) => ({ \n ...e, \n progress: props.progress?.[e.id] ?? e.progress, \n error: props.errors?.[e.id] ?? e.error, \n })), \n); \n \n/* ---------- v-model sync from outside ---------- */ \nwatch(() => props.modelValue, (v) => { \n if (!v) { \n if (internalFiles.value.length) revokeAll(); \n return; \n } \n // Solo sincroniza si el caller reemplazó la lista entera con otras refs. \n const current = internalFiles.value.map((e) => e.file); \n if (v.length === current.length && v.every((f, i) => f === current[i])) return; \n revokeAll(); \n const wrapped: FileInputFile[] = v.map((file) => { \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n return entry; \n }); \n internalFiles.value = wrapped; \n}, { immediate: true }); \n \n/* ---------- Display ---------- */ \n \nconst headlineText = computed(() => { \n if (files.value.length === 1) return files.value[0].name; \n return interpolate(loc.value.fileInput.filesSelected, { count: files.value.length }); \n}); \n \nconst helperInlineText = computed(() => { \n const bits: string[] = []; \n if (props.accept) bits.push(props.accept); \n if (props.maxSize) bits.push(interpolate(loc.value.fileInput.hintUpTo, { limit: formatBytes(props.maxSize) })); \n if (props.multiple && props.maxFiles) bits.push(interpolate(loc.value.fileInput.hintMax, { limit: props.maxFiles })); \n return bits.join(' · '); \n}); \n \nconst browseLabel = computed(() => \n props.multiple \n ? (files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse) \n : (files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse), \n); \n \n/* ---------- Size maps ---------- */\nconst wrapperSizeClasses = computed(() => `${sz.value.control} ${sz.value.padX}`);\nconst iconSizeClasses = computed(() => sz.value.icon);\nconst inputTextClasses = computed(() => sz.value.text);\n// The inline Browse button is a trailing control: it sits inside the field with\n// 4px of air above and below (control height - 8px), so it never touches the\n// border at any radius. Same idea as the clear / eye buttons of other fields.\nconst INLINE_BUTTON_SIZE: Record<string, 'xsmall' | 'small' | 'medium'> = { xsmall: 'xsmall', small: 'xsmall', medium: 'small', large: 'medium' };\nconst inlineButtonSize = computed(() => INLINE_BUTTON_SIZE[resolvedSize.value] ?? 'small');\nconst INLINE_BUTTON_HEIGHT: Record<string, string> = { xsmall: '!h-6', small: '!h-7', medium: '!h-8', large: '!h-10' };\nconst inlineButtonHeight = computed(() => INLINE_BUTTON_HEIGHT[resolvedSize.value] ?? '!h-8'); \n \n/* ---------- Area variant ---------- */ \nconst isAreaVariant = computed(() => props.dropzoneVariant === 'area'); \n \nconst areaHeightClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'min-h-[120px] py-4'; \n case 'large': return 'min-h-[240px] py-10'; \n default: return 'min-h-[180px] py-8'; \n } \n}); \n \nconst areaIconSizeClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'w-8 h-8'; \n case 'large': return 'w-14 h-14'; \n default: return 'w-10 h-10'; \n } \n}); \n \nconst areaPrimaryText = computed(() => { \n if (props.dropzoneLabel) return props.dropzoneLabel; \n if (files.value.length === 0) { \n return props.multiple \n ? loc.value.fileInput.dropzoneLabelMultiple \n : loc.value.fileInput.dropzoneLabel; \n } \n return headlineText.value; \n}); \n \nconst areaSecondaryText = computed<string | undefined>(() => { \n if (props.dropzoneHint) return props.dropzoneHint; \n return helperInlineText.value || undefined; \n}); \n \n/* ---------- Color / dashed accents ---------- */ \nconst ACCENT_TEXT_BY_COLOR: Record<string, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \nconst ACCENT_TEXT_IDLE_BY_COLOR: Record<string, string> = { \n default: 'text-muted-foreground', \n primary: 'text-primary/70', \n danger: 'text-destructive/70', \n success: 'text-success/70', \n warning: 'text-warning/70', \n}; \n// Dashed variant keeps a transparent surface — colored fills felt heavy \n// against form backgrounds. Color only surfaces via icon/button accents. \nconst DRAG_OVER_RING_BY_COLOR: Record<string, string> = { \n default: 'ring-4 ring-foreground/25 border-foreground', \n primary: 'ring-4 ring-primary/40 border-primary', \n danger: 'ring-4 ring-destructive/40 border-destructive', \n success: 'ring-4 ring-success/40 border-success', \n warning: 'ring-4 ring-warning/40 border-warning', \n}; \nconst PROGRESS_FILL_BY_COLOR: Record<string, string> = { \n default: 'bg-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst accentTextClass = computed(() => ACCENT_TEXT_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_BY_COLOR.default); \nconst accentTextIdleClass = computed(() => ACCENT_TEXT_IDLE_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_IDLE_BY_COLOR.default); \n// Idle border is always neutral — the color only surfaces as accent on \n// drag-over, focus, or in the upload Button. Matches Modal/Card surface pattern. \nconst colorBorderClass = computed(() => ''); \nconst dragOverRingClass = computed(() => \n DRAG_OVER_RING_BY_COLOR[stateColor.value] ?? DRAG_OVER_RING_BY_COLOR.default, \n); \nconst progressFillClass = computed(() => \n PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default, \n); \n \n/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */ \nconst dashedWrapperClasses = computed(() => { \n // Border stays neutral; only error state gets a colored border. \n const borderTint = hasError.value ? 'border-destructive/50' : 'border-input not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover'; \n return [ \n 'border-2 border-dashed', \n borderTint, \n ].join(' '); \n}); \n \n/* ---------- Radius helpers ---------- */ \nconst itemRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-lg'; \n // File chips are inner controls: they take the full pill.\n case 'full': return 'rounded-full pl-3'; \n default: return 'rounded-md'; \n } \n}); \nconst itemThumbRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-md'; \n case 'full': return 'rounded-full'; \n default: return 'rounded-md'; \n } \n}); \nconst progressRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n default: return 'rounded-full'; \n } \n}); \n</script> \n \n<style scoped> \n/* File item enter/leave + move. Mirrors the MultiSelect chip pattern but \n * collapses vertical space (max-height + margin-bottom + padding) so siblings \n * slide cleanly when files are added or removed. \n * \n * NOTE: spacing between items uses margin-bottom (see template), NOT the \n * parent's `gap`. `gap` cannot animate per-item so removing the first \n * file would leave a 6px gap that snaps closed when the node unmounts. \n */ \n.modo-file-enter-active, \n.modo-file-leave-active { \n transition: \n opacity 220ms cubic-bezier(0.2, 0, 0, 1), \n transform 260ms cubic-bezier(0.2, 0, 0, 1), \n max-height 260ms cubic-bezier(0.2, 0, 0, 1), \n margin-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-top 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n border-width 260ms cubic-bezier(0.2, 0, 0, 1); \n overflow: hidden; \n} \n.modo-file-move { \n transition: transform 260ms cubic-bezier(0.2, 0, 0, 1); \n} \n.modo-file-enter-from, \n.modo-file-leave-to { \n opacity: 0; \n transform: translateY(-4px) scale(0.98); \n max-height: 0; \n margin-bottom: 0 !important; \n padding-top: 0; \n padding-bottom: 0; \n border-width: 0; \n} \n.modo-file-enter-to, \n.modo-file-leave-from { \n /* 5rem comfortably fits the tallest file row (40px thumb + padding). */ \n max-height: 5rem; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-file-enter-active, \n .modo-file-leave-active, \n .modo-file-move { \n transition: none; \n } \n .modo-file-enter-from, \n .modo-file-leave-to { \n opacity: 1; \n transform: none; \n max-height: none; \n margin-bottom: initial !important; \n padding: initial; \n border-width: initial; \n } \n} \n</style>\n"],"mappings":""}
|
|
@@ -20,7 +20,7 @@ var _hoisted_3 = [
|
|
|
20
20
|
];
|
|
21
21
|
var _hoisted_4 = {
|
|
22
22
|
key: 1,
|
|
23
|
-
class: "flex items-center gap-3"
|
|
23
|
+
class: "flex items-center gap-3 w-full min-w-0"
|
|
24
24
|
};
|
|
25
25
|
var _hoisted_5 = { class: "flex-1 min-w-0" };
|
|
26
26
|
var _hoisted_6 = [
|
|
@@ -126,7 +126,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
126
126
|
],
|
|
127
127
|
setup(__props, { emit: __emit }) {
|
|
128
128
|
const props = __props;
|
|
129
|
-
require_useModoConfig.useResolvedSize(() => props.size);
|
|
129
|
+
const resolvedSize = require_useModoConfig.useResolvedSize(() => props.size);
|
|
130
130
|
const sz = require_useModoConfig.useSizeTokens(() => props.size);
|
|
131
131
|
const emit = __emit;
|
|
132
132
|
const loc = require_useModoConfig.useModoLocale();
|
|
@@ -139,6 +139,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
139
139
|
stateColor,
|
|
140
140
|
hasError,
|
|
141
141
|
radius,
|
|
142
|
+
radiusKind: () => props.dropzoneVariant === "area" ? "surface" : "control",
|
|
142
143
|
forceFocus: () => isDragOver.value,
|
|
143
144
|
halo: () => props.halo
|
|
144
145
|
});
|
|
@@ -347,6 +348,21 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
347
348
|
const browseLabel = (0, vue.computed)(() => props.multiple ? files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse : files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse);
|
|
348
349
|
const wrapperSizeClasses = (0, vue.computed)(() => `${sz.value.control} ${sz.value.padX}`);
|
|
349
350
|
const iconSizeClasses = (0, vue.computed)(() => sz.value.icon);
|
|
351
|
+
const inputTextClasses = (0, vue.computed)(() => sz.value.text);
|
|
352
|
+
const INLINE_BUTTON_SIZE = {
|
|
353
|
+
xsmall: "xsmall",
|
|
354
|
+
small: "xsmall",
|
|
355
|
+
medium: "small",
|
|
356
|
+
large: "medium"
|
|
357
|
+
};
|
|
358
|
+
const inlineButtonSize = (0, vue.computed)(() => INLINE_BUTTON_SIZE[resolvedSize.value] ?? "small");
|
|
359
|
+
const INLINE_BUTTON_HEIGHT = {
|
|
360
|
+
xsmall: "!h-6",
|
|
361
|
+
small: "!h-7",
|
|
362
|
+
medium: "!h-8",
|
|
363
|
+
large: "!h-10"
|
|
364
|
+
};
|
|
365
|
+
const inlineButtonHeight = (0, vue.computed)(() => INLINE_BUTTON_HEIGHT[resolvedSize.value] ?? "!h-8");
|
|
350
366
|
const isAreaVariant = (0, vue.computed)(() => props.dropzoneVariant === "area");
|
|
351
367
|
const areaHeightClasses = (0, vue.computed)(() => {
|
|
352
368
|
switch (props.dropzoneHeight) {
|
|
@@ -406,14 +422,14 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
406
422
|
const progressFillClass = (0, vue.computed)(() => PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default);
|
|
407
423
|
/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */
|
|
408
424
|
const dashedWrapperClasses = (0, vue.computed)(() => {
|
|
409
|
-
return ["border-2 border-dashed", hasError.value ? "border-destructive/50" : "border-border"].join(" ");
|
|
425
|
+
return ["border-2 border-dashed", hasError.value ? "border-destructive/50" : "border-input not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover"].join(" ");
|
|
410
426
|
});
|
|
411
427
|
const itemRadiusClass = (0, vue.computed)(() => {
|
|
412
428
|
switch (radius.value) {
|
|
413
429
|
case "none": return "rounded-none";
|
|
414
430
|
case "small": return "rounded-sm";
|
|
415
431
|
case "large": return "rounded-lg";
|
|
416
|
-
case "full": return "rounded-
|
|
432
|
+
case "full": return "rounded-full pl-3";
|
|
417
433
|
default: return "rounded-md";
|
|
418
434
|
}
|
|
419
435
|
});
|
|
@@ -422,7 +438,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
422
438
|
case "none": return "rounded-none";
|
|
423
439
|
case "small": return "rounded-sm";
|
|
424
440
|
case "large": return "rounded-md";
|
|
425
|
-
case "full": return "rounded-
|
|
441
|
+
case "full": return "rounded-full";
|
|
426
442
|
default: return "rounded-md";
|
|
427
443
|
}
|
|
428
444
|
});
|
|
@@ -443,7 +459,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
443
459
|
class: (0, vue.normalizeClass)([
|
|
444
460
|
"modo-field-wrapper transition-colors",
|
|
445
461
|
__props.dashed ? dashedWrapperClasses.value : (0, vue.unref)(wrapperVariantClasses),
|
|
446
|
-
isAreaVariant.value ? "" : wrapperSizeClasses.value
|
|
462
|
+
isAreaVariant.value ? "" : `flex items-center ${wrapperSizeClasses.value}`,
|
|
447
463
|
(0, vue.unref)(radiusClasses),
|
|
448
464
|
colorBorderClass.value,
|
|
449
465
|
__props.fullWidth ? "w-full" : "",
|
|
@@ -516,15 +532,11 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
516
532
|
iconSizeClasses.value
|
|
517
533
|
])
|
|
518
534
|
}, null, 8, ["class"])),
|
|
519
|
-
(0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}, {
|
|
525
|
-
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(files.value.length === 0 ? __props.placeholder ?? (0, vue.unref)(loc).fileInput.placeholder : headlineText.value), 1)]),
|
|
526
|
-
_: 1
|
|
527
|
-
}, 8, ["size"]), helperInlineText.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_Typography.default, {
|
|
535
|
+
(0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.createElementVNode)("p", { class: (0, vue.normalizeClass)([
|
|
536
|
+
"truncate",
|
|
537
|
+
inputTextClasses.value,
|
|
538
|
+
files.value.length === 0 ? "text-muted-foreground" : "text-foreground"
|
|
539
|
+
]) }, (0, vue.toDisplayString)(files.value.length === 0 ? __props.placeholder ?? (0, vue.unref)(loc).fileInput.placeholder : headlineText.value), 3), helperInlineText.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_Typography.default, {
|
|
528
540
|
key: 0,
|
|
529
541
|
variant: "caption",
|
|
530
542
|
size: "medium",
|
|
@@ -535,10 +547,14 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
535
547
|
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(helperInlineText.value), 1)]),
|
|
536
548
|
_: 1
|
|
537
549
|
})) : (0, vue.createCommentVNode)("", true)]),
|
|
538
|
-
(0, vue.createElementVNode)("div", {
|
|
550
|
+
(0, vue.createElementVNode)("div", {
|
|
551
|
+
class: "flex shrink-0 items-center",
|
|
552
|
+
onClick: _cache[1] || (_cache[1] = (0, vue.withModifiers)(() => {}, ["stop"]))
|
|
553
|
+
}, [(0, vue.createVNode)(require_Button.default, {
|
|
539
554
|
disabled: (0, vue.unref)(isDisabled) || __props.readonly,
|
|
540
555
|
color: __props.color,
|
|
541
|
-
size:
|
|
556
|
+
size: inlineButtonSize.value,
|
|
557
|
+
class: (0, vue.normalizeClass)(["shrink-0", inlineButtonHeight.value]),
|
|
542
558
|
radius: (0, vue.unref)(radius),
|
|
543
559
|
icon: (0, vue.unref)(_heroicons_vue_24_outline.ArrowUpTrayIcon),
|
|
544
560
|
variant: "outline",
|
|
@@ -548,6 +564,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
548
564
|
"disabled",
|
|
549
565
|
"color",
|
|
550
566
|
"size",
|
|
567
|
+
"class",
|
|
551
568
|
"radius",
|
|
552
569
|
"icon",
|
|
553
570
|
"label"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/components/forms/FileInput.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div \n :class=\"[ \n 'modo-field-wrapper transition-colors', \n dashed ? dashedWrapperClasses : wrapperVariantClasses, \n isAreaVariant ? '' : wrapperSizeClasses, \n radiusClasses, \n colorBorderClass, \n fullWidth ? 'w-full' : '', \n isDisabled ? 'opacity-60 cursor-not-allowed' : '', \n isDragOver ? dragOverRingClass : '', \n isAreaVariant && clickToSelect && !isDisabled && !readonly ? 'cursor-pointer' : '', \n ]\" \n :role=\"isAreaVariant ? 'button' : undefined\" \n :tabindex=\"isAreaVariant && !isDisabled && !readonly ? 0 : undefined\" \n :aria-label=\"isAreaVariant ? (ariaLabel ?? label ?? dropzoneLabel ?? loc.fileInput.uploadFiles) : undefined\" \n @dragover.prevent=\"onDragOver\" \n @dragleave.prevent=\"onDragLeave\" \n @drop.prevent=\"onDrop\" \n @click=\"onWrapperClick\" \n @keydown=\"onWrapperKeydown\" \n > \n <!-- Area variant --> \n <div \n v-if=\"isAreaVariant\" \n :class=\"[ \n 'flex flex-col items-center justify-center text-center gap-2 px-4', \n areaHeightClasses, \n ]\" \n > \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 transition-colors duration-base ease-standard', \n isDragOver ? accentTextClass : accentTextIdleClass, \n areaIconSizeClasses, \n ]\" \n /> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\"> \n {{ areaPrimaryText }} \n </Typography> \n <Typography v-if=\"areaSecondaryText\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\"> \n {{ areaSecondaryText }} \n </Typography> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n class=\"mt-1\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Inline variant (default) --> \n <div v-else class=\"flex items-center gap-3\"> \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"['shrink-0', accentTextIdleClass, iconSizeClasses]\" \n /> \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\" :truncate=\"true\"> \n {{ files.length === 0 ? (placeholder ?? loc.fileInput.placeholder) : headlineText }} \n </Typography> \n <Typography v-if=\"helperInlineText\" variant=\"caption\" size=\"medium\" color=\"muted\" :truncate=\"true\" as=\"p\"> \n {{ helperInlineText }} \n </Typography> \n </div> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Hidden native input --> \n <input \n :id=\"fieldId\" \n ref=\"inputEl\" \n type=\"file\" \n class=\"sr-only\" \n :name=\"name\" \n :accept=\"accept\" \n :multiple=\"multiple\" \n :disabled=\"isDisabled\" \n :required=\"required\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n @change=\"onPickerChange\" \n /> \n </div> \n \n <!-- File list / previews (fuera del dropzone para no romper su forma) --> \n <TransitionGroup \n v-show=\"files.length\" \n appear \n name=\"modo-file\" \n tag=\"ul\" \n :class=\"[ \n 'flex flex-col mt-1', \n previews ? 'md:grid md:grid-cols-2 lg:grid-cols-3 md:gap-2' : '', \n ]\" \n > \n <li \n v-for=\"entry in files\" \n :key=\"entry.id\" \n :class=\"[ \n 'modo-file-item relative flex items-center gap-2 p-2 border border-border bg-background', \n // Vertical spacing via margin-bottom (not parent gap) so \n // it can animate to 0 on leave without causing a sibling \n // snap. Using mb (not mt) means when an item is removed \n // the newly-exposed sibling keeps its position. \n '[&:not(:last-child)]:mb-1.5 md:[&:not(:last-child)]:mb-0', \n itemRadiusClass, \n ]\" \n > \n <div \n v-if=\"previews && entry.previewUrl\" \n :class=\"[ \n 'shrink-0 w-10 h-10 overflow-hidden bg-muted', \n itemThumbRadiusClass, \n ]\" \n > \n <img :src=\"entry.previewUrl\" :alt=\"entry.name\" class=\"w-full h-full object-cover\" /> \n </div> \n <component \n v-else \n :is=\"isImage(entry) ? PhotoIcon : DocumentIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 w-8 h-8 text-muted-foreground p-1.5 bg-muted', \n itemThumbRadiusClass, \n ]\" \n /> \n \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"caption\" size=\"medium\" weight=\"medium\" :truncate=\"true\" as=\"p\">{{ entry.name }}</Typography> \n <p class=\"text-[11px] text-muted-foreground\"> \n {{ formatBytes(entry.size) }} \n <span v-if=\"entry.error\" class=\"text-destructive\">· {{ entry.error }}</span> \n </p> \n <!-- Progress bar --> \n <div \n v-if=\"typeof entry.progress === 'number' && entry.progress >= 0 && entry.progress < 100\" \n :class=\"['mt-1 h-1 overflow-hidden', progressRadiusClass, 'bg-muted']\" \n > \n <div \n :class=\"['h-full transition-all duration-base ease-standard', progressFillClass]\" \n :style=\"{ width: `${entry.progress}%` }\" \n /> \n </div> \n </div> \n \n <div v-if=\"!isDisabled && !readonly\" @click.stop> \n <Button \n variant=\"text\" \n :color=\"color\" \n size=\"small\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"`Remove ${entry.name}`\" \n @click=\"removeFile(entry.id)\" \n /> \n </div> \n </li> \n </TransitionGroup> \n \n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\"> \n <Typography v-if=\"errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography> \n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport type { \n FileInput, \n FileInputFile, \n FileInputRejectCode, \n FileInputRejectContext, \n FileInputRejection, \n} from '../../interfaces/forms/FileInput.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\nimport { interpolate } from '../../config/ModoLocale'; \nimport { ArrowUpTrayIcon, XMarkIcon, PhotoIcon, DocumentIcon } from '@heroicons/vue/24/outline'; \nimport Button from './Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \n \nconst props = withDefaults(defineProps<FileInput>(), { \n modelValue: null, \n multiple: false, \n previews: true, \n dropzone: true, \n dropzoneVariant: 'inline', \n dropzoneHeight: 'medium', \n dashed: false, \n clickToSelect: true, \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n fullWidth: false, \n // `placeholder` is resolved at render time against the locale fallback. \n // Leaving the default undefined so `props.placeholder ?? loc...` works. \n autofocus: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst emit = defineEmits<{ \n 'update:modelValue': [files: File[] | null]; \n change: [files: File[] | null]; \n add: [files: File[]]; \n remove: [file: File]; \n reject: [rejections: FileInputRejection[]]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst { \n fieldId, hasError, isDisabled, errorId, helperId, describedBy, \n stateColor, radius, \n} = useFieldState(props, { componentName: 'FileInput', idPrefix: 'modo-file' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, hasError, radius, \n forceFocus: () => isDragOver.value, \n halo: () => props.halo, \n}); \n \nconst inputEl = ref<HTMLInputElement | null>(null); \nconst isDragOver = ref(false); \nconst internalFiles = ref<FileInputFile[]>([]); \nconst autoId = useId(); \nlet counter = 0; \nconst makeId = () => `modo-file-${autoId}-${++counter}`; \n \nfunction isImage(entry: FileInputFile) { \n return entry.type.startsWith('image/'); \n} \n \nfunction formatBytes(n: number) { \n if (n < 1024) return `${n} B`; \n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; \n if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`; \n return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`; \n} \n \nfunction openFilePicker() { \n if (isDisabled.value || props.readonly) return; \n inputEl.value?.click(); \n} \n \nfunction validate(file: File): { code: FileInputRejectCode; limit?: number | string } | null { \n if (props.maxSize && file.size > props.maxSize) { \n return { code: 'size', limit: props.maxSize }; \n } \n // Accept check (simple prefix + ext match) \n if (props.accept) { \n const tokens = props.accept.split(',').map((t) => t.trim().toLowerCase()); \n const name = file.name.toLowerCase(); \n const type = file.type.toLowerCase(); \n const ok = tokens.some((t) => { \n if (t.startsWith('.')) return name.endsWith(t); \n if (t.endsWith('/*')) return type.startsWith(t.slice(0, -1)); \n return type === t; \n }); \n if (!ok) return { code: 'type', limit: props.accept }; \n } \n return null; \n} \n \n/** \n * Reject message resolver with three-tier precedence: \n * 1. Per-component prop `rejectMessages` (fn > string with `{limit}`). \n * 2. `ModoProvider`-level `locale.fileInput.reject`. \n * 3. Built-in English defaults in `defaultLocale`. \n */ \nfunction resolveRejectMessage(ctx: FileInputRejectContext): string { \n const override = props.rejectMessages?.[ctx.code]; \n if (typeof override === 'function') return override(ctx); \n if (typeof override === 'string') { \n return applyLimit(override, ctx); \n } \n // Fall back to locale (which itself falls back to defaultLocale EN). \n const reject = loc.value.fileInput.reject; \n let template: string; \n if (ctx.code === 'size') { \n template = typeof ctx.limit === 'number' ? reject.size : reject.sizeNoLimit; \n } else if (ctx.code === 'count') { \n template = typeof ctx.limit === 'number' ? reject.count : reject.countNoLimit; \n } else { \n template = reject.type; \n } \n return applyLimit(template, ctx); \n} \n \nfunction applyLimit(template: string, ctx: FileInputRejectContext): string { \n if (!template.includes('{limit}')) return template; \n const value = \n typeof ctx.limit === 'number' && ctx.code === 'size' \n ? ctx.formatBytes(ctx.limit) \n : String(ctx.limit ?? ''); \n return template.split('{limit}').join(value); \n} \n \nfunction buildRejection( \n file: File, \n code: FileInputRejectCode, \n limit?: number | string, \n): FileInputRejection { \n const ctx: FileInputRejectContext = { file, code, limit, formatBytes }; \n return { file, code, limit, message: resolveRejectMessage(ctx) }; \n} \n \nfunction addFiles(list: FileList | File[]) { \n const incoming = Array.from(list); \n const accepted: FileInputFile[] = []; \n const rejected: FileInputRejection[] = []; \n \n for (const file of incoming) { \n const err = validate(file); \n if (err) { \n rejected.push(buildRejection(file, err.code, err.limit)); \n continue; \n } \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n accepted.push(entry); \n } \n \n // Respect multiple + maxFiles \n if (!props.multiple) { \n // Replace with first \n revokeAll(); \n internalFiles.value = accepted.slice(0, 1); \n } else { \n const next = [...internalFiles.value, ...accepted]; \n if (props.maxFiles && next.length > props.maxFiles) { \n const overflow = next.slice(props.maxFiles); \n overflow.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = next.slice(0, props.maxFiles); \n overflow.forEach((e) => \n rejected.push(buildRejection(e.file, 'count', props.maxFiles)), \n ); \n } else { \n internalFiles.value = next; \n } \n } \n \n if (accepted.length) emit('add', accepted.map((e) => e.file)); \n if (rejected.length) emit('reject', rejected); \n emitUpdate(); \n} \n \nfunction removeFile(id: string) { \n const idx = internalFiles.value.findIndex((e) => e.id === id); \n if (idx === -1) return; \n const [removed] = internalFiles.value.splice(idx, 1); \n if (removed.previewUrl) URL.revokeObjectURL(removed.previewUrl); \n emit('remove', removed.file); \n emitUpdate(); \n} \n \nfunction emitUpdate() { \n const out = internalFiles.value.map((e) => e.file); \n emit('update:modelValue', out.length ? out : null); \n emit('change', out.length ? out : null); \n} \n \nfunction revokeAll() { \n internalFiles.value.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = []; \n} \n \nonBeforeUnmount(() => revokeAll()); \n \n/* ---------- Events ---------- */ \n \nfunction onPickerChange(e: Event) { \n const input = e.target as HTMLInputElement; \n if (input.files && input.files.length) { \n addFiles(input.files); \n } \n // Reset para permitir re-seleccionar el mismo archivo \n input.value = ''; \n} \n \nfunction onDragOver(e: DragEvent) { \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy'; \n isDragOver.value = true; \n} \nfunction onDragLeave() { \n isDragOver.value = false; \n} \nfunction onDrop(e: DragEvent) { \n isDragOver.value = false; \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer?.files?.length) { \n addFiles(e.dataTransfer.files); \n } \n} \n \nfunction onWrapperClick(e: MouseEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n // Ignora clicks provenientes de elementos interactivos (botones, remove) \n const target = e.target as HTMLElement | null; \n if (target?.closest('button, a, input, [role=\"button\"][data-modo-item]')) return; \n openFilePicker(); \n} \nfunction onWrapperKeydown(e: KeyboardEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n if (e.key === 'Enter' || e.key === ' ') { \n e.preventDefault(); \n openFilePicker(); \n } \n} \n \n/* ---------- Merge external progress / errors ---------- */ \nconst files = computed<FileInputFile[]>(() => \n internalFiles.value.map((e) => ({ \n ...e, \n progress: props.progress?.[e.id] ?? e.progress, \n error: props.errors?.[e.id] ?? e.error, \n })), \n); \n \n/* ---------- v-model sync from outside ---------- */ \nwatch(() => props.modelValue, (v) => { \n if (!v) { \n if (internalFiles.value.length) revokeAll(); \n return; \n } \n // Solo sincroniza si el caller reemplazó la lista entera con otras refs. \n const current = internalFiles.value.map((e) => e.file); \n if (v.length === current.length && v.every((f, i) => f === current[i])) return; \n revokeAll(); \n const wrapped: FileInputFile[] = v.map((file) => { \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n return entry; \n }); \n internalFiles.value = wrapped; \n}, { immediate: true }); \n \n/* ---------- Display ---------- */ \n \nconst headlineText = computed(() => { \n if (files.value.length === 1) return files.value[0].name; \n return interpolate(loc.value.fileInput.filesSelected, { count: files.value.length }); \n}); \n \nconst helperInlineText = computed(() => { \n const bits: string[] = []; \n if (props.accept) bits.push(props.accept); \n if (props.maxSize) bits.push(interpolate(loc.value.fileInput.hintUpTo, { limit: formatBytes(props.maxSize) })); \n if (props.multiple && props.maxFiles) bits.push(interpolate(loc.value.fileInput.hintMax, { limit: props.maxFiles })); \n return bits.join(' · '); \n}); \n \nconst browseLabel = computed(() => \n props.multiple \n ? (files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse) \n : (files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse), \n); \n \n/* ---------- Size maps ---------- */\nconst wrapperSizeClasses = computed(() => `${sz.value.control} ${sz.value.padX}`);\nconst iconSizeClasses = computed(() => sz.value.icon); \n \n/* ---------- Area variant ---------- */ \nconst isAreaVariant = computed(() => props.dropzoneVariant === 'area'); \n \nconst areaHeightClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'min-h-[120px] py-4'; \n case 'large': return 'min-h-[240px] py-10'; \n default: return 'min-h-[180px] py-8'; \n } \n}); \n \nconst areaIconSizeClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'w-8 h-8'; \n case 'large': return 'w-14 h-14'; \n default: return 'w-10 h-10'; \n } \n}); \n \nconst areaPrimaryText = computed(() => { \n if (props.dropzoneLabel) return props.dropzoneLabel; \n if (files.value.length === 0) { \n return props.multiple \n ? loc.value.fileInput.dropzoneLabelMultiple \n : loc.value.fileInput.dropzoneLabel; \n } \n return headlineText.value; \n}); \n \nconst areaSecondaryText = computed<string | undefined>(() => { \n if (props.dropzoneHint) return props.dropzoneHint; \n return helperInlineText.value || undefined; \n}); \n \n/* ---------- Color / dashed accents ---------- */ \nconst ACCENT_TEXT_BY_COLOR: Record<string, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \nconst ACCENT_TEXT_IDLE_BY_COLOR: Record<string, string> = { \n default: 'text-muted-foreground', \n primary: 'text-primary/70', \n danger: 'text-destructive/70', \n success: 'text-success/70', \n warning: 'text-warning/70', \n}; \n// Dashed variant keeps a transparent surface — colored fills felt heavy \n// against form backgrounds. Color only surfaces via icon/button accents. \nconst DRAG_OVER_RING_BY_COLOR: Record<string, string> = { \n default: 'ring-4 ring-foreground/25 border-foreground', \n primary: 'ring-4 ring-primary/40 border-primary', \n danger: 'ring-4 ring-destructive/40 border-destructive', \n success: 'ring-4 ring-success/40 border-success', \n warning: 'ring-4 ring-warning/40 border-warning', \n}; \nconst PROGRESS_FILL_BY_COLOR: Record<string, string> = { \n default: 'bg-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst accentTextClass = computed(() => ACCENT_TEXT_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_BY_COLOR.default); \nconst accentTextIdleClass = computed(() => ACCENT_TEXT_IDLE_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_IDLE_BY_COLOR.default); \n// Idle border is always neutral — the color only surfaces as accent on \n// drag-over, focus, or in the upload Button. Matches Modal/Card surface pattern. \nconst colorBorderClass = computed(() => ''); \nconst dragOverRingClass = computed(() => \n DRAG_OVER_RING_BY_COLOR[stateColor.value] ?? DRAG_OVER_RING_BY_COLOR.default, \n); \nconst progressFillClass = computed(() => \n PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default, \n); \n \n/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */ \nconst dashedWrapperClasses = computed(() => { \n // Border stays neutral; only error state gets a colored border. \n const borderTint = hasError.value ? 'border-destructive/50' : 'border-border'; \n return [ \n 'border-2 border-dashed', \n borderTint, \n ].join(' '); \n}); \n \n/* ---------- Radius helpers ---------- */ \nconst itemRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-lg'; \n case 'full': return 'rounded-xl'; \n default: return 'rounded-md'; \n } \n}); \nconst itemThumbRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-md'; \n case 'full': return 'rounded-lg'; \n default: return 'rounded-md'; \n } \n}); \nconst progressRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n default: return 'rounded-full'; \n } \n}); \n</script> \n \n<style scoped> \n/* File item enter/leave + move. Mirrors the MultiSelect chip pattern but \n * collapses vertical space (max-height + margin-bottom + padding) so siblings \n * slide cleanly when files are added or removed. \n * \n * NOTE: spacing between items uses margin-bottom (see template), NOT the \n * parent's `gap`. `gap` cannot animate per-item so removing the first \n * file would leave a 6px gap that snaps closed when the node unmounts. \n */ \n.modo-file-enter-active, \n.modo-file-leave-active { \n transition: \n opacity 220ms cubic-bezier(0.2, 0, 0, 1), \n transform 260ms cubic-bezier(0.2, 0, 0, 1), \n max-height 260ms cubic-bezier(0.2, 0, 0, 1), \n margin-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-top 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n border-width 260ms cubic-bezier(0.2, 0, 0, 1); \n overflow: hidden; \n} \n.modo-file-move { \n transition: transform 260ms cubic-bezier(0.2, 0, 0, 1); \n} \n.modo-file-enter-from, \n.modo-file-leave-to { \n opacity: 0; \n transform: translateY(-4px) scale(0.98); \n max-height: 0; \n margin-bottom: 0 !important; \n padding-top: 0; \n padding-bottom: 0; \n border-width: 0; \n} \n.modo-file-enter-to, \n.modo-file-leave-from { \n /* 5rem comfortably fits the tallest file row (40px thumb + padding). */ \n max-height: 5rem; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-file-enter-active, \n .modo-file-leave-active, \n .modo-file-move { \n transition: none; \n } \n .modo-file-enter-from, \n .modo-file-leave-to { \n opacity: 1; \n transform: none; \n max-height: none; \n margin-bottom: initial !important; \n padding: initial; \n border-width: initial; \n } \n} \n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsNA,MAAM,QAAQ;EAqBO,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAE1C,MAAM,OAAO;EAQb,MAAM,MAAM,sBAAA,eAAe;EAE3B,MAAM,EACF,SAAS,UAAU,YAAY,SAAS,UAAU,aAClD,YAAY,WACZ,iBAAA,cAAc,OAAO;GAAE,eAAe;GAAa,UAAU;GAAa,CAAC;EAE/E,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAC7D,eAAe,MAAM;GACrB;GAAY;GAAU;GACtB,kBAAkB,WAAW;GAC7B,YAAY,MAAM;GACrB,CAAC;EAEF,MAAM,WAAA,GAAA,IAAA,KAAuC,KAAK;EAClD,MAAM,cAAA,GAAA,IAAA,KAAiB,MAAM;EAC7B,MAAM,iBAAA,GAAA,IAAA,KAAqC,EAAE,CAAC;EAC9C,MAAM,UAAA,GAAA,IAAA,QAAgB;EACtB,IAAI,UAAU;EACd,MAAM,eAAe,aAAa,OAAO,GAAG,EAAE;EAE9C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CAlE/B,MAAA,MAAM,OAAM,CAAA,CAAA;IAwEb,QAAA,aAAa,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAGlB,OAHN,aAGM,CAFgB,QAAA,cAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAA2G,mBAAA,SAAA;;KAA/F,KAAA,GAAA,IAAA,OAAI,QAAO;KAAE,SAAQ;KAAU,MAAK;KAAS,OAAM;KAAS,IAAG;;qCAAmB,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBAAZ,QAAA,UAAS,EAAA,EAAA,CAAA,CAAA;;qBACtF,QAAA,eAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAA6G,mBAAA,SAAA;;KAAhG,KAAA,GAAA,IAAA,OAAI,SAAQ;KAAE,SAAQ;KAAU,MAAK;KAAS,OAAM;KAAQ,IAAG;;qCAAoB,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBAAb,QAAA,WAAU,EAAA,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"FileInput.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/components/forms/FileInput.vue"],"sourcesContent":["<template> \n <div :class=\"['flex flex-col gap-1.5', fullWidth ? 'w-full' : 'inline-flex']\"> \n <label \n v-if=\"label\" \n :for=\"fieldId\" \n class=\"text-caption font-medium text-foreground\" \n > \n {{ label }} \n <span v-if=\"required\" aria-hidden=\"true\" class=\"text-destructive ml-0.5\">*</span> \n </label> \n \n <div \n :class=\"[ \n 'modo-field-wrapper transition-colors', \n dashed ? dashedWrapperClasses : wrapperVariantClasses, \n isAreaVariant ? '' : `flex items-center ${wrapperSizeClasses}`, \n radiusClasses, \n colorBorderClass, \n fullWidth ? 'w-full' : '', \n isDisabled ? 'opacity-60 cursor-not-allowed' : '', \n isDragOver ? dragOverRingClass : '', \n isAreaVariant && clickToSelect && !isDisabled && !readonly ? 'cursor-pointer' : '', \n ]\" \n :role=\"isAreaVariant ? 'button' : undefined\" \n :tabindex=\"isAreaVariant && !isDisabled && !readonly ? 0 : undefined\" \n :aria-label=\"isAreaVariant ? (ariaLabel ?? label ?? dropzoneLabel ?? loc.fileInput.uploadFiles) : undefined\" \n @dragover.prevent=\"onDragOver\" \n @dragleave.prevent=\"onDragLeave\" \n @drop.prevent=\"onDrop\" \n @click=\"onWrapperClick\" \n @keydown=\"onWrapperKeydown\" \n > \n <!-- Area variant --> \n <div \n v-if=\"isAreaVariant\" \n :class=\"[ \n 'flex flex-col items-center justify-center text-center gap-2 px-4', \n areaHeightClasses, \n ]\" \n > \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 transition-colors duration-base ease-standard', \n isDragOver ? accentTextClass : accentTextIdleClass, \n areaIconSizeClasses, \n ]\" \n /> \n <Typography variant=\"body\" :size=\"size\" weight=\"medium\"> \n {{ areaPrimaryText }} \n </Typography> \n <Typography v-if=\"areaSecondaryText\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\"> \n {{ areaSecondaryText }} \n </Typography> \n <div @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"size\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n class=\"mt-1\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Inline variant (default) --> \n <div v-else class=\"flex items-center gap-3 w-full min-w-0\"> \n <component \n :is=\"iconLeft ?? ArrowUpTrayIcon\" \n aria-hidden=\"true\" \n :class=\"['shrink-0', accentTextIdleClass, iconSizeClasses]\" \n /> \n <div class=\"flex-1 min-w-0\"> \n <p :class=\"['truncate', inputTextClasses, files.length === 0 ? 'text-muted-foreground' : 'text-foreground']\"> \n {{ files.length === 0 ? (placeholder ?? loc.fileInput.placeholder) : headlineText }} \n </p> \n <Typography v-if=\"helperInlineText\" variant=\"caption\" size=\"medium\" color=\"muted\" :truncate=\"true\" as=\"p\"> \n {{ helperInlineText }} \n </Typography> \n </div> \n <div class=\"flex shrink-0 items-center\" @click.stop> \n <Button \n :disabled=\"isDisabled || readonly\" \n :color=\"color\" \n :size=\"inlineButtonSize\" \n :class=\"['shrink-0', inlineButtonHeight]\" \n :radius=\"radius\" \n :icon=\"ArrowUpTrayIcon\" \n variant=\"outline\" \n :label=\"browseLabel\" \n @click=\"openFilePicker\" \n /> \n </div> \n </div> \n \n <!-- Hidden native input --> \n <input \n :id=\"fieldId\" \n ref=\"inputEl\" \n type=\"file\" \n class=\"sr-only\" \n :name=\"name\" \n :accept=\"accept\" \n :multiple=\"multiple\" \n :disabled=\"isDisabled\" \n :required=\"required\" \n :aria-label=\"!label ? ariaLabel : undefined\" \n :aria-invalid=\"hasError || undefined\" \n :aria-describedby=\"describedBy\" \n @change=\"onPickerChange\" \n /> \n </div> \n \n <!-- File list / previews (fuera del dropzone para no romper su forma) --> \n <TransitionGroup \n v-show=\"files.length\" \n appear \n name=\"modo-file\" \n tag=\"ul\" \n :class=\"[ \n 'flex flex-col mt-1', \n previews ? 'md:grid md:grid-cols-2 lg:grid-cols-3 md:gap-2' : '', \n ]\" \n > \n <li \n v-for=\"entry in files\" \n :key=\"entry.id\" \n :class=\"[ \n 'modo-file-item relative flex items-center gap-2 p-2 border border-border bg-background', \n // Vertical spacing via margin-bottom (not parent gap) so \n // it can animate to 0 on leave without causing a sibling \n // snap. Using mb (not mt) means when an item is removed \n // the newly-exposed sibling keeps its position. \n '[&:not(:last-child)]:mb-1.5 md:[&:not(:last-child)]:mb-0', \n itemRadiusClass, \n ]\" \n > \n <div \n v-if=\"previews && entry.previewUrl\" \n :class=\"[ \n 'shrink-0 w-10 h-10 overflow-hidden bg-muted', \n itemThumbRadiusClass, \n ]\" \n > \n <img :src=\"entry.previewUrl\" :alt=\"entry.name\" class=\"w-full h-full object-cover\" /> \n </div> \n <component \n v-else \n :is=\"isImage(entry) ? PhotoIcon : DocumentIcon\" \n aria-hidden=\"true\" \n :class=\"[ \n 'shrink-0 w-8 h-8 text-muted-foreground p-1.5 bg-muted', \n itemThumbRadiusClass, \n ]\" \n /> \n \n <div class=\"flex-1 min-w-0\"> \n <Typography variant=\"caption\" size=\"medium\" weight=\"medium\" :truncate=\"true\" as=\"p\">{{ entry.name }}</Typography> \n <p class=\"text-[11px] text-muted-foreground\"> \n {{ formatBytes(entry.size) }} \n <span v-if=\"entry.error\" class=\"text-destructive\">· {{ entry.error }}</span> \n </p> \n <!-- Progress bar --> \n <div \n v-if=\"typeof entry.progress === 'number' && entry.progress >= 0 && entry.progress < 100\" \n :class=\"['mt-1 h-1 overflow-hidden', progressRadiusClass, 'bg-muted']\" \n > \n <div \n :class=\"['h-full transition-all duration-base ease-standard', progressFillClass]\" \n :style=\"{ width: `${entry.progress}%` }\" \n /> \n </div> \n </div> \n \n <div v-if=\"!isDisabled && !readonly\" @click.stop> \n <Button \n variant=\"text\" \n :color=\"color\" \n size=\"small\" \n :icon=\"XMarkIcon\" \n :ariaLabel=\"`Remove ${entry.name}`\" \n @click=\"removeFile(entry.id)\" \n /> \n </div> \n </li> \n </TransitionGroup> \n \n <div v-if=\"errorText || helperText\" class=\"flex items-start gap-2\"> \n <Typography v-if=\"errorText\" :id=\"errorId\" variant=\"caption\" size=\"medium\" color=\"danger\" as=\"p\">{{ errorText }}</Typography> \n <Typography v-else-if=\"helperText\" :id=\"helperId\" variant=\"caption\" size=\"medium\" color=\"muted\" as=\"p\">{{ helperText }}</Typography> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, onBeforeUnmount, ref, useId, watch } from 'vue'; \nimport type { \n FileInput, \n FileInputFile, \n FileInputRejectCode, \n FileInputRejectContext, \n FileInputRejection, \n} from '../../interfaces/forms/FileInput.interface'; \nimport { useFieldState, useFieldClasses } from '../../composables/useField'; \nimport { useModoLocale, useResolvedSize, useSizeTokens } from '../../composables/useModoConfig';\nimport { interpolate } from '../../config/ModoLocale'; \nimport { ArrowUpTrayIcon, XMarkIcon, PhotoIcon, DocumentIcon } from '@heroicons/vue/24/outline'; \nimport Button from './Button.vue'; \nimport Typography from '../data-display/Typography.vue'; \n \nconst props = withDefaults(defineProps<FileInput>(), { \n modelValue: null, \n multiple: false, \n previews: true, \n dropzone: true, \n dropzoneVariant: 'inline', \n dropzoneHeight: 'medium', \n dashed: false, \n clickToSelect: true, \n variant: 'outline', \n color: 'default', \n disabled: false, \n readonly: false, \n required: false, \n loading: false, \n fullWidth: false, \n // `placeholder` is resolved at render time against the locale fallback. \n // Leaving the default undefined so `props.placeholder ?? loc...` works. \n autofocus: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size);\nconst sz = useSizeTokens(() => props.size);\n\nconst emit = defineEmits<{ \n 'update:modelValue': [files: File[] | null]; \n change: [files: File[] | null]; \n add: [files: File[]]; \n remove: [file: File]; \n reject: [rejections: FileInputRejection[]]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst { \n fieldId, hasError, isDisabled, errorId, helperId, describedBy, \n stateColor, radius, \n} = useFieldState(props, { componentName: 'FileInput', idPrefix: 'modo-file' }); \n \nconst { wrapperVariantClasses, radiusClasses } = useFieldClasses({ \n variant: () => props.variant, \n stateColor, hasError, radius, \n // The drop zone is a big box: `radius=\"full\"` caps at a card-like radius.\n radiusKind: () => (props.dropzoneVariant === 'area' ? 'surface' : 'control'), \n forceFocus: () => isDragOver.value, \n halo: () => props.halo, \n}); \n \nconst inputEl = ref<HTMLInputElement | null>(null); \nconst isDragOver = ref(false); \nconst internalFiles = ref<FileInputFile[]>([]); \nconst autoId = useId(); \nlet counter = 0; \nconst makeId = () => `modo-file-${autoId}-${++counter}`; \n \nfunction isImage(entry: FileInputFile) { \n return entry.type.startsWith('image/'); \n} \n \nfunction formatBytes(n: number) { \n if (n < 1024) return `${n} B`; \n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; \n if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`; \n return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`; \n} \n \nfunction openFilePicker() { \n if (isDisabled.value || props.readonly) return; \n inputEl.value?.click(); \n} \n \nfunction validate(file: File): { code: FileInputRejectCode; limit?: number | string } | null { \n if (props.maxSize && file.size > props.maxSize) { \n return { code: 'size', limit: props.maxSize }; \n } \n // Accept check (simple prefix + ext match) \n if (props.accept) { \n const tokens = props.accept.split(',').map((t) => t.trim().toLowerCase()); \n const name = file.name.toLowerCase(); \n const type = file.type.toLowerCase(); \n const ok = tokens.some((t) => { \n if (t.startsWith('.')) return name.endsWith(t); \n if (t.endsWith('/*')) return type.startsWith(t.slice(0, -1)); \n return type === t; \n }); \n if (!ok) return { code: 'type', limit: props.accept }; \n } \n return null; \n} \n \n/** \n * Reject message resolver with three-tier precedence: \n * 1. Per-component prop `rejectMessages` (fn > string with `{limit}`). \n * 2. `ModoProvider`-level `locale.fileInput.reject`. \n * 3. Built-in English defaults in `defaultLocale`. \n */ \nfunction resolveRejectMessage(ctx: FileInputRejectContext): string { \n const override = props.rejectMessages?.[ctx.code]; \n if (typeof override === 'function') return override(ctx); \n if (typeof override === 'string') { \n return applyLimit(override, ctx); \n } \n // Fall back to locale (which itself falls back to defaultLocale EN). \n const reject = loc.value.fileInput.reject; \n let template: string; \n if (ctx.code === 'size') { \n template = typeof ctx.limit === 'number' ? reject.size : reject.sizeNoLimit; \n } else if (ctx.code === 'count') { \n template = typeof ctx.limit === 'number' ? reject.count : reject.countNoLimit; \n } else { \n template = reject.type; \n } \n return applyLimit(template, ctx); \n} \n \nfunction applyLimit(template: string, ctx: FileInputRejectContext): string { \n if (!template.includes('{limit}')) return template; \n const value = \n typeof ctx.limit === 'number' && ctx.code === 'size' \n ? ctx.formatBytes(ctx.limit) \n : String(ctx.limit ?? ''); \n return template.split('{limit}').join(value); \n} \n \nfunction buildRejection( \n file: File, \n code: FileInputRejectCode, \n limit?: number | string, \n): FileInputRejection { \n const ctx: FileInputRejectContext = { file, code, limit, formatBytes }; \n return { file, code, limit, message: resolveRejectMessage(ctx) }; \n} \n \nfunction addFiles(list: FileList | File[]) { \n const incoming = Array.from(list); \n const accepted: FileInputFile[] = []; \n const rejected: FileInputRejection[] = []; \n \n for (const file of incoming) { \n const err = validate(file); \n if (err) { \n rejected.push(buildRejection(file, err.code, err.limit)); \n continue; \n } \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n accepted.push(entry); \n } \n \n // Respect multiple + maxFiles \n if (!props.multiple) { \n // Replace with first \n revokeAll(); \n internalFiles.value = accepted.slice(0, 1); \n } else { \n const next = [...internalFiles.value, ...accepted]; \n if (props.maxFiles && next.length > props.maxFiles) { \n const overflow = next.slice(props.maxFiles); \n overflow.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = next.slice(0, props.maxFiles); \n overflow.forEach((e) => \n rejected.push(buildRejection(e.file, 'count', props.maxFiles)), \n ); \n } else { \n internalFiles.value = next; \n } \n } \n \n if (accepted.length) emit('add', accepted.map((e) => e.file)); \n if (rejected.length) emit('reject', rejected); \n emitUpdate(); \n} \n \nfunction removeFile(id: string) { \n const idx = internalFiles.value.findIndex((e) => e.id === id); \n if (idx === -1) return; \n const [removed] = internalFiles.value.splice(idx, 1); \n if (removed.previewUrl) URL.revokeObjectURL(removed.previewUrl); \n emit('remove', removed.file); \n emitUpdate(); \n} \n \nfunction emitUpdate() { \n const out = internalFiles.value.map((e) => e.file); \n emit('update:modelValue', out.length ? out : null); \n emit('change', out.length ? out : null); \n} \n \nfunction revokeAll() { \n internalFiles.value.forEach((e) => { \n if (e.previewUrl) URL.revokeObjectURL(e.previewUrl); \n }); \n internalFiles.value = []; \n} \n \nonBeforeUnmount(() => revokeAll()); \n \n/* ---------- Events ---------- */ \n \nfunction onPickerChange(e: Event) { \n const input = e.target as HTMLInputElement; \n if (input.files && input.files.length) { \n addFiles(input.files); \n } \n // Reset para permitir re-seleccionar el mismo archivo \n input.value = ''; \n} \n \nfunction onDragOver(e: DragEvent) { \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy'; \n isDragOver.value = true; \n} \nfunction onDragLeave() { \n isDragOver.value = false; \n} \nfunction onDrop(e: DragEvent) { \n isDragOver.value = false; \n if (!props.dropzone || isDisabled.value || props.readonly) return; \n if (e.dataTransfer?.files?.length) { \n addFiles(e.dataTransfer.files); \n } \n} \n \nfunction onWrapperClick(e: MouseEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n // Ignora clicks provenientes de elementos interactivos (botones, remove) \n const target = e.target as HTMLElement | null; \n if (target?.closest('button, a, input, [role=\"button\"][data-modo-item]')) return; \n openFilePicker(); \n} \nfunction onWrapperKeydown(e: KeyboardEvent) { \n if (!isAreaVariant.value) return; \n if (!props.clickToSelect) return; \n if (isDisabled.value || props.readonly) return; \n if (e.key === 'Enter' || e.key === ' ') { \n e.preventDefault(); \n openFilePicker(); \n } \n} \n \n/* ---------- Merge external progress / errors ---------- */ \nconst files = computed<FileInputFile[]>(() => \n internalFiles.value.map((e) => ({ \n ...e, \n progress: props.progress?.[e.id] ?? e.progress, \n error: props.errors?.[e.id] ?? e.error, \n })), \n); \n \n/* ---------- v-model sync from outside ---------- */ \nwatch(() => props.modelValue, (v) => { \n if (!v) { \n if (internalFiles.value.length) revokeAll(); \n return; \n } \n // Solo sincroniza si el caller reemplazó la lista entera con otras refs. \n const current = internalFiles.value.map((e) => e.file); \n if (v.length === current.length && v.every((f, i) => f === current[i])) return; \n revokeAll(); \n const wrapped: FileInputFile[] = v.map((file) => { \n const entry: FileInputFile = { \n id: makeId(), \n file, \n name: file.name, \n size: file.size, \n type: file.type, \n }; \n if (props.previews && file.type.startsWith('image/')) { \n entry.previewUrl = URL.createObjectURL(file); \n } \n return entry; \n }); \n internalFiles.value = wrapped; \n}, { immediate: true }); \n \n/* ---------- Display ---------- */ \n \nconst headlineText = computed(() => { \n if (files.value.length === 1) return files.value[0].name; \n return interpolate(loc.value.fileInput.filesSelected, { count: files.value.length }); \n}); \n \nconst helperInlineText = computed(() => { \n const bits: string[] = []; \n if (props.accept) bits.push(props.accept); \n if (props.maxSize) bits.push(interpolate(loc.value.fileInput.hintUpTo, { limit: formatBytes(props.maxSize) })); \n if (props.multiple && props.maxFiles) bits.push(interpolate(loc.value.fileInput.hintMax, { limit: props.maxFiles })); \n return bits.join(' · '); \n}); \n \nconst browseLabel = computed(() => \n props.multiple \n ? (files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse) \n : (files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse), \n); \n \n/* ---------- Size maps ---------- */\nconst wrapperSizeClasses = computed(() => `${sz.value.control} ${sz.value.padX}`);\nconst iconSizeClasses = computed(() => sz.value.icon);\nconst inputTextClasses = computed(() => sz.value.text);\n// The inline Browse button is a trailing control: it sits inside the field with\n// 4px of air above and below (control height - 8px), so it never touches the\n// border at any radius. Same idea as the clear / eye buttons of other fields.\nconst INLINE_BUTTON_SIZE: Record<string, 'xsmall' | 'small' | 'medium'> = { xsmall: 'xsmall', small: 'xsmall', medium: 'small', large: 'medium' };\nconst inlineButtonSize = computed(() => INLINE_BUTTON_SIZE[resolvedSize.value] ?? 'small');\nconst INLINE_BUTTON_HEIGHT: Record<string, string> = { xsmall: '!h-6', small: '!h-7', medium: '!h-8', large: '!h-10' };\nconst inlineButtonHeight = computed(() => INLINE_BUTTON_HEIGHT[resolvedSize.value] ?? '!h-8'); \n \n/* ---------- Area variant ---------- */ \nconst isAreaVariant = computed(() => props.dropzoneVariant === 'area'); \n \nconst areaHeightClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'min-h-[120px] py-4'; \n case 'large': return 'min-h-[240px] py-10'; \n default: return 'min-h-[180px] py-8'; \n } \n}); \n \nconst areaIconSizeClasses = computed(() => { \n switch (props.dropzoneHeight) { \n case 'small': return 'w-8 h-8'; \n case 'large': return 'w-14 h-14'; \n default: return 'w-10 h-10'; \n } \n}); \n \nconst areaPrimaryText = computed(() => { \n if (props.dropzoneLabel) return props.dropzoneLabel; \n if (files.value.length === 0) { \n return props.multiple \n ? loc.value.fileInput.dropzoneLabelMultiple \n : loc.value.fileInput.dropzoneLabel; \n } \n return headlineText.value; \n}); \n \nconst areaSecondaryText = computed<string | undefined>(() => { \n if (props.dropzoneHint) return props.dropzoneHint; \n return helperInlineText.value || undefined; \n}); \n \n/* ---------- Color / dashed accents ---------- */ \nconst ACCENT_TEXT_BY_COLOR: Record<string, string> = { \n default: 'text-foreground', \n primary: 'text-primary', \n danger: 'text-destructive', \n success: 'text-success', \n warning: 'text-warning', \n}; \nconst ACCENT_TEXT_IDLE_BY_COLOR: Record<string, string> = { \n default: 'text-muted-foreground', \n primary: 'text-primary/70', \n danger: 'text-destructive/70', \n success: 'text-success/70', \n warning: 'text-warning/70', \n}; \n// Dashed variant keeps a transparent surface — colored fills felt heavy \n// against form backgrounds. Color only surfaces via icon/button accents. \nconst DRAG_OVER_RING_BY_COLOR: Record<string, string> = { \n default: 'ring-4 ring-foreground/25 border-foreground', \n primary: 'ring-4 ring-primary/40 border-primary', \n danger: 'ring-4 ring-destructive/40 border-destructive', \n success: 'ring-4 ring-success/40 border-success', \n warning: 'ring-4 ring-warning/40 border-warning', \n}; \nconst PROGRESS_FILL_BY_COLOR: Record<string, string> = { \n default: 'bg-foreground', \n primary: 'bg-primary', \n danger: 'bg-destructive', \n success: 'bg-success', \n warning: 'bg-warning', \n}; \n \nconst accentTextClass = computed(() => ACCENT_TEXT_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_BY_COLOR.default); \nconst accentTextIdleClass = computed(() => ACCENT_TEXT_IDLE_BY_COLOR[stateColor.value] ?? ACCENT_TEXT_IDLE_BY_COLOR.default); \n// Idle border is always neutral — the color only surfaces as accent on \n// drag-over, focus, or in the upload Button. Matches Modal/Card surface pattern. \nconst colorBorderClass = computed(() => ''); \nconst dragOverRingClass = computed(() => \n DRAG_OVER_RING_BY_COLOR[stateColor.value] ?? DRAG_OVER_RING_BY_COLOR.default, \n); \nconst progressFillClass = computed(() => \n PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default, \n); \n \n/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */ \nconst dashedWrapperClasses = computed(() => { \n // Border stays neutral; only error state gets a colored border. \n const borderTint = hasError.value ? 'border-destructive/50' : 'border-input not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover'; \n return [ \n 'border-2 border-dashed', \n borderTint, \n ].join(' '); \n}); \n \n/* ---------- Radius helpers ---------- */ \nconst itemRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-lg'; \n // File chips are inner controls: they take the full pill.\n case 'full': return 'rounded-full pl-3'; \n default: return 'rounded-md'; \n } \n}); \nconst itemThumbRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-md'; \n case 'full': return 'rounded-full'; \n default: return 'rounded-md'; \n } \n}); \nconst progressRadiusClass = computed(() => { \n switch (radius.value) { \n case 'none': return 'rounded-none'; \n default: return 'rounded-full'; \n } \n}); \n</script> \n \n<style scoped> \n/* File item enter/leave + move. Mirrors the MultiSelect chip pattern but \n * collapses vertical space (max-height + margin-bottom + padding) so siblings \n * slide cleanly when files are added or removed. \n * \n * NOTE: spacing between items uses margin-bottom (see template), NOT the \n * parent's `gap`. `gap` cannot animate per-item so removing the first \n * file would leave a 6px gap that snaps closed when the node unmounts. \n */ \n.modo-file-enter-active, \n.modo-file-leave-active { \n transition: \n opacity 220ms cubic-bezier(0.2, 0, 0, 1), \n transform 260ms cubic-bezier(0.2, 0, 0, 1), \n max-height 260ms cubic-bezier(0.2, 0, 0, 1), \n margin-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-top 260ms cubic-bezier(0.2, 0, 0, 1), \n padding-bottom 260ms cubic-bezier(0.2, 0, 0, 1), \n border-width 260ms cubic-bezier(0.2, 0, 0, 1); \n overflow: hidden; \n} \n.modo-file-move { \n transition: transform 260ms cubic-bezier(0.2, 0, 0, 1); \n} \n.modo-file-enter-from, \n.modo-file-leave-to { \n opacity: 0; \n transform: translateY(-4px) scale(0.98); \n max-height: 0; \n margin-bottom: 0 !important; \n padding-top: 0; \n padding-bottom: 0; \n border-width: 0; \n} \n.modo-file-enter-to, \n.modo-file-leave-from { \n /* 5rem comfortably fits the tallest file row (40px thumb + padding). */ \n max-height: 5rem; \n} \n \n@media (prefers-reduced-motion: reduce) { \n .modo-file-enter-active, \n .modo-file-leave-active, \n .modo-file-move { \n transition: none; \n } \n .modo-file-enter-from, \n .modo-file-leave-to { \n opacity: 1; \n transform: none; \n max-height: none; \n margin-bottom: initial !important; \n padding: initial; \n border-width: initial; \n } \n} \n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuNA,MAAM,QAAQ;EAqBd,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,KAAK,sBAAA,oBAAoB,MAAM,KAAK;EAE1C,MAAM,OAAO;EAQb,MAAM,MAAM,sBAAA,eAAe;EAE3B,MAAM,EACF,SAAS,UAAU,YAAY,SAAS,UAAU,aAClD,YAAY,WACZ,iBAAA,cAAc,OAAO;GAAE,eAAe;GAAa,UAAU;GAAa,CAAC;EAE/E,MAAM,EAAE,uBAAuB,kBAAkB,iBAAA,gBAAgB;GAC7D,eAAe,MAAM;GACrB;GAAY;GAAU;GAEtB,kBAAmB,MAAM,oBAA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KAAU,MAAK;KAAS,OAAM;KAAQ,IAAG;;qCAAoB,EAAA,GAAA,IAAA,kBAAA,GAAA,IAAA,iBAAb,QAAA,WAAU,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -19,7 +19,7 @@ var _hoisted_3 = [
|
|
|
19
19
|
];
|
|
20
20
|
var _hoisted_4 = {
|
|
21
21
|
key: 1,
|
|
22
|
-
class: "flex items-center gap-3"
|
|
22
|
+
class: "flex items-center gap-3 w-full min-w-0"
|
|
23
23
|
};
|
|
24
24
|
var _hoisted_5 = { class: "flex-1 min-w-0" };
|
|
25
25
|
var _hoisted_6 = [
|
|
@@ -125,7 +125,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
125
125
|
],
|
|
126
126
|
setup(__props, { emit: __emit }) {
|
|
127
127
|
const props = __props;
|
|
128
|
-
useResolvedSize(() => props.size);
|
|
128
|
+
const resolvedSize = useResolvedSize(() => props.size);
|
|
129
129
|
const sz = useSizeTokens(() => props.size);
|
|
130
130
|
const emit = __emit;
|
|
131
131
|
const loc = useModoLocale();
|
|
@@ -138,6 +138,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
138
138
|
stateColor,
|
|
139
139
|
hasError,
|
|
140
140
|
radius,
|
|
141
|
+
radiusKind: () => props.dropzoneVariant === "area" ? "surface" : "control",
|
|
141
142
|
forceFocus: () => isDragOver.value,
|
|
142
143
|
halo: () => props.halo
|
|
143
144
|
});
|
|
@@ -346,6 +347,21 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
346
347
|
const browseLabel = computed(() => props.multiple ? files.value.length ? loc.value.fileInput.addMore : loc.value.fileInput.browse : files.value.length ? loc.value.fileInput.replace : loc.value.fileInput.browse);
|
|
347
348
|
const wrapperSizeClasses = computed(() => `${sz.value.control} ${sz.value.padX}`);
|
|
348
349
|
const iconSizeClasses = computed(() => sz.value.icon);
|
|
350
|
+
const inputTextClasses = computed(() => sz.value.text);
|
|
351
|
+
const INLINE_BUTTON_SIZE = {
|
|
352
|
+
xsmall: "xsmall",
|
|
353
|
+
small: "xsmall",
|
|
354
|
+
medium: "small",
|
|
355
|
+
large: "medium"
|
|
356
|
+
};
|
|
357
|
+
const inlineButtonSize = computed(() => INLINE_BUTTON_SIZE[resolvedSize.value] ?? "small");
|
|
358
|
+
const INLINE_BUTTON_HEIGHT = {
|
|
359
|
+
xsmall: "!h-6",
|
|
360
|
+
small: "!h-7",
|
|
361
|
+
medium: "!h-8",
|
|
362
|
+
large: "!h-10"
|
|
363
|
+
};
|
|
364
|
+
const inlineButtonHeight = computed(() => INLINE_BUTTON_HEIGHT[resolvedSize.value] ?? "!h-8");
|
|
349
365
|
const isAreaVariant = computed(() => props.dropzoneVariant === "area");
|
|
350
366
|
const areaHeightClasses = computed(() => {
|
|
351
367
|
switch (props.dropzoneHeight) {
|
|
@@ -405,14 +421,14 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
405
421
|
const progressFillClass = computed(() => PROGRESS_FILL_BY_COLOR[stateColor.value] ?? PROGRESS_FILL_BY_COLOR.default);
|
|
406
422
|
/** Wrapper classes when `dashed=true` (overrides the field variant entirely). */
|
|
407
423
|
const dashedWrapperClasses = computed(() => {
|
|
408
|
-
return ["border-2 border-dashed", hasError.value ? "border-destructive/50" : "border-border"].join(" ");
|
|
424
|
+
return ["border-2 border-dashed", hasError.value ? "border-destructive/50" : "border-input not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover"].join(" ");
|
|
409
425
|
});
|
|
410
426
|
const itemRadiusClass = computed(() => {
|
|
411
427
|
switch (radius.value) {
|
|
412
428
|
case "none": return "rounded-none";
|
|
413
429
|
case "small": return "rounded-sm";
|
|
414
430
|
case "large": return "rounded-lg";
|
|
415
|
-
case "full": return "rounded-
|
|
431
|
+
case "full": return "rounded-full pl-3";
|
|
416
432
|
default: return "rounded-md";
|
|
417
433
|
}
|
|
418
434
|
});
|
|
@@ -421,7 +437,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
421
437
|
case "none": return "rounded-none";
|
|
422
438
|
case "small": return "rounded-sm";
|
|
423
439
|
case "large": return "rounded-md";
|
|
424
|
-
case "full": return "rounded-
|
|
440
|
+
case "full": return "rounded-full";
|
|
425
441
|
default: return "rounded-md";
|
|
426
442
|
}
|
|
427
443
|
});
|
|
@@ -442,7 +458,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
442
458
|
class: normalizeClass([
|
|
443
459
|
"modo-field-wrapper transition-colors",
|
|
444
460
|
__props.dashed ? dashedWrapperClasses.value : unref(wrapperVariantClasses),
|
|
445
|
-
isAreaVariant.value ? "" : wrapperSizeClasses.value
|
|
461
|
+
isAreaVariant.value ? "" : `flex items-center ${wrapperSizeClasses.value}`,
|
|
446
462
|
unref(radiusClasses),
|
|
447
463
|
colorBorderClass.value,
|
|
448
464
|
__props.fullWidth ? "w-full" : "",
|
|
@@ -515,15 +531,11 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
515
531
|
iconSizeClasses.value
|
|
516
532
|
])
|
|
517
533
|
}, null, 8, ["class"])),
|
|
518
|
-
createElementVNode("div", _hoisted_5, [
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}, {
|
|
524
|
-
default: withCtx(() => [createTextVNode(toDisplayString(files.value.length === 0 ? __props.placeholder ?? unref(loc).fileInput.placeholder : headlineText.value), 1)]),
|
|
525
|
-
_: 1
|
|
526
|
-
}, 8, ["size"]), helperInlineText.value ? (openBlock(), createBlock(Typography_default, {
|
|
534
|
+
createElementVNode("div", _hoisted_5, [createElementVNode("p", { class: normalizeClass([
|
|
535
|
+
"truncate",
|
|
536
|
+
inputTextClasses.value,
|
|
537
|
+
files.value.length === 0 ? "text-muted-foreground" : "text-foreground"
|
|
538
|
+
]) }, toDisplayString(files.value.length === 0 ? __props.placeholder ?? unref(loc).fileInput.placeholder : headlineText.value), 3), helperInlineText.value ? (openBlock(), createBlock(Typography_default, {
|
|
527
539
|
key: 0,
|
|
528
540
|
variant: "caption",
|
|
529
541
|
size: "medium",
|
|
@@ -534,10 +546,14 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
534
546
|
default: withCtx(() => [createTextVNode(toDisplayString(helperInlineText.value), 1)]),
|
|
535
547
|
_: 1
|
|
536
548
|
})) : createCommentVNode("", true)]),
|
|
537
|
-
createElementVNode("div", {
|
|
549
|
+
createElementVNode("div", {
|
|
550
|
+
class: "flex shrink-0 items-center",
|
|
551
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
|
|
552
|
+
}, [createVNode(Button_default, {
|
|
538
553
|
disabled: unref(isDisabled) || __props.readonly,
|
|
539
554
|
color: __props.color,
|
|
540
|
-
size:
|
|
555
|
+
size: inlineButtonSize.value,
|
|
556
|
+
class: normalizeClass(["shrink-0", inlineButtonHeight.value]),
|
|
541
557
|
radius: unref(radius),
|
|
542
558
|
icon: unref(ArrowUpTrayIcon),
|
|
543
559
|
variant: "outline",
|
|
@@ -547,6 +563,7 @@ var FileInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
547
563
|
"disabled",
|
|
548
564
|
"color",
|
|
549
565
|
"size",
|
|
566
|
+
"class",
|
|
550
567
|
"radius",
|
|
551
568
|
"icon",
|
|
552
569
|
"label"
|