ropav 0.1.6 → 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 +6 -0
- 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/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/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +22 -28
- 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 +221 -200
- 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/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/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/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} +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-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-trigger.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub.d.ts +1 -1
- package/dist/components/dropdown-menu/{dropdown-menu-primitive-core.d.ts → dropdownMenuContext.d.ts} +16 -18
- 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/number-input/numberInputModel.d.ts +15 -0
- package/dist/components/number-input/useNumberInput.d.ts +3 -17
- 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 +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 +10 -8
- package/dist/components/scroll-area/useScrollAreaVisibility.d.ts +15 -20
- 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 +8 -16
- 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/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/css.js +12 -0
- package/dist/dialog.js +226 -218
- package/dist/dropdown-menu.js +1458 -1097
- package/dist/events.js +59 -0
- package/dist/field.css +8 -8
- package/dist/field.js +13 -25
- package/dist/floating.js +548 -319
- package/dist/floatingOffset.js +11 -0
- package/dist/focus-trap.js +7 -5
- package/dist/focusNavigation.js +37 -0
- package/dist/icon-button.css +8 -8
- package/dist/icon-button.js +7 -6
- package/dist/index.js +6 -6
- package/dist/input.css +24 -24
- package/dist/input.js +19 -31
- package/dist/interactive.js +18 -0
- package/dist/modal.js +1 -1
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +14 -12
- package/dist/number.js +22 -0
- package/dist/overlay.js +3 -2
- package/dist/pagination.css +28 -28
- package/dist/pagination.js +65 -63
- package/dist/pointer.js +9 -0
- package/dist/popover.css +34 -34
- package/dist/popover.js +85 -86
- 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 +512 -516
- package/dist/select.css +45 -45
- package/dist/select.js +36 -44
- package/dist/slider.css +191 -191
- package/dist/slider.js +691 -618
- 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/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 +36 -40
- package/dist/useCollapse.js +8 -11
- package/dist/useControlState.js +3 -6
- package/dist/useFloatingPosition.js +140 -10
- package/dist/useOverlayZIndex.js +1 -5
- 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-floating-api.md +6 -5
- package/package.json +13 -12
- 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/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/popover.js
CHANGED
|
@@ -1,54 +1,81 @@
|
|
|
1
1
|
import './popover.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";
|
|
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 { a as snapshotAttributes, i as restoreAttributes } from "./attributes2.js";
|
|
9
|
+
import { n as mergeAriaIdRefs } from "./aria.js";
|
|
10
|
+
import { i as isNodeWithinElement } from "./events.js";
|
|
6
11
|
import { n as useOverlayZIndex, r as useOverlayLayer } from "./useOverlayZIndex.js";
|
|
12
|
+
import { t as getFloatingOffsetStyle } from "./floatingOffset.js";
|
|
7
13
|
import { t as useFocusTrap } from "./useFocusTrap.js";
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import { VaporTeleport, VaporTransition, applyVShow, computed, createComponent, createIf,
|
|
11
|
-
//#region src/components/popover/
|
|
12
|
-
var DEFAULT_PLACEMENT = "bottom";
|
|
13
|
-
var DEFAULT_ROLE = "dialog";
|
|
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, isRef, nextTick, on, ref, renderEffect, setAttr, setDynamicProps, setInsertionState, setStyle, setTemplateRefBinding, template, unref, useAttrs, useId, useSlots, watch } from "vue";
|
|
17
|
+
//#region src/components/popover/usePopoverBindings.ts
|
|
14
18
|
var TARGET_ATTRIBUTES = [
|
|
15
19
|
"aria-controls",
|
|
16
20
|
"aria-expanded",
|
|
17
21
|
"aria-haspopup"
|
|
18
22
|
];
|
|
19
|
-
function addIdReference(currentValue, id) {
|
|
20
|
-
const ids = (currentValue ?? "").split(/\s+/).filter(Boolean);
|
|
21
|
-
if (!ids.includes(id)) ids.push(id);
|
|
22
|
-
return ids.join(" ");
|
|
23
|
-
}
|
|
24
|
-
function snapshotAttributes(element) {
|
|
25
|
-
const snapshot = {};
|
|
26
|
-
for (const attribute of TARGET_ATTRIBUTES) snapshot[attribute] = element.getAttribute(attribute);
|
|
27
|
-
return snapshot;
|
|
28
|
-
}
|
|
29
|
-
function restoreAttributes(element, snapshot) {
|
|
30
|
-
for (const attribute of TARGET_ATTRIBUTES) {
|
|
31
|
-
const value = snapshot[attribute];
|
|
32
|
-
if (value == null) element.removeAttribute(attribute);
|
|
33
|
-
else element.setAttribute(attribute, value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
23
|
function applyTargetAttributes(element, snapshot, options) {
|
|
37
|
-
element.setAttribute("aria-controls",
|
|
24
|
+
element.setAttribute("aria-controls", mergeAriaIdRefs(snapshot.get("aria-controls"), options.id) ?? "");
|
|
38
25
|
element.setAttribute("aria-expanded", String(options.expanded));
|
|
39
26
|
element.setAttribute("aria-haspopup", options.role);
|
|
40
27
|
}
|
|
28
|
+
function usePopoverBindings({ isExplicitTarget, targetElement, popoverId, popoverRole, isVisible, isDisabled, onTriggerClick, onDocumentClick, onDocumentPointerDown, onDocumentKeydown }) {
|
|
29
|
+
watch([isExplicitTarget, targetElement], ([explicit, target], _previous, onCleanup) => {
|
|
30
|
+
if (!explicit || !target) return;
|
|
31
|
+
target.addEventListener("click", onTriggerClick);
|
|
32
|
+
onCleanup(() => target.removeEventListener("click", onTriggerClick));
|
|
33
|
+
}, { flush: "sync" });
|
|
34
|
+
watch([
|
|
35
|
+
isExplicitTarget,
|
|
36
|
+
targetElement,
|
|
37
|
+
popoverId,
|
|
38
|
+
popoverRole,
|
|
39
|
+
isVisible,
|
|
40
|
+
isDisabled
|
|
41
|
+
], ([explicit, target, id, role, visible, disabled], _previous, onCleanup) => {
|
|
42
|
+
if (!explicit || !target || disabled) return;
|
|
43
|
+
const snapshot = snapshotAttributes(target, TARGET_ATTRIBUTES);
|
|
44
|
+
applyTargetAttributes(target, snapshot, {
|
|
45
|
+
id,
|
|
46
|
+
expanded: visible,
|
|
47
|
+
role
|
|
48
|
+
});
|
|
49
|
+
onCleanup(() => restoreAttributes(target, snapshot));
|
|
50
|
+
}, { flush: "sync" });
|
|
51
|
+
watch(isVisible, (visible, _previous, onCleanup) => {
|
|
52
|
+
if (!visible || typeof document === "undefined") return;
|
|
53
|
+
document.addEventListener("click", onDocumentClick, true);
|
|
54
|
+
document.addEventListener("mousedown", onDocumentPointerDown, true);
|
|
55
|
+
document.addEventListener("touchstart", onDocumentPointerDown, true);
|
|
56
|
+
document.addEventListener("keydown", onDocumentKeydown);
|
|
57
|
+
onCleanup(() => {
|
|
58
|
+
document.removeEventListener("click", onDocumentClick, true);
|
|
59
|
+
document.removeEventListener("mousedown", onDocumentPointerDown, true);
|
|
60
|
+
document.removeEventListener("touchstart", onDocumentPointerDown, true);
|
|
61
|
+
document.removeEventListener("keydown", onDocumentKeydown);
|
|
62
|
+
});
|
|
63
|
+
}, {
|
|
64
|
+
flush: "sync",
|
|
65
|
+
immediate: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/popover/usePopover.ts
|
|
70
|
+
var DEFAULT_PLACEMENT = "bottom";
|
|
71
|
+
var DEFAULT_ROLE = "dialog";
|
|
72
|
+
var POPOVER_OFFSET_PROPERTIES = {
|
|
73
|
+
mainAxis: "--_rp-popover-main-axis-offset",
|
|
74
|
+
crossAxis: "--_rp-popover-cross-axis-offset"
|
|
75
|
+
};
|
|
41
76
|
function isFocusTrapContainer(value) {
|
|
42
77
|
return typeof HTMLElement !== "undefined" && value instanceof HTMLElement || typeof SVGElement !== "undefined" && value instanceof SVGElement;
|
|
43
78
|
}
|
|
44
|
-
function resolveOffsetStyle(offset) {
|
|
45
|
-
if (offset == null) return void 0;
|
|
46
|
-
if (typeof offset === "number") return { "--_rp-popover-main-axis-offset": `${offset}px` };
|
|
47
|
-
const style = {};
|
|
48
|
-
if (offset.mainAxis != null) style["--_rp-popover-main-axis-offset"] = `${offset.mainAxis}px`;
|
|
49
|
-
if (offset.crossAxis != null) style["--_rp-popover-cross-axis-offset"] = `${offset.crossAxis}px`;
|
|
50
|
-
return Object.keys(style).length > 0 ? style : void 0;
|
|
51
|
-
}
|
|
52
79
|
function usePopover(props, emitOpenChange) {
|
|
53
80
|
const slots = useSlots();
|
|
54
81
|
const attrs = useAttrs();
|
|
@@ -65,9 +92,8 @@ function usePopover(props, emitOpenChange) {
|
|
|
65
92
|
const placement = computed(() => props.placement ?? DEFAULT_PLACEMENT);
|
|
66
93
|
const popoverRole = computed(() => props.role ?? DEFAULT_ROLE);
|
|
67
94
|
const teleportTo = useTeleportTarget(() => props.teleportTo);
|
|
68
|
-
const teleportPositioningKey = useTeleportPositioningKey();
|
|
69
95
|
const { isExplicitTarget, reference, resolvedTarget } = useFloatingTarget(() => props.target, rootRef);
|
|
70
|
-
const targetElement = computed(() =>
|
|
96
|
+
const targetElement = computed(() => isElement(resolvedTarget.value) ? resolvedTarget.value : null);
|
|
71
97
|
const hasContent = computed(() => Boolean(slots.content || isExplicitTarget.value && slots.default));
|
|
72
98
|
const isDisabled = computed(() => Boolean(props.disabled || !hasContent.value));
|
|
73
99
|
const isOpen = controllableOpen.value;
|
|
@@ -108,12 +134,7 @@ function usePopover(props, emitOpenChange) {
|
|
|
108
134
|
flipOptions: () => props.flipOptions,
|
|
109
135
|
shift: () => props.shift !== false,
|
|
110
136
|
collisionPadding: () => props.collisionPadding ?? 8,
|
|
111
|
-
autoUpdateOptions: () => props.autoUpdateOptions
|
|
112
|
-
restartKey: () => [
|
|
113
|
-
Boolean(props.teleport),
|
|
114
|
-
teleportTo.value,
|
|
115
|
-
teleportPositioningKey.value
|
|
116
|
-
]
|
|
137
|
+
autoUpdateOptions: () => props.autoUpdateOptions
|
|
117
138
|
});
|
|
118
139
|
const placementSide = computed(() => floating.actualPlacement.value.split("-")[0]);
|
|
119
140
|
const rootClass = computed(() => bem("rp-popover", {
|
|
@@ -125,7 +146,7 @@ function usePopover(props, emitOpenChange) {
|
|
|
125
146
|
}));
|
|
126
147
|
const contentStyle = computed(() => ({
|
|
127
148
|
...floating.floatingStyle.value,
|
|
128
|
-
...
|
|
149
|
+
...getFloatingOffsetStyle(props.offset, POPOVER_OFFSET_PROPERTIES),
|
|
129
150
|
zIndex: layer.zIndex.value
|
|
130
151
|
}));
|
|
131
152
|
const triggerProps = computed(() => ({
|
|
@@ -192,7 +213,7 @@ function usePopover(props, emitOpenChange) {
|
|
|
192
213
|
}
|
|
193
214
|
function onCompositeFocusout(event) {
|
|
194
215
|
const nextTarget = event.relatedTarget;
|
|
195
|
-
if (nextTarget
|
|
216
|
+
if (isNodeWithinElement(nextTarget, rootRef.value) || isNodeWithinElement(nextTarget, contentRef.value) || isNodeWithinElement(nextTarget, targetElement.value)) return;
|
|
196
217
|
const listener = attrs.onFocusout;
|
|
197
218
|
const listeners = Array.isArray(listener) ? listener : [listener];
|
|
198
219
|
for (const current of listeners) if (typeof current === "function") current(event);
|
|
@@ -227,43 +248,17 @@ function usePopover(props, emitOpenChange) {
|
|
|
227
248
|
flush: "post",
|
|
228
249
|
immediate: true
|
|
229
250
|
});
|
|
230
|
-
|
|
231
|
-
if (!explicit || !target) return;
|
|
232
|
-
target.addEventListener("click", onTriggerClick);
|
|
233
|
-
onCleanup(() => target.removeEventListener("click", onTriggerClick));
|
|
234
|
-
}, { flush: "sync" });
|
|
235
|
-
watch([
|
|
251
|
+
usePopoverBindings({
|
|
236
252
|
isExplicitTarget,
|
|
237
253
|
targetElement,
|
|
238
254
|
popoverId,
|
|
239
255
|
popoverRole,
|
|
240
256
|
isVisible,
|
|
241
|
-
isDisabled
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
id,
|
|
247
|
-
expanded: visible,
|
|
248
|
-
role
|
|
249
|
-
});
|
|
250
|
-
onCleanup(() => restoreAttributes(target, snapshot));
|
|
251
|
-
}, { flush: "sync" });
|
|
252
|
-
watch(isVisible, (visible, _previous, onCleanup) => {
|
|
253
|
-
if (!visible || typeof document === "undefined") return;
|
|
254
|
-
document.addEventListener("click", onDocumentClick, true);
|
|
255
|
-
document.addEventListener("mousedown", onDocumentPointerDown, true);
|
|
256
|
-
document.addEventListener("touchstart", onDocumentPointerDown, true);
|
|
257
|
-
document.addEventListener("keydown", onDocumentKeydown);
|
|
258
|
-
onCleanup(() => {
|
|
259
|
-
document.removeEventListener("click", onDocumentClick, true);
|
|
260
|
-
document.removeEventListener("mousedown", onDocumentPointerDown, true);
|
|
261
|
-
document.removeEventListener("touchstart", onDocumentPointerDown, true);
|
|
262
|
-
document.removeEventListener("keydown", onDocumentKeydown);
|
|
263
|
-
});
|
|
264
|
-
}, {
|
|
265
|
-
flush: "sync",
|
|
266
|
-
immediate: true
|
|
257
|
+
isDisabled,
|
|
258
|
+
onTriggerClick,
|
|
259
|
+
onDocumentClick,
|
|
260
|
+
onDocumentPointerDown,
|
|
261
|
+
onDocumentKeydown
|
|
267
262
|
});
|
|
268
263
|
return {
|
|
269
264
|
rootRef,
|
|
@@ -298,10 +293,9 @@ function usePopover(props, emitOpenChange) {
|
|
|
298
293
|
}
|
|
299
294
|
//#endregion
|
|
300
295
|
//#region src/components/popover/popover.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
301
|
-
var t0 = template("<span data-v-
|
|
302
|
-
var t1 = template("<section data-v-
|
|
303
|
-
var t2 = template("<span data-v-
|
|
304
|
-
delegateEvents("focusout");
|
|
296
|
+
var t0 = template("<span data-v-519e9856 class=rp-popover__arrow aria-hidden=true>");
|
|
297
|
+
var t1 = template("<section data-v-519e9856>");
|
|
298
|
+
var t2 = template("<span data-v-519e9856>", 1);
|
|
305
299
|
//#endregion
|
|
306
300
|
//#region src/components/popover/popover.vue
|
|
307
301
|
var popover_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -380,12 +374,17 @@ var popover_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
380
374
|
const { rootRef, contentRef, arrowRef, popoverId, isDisabled, isTargetMode, popoverRole, ariaLabel, ariaLabelledby, ariaDescribedby, shouldRenderContent, shouldShowContent, rootClass, contentStyle, slotProps, contentSlotProps, actualPlacement, placementSide, arrowStyle, teleportTo, onCompositeFocusout } = usePopover(props, (open) => {
|
|
381
375
|
emit("update:open", open);
|
|
382
376
|
});
|
|
377
|
+
const templateRefs = {
|
|
378
|
+
root: rootRef,
|
|
379
|
+
content: contentRef,
|
|
380
|
+
arrow: arrowRef
|
|
381
|
+
};
|
|
383
382
|
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
384
383
|
const publicRootAttrs = computed(() => getRootAttrs({
|
|
385
384
|
class: rootClass.value,
|
|
386
385
|
onFocusout: onCompositeFocusout,
|
|
387
386
|
"data-state": slotProps.value.isOpen ? "open" : "closed",
|
|
388
|
-
"data-disabled":
|
|
387
|
+
"data-disabled": toPresenceAttribute(isDisabled.value)
|
|
389
388
|
}, {}, ["onFocusout"]));
|
|
390
389
|
const styledTriggerProps = computed(() => {
|
|
391
390
|
const partAttrs = getPartAttrs("trigger");
|
|
@@ -394,7 +393,7 @@ var popover_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
394
393
|
...props.classNames?.trigger !== void 0 ? { class: partAttrs.class } : {},
|
|
395
394
|
...props.styles?.trigger !== void 0 ? { style: partAttrs.style } : {},
|
|
396
395
|
"data-state": slotProps.value.isOpen ? "open" : "closed",
|
|
397
|
-
"data-disabled":
|
|
396
|
+
"data-disabled": toPresenceAttribute(isDisabled.value)
|
|
398
397
|
};
|
|
399
398
|
});
|
|
400
399
|
const contentAttrs = computed(() => ({
|
|
@@ -458,23 +457,23 @@ var popover_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
458
457
|
setInsertionState(n13, null, 1);
|
|
459
458
|
createIf(() => __props.arrow, () => {
|
|
460
459
|
const n12 = t0();
|
|
461
|
-
_setTemplateRef(n12, arrowRef, null, "arrowRef");
|
|
462
460
|
renderEffect(() => {
|
|
463
461
|
setAttr(n12, "data-side", unref(placementSide));
|
|
464
462
|
setStyle(n12, unref(arrowStyle));
|
|
463
|
+
_setTemplateRef(n12, templateRefs.arrow);
|
|
465
464
|
});
|
|
466
465
|
return n12;
|
|
467
466
|
});
|
|
468
467
|
applyVShow(n13, () => unref(shouldShowContent));
|
|
469
|
-
n13
|
|
470
|
-
|
|
468
|
+
on(n13, "focusout", (e) => unref(onCompositeFocusout)(e));
|
|
469
|
+
setTemplateRefBinding(n13, () => templateRefs.content, _setTemplateRef);
|
|
471
470
|
return n13;
|
|
472
471
|
}, null, 129);
|
|
473
472
|
}, { _: 8 }));
|
|
474
473
|
});
|
|
475
|
-
|
|
474
|
+
setTemplateRefBinding(n16, () => templateRefs.root);
|
|
476
475
|
return n16;
|
|
477
476
|
}
|
|
478
|
-
}), [["__scopeId", "data-v-
|
|
477
|
+
}), [["__scopeId", "data-v-519e9856"]]);
|
|
479
478
|
//#endregion
|
|
480
479
|
export { popover_default as t };
|
package/dist/progress.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import './progress.css';
|
|
2
|
-
import {
|
|
2
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
3
3
|
import { t as bem } from "./bem.js";
|
|
4
4
|
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
5
|
-
import {
|
|
5
|
+
import { n as getValuePercent, t as clamp } from "./number.js";
|
|
6
|
+
import { i as getComponentColorValue, t as componentColors } from "./componentColors.js";
|
|
6
7
|
import { t as useControlState } from "./useControlState.js";
|
|
7
8
|
import { child, computed, createIf, createSlot, defineVaporComponent, renderEffect, setDynamicProps, setInsertionState, setText, template, toDisplayString, unref, useId, useSlots } from "vue";
|
|
8
|
-
//#region src/components/progress/
|
|
9
|
+
//#region src/components/progress/progressModel.ts
|
|
9
10
|
function normalizeProgressBounds(min, max) {
|
|
10
11
|
const safeMin = Number.isFinite(min) ? min : 0;
|
|
11
12
|
const safeMax = Number.isFinite(max) ? max : 100;
|
|
@@ -18,15 +19,9 @@ function normalizeProgressBounds(min, max) {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
function normalizeProgressValue(value, min, max) {
|
|
21
|
-
|
|
22
|
-
return Math.min(max, Math.max(min, safeValue));
|
|
23
|
-
}
|
|
24
|
-
function getProgressValuePercent(value, min, max) {
|
|
25
|
-
if (max <= min) return 0;
|
|
26
|
-
const percent = (value - min) / (max - min) * 100;
|
|
27
|
-
return Math.min(100, Math.max(0, percent));
|
|
22
|
+
return clamp(Number.isFinite(value) ? Number(value) : min, min, max);
|
|
28
23
|
}
|
|
29
|
-
function
|
|
24
|
+
function formatProgressValue(value, percent, formatter) {
|
|
30
25
|
return formatter ? formatter(value, percent) : `${Math.round(percent)}%`;
|
|
31
26
|
}
|
|
32
27
|
function getProgressAriaValueText(value, percent, ariaValueText, formatter) {
|
|
@@ -34,13 +29,15 @@ function getProgressAriaValueText(value, percent, ariaValueText, formatter) {
|
|
|
34
29
|
if (ariaValueText != null && ariaValueText !== "") return String(ariaValueText);
|
|
35
30
|
if (formatter) return String(formatter(value, percent));
|
|
36
31
|
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/progress/useProgress.ts
|
|
37
34
|
function useProgress(props) {
|
|
38
35
|
const control = useControlState(props);
|
|
39
36
|
const bounds = computed(() => normalizeProgressBounds(props.min, props.max));
|
|
40
37
|
const isIndeterminate = computed(() => props.indeterminate || props.value == null);
|
|
41
38
|
const normalizedValue = computed(() => normalizeProgressValue(props.value, bounds.value.min, bounds.value.max));
|
|
42
|
-
const valuePercent = computed(() =>
|
|
43
|
-
const formattedValue = computed(() =>
|
|
39
|
+
const valuePercent = computed(() => getValuePercent(normalizedValue.value, bounds.value.min, bounds.value.max));
|
|
40
|
+
const formattedValue = computed(() => formatProgressValue(normalizedValue.value, valuePercent.value, props.formatValue));
|
|
44
41
|
const ariaValueText = computed(() => isIndeterminate.value ? void 0 : getProgressAriaValueText(normalizedValue.value, valuePercent.value, props.ariaValueText, props.formatValue));
|
|
45
42
|
return {
|
|
46
43
|
control,
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/utils/dom/query.ts
|
|
2
|
+
function isElement(value) {
|
|
3
|
+
if (value == null || typeof value !== "object") return false;
|
|
4
|
+
if (typeof Element !== "undefined" && value instanceof Element) return true;
|
|
5
|
+
const candidate = value;
|
|
6
|
+
const ElementConstructor = ("ownerDocument" in value ? candidate.ownerDocument : null)?.defaultView?.Element;
|
|
7
|
+
if (ElementConstructor && value instanceof ElementConstructor) return true;
|
|
8
|
+
return candidate.nodeType === 1 && typeof candidate.getAttribute === "function";
|
|
9
|
+
}
|
|
10
|
+
function matchesSelectorSafe(element, selector) {
|
|
11
|
+
try {
|
|
12
|
+
return element.matches(selector);
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function getQueryRoot(root) {
|
|
18
|
+
if (root !== void 0) return root;
|
|
19
|
+
return typeof document !== "undefined" ? document : null;
|
|
20
|
+
}
|
|
21
|
+
function querySelectorSafe(selector, root) {
|
|
22
|
+
const queryRoot = getQueryRoot(root);
|
|
23
|
+
if (!queryRoot) return null;
|
|
24
|
+
try {
|
|
25
|
+
return queryRoot.querySelector(selector);
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function querySelectorAllSafe(selector, root) {
|
|
31
|
+
const queryRoot = getQueryRoot(root);
|
|
32
|
+
if (!queryRoot) return [];
|
|
33
|
+
try {
|
|
34
|
+
return Array.from(queryRoot.querySelectorAll(selector));
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { querySelectorSafe as i, matchesSelectorSafe as n, querySelectorAllSafe as r, isElement as t };
|
package/dist/radio.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@layer ropav.components {
|
|
2
|
-
.rp-radio[data-v-
|
|
2
|
+
.rp-radio[data-v-d1001176] {
|
|
3
3
|
--_rp-radio-color: var(--rp-color-control-selected-bg);
|
|
4
4
|
--_rp-radio-on-color: var(--rp-color-control-selected-fg);
|
|
5
5
|
--_rp-radio-default-size: 24px;
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
font-family: var(--rp-font-family);
|
|
17
17
|
user-select: none;
|
|
18
18
|
}
|
|
19
|
-
.rp-radio--disabled[data-v-
|
|
19
|
+
.rp-radio--disabled[data-v-d1001176] {
|
|
20
20
|
opacity: var(--rp-opacity-disabled);
|
|
21
21
|
cursor: not-allowed;
|
|
22
22
|
}
|
|
23
|
-
.rp-radio[data-v-
|
|
23
|
+
.rp-radio[data-v-d1001176] {
|
|
24
24
|
gap: var(--rp-spacing-2);
|
|
25
25
|
font-size: var(--_rp-radio-font-size);
|
|
26
26
|
}
|
|
27
|
-
.rp-radio__native[data-v-
|
|
27
|
+
.rp-radio__native[data-v-d1001176] {
|
|
28
28
|
position: absolute;
|
|
29
29
|
width: 1px;
|
|
30
30
|
height: 1px;
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
border-width: 0;
|
|
37
37
|
pointer-events: none;
|
|
38
38
|
}
|
|
39
|
-
.rp-radio__native:focus-visible + .rp-radio__dot[data-v-
|
|
39
|
+
.rp-radio__native:focus-visible + .rp-radio__dot[data-v-d1001176] {
|
|
40
40
|
border-color: var(--rp-color-control-border-focus);
|
|
41
41
|
box-shadow: 0 0 0 var(--rp-border-width-medium) var(--rp-color-focus-ring);
|
|
42
42
|
}
|
|
43
|
-
.rp-radio__dot[data-v-
|
|
43
|
+
.rp-radio__dot[data-v-d1001176] {
|
|
44
44
|
display: inline-flex;
|
|
45
45
|
align-items: center;
|
|
46
46
|
justify-content: center;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
background-color: var(--rp-color-control-bg);
|
|
53
53
|
transition: background-color var(--rp-transition-fast), border-color var(--rp-transition-fast);
|
|
54
54
|
}
|
|
55
|
-
.rp-radio__dot[data-v-
|
|
55
|
+
.rp-radio__dot[data-v-d1001176]::after {
|
|
56
56
|
content: "";
|
|
57
57
|
width: var(--_rp-radio-dot);
|
|
58
58
|
height: var(--_rp-radio-dot);
|
|
@@ -61,55 +61,55 @@
|
|
|
61
61
|
transform: scale(0);
|
|
62
62
|
transition: transform var(--rp-transition-fast);
|
|
63
63
|
}
|
|
64
|
-
.rp-radio--checked .rp-radio__dot[data-v-
|
|
64
|
+
.rp-radio--checked .rp-radio__dot[data-v-d1001176] {
|
|
65
65
|
background-color: var(--_rp-radio-checked-bg);
|
|
66
66
|
border-color: var(--_rp-radio-checked-border);
|
|
67
67
|
}
|
|
68
|
-
.rp-radio--checked .rp-radio__dot[data-v-
|
|
68
|
+
.rp-radio--checked .rp-radio__dot[data-v-d1001176]::after {
|
|
69
69
|
transform: scale(1);
|
|
70
70
|
}
|
|
71
|
-
.rp-radio__label[data-v-
|
|
71
|
+
.rp-radio__label[data-v-d1001176] {
|
|
72
72
|
line-height: var(--rp-line-height-md);
|
|
73
73
|
color: var(--rp-color-text);
|
|
74
74
|
}
|
|
75
|
-
.rp-radio--outline[data-v-
|
|
75
|
+
.rp-radio--outline[data-v-d1001176] {
|
|
76
76
|
--_rp-radio-checked-bg: var(--rp-color-control-bg);
|
|
77
77
|
--_rp-radio-checked-border: var(--_rp-radio-color);
|
|
78
78
|
--_rp-radio-checked-dot: var(--_rp-radio-color);
|
|
79
79
|
}
|
|
80
|
-
.rp-radio--size-xs[data-v-
|
|
80
|
+
.rp-radio--size-xs[data-v-d1001176] {
|
|
81
81
|
--_rp-radio-default-size: 16px;
|
|
82
82
|
--_rp-radio-default-dot: 6px;
|
|
83
83
|
--_rp-radio-font-size: var(--rp-font-size-xs);
|
|
84
84
|
}
|
|
85
|
-
.rp-radio--size-sm[data-v-
|
|
85
|
+
.rp-radio--size-sm[data-v-d1001176] {
|
|
86
86
|
--_rp-radio-default-size: 20px;
|
|
87
87
|
--_rp-radio-default-dot: 8px;
|
|
88
88
|
--_rp-radio-font-size: var(--rp-font-size-sm);
|
|
89
89
|
}
|
|
90
|
-
.rp-radio--size-md[data-v-
|
|
90
|
+
.rp-radio--size-md[data-v-d1001176] {
|
|
91
91
|
--_rp-radio-default-size: 24px;
|
|
92
92
|
--_rp-radio-default-dot: 10px;
|
|
93
93
|
--_rp-radio-font-size: var(--rp-font-size-md);
|
|
94
94
|
}
|
|
95
|
-
.rp-radio--size-lg[data-v-
|
|
95
|
+
.rp-radio--size-lg[data-v-d1001176] {
|
|
96
96
|
--_rp-radio-default-size: 30px;
|
|
97
97
|
--_rp-radio-default-dot: 14px;
|
|
98
98
|
--_rp-radio-font-size: var(--rp-font-size-lg);
|
|
99
99
|
}
|
|
100
|
-
.rp-radio--size-xl[data-v-
|
|
100
|
+
.rp-radio--size-xl[data-v-d1001176] {
|
|
101
101
|
--_rp-radio-default-size: 36px;
|
|
102
102
|
--_rp-radio-default-dot: 16px;
|
|
103
103
|
--_rp-radio-font-size: var(--rp-font-size-xl);
|
|
104
104
|
}
|
|
105
105
|
}@layer ropav.components {
|
|
106
|
-
.rp-radio-group[data-v-
|
|
106
|
+
.rp-radio-group[data-v-9c16fa9f] {
|
|
107
107
|
display: flex;
|
|
108
108
|
flex-direction: column;
|
|
109
109
|
gap: var(--rp-spacing-3);
|
|
110
110
|
font-family: var(--rp-font-family);
|
|
111
111
|
}
|
|
112
|
-
.rp-radio-group[data-orientation=horizontal][data-v-
|
|
112
|
+
.rp-radio-group[data-orientation=horizontal][data-v-9c16fa9f] {
|
|
113
113
|
flex-flow: row wrap;
|
|
114
114
|
}
|
|
115
115
|
}
|
package/dist/radio.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import './radio.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";
|
|
6
|
-
import {
|
|
7
|
+
import { n as getComponentCheckedColorStyle } from "./componentColors.js";
|
|
7
8
|
import { i as useFormControl } from "./useFormControl.js";
|
|
9
|
+
import { o as splitCompatibilityAttributes, t as composeEventHandlers } from "./attributes2.js";
|
|
8
10
|
import { t as useControlState } from "./useControlState.js";
|
|
9
11
|
import { child, computed, createIf, createSlot, defineVaporComponent, inject, next, onBeforeUnmount, onMounted, provide, ref, renderEffect, setDynamicProps, setInsertionState, setStaticTemplateRef, shallowRef, template, unref, useId } from "vue";
|
|
10
12
|
//#region src/components/radio/types.ts
|
|
@@ -18,18 +20,6 @@ var radioGroupParts = ["root"];
|
|
|
18
20
|
var radioGroupKey = Symbol("radioGroup");
|
|
19
21
|
//#endregion
|
|
20
22
|
//#region src/components/radio/useRadio.ts
|
|
21
|
-
function getRadioColorStyle(color, autoContrast, contrastColor) {
|
|
22
|
-
const colorValue = getComponentColorValue(color);
|
|
23
|
-
if (color && !colorValue) return void 0;
|
|
24
|
-
if (!colorValue && autoContrast === false && contrastColor === void 0) return void 0;
|
|
25
|
-
const style = {};
|
|
26
|
-
if (colorValue) style["--_rp-radio-color"] = colorValue;
|
|
27
|
-
if (autoContrast !== false || contrastColor !== void 0) style["--_rp-radio-on-color"] = getComponentContrastColor(color ?? "primary", {
|
|
28
|
-
autoContrast,
|
|
29
|
-
contrastColor
|
|
30
|
-
});
|
|
31
|
-
return style;
|
|
32
|
-
}
|
|
33
23
|
function useRadio(props, emitChange) {
|
|
34
24
|
const inputRef = ref(null);
|
|
35
25
|
const control = useControlState(props);
|
|
@@ -52,7 +42,13 @@ function useRadio(props, emitChange) {
|
|
|
52
42
|
[variant.value ?? ""]: Boolean(variant.value),
|
|
53
43
|
[`size-${size.value}`]: Boolean(size.value)
|
|
54
44
|
}));
|
|
55
|
-
const rootStyle = computed(() =>
|
|
45
|
+
const rootStyle = computed(() => getComponentCheckedColorStyle({
|
|
46
|
+
color: color.value,
|
|
47
|
+
autoContrast: autoContrast.value,
|
|
48
|
+
contrastColor: contrastColor.value,
|
|
49
|
+
colorProperty: "--_rp-radio-color",
|
|
50
|
+
checkedColorProperty: "--_rp-radio-on-color"
|
|
51
|
+
}));
|
|
56
52
|
function onSelect(event) {
|
|
57
53
|
if (isDisabled.value) return;
|
|
58
54
|
group?.select(props.value);
|
|
@@ -190,8 +186,8 @@ function useRadioGroup(props, emitUpdate) {
|
|
|
190
186
|
}
|
|
191
187
|
//#endregion
|
|
192
188
|
//#region src/components/radio/radio.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
193
|
-
var t0$1 = template("<span data-v-
|
|
194
|
-
var t1 = template("<label data-v-
|
|
189
|
+
var t0$1 = template("<span data-v-d1001176>");
|
|
190
|
+
var t1 = template("<label data-v-d1001176><input data-v-d1001176><span data-v-d1001176></span>", 1);
|
|
195
191
|
//#endregion
|
|
196
192
|
//#region src/components/radio/radio.vue
|
|
197
193
|
var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -244,26 +240,24 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
244
240
|
const rootAttrs = computed(() => getRootAttrs({
|
|
245
241
|
class: rootClass.value,
|
|
246
242
|
style: rootStyle.value,
|
|
247
|
-
"data-disabled":
|
|
248
|
-
"data-invalid":
|
|
243
|
+
"data-disabled": toPresenceAttribute(isDisabled.value),
|
|
244
|
+
"data-invalid": toPresenceAttribute(isInvalid.value),
|
|
249
245
|
"data-state": isChecked.value ? "checked" : "unchecked"
|
|
250
246
|
}));
|
|
251
247
|
const nativeInputAttrs = computed(() => {
|
|
252
|
-
const
|
|
253
|
-
const
|
|
248
|
+
const groupAttrs = groupInputAttrs.value ?? {};
|
|
249
|
+
const itemAttrs = props.inputAttrs ?? {};
|
|
250
|
+
const { compatibilityClass: groupClass, compatibilityStyle: groupStyle, forwardedAttributes: groupForwardedAttributes } = splitCompatibilityAttributes(groupAttrs);
|
|
251
|
+
const { compatibilityClass: itemClass, compatibilityStyle: itemStyle, forwardedAttributes: itemForwardedAttributes } = splitCompatibilityAttributes(itemAttrs);
|
|
254
252
|
return {
|
|
255
|
-
...
|
|
256
|
-
...
|
|
253
|
+
...groupForwardedAttributes,
|
|
254
|
+
...itemForwardedAttributes,
|
|
257
255
|
...getPartAttrs("input", {
|
|
258
256
|
class: "rp-radio__native",
|
|
259
257
|
compatibilityClass: [groupClass, itemClass],
|
|
260
258
|
compatibilityStyle: [groupStyle, itemStyle]
|
|
261
259
|
}),
|
|
262
|
-
onChange(
|
|
263
|
-
onSelect(event);
|
|
264
|
-
groupOnChange?.(event);
|
|
265
|
-
itemOnChange?.(event);
|
|
266
|
-
}
|
|
260
|
+
onChange: composeEventHandlers(onSelect, groupAttrs.onChange, itemAttrs.onChange)
|
|
267
261
|
};
|
|
268
262
|
});
|
|
269
263
|
__expose({
|
|
@@ -280,7 +274,7 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
280
274
|
const _isChecked = unref(isChecked);
|
|
281
275
|
const _isDisabled = unref(isDisabled);
|
|
282
276
|
const _isInvalid = unref(isInvalid);
|
|
283
|
-
const
|
|
277
|
+
const _toPresenceAttribute = unref(toPresenceAttribute);
|
|
284
278
|
setDynamicProps(n6, [rootAttrs.value]);
|
|
285
279
|
setDynamicProps(n0, [_nativeInputAttrs, {
|
|
286
280
|
id: _control.id,
|
|
@@ -296,8 +290,8 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
296
290
|
"aria-describedby": _control.ariaDescribedby,
|
|
297
291
|
"aria-invalid": _isInvalid || void 0,
|
|
298
292
|
"aria-required": unref(isRequired) || void 0,
|
|
299
|
-
"data-disabled":
|
|
300
|
-
"data-invalid":
|
|
293
|
+
"data-disabled": _toPresenceAttribute(_isDisabled),
|
|
294
|
+
"data-invalid": _toPresenceAttribute(_isInvalid),
|
|
301
295
|
"data-state": _isChecked ? "checked" : "unchecked"
|
|
302
296
|
}]);
|
|
303
297
|
setDynamicProps(n1, [unref(getPartAttrs)("indicator", { class: "rp-radio__dot" })]);
|
|
@@ -312,10 +306,10 @@ var radio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__
|
|
|
312
306
|
});
|
|
313
307
|
return n6;
|
|
314
308
|
}
|
|
315
|
-
}), [["__scopeId", "data-v-
|
|
309
|
+
}), [["__scopeId", "data-v-d1001176"]]);
|
|
316
310
|
//#endregion
|
|
317
311
|
//#region src/components/radio/radio-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
318
|
-
var t0 = template("<div data-v-
|
|
312
|
+
var t0 = template("<div data-v-9c16fa9f>", 1);
|
|
319
313
|
//#endregion
|
|
320
314
|
//#region src/components/radio/radio-group.vue
|
|
321
315
|
var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -370,8 +364,8 @@ var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
370
364
|
class: rootClass.value,
|
|
371
365
|
role: "radiogroup",
|
|
372
366
|
"data-orientation": props.orientation,
|
|
373
|
-
"data-disabled":
|
|
374
|
-
"data-invalid":
|
|
367
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
368
|
+
"data-invalid": toPresenceAttribute(control.invalid),
|
|
375
369
|
"aria-label": props.ariaLabel || void 0,
|
|
376
370
|
"aria-labelledby": control.ariaLabelledby,
|
|
377
371
|
"aria-describedby": control.ariaDescribedby,
|
|
@@ -385,6 +379,6 @@ var radio_group_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
385
379
|
createSlot("default", null, null, 1);
|
|
386
380
|
return n1;
|
|
387
381
|
}
|
|
388
|
-
}), [["__scopeId", "data-v-
|
|
382
|
+
}), [["__scopeId", "data-v-9c16fa9f"]]);
|
|
389
383
|
//#endregion
|
|
390
384
|
export { radioParts as i, radio_default as n, radioGroupParts as r, radio_group_default as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/utils/rafScheduler.ts
|
|
2
|
+
function createRafScheduler(callback, getView) {
|
|
3
|
+
let frameId;
|
|
4
|
+
let frameView;
|
|
5
|
+
let generation = 0;
|
|
6
|
+
function cancel() {
|
|
7
|
+
generation += 1;
|
|
8
|
+
if (frameId !== void 0) frameView?.cancelAnimationFrame(frameId);
|
|
9
|
+
frameId = void 0;
|
|
10
|
+
frameView = void 0;
|
|
11
|
+
}
|
|
12
|
+
function schedule() {
|
|
13
|
+
if (frameId !== void 0) return;
|
|
14
|
+
const view = getView();
|
|
15
|
+
if (!view?.requestAnimationFrame) {
|
|
16
|
+
callback();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const scheduledGeneration = generation;
|
|
20
|
+
frameView = view;
|
|
21
|
+
frameId = view.requestAnimationFrame(() => {
|
|
22
|
+
if (generation !== scheduledGeneration || frameView !== view) return;
|
|
23
|
+
frameId = void 0;
|
|
24
|
+
frameView = void 0;
|
|
25
|
+
callback();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
cancel,
|
|
30
|
+
schedule
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createRafScheduler as t };
|