ropav 0.1.6 → 0.1.8
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 +7 -1
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +123 -155
- package/dist/alert.css +18 -18
- package/dist/alert.js +10 -11
- package/dist/ancestry.js +136 -0
- package/dist/aria.js +14 -0
- package/dist/aspect-ratio.js +1 -1
- package/dist/attributes.js +9 -0
- package/dist/attributes2.js +29 -0
- package/dist/avatar.css +19 -19
- package/dist/avatar.js +9 -17
- package/dist/badge.css +16 -16
- package/dist/badge.js +5 -5
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +4 -3
- package/dist/button.js +4 -3
- package/dist/button.scss_vue_type_style_index_0_src_true_lang.js +1 -1
- package/dist/calendar.css +173 -0
- package/dist/calendar.js +714 -0
- package/dist/calendar2.js +37 -0
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +22 -28
- package/dist/chevron-left.js +12 -0
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +7 -6
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +14 -13
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +247 -276
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +6 -8
- package/dist/color.js +5 -10
- package/dist/combobox.css +251 -0
- package/dist/combobox.js +410 -0
- package/dist/componentColors.js +125 -84
- package/dist/componentRef.js +26 -0
- package/dist/components/accordion/accordionContext.d.ts +3 -0
- package/dist/components/accordion/accordionModel.d.ts +14 -0
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/types.d.ts +1 -2
- package/dist/components/accordion/useAccordion.d.ts +2 -2
- package/dist/components/accordion/useAccordionItem.d.ts +2 -0
- package/dist/components/calendar/calendar.d.ts +30 -0
- package/dist/components/calendar/calendarBehavior.d.ts +49 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/types.d.ts +53 -0
- package/dist/components/calendar/useCalendar.d.ts +24 -0
- package/dist/components/checkbox/useCheckbox.d.ts +1 -2
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +2 -2
- package/dist/components/color-picker/useColorPickerDrag.d.ts +1 -1
- package/dist/components/color-picker/useColorPickerSaturation.d.ts +22 -0
- package/dist/components/color-picker/useColorPickerSlider.d.ts +20 -0
- package/dist/components/color-picker/useColorPickerValue.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts +29 -0
- package/dist/components/combobox/comboboxModel.d.ts +4 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/combobox/types.d.ts +43 -0
- package/dist/components/combobox/useCombobox.d.ts +45 -0
- package/dist/components/date-picker/date-picker.d.ts +33 -0
- package/dist/components/date-picker/datePickerModel.d.ts +10 -0
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/date-picker/types.d.ts +57 -0
- package/dist/components/date-picker/useDatePicker.d.ts +29 -0
- package/dist/components/date-picker/useDatePickerValueState.d.ts +21 -0
- package/dist/components/dialog/{dialog-core.d.ts → dialogContext.d.ts} +1 -5
- package/dist/components/dialog/useDialogContentInteractions.d.ts +18 -0
- package/dist/components/dialog/useDialogRootState.d.ts +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-item-row.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-items.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-model.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-trigger.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -30
- package/dist/components/dropdown-menu/dropdownMenuDataModel.d.ts +20 -0
- package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionNavigation.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionRegistry.d.ts +42 -0
- package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +114 -0
- package/dist/components/dropdown-menu/useDropdownMenu.d.ts +11 -11
- package/dist/components/dropdown-menu/useDropdownMenuContextTrigger.d.ts +9 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +35 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +24 -0
- package/dist/components/dropdown-menu/useDropdownMenuHoverIntent.d.ts +6 -5
- package/dist/components/dropdown-menu/useDropdownMenuInteractionDismissal.d.ts +17 -0
- package/dist/components/dropdown-menu/useDropdownMenuInteractionKeyboard.d.ts +19 -0
- package/dist/components/dropdown-menu/useDropdownMenuPortalPosition.d.ts +0 -1
- package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +28 -0
- package/dist/components/dropdown-menu/useDropdownMenuPrimitiveContent.d.ts +2 -2
- package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +1 -1
- package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +19 -0
- package/dist/components/dropzone/dropzone.d.ts +31 -0
- package/dist/components/dropzone/dropzoneModel.d.ts +16 -0
- package/dist/components/dropzone/index.d.ts +3 -0
- package/dist/components/dropzone/index.js +2 -0
- package/dist/components/dropzone/types.d.ts +56 -0
- package/dist/components/dropzone/useDropzone.d.ts +25 -0
- package/dist/components/file-input/file-input.d.ts +29 -0
- package/dist/components/file-input/index.d.ts +3 -0
- package/dist/components/file-input/index.js +2 -0
- package/dist/components/file-input/types.d.ts +37 -0
- package/dist/components/file-input/useFileInput.d.ts +15 -0
- package/dist/components/floating/index.js +2 -2
- package/dist/components/floating/useFloatingPosition.d.ts +1 -14
- package/dist/components/floating/useFloatingTargetLifecycle.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +10 -0
- package/dist/components/hover-card/hover-card.d.ts +25 -0
- package/dist/components/hover-card/index.d.ts +3 -0
- package/dist/components/hover-card/index.js +2 -0
- package/dist/components/hover-card/types.d.ts +45 -0
- package/dist/components/hover-card/useHoverCard.d.ts +22 -0
- package/dist/components/hover-card/useHoverCardDisclosure.d.ts +19 -0
- package/dist/components/multi-select/index.d.ts +3 -0
- package/dist/components/multi-select/index.js +2 -0
- package/dist/components/multi-select/multi-select.d.ts +30 -0
- package/dist/components/multi-select/multiSelectModel.d.ts +3 -0
- package/dist/components/multi-select/types.d.ts +49 -0
- package/dist/components/multi-select/useMultiSelect.d.ts +46 -0
- package/dist/components/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +3 -19
- package/dist/components/pagination/index.d.ts +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/paginationModel.d.ts +4 -0
- package/dist/components/pagination/types.d.ts +15 -0
- package/dist/components/pagination/usePagination.d.ts +3 -19
- package/dist/components/popover/usePopoverBindings.d.ts +13 -0
- package/dist/components/progress/progressModel.d.ts +8 -0
- package/dist/components/progress/useProgress.d.ts +0 -6
- package/dist/components/radio/useRadio.d.ts +1 -2
- package/dist/components/scroll-area/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area/scrollAreaModel.d.ts +64 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +70 -53
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -17
- package/dist/components/scroll-area/useScrollAreaDerivedState.d.ts +8 -0
- package/dist/components/scroll-area/useScrollAreaMeasurement.d.ts +35 -0
- package/dist/components/scroll-area/useScrollAreaPointer.d.ts +11 -9
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- package/dist/components/segmented-control/index.d.ts +3 -0
- package/dist/components/segmented-control/index.js +2 -0
- package/dist/components/segmented-control/segmented-control.d.ts +26 -0
- package/dist/components/segmented-control/types.d.ts +47 -0
- package/dist/components/segmented-control/useSegmentedControl.d.ts +15 -0
- package/dist/components/select/useSelect.d.ts +31 -19
- package/dist/components/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +0 -1
- package/dist/components/slider/useRangeSlider.d.ts +9 -17
- package/dist/components/slider/useRangeSliderPointer.d.ts +1 -1
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +7 -13
- package/dist/components/slider/useSliderPointerPreview.d.ts +22 -0
- package/dist/components/slider/useSliderTooltipState.d.ts +40 -0
- package/dist/components/slider/useSliderValueState.d.ts +33 -0
- package/dist/components/tags-input/index.d.ts +3 -0
- package/dist/components/tags-input/index.js +2 -0
- package/dist/components/tags-input/tags-input.d.ts +27 -0
- package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
- package/dist/components/tags-input/types.d.ts +37 -0
- package/dist/components/tags-input/useTagsInput.d.ts +23 -0
- package/dist/components/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
- package/dist/css.js +12 -0
- package/dist/date-picker.css +49 -0
- package/dist/date-picker.js +809 -0
- package/dist/dialog.js +215 -218
- package/dist/direction.js +6 -0
- package/dist/dropdown-menu.css +21 -3
- package/dist/dropdown-menu.js +1626 -1185
- package/dist/dropzone.css +135 -0
- package/dist/dropzone.js +431 -0
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/file-input.css +135 -0
- package/dist/file-input.js +198 -0
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/hover-card.css +80 -0
- package/dist/hover-card.js +402 -0
- package/dist/icon-button.css +8 -8
- package/dist/icon-button.js +7 -6
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -9
- package/dist/input.css +24 -24
- package/dist/input.js +19 -31
- package/dist/interactive.js +18 -0
- package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
- package/dist/modal.js +2 -2
- package/dist/multi-select.css +316 -0
- package/dist/multi-select.js +481 -0
- package/dist/nativeChoice.js +169 -0
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +44 -44
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +66 -73
- package/dist/pointerSession.js +130 -0
- package/dist/popover.css +55 -37
- package/dist/popover.js +75 -101
- package/dist/progress.js +10 -13
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +30 -36
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +28 -28
- package/dist/scroll-area.js +540 -554
- package/dist/segmented-control.css +176 -0
- package/dist/segmented-control.js +382 -0
- package/dist/select.css +50 -48
- package/dist/select.js +131 -289
- package/dist/slider.css +191 -191
- package/dist/slider.js +720 -706
- package/dist/styles-api.d.ts +0 -1
- package/dist/styles-api.js +1 -4
- package/dist/switch.css +17 -17
- package/dist/switch.js +14 -15
- package/dist/tabs.css +43 -43
- package/dist/tabs.js +29 -56
- package/dist/tags-input.css +197 -0
- package/dist/tags-input.js +380 -0
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +21 -32
- package/dist/toast.css +26 -26
- package/dist/toast.js +141 -118
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +64 -63
- package/dist/useCollapse.js +8 -11
- package/dist/useControlState.js +3 -6
- package/dist/useEditableOptionList.js +216 -0
- package/dist/useFlatOptionCollection.js +134 -0
- package/dist/useFloatingPosition.js +14 -40
- package/dist/useFloatingTargetLifecycle.js +127 -0
- package/dist/useFormControl.js +1 -0
- package/dist/useHoverDisclosure.js +561 -0
- package/dist/useNativeChoiceTransaction.js +46 -0
- package/dist/useNativeFileSelection.js +86 -0
- package/dist/useOverlayZIndex.js +246 -19
- package/dist/useTeleportTarget.js +3 -14
- package/dist/useTypeahead.js +94 -0
- package/dist/utils/aria.d.ts +3 -0
- package/dist/utils/attributes.d.ts +2 -0
- package/dist/utils/bem.d.ts +3 -0
- package/dist/utils/collectionNavigation.d.ts +2 -0
- package/dist/utils/color.d.ts +7 -0
- package/dist/{components/color-picker/color-picker-utils.d.ts → utils/colorPicker.d.ts} +5 -4
- package/dist/utils/componentColors.d.ts +7 -0
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/dateAvailability.d.ts +7 -0
- package/dist/utils/dom/ancestry.d.ts +8 -0
- package/dist/utils/dom/attributes.d.ts +16 -0
- package/dist/utils/dom/componentRef.d.ts +4 -0
- package/dist/utils/dom/direction.d.ts +2 -0
- package/dist/utils/dom/events.d.ts +5 -0
- package/dist/utils/dom/files.d.ts +3 -0
- package/dist/utils/dom/focusNavigation.d.ts +7 -0
- package/dist/utils/dom/interactive.d.ts +2 -0
- package/dist/utils/dom/nativeChoice.d.ts +17 -0
- package/dist/utils/dom/pointerSession.d.ts +20 -0
- package/dist/utils/dom/query.d.ts +4 -0
- package/dist/utils/dom/scroll.d.ts +24 -0
- package/dist/utils/floatingOffset.d.ts +10 -0
- package/dist/utils/geometry.d.ts +14 -0
- package/dist/utils/indexPath.d.ts +6 -0
- package/dist/utils/number.d.ts +4 -0
- package/dist/utils/optionFilter.d.ts +5 -0
- package/dist/utils/rafScheduler.d.ts +4 -0
- package/dist/utils/text.d.ts +2 -0
- package/docs/code-architecture.md +118 -0
- package/docs/public-floating-api.md +13 -9
- package/docs/public-styles-api.md +25 -12
- package/package.json +51 -14
- package/src/styles/_mixins.scss +26 -0
- package/src/styles/styles-manifest.json +1 -2
- package/dist/components/dropdown-menu/dropdown-menu-outside.d.ts +0 -3
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -21
- package/dist/components/dropdown-menu/useDropdownMenuDisclosure.d.ts +0 -36
- package/dist/components/dropdown-menu/useDropdownMenuDom.d.ts +0 -29
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +0 -52
- package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +0 -17
- package/dist/components/dropdown-menu/useDropdownSubmenus.d.ts +0 -18
- package/dist/components/scroll-area/scrollAreaCore.d.ts +0 -30
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -38
- package/dist/components/select/useSelectNativeControl.d.ts +0 -9
- package/dist/components/select/useSelectNativeValue.d.ts +0 -9
- package/dist/floating.js +0 -415
- /package/dist/components/alert/{useAlertColor.d.ts → alertColor.d.ts} +0 -0
- /package/dist/components/avatar/{useAvatarColor.d.ts → avatarColor.d.ts} +0 -0
- /package/dist/components/badge/{useBadgeColor.d.ts → badgeColor.d.ts} +0 -0
- /package/dist/components/button/{useButtonColor.d.ts → buttonColor.d.ts} +0 -0
- /package/dist/components/color-swatch/{useColorSwatchColor.d.ts → colorSwatchColor.d.ts} +0 -0
- /package/dist/components/toast/{useToastColor.d.ts → toastColor.d.ts} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
@layer ropav.components {
|
|
2
|
+
.rp-dropzone[data-v-0f0e7a3d] {
|
|
3
|
+
--_rp-dropzone-min-height: calc(var(--rp-size-control-xl) * 2.5);
|
|
4
|
+
--_rp-dropzone-padding: var(--rp-spacing-6);
|
|
5
|
+
--_rp-dropzone-font-size: var(--rp-font-size-md);
|
|
6
|
+
--_rp-dropzone-radius: var(--rp-radius-sm);
|
|
7
|
+
--_rp-dropzone-border: var(--rp-color-control-border);
|
|
8
|
+
--_rp-dropzone-ring: var(--rp-color-focus-ring);
|
|
9
|
+
--_rp-dropzone-bg: var(--rp-color-control-bg);
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-height: var(--_rp-dropzone-min-height);
|
|
17
|
+
padding: var(--_rp-dropzone-padding);
|
|
18
|
+
color: var(--rp-color-control-fg);
|
|
19
|
+
font-family: var(--rp-font-family);
|
|
20
|
+
font-size: var(--_rp-dropzone-font-size);
|
|
21
|
+
background-color: var(--_rp-dropzone-bg);
|
|
22
|
+
border: var(--rp-border-width-medium) dashed var(--_rp-dropzone-border);
|
|
23
|
+
border-radius: var(--_rp-dropzone-radius);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
transition: background-color var(--rp-transition-fast), border-color var(--rp-transition-fast), box-shadow var(--rp-transition-fast);
|
|
26
|
+
}
|
|
27
|
+
.rp-dropzone[data-v-0f0e7a3d]:hover:not(.rp-dropzone--disabled):not(.rp-dropzone--invalid):not(.rp-dropzone--valid):not(.rp-dropzone--dragging) {
|
|
28
|
+
--_rp-dropzone-border: var(--rp-color-control-border-hover);
|
|
29
|
+
}
|
|
30
|
+
.rp-dropzone[data-v-0f0e7a3d]:focus-visible, .rp-dropzone[data-v-0f0e7a3d]:focus-within {
|
|
31
|
+
outline: none;
|
|
32
|
+
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--_rp-dropzone-ring);
|
|
33
|
+
}
|
|
34
|
+
.rp-dropzone--size-sm[data-v-0f0e7a3d] {
|
|
35
|
+
--_rp-dropzone-min-height: calc(var(--rp-size-control-xl) * 2);
|
|
36
|
+
--_rp-dropzone-padding: var(--rp-spacing-4);
|
|
37
|
+
--_rp-dropzone-font-size: var(--rp-font-size-sm);
|
|
38
|
+
}
|
|
39
|
+
.rp-dropzone--size-md[data-v-0f0e7a3d] {
|
|
40
|
+
--_rp-dropzone-min-height: calc(var(--rp-size-control-xl) * 2.5);
|
|
41
|
+
--_rp-dropzone-padding: var(--rp-spacing-6);
|
|
42
|
+
--_rp-dropzone-font-size: var(--rp-font-size-md);
|
|
43
|
+
}
|
|
44
|
+
.rp-dropzone--size-lg[data-v-0f0e7a3d] {
|
|
45
|
+
--_rp-dropzone-min-height: calc(var(--rp-size-control-xl) * 3);
|
|
46
|
+
--_rp-dropzone-padding: var(--rp-spacing-8);
|
|
47
|
+
--_rp-dropzone-font-size: var(--rp-font-size-lg);
|
|
48
|
+
}
|
|
49
|
+
.rp-dropzone--radius-xs[data-v-0f0e7a3d] {
|
|
50
|
+
--_rp-dropzone-radius: var(--rp-radius-xs);
|
|
51
|
+
}
|
|
52
|
+
.rp-dropzone--radius-sm[data-v-0f0e7a3d] {
|
|
53
|
+
--_rp-dropzone-radius: var(--rp-radius-sm);
|
|
54
|
+
}
|
|
55
|
+
.rp-dropzone--radius-md[data-v-0f0e7a3d] {
|
|
56
|
+
--_rp-dropzone-radius: var(--rp-radius-md);
|
|
57
|
+
}
|
|
58
|
+
.rp-dropzone--radius-lg[data-v-0f0e7a3d] {
|
|
59
|
+
--_rp-dropzone-radius: var(--rp-radius-lg);
|
|
60
|
+
}
|
|
61
|
+
.rp-dropzone--radius-xl[data-v-0f0e7a3d] {
|
|
62
|
+
--_rp-dropzone-radius: var(--rp-radius-xl);
|
|
63
|
+
}
|
|
64
|
+
.rp-dropzone--accept[data-v-0f0e7a3d] {
|
|
65
|
+
--_rp-dropzone-border: var(--rp-color-green-outline);
|
|
66
|
+
--_rp-dropzone-ring: color-mix(in srgb, var(--rp-color-green-outline) 32%, transparent);
|
|
67
|
+
--_rp-dropzone-bg: color-mix(
|
|
68
|
+
in srgb,
|
|
69
|
+
var(--rp-color-green-outline) 8%,
|
|
70
|
+
var(--rp-color-control-bg)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
.rp-dropzone--reject[data-v-0f0e7a3d], .rp-dropzone--invalid[data-v-0f0e7a3d] {
|
|
74
|
+
--_rp-dropzone-border: var(--rp-color-red-outline);
|
|
75
|
+
--_rp-dropzone-ring: color-mix(in srgb, var(--rp-color-red-outline) 32%, transparent);
|
|
76
|
+
}
|
|
77
|
+
.rp-dropzone--reject[data-v-0f0e7a3d] {
|
|
78
|
+
--_rp-dropzone-bg: color-mix(
|
|
79
|
+
in srgb,
|
|
80
|
+
var(--rp-color-red-outline) 8%,
|
|
81
|
+
var(--rp-color-control-bg)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
.rp-dropzone--valid[data-v-0f0e7a3d] {
|
|
85
|
+
--_rp-dropzone-border: var(--rp-color-green-outline);
|
|
86
|
+
--_rp-dropzone-ring: color-mix(in srgb, var(--rp-color-green-outline) 32%, transparent);
|
|
87
|
+
}
|
|
88
|
+
.rp-dropzone--disabled[data-v-0f0e7a3d] {
|
|
89
|
+
--_rp-dropzone-border: var(--rp-color-disabled-border);
|
|
90
|
+
cursor: not-allowed;
|
|
91
|
+
}
|
|
92
|
+
.rp-dropzone--click-disabled[data-v-0f0e7a3d]:not(.rp-dropzone--disabled) {
|
|
93
|
+
cursor: default;
|
|
94
|
+
}
|
|
95
|
+
.rp-dropzone--click-disabled .rp-dropzone__input[data-v-0f0e7a3d] {
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
}
|
|
98
|
+
.rp-dropzone__input[data-v-0f0e7a3d] {
|
|
99
|
+
position: absolute;
|
|
100
|
+
inset: 0;
|
|
101
|
+
z-index: 1;
|
|
102
|
+
width: 100%;
|
|
103
|
+
height: 100%;
|
|
104
|
+
opacity: 0;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
}
|
|
107
|
+
.rp-dropzone__input[data-v-0f0e7a3d]:disabled {
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
}
|
|
110
|
+
.rp-dropzone__content[data-v-0f0e7a3d] {
|
|
111
|
+
position: relative;
|
|
112
|
+
z-index: 2;
|
|
113
|
+
display: grid;
|
|
114
|
+
gap: var(--rp-spacing-1);
|
|
115
|
+
width: 100%;
|
|
116
|
+
text-align: center;
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
}
|
|
119
|
+
.rp-dropzone__content[data-v-0f0e7a3d] button, .rp-dropzone__content[data-v-0f0e7a3d] a, .rp-dropzone__content[data-v-0f0e7a3d] input, .rp-dropzone__content[data-v-0f0e7a3d] select, .rp-dropzone__content[data-v-0f0e7a3d] textarea, .rp-dropzone__content[data-v-0f0e7a3d] [tabindex] {
|
|
120
|
+
pointer-events: auto;
|
|
121
|
+
}
|
|
122
|
+
.rp-dropzone__label[data-v-0f0e7a3d], .rp-dropzone__description[data-v-0f0e7a3d] {
|
|
123
|
+
margin: 0;
|
|
124
|
+
}
|
|
125
|
+
.rp-dropzone__label[data-v-0f0e7a3d] {
|
|
126
|
+
color: inherit;
|
|
127
|
+
font-weight: var(--rp-font-weight-semibold);
|
|
128
|
+
line-height: var(--rp-line-height-sm);
|
|
129
|
+
}
|
|
130
|
+
.rp-dropzone__description[data-v-0f0e7a3d] {
|
|
131
|
+
color: var(--rp-color-dimmed);
|
|
132
|
+
font-size: var(--rp-font-size-sm);
|
|
133
|
+
line-height: var(--rp-line-height-md);
|
|
134
|
+
}
|
|
135
|
+
}
|
package/dist/dropzone.js
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import './dropzone.css';
|
|
2
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
3
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
4
|
+
import { t as bem } from "./bem.js";
|
|
5
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
6
|
+
import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
|
|
7
|
+
import { n as mergeAriaIdRefs } from "./aria.js";
|
|
8
|
+
import { t as useControlState } from "./useControlState.js";
|
|
9
|
+
import { t as useNativeFileSelection } from "./useNativeFileSelection.js";
|
|
10
|
+
import { child, computed, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, next, ref, renderEffect, setDynamicProps, setInsertionState, setText, template, toDisplayString, txt, unref, useId, useSlots } from "vue";
|
|
11
|
+
//#region src/components/dropzone/dropzoneModel.ts
|
|
12
|
+
function normalizeAcceptTokens(accept) {
|
|
13
|
+
return accept?.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean) ?? [];
|
|
14
|
+
}
|
|
15
|
+
function matchesMimeToken(type, token) {
|
|
16
|
+
const fileType = type.toLowerCase();
|
|
17
|
+
if (token.endsWith("/*")) return fileType.startsWith(token.slice(0, -1));
|
|
18
|
+
return Boolean(fileType) && fileType === token;
|
|
19
|
+
}
|
|
20
|
+
function matchesAcceptToken(file, token) {
|
|
21
|
+
if (token.startsWith(".")) return file.name.toLowerCase().endsWith(token);
|
|
22
|
+
return matchesMimeToken(file.type, token);
|
|
23
|
+
}
|
|
24
|
+
function isFileAccepted(file, accept) {
|
|
25
|
+
const tokens = normalizeAcceptTokens(accept);
|
|
26
|
+
return tokens.length === 0 || tokens.some((token) => matchesAcceptToken(file, token));
|
|
27
|
+
}
|
|
28
|
+
function getFileErrors(file, options) {
|
|
29
|
+
const errors = [];
|
|
30
|
+
if (!isFileAccepted(file, options.accept)) errors.push({
|
|
31
|
+
code: "file-invalid-type",
|
|
32
|
+
message: `File type must match ${options.accept}.`
|
|
33
|
+
});
|
|
34
|
+
if (options.maxSize != null && options.maxSize >= 0 && file.size > options.maxSize) errors.push({
|
|
35
|
+
code: "file-too-large",
|
|
36
|
+
message: `File must not be larger than ${options.maxSize} bytes.`
|
|
37
|
+
});
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
function getFileLimit(options) {
|
|
41
|
+
if (!options.multiple) return 1;
|
|
42
|
+
if (options.maxFiles == null) return Number.POSITIVE_INFINITY;
|
|
43
|
+
return Math.max(0, Math.floor(options.maxFiles));
|
|
44
|
+
}
|
|
45
|
+
function getDragStatus(items, options) {
|
|
46
|
+
const fileItems = Array.from(items).filter((item) => item.kind === "file");
|
|
47
|
+
if (fileItems.length > getFileLimit(options)) return "reject";
|
|
48
|
+
const tokens = normalizeAcceptTokens(options.accept);
|
|
49
|
+
if (tokens.length === 0) return "accept";
|
|
50
|
+
const hasExtensionToken = tokens.some((token) => token.startsWith("."));
|
|
51
|
+
const mimeTokens = tokens.filter((token) => !token.startsWith("."));
|
|
52
|
+
return fileItems.some((item) => {
|
|
53
|
+
const itemType = item.type.toLowerCase();
|
|
54
|
+
if (!itemType || itemType === "application/octet-stream" || hasExtensionToken) return false;
|
|
55
|
+
return !mimeTokens.some((token) => matchesMimeToken(itemType, token));
|
|
56
|
+
}) ? "reject" : "accept";
|
|
57
|
+
}
|
|
58
|
+
function rejectTooMany(file, limit) {
|
|
59
|
+
return {
|
|
60
|
+
file,
|
|
61
|
+
errors: [{
|
|
62
|
+
code: "too-many-files",
|
|
63
|
+
message: `At most ${limit} files can be selected.`
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function processFiles(files, options) {
|
|
68
|
+
const acceptedFiles = [];
|
|
69
|
+
const rejections = [];
|
|
70
|
+
const limit = getFileLimit(options);
|
|
71
|
+
for (const file of files) {
|
|
72
|
+
const errors = getFileErrors(file, options);
|
|
73
|
+
if (errors.length > 0) {
|
|
74
|
+
rejections.push({
|
|
75
|
+
file,
|
|
76
|
+
errors
|
|
77
|
+
});
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (acceptedFiles.length >= limit) {
|
|
81
|
+
rejections.push(rejectTooMany(file, limit));
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
acceptedFiles.push(file);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
acceptedFiles,
|
|
88
|
+
rejections
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function createDropzonePolicy(options) {
|
|
92
|
+
return {
|
|
93
|
+
preview(items) {
|
|
94
|
+
return getDragStatus(items, options);
|
|
95
|
+
},
|
|
96
|
+
commit(files) {
|
|
97
|
+
return processFiles(files, options);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/components/dropzone/useDropzone.ts
|
|
103
|
+
function hasFileTransfer(transfer) {
|
|
104
|
+
return Boolean(transfer && (Array.from(transfer.types).includes("Files") || transfer.files.length > 0 || Array.from(transfer.items).some((item) => item.kind === "file")));
|
|
105
|
+
}
|
|
106
|
+
function readTransferFiles(transfer) {
|
|
107
|
+
if (!transfer) return [];
|
|
108
|
+
const files = Array.from(transfer.files);
|
|
109
|
+
if (files.length > 0) return files;
|
|
110
|
+
return Array.from(transfer.items).filter((item) => item.kind === "file").map((item) => item.getAsFile()).filter((file) => Boolean(file));
|
|
111
|
+
}
|
|
112
|
+
function readTransferItems(transfer) {
|
|
113
|
+
if (!transfer) return [];
|
|
114
|
+
return Array.from(transfer.items, ({ kind, type }) => ({
|
|
115
|
+
kind,
|
|
116
|
+
type
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
function useDropzone(props, callbacks) {
|
|
120
|
+
const rootRef = ref(null);
|
|
121
|
+
const control = useControlState(props);
|
|
122
|
+
const { inputRef, files, settleSelection, clear: clearNativeFiles, focus, open } = useNativeFileSelection({
|
|
123
|
+
modelValue: () => props.modelValue,
|
|
124
|
+
multiple: () => props.multiple !== false,
|
|
125
|
+
disabled: () => control.disabled,
|
|
126
|
+
validationMessage: () => props.validationMessage,
|
|
127
|
+
onChange: callbacks.onUpdate
|
|
128
|
+
});
|
|
129
|
+
const dragDepth = ref(0);
|
|
130
|
+
const dragFiles = ref([]);
|
|
131
|
+
const dragItems = ref([]);
|
|
132
|
+
const lastRejections = ref([]);
|
|
133
|
+
const policy = computed(() => createDropzonePolicy({
|
|
134
|
+
accept: props.accept,
|
|
135
|
+
multiple: props.multiple ?? true,
|
|
136
|
+
maxFiles: props.maxFiles,
|
|
137
|
+
maxSize: props.maxSize
|
|
138
|
+
}));
|
|
139
|
+
const dragSelection = computed(() => policy.value.commit(dragFiles.value));
|
|
140
|
+
const status = computed(() => {
|
|
141
|
+
if (dragDepth.value === 0) return "idle";
|
|
142
|
+
if (dragSelection.value.rejections.length > 0) return "reject";
|
|
143
|
+
return policy.value.preview(dragItems.value);
|
|
144
|
+
});
|
|
145
|
+
const rejections = computed(() => status.value === "idle" ? lastRejections.value : dragSelection.value.rejections);
|
|
146
|
+
const rootClass = computed(() => bem("rp-dropzone", {
|
|
147
|
+
[`size-${props.size}`]: Boolean(props.size),
|
|
148
|
+
[`radius-${props.radius}`]: Boolean(props.radius),
|
|
149
|
+
disabled: control.disabled,
|
|
150
|
+
invalid: control.invalid,
|
|
151
|
+
valid: control.valid && !control.invalid,
|
|
152
|
+
filled: files.value.length > 0,
|
|
153
|
+
dragging: status.value !== "idle",
|
|
154
|
+
accept: status.value === "accept",
|
|
155
|
+
reject: status.value === "reject",
|
|
156
|
+
"click-disabled": !props.activateOnClick
|
|
157
|
+
}));
|
|
158
|
+
function submitFiles(nextFiles) {
|
|
159
|
+
const selection = policy.value.commit(nextFiles);
|
|
160
|
+
lastRejections.value = selection.rejections;
|
|
161
|
+
settleSelection(selection.acceptedFiles.length > 0 || selection.rejections.length === 0 ? {
|
|
162
|
+
status: "accepted",
|
|
163
|
+
files: selection.acceptedFiles
|
|
164
|
+
} : { status: "rejected" });
|
|
165
|
+
callbacks.onDrop(selection);
|
|
166
|
+
if (selection.rejections.length > 0) callbacks.onReject(selection.rejections);
|
|
167
|
+
}
|
|
168
|
+
function resetDrag() {
|
|
169
|
+
dragDepth.value = 0;
|
|
170
|
+
dragFiles.value = [];
|
|
171
|
+
dragItems.value = [];
|
|
172
|
+
}
|
|
173
|
+
function onDragenter(event) {
|
|
174
|
+
if (!hasFileTransfer(event.dataTransfer)) return;
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
if (control.disabled) return;
|
|
177
|
+
dragDepth.value += 1;
|
|
178
|
+
dragFiles.value = readTransferFiles(event.dataTransfer);
|
|
179
|
+
dragItems.value = readTransferItems(event.dataTransfer);
|
|
180
|
+
}
|
|
181
|
+
function onDragover(event) {
|
|
182
|
+
if (!hasFileTransfer(event.dataTransfer)) return;
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
if (control.disabled) return;
|
|
185
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
|
|
186
|
+
const nextFiles = readTransferFiles(event.dataTransfer);
|
|
187
|
+
const nextItems = readTransferItems(event.dataTransfer);
|
|
188
|
+
if (nextFiles.length > 0) dragFiles.value = nextFiles;
|
|
189
|
+
if (nextItems.length > 0) dragItems.value = nextItems;
|
|
190
|
+
}
|
|
191
|
+
function onDragleave() {
|
|
192
|
+
if (control.disabled || dragDepth.value === 0) return;
|
|
193
|
+
dragDepth.value = Math.max(0, dragDepth.value - 1);
|
|
194
|
+
if (dragDepth.value === 0) {
|
|
195
|
+
dragFiles.value = [];
|
|
196
|
+
dragItems.value = [];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function onDrop(event) {
|
|
200
|
+
if (!hasFileTransfer(event.dataTransfer)) return;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
const nextFiles = readTransferFiles(event.dataTransfer);
|
|
203
|
+
resetDrag();
|
|
204
|
+
if (!control.disabled) submitFiles(nextFiles);
|
|
205
|
+
}
|
|
206
|
+
function clear() {
|
|
207
|
+
lastRejections.value = [];
|
|
208
|
+
clearNativeFiles();
|
|
209
|
+
}
|
|
210
|
+
function onChange(event) {
|
|
211
|
+
submitFiles(Array.from(event.target.files ?? []));
|
|
212
|
+
}
|
|
213
|
+
function onKeydown(event) {
|
|
214
|
+
if (props.activateOnKeyboard === false && (event.key === "Enter" || event.key === " ")) event.preventDefault();
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
rootRef,
|
|
218
|
+
inputRef,
|
|
219
|
+
control,
|
|
220
|
+
files,
|
|
221
|
+
rejections,
|
|
222
|
+
status,
|
|
223
|
+
rootClass,
|
|
224
|
+
onDragenter,
|
|
225
|
+
onDragover,
|
|
226
|
+
onDragleave,
|
|
227
|
+
onDrop,
|
|
228
|
+
onChange,
|
|
229
|
+
onKeydown,
|
|
230
|
+
open,
|
|
231
|
+
clear,
|
|
232
|
+
focus
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/components/dropzone/dropzone.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
237
|
+
var t0 = template("<p data-v-0f0e7a3d> </p>");
|
|
238
|
+
var t1 = template("<p data-v-0f0e7a3d> ");
|
|
239
|
+
var t2 = template("<div data-v-0f0e7a3d><input data-v-0f0e7a3d><div data-v-0f0e7a3d>", 1);
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/components/dropzone/dropzone.vue
|
|
242
|
+
var dropzone_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
243
|
+
name: "RpDropzone",
|
|
244
|
+
inheritAttrs: false,
|
|
245
|
+
__name: "dropzone",
|
|
246
|
+
props: {
|
|
247
|
+
id: {},
|
|
248
|
+
name: {},
|
|
249
|
+
form: {},
|
|
250
|
+
modelValue: { default: void 0 },
|
|
251
|
+
accept: { default: void 0 },
|
|
252
|
+
capture: {
|
|
253
|
+
type: [Boolean, String],
|
|
254
|
+
default: void 0
|
|
255
|
+
},
|
|
256
|
+
multiple: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: true
|
|
259
|
+
},
|
|
260
|
+
maxFiles: { default: void 0 },
|
|
261
|
+
maxSize: { default: void 0 },
|
|
262
|
+
size: { default: void 0 },
|
|
263
|
+
radius: { default: void 0 },
|
|
264
|
+
label: { default: void 0 },
|
|
265
|
+
description: { default: void 0 },
|
|
266
|
+
activateOnClick: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: true
|
|
269
|
+
},
|
|
270
|
+
activateOnKeyboard: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: true
|
|
273
|
+
},
|
|
274
|
+
disabled: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: void 0
|
|
277
|
+
},
|
|
278
|
+
required: {
|
|
279
|
+
type: Boolean,
|
|
280
|
+
default: void 0
|
|
281
|
+
},
|
|
282
|
+
invalid: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
default: void 0
|
|
285
|
+
},
|
|
286
|
+
valid: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
default: void 0
|
|
289
|
+
},
|
|
290
|
+
ariaLabel: {},
|
|
291
|
+
describedby: {},
|
|
292
|
+
labelledby: {},
|
|
293
|
+
inputAttrs: {},
|
|
294
|
+
validationMessage: {},
|
|
295
|
+
classNames: {},
|
|
296
|
+
styles: {}
|
|
297
|
+
},
|
|
298
|
+
emits: [
|
|
299
|
+
"update:modelValue",
|
|
300
|
+
"drop",
|
|
301
|
+
"reject"
|
|
302
|
+
],
|
|
303
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
304
|
+
const props = __props;
|
|
305
|
+
const emit = __emit;
|
|
306
|
+
const slots = useSlots();
|
|
307
|
+
const descriptionId = `${useId()}-description`;
|
|
308
|
+
const { rootRef, inputRef, control, files, rejections, status, rootClass, onDragenter, onDragover, onDragleave, onDrop, onChange, onKeydown, open, clear, focus } = useDropzone(props, {
|
|
309
|
+
onUpdate: (nextFiles) => emit("update:modelValue", nextFiles),
|
|
310
|
+
onDrop: (selection) => emit("drop", selection),
|
|
311
|
+
onReject: (nextRejections) => emit("reject", nextRejections)
|
|
312
|
+
});
|
|
313
|
+
const displayLabel = computed(() => {
|
|
314
|
+
if (props.label) return props.label;
|
|
315
|
+
if (status.value === "accept") return "Drop files here";
|
|
316
|
+
if (status.value === "reject") return "Some files are not accepted";
|
|
317
|
+
return props.multiple ? "Drag files here or click to browse" : "Drag a file here or click to browse";
|
|
318
|
+
});
|
|
319
|
+
const ariaDescribedby = computed(() => mergeAriaIdRefs(control.ariaDescribedby, !slots.default && props.description ? descriptionId : void 0));
|
|
320
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
321
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
322
|
+
class: rootClass.value,
|
|
323
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
324
|
+
"data-invalid": toPresenceAttribute(control.invalid),
|
|
325
|
+
"data-filled": toPresenceAttribute(files.value.length > 0),
|
|
326
|
+
"data-dragging": toPresenceAttribute(status.value !== "idle"),
|
|
327
|
+
"data-state": status.value,
|
|
328
|
+
onDragenter,
|
|
329
|
+
onDragover,
|
|
330
|
+
onDragleave,
|
|
331
|
+
onDrop
|
|
332
|
+
}));
|
|
333
|
+
const nativeInputAttrs = computed(() => {
|
|
334
|
+
const attrs = props.inputAttrs ?? {};
|
|
335
|
+
const { compatibilityClass, compatibilityStyle, forwardedAttributes } = splitCompatibilityAttributes(attrs);
|
|
336
|
+
return {
|
|
337
|
+
...forwardedAttributes,
|
|
338
|
+
...getPartAttrs("input", {
|
|
339
|
+
class: "rp-dropzone__input",
|
|
340
|
+
compatibilityClass,
|
|
341
|
+
compatibilityStyle
|
|
342
|
+
}),
|
|
343
|
+
id: control.id,
|
|
344
|
+
name: props.name,
|
|
345
|
+
form: control.form ?? forwardedAttributes.form,
|
|
346
|
+
type: "file",
|
|
347
|
+
value: void 0,
|
|
348
|
+
accept: props.accept,
|
|
349
|
+
capture: props.capture,
|
|
350
|
+
multiple: props.multiple || void 0,
|
|
351
|
+
disabled: control.disabled || void 0,
|
|
352
|
+
required: control.required || void 0,
|
|
353
|
+
tabindex: props.activateOnKeyboard ? void 0 : -1,
|
|
354
|
+
"aria-label": control.ariaLabelledby ? void 0 : props.ariaLabel || displayLabel.value,
|
|
355
|
+
"aria-labelledby": control.ariaLabelledby,
|
|
356
|
+
"aria-describedby": ariaDescribedby.value,
|
|
357
|
+
"aria-invalid": control.invalid || void 0,
|
|
358
|
+
"aria-required": control.required || void 0,
|
|
359
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
360
|
+
"data-invalid": toPresenceAttribute(control.invalid),
|
|
361
|
+
onChange: composeEventHandlers(onChange, attrs.onChange),
|
|
362
|
+
onKeydown: composeEventHandlers(onKeydown, attrs.onKeydown)
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
__expose({
|
|
366
|
+
nativeElement: inputRef,
|
|
367
|
+
rootElement: rootRef,
|
|
368
|
+
open,
|
|
369
|
+
clear,
|
|
370
|
+
focus
|
|
371
|
+
});
|
|
372
|
+
const _setTemplateRef = createTemplateRefSetter();
|
|
373
|
+
const n8 = t2();
|
|
374
|
+
const n0 = child(n8);
|
|
375
|
+
const n7 = next(n0, 1);
|
|
376
|
+
_setTemplateRef(n0, inputRef, null, "inputRef");
|
|
377
|
+
renderEffect(() => {
|
|
378
|
+
setDynamicProps(n8, [rootAttrs.value]);
|
|
379
|
+
setDynamicProps(n0, [nativeInputAttrs.value]);
|
|
380
|
+
setDynamicProps(n7, [unref(getPartAttrs)("content", { class: "rp-dropzone__content" })]);
|
|
381
|
+
});
|
|
382
|
+
setInsertionState(n7, null, 0);
|
|
383
|
+
createSlot("default", {
|
|
384
|
+
files: () => unref(files),
|
|
385
|
+
rejections: () => unref(rejections),
|
|
386
|
+
status: () => unref(status),
|
|
387
|
+
dragging: () => unref(status) !== "idle",
|
|
388
|
+
open: () => unref(open),
|
|
389
|
+
clear: () => unref(clear)
|
|
390
|
+
}, () => {
|
|
391
|
+
const n3 = t0();
|
|
392
|
+
const x3 = txt(n3);
|
|
393
|
+
renderEffect(() => {
|
|
394
|
+
setDynamicProps(n3, [unref(getPartAttrs)("label", { class: "rp-dropzone__label" })]);
|
|
395
|
+
setText(x3, toDisplayString(displayLabel.value));
|
|
396
|
+
});
|
|
397
|
+
return [n3, createIf(() => __props.description, () => {
|
|
398
|
+
const n6 = t1();
|
|
399
|
+
const x6 = txt(n6);
|
|
400
|
+
renderEffect(() => {
|
|
401
|
+
setDynamicProps(n6, [unref(getPartAttrs)("description", { class: "rp-dropzone__description" }), { id: descriptionId }]);
|
|
402
|
+
setText(x6, toDisplayString(__props.description));
|
|
403
|
+
});
|
|
404
|
+
return n6;
|
|
405
|
+
})];
|
|
406
|
+
}, 1);
|
|
407
|
+
_setTemplateRef(n8, rootRef, null, "rootRef");
|
|
408
|
+
return n8;
|
|
409
|
+
}
|
|
410
|
+
}), [["__scopeId", "data-v-0f0e7a3d"]]);
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/components/dropzone/types.ts
|
|
413
|
+
var dropzoneParts = [
|
|
414
|
+
"root",
|
|
415
|
+
"input",
|
|
416
|
+
"content",
|
|
417
|
+
"label",
|
|
418
|
+
"description"
|
|
419
|
+
];
|
|
420
|
+
var dropzoneStatuses = [
|
|
421
|
+
"idle",
|
|
422
|
+
"accept",
|
|
423
|
+
"reject"
|
|
424
|
+
];
|
|
425
|
+
var dropzoneErrorCodes = [
|
|
426
|
+
"file-invalid-type",
|
|
427
|
+
"file-too-large",
|
|
428
|
+
"too-many-files"
|
|
429
|
+
];
|
|
430
|
+
//#endregion
|
|
431
|
+
export { dropzone_default as i, dropzoneParts as n, dropzoneStatuses as r, dropzoneErrorCodes as t };
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as matchesSelectorSafe, r as querySelectorAllSafe, t as isElement } from "./query.js";
|
|
2
|
+
//#region src/utils/dom/events.ts
|
|
3
|
+
function isNodeLike(value) {
|
|
4
|
+
return value != null && typeof value === "object" && "nodeType" in value && typeof value.nodeType === "number";
|
|
5
|
+
}
|
|
6
|
+
function isNodeWithinElement(value, element) {
|
|
7
|
+
if (!isElement(element) || !isNodeLike(value)) return false;
|
|
8
|
+
try {
|
|
9
|
+
return element.contains(value);
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function isEventWithinElement(event, element) {
|
|
15
|
+
const path = event.composedPath();
|
|
16
|
+
if (path.length > 0) return path.some((entry) => entry === element || isNodeWithinElement(entry, element));
|
|
17
|
+
return isNodeWithinElement(event.target, element);
|
|
18
|
+
}
|
|
19
|
+
function getEventDocument(event) {
|
|
20
|
+
const target = event.target;
|
|
21
|
+
if (target != null && typeof target === "object") {
|
|
22
|
+
if ("nodeType" in target && target.nodeType === 9) return target;
|
|
23
|
+
if ("ownerDocument" in target) return target.ownerDocument ?? null;
|
|
24
|
+
if ("document" in target) return target.document ?? null;
|
|
25
|
+
}
|
|
26
|
+
return typeof document !== "undefined" ? document : null;
|
|
27
|
+
}
|
|
28
|
+
function isEventWithinSelector(event, selector) {
|
|
29
|
+
const path = event.composedPath();
|
|
30
|
+
if (path.length > 0) return path.some((entry) => isElement(entry) && matchesSelectorSafe(entry, selector));
|
|
31
|
+
return querySelectorAllSafe(selector, getEventDocument(event)).some((element) => isEventWithinElement(event, element));
|
|
32
|
+
}
|
|
33
|
+
function isEventWithinTargets(event, targets) {
|
|
34
|
+
for (const target of targets) {
|
|
35
|
+
if (!target) continue;
|
|
36
|
+
if (typeof target === "string") {
|
|
37
|
+
if (isEventWithinSelector(event, target)) return true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (isEventWithinElement(event, target)) return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function getEventView(event) {
|
|
45
|
+
const target = event.target;
|
|
46
|
+
if (target == null || typeof target !== "object") return null;
|
|
47
|
+
if ("ownerDocument" in target) return target.ownerDocument?.defaultView ?? null;
|
|
48
|
+
if ("defaultView" in target) return target.defaultView ?? null;
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function createCancelableCustomEvent(type, detail, originalEvent) {
|
|
52
|
+
return new ((getEventView(originalEvent)?.CustomEvent) ?? CustomEvent)(type, {
|
|
53
|
+
bubbles: false,
|
|
54
|
+
cancelable: true,
|
|
55
|
+
detail
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { isNodeWithinElement as i, isEventWithinElement as n, isEventWithinTargets as r, createCancelableCustomEvent as t };
|
package/dist/field.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@layer ropav.components {
|
|
2
|
-
.rp-field[data-v-
|
|
2
|
+
.rp-field[data-v-babf7642] {
|
|
3
3
|
--_rp-field-danger: var(--rp-color-red-filled);
|
|
4
4
|
display: grid;
|
|
5
5
|
gap: var(--rp-spacing-1);
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
font-family: var(--rp-font-family);
|
|
8
8
|
color: var(--rp-color-text);
|
|
9
9
|
}
|
|
10
|
-
html.dark .rp-field[data-v-
|
|
10
|
+
html.dark .rp-field[data-v-babf7642], [data-rp-color-scheme=dark] .rp-field[data-v-babf7642] {
|
|
11
11
|
--_rp-field-danger: var(--rp-color-red-light-color);
|
|
12
12
|
}
|
|
13
|
-
.rp-field__label[data-v-
|
|
13
|
+
.rp-field__label[data-v-babf7642] {
|
|
14
14
|
display: inline-flex;
|
|
15
15
|
width: fit-content;
|
|
16
16
|
align-items: center;
|
|
@@ -20,23 +20,23 @@ html.dark .rp-field[data-v-cbd66c2e], [data-rp-color-scheme=dark] .rp-field[data
|
|
|
20
20
|
font-weight: var(--rp-font-weight-medium);
|
|
21
21
|
line-height: var(--rp-line-height-md);
|
|
22
22
|
}
|
|
23
|
-
.rp-field__required[data-v-
|
|
23
|
+
.rp-field__required[data-v-babf7642] {
|
|
24
24
|
color: var(--_rp-field-danger);
|
|
25
25
|
line-height: 1;
|
|
26
26
|
}
|
|
27
|
-
.rp-field__label + .rp-field__control[data-v-
|
|
27
|
+
.rp-field__label + .rp-field__control[data-v-babf7642] {
|
|
28
28
|
margin-block-start: var(--rp-spacing-1);
|
|
29
29
|
}
|
|
30
|
-
.rp-field__control[data-v-
|
|
30
|
+
.rp-field__control[data-v-babf7642] {
|
|
31
31
|
min-width: 0;
|
|
32
32
|
}
|
|
33
|
-
.rp-field__description[data-v-
|
|
33
|
+
.rp-field__description[data-v-babf7642] {
|
|
34
34
|
margin: 0;
|
|
35
35
|
color: var(--rp-color-dimmed);
|
|
36
36
|
font-size: var(--rp-font-size-sm);
|
|
37
37
|
line-height: var(--rp-line-height-md);
|
|
38
38
|
}
|
|
39
|
-
.rp-field--disabled .rp-field__label[data-v-
|
|
39
|
+
.rp-field--disabled .rp-field__label[data-v-babf7642], .rp-field--disabled .rp-field__description[data-v-babf7642] {
|
|
40
40
|
color: var(--rp-color-disabled-color);
|
|
41
41
|
}
|
|
42
42
|
}
|