@plexui/vue 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Badge/Badge.js +1 -1
- package/dist/es/components/Badge/Badge.js.map +1 -1
- package/dist/es/components/Button/Button.js +13 -5
- package/dist/es/components/Button/Button.js.map +1 -1
- package/dist/es/components/Button/ButtonLink.js +7 -1
- package/dist/es/components/Button/ButtonLink.js.map +1 -1
- package/dist/es/components/Button/NavigationButton.js +27 -0
- package/dist/es/components/Button/NavigationButton.js.map +1 -0
- package/dist/es/components/Button/NavigationGlyph.js +27 -0
- package/dist/es/components/Button/NavigationGlyph.js.map +1 -0
- package/dist/es/components/Button/index.js +1 -0
- package/dist/es/components/Button/index.js.map +1 -1
- package/dist/es/components/Checkbox/Checkbox.js +14 -4
- package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/es/components/DateInput/DateInput.js +7 -3
- package/dist/es/components/DateInput/DateInput.js.map +1 -1
- package/dist/es/components/DatePicker/Calendar.js +130 -86
- package/dist/es/components/DatePicker/Calendar.js.map +1 -1
- package/dist/es/components/DatePicker/CalendarNavigationIcon.js +31 -0
- package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -0
- package/dist/es/components/DatePicker/DatePicker.js +16 -4
- package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/es/components/DatePicker/context.js.map +1 -1
- package/dist/es/components/DatePicker/useCalendarGutter.js +14 -0
- package/dist/es/components/DatePicker/useCalendarGutter.js.map +1 -0
- package/dist/es/components/DateRangePicker/Calendar.js +92 -71
- package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
- package/dist/es/components/DateRangePicker/DateRangePicker.js +13 -4
- package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/es/components/DateRangePicker/Trigger.js +1 -0
- package/dist/es/components/DateRangePicker/Trigger.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +125 -52
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/index.js.map +1 -1
- package/dist/es/components/Dialog/sheetDrag.js +77 -24
- package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
- package/dist/es/components/Field/Field.js +58 -5
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/FieldGroup/FieldGroup.js +3 -1
- package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
- package/dist/es/components/FileUpload/FileUpload.js +50 -11
- package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +24 -13
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js +9 -3
- package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -1
- package/dist/es/components/Icon/index.js +1 -0
- package/dist/es/components/Icon/index.js.map +1 -1
- package/dist/es/components/Icon/svg/Disclosure.js +10 -0
- package/dist/es/components/Icon/svg/Disclosure.js.map +1 -0
- package/dist/es/components/Indicator/LoadingIndicator.js +2 -2
- package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
- package/dist/es/components/Input/Input.js +15 -5
- package/dist/es/components/Input/Input.js.map +1 -1
- package/dist/es/components/InputGroup/InputGroup.js +3 -1
- package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js +126 -151
- package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +217 -35
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/Menu/internal.js +2 -1
- package/dist/es/components/Menu/internal.js.map +1 -1
- package/dist/es/components/OTPInput/OTPInput.js +7 -4
- package/dist/es/components/OTPInput/OTPInput.js.map +1 -1
- package/dist/es/components/Page/Page.js +93 -14
- package/dist/es/components/Page/Page.js.map +1 -1
- package/dist/es/components/Page/index.js +1 -1
- package/dist/es/components/Page/index.js.map +1 -1
- package/dist/es/components/Popover/Popover.js +16 -6
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/Popover/deferredPointerDownOutside.js +6 -0
- package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
- package/dist/es/components/RadioGroup/RadioGroup.js +31 -13
- package/dist/es/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/es/components/Select/Select.js +75 -25
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/SelectControl/SelectControl.js +58 -25
- package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
- package/dist/es/components/SelectControl/index.js +1 -1
- package/dist/es/components/SelectControl/index.js.map +1 -1
- package/dist/es/components/ShimmerText/ShimmerText.js +16 -3
- package/dist/es/components/ShimmerText/ShimmerText.js.map +1 -1
- package/dist/es/components/Slider/Slider.js +56 -16
- package/dist/es/components/Slider/Slider.js.map +1 -1
- package/dist/es/components/Sortable/Sortable.js +20 -13
- package/dist/es/components/Sortable/Sortable.js.map +1 -1
- package/dist/es/components/Switch/Switch.js +6 -3
- package/dist/es/components/Switch/Switch.js.map +1 -1
- package/dist/es/components/Tabs/Tabs.js +12 -11
- package/dist/es/components/Tabs/Tabs.js.map +1 -1
- package/dist/es/components/TagInput/TagInput.js +46 -6
- package/dist/es/components/TagInput/TagInput.js.map +1 -1
- package/dist/es/components/Textarea/Textarea.js +13 -2
- package/dist/es/components/Textarea/Textarea.js.map +1 -1
- package/dist/es/components/Toast/ToastRenderer.js +144 -0
- package/dist/es/components/Toast/ToastRenderer.js.map +1 -0
- package/dist/es/components/Toast/Toaster.js +23 -1
- package/dist/es/components/Toast/Toaster.js.map +1 -1
- package/dist/es/components/Toast/toastLifecycle.js +283 -0
- package/dist/es/components/Toast/toastLifecycle.js.map +1 -0
- package/dist/es/components/Toolbar/Toolbar.js +107 -0
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/es/components/Toolbar/index.js +2 -0
- package/dist/es/components/Toolbar/index.js.map +1 -0
- package/dist/es/components/Tooltip/CopyTooltip.js +39 -13
- package/dist/es/components/Tooltip/CopyTooltip.js.map +1 -1
- package/dist/es/components/Tooltip/Tooltip.js +35 -14
- package/dist/es/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/es/composables/useFloatingBoundary.js +48 -0
- package/dist/es/composables/useFloatingBoundary.js.map +1 -0
- package/dist/es/composables/usePhoneSubmenu.js +19 -0
- package/dist/es/composables/usePhoneSubmenu.js.map +1 -0
- package/dist/es/lib/copyToClipboard.js +16 -7
- package/dist/es/lib/copyToClipboard.js.map +1 -1
- package/dist/es/lib/floatingBoundary.js +90 -0
- package/dist/es/lib/floatingBoundary.js.map +1 -0
- package/dist/es/lib/focusRestore.js +56 -0
- package/dist/es/lib/focusRestore.js.map +1 -0
- package/dist/es/lib/helpers.js +0 -18
- package/dist/es/lib/helpers.js.map +1 -1
- package/dist/es/lib/inputMode.js +9 -0
- package/dist/es/lib/inputMode.js.map +1 -0
- package/dist/es/lib/menuInitialFocus.js +100 -0
- package/dist/es/lib/menuInitialFocus.js.map +1 -0
- package/dist/es/lib/menuSubmenuPlacement.js +219 -0
- package/dist/es/lib/menuSubmenuPlacement.js.map +1 -0
- package/dist/es/lib/observeTextareaWidth.js +49 -0
- package/dist/es/lib/observeTextareaWidth.js.map +1 -0
- package/dist/es/lib/selectPress.js +34 -0
- package/dist/es/lib/selectPress.js.map +1 -0
- package/dist/es/lib/sortable.js +74 -20
- package/dist/es/lib/sortable.js.map +1 -1
- package/dist/types/components/Button/Button.d.ts +6 -2
- package/dist/types/components/Button/ButtonLink.d.ts +6 -2
- package/dist/types/components/Button/NavigationButton.d.ts +27 -0
- package/dist/types/components/Button/NavigationGlyph.d.ts +16 -0
- package/dist/types/components/Button/index.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +12 -12
- package/dist/types/components/DateInput/DateInput.d.ts +4 -4
- package/dist/types/components/DatePicker/CalendarNavigationIcon.d.ts +6 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +13 -13
- package/dist/types/components/DatePicker/context.d.ts +1 -0
- package/dist/types/components/DatePicker/useCalendarGutter.d.ts +2 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -13
- package/dist/types/components/Dialog/Dialog.d.ts +46 -11
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Field/Field.d.ts +2 -2
- package/dist/types/components/FileUpload/FileUpload.d.ts +6 -6
- package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +4 -4
- package/dist/types/components/Icon/index.d.ts +1 -0
- package/dist/types/components/Icon/svg/Disclosure.d.ts +3 -0
- package/dist/types/components/Indicator/LoadingIndicator.d.ts +2 -2
- package/dist/types/components/Input/Input.d.ts +2 -2
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +8 -8
- package/dist/types/components/Menu/Menu.d.ts +18 -25
- package/dist/types/components/OTPInput/OTPInput.d.ts +6 -6
- package/dist/types/components/Page/Page.d.ts +48 -7
- package/dist/types/components/Page/index.d.ts +1 -1
- package/dist/types/components/Popover/Popover.d.ts +17 -6
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +10 -10
- package/dist/types/components/SelectControl/index.d.ts +1 -1
- package/dist/types/components/Sortable/Sortable.d.ts +8 -8
- package/dist/types/components/Switch/Switch.d.ts +34 -12
- package/dist/types/components/Tabs/Tabs.d.ts +6 -6
- package/dist/types/components/TagInput/TagInput.d.ts +4 -4
- package/dist/types/components/Textarea/Textarea.d.ts +2 -2
- package/dist/types/components/Toast/ToastRenderer.d.ts +79 -0
- package/dist/types/components/Toast/Toaster.d.ts +6 -2
- package/dist/types/components/Toast/toastLifecycle.d.ts +90 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +149 -0
- package/dist/types/components/Toolbar/index.d.ts +1 -0
- package/dist/types/components/Tooltip/CopyTooltip.d.ts +2 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/types/composables/useFloatingBoundary.d.ts +24 -0
- package/dist/types/composables/usePhoneSubmenu.d.ts +3 -0
- package/dist/types/lib/floatingBoundary.d.ts +9 -0
- package/dist/types/lib/focusRestore.d.ts +5 -0
- package/dist/types/lib/helpers.d.ts +0 -4
- package/dist/types/lib/inputMode.d.ts +7 -0
- package/dist/types/lib/menuInitialFocus.d.ts +9 -0
- package/dist/types/lib/menuSubmenuPlacement.d.ts +44 -0
- package/dist/types/lib/observeTextareaWidth.d.ts +2 -0
- package/dist/types/lib/selectPress.d.ts +23 -0
- package/dist/types/lib/sortable.d.ts +1 -1
- package/package.json +2 -2
|
@@ -22,22 +22,51 @@ export const CopyTooltip = defineComponent({
|
|
|
22
22
|
},
|
|
23
23
|
emits: {
|
|
24
24
|
/** The clipboard write settled; `copied` says whether it succeeded (React's `onCopy`). */
|
|
25
|
-
copy: (
|
|
25
|
+
copy: (copied) => typeof copied === "boolean",
|
|
26
26
|
},
|
|
27
27
|
setup(props, { slots, emit }) {
|
|
28
28
|
const open = ref(false);
|
|
29
29
|
const copied = ref(false);
|
|
30
30
|
let copiedTimer;
|
|
31
31
|
let mounted = true;
|
|
32
|
+
let copyGeneration = 0;
|
|
33
|
+
let stopPendingDismissListeners;
|
|
34
|
+
const cancelFeedback = () => {
|
|
35
|
+
copyGeneration += 1;
|
|
36
|
+
stopPendingDismissListeners?.();
|
|
37
|
+
stopPendingDismissListeners = undefined;
|
|
38
|
+
clearTimeout(copiedTimer);
|
|
39
|
+
};
|
|
32
40
|
const copy = async () => {
|
|
33
|
-
|
|
41
|
+
cancelFeedback();
|
|
42
|
+
// Success belongs to the completed attempt, not a new pending write.
|
|
43
|
+
copied.value = false;
|
|
44
|
+
const generation = copyGeneration;
|
|
45
|
+
// A touch copy can start while closed, before TooltipContent installs its
|
|
46
|
+
// dismissal listeners. Scrolling or Escape still cancels pending feedback.
|
|
47
|
+
const onKeyDown = (event) => {
|
|
48
|
+
if (event.key === "Escape")
|
|
49
|
+
cancelFeedback();
|
|
50
|
+
};
|
|
51
|
+
document.addEventListener("scroll", cancelFeedback, true);
|
|
52
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
53
|
+
stopPendingDismissListeners = () => {
|
|
54
|
+
document.removeEventListener("scroll", cancelFeedback, true);
|
|
55
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
56
|
+
};
|
|
57
|
+
// "Copied!" follows the latest successful clipboard write
|
|
34
58
|
const succeeded = await copyText(props.copyValue);
|
|
35
59
|
if (!mounted)
|
|
36
60
|
return;
|
|
37
61
|
emit("copy", succeeded);
|
|
62
|
+
if (generation !== copyGeneration)
|
|
63
|
+
return;
|
|
64
|
+
stopPendingDismissListeners?.();
|
|
65
|
+
stopPendingDismissListeners = undefined;
|
|
38
66
|
if (!succeeded)
|
|
39
67
|
return;
|
|
40
68
|
copied.value = true;
|
|
69
|
+
open.value = true;
|
|
41
70
|
// Persist the copied state for a second, then close
|
|
42
71
|
clearTimeout(copiedTimer);
|
|
43
72
|
copiedTimer = setTimeout(() => {
|
|
@@ -46,9 +75,12 @@ export const CopyTooltip = defineComponent({
|
|
|
46
75
|
};
|
|
47
76
|
onBeforeUnmount(() => {
|
|
48
77
|
mounted = false;
|
|
78
|
+
stopPendingDismissListeners?.();
|
|
49
79
|
clearTimeout(copiedTimer);
|
|
50
80
|
});
|
|
51
81
|
const handleOpenChange = (nextState) => {
|
|
82
|
+
if (!nextState)
|
|
83
|
+
cancelFeedback();
|
|
52
84
|
// When opening, ensure timer and copied state are cleared
|
|
53
85
|
if (nextState) {
|
|
54
86
|
clearTimeout(copiedTimer);
|
|
@@ -60,27 +92,21 @@ export const CopyTooltip = defineComponent({
|
|
|
60
92
|
"open": open.value,
|
|
61
93
|
"onUpdate:open": handleOpenChange,
|
|
62
94
|
"delayDuration": props.openDelay,
|
|
63
|
-
"disableHoverableContent":
|
|
95
|
+
"disableHoverableContent": copied.value,
|
|
64
96
|
}, {
|
|
65
97
|
default: () => [
|
|
66
98
|
h(TooltipTrigger, {
|
|
67
|
-
onPointerdown: (evt) => {
|
|
68
|
-
// Prevent tooltip listeners from closing
|
|
69
|
-
evt.preventDefault();
|
|
70
|
-
evt.stopPropagation();
|
|
71
|
-
// Copy the value
|
|
72
|
-
copy();
|
|
73
|
-
},
|
|
74
|
-
// Prevent default behavior of closing on click from this handler
|
|
75
99
|
onClick: (evt) => {
|
|
100
|
+
// Activate after a completed tap, not when a scrolling gesture starts.
|
|
101
|
+
// Keep the tooltip's click listener from closing the copy feedback.
|
|
76
102
|
evt.preventDefault();
|
|
77
103
|
evt.stopPropagation();
|
|
104
|
+
copy();
|
|
78
105
|
},
|
|
79
106
|
// Keyboard users copy with Enter or Space, like a click
|
|
80
107
|
onKeydown: (evt) => {
|
|
81
108
|
if (evt.key === "Enter" || evt.key === " ") {
|
|
82
109
|
evt.preventDefault();
|
|
83
|
-
open.value = true;
|
|
84
110
|
copy();
|
|
85
111
|
}
|
|
86
112
|
},
|
|
@@ -95,7 +121,7 @@ export const CopyTooltip = defineComponent({
|
|
|
95
121
|
side: props.side,
|
|
96
122
|
sideOffset: props.sideOffset,
|
|
97
123
|
collisionPadding: 15,
|
|
98
|
-
|
|
124
|
+
onClick: copy,
|
|
99
125
|
}, {
|
|
100
126
|
default: () => copied.value
|
|
101
127
|
? // The <Check /> SVG canvas whitespace is larger than copy, so we use a smaller flexbox gap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyTooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/CopyTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,GAAG,EAAiB,MAAM,KAAK,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAuC,MAAM,cAAc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kB,EAAE,EAAE;wBAChC,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;4BAC3C,GAAG,CAAC,cAAc,EAAE,CAAA;4BACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;4BACjB,IAAI,EAAE,CAAA;wBACR,CAAC;oBACH,CAAC;iBACF,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,CACrC;gBACD,kEAAkE;gBAClE,6DAA6D;gBAC7D,CAAC,CACC,cAAc,EACd;oBACE,OAAO,EAAE,IAAI;oBACb,SAAS,EAAE,CAAC,MAAM,CAAC,KAAK;oBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,gBAAgB,EAAE,EAAE;oBACpB,aAAa,EAAE,IAAI;iBACpB,EACD;oBACE,OAAO,EAAE,GAAG,EAAE,CACZ,MAAM,CAAC,KAAK;wBACV,CAAC,CAAC,2FAA2F;4BAC3F,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,2BAA2B,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;wBAC1E,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;iBACzE,CACF;aACF;SACF,CACF,CAAA;IACL,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { defineComponent, h, onBeforeUnmount, ref, type PropType } from \"vue\"\nimport { copyText } from \"../../lib/copyToClipboard.js\"\nimport { Check, Copy } from \"../Icon/index.js\"\nimport { TooltipContent, TooltipRoot, TooltipTrigger, type TooltipAlign, type TooltipSide } from \"./Tooltip.js\"\n\n// Vue port of packages/ui/src/components/Tooltip/CopyTooltip.tsx.\n\n/** Wraps a trigger (the default slot) and copies `copyValue` when it is pressed. */\nexport const CopyTooltip = defineComponent({\n name: \"CopyTooltip\",\n props: {\n /** Value to copy to the clipboard */\n copyValue: { type: String, required: true },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<TooltipAlign>, default: \"center\" },\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: { type: String as PropType<TooltipSide>, default: \"top\" },\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n },\n emits: {\n /** The clipboard write settled; `copied` says whether it succeeded (React's `onCopy`). */\n copy: (_copied: boolean) => true,\n },\n setup(props, { slots, emit }) {\n const open = ref(false)\n const copied = ref(false)\n let copiedTimer: ReturnType<typeof setTimeout> | undefined\n let mounted = true\n\n const copy = async () => {\n // \"Copied!\" follows the clipboard: a failed write keeps the tooltip as it was\n const succeeded = await copyText(props.copyValue)\n if (!mounted) return\n emit(\"copy\", succeeded)\n if (!succeeded) return\n\n copied.value = true\n\n // Persist the copied state for a second, then close\n clearTimeout(copiedTimer)\n copiedTimer = setTimeout(() => {\n open.value = false\n }, 1000)\n }\n\n onBeforeUnmount(() => {\n mounted = false\n clearTimeout(copiedTimer)\n })\n\n const handleOpenChange = (nextState: boolean) => {\n // When opening, ensure timer and copied state are cleared\n if (nextState) {\n clearTimeout(copiedTimer)\n copied.value = false\n }\n\n open.value = nextState\n }\n\n return () =>\n h(\n TooltipRoot,\n {\n \"open\": open.value,\n \"onUpdate:open\": handleOpenChange,\n \"delayDuration\": props.openDelay,\n \"disableHoverableContent\": false,\n },\n {\n default: () => [\n h(\n TooltipTrigger,\n {\n onPointerdown: (evt: PointerEvent) => {\n // Prevent tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n\n // Copy the value\n copy()\n },\n // Prevent default behavior of closing on click from this handler\n onClick: (evt: MouseEvent) => {\n evt.preventDefault()\n evt.stopPropagation()\n },\n // Keyboard users copy with Enter or Space, like a click\n onKeydown: (evt: KeyboardEvent) => {\n if (evt.key === \"Enter\" || evt.key === \" \") {\n evt.preventDefault()\n open.value = true\n copy()\n }\n },\n },\n { default: () => slots.default?.() },\n ),\n // React also passes an Escape handler here, which Tooltip.Content\n // overrides with its own; Escape closes through TooltipRoot.\n h(\n TooltipContent,\n {\n compact: true,\n clickable: !copied.value,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n collisionPadding: 15,\n onPointerdown: copy,\n },\n {\n default: () =>\n copied.value\n ? // The <Check /> SVG canvas whitespace is larger than copy, so we use a smaller flexbox gap\n h(\"div\", { class: \"flex items-center gap-0.5\" }, [h(Check), \" Copied!\"])\n : h(\"div\", { class: \"flex items-center gap-1\" }, [h(Copy), \" Copy\"]),\n },\n ),\n ],\n },\n )\n },\n})\n\nexport type CopyTooltipProps = InstanceType<typeof CopyTooltip>[\"$props\"]\n"]}
|
|
1
|
+
{"version":3,"file":"CopyTooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/CopyTooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,GAAG,EAAiB,MAAM,KAAK,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAuC,MAAM,cAAc,CAAA;AAE/G,kEAAkE;AAElE,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;IACzC,IAAI,EAAE,aAAa;IAC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C,cAAc,EACd;oBACE,OAAO,EAAE,IAAI;oBACb,SAAS,EAAE,CAAC,MAAM,CAAC,KAAK;oBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,gBAAgB,EAAE,EAAE;oBACpB,OAAO,EAAE,IAAI;iBACd,EACD;oBACE,OAAO,EAAE,GAAG,EAAE,CACZ,MAAM,CAAC,KAAK;wBACV,CAAC,CAAC,2FAA2F;4BAC3F,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,2BAA2B,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;wBAC1E,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;iBACzE,CACF;aACF;SACF,CACF,CAAA;IACL,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { defineComponent, h, onBeforeUnmount, ref, type PropType } from \"vue\"\nimport { copyText } from \"../../lib/copyToClipboard.js\"\nimport { Check, Copy } from \"../Icon/index.js\"\nimport { TooltipContent, TooltipRoot, TooltipTrigger, type TooltipAlign, type TooltipSide } from \"./Tooltip.js\"\n\n// Vue port of packages/ui/src/components/Tooltip/CopyTooltip.tsx.\n\n/** Wraps a trigger (the default slot) and copies `copyValue` when it is pressed. */\nexport const CopyTooltip = defineComponent({\n name: \"CopyTooltip\",\n props: {\n /** Value to copy to the clipboard */\n copyValue: { type: String, required: true },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<TooltipAlign>, default: \"center\" },\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: { type: String as PropType<TooltipSide>, default: \"top\" },\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n },\n emits: {\n /** The clipboard write settled; `copied` says whether it succeeded (React's `onCopy`). */\n copy: (copied: boolean) => typeof copied === \"boolean\",\n },\n setup(props, { slots, emit }) {\n const open = ref(false)\n const copied = ref(false)\n let copiedTimer: ReturnType<typeof setTimeout> | undefined\n let mounted = true\n let copyGeneration = 0\n let stopPendingDismissListeners: (() => void) | undefined\n\n const cancelFeedback = () => {\n copyGeneration += 1\n stopPendingDismissListeners?.()\n stopPendingDismissListeners = undefined\n clearTimeout(copiedTimer)\n }\n\n const copy = async () => {\n cancelFeedback()\n // Success belongs to the completed attempt, not a new pending write.\n copied.value = false\n const generation = copyGeneration\n // A touch copy can start while closed, before TooltipContent installs its\n // dismissal listeners. Scrolling or Escape still cancels pending feedback.\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") cancelFeedback()\n }\n document.addEventListener(\"scroll\", cancelFeedback, true)\n document.addEventListener(\"keydown\", onKeyDown, true)\n stopPendingDismissListeners = () => {\n document.removeEventListener(\"scroll\", cancelFeedback, true)\n document.removeEventListener(\"keydown\", onKeyDown, true)\n }\n // \"Copied!\" follows the latest successful clipboard write\n const succeeded = await copyText(props.copyValue)\n if (!mounted) return\n emit(\"copy\", succeeded)\n if (generation !== copyGeneration) return\n stopPendingDismissListeners?.()\n stopPendingDismissListeners = undefined\n if (!succeeded) return\n\n copied.value = true\n open.value = true\n\n // Persist the copied state for a second, then close\n clearTimeout(copiedTimer)\n copiedTimer = setTimeout(() => {\n open.value = false\n }, 1000)\n }\n\n onBeforeUnmount(() => {\n mounted = false\n stopPendingDismissListeners?.()\n clearTimeout(copiedTimer)\n })\n\n const handleOpenChange = (nextState: boolean) => {\n if (!nextState) cancelFeedback()\n // When opening, ensure timer and copied state are cleared\n if (nextState) {\n clearTimeout(copiedTimer)\n copied.value = false\n }\n\n open.value = nextState\n }\n\n return () =>\n h(\n TooltipRoot,\n {\n \"open\": open.value,\n \"onUpdate:open\": handleOpenChange,\n \"delayDuration\": props.openDelay,\n \"disableHoverableContent\": copied.value,\n },\n {\n default: () => [\n h(\n TooltipTrigger,\n {\n onClick: (evt: MouseEvent) => {\n // Activate after a completed tap, not when a scrolling gesture starts.\n // Keep the tooltip's click listener from closing the copy feedback.\n evt.preventDefault()\n evt.stopPropagation()\n copy()\n },\n // Keyboard users copy with Enter or Space, like a click\n onKeydown: (evt: KeyboardEvent) => {\n if (evt.key === \"Enter\" || evt.key === \" \") {\n evt.preventDefault()\n copy()\n }\n },\n },\n { default: () => slots.default?.() },\n ),\n // React also passes an Escape handler here, which Tooltip.Content\n // overrides with its own; Escape closes through TooltipRoot.\n h(\n TooltipContent,\n {\n compact: true,\n clickable: !copied.value,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n collisionPadding: 15,\n onClick: copy,\n },\n {\n default: () =>\n copied.value\n ? // The <Check /> SVG canvas whitespace is larger than copy, so we use a smaller flexbox gap\n h(\"div\", { class: \"flex items-center gap-0.5\" }, [h(Check), \" Copied!\"])\n : h(\"div\", { class: \"flex items-center gap-1\" }, [h(Copy), \" Copy\"]),\n },\n ),\n ],\n },\n )\n },\n})\n\nexport type CopyTooltipProps = InstanceType<typeof CopyTooltip>[\"$props\"]\n"]}
|
|
@@ -3,6 +3,7 @@ import { TooltipContent as RekaTooltipContent, TooltipPortal as RekaTooltipPorta
|
|
|
3
3
|
import { useEscCloseStack } from "../../composables/useEscCloseStack.js";
|
|
4
4
|
import { preventDefaultHandler } from "../../lib/helpers.js";
|
|
5
5
|
import { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from "./slot.js";
|
|
6
|
+
import { isHoverPointer } from "../../lib/inputMode.js";
|
|
6
7
|
import s from "@plexui/styles/components/Tooltip/Tooltip.module.css";
|
|
7
8
|
const TOOLTIP_OPEN = "tooltip.open";
|
|
8
9
|
// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)
|
|
@@ -77,7 +78,7 @@ export const TooltipRoot = defineComponent({
|
|
|
77
78
|
disableHoverableContent: { type: Boolean, default: undefined },
|
|
78
79
|
},
|
|
79
80
|
emits: {
|
|
80
|
-
"update:open": (
|
|
81
|
+
"update:open": (open) => typeof open === "boolean",
|
|
81
82
|
},
|
|
82
83
|
setup(props, { slots, emit }) {
|
|
83
84
|
const hooks = { onOpen: () => { }, onClose: () => { } };
|
|
@@ -128,36 +129,52 @@ export const TooltipTrigger = defineComponent({
|
|
|
128
129
|
const contentIdProp = inject(ContentIdKey, undefined);
|
|
129
130
|
let isPointerDown = false;
|
|
130
131
|
let hasPointerMoveOpened = false;
|
|
131
|
-
|
|
132
|
+
let pointerDocument;
|
|
133
|
+
const handlePointerEnd = () => {
|
|
132
134
|
isPointerDown = false;
|
|
135
|
+
pointerDocument?.removeEventListener("pointerup", handlePointerEnd);
|
|
136
|
+
pointerDocument?.removeEventListener("pointercancel", handlePointerEnd);
|
|
137
|
+
pointerDocument = undefined;
|
|
133
138
|
};
|
|
134
|
-
onBeforeUnmount(
|
|
139
|
+
onBeforeUnmount(handlePointerEnd);
|
|
135
140
|
// Radix's TooltipTrigger handlers
|
|
136
141
|
const handlers = {
|
|
137
142
|
onPointermove: (event) => {
|
|
138
|
-
if (event
|
|
143
|
+
if (!isHoverPointer(event))
|
|
139
144
|
return;
|
|
140
145
|
if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {
|
|
141
146
|
rootContext.onTriggerEnter();
|
|
142
147
|
hasPointerMoveOpened = true;
|
|
143
148
|
}
|
|
144
149
|
},
|
|
145
|
-
onPointerleave: () => {
|
|
150
|
+
onPointerleave: (event) => {
|
|
151
|
+
if (!isHoverPointer(event))
|
|
152
|
+
return;
|
|
146
153
|
rootContext.onTriggerLeave();
|
|
147
154
|
hasPointerMoveOpened = false;
|
|
148
155
|
},
|
|
149
|
-
onPointerdown: () => {
|
|
156
|
+
onPointerdown: (event) => {
|
|
157
|
+
handlePointerEnd();
|
|
150
158
|
if (rootContext.open.value) {
|
|
151
159
|
rootContext.onClose();
|
|
152
160
|
}
|
|
153
161
|
isPointerDown = true;
|
|
154
|
-
|
|
162
|
+
pointerDocument = event.currentTarget.ownerDocument;
|
|
163
|
+
pointerDocument.addEventListener("pointerup", handlePointerEnd, { once: true });
|
|
164
|
+
pointerDocument.addEventListener("pointercancel", handlePointerEnd, { once: true });
|
|
155
165
|
},
|
|
156
|
-
onFocus: () => {
|
|
157
|
-
if (!isPointerDown)
|
|
166
|
+
onFocus: (event) => {
|
|
167
|
+
if (!isPointerDown && !event.currentTarget.hasAttribute("data-menu-pointer-focus")) {
|
|
158
168
|
rootContext.onOpen();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
onBlur: (event) => {
|
|
172
|
+
// Clipboard fallback borrows focus synchronously, then restores it.
|
|
173
|
+
const nextTarget = event.relatedTarget;
|
|
174
|
+
if (nextTarget instanceof Element && nextTarget.hasAttribute("data-plex-clipboard-fallback"))
|
|
175
|
+
return;
|
|
176
|
+
rootContext.onClose();
|
|
159
177
|
},
|
|
160
|
-
onBlur: () => rootContext.onClose(),
|
|
161
178
|
onClick: () => rootContext.onClose(),
|
|
162
179
|
};
|
|
163
180
|
return () => {
|
|
@@ -192,7 +209,9 @@ const TooltipContentElement = markRaw(defineComponent({
|
|
|
192
209
|
const content = inject(ContentChildrenKey);
|
|
193
210
|
const contentIdProp = inject(ContentIdKey, undefined);
|
|
194
211
|
return () => {
|
|
195
|
-
const {
|
|
212
|
+
const { style, ...rest } = attrs;
|
|
213
|
+
delete rest.dir;
|
|
214
|
+
delete rest.id;
|
|
196
215
|
const ariaLabel = content.ariaLabel();
|
|
197
216
|
const contentId = contentIdProp?.value ?? (rootContext.contentId || undefined);
|
|
198
217
|
return h("div", {
|
|
@@ -249,7 +268,9 @@ export const TooltipContent = defineComponent({
|
|
|
249
268
|
});
|
|
250
269
|
}
|
|
251
270
|
return () => {
|
|
252
|
-
const { class: className, style,
|
|
271
|
+
const { class: className, style, ...restProps } = attrs;
|
|
272
|
+
delete restProps["aria-label"];
|
|
273
|
+
delete restProps.id;
|
|
253
274
|
return h(RekaTooltipPortal, null, {
|
|
254
275
|
default: () => h(RekaTooltipContent, {
|
|
255
276
|
...restProps,
|
|
@@ -339,8 +360,8 @@ const TooltipComponent = defineComponent({
|
|
|
339
360
|
contentClassName: String,
|
|
340
361
|
},
|
|
341
362
|
emits: {
|
|
342
|
-
pointerdown: (
|
|
343
|
-
click: (
|
|
363
|
+
pointerdown: (event) => typeof event.type === "string",
|
|
364
|
+
click: (event) => typeof event.type === "string",
|
|
344
365
|
},
|
|
345
366
|
setup(props, { slots, attrs, emit }) {
|
|
346
367
|
const visible = ref(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,OAAO,EACP,cAAc,EACd,eAAe,EACf,OAAO,EACP,GAAG,EACH,KAAK,GAMN,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,cAAc,IAAI,kBAAkB,EACpC,aAAa,IAAI,iBAAiB,EAClC,eAAe,IAAI,mBAAmB,EACtC,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,kBAAkB,EACpC,4BAA4B,EAC5B,wBAAwB,EACxB,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACv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BAC9B,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CACrE;iBACF;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF;;;GAGG;AACH,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,OAAO,GAKhB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAClC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,uBAAuB;CAC1C,CAAC,CAAA","sourcesContent":["import {\n Text,\n computed,\n defineComponent,\n h,\n inject,\n markRaw,\n normalizeStyle,\n onBeforeUnmount,\n provide,\n ref,\n watch,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport {\n TooltipContent as RekaTooltipContent,\n TooltipPortal as RekaTooltipPortal,\n TooltipProvider as RekaTooltipProvider,\n TooltipRoot as RekaTooltipRoot,\n TooltipTrigger as RekaTooltipTrigger,\n injectTooltipProviderContext,\n injectTooltipRootContext,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { preventDefaultHandler } from \"../../lib/helpers.js\"\nimport { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from \"./slot.js\"\nimport s from \"@plexui/styles/components/Tooltip/Tooltip.module.css\"\n\n// Vue port of packages/ui/src/components/Tooltip/Tooltip.tsx on Reka UI.\n// Exports are flat (`TooltipRoot`, `TooltipTrigger`, ...) because\n// runtime-compiled templates cannot resolve `Tooltip.Root`; the static\n// properties are kept for render functions and SFCs.\n//\n// Reka keeps the open/close timers, the provider's skip delay, positioning,\n// the dismissable layer and the hover grace area. Where Radix and Reka\n// differ, the port follows Radix so the DOM and behaviour match React:\n// - Triggers run their handlers after the child's and skip them when one\n// called preventDefault() (Radix's composeEventHandlers). Reka's trigger\n// listeners are switched off (`disabled`) and re-implemented here.\n// - Radix tells the provider about open changes (skip delay, the\n// \"tooltip.open\" event that closes other tooltips) only when the tooltip\n// asks for one; Reka also does it for any change of the `open` prop, which\n// Plex uses to close on Escape and after a copy.\n// - The state attribute is computed when `open` changes, as Radix memoizes it.\n// - The content element is rendered here (Reka's `as`) the radix-ui 1.8 way:\n// it is the `role=\"tooltip\"` element itself, without the visually hidden\n// copy of the text Reka adds; an `id` on the content becomes the id the\n// trigger points at, and only an `aria-label` gets a visually hidden\n// element. Radix's custom property names, no `dir` and no\n// `data-grace-area-trigger`.\n\nexport type TooltipSide = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type TooltipAlign = \"start\" | \"center\" | \"end\"\nexport type TooltipGutterSize = \"sm\" | \"md\" | \"lg\"\ntype StateAttribute = \"closed\" | \"delayed-open\" | \"instant-open\"\n\nconst TOOLTIP_OPEN = \"tooltip.open\"\n\n// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)\nconst VISUALLY_HIDDEN_STYLE = {\n position: \"absolute\",\n border: \"0\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\",\n}\n\n/** React adds `px` to unitless numbers in style objects; Vue does not. */\nconst toCssLength = (value: number | string | undefined) => (typeof value === \"number\" ? `${value}px` : value)\n\n/**\n * The content custom properties under Radix's names (`--radix-tooltip-*`,\n * `--radix-popover-*`), which the shared CSS reads. They still point at the\n * `--reka-popper-*` values Reka sets on its positioning wrapper.\n */\nexport const withRadixVariableNames = (style: unknown, part: string) => {\n const from = `--reka-${part}-`\n const result: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(normalizeStyle([style]) as Record<string, unknown>)) {\n result[key.startsWith(from) ? `--radix-${part}-${key.slice(from.length)}` : key] = value\n }\n return result\n}\n\ntype ProviderHooks = { onOpen: () => void; onClose: () => void }\n\n// The content's own `id`, which Radix uses as the content id (Reka's\n// `contentId` is a plain string the trigger reads once)\nconst ContentIdKey: InjectionKey<Ref<string | undefined>> = Symbol(\"PlexUITooltipContentId\")\n\nconst REKA_PROVIDER_HOOKS = Symbol(\"rekaProviderHooks\")\nconst REKA_STATE = Symbol(\"rekaStateAttribute\")\n\n// Rendered inside Reka's root: adjusts the provider and root contexts the\n// Radix way (see the notes at the top).\nconst TooltipContextBridge = defineComponent({\n name: \"TooltipContextBridge\",\n props: {\n hooks: { type: Object as PropType<ProviderHooks>, required: true },\n },\n setup(props, { slots }) {\n // Reka's originals are kept on the contexts, so a second setup against\n // the same provider and root (a remount, HMR) still finds them\n const providerContext = injectTooltipProviderContext() as ReturnType<typeof injectTooltipProviderContext> & {\n [REKA_PROVIDER_HOOKS]?: ProviderHooks\n }\n const rekaHooks = (providerContext[REKA_PROVIDER_HOOKS] ??= {\n onOpen: providerContext.onOpen,\n onClose: providerContext.onClose,\n })\n props.hooks.onOpen = rekaHooks.onOpen\n props.hooks.onClose = rekaHooks.onClose\n // Reka's root skips its own provider calls when there is no `onClose`\n ;(providerContext as { onClose?: () => void }).onClose = undefined\n\n const rootContext = injectTooltipRootContext() as ReturnType<typeof injectTooltipRootContext> & {\n [REKA_STATE]?: Ref<StateAttribute>\n }\n const rekaState = (rootContext[REKA_STATE] ??= rootContext.stateAttribute)\n const state = ref<StateAttribute>(rekaState.value)\n watch(\n () => rootContext.open.value,\n () => {\n state.value = rekaState.value\n },\n { flush: \"sync\" },\n )\n rootContext.stateAttribute = computed(() => state.value) as unknown as Ref<StateAttribute>\n\n return () => slots.default?.()\n },\n})\n\n/** Low-level tooltip root (`Tooltip.Root` in React). Always controlled: bind `v-model:open`. */\nexport const TooltipRoot = defineComponent({\n name: \"TooltipRoot\",\n props: {\n open: { type: Boolean, required: true },\n /** Delay before the tooltip opens on hover, in milliseconds. @default 700 */\n delayDuration: Number,\n /** Closes the tooltip as soon as the pointer leaves the trigger. @default false */\n disableHoverableContent: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (_open: boolean) => true,\n },\n setup(props, { slots, emit }) {\n const hooks: ProviderHooks = { onOpen: () => {}, onClose: () => {} }\n const onOpenChange = (nextState: boolean) => emit(\"update:open\", nextState)\n provide(ContentIdKey, ref<string>())\n\n useEscCloseStack(\n () => props.open,\n () => onOpenChange(false),\n )\n\n // Radix's controlled state: only real changes are reported\n const handleOpenChange = (nextState: boolean) => {\n if (nextState === props.open) return\n if (nextState) {\n hooks.onOpen()\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))\n } else {\n hooks.onClose()\n }\n onOpenChange(nextState)\n }\n\n return () =>\n h(RekaTooltipProvider, null, {\n default: () =>\n h(\n RekaTooltipRoot,\n {\n \"open\": props.open,\n \"delayDuration\": props.delayDuration,\n \"disableHoverableContent\": props.disableHoverableContent,\n // The trigger listeners are this port's (TooltipTrigger)\n \"disabled\": true,\n \"onUpdate:open\": handleOpenChange,\n },\n { default: () => h(TooltipContextBridge, { hooks }, { default: () => slots.default?.() }) },\n ),\n })\n },\n})\n\n/**\n * Low-level trigger (`Tooltip.Trigger` in React). Renders its child with the\n * tooltip wiring merged in; `as-child=\"false\"` renders a `<button>` instead.\n */\nexport const TooltipTrigger = defineComponent({\n name: \"TooltipTrigger\",\n inheritAttrs: false,\n props: {\n /** Merges into the child instead of rendering a `<button>`. @default true */\n asChild: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n const rootContext = injectTooltipRootContext()\n const providerContext = injectTooltipProviderContext()\n // Set before the first render, which describes the trigger by it\n rootContext.contentId ||= useId(undefined, \"reka-tooltip-content\")\n const contentIdProp = inject(ContentIdKey, undefined)\n let isPointerDown = false\n let hasPointerMoveOpened = false\n\n const handlePointerUp = () => {\n isPointerDown = false\n }\n onBeforeUnmount(() => document.removeEventListener(\"pointerup\", handlePointerUp))\n\n // Radix's TooltipTrigger handlers\n const handlers: Record<string, (event: Event) => void> = {\n onPointermove: (event) => {\n if ((event as PointerEvent).pointerType === \"touch\") return\n if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {\n rootContext.onTriggerEnter()\n hasPointerMoveOpened = true\n }\n },\n onPointerleave: () => {\n rootContext.onTriggerLeave()\n hasPointerMoveOpened = false\n },\n onPointerdown: () => {\n if (rootContext.open.value) {\n rootContext.onClose()\n }\n isPointerDown = true\n document.addEventListener(\"pointerup\", handlePointerUp, { once: true })\n },\n onFocus: () => {\n if (!isPointerDown) rootContext.onOpen()\n },\n onBlur: () => rootContext.onClose(),\n onClick: () => rootContext.onClose(),\n }\n\n return () => {\n const child = props.asChild ? firstElementChild(slots.default?.()) : h(\"button\", null, slots.default?.())\n if (!child) return null\n\n const contentId = contentIdProp?.value ?? rootContext.contentId\n const triggerProps: Record<string, unknown> = {\n ...attrs,\n // Radix adds the content id to the trigger's own while open (the\n // child's own ids come first, as in Radix's Slot)\n \"aria-describedby\": rootContext.open.value\n ? concatAriaDescribedby(attrs[\"aria-describedby\"], contentId)\n : attrs[\"aria-describedby\"],\n \"data-grace-area-trigger\": undefined,\n }\n for (const [key, handler] of Object.entries(handlers)) {\n triggerProps[key] = composeEventHandlers(attrs[key], handler)\n }\n\n return h(RekaTooltipTrigger, { asChild: true }, { default: () => mergeSlotProps(child, triggerProps) })\n }\n },\n})\n\ntype ContentChildren = {\n render: () => VNodeArrayChildren | undefined\n ariaLabel: () => unknown\n}\n\nconst ContentChildrenKey: InjectionKey<ContentChildren> = Symbol(\"PlexUITooltipContent\")\n\n// The element Reka's content renders (`as`), in place of Reka's visually\n// hidden copy of the text. Raw, as Reka may pass `as` through reactive props.\nconst TooltipContentElement = markRaw(defineComponent({\n name: \"TooltipContentElement\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const rootContext = injectTooltipRootContext()\n const content = inject(ContentChildrenKey)!\n const contentIdProp = inject(ContentIdKey, undefined)\n\n return () => {\n const { dir: _dir, style, id: _id, ...rest } = attrs\n const ariaLabel = content.ariaLabel() as string | undefined\n const contentId = contentIdProp?.value ?? (rootContext.contentId || undefined)\n return h(\n \"div\",\n {\n role: ariaLabel ? undefined : \"tooltip\",\n id: ariaLabel ? undefined : contentId,\n ...rest,\n style: withRadixVariableNames(style, \"tooltip\"),\n },\n [\n content.render(),\n ariaLabel ? h(\"span\", { id: contentId, role: \"tooltip\", style: VISUALLY_HIDDEN_STYLE }, ariaLabel) : null,\n ],\n )\n }\n },\n}))\n\nconst sideProp = String as PropType<TooltipSide>\nconst alignProp = String as PropType<TooltipAlign>\nconst gutterSizeProp = { type: String as PropType<TooltipGutterSize>, default: \"md\" }\nconst maxWidthProp = { type: [Number, String] as PropType<number | \"none\">, default: 300 }\n\n/** Low-level content (`Tooltip.Content` in React). `class` lands on the tooltip. */\nexport const TooltipContent = defineComponent({\n name: \"TooltipContent\",\n inheritAttrs: false,\n props: {\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Whether the tooltip content responds to clicks */\n clickable: { type: Boolean, default: undefined },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n },\n setup(props, { slots, attrs }) {\n provide(ContentChildrenKey, {\n render: () => slots.default?.(),\n ariaLabel: () => attrs[\"aria-label\"],\n })\n\n // Radix's content `id` replaces the generated content id while mounted\n const contentIdProp = inject(ContentIdKey, undefined)\n if (contentIdProp) {\n watch(\n () => attrs.id as string | undefined,\n (id) => {\n contentIdProp.value = id || undefined\n },\n { immediate: true },\n )\n onBeforeUnmount(() => {\n contentIdProp.value = undefined\n })\n }\n\n return () => {\n const { class: className, style, \"aria-label\": _ariaLabel, id: _id, ...restProps } = attrs\n\n return h(RekaTooltipPortal, null, {\n default: () =>\n h(\n RekaTooltipContent,\n {\n ...restProps,\n \"as\": TooltipContentElement,\n \"side\": props.side,\n \"align\": props.align,\n \"class\": [s.Tooltip, className],\n \"data-compact\": String(props.compact),\n \"data-clickable\": props.clickable === undefined ? undefined : String(props.clickable),\n \"data-gutter-size\": props.gutterSize,\n \"alignOffset\": props.alignOffset,\n \"sideOffset\": props.sideOffset,\n \"collisionPadding\": 15,\n \"hideWhenDetached\": true,\n \"style\": [style, { maxWidth: toCssLength(props.maxWidth) }],\n // Escape is handled by the Escape stack in TooltipRoot\n \"onEscapeKeyDown\": preventDefaultHandler,\n },\n // Rendered by TooltipContentElement from the injected slot\n { default: () => [] },\n ),\n })\n }\n },\n})\n\nconst isPlainText = (nodes: VNode[]) => nodes.length === 1 && nodes[0]!.type === Text\n\n/**\n * Optional trigger wrapper (`Tooltip.TriggerDecorator` in React) for content\n * that is not accessible or visibly interactive on its own. Plain text is\n * wrapped in a focusable `<span>`; an element child gets the props merged in.\n */\nexport const TooltipTriggerDecorator = defineComponent({\n name: \"TooltipTriggerDecorator\",\n inheritAttrs: false,\n props: {\n /** Applies `tabindex=\"0\"` to the trigger. @default true */\n focusable: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n return () => {\n const { class: className, ...restProps } = attrs\n const slotProps = {\n ...restProps,\n class: [s.TriggerDecorator, className],\n tabindex: props.focusable ? 0 : undefined,\n }\n const children = flattenSlot(slots.default?.())\n\n if (isPlainText(children)) {\n return h(\"span\", slotProps, String(children[0]!.children ?? \"\"))\n }\n\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n }\n },\n})\n\nconst TooltipComponent = defineComponent({\n name: \"Tooltip\",\n inheritAttrs: false,\n props: {\n /**\n * The content of the tooltip (or the `#content` slot). `null` renders no\n * tooltip.\n */\n content: { type: [String, Number, Object] as PropType<string | number | VNode | null>, default: undefined },\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Forces the tooltip to remain open or closed */\n forceOpen: { type: Boolean, default: undefined },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** The tooltip has interactive content and stays open while hovered. @default false */\n interactive: { type: Boolean, default: false },\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Keeps the tooltip open when the trigger is clicked right after it opened. @default false */\n preventUnintentionalClickToClose: { type: Boolean, default: undefined },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n /** Class applied to the tooltip content */\n contentClassName: String,\n },\n emits: {\n pointerdown: (_event: PointerEvent) => true,\n click: (_event: MouseEvent) => true,\n },\n setup(props, { slots, attrs, emit }) {\n const visible = ref(false)\n const temporarilyPreventClickToClose = ref(false)\n\n watch(temporarilyPreventClickToClose, (prevent, _, onCleanup) => {\n if (!prevent) return\n const id = setTimeout(() => {\n temporarilyPreventClickToClose.value = false\n }, 400)\n onCleanup(() => clearTimeout(id))\n })\n\n const hasContent = () => !(props.content === null && !slots.content)\n const forceOpen = () => props.forceOpen ?? (hasContent() ? undefined : false)\n\n const handleOpenChange = (nextState: boolean) => {\n // When forceOpen is passed, don't manage internal state\n if (typeof forceOpen() === \"boolean\") return\n\n visible.value = nextState\n\n if (props.preventUnintentionalClickToClose) {\n temporarilyPreventClickToClose.value = nextState\n }\n }\n\n const maybePreventClickClose = (evt: Event) => {\n if (props.preventUnintentionalClickToClose && temporarilyPreventClickToClose.value) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const onPointerdown = (evt: PointerEvent) => {\n maybePreventClickClose(evt)\n emit(\"pointerdown\", evt)\n }\n\n const onClick = (evt: MouseEvent) => {\n maybePreventClickClose(evt)\n emit(\"click\", evt)\n }\n\n return () => {\n const child = firstElementChild(slots.default?.())\n\n return h(\n TooltipRoot,\n {\n \"open\": forceOpen() ?? visible.value,\n \"delayDuration\": props.openDelay,\n \"onUpdate:open\": handleOpenChange,\n \"disableHoverableContent\": !props.interactive,\n },\n {\n default: () => [\n h(TooltipTrigger, null, {\n default: () => (child ? mergeSlotProps(child, { ...attrs, onPointerdown, onClick }) : null),\n }),\n h(\n TooltipContent,\n {\n maxWidth: props.maxWidth,\n compact: props.compact,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n gutterSize: props.gutterSize,\n class: props.contentClassName,\n },\n { default: () => (slots.content ? slots.content() : props.content) },\n ),\n ],\n },\n )\n }\n },\n})\n\n/**\n * Tooltip for any trigger element (the default slot). Content comes from the\n * `content` prop or the `#content` slot; `null` disables the tooltip.\n */\n// Typed explicitly so the published declaration refers to the parts instead of\n// expanding them (an expanded component type fails consumers' type checks)\nexport const Tooltip: typeof TooltipComponent & {\n Root: typeof TooltipRoot\n Content: typeof TooltipContent\n Trigger: typeof TooltipTrigger\n TriggerDecorator: typeof TooltipTriggerDecorator\n} = Object.assign(TooltipComponent, {\n Root: TooltipRoot,\n Content: TooltipContent,\n Trigger: TooltipTrigger,\n TriggerDecorator: TooltipTriggerDecorator,\n})\n\nexport type TooltipProps = InstanceType<typeof TooltipComponent>[\"$props\"]\n"]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.ts"],"names":[],"mappings":"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,KAAK,CAAC,KAAK;wBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;wBAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK,EAAE,KAAK,CAAC,gBAAgB;qBAC9B,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CACrE;iBACF;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF;;;GAGG;AACH,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,OAAO,GAKhB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAClC,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,uBAAuB;CAC1C,CAAC,CAAA","sourcesContent":["import {\n Text,\n computed,\n defineComponent,\n h,\n inject,\n markRaw,\n normalizeStyle,\n onBeforeUnmount,\n provide,\n ref,\n watch,\n type InjectionKey,\n type PropType,\n type Ref,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport {\n TooltipContent as RekaTooltipContent,\n TooltipPortal as RekaTooltipPortal,\n TooltipProvider as RekaTooltipProvider,\n TooltipRoot as RekaTooltipRoot,\n TooltipTrigger as RekaTooltipTrigger,\n injectTooltipProviderContext,\n injectTooltipRootContext,\n useId,\n} from \"reka-ui\"\nimport { useEscCloseStack } from \"../../composables/useEscCloseStack.js\"\nimport { preventDefaultHandler } from \"../../lib/helpers.js\"\nimport { composeEventHandlers, concatAriaDescribedby, firstElementChild, flattenSlot, mergeSlotProps } from \"./slot.js\"\nimport { isHoverPointer } from \"../../lib/inputMode.js\"\nimport s from \"@plexui/styles/components/Tooltip/Tooltip.module.css\"\n\n// Vue port of packages/ui/src/components/Tooltip/Tooltip.tsx on Reka UI.\n// Exports are flat (`TooltipRoot`, `TooltipTrigger`, ...) because\n// runtime-compiled templates cannot resolve `Tooltip.Root`; the static\n// properties are kept for render functions and SFCs.\n//\n// Reka keeps the open/close timers, the provider's skip delay, positioning,\n// the dismissable layer and the hover grace area. Where Radix and Reka\n// differ, the port follows Radix so the DOM and behaviour match React:\n// - Triggers run their handlers after the child's and skip them when one\n// called preventDefault() (Radix's composeEventHandlers). Reka's trigger\n// listeners are switched off (`disabled`) and re-implemented here.\n// - Radix tells the provider about open changes (skip delay, the\n// \"tooltip.open\" event that closes other tooltips) only when the tooltip\n// asks for one; Reka also does it for any change of the `open` prop, which\n// Plex uses to close on Escape and after a copy.\n// - The state attribute is computed when `open` changes, as Radix memoizes it.\n// - The content element is rendered here (Reka's `as`) the radix-ui 1.8 way:\n// it is the `role=\"tooltip\"` element itself, without the visually hidden\n// copy of the text Reka adds; an `id` on the content becomes the id the\n// trigger points at, and only an `aria-label` gets a visually hidden\n// element. Radix's custom property names, no `dir` and no\n// `data-grace-area-trigger`.\n\nexport type TooltipSide = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type TooltipAlign = \"start\" | \"center\" | \"end\"\nexport type TooltipGutterSize = \"sm\" | \"md\" | \"lg\"\ntype StateAttribute = \"closed\" | \"delayed-open\" | \"instant-open\"\n\nconst TOOLTIP_OPEN = \"tooltip.open\"\n\n// Radix's VisuallyHidden styles (Reka's add clip-path, top and left)\nconst VISUALLY_HIDDEN_STYLE = {\n position: \"absolute\",\n border: \"0\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\",\n}\n\n/** React adds `px` to unitless numbers in style objects; Vue does not. */\nconst toCssLength = (value: number | string | undefined) => (typeof value === \"number\" ? `${value}px` : value)\n\n/**\n * The content custom properties under Radix's names (`--radix-tooltip-*`,\n * `--radix-popover-*`), which the shared CSS reads. They still point at the\n * `--reka-popper-*` values Reka sets on its positioning wrapper.\n */\nexport const withRadixVariableNames = (style: unknown, part: string) => {\n const from = `--reka-${part}-`\n const result: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(normalizeStyle([style]) as Record<string, unknown>)) {\n result[key.startsWith(from) ? `--radix-${part}-${key.slice(from.length)}` : key] = value\n }\n return result\n}\n\ntype ProviderHooks = { onOpen: () => void; onClose: () => void }\n\n// The content's own `id`, which Radix uses as the content id (Reka's\n// `contentId` is a plain string the trigger reads once)\nconst ContentIdKey: InjectionKey<Ref<string | undefined>> = Symbol(\"PlexUITooltipContentId\")\n\nconst REKA_PROVIDER_HOOKS = Symbol(\"rekaProviderHooks\")\nconst REKA_STATE = Symbol(\"rekaStateAttribute\")\n\n// Rendered inside Reka's root: adjusts the provider and root contexts the\n// Radix way (see the notes at the top).\nconst TooltipContextBridge = defineComponent({\n name: \"TooltipContextBridge\",\n props: {\n hooks: { type: Object as PropType<ProviderHooks>, required: true },\n },\n setup(props, { slots }) {\n // Reka's originals are kept on the contexts, so a second setup against\n // the same provider and root (a remount, HMR) still finds them\n const providerContext = injectTooltipProviderContext() as ReturnType<typeof injectTooltipProviderContext> & {\n [REKA_PROVIDER_HOOKS]?: ProviderHooks\n }\n const rekaHooks = (providerContext[REKA_PROVIDER_HOOKS] ??= {\n onOpen: providerContext.onOpen,\n onClose: providerContext.onClose,\n })\n props.hooks.onOpen = rekaHooks.onOpen\n props.hooks.onClose = rekaHooks.onClose\n // Reka's root skips its own provider calls when there is no `onClose`\n ;(providerContext as { onClose?: () => void }).onClose = undefined\n\n const rootContext = injectTooltipRootContext() as ReturnType<typeof injectTooltipRootContext> & {\n [REKA_STATE]?: Ref<StateAttribute>\n }\n const rekaState = (rootContext[REKA_STATE] ??= rootContext.stateAttribute)\n const state = ref<StateAttribute>(rekaState.value)\n watch(\n () => rootContext.open.value,\n () => {\n state.value = rekaState.value\n },\n { flush: \"sync\" },\n )\n rootContext.stateAttribute = computed(() => state.value) as unknown as Ref<StateAttribute>\n\n return () => slots.default?.()\n },\n})\n\n/** Low-level tooltip root (`Tooltip.Root` in React). Always controlled: bind `v-model:open`. */\nexport const TooltipRoot = defineComponent({\n name: \"TooltipRoot\",\n props: {\n open: { type: Boolean, required: true },\n /** Delay before the tooltip opens on hover, in milliseconds. @default 700 */\n delayDuration: Number,\n /** Closes the tooltip as soon as the pointer leaves the trigger. @default false */\n disableHoverableContent: { type: Boolean, default: undefined },\n },\n emits: {\n \"update:open\": (open: boolean) => typeof open === \"boolean\",\n },\n setup(props, { slots, emit }) {\n const hooks: ProviderHooks = { onOpen: () => {}, onClose: () => {} }\n const onOpenChange = (nextState: boolean) => emit(\"update:open\", nextState)\n provide(ContentIdKey, ref<string>())\n\n useEscCloseStack(\n () => props.open,\n () => onOpenChange(false),\n )\n\n // Radix's controlled state: only real changes are reported\n const handleOpenChange = (nextState: boolean) => {\n if (nextState === props.open) return\n if (nextState) {\n hooks.onOpen()\n document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))\n } else {\n hooks.onClose()\n }\n onOpenChange(nextState)\n }\n\n return () =>\n h(RekaTooltipProvider, null, {\n default: () =>\n h(\n RekaTooltipRoot,\n {\n \"open\": props.open,\n \"delayDuration\": props.delayDuration,\n \"disableHoverableContent\": props.disableHoverableContent,\n // The trigger listeners are this port's (TooltipTrigger)\n \"disabled\": true,\n \"onUpdate:open\": handleOpenChange,\n },\n { default: () => h(TooltipContextBridge, { hooks }, { default: () => slots.default?.() }) },\n ),\n })\n },\n})\n\n/**\n * Low-level trigger (`Tooltip.Trigger` in React). Renders its child with the\n * tooltip wiring merged in; `as-child=\"false\"` renders a `<button>` instead.\n */\nexport const TooltipTrigger = defineComponent({\n name: \"TooltipTrigger\",\n inheritAttrs: false,\n props: {\n /** Merges into the child instead of rendering a `<button>`. @default true */\n asChild: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n const rootContext = injectTooltipRootContext()\n const providerContext = injectTooltipProviderContext()\n // Set before the first render, which describes the trigger by it\n rootContext.contentId ||= useId(undefined, \"reka-tooltip-content\")\n const contentIdProp = inject(ContentIdKey, undefined)\n let isPointerDown = false\n let hasPointerMoveOpened = false\n\n let pointerDocument: Document | undefined\n const handlePointerEnd = () => {\n isPointerDown = false\n pointerDocument?.removeEventListener(\"pointerup\", handlePointerEnd)\n pointerDocument?.removeEventListener(\"pointercancel\", handlePointerEnd)\n pointerDocument = undefined\n }\n onBeforeUnmount(handlePointerEnd)\n\n // Radix's TooltipTrigger handlers\n const handlers: Record<string, (event: Event) => void> = {\n onPointermove: (event) => {\n if (!isHoverPointer(event as PointerEvent)) return\n if (!hasPointerMoveOpened && !providerContext.isPointerInTransitRef.value) {\n rootContext.onTriggerEnter()\n hasPointerMoveOpened = true\n }\n },\n onPointerleave: (event) => {\n if (!isHoverPointer(event as PointerEvent)) return\n rootContext.onTriggerLeave()\n hasPointerMoveOpened = false\n },\n onPointerdown: (event) => {\n handlePointerEnd()\n if (rootContext.open.value) {\n rootContext.onClose()\n }\n isPointerDown = true\n pointerDocument = (event.currentTarget as HTMLElement).ownerDocument\n pointerDocument.addEventListener(\"pointerup\", handlePointerEnd, { once: true })\n pointerDocument.addEventListener(\"pointercancel\", handlePointerEnd, { once: true })\n },\n onFocus: (event) => {\n if (!isPointerDown && !(event.currentTarget as HTMLElement).hasAttribute(\"data-menu-pointer-focus\")) {\n rootContext.onOpen()\n }\n },\n onBlur: (event) => {\n // Clipboard fallback borrows focus synchronously, then restores it.\n const nextTarget = (event as FocusEvent).relatedTarget\n if (nextTarget instanceof Element && nextTarget.hasAttribute(\"data-plex-clipboard-fallback\")) return\n rootContext.onClose()\n },\n onClick: () => rootContext.onClose(),\n }\n\n return () => {\n const child = props.asChild ? firstElementChild(slots.default?.()) : h(\"button\", null, slots.default?.())\n if (!child) return null\n\n const contentId = contentIdProp?.value ?? rootContext.contentId\n const triggerProps: Record<string, unknown> = {\n ...attrs,\n // Radix adds the content id to the trigger's own while open (the\n // child's own ids come first, as in Radix's Slot)\n \"aria-describedby\": rootContext.open.value\n ? concatAriaDescribedby(attrs[\"aria-describedby\"], contentId)\n : attrs[\"aria-describedby\"],\n \"data-grace-area-trigger\": undefined,\n }\n for (const [key, handler] of Object.entries(handlers)) {\n triggerProps[key] = composeEventHandlers(attrs[key], handler)\n }\n\n return h(RekaTooltipTrigger, { asChild: true }, { default: () => mergeSlotProps(child, triggerProps) })\n }\n },\n})\n\ntype ContentChildren = {\n render: () => VNodeArrayChildren | undefined\n ariaLabel: () => unknown\n}\n\nconst ContentChildrenKey: InjectionKey<ContentChildren> = Symbol(\"PlexUITooltipContent\")\n\n// The element Reka's content renders (`as`), in place of Reka's visually\n// hidden copy of the text. Raw, as Reka may pass `as` through reactive props.\nconst TooltipContentElement = markRaw(defineComponent({\n name: \"TooltipContentElement\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const rootContext = injectTooltipRootContext()\n const content = inject(ContentChildrenKey)!\n const contentIdProp = inject(ContentIdKey, undefined)\n\n return () => {\n const { style, ...rest } = attrs\n delete rest.dir\n delete rest.id\n const ariaLabel = content.ariaLabel() as string | undefined\n const contentId = contentIdProp?.value ?? (rootContext.contentId || undefined)\n return h(\n \"div\",\n {\n role: ariaLabel ? undefined : \"tooltip\",\n id: ariaLabel ? undefined : contentId,\n ...rest,\n style: withRadixVariableNames(style, \"tooltip\"),\n },\n [\n content.render(),\n ariaLabel ? h(\"span\", { id: contentId, role: \"tooltip\", style: VISUALLY_HIDDEN_STYLE }, ariaLabel) : null,\n ],\n )\n }\n },\n}))\n\nconst sideProp = String as PropType<TooltipSide>\nconst alignProp = String as PropType<TooltipAlign>\nconst gutterSizeProp = { type: String as PropType<TooltipGutterSize>, default: \"md\" }\nconst maxWidthProp = { type: [Number, String] as PropType<number | \"none\">, default: 300 }\n\n/** Low-level content (`Tooltip.Content` in React). `class` lands on the tooltip. */\nexport const TooltipContent = defineComponent({\n name: \"TooltipContent\",\n inheritAttrs: false,\n props: {\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Whether the tooltip content responds to clicks */\n clickable: { type: Boolean, default: undefined },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n },\n setup(props, { slots, attrs }) {\n provide(ContentChildrenKey, {\n render: () => slots.default?.(),\n ariaLabel: () => attrs[\"aria-label\"],\n })\n\n // Radix's content `id` replaces the generated content id while mounted\n const contentIdProp = inject(ContentIdKey, undefined)\n if (contentIdProp) {\n watch(\n () => attrs.id as string | undefined,\n (id) => {\n contentIdProp.value = id || undefined\n },\n { immediate: true },\n )\n onBeforeUnmount(() => {\n contentIdProp.value = undefined\n })\n }\n\n return () => {\n const { class: className, style, ...restProps } = attrs\n delete restProps[\"aria-label\"]\n delete restProps.id\n\n return h(RekaTooltipPortal, null, {\n default: () =>\n h(\n RekaTooltipContent,\n {\n ...restProps,\n \"as\": TooltipContentElement,\n \"side\": props.side,\n \"align\": props.align,\n \"class\": [s.Tooltip, className],\n \"data-compact\": String(props.compact),\n \"data-clickable\": props.clickable === undefined ? undefined : String(props.clickable),\n \"data-gutter-size\": props.gutterSize,\n \"alignOffset\": props.alignOffset,\n \"sideOffset\": props.sideOffset,\n \"collisionPadding\": 15,\n \"hideWhenDetached\": true,\n \"style\": [style, { maxWidth: toCssLength(props.maxWidth) }],\n // Escape is handled by the Escape stack in TooltipRoot\n \"onEscapeKeyDown\": preventDefaultHandler,\n },\n // Rendered by TooltipContentElement from the injected slot\n { default: () => [] },\n ),\n })\n }\n },\n})\n\nconst isPlainText = (nodes: VNode[]) => nodes.length === 1 && nodes[0]!.type === Text\n\n/**\n * Optional trigger wrapper (`Tooltip.TriggerDecorator` in React) for content\n * that is not accessible or visibly interactive on its own. Plain text is\n * wrapped in a focusable `<span>`; an element child gets the props merged in.\n */\nexport const TooltipTriggerDecorator = defineComponent({\n name: \"TooltipTriggerDecorator\",\n inheritAttrs: false,\n props: {\n /** Applies `tabindex=\"0\"` to the trigger. @default true */\n focusable: { type: Boolean, default: true },\n },\n setup(props, { slots, attrs }) {\n return () => {\n const { class: className, ...restProps } = attrs\n const slotProps = {\n ...restProps,\n class: [s.TriggerDecorator, className],\n tabindex: props.focusable ? 0 : undefined,\n }\n const children = flattenSlot(slots.default?.())\n\n if (isPlainText(children)) {\n return h(\"span\", slotProps, String(children[0]!.children ?? \"\"))\n }\n\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n }\n },\n})\n\nconst TooltipComponent = defineComponent({\n name: \"Tooltip\",\n inheritAttrs: false,\n props: {\n /**\n * The content of the tooltip (or the `#content` slot). `null` renders no\n * tooltip.\n */\n content: { type: [String, Number, Object] as PropType<string | number | VNode | null>, default: undefined },\n /** `max-width` of the tooltip; `\"none\"` sizes it to a single line. @default 300 */\n maxWidth: maxWidthProp,\n /** Forces the tooltip to remain open or closed */\n forceOpen: { type: Boolean, default: undefined },\n /** Delay before the tooltip opens from the first interaction, in milliseconds. @default 150 */\n openDelay: { type: Number, default: 150 },\n /** The tooltip has interactive content and stays open while hovered. @default false */\n interactive: { type: Boolean, default: false },\n /** Short, 1-3 word tooltips, stylized inversely from normal tooltips. @default false */\n compact: { type: Boolean, default: false },\n /** Keeps the tooltip open when the trigger is clicked right after it opened. @default false */\n preventUnintentionalClickToClose: { type: Boolean, default: undefined },\n /** Preferred alignment against the trigger. @default \"center\" */\n align: alignProp,\n /** Offset from the \"start\" or \"end\" alignment, in pixels. @default 0 */\n alignOffset: { type: Number, default: 0 },\n /** Preferred side of the trigger. @default \"top\" */\n side: sideProp,\n /** Distance from the trigger, in pixels. @default 5 */\n sideOffset: { type: Number, default: 5 },\n /** Gutter sizing inside the tooltip. @default \"md\" */\n gutterSize: gutterSizeProp,\n /** Class applied to the tooltip content */\n contentClassName: String,\n },\n emits: {\n pointerdown: (event: PointerEvent) => typeof event.type === \"string\",\n click: (event: MouseEvent) => typeof event.type === \"string\",\n },\n setup(props, { slots, attrs, emit }) {\n const visible = ref(false)\n const temporarilyPreventClickToClose = ref(false)\n\n watch(temporarilyPreventClickToClose, (prevent, _, onCleanup) => {\n if (!prevent) return\n const id = setTimeout(() => {\n temporarilyPreventClickToClose.value = false\n }, 400)\n onCleanup(() => clearTimeout(id))\n })\n\n const hasContent = () => !(props.content === null && !slots.content)\n const forceOpen = () => props.forceOpen ?? (hasContent() ? undefined : false)\n\n const handleOpenChange = (nextState: boolean) => {\n // When forceOpen is passed, don't manage internal state\n if (typeof forceOpen() === \"boolean\") return\n\n visible.value = nextState\n\n if (props.preventUnintentionalClickToClose) {\n temporarilyPreventClickToClose.value = nextState\n }\n }\n\n const maybePreventClickClose = (evt: Event) => {\n if (props.preventUnintentionalClickToClose && temporarilyPreventClickToClose.value) {\n // Prevents tooltip listeners from closing\n evt.preventDefault()\n evt.stopPropagation()\n }\n }\n\n const onPointerdown = (evt: PointerEvent) => {\n maybePreventClickClose(evt)\n emit(\"pointerdown\", evt)\n }\n\n const onClick = (evt: MouseEvent) => {\n maybePreventClickClose(evt)\n emit(\"click\", evt)\n }\n\n return () => {\n const child = firstElementChild(slots.default?.())\n\n return h(\n TooltipRoot,\n {\n \"open\": forceOpen() ?? visible.value,\n \"delayDuration\": props.openDelay,\n \"onUpdate:open\": handleOpenChange,\n \"disableHoverableContent\": !props.interactive,\n },\n {\n default: () => [\n h(TooltipTrigger, null, {\n default: () => (child ? mergeSlotProps(child, { ...attrs, onPointerdown, onClick }) : null),\n }),\n h(\n TooltipContent,\n {\n maxWidth: props.maxWidth,\n compact: props.compact,\n align: props.align,\n alignOffset: props.alignOffset,\n side: props.side,\n sideOffset: props.sideOffset,\n gutterSize: props.gutterSize,\n class: props.contentClassName,\n },\n { default: () => (slots.content ? slots.content() : props.content) },\n ),\n ],\n },\n )\n }\n },\n})\n\n/**\n * Tooltip for any trigger element (the default slot). Content comes from the\n * `content` prop or the `#content` slot; `null` disables the tooltip.\n */\n// Typed explicitly so the published declaration refers to the parts instead of\n// expanding them (an expanded component type fails consumers' type checks)\nexport const Tooltip: typeof TooltipComponent & {\n Root: typeof TooltipRoot\n Content: typeof TooltipContent\n Trigger: typeof TooltipTrigger\n TriggerDecorator: typeof TooltipTriggerDecorator\n} = Object.assign(TooltipComponent, {\n Root: TooltipRoot,\n Content: TooltipContent,\n Trigger: TooltipTrigger,\n TriggerDecorator: TooltipTriggerDecorator,\n})\n\nexport type TooltipProps = InstanceType<typeof TooltipComponent>[\"$props\"]\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { computed, inject, provide, shallowRef, watch, } from 'vue';
|
|
2
|
+
import { observeFloatingFooter, sameFloatingFooterInset, } from '../lib/floatingBoundary.js';
|
|
3
|
+
const FloatingBoundaryKey = Symbol('PlexUIFloatingBoundary');
|
|
4
|
+
/** A nested Dialog deliberately starts a new scope even before its footer mounts. */
|
|
5
|
+
export function provideFloatingBoundaryScope() {
|
|
6
|
+
const root = shallowRef(null);
|
|
7
|
+
const footer = shallowRef(null);
|
|
8
|
+
const scope = {
|
|
9
|
+
root,
|
|
10
|
+
footer,
|
|
11
|
+
setRoot: (node) => {
|
|
12
|
+
root.value = node instanceof HTMLElement ? node : null;
|
|
13
|
+
},
|
|
14
|
+
setFooter: (node) => {
|
|
15
|
+
footer.value = node instanceof HTMLElement ? node : null;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
provide(FloatingBoundaryKey, scope);
|
|
19
|
+
return scope;
|
|
20
|
+
}
|
|
21
|
+
export const useFloatingBoundaryRegistration = () => inject(FloatingBoundaryKey, null);
|
|
22
|
+
export function useFloatingBoundary(active, padding) {
|
|
23
|
+
const scope = useFloatingBoundaryRegistration();
|
|
24
|
+
const inset = shallowRef(null);
|
|
25
|
+
watch([active, () => scope?.root.value, () => scope?.footer.value], ([enabled, root, footer], _previous, onCleanup) => {
|
|
26
|
+
const update = (next) => {
|
|
27
|
+
if (!sameFloatingFooterInset(inset.value, next))
|
|
28
|
+
inset.value = next;
|
|
29
|
+
};
|
|
30
|
+
if (!enabled || !root || !footer) {
|
|
31
|
+
update(null);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
onCleanup(observeFloatingFooter(root, footer, update));
|
|
35
|
+
}, { immediate: true, flush: 'post' });
|
|
36
|
+
return computed(() => {
|
|
37
|
+
const current = active() && inset.value?.boundary === scope?.root.value && scope?.footer.value
|
|
38
|
+
? inset.value
|
|
39
|
+
: null;
|
|
40
|
+
return current
|
|
41
|
+
? {
|
|
42
|
+
collisionBoundary: current.boundary,
|
|
43
|
+
collisionPadding: { ...padding, bottom: (padding.bottom ?? 0) + current.bottom },
|
|
44
|
+
}
|
|
45
|
+
: { collisionPadding: padding };
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=useFloatingBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingBoundary.js","sourceRoot":"","sources":["../../../src/composables/useFloatingBoundary.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAK,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EACH,qBAAqB,EACrB,uBAAuB,GAE1B,MAAM,4BAA4B,CAAC;AASpC,MAAM,mBAAmB,GAAgC,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAE1F,qFAAqF;AACrF,MAAM,UAAU,4BAA4B;IACxC,MAAM,IAAI,GAAG,UAAU,CAA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CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,CAAC;YACb,OAAO;QACX,CAAC;QACD,SAAS,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CACrC,CAAC;IAEF,OAAO,QAAQ,CAAC,GAAG,EAAE;QACjB,MAAM,OAAO,GACT,MAAM,EAAE,IAAI,KAAK,CAAC,KAAK,EAAE,QAAQ,KAAK,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK,EAAE,MAAM,CAAC,KAAK;YAC1E,CAAC,CAAC,KAAK,CAAC,KAAK;YACb,CAAC,CAAC,IAAI,CAAC;QACf,OAAO,OAAO;YACV,CAAC,CAAC;gBACI,iBAAiB,EAAE,OAAO,CAAC,QAAQ;gBACnC,gBAAgB,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE;aACnF;YACH,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {\n computed,\n inject,\n provide,\n shallowRef,\n watch,\n type InjectionKey,\n type ShallowRef,\n} from 'vue';\nimport {\n observeFloatingFooter,\n sameFloatingFooterInset,\n type FloatingFooterInset,\n} from '../lib/floatingBoundary.js';\n\ntype BoundaryScope = {\n root: ShallowRef<HTMLElement | null>;\n footer: ShallowRef<HTMLElement | null>;\n setRoot: (element: unknown) => void;\n setFooter: (element: unknown) => void;\n};\ntype CollisionPadding = Partial<Record<'top' | 'right' | 'bottom' | 'left', number>>;\nconst FloatingBoundaryKey: InjectionKey<BoundaryScope> = Symbol('PlexUIFloatingBoundary');\n\n/** A nested Dialog deliberately starts a new scope even before its footer mounts. */\nexport function provideFloatingBoundaryScope(): BoundaryScope {\n const root = shallowRef<HTMLElement | null>(null);\n const footer = shallowRef<HTMLElement | null>(null);\n const scope = {\n root,\n footer,\n setRoot: (node: unknown) => {\n root.value = node instanceof HTMLElement ? node : null;\n },\n setFooter: (node: unknown) => {\n footer.value = node instanceof HTMLElement ? node : null;\n },\n };\n provide(FloatingBoundaryKey, scope);\n return scope;\n}\n\nexport const useFloatingBoundaryRegistration = () => inject(FloatingBoundaryKey, null);\n\nexport function useFloatingBoundary(active: () => boolean, padding: CollisionPadding) {\n const scope = useFloatingBoundaryRegistration();\n const inset = shallowRef<FloatingFooterInset>(null);\n watch(\n [active, () => scope?.root.value, () => scope?.footer.value],\n ([enabled, root, footer], _previous, onCleanup) => {\n const update = (next: FloatingFooterInset) => {\n if (!sameFloatingFooterInset(inset.value, next)) inset.value = next;\n };\n if (!enabled || !root || !footer) {\n update(null);\n return;\n }\n onCleanup(observeFloatingFooter(root, footer, update));\n },\n { immediate: true, flush: 'post' },\n );\n\n return computed(() => {\n const current =\n active() && inset.value?.boundary === scope?.root.value && scope?.footer.value\n ? inset.value\n : null;\n return current\n ? {\n collisionBoundary: current.boundary,\n collisionPadding: { ...padding, bottom: (padding.bottom ?? 0) + current.bottom },\n }\n : { collisionPadding: padding };\n });\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { onUpdated, shallowRef, watch } from "vue";
|
|
2
|
+
import { observePhoneSubmenu, samePhoneSubmenuState } from "../lib/menuSubmenuPlacement.js";
|
|
3
|
+
export function usePhoneSubmenu(active, trigger, content, boundary) {
|
|
4
|
+
const state = shallowRef({ mobile: false });
|
|
5
|
+
let observer;
|
|
6
|
+
watch([active, trigger, content, boundary], ([open, triggerElement, contentElement, options], _previous, onCleanup) => {
|
|
7
|
+
if (!open || !triggerElement || !contentElement)
|
|
8
|
+
return;
|
|
9
|
+
const current = observePhoneSubmenu(triggerElement, contentElement, options, (next) => {
|
|
10
|
+
if (!samePhoneSubmenuState(state.value, next))
|
|
11
|
+
state.value = next;
|
|
12
|
+
});
|
|
13
|
+
observer = current;
|
|
14
|
+
onCleanup(() => { current.dispose(); observer = undefined; });
|
|
15
|
+
}, { immediate: true, flush: "post" });
|
|
16
|
+
onUpdated(() => observer?.refresh());
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=usePhoneSubmenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePhoneSubmenu.js","sourceRoot":"","sources":["../../../src/composables/usePhoneSubmenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAqC,MAAM,KAAK,CAAA;AACrF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAqD,MAAM,gCAAgC,CAAA;AAE9I,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,OAAuC,EAAE,OAAuC,EAAE,QAA2C;IAClL,MAAM,KAAK,GAAG,UAAU,CAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAC9D,IAAI,QAA4D,CAAA;IAChE,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE;QACpH,IAAI,CAAC,IAAI,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc;YAAE,OAAM;QACvD,MAAM,OAAO,GAAG,mBAAmB,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACpF,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;gBAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAA;QACnE,CAAC,CAAC,CAAA;QACF,QAAQ,GAAG,OAAO,CAAA;QAClB,SAAS,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,GAAG,SAAS,CAAA,CAAC,CAAC,CAAC,CAAA;IAC9D,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IACtC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAA;IACpC,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { onUpdated, shallowRef, watch, type ComputedRef, type ShallowRef } from \"vue\"\nimport { observePhoneSubmenu, samePhoneSubmenuState, type MenuFloatingBoundary, type PhoneSubmenuState } from \"../lib/menuSubmenuPlacement.js\"\n\nexport function usePhoneSubmenu(active: () => boolean, trigger: ShallowRef<HTMLElement | null>, content: ShallowRef<HTMLElement | null>, boundary: ComputedRef<MenuFloatingBoundary>) {\n const state = shallowRef<PhoneSubmenuState>({ mobile: false })\n let observer: ReturnType<typeof observePhoneSubmenu> | undefined\n watch([active, trigger, content, boundary], ([open, triggerElement, contentElement, options], _previous, onCleanup) => {\n if (!open || !triggerElement || !contentElement) return\n const current = observePhoneSubmenu(triggerElement, contentElement, options, (next) => {\n if (!samePhoneSubmenuState(state.value, next)) state.value = next\n })\n observer = current\n onCleanup(() => { current.dispose(); observer = undefined })\n }, { immediate: true, flush: \"post\" })\n onUpdated(() => observer?.refresh())\n return state\n}\n"]}
|
|
@@ -33,7 +33,7 @@ export async function copyToClipboard(content, container = document.body) {
|
|
|
33
33
|
}
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
-
catch
|
|
36
|
+
catch {
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -55,30 +55,39 @@ export async function copyText(text, container = document.body) {
|
|
|
55
55
|
await navigator.clipboard.writeText(text);
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
-
catch
|
|
58
|
+
catch {
|
|
59
59
|
// If that doesn't work, we continue on to the fallback
|
|
60
60
|
// method below
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
// Fallback method
|
|
64
|
-
const
|
|
64
|
+
const ownerDocument = container.ownerDocument;
|
|
65
|
+
const previousFocus = ownerDocument.activeElement;
|
|
66
|
+
const textArea = ownerDocument.createElement("textarea");
|
|
65
67
|
textArea.value = text;
|
|
68
|
+
textArea.setAttribute("data-plex-clipboard-fallback", "");
|
|
66
69
|
// Avoid visibility/interaction
|
|
67
70
|
textArea.style.position = "fixed";
|
|
68
71
|
textArea.style.top = "0";
|
|
69
72
|
textArea.style.left = "0";
|
|
70
73
|
textArea.style.opacity = "0";
|
|
71
74
|
container.appendChild(textArea);
|
|
72
|
-
textArea.focus();
|
|
75
|
+
textArea.focus({ preventScroll: true });
|
|
73
76
|
textArea.select();
|
|
74
77
|
let succeeded = false;
|
|
75
78
|
try {
|
|
76
|
-
succeeded =
|
|
79
|
+
succeeded = ownerDocument.execCommand("copy");
|
|
77
80
|
}
|
|
78
|
-
catch
|
|
81
|
+
catch {
|
|
79
82
|
// Ignore
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
const restoreFocus = ownerDocument.activeElement === textArea;
|
|
85
|
+
textArea.remove();
|
|
86
|
+
// execCommand can synchronously move focus (for example, through a copy
|
|
87
|
+
// handler). Restore only while the temporary textarea still owns it.
|
|
88
|
+
if (restoreFocus && previousFocus?.isConnected && "focus" in previousFocus && typeof previousFocus.focus === "function") {
|
|
89
|
+
previousFocus.focus({ preventScroll: true });
|
|
90
|
+
}
|
|
82
91
|
return succeeded;
|
|
83
92
|
}
|
|
84
93
|
//# sourceMappingURL=copyToClipboard.js.map
|