ropav 0.1.5 → 0.1.7
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 +10 -0
- package/dist/accordion.css +17 -17
- package/dist/accordion.js +125 -154
- package/dist/alert.css +18 -18
- package/dist/alert.js +20 -20
- 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 +10 -18
- package/dist/badge.css +16 -16
- package/dist/badge.js +6 -6
- package/dist/base.css +18 -13
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +13 -14
- package/dist/button.css +32 -27
- package/dist/button.js +13 -14
- package/dist/{useButtonColor.js → button.scss_vue_type_style_index_0_src_true_lang.js} +3 -2
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +23 -29
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +8 -7
- package/dist/collectionNavigation.js +2 -99
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +15 -14
- package/dist/color-picker.css +40 -40
- package/dist/color-picker.js +222 -202
- package/dist/color-picker2.js +1 -9
- package/dist/color-swatch.css +4 -4
- package/dist/color-swatch.js +7 -9
- package/dist/color.js +5 -10
- package/dist/componentColors.js +165 -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/checkbox/useCheckbox.d.ts +2 -3
- package/dist/components/color-input/color-input.d.ts +2 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/color-picker/index.js +2 -2
- package/dist/components/color-picker/types.d.ts +2 -2
- 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/dialog/{dialog-core.d.ts → dialogContext.d.ts} +2 -6
- 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 +3 -3
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +17 -19
- 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 +85 -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 +34 -0
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +22 -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 +29 -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/floating/hoverDisclosureInteractionModel.d.ts +42 -0
- package/dist/components/floating/index.js +1 -1
- package/dist/components/floating/useFloatingPosition.d.ts +0 -1
- package/dist/components/floating/useHoverDisclosureInteractions.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosureOpenState.d.ts +25 -0
- package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +27 -0
- package/dist/components/input/useInput.d.ts +1 -1
- package/dist/components/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +4 -18
- 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 +16 -0
- package/dist/components/progress/progressModel.d.ts +8 -0
- package/dist/components/progress/useProgress.d.ts +1 -7
- package/dist/components/radio/useRadio.d.ts +3 -4
- 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/types.d.ts +4 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +70 -52
- package/dist/components/scroll-area/{useScrollAreaPresentation.d.ts → useScrollAreaAttributes.d.ts} +37 -14
- 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 +10 -8
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- package/dist/components/select/useSelect.d.ts +2 -1
- package/dist/components/select/useSelectNativeValue.d.ts +1 -7
- package/dist/components/slider/rangeSliderModel.d.ts +41 -0
- package/dist/components/slider/{sliderCore.d.ts → sliderModel.d.ts} +2 -2
- package/dist/components/slider/useRangeSlider.d.ts +9 -17
- package/dist/components/slider/useRangeSliderValueState.d.ts +40 -0
- package/dist/components/slider/useSlider.d.ts +8 -14
- 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/switch/useSwitch.d.ts +1 -1
- package/dist/components/teleport-provider/index.js +1 -1
- package/dist/components/teleport-provider/useTeleportTarget.d.ts +1 -2
- package/dist/components/textarea/useTextarea.d.ts +1 -1
- package/dist/components/toast/useToastLifecycle.d.ts +19 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -2
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useControllableValue.d.ts +14 -0
- package/dist/css.js +12 -0
- package/dist/dialog.js +227 -216
- package/dist/dropdown-menu.js +1493 -1118
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/floating.js +553 -312
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/icon-button.css +12 -173
- package/dist/icon-button.js +8 -7
- package/dist/index.d.ts +5 -4
- package/dist/index.js +13 -11
- package/dist/input.css +24 -24
- package/dist/input.js +20 -32
- package/dist/interactive.js +18 -0
- package/dist/modal.js +11 -7
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +15 -13
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +67 -65
- package/dist/pointer.js +9 -0
- package/dist/popover.css +34 -34
- package/dist/popover.js +93 -91
- package/dist/progress.css +29 -21
- package/dist/progress.js +25 -21
- package/dist/query.js +40 -0
- package/dist/radio.css +18 -18
- package/dist/radio.js +31 -37
- package/dist/rafScheduler.js +34 -0
- package/dist/scroll-area.css +35 -26
- package/dist/scroll-area.js +553 -500
- package/dist/select.css +45 -45
- package/dist/select.js +70 -56
- package/dist/slider.css +191 -191
- package/dist/slider.js +695 -628
- 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 +15 -16
- package/dist/tabs.css +46 -46
- package/dist/tabs.js +51 -68
- package/dist/text.js +17 -0
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +22 -33
- package/dist/toast.css +26 -26
- package/dist/toast.js +157 -129
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +46 -47
- package/dist/useCollapse.js +19 -17
- package/dist/useControlState.js +4 -7
- package/dist/useControllableValue.js +8 -2
- package/dist/useFloatingPosition.js +122 -1128
- package/dist/useFormControl.js +3 -2
- package/dist/useOverlayZIndex.js +2 -6
- package/dist/useRequiredInject.js +1 -1
- 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/dom/ancestry.d.ts +7 -0
- package/dist/utils/dom/attributes.d.ts +16 -0
- package/dist/utils/dom/componentRef.d.ts +4 -0
- package/dist/utils/dom/events.d.ts +5 -0
- package/dist/utils/dom/focusNavigation.d.ts +7 -0
- package/dist/utils/dom/interactive.d.ts +2 -0
- package/dist/utils/dom/pointer.d.ts +2 -0
- package/dist/utils/dom/query.d.ts +4 -0
- package/dist/utils/dom/scroll.d.ts +23 -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/rafScheduler.d.ts +4 -0
- package/dist/utils/text.d.ts +2 -0
- package/docs/code-architecture.md +118 -0
- package/docs/public-composables-api.md +52 -0
- package/docs/public-floating-api.md +6 -5
- package/package.json +54 -46
- package/src/styles/_mixins.scss +4 -0
- package/src/styles/_tokens.scss +12 -12
- package/src/styles/_variables.scss +1 -1
- package/dist/button-link.css +0 -167
- 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 -37
- 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 -25
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +0 -25
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +0 -35
- /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
- /package/dist/{composables → internal/composables}/useOverlayLayer.d.ts +0 -0
package/dist/tooltip.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import './tooltip.css';
|
|
2
|
+
import { t as useControllableValue } from "./useControllableValue.js";
|
|
3
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
4
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
2
5
|
import { t as bem } from "./bem.js";
|
|
3
|
-
import {
|
|
4
|
-
import { i as getComponentVariantColorRoles } from "./componentColors.js";
|
|
6
|
+
import { t as isElement } from "./query.js";
|
|
5
7
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
8
|
+
import { r as normalizeDelay } from "./number.js";
|
|
9
|
+
import { a as getComponentVariantColorRoles } from "./componentColors.js";
|
|
10
|
+
import { a as snapshotAttributes, i as restoreAttributes } from "./attributes2.js";
|
|
11
|
+
import { n as mergeAriaIdRefs } from "./aria.js";
|
|
6
12
|
import { n as useOverlayZIndex } from "./useOverlayZIndex.js";
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
|
|
13
|
+
import { t as getFloatingOffsetStyle } from "./floatingOffset.js";
|
|
14
|
+
import { n as useFloatingTarget, t as useFloatingPosition } from "./useFloatingPosition.js";
|
|
15
|
+
import { n as useTeleportTarget } from "./useTeleportTarget.js";
|
|
16
|
+
import { VaporTeleport, VaporTransition, applyVShow, computed, createComponent, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, onBeforeUnmount, ref, renderEffect, setAttr, setDynamicProps, setInsertionState, setStyle, setTemplateRefBinding, setText, template, toDisplayString, unref, useId, useSlots, watch } from "vue";
|
|
17
|
+
//#region src/internal/composables/useDelayedOpen.ts
|
|
11
18
|
function readOption(value, fallback) {
|
|
12
19
|
return typeof value === "function" ? value() ?? fallback : value ?? fallback;
|
|
13
20
|
}
|
|
@@ -15,9 +22,13 @@ function readOptional(value) {
|
|
|
15
22
|
return typeof value === "function" ? value() : value;
|
|
16
23
|
}
|
|
17
24
|
function useDelayedOpen(options = {}) {
|
|
18
|
-
const
|
|
25
|
+
const controllableOpen = useControllableValue({
|
|
26
|
+
modelValue: () => readOptional(options.open),
|
|
27
|
+
defaultValue: () => false,
|
|
28
|
+
onChange: (nextOpen) => options.onOpenChange?.(nextOpen)
|
|
29
|
+
});
|
|
19
30
|
let openTimer = null;
|
|
20
|
-
const isOpen =
|
|
31
|
+
const isOpen = controllableOpen.value;
|
|
21
32
|
function clearTimers() {
|
|
22
33
|
if (openTimer) {
|
|
23
34
|
clearTimeout(openTimer);
|
|
@@ -28,13 +39,11 @@ function useDelayedOpen(options = {}) {
|
|
|
28
39
|
return readOption(options.disabled, false);
|
|
29
40
|
}
|
|
30
41
|
function setOpen(nextOpen) {
|
|
31
|
-
|
|
32
|
-
if (readOptional(options.open) === void 0) uncontrolledOpen.value = nextOpen;
|
|
33
|
-
if (previousOpen !== nextOpen) options.onOpenChange?.(nextOpen);
|
|
42
|
+
if (isOpen.value !== nextOpen) controllableOpen.setValue(nextOpen);
|
|
34
43
|
}
|
|
35
44
|
function open() {
|
|
36
45
|
if (isDisabled()) return;
|
|
37
|
-
const delay = readOption(options.openDelay, 0);
|
|
46
|
+
const delay = normalizeDelay(readOption(options.openDelay, 0));
|
|
38
47
|
if (delay <= 0) {
|
|
39
48
|
setOpen(true);
|
|
40
49
|
return;
|
|
@@ -58,14 +67,10 @@ function useDelayedOpen(options = {}) {
|
|
|
58
67
|
}
|
|
59
68
|
//#endregion
|
|
60
69
|
//#region src/components/tooltip/useTooltip.ts
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (offset.mainAxis != null) style["--_rp-tooltip-main-axis-offset"] = `${offset.mainAxis}px`;
|
|
66
|
-
if (offset.crossAxis != null) style["--_rp-tooltip-cross-axis-offset"] = `${offset.crossAxis}px`;
|
|
67
|
-
return Object.keys(style).length > 0 ? style : void 0;
|
|
68
|
-
}
|
|
70
|
+
var TOOLTIP_OFFSET_PROPERTIES = {
|
|
71
|
+
mainAxis: "--_rp-tooltip-main-axis-offset",
|
|
72
|
+
crossAxis: "--_rp-tooltip-cross-axis-offset"
|
|
73
|
+
};
|
|
69
74
|
function resolveTooltipColorStyleWithContrast(color, autoContrast, contrastColor) {
|
|
70
75
|
if (!color) return void 0;
|
|
71
76
|
const roles = getComponentVariantColorRoles({
|
|
@@ -94,9 +99,8 @@ function useTooltip(props, emitOpenChange) {
|
|
|
94
99
|
const shouldRenderContent = computed(() => !isDisabled.value);
|
|
95
100
|
const shouldDescribeContent = computed(() => shouldRenderContent.value && !isDecorative.value);
|
|
96
101
|
const teleportTo = useTeleportTarget(() => props.teleportTo);
|
|
97
|
-
const teleportPositioningKey = useTeleportPositioningKey();
|
|
98
102
|
const { isExplicitTarget, reference, resolvedTarget } = useFloatingTarget(() => props.target, rootRef);
|
|
99
|
-
const targetElement = computed(() =>
|
|
103
|
+
const targetElement = computed(() => isElement(resolvedTarget.value) ? resolvedTarget.value : null);
|
|
100
104
|
const zIndex = useOverlayZIndex({
|
|
101
105
|
baseZIndex: () => props.baseZIndex,
|
|
102
106
|
defaultBaseZIndex: 1e3
|
|
@@ -120,12 +124,7 @@ function useTooltip(props, emitOpenChange) {
|
|
|
120
124
|
flipOptions: () => props.flipOptions,
|
|
121
125
|
shift: () => props.shift !== false,
|
|
122
126
|
collisionPadding: () => props.collisionPadding ?? 8,
|
|
123
|
-
autoUpdateOptions: () => props.autoUpdateOptions
|
|
124
|
-
restartKey: () => [
|
|
125
|
-
Boolean(props.teleport),
|
|
126
|
-
teleportTo.value,
|
|
127
|
-
teleportPositioningKey.value
|
|
128
|
-
]
|
|
127
|
+
autoUpdateOptions: () => props.autoUpdateOptions
|
|
129
128
|
});
|
|
130
129
|
const placementSide = computed(() => floating.actualPlacement.value.split("-")[0]);
|
|
131
130
|
const rootClass = computed(() => bem("rp-tooltip", {
|
|
@@ -140,7 +139,7 @@ function useTooltip(props, emitOpenChange) {
|
|
|
140
139
|
const contentAriaHidden = computed(() => isDecorative.value ? "true" : void 0);
|
|
141
140
|
const contentStyle = computed(() => ({
|
|
142
141
|
...floating.floatingStyle.value,
|
|
143
|
-
...
|
|
142
|
+
...getFloatingOffsetStyle(props.offset, TOOLTIP_OFFSET_PROPERTIES),
|
|
144
143
|
...resolveTooltipColorStyleWithContrast(props.color, props.autoContrast, props.contrastColor),
|
|
145
144
|
zIndex: zIndex.value
|
|
146
145
|
}));
|
|
@@ -178,14 +177,9 @@ function useTooltip(props, emitOpenChange) {
|
|
|
178
177
|
tooltipId
|
|
179
178
|
], ([explicit, target, shouldDescribe, id], _previous, onCleanup) => {
|
|
180
179
|
if (!explicit || !target || !shouldDescribe) return;
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
target.setAttribute("aria-describedby", ids.join(" "));
|
|
185
|
-
onCleanup(() => {
|
|
186
|
-
if (previous == null) target.removeAttribute("aria-describedby");
|
|
187
|
-
else target.setAttribute("aria-describedby", previous);
|
|
188
|
-
});
|
|
180
|
+
const snapshot = snapshotAttributes(target, ["aria-describedby"]);
|
|
181
|
+
target.setAttribute("aria-describedby", mergeAriaIdRefs(snapshot.get("aria-describedby"), id) ?? "");
|
|
182
|
+
onCleanup(() => restoreAttributes(target, snapshot));
|
|
189
183
|
}, { flush: "sync" });
|
|
190
184
|
return {
|
|
191
185
|
rootRef,
|
|
@@ -213,10 +207,10 @@ function useTooltip(props, emitOpenChange) {
|
|
|
213
207
|
}
|
|
214
208
|
//#endregion
|
|
215
209
|
//#region src/components/tooltip/tooltip.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
216
|
-
var t0 = template("<span data-v-
|
|
210
|
+
var t0 = template("<span data-v-19aad69c class=rp-tooltip__arrow aria-hidden=true>");
|
|
217
211
|
var t1 = template(" ");
|
|
218
|
-
var t2 = template("<span data-v-
|
|
219
|
-
var t3 = template("<span data-v-
|
|
212
|
+
var t2 = template("<span data-v-19aad69c>");
|
|
213
|
+
var t3 = template("<span data-v-19aad69c>", 1);
|
|
220
214
|
//#endregion
|
|
221
215
|
//#region src/components/tooltip/tooltip.vue
|
|
222
216
|
var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -280,12 +274,17 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
280
274
|
const { rootRef, contentRef, arrowRef, tooltipId, isDisabled, isVisible, isTargetMode, shouldRenderContent, rootClass, triggerProps, contentRole, contentAriaHidden, contentStyle, actualPlacement, placementSide, arrowStyle, teleportTo, openTooltip, closeTooltip, onKeydown } = useTooltip(props, (open) => {
|
|
281
275
|
emit("update:open", open);
|
|
282
276
|
});
|
|
277
|
+
const templateRefs = {
|
|
278
|
+
root: rootRef,
|
|
279
|
+
content: contentRef,
|
|
280
|
+
arrow: arrowRef
|
|
281
|
+
};
|
|
283
282
|
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
284
283
|
const state = computed(() => isVisible.value ? "open" : "closed");
|
|
285
284
|
const rootAttrs = computed(() => getRootAttrs({
|
|
286
285
|
class: rootClass.value,
|
|
287
286
|
"data-state": state.value,
|
|
288
|
-
"data-disabled":
|
|
287
|
+
"data-disabled": toPresenceAttribute(isDisabled.value),
|
|
289
288
|
onMouseenter: openTooltip,
|
|
290
289
|
onMouseleave: closeTooltip,
|
|
291
290
|
onFocusin: openTooltip,
|
|
@@ -299,7 +298,7 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
299
298
|
...props.classNames?.trigger !== void 0 ? { class: partAttrs.class } : {},
|
|
300
299
|
...props.styles?.trigger !== void 0 ? { style: partAttrs.style } : {},
|
|
301
300
|
"data-state": state.value,
|
|
302
|
-
"data-disabled":
|
|
301
|
+
"data-disabled": toPresenceAttribute(isDisabled.value)
|
|
303
302
|
};
|
|
304
303
|
});
|
|
305
304
|
const contentAttrs = computed(() => ({
|
|
@@ -337,10 +336,10 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
337
336
|
setInsertionState(n11, null, 0);
|
|
338
337
|
createIf(() => __props.arrow, () => {
|
|
339
338
|
const n7 = t0();
|
|
340
|
-
_setTemplateRef(n7, arrowRef, null, "arrowRef");
|
|
341
339
|
renderEffect(() => {
|
|
342
340
|
setAttr(n7, "data-side", unref(placementSide));
|
|
343
341
|
setStyle(n7, unref(arrowStyle));
|
|
342
|
+
_setTemplateRef(n7, templateRefs.arrow);
|
|
344
343
|
});
|
|
345
344
|
return n7;
|
|
346
345
|
});
|
|
@@ -351,14 +350,14 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
351
350
|
return n10;
|
|
352
351
|
}, 1);
|
|
353
352
|
applyVShow(n11, () => unref(isVisible));
|
|
354
|
-
|
|
353
|
+
setTemplateRefBinding(n11, () => templateRefs.content, _setTemplateRef);
|
|
355
354
|
return n11;
|
|
356
355
|
}, null, 129);
|
|
357
356
|
}, { _: 8 }));
|
|
358
357
|
});
|
|
359
|
-
|
|
358
|
+
setTemplateRefBinding(n14, () => templateRefs.root);
|
|
360
359
|
return n14;
|
|
361
360
|
}
|
|
362
|
-
}), [["__scopeId", "data-v-
|
|
361
|
+
}), [["__scopeId", "data-v-19aad69c"]]);
|
|
363
362
|
//#endregion
|
|
364
|
-
export {
|
|
363
|
+
export { resolveTooltipColorStyleWithContrast as n, useDelayedOpen as r, tooltip_default as t };
|
package/dist/useCollapse.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
+
import { t as useControllableValue } from "./useControllableValue.js";
|
|
1
2
|
import { t as bem } from "./bem.js";
|
|
2
|
-
import { computed,
|
|
3
|
+
import { computed, toValue, useId } from "vue";
|
|
3
4
|
//#region src/components/collapse/useCollapse.ts
|
|
4
5
|
var DEFAULT_ROLE = "region";
|
|
5
|
-
function optionValue(value) {
|
|
6
|
-
return toValue(value);
|
|
7
|
-
}
|
|
8
6
|
function useCollapse(options = {}, emitOpenChange) {
|
|
9
7
|
const generatedId = useId();
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const id = computed(() => toValue(options.id) ?? `${generatedId}-collapse`);
|
|
9
|
+
const isDisabled = computed(() => Boolean(toValue(options.disabled)));
|
|
10
|
+
const controllableOpen = useControllableValue({
|
|
11
|
+
modelValue: () => toValue(options.open),
|
|
12
|
+
defaultValue: () => false,
|
|
13
|
+
onChange: (nextOpen) => {
|
|
14
|
+
options.onOpenChange?.(nextOpen);
|
|
15
|
+
emitOpenChange?.(nextOpen);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const isOpen = controllableOpen.value;
|
|
15
19
|
const state = computed(() => isOpen.value ? "open" : "closed");
|
|
16
|
-
const shouldRenderContent = computed(() => !
|
|
20
|
+
const shouldRenderContent = computed(() => !toValue(options.unmountOnExit) || isOpen.value);
|
|
17
21
|
const rootClass = computed(() => bem("rp-collapse", {
|
|
18
22
|
open: isOpen.value,
|
|
19
23
|
closed: !isOpen.value,
|
|
@@ -41,12 +45,12 @@ function useCollapse(options = {}, emitOpenChange) {
|
|
|
41
45
|
const contentProps = computed(() => ({
|
|
42
46
|
class: "rp-collapse__content",
|
|
43
47
|
id: id.value,
|
|
44
|
-
role:
|
|
48
|
+
role: toValue(options.role) ?? DEFAULT_ROLE,
|
|
45
49
|
"data-state": state.value,
|
|
46
50
|
"aria-hidden": isOpen.value ? void 0 : "true",
|
|
47
|
-
"aria-label":
|
|
48
|
-
"aria-labelledby":
|
|
49
|
-
"aria-describedby":
|
|
51
|
+
"aria-label": toValue(options.ariaLabel) || void 0,
|
|
52
|
+
"aria-labelledby": toValue(options.ariaLabelledby) || void 0,
|
|
53
|
+
"aria-describedby": toValue(options.ariaDescribedby) || void 0
|
|
50
54
|
}));
|
|
51
55
|
const triggerSlotProps = computed(() => ({
|
|
52
56
|
triggerProps: triggerProps.value,
|
|
@@ -54,9 +58,7 @@ function useCollapse(options = {}, emitOpenChange) {
|
|
|
54
58
|
}));
|
|
55
59
|
function setOpen(nextOpen) {
|
|
56
60
|
if (isDisabled.value || nextOpen === isOpen.value) return;
|
|
57
|
-
|
|
58
|
-
options.onOpenChange?.(nextOpen);
|
|
59
|
-
emitOpenChange?.(nextOpen);
|
|
61
|
+
controllableOpen.setValue(nextOpen);
|
|
60
62
|
}
|
|
61
63
|
function open() {
|
|
62
64
|
setOpen(true);
|
package/dist/useControlState.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
import { n as mergeAriaIdRefs } from "./aria.js";
|
|
1
2
|
import { computed } from "vue";
|
|
2
|
-
//#region src/composables/useControlState.ts
|
|
3
|
-
function mergeIds(...values) {
|
|
4
|
-
const ids = values.flatMap((value) => value?.split(/\s+/) ?? []).filter(Boolean);
|
|
5
|
-
return ids.length > 0 ? Array.from(new Set(ids)).join(" ") : void 0;
|
|
6
|
-
}
|
|
3
|
+
//#region src/internal/composables/useControlState.ts
|
|
7
4
|
function useControlState(options = {}) {
|
|
8
5
|
const id = computed(() => options.id);
|
|
9
6
|
const form = computed(() => options.form);
|
|
@@ -11,8 +8,8 @@ function useControlState(options = {}) {
|
|
|
11
8
|
const required = computed(() => options.required ?? false);
|
|
12
9
|
const invalid = computed(() => options.invalid ?? false);
|
|
13
10
|
const valid = computed(() => options.valid ?? false);
|
|
14
|
-
const ariaDescribedby = computed(() =>
|
|
15
|
-
const ariaLabelledby = computed(() =>
|
|
11
|
+
const ariaDescribedby = computed(() => mergeAriaIdRefs(options.describedby));
|
|
12
|
+
const ariaLabelledby = computed(() => mergeAriaIdRefs(options.labelledby));
|
|
16
13
|
return {
|
|
17
14
|
get id() {
|
|
18
15
|
return id.value;
|
|
@@ -6,8 +6,14 @@ function useControllableValue(options) {
|
|
|
6
6
|
const isControlled = computed(() => options.modelValue() !== void 0);
|
|
7
7
|
watch(options.modelValue, (value) => {
|
|
8
8
|
if (value !== void 0) uncontrolledValue.value = value;
|
|
9
|
-
}, {
|
|
10
|
-
|
|
9
|
+
}, {
|
|
10
|
+
flush: "sync",
|
|
11
|
+
immediate: true
|
|
12
|
+
});
|
|
13
|
+
const value = computed(() => {
|
|
14
|
+
const modelValue = options.modelValue();
|
|
15
|
+
return modelValue === void 0 ? uncontrolledValue.value : modelValue;
|
|
16
|
+
});
|
|
11
17
|
function setValue(nextValue) {
|
|
12
18
|
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
13
19
|
options.onChange(nextValue);
|