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,380 @@
|
|
|
1
|
+
import './tags-input.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 { t as x_default } from "./x.js";
|
|
7
|
+
import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
|
|
8
|
+
import { t as useControlState } from "./useControlState.js";
|
|
9
|
+
import { i as isNodeWithinElement } from "./events.js";
|
|
10
|
+
import { t as isInteractiveElement } from "./interactive.js";
|
|
11
|
+
import { i as useHiddenSelectChoiceTransaction, r as createStringListNativeChoiceAdapter } from "./nativeChoice.js";
|
|
12
|
+
import { child, computed, createComponent, createFor, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, next, nextTick, on, ref, renderEffect, setDynamicProps, setInsertionState, setTemplateRefBinding, setText, template, toDisplayString, unref, withModifiers } from "vue";
|
|
13
|
+
//#region src/components/tags-input/tagsInputModel.ts
|
|
14
|
+
function normalizeTagsInputValue(value) {
|
|
15
|
+
return value.trim();
|
|
16
|
+
}
|
|
17
|
+
function addTagsInputValues(values, candidates, options) {
|
|
18
|
+
const nextValues = [...values];
|
|
19
|
+
const maxTags = options.maxTags === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, options.maxTags);
|
|
20
|
+
for (const candidate of candidates) {
|
|
21
|
+
const value = normalizeTagsInputValue(candidate);
|
|
22
|
+
if (value === "" || nextValues.length >= maxTags) continue;
|
|
23
|
+
if (!options.allowDuplicates && nextValues.includes(value)) continue;
|
|
24
|
+
if (options.validate && !options.validate(value)) continue;
|
|
25
|
+
nextValues.push(value);
|
|
26
|
+
}
|
|
27
|
+
return nextValues;
|
|
28
|
+
}
|
|
29
|
+
function splitTagsInputValue(value, splitChars) {
|
|
30
|
+
const delimiters = new Set(splitChars);
|
|
31
|
+
const tags = [];
|
|
32
|
+
let remainder = "";
|
|
33
|
+
let wasSplit = false;
|
|
34
|
+
for (const character of Array.from(value)) {
|
|
35
|
+
if (!delimiters.has(character)) {
|
|
36
|
+
remainder += character;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
tags.push(remainder);
|
|
40
|
+
remainder = "";
|
|
41
|
+
wasSplit = true;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
tags: wasSplit ? tags : [],
|
|
45
|
+
remainder: wasSplit ? remainder : value
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/tags-input/useTagsInput.ts
|
|
50
|
+
function useTagsInputTransaction(props, emitUpdate, inputRef, onFormReset) {
|
|
51
|
+
const transaction = useHiddenSelectChoiceTransaction({
|
|
52
|
+
value: {
|
|
53
|
+
modelValue: () => props.modelValue,
|
|
54
|
+
defaultValue: () => [...props.defaultValue ?? []],
|
|
55
|
+
onChange: emitUpdate
|
|
56
|
+
},
|
|
57
|
+
native: {
|
|
58
|
+
adapter: createStringListNativeChoiceAdapter(),
|
|
59
|
+
className: "rp-tags-input__native",
|
|
60
|
+
focusVisible: () => inputRef.value?.focus(),
|
|
61
|
+
validationMessage: () => props.readonly ? void 0 : props.validationMessage
|
|
62
|
+
},
|
|
63
|
+
onFormReset
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
nativeSelectRef: transaction.nativeSelectRef,
|
|
67
|
+
nativeSelectAttrs: transaction.nativeSelectAttrs,
|
|
68
|
+
requestValueUpdate: transaction.requestValueUpdate,
|
|
69
|
+
values: transaction.value
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function areTagValuesEqual(left, right) {
|
|
73
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
74
|
+
}
|
|
75
|
+
function useTagsInput(props, emitUpdate) {
|
|
76
|
+
const rootRef = ref(null);
|
|
77
|
+
const inputRef = ref(null);
|
|
78
|
+
const searchValue = ref("");
|
|
79
|
+
function updateSearch(value) {
|
|
80
|
+
searchValue.value = value;
|
|
81
|
+
if (inputRef.value && inputRef.value.value !== value) inputRef.value.value = value;
|
|
82
|
+
}
|
|
83
|
+
const transaction = useTagsInputTransaction(props, emitUpdate, inputRef, () => updateSearch(""));
|
|
84
|
+
const values = transaction.values;
|
|
85
|
+
const control = useControlState(props);
|
|
86
|
+
const rootClass = computed(() => bem("rp-tags-input", {
|
|
87
|
+
[`size-${props.size}`]: Boolean(props.size),
|
|
88
|
+
[`radius-${props.radius}`]: Boolean(props.radius),
|
|
89
|
+
disabled: control.disabled,
|
|
90
|
+
readonly: props.readonly,
|
|
91
|
+
invalid: control.invalid
|
|
92
|
+
}));
|
|
93
|
+
const canClear = computed(() => Boolean(props.clearable && values.value.length > 0 && !control.disabled && !props.readonly));
|
|
94
|
+
function addValues(candidates) {
|
|
95
|
+
if (control.disabled || props.readonly) return false;
|
|
96
|
+
const nextValues = addTagsInputValues(values.value, candidates, {
|
|
97
|
+
allowDuplicates: props.allowDuplicates ?? false,
|
|
98
|
+
maxTags: props.maxTags,
|
|
99
|
+
validate: props.validate
|
|
100
|
+
});
|
|
101
|
+
if (areTagValuesEqual(nextValues, values.value)) return false;
|
|
102
|
+
transaction.requestValueUpdate(nextValues);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
function commitSearch() {
|
|
106
|
+
if (searchValue.value.trim() === "") return false;
|
|
107
|
+
const wasAdded = addValues([searchValue.value]);
|
|
108
|
+
if (wasAdded) updateSearch("");
|
|
109
|
+
return wasAdded;
|
|
110
|
+
}
|
|
111
|
+
function removeTag(index) {
|
|
112
|
+
if (control.disabled || props.readonly || index < 0 || index >= values.value.length) return;
|
|
113
|
+
transaction.requestValueUpdate(values.value.filter((_, valueIndex) => valueIndex !== index));
|
|
114
|
+
nextTick(() => inputRef.value?.focus());
|
|
115
|
+
}
|
|
116
|
+
function clear() {
|
|
117
|
+
if (!canClear.value) return;
|
|
118
|
+
transaction.requestValueUpdate([]);
|
|
119
|
+
updateSearch("");
|
|
120
|
+
nextTick(() => inputRef.value?.focus());
|
|
121
|
+
}
|
|
122
|
+
function focusInput(event) {
|
|
123
|
+
if (control.disabled) return;
|
|
124
|
+
if (event && isInteractiveElement(event.target, ".rp-tags-input__input")) return;
|
|
125
|
+
inputRef.value?.focus();
|
|
126
|
+
}
|
|
127
|
+
function onInput(event) {
|
|
128
|
+
if (control.disabled || props.readonly || event.isComposing) return;
|
|
129
|
+
const inputValue = event.currentTarget.value;
|
|
130
|
+
const { tags, remainder } = splitTagsInputValue(inputValue, props.splitChars ?? [","]);
|
|
131
|
+
if (tags.length > 0) addValues(tags);
|
|
132
|
+
updateSearch(remainder);
|
|
133
|
+
}
|
|
134
|
+
function onInputBlur(event) {
|
|
135
|
+
if (isNodeWithinElement(event.relatedTarget, rootRef.value)) return;
|
|
136
|
+
if (props.acceptValueOnBlur) commitSearch();
|
|
137
|
+
}
|
|
138
|
+
function onInputKeydown(event) {
|
|
139
|
+
if (control.disabled || props.readonly || event.isComposing) return;
|
|
140
|
+
if (event.key === "Enter" && searchValue.value.trim() !== "") {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
commitSearch();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (event.key === "Backspace" && searchValue.value === "") {
|
|
146
|
+
const lastIndex = values.value.length - 1;
|
|
147
|
+
if (lastIndex >= 0) removeTag(lastIndex);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
templateRefs: {
|
|
152
|
+
root: rootRef,
|
|
153
|
+
input: inputRef,
|
|
154
|
+
native: transaction.nativeSelectRef
|
|
155
|
+
},
|
|
156
|
+
nativeSelectAttrs: transaction.nativeSelectAttrs,
|
|
157
|
+
control,
|
|
158
|
+
rootClass,
|
|
159
|
+
values,
|
|
160
|
+
searchValue,
|
|
161
|
+
canClear,
|
|
162
|
+
removeTag,
|
|
163
|
+
clear,
|
|
164
|
+
focusInput,
|
|
165
|
+
onInput,
|
|
166
|
+
onInputBlur,
|
|
167
|
+
onInputKeydown
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/components/tags-input/tags-input.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
172
|
+
var t0 = template(" ");
|
|
173
|
+
var t1 = template("<button data-v-9fbac28f></button>");
|
|
174
|
+
var t2 = template("<span data-v-9fbac28f><span data-v-9fbac28f></span>");
|
|
175
|
+
var t3 = template("<button data-v-9fbac28f>");
|
|
176
|
+
var t4 = template("<div data-v-9fbac28f><select data-v-9fbac28f></select><div data-v-9fbac28f><input data-v-9fbac28f></div>", 1);
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/components/tags-input/tags-input.vue
|
|
179
|
+
var tags_input_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
180
|
+
name: "RpTagsInput",
|
|
181
|
+
inheritAttrs: false,
|
|
182
|
+
__name: "tags-input",
|
|
183
|
+
props: {
|
|
184
|
+
id: {},
|
|
185
|
+
name: {},
|
|
186
|
+
form: {},
|
|
187
|
+
modelValue: { default: void 0 },
|
|
188
|
+
defaultValue: { default: () => [] },
|
|
189
|
+
maxTags: { default: void 0 },
|
|
190
|
+
allowDuplicates: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: false
|
|
193
|
+
},
|
|
194
|
+
splitChars: { default: () => [","] },
|
|
195
|
+
acceptValueOnBlur: {
|
|
196
|
+
type: Boolean,
|
|
197
|
+
default: false
|
|
198
|
+
},
|
|
199
|
+
validate: {
|
|
200
|
+
type: Function,
|
|
201
|
+
default: void 0
|
|
202
|
+
},
|
|
203
|
+
size: {},
|
|
204
|
+
radius: {},
|
|
205
|
+
placeholder: { default: "Enter tags..." },
|
|
206
|
+
clearable: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: false
|
|
209
|
+
},
|
|
210
|
+
clearLabel: { default: "Clear tags" },
|
|
211
|
+
removeLabel: { default: "Remove" },
|
|
212
|
+
disabled: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default: void 0
|
|
215
|
+
},
|
|
216
|
+
readonly: {
|
|
217
|
+
type: Boolean,
|
|
218
|
+
default: false
|
|
219
|
+
},
|
|
220
|
+
required: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: void 0
|
|
223
|
+
},
|
|
224
|
+
invalid: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: void 0
|
|
227
|
+
},
|
|
228
|
+
ariaLabel: {},
|
|
229
|
+
describedby: {},
|
|
230
|
+
labelledby: {},
|
|
231
|
+
inputAttrs: {},
|
|
232
|
+
validationMessage: {},
|
|
233
|
+
classNames: {},
|
|
234
|
+
styles: {}
|
|
235
|
+
},
|
|
236
|
+
emits: ["update:modelValue"],
|
|
237
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
238
|
+
const props = __props;
|
|
239
|
+
const emit = __emit;
|
|
240
|
+
const { templateRefs, nativeSelectAttrs, control, rootClass, values, searchValue, canClear, removeTag, clear, focusInput, onInput, onInputBlur, onInputKeydown } = useTagsInput(props, (value) => emit("update:modelValue", value));
|
|
241
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
242
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
243
|
+
class: rootClass.value,
|
|
244
|
+
onMousedown: focusInput,
|
|
245
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
246
|
+
"data-readonly": toPresenceAttribute(props.readonly),
|
|
247
|
+
"data-invalid": toPresenceAttribute(control.invalid)
|
|
248
|
+
}));
|
|
249
|
+
const visibleInputAttrs = computed(() => {
|
|
250
|
+
const attrs = props.inputAttrs ?? {};
|
|
251
|
+
const { compatibilityClass, compatibilityStyle, forwardedAttributes } = splitCompatibilityAttributes(attrs);
|
|
252
|
+
return {
|
|
253
|
+
...forwardedAttributes,
|
|
254
|
+
...getPartAttrs("input", {
|
|
255
|
+
class: "rp-tags-input__input",
|
|
256
|
+
compatibilityClass,
|
|
257
|
+
compatibilityStyle
|
|
258
|
+
}),
|
|
259
|
+
id: control.id,
|
|
260
|
+
name: void 0,
|
|
261
|
+
form: "",
|
|
262
|
+
type: "text",
|
|
263
|
+
value: searchValue.value,
|
|
264
|
+
placeholder: values.value.length === 0 ? props.placeholder : void 0,
|
|
265
|
+
disabled: control.disabled || void 0,
|
|
266
|
+
readonly: props.readonly || void 0,
|
|
267
|
+
required: void 0,
|
|
268
|
+
autocomplete: forwardedAttributes.autocomplete ?? "off",
|
|
269
|
+
"aria-disabled": control.disabled || void 0,
|
|
270
|
+
"aria-invalid": control.invalid || void 0,
|
|
271
|
+
"aria-required": control.required || void 0,
|
|
272
|
+
"aria-label": control.ariaLabelledby ? void 0 : props.ariaLabel || void 0,
|
|
273
|
+
"aria-labelledby": control.ariaLabelledby,
|
|
274
|
+
"aria-describedby": control.ariaDescribedby,
|
|
275
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
276
|
+
"data-readonly": toPresenceAttribute(props.readonly),
|
|
277
|
+
"data-invalid": toPresenceAttribute(control.invalid),
|
|
278
|
+
onInput: composeEventHandlers(onInput, attrs.onInput),
|
|
279
|
+
onBlur: composeEventHandlers(onInputBlur, attrs.onBlur),
|
|
280
|
+
onKeydown: composeEventHandlers(onInputKeydown, attrs.onKeydown)
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
__expose({
|
|
284
|
+
nativeElement: templateRefs.native,
|
|
285
|
+
inputElement: templateRefs.input,
|
|
286
|
+
focus: () => templateRefs.input.value?.focus()
|
|
287
|
+
});
|
|
288
|
+
const _setTemplateRef = createTemplateRefSetter();
|
|
289
|
+
const n18 = t4();
|
|
290
|
+
const n0 = child(n18);
|
|
291
|
+
const n13 = next(n0, 1);
|
|
292
|
+
const n12 = child(n13, 1);
|
|
293
|
+
renderEffect(() => {
|
|
294
|
+
const _control = unref(control);
|
|
295
|
+
setDynamicProps(n18, [rootAttrs.value]);
|
|
296
|
+
setDynamicProps(n0, [unref(nativeSelectAttrs), {
|
|
297
|
+
name: __props.name,
|
|
298
|
+
form: _control.form,
|
|
299
|
+
disabled: _control.disabled || void 0,
|
|
300
|
+
required: _control.required && !__props.readonly || void 0,
|
|
301
|
+
multiple: "",
|
|
302
|
+
tabindex: "-1",
|
|
303
|
+
"aria-hidden": "true"
|
|
304
|
+
}]);
|
|
305
|
+
_setTemplateRef(n0, unref(templateRefs).native);
|
|
306
|
+
setDynamicProps(n13, [unref(getPartAttrs)("tags", { class: "rp-tags-input__tags" })]);
|
|
307
|
+
});
|
|
308
|
+
setInsertionState(n13, 0);
|
|
309
|
+
createFor(() => unref(values), (_for_item0, _for_key0) => {
|
|
310
|
+
const n11 = t2();
|
|
311
|
+
const n6 = child(n11);
|
|
312
|
+
renderEffect(() => {
|
|
313
|
+
const _getPartAttrs = unref(getPartAttrs);
|
|
314
|
+
setDynamicProps(n11, [_getPartAttrs("tag", { class: "rp-tags-input__tag" })]);
|
|
315
|
+
setDynamicProps(n6, [_getPartAttrs("tagLabel", { class: "rp-tags-input__tag-label" })]);
|
|
316
|
+
});
|
|
317
|
+
setInsertionState(n6, null, 0);
|
|
318
|
+
createSlot("tag", { value: () => _for_item0.value }, () => {
|
|
319
|
+
const n5 = t0();
|
|
320
|
+
renderEffect(() => setText(n5, toDisplayString(_for_item0.value)));
|
|
321
|
+
return n5;
|
|
322
|
+
}, 1);
|
|
323
|
+
setInsertionState(n11, null, 1);
|
|
324
|
+
createIf(() => !__props.readonly, () => {
|
|
325
|
+
const n10 = t1();
|
|
326
|
+
renderEffect(() => setDynamicProps(n10, [
|
|
327
|
+
{ type: "button" },
|
|
328
|
+
unref(getPartAttrs)("tagRemove", { class: "rp-tags-input__tag-remove" }),
|
|
329
|
+
{
|
|
330
|
+
"aria-label": `${__props.removeLabel} ${_for_item0.value}`,
|
|
331
|
+
disabled: unref(control).disabled || void 0,
|
|
332
|
+
tabindex: "-1"
|
|
333
|
+
}
|
|
334
|
+
]));
|
|
335
|
+
setInsertionState(n10, null, 0);
|
|
336
|
+
createComponent(unref(x_default));
|
|
337
|
+
on(n10, "mousedown", withModifiers(() => {}, ["prevent"]));
|
|
338
|
+
on(n10, "click", withModifiers(() => unref(removeTag)(_for_key0.value), ["stop"]));
|
|
339
|
+
return n10;
|
|
340
|
+
});
|
|
341
|
+
return n11;
|
|
342
|
+
}, (value, index) => `${value}-${index}`, 8);
|
|
343
|
+
renderEffect(() => {
|
|
344
|
+
setDynamicProps(n12, [visibleInputAttrs.value]);
|
|
345
|
+
_setTemplateRef(n12, unref(templateRefs).input);
|
|
346
|
+
});
|
|
347
|
+
setInsertionState(n18, null, 2);
|
|
348
|
+
createIf(() => unref(canClear), () => {
|
|
349
|
+
const n17 = t3();
|
|
350
|
+
renderEffect(() => setDynamicProps(n17, [
|
|
351
|
+
{ type: "button" },
|
|
352
|
+
unref(getPartAttrs)("clear", { class: "rp-tags-input__clear" }),
|
|
353
|
+
{
|
|
354
|
+
"aria-label": __props.clearLabel,
|
|
355
|
+
tabindex: "-1"
|
|
356
|
+
}
|
|
357
|
+
]));
|
|
358
|
+
setInsertionState(n17, null, 0);
|
|
359
|
+
createComponent(unref(x_default));
|
|
360
|
+
on(n17, "mousedown", withModifiers(() => {}, ["prevent"]));
|
|
361
|
+
on(n17, "click", withModifiers((e) => unref(clear)(e), ["stop"]));
|
|
362
|
+
return n17;
|
|
363
|
+
});
|
|
364
|
+
setTemplateRefBinding(n18, () => unref(templateRefs).root);
|
|
365
|
+
return n18;
|
|
366
|
+
}
|
|
367
|
+
}), [["__scopeId", "data-v-9fbac28f"]]);
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/components/tags-input/types.ts
|
|
370
|
+
var tagsInputParts = [
|
|
371
|
+
"root",
|
|
372
|
+
"tags",
|
|
373
|
+
"tag",
|
|
374
|
+
"tagLabel",
|
|
375
|
+
"tagRemove",
|
|
376
|
+
"input",
|
|
377
|
+
"clear"
|
|
378
|
+
];
|
|
379
|
+
//#endregion
|
|
380
|
+
export { tags_input_default as n, tagsInputParts as t };
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/utils/text.ts
|
|
2
|
+
var COMBINING_MARKS = /\p{M}/gu;
|
|
3
|
+
var WHITESPACE = /\s+/g;
|
|
4
|
+
function getNameInitials(name) {
|
|
5
|
+
if (!name) return "";
|
|
6
|
+
const parts = name.trim().split(WHITESPACE).filter(Boolean);
|
|
7
|
+
const firstPart = parts[0];
|
|
8
|
+
if (!firstPart) return "";
|
|
9
|
+
if (parts.length === 1) return Array.from(firstPart).slice(0, 2).join("").toLocaleUpperCase();
|
|
10
|
+
const lastPart = parts.at(-1) ?? firstPart;
|
|
11
|
+
return `${Array.from(firstPart)[0] ?? ""}${Array.from(lastPart)[0] ?? ""}`.toLocaleUpperCase();
|
|
12
|
+
}
|
|
13
|
+
function normalizeTypeaheadText(value, locales) {
|
|
14
|
+
return value.toLocaleLowerCase(locales).normalize("NFKD").replace(COMBINING_MARKS, "").replace(WHITESPACE, " ").trim();
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { normalizeTypeaheadText as n, getNameInitials as t };
|
package/dist/textarea.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@layer ropav.components {
|
|
2
|
-
.rp-textarea[data-v-
|
|
2
|
+
.rp-textarea[data-v-da9cf2c9] {
|
|
3
3
|
--_rp-textarea-padding-y: 7px;
|
|
4
4
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-md) / 3);
|
|
5
5
|
--_rp-textarea-font-size: var(--rp-font-size-md);
|
|
@@ -17,58 +17,58 @@
|
|
|
17
17
|
cursor: text;
|
|
18
18
|
transition: border-color var(--rp-transition-fast), box-shadow var(--rp-transition-fast);
|
|
19
19
|
}
|
|
20
|
-
.rp-textarea[data-v-
|
|
20
|
+
.rp-textarea[data-v-da9cf2c9]:hover:not(.rp-textarea--disabled):not(.rp-textarea--invalid):not(.rp-textarea--valid) {
|
|
21
21
|
border-color: var(--rp-color-control-border-hover);
|
|
22
22
|
}
|
|
23
|
-
.rp-textarea[data-v-
|
|
23
|
+
.rp-textarea[data-v-da9cf2c9]:focus-within:not(.rp-textarea--disabled):not(.rp-textarea--invalid):not(.rp-textarea--valid) {
|
|
24
24
|
border-color: var(--rp-color-control-border-focus);
|
|
25
25
|
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
|
|
26
26
|
}
|
|
27
|
-
.rp-textarea[data-v-
|
|
27
|
+
.rp-textarea[data-v-da9cf2c9] {
|
|
28
28
|
font-size: var(--_rp-textarea-font-size);
|
|
29
29
|
border-radius: var(--_rp-textarea-radius);
|
|
30
30
|
}
|
|
31
|
-
.rp-textarea--size-xs[data-v-
|
|
31
|
+
.rp-textarea--size-xs[data-v-da9cf2c9] {
|
|
32
32
|
--_rp-textarea-padding-y: 4.5px;
|
|
33
33
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-xs) / 3);
|
|
34
34
|
--_rp-textarea-font-size: var(--rp-font-size-xs);
|
|
35
35
|
}
|
|
36
|
-
.rp-textarea--size-sm[data-v-
|
|
36
|
+
.rp-textarea--size-sm[data-v-da9cf2c9] {
|
|
37
37
|
--_rp-textarea-padding-y: 5.5px;
|
|
38
38
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-sm) / 3);
|
|
39
39
|
--_rp-textarea-font-size: var(--rp-font-size-sm);
|
|
40
40
|
}
|
|
41
|
-
.rp-textarea--size-md[data-v-
|
|
41
|
+
.rp-textarea--size-md[data-v-da9cf2c9] {
|
|
42
42
|
--_rp-textarea-padding-y: 7px;
|
|
43
43
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-md) / 3);
|
|
44
44
|
--_rp-textarea-font-size: var(--rp-font-size-md);
|
|
45
45
|
}
|
|
46
|
-
.rp-textarea--size-lg[data-v-
|
|
46
|
+
.rp-textarea--size-lg[data-v-da9cf2c9] {
|
|
47
47
|
--_rp-textarea-padding-y: 9.5px;
|
|
48
48
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-lg) / 3);
|
|
49
49
|
--_rp-textarea-font-size: var(--rp-font-size-lg);
|
|
50
50
|
}
|
|
51
|
-
.rp-textarea--size-xl[data-v-
|
|
51
|
+
.rp-textarea--size-xl[data-v-da9cf2c9] {
|
|
52
52
|
--_rp-textarea-padding-y: 13px;
|
|
53
53
|
--_rp-textarea-padding-x: calc(var(--rp-size-control-xl) / 3);
|
|
54
54
|
--_rp-textarea-font-size: var(--rp-font-size-xl);
|
|
55
55
|
}
|
|
56
|
-
.rp-textarea--radius-xs[data-v-
|
|
56
|
+
.rp-textarea--radius-xs[data-v-da9cf2c9] {
|
|
57
57
|
--_rp-textarea-radius: var(--rp-radius-xs);
|
|
58
58
|
}
|
|
59
|
-
.rp-textarea--radius-sm[data-v-
|
|
59
|
+
.rp-textarea--radius-sm[data-v-da9cf2c9] {
|
|
60
60
|
--_rp-textarea-radius: var(--rp-radius-sm);
|
|
61
61
|
}
|
|
62
|
-
.rp-textarea--radius-md[data-v-
|
|
62
|
+
.rp-textarea--radius-md[data-v-da9cf2c9] {
|
|
63
63
|
--_rp-textarea-radius: var(--rp-radius-md);
|
|
64
64
|
}
|
|
65
|
-
.rp-textarea--radius-lg[data-v-
|
|
65
|
+
.rp-textarea--radius-lg[data-v-da9cf2c9] {
|
|
66
66
|
--_rp-textarea-radius: var(--rp-radius-lg);
|
|
67
67
|
}
|
|
68
|
-
.rp-textarea--radius-xl[data-v-
|
|
68
|
+
.rp-textarea--radius-xl[data-v-da9cf2c9] {
|
|
69
69
|
--_rp-textarea-radius: var(--rp-radius-xl);
|
|
70
70
|
}
|
|
71
|
-
html.dark .rp-textarea[data-v-
|
|
71
|
+
html.dark .rp-textarea[data-v-da9cf2c9], [data-rp-color-scheme=dark] .rp-textarea[data-v-da9cf2c9] {
|
|
72
72
|
--_rp-textarea-valid-border: var(--rp-color-green-light-color);
|
|
73
73
|
--_rp-textarea-valid-ring: color-mix(
|
|
74
74
|
in srgb,
|
|
@@ -82,34 +82,34 @@ html.dark .rp-textarea[data-v-b604b69c], [data-rp-color-scheme=dark] .rp-textare
|
|
|
82
82
|
transparent
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
.rp-textarea--disabled[data-v-
|
|
85
|
+
.rp-textarea--disabled[data-v-da9cf2c9] {
|
|
86
86
|
opacity: var(--rp-opacity-disabled);
|
|
87
87
|
cursor: not-allowed;
|
|
88
88
|
}
|
|
89
|
-
.rp-textarea--valid[data-v-
|
|
89
|
+
.rp-textarea--valid[data-v-da9cf2c9] {
|
|
90
90
|
border-color: var(--_rp-textarea-valid-border);
|
|
91
91
|
}
|
|
92
|
-
.rp-textarea--valid[data-v-
|
|
92
|
+
.rp-textarea--valid[data-v-da9cf2c9]:focus-within:not(.rp-textarea--disabled) {
|
|
93
93
|
border-color: var(--_rp-textarea-valid-border);
|
|
94
94
|
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--_rp-textarea-valid-ring);
|
|
95
95
|
}
|
|
96
|
-
.rp-textarea--invalid[data-v-
|
|
96
|
+
.rp-textarea--invalid[data-v-da9cf2c9] {
|
|
97
97
|
border-color: var(--_rp-textarea-invalid-border);
|
|
98
98
|
}
|
|
99
|
-
.rp-textarea--invalid[data-v-
|
|
99
|
+
.rp-textarea--invalid[data-v-da9cf2c9]:focus-within:not(.rp-textarea--disabled) {
|
|
100
100
|
border-color: var(--_rp-textarea-invalid-border);
|
|
101
101
|
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--_rp-textarea-invalid-ring);
|
|
102
102
|
}
|
|
103
|
-
.rp-textarea--readonly[data-v-
|
|
103
|
+
.rp-textarea--readonly[data-v-da9cf2c9] {
|
|
104
104
|
background-color: var(--rp-color-control-readonly-bg);
|
|
105
105
|
}
|
|
106
|
-
.rp-textarea--resize-vertical .rp-textarea__native[data-v-
|
|
106
|
+
.rp-textarea--resize-vertical .rp-textarea__native[data-v-da9cf2c9] {
|
|
107
107
|
resize: vertical;
|
|
108
108
|
}
|
|
109
|
-
.rp-textarea--resize-both .rp-textarea__native[data-v-
|
|
109
|
+
.rp-textarea--resize-both .rp-textarea__native[data-v-da9cf2c9] {
|
|
110
110
|
resize: both;
|
|
111
111
|
}
|
|
112
|
-
.rp-textarea__native[data-v-
|
|
112
|
+
.rp-textarea__native[data-v-da9cf2c9] {
|
|
113
113
|
box-sizing: border-box;
|
|
114
114
|
flex: 1;
|
|
115
115
|
width: 100%;
|
|
@@ -124,10 +124,10 @@ html.dark .rp-textarea[data-v-b604b69c], [data-rp-color-scheme=dark] .rp-textare
|
|
|
124
124
|
color: var(--rp-color-control-fg);
|
|
125
125
|
line-height: var(--rp-line-height-md);
|
|
126
126
|
}
|
|
127
|
-
.rp-textarea__native[data-v-
|
|
127
|
+
.rp-textarea__native[data-v-da9cf2c9]::placeholder {
|
|
128
128
|
color: var(--rp-color-control-placeholder);
|
|
129
129
|
}
|
|
130
|
-
.rp-textarea__native[data-v-
|
|
130
|
+
.rp-textarea__native[data-v-da9cf2c9]:disabled {
|
|
131
131
|
cursor: not-allowed;
|
|
132
132
|
}
|
|
133
133
|
}
|
package/dist/textarea.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import './textarea.css';
|
|
2
2
|
import { t as useControllableValue } from "./useControllableValue.js";
|
|
3
|
-
import {
|
|
3
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
4
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
4
5
|
import { t as bem } from "./bem.js";
|
|
5
6
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
7
|
+
import { t as clamp } from "./number.js";
|
|
6
8
|
import { a as useTextFormControl } from "./useFormControl.js";
|
|
9
|
+
import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
|
|
7
10
|
import { t as useControlState } from "./useControlState.js";
|
|
11
|
+
import { t as isInteractiveElement } from "./interactive.js";
|
|
8
12
|
import { child, computed, defineVaporComponent, nextTick, onMounted, ref, renderEffect, setDynamicProps, setStaticTemplateRef, template, unref, watch } from "vue";
|
|
9
13
|
//#region src/components/textarea/useTextarea.ts
|
|
10
14
|
var MIN_ROWS = 1;
|
|
11
|
-
var
|
|
12
|
-
"button",
|
|
13
|
-
"a[href]",
|
|
14
|
-
"input",
|
|
15
|
-
"select",
|
|
16
|
-
`textarea:not(.rp-textarea__native)`,
|
|
17
|
-
"[contenteditable=\"true\"]",
|
|
18
|
-
"[tabindex]:not([tabindex=\"-1\"])"
|
|
19
|
-
].join(",");
|
|
20
|
-
function isInteractiveElement(target) {
|
|
21
|
-
return Boolean(target.closest(INTERACTIVE_SELECTOR));
|
|
22
|
-
}
|
|
15
|
+
var NATIVE_TEXTAREA_SELECTOR = ".rp-textarea__native";
|
|
23
16
|
function normalizeRows(value, fallback) {
|
|
24
17
|
if (value === void 0 || !Number.isFinite(value)) return fallback;
|
|
25
18
|
return Math.max(MIN_ROWS, Math.floor(value));
|
|
@@ -98,8 +91,7 @@ function useTextarea(props, emitUpdate, getValue = () => props.modelValue ?? "")
|
|
|
98
91
|
}
|
|
99
92
|
textarea.style.height = "auto";
|
|
100
93
|
const { contentHeight, minHeight, maxHeight } = getAutosizeMeasurement(textarea, autosizeRows.value);
|
|
101
|
-
const
|
|
102
|
-
const nextHeight = Math.min(Math.max(contentHeight, minHeight), heightLimit);
|
|
94
|
+
const nextHeight = clamp(contentHeight, minHeight, maxHeight ?? Number.POSITIVE_INFINITY);
|
|
103
95
|
textarea.style.height = `${nextHeight}px`;
|
|
104
96
|
textarea.style.overflowY = maxHeight !== void 0 && contentHeight > maxHeight ? "auto" : "hidden";
|
|
105
97
|
}
|
|
@@ -117,8 +109,7 @@ function useTextarea(props, emitUpdate, getValue = () => props.modelValue ?? "")
|
|
|
117
109
|
}
|
|
118
110
|
function focusTextarea(e) {
|
|
119
111
|
if (control.disabled) return;
|
|
120
|
-
|
|
121
|
-
if (target instanceof Element && isInteractiveElement(target)) return;
|
|
112
|
+
if (isInteractiveElement(e.target, NATIVE_TEXTAREA_SELECTOR)) return;
|
|
122
113
|
textareaRef.value?.focus();
|
|
123
114
|
}
|
|
124
115
|
function focus(options) {
|
|
@@ -138,7 +129,7 @@ function useTextarea(props, emitUpdate, getValue = () => props.modelValue ?? "")
|
|
|
138
129
|
}
|
|
139
130
|
//#endregion
|
|
140
131
|
//#region src/components/textarea/textarea.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
141
|
-
var t0 = template("<div data-v-
|
|
132
|
+
var t0 = template("<div data-v-da9cf2c9><textarea data-v-da9cf2c9>", 1);
|
|
142
133
|
//#endregion
|
|
143
134
|
//#region src/components/textarea/textarea.vue
|
|
144
135
|
var textarea_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -205,23 +196,21 @@ var textarea_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
205
196
|
const rootAttrs = computed(() => getRootAttrs({
|
|
206
197
|
class: rootClass.value,
|
|
207
198
|
onMousedown: focusTextarea,
|
|
208
|
-
"data-disabled":
|
|
209
|
-
"data-readonly":
|
|
210
|
-
"data-invalid":
|
|
199
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
200
|
+
"data-readonly": toPresenceAttribute(props.readonly),
|
|
201
|
+
"data-invalid": toPresenceAttribute(control.invalid)
|
|
211
202
|
}));
|
|
212
203
|
const nativeInputAttrs = computed(() => {
|
|
213
|
-
const
|
|
204
|
+
const inputAttrs = props.inputAttrs ?? {};
|
|
205
|
+
const { compatibilityClass, compatibilityStyle, forwardedAttributes } = splitCompatibilityAttributes(inputAttrs);
|
|
214
206
|
return {
|
|
215
|
-
...
|
|
207
|
+
...forwardedAttributes,
|
|
216
208
|
...getPartAttrs("input", {
|
|
217
209
|
class: "rp-textarea__native",
|
|
218
210
|
compatibilityClass,
|
|
219
211
|
compatibilityStyle
|
|
220
212
|
}),
|
|
221
|
-
onInput(
|
|
222
|
-
onInput(event);
|
|
223
|
-
compatibilityOnInput?.(event);
|
|
224
|
-
}
|
|
213
|
+
onInput: composeEventHandlers(onInput, inputAttrs.onInput)
|
|
225
214
|
};
|
|
226
215
|
});
|
|
227
216
|
__expose({
|
|
@@ -235,7 +224,7 @@ var textarea_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
235
224
|
const _nativeInputAttrs = nativeInputAttrs.value;
|
|
236
225
|
const _control = unref(control);
|
|
237
226
|
const _readonly = __props.readonly;
|
|
238
|
-
const
|
|
227
|
+
const _toPresenceAttribute = unref(toPresenceAttribute);
|
|
239
228
|
const _control_required = _control.required;
|
|
240
229
|
setDynamicProps(n1, [rootAttrs.value]);
|
|
241
230
|
setDynamicProps(n0, [_nativeInputAttrs, {
|
|
@@ -253,14 +242,14 @@ var textarea_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
253
242
|
"aria-describedby": _control.ariaDescribedby,
|
|
254
243
|
"aria-invalid": _control.invalid || void 0,
|
|
255
244
|
"aria-required": _control_required || void 0,
|
|
256
|
-
"data-disabled":
|
|
257
|
-
"data-readonly":
|
|
258
|
-
"data-invalid":
|
|
245
|
+
"data-disabled": _toPresenceAttribute(_control.disabled),
|
|
246
|
+
"data-readonly": _toPresenceAttribute(_readonly),
|
|
247
|
+
"data-invalid": _toPresenceAttribute(_control.invalid)
|
|
259
248
|
}]);
|
|
260
249
|
});
|
|
261
250
|
return n1;
|
|
262
251
|
}
|
|
263
|
-
}), [["__scopeId", "data-v-
|
|
252
|
+
}), [["__scopeId", "data-v-da9cf2c9"]]);
|
|
264
253
|
//#endregion
|
|
265
254
|
//#region src/components/textarea/types.ts
|
|
266
255
|
var textareaParts = ["root", "input"];
|