@koide-labs/ui 0.0.15 → 0.1.1
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/-utils.d.ts +2 -2
- package/dist/-utils.js +1 -1
- package/dist/{Button-DrPFFzo7.js → Button-BmcVHRRW.js} +2 -2
- package/dist/{CompositeRoot-CVk5a-pR.js → CompositeRoot-CCgh2M64.js} +6 -6
- package/dist/{FloatingPortal-tWyuKRSN.js → FloatingPortal-BQsQhvIr.js} +27 -27
- package/dist/{FloatingPortalLite-DVyq6YhV.js → FloatingPortalLite-_ECdFE7b.js} +1 -1
- package/dist/{InternalBackdrop-jYAiOJ8v.js → InternalBackdrop-BSMKU-hc.js} +13 -13
- package/dist/{LabelableContext-BMvjVwor.js → LabelableContext-Be1u-eFg.js} +2 -2
- package/dist/accordion.css +1 -0
- package/dist/alert-dialog.css +1 -0
- package/dist/anchor.css +1 -0
- package/dist/avatar.css +1 -0
- package/dist/badge.css +1 -0
- package/dist/button.css +1 -0
- package/dist/checkbox.css +1 -0
- package/dist/code.css +1 -0
- package/dist/collapse.css +1 -0
- package/dist/command.css +1 -0
- package/dist/components/accordion/accordion.d.ts +19 -0
- package/dist/components/accordion/accordion.js +701 -0
- package/dist/components/accordion/index.d.ts +1 -12
- package/dist/components/accordion/index.js +2 -697
- package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
- package/dist/components/alert-dialog/alert-dialog.js +138 -0
- package/dist/components/alert-dialog/index.d.ts +1 -26
- package/dist/components/alert-dialog/index.js +2 -134
- package/dist/components/anchor/anchor.d.ts +12 -0
- package/dist/components/anchor/anchor.js +21 -0
- package/dist/components/anchor/index.d.ts +1 -8
- package/dist/components/anchor/index.js +2 -19
- package/dist/components/avatar/avatar.d.ts +25 -0
- package/dist/components/avatar/avatar.js +161 -0
- package/dist/components/avatar/index.d.ts +1 -21
- package/dist/components/avatar/index.js +2 -159
- package/dist/components/badge/badge.d.ts +20 -0
- package/dist/components/badge/badge.js +42 -0
- package/dist/components/badge/index.d.ts +1 -16
- package/dist/components/badge/index.js +2 -40
- package/dist/components/button/button.d.ts +27 -0
- package/dist/components/button/button.js +47 -0
- package/dist/components/button/index.d.ts +1 -24
- package/dist/components/button/index.js +2 -45
- package/dist/components/checkbox/checkbox.d.ts +13 -0
- package/dist/components/checkbox/checkbox.js +269 -0
- package/dist/components/checkbox/index.d.ts +1 -9
- package/dist/components/checkbox/index.js +2 -267
- package/dist/components/code/code.d.ts +13 -0
- package/dist/components/code/code.js +1206 -0
- package/dist/components/code/index.d.ts +1 -9
- package/dist/components/code/index.js +2 -1204
- package/dist/components/collapse/collapse.d.ts +14 -0
- package/dist/components/collapse/collapse.js +35 -0
- package/dist/components/collapse/index.d.ts +1 -11
- package/dist/components/collapse/index.js +2 -33
- package/dist/components/command/command.d.ts +36 -0
- package/dist/components/command/command.js +1695 -0
- package/dist/components/command/index.d.ts +1 -15
- package/dist/components/command/index.js +2 -1693
- package/dist/components/context-menu/context-menu.d.ts +82 -0
- package/dist/components/context-menu/context-menu.js +1445 -0
- package/dist/components/context-menu/index.d.ts +1 -42
- package/dist/components/context-menu/index.js +2 -1442
- package/dist/components/dialog/dialog.d.ts +22 -0
- package/dist/components/dialog/dialog.js +140 -0
- package/dist/components/dialog/dialog.types.d.ts +38 -0
- package/dist/components/dialog/index.d.ts +1 -48
- package/dist/components/dialog/index.js +2 -136
- package/dist/components/heading/heading.d.ts +25 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/heading/index.d.ts +1 -44
- package/dist/components/heading/index.js +2 -49
- package/dist/components/icon/icon.d.ts +28 -0
- package/dist/components/icon/icon.js +43 -0
- package/dist/components/icon/{icon-names.d.ts → icon.types.d.ts} +4 -0
- package/dist/components/icon/icon.types.js +1 -0
- package/dist/components/icon/index.d.ts +2 -24
- package/dist/components/icon/index.js +2 -41
- package/dist/components/icon-button/icon-button.d.ts +16 -0
- package/dist/components/icon-button/icon-button.js +46 -0
- package/dist/components/icon-button/index.d.ts +1 -12
- package/dist/components/icon-button/index.js +2 -44
- package/dist/components/inline-code/index.d.ts +1 -6
- package/dist/components/inline-code/index.js +2 -20
- package/dist/components/inline-code/inline-code.d.ts +10 -0
- package/dist/components/inline-code/inline-code.js +25 -0
- package/dist/components/input/index.d.ts +1 -3
- package/dist/components/input/index.js +2 -117
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +126 -0
- package/dist/components/meter/index.d.ts +1 -18
- package/dist/components/meter/index.js +2 -163
- package/dist/components/meter/meter.d.ts +22 -0
- package/dist/components/meter/meter.js +165 -0
- package/dist/components/multiline-input/index.d.ts +1 -6
- package/dist/components/multiline-input/index.js +2 -98
- package/dist/components/multiline-input/multiline-input.d.ts +10 -0
- package/dist/components/multiline-input/multiline-input.js +100 -0
- package/dist/components/number-input/index.d.ts +1 -10
- package/dist/components/number-input/index.js +2 -1167
- package/dist/components/number-input/number-input.d.ts +14 -0
- package/dist/components/number-input/number-input.js +1169 -0
- package/dist/components/password-input/index.d.ts +1 -2
- package/dist/components/password-input/index.js +2 -27
- package/dist/components/password-input/password-input.d.ts +7 -0
- package/dist/components/password-input/password-input.js +29 -0
- package/dist/components/pill/index.d.ts +1 -13
- package/dist/components/pill/index.js +2 -36
- package/dist/components/pill/pill.d.ts +17 -0
- package/dist/components/pill/pill.js +38 -0
- package/dist/components/popover/index.d.ts +1 -21
- package/dist/components/popover/index.js +2 -634
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.js +634 -0
- package/dist/components/preview-card/index.d.ts +1 -17
- package/dist/components/preview-card/index.js +2 -400
- package/dist/components/preview-card/preview-card.d.ts +21 -0
- package/dist/components/preview-card/preview-card.js +402 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/radio-group/index.js +5 -0
- package/dist/components/radio-group/radio-group.d.ts +25 -0
- package/dist/components/{radio/index.js → radio-group/radio-group.js} +91 -90
- package/dist/components/search-bar/index.d.ts +1 -12
- package/dist/components/search-bar/index.js +2 -46
- package/dist/components/search-bar/search-bar.d.ts +16 -0
- package/dist/components/search-bar/search-bar.js +43 -0
- package/dist/components/select/index.d.ts +1 -16
- package/dist/components/select/index.js +2 -1261
- package/dist/components/select/select.d.ts +22 -0
- package/dist/components/select/select.js +1263 -0
- package/dist/components/separator/index.d.ts +1 -7
- package/dist/components/separator/index.js +2 -4
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.js +6 -0
- package/dist/components/slider/index.d.ts +1 -5
- package/dist/components/slider/index.js +2 -900
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +899 -0
- package/dist/components/spinner/index.d.ts +1 -2
- package/dist/components/spinner/index.js +2 -11
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +1 -14
- package/dist/components/stacked-avatars/index.js +2 -90
- package/dist/components/stacked-avatars/stacked-avatars.d.ts +18 -0
- package/dist/components/stacked-avatars/stacked-avatars.js +92 -0
- package/dist/components/status-banner/index.d.ts +1 -17
- package/dist/components/status-banner/index.js +2 -69
- package/dist/components/status-banner/status-banner.d.ts +22 -0
- package/dist/components/status-banner/status-banner.js +71 -0
- package/dist/components/surface/index.d.ts +2 -27
- package/dist/components/surface/index.js +2 -39
- package/dist/components/surface/surface.d.ts +26 -0
- package/dist/components/surface/surface.js +36 -0
- package/dist/components/surface/surface.types.d.ts +1 -0
- package/dist/components/surface/surface.types.js +1 -0
- package/dist/components/switch/index.d.ts +1 -5
- package/dist/components/switch/index.js +2 -194
- package/dist/components/switch/switch.d.ts +10 -0
- package/dist/components/switch/switch.js +193 -0
- package/dist/components/tabs/index.d.ts +1 -18
- package/dist/components/tabs/index.js +2 -507
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +511 -0
- package/dist/components/text/index.d.ts +1 -26
- package/dist/components/text/index.js +2 -46
- package/dist/components/text/text.d.ts +29 -0
- package/dist/components/text/text.js +48 -0
- package/dist/components/theme-provider/index.d.ts +1 -1
- package/dist/components/theme-provider/theme-provider.d.ts +8 -4
- package/dist/components/theme-provider/theme-provider.js +3 -3
- package/dist/components/timestamp/index.d.ts +1 -23
- package/dist/components/timestamp/index.js +2 -1390
- package/dist/components/timestamp/timestamp.d.ts +26 -0
- package/dist/components/timestamp/timestamp.js +1391 -0
- package/dist/components/toaster/index.d.ts +2 -0
- package/dist/components/toaster/index.js +7 -0
- package/dist/components/toaster/toaster.d.ts +7 -0
- package/dist/components/toaster/toaster.js +923 -0
- package/dist/components/{toast → toaster}/use-toast-manager.d.ts +3 -3
- package/dist/components/tooltip/index.d.ts +1 -14
- package/dist/components/tooltip/index.js +2 -710
- package/dist/components/tooltip/tooltip.d.ts +24 -0
- package/dist/components/tooltip/tooltip.js +9 -0
- package/dist/components/view/index.d.ts +2 -30
- package/dist/components/view/index.js +2 -79
- package/dist/components/view/view.d.ts +31 -0
- package/dist/components/view/view.js +83 -0
- package/dist/components/view/view.types.d.ts +5 -0
- package/dist/components/view/view.types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +5 -1
- package/dist/{composite-Bx7Szd_T.js → composite-BZzP-LlG.js} +3 -3
- package/dist/{composite-C9L5QmZL.js → composite-BwEK5cWH.js} +1 -1
- package/dist/context-menu.css +1 -0
- package/dist/{createBaseUIEventDetails-D8M2Yl-a.js → createBaseUIEventDetails-CCSfZ2vM.js} +7 -7
- package/dist/{detectBrowser-I-s3yzIE.js → detectBrowser-Bl8Ki_1I.js} +2 -2
- package/dist/dialog.css +1 -1
- package/dist/{dialog.module-BeF-6XAo.js → dialog.module-DsbQRp-d.js} +55 -55
- package/dist/{element-CZEOj04G.js → element-u5WgOZX1.js} +7 -7
- package/dist/{event-CKoGyQEJ.js → event-B89-Ng5h.js} +4 -4
- package/dist/{floating-ui.utils-C7pRWMZ_.js → floating-ui.utils-DUVaIF3G.js} +7 -7
- package/dist/{floating-ui.utils.dom-C7FS5id0.js → floating-ui.utils.dom-cbi420Pg.js} +4 -4
- package/dist/{getDisabledMountTransitionStyles-YfHPge6T.js → getDisabledMountTransitionStyles-E2x-_lte.js} +7 -7
- package/dist/heading.css +1 -0
- package/dist/icon-button.css +1 -0
- package/dist/icon.css +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +86 -104
- package/dist/{inertValue-BCYGsdmf.js → inertValue-BTpPjX30.js} +1 -1
- package/dist/inline-code.css +1 -0
- package/dist/input.css +1 -1
- package/dist/input.module-CtE19OH8.js +8 -0
- package/dist/integrations/react-markdown/index.js +12 -12
- package/dist/meter.css +1 -0
- package/dist/number-input.css +1 -0
- package/dist/password-input.css +1 -0
- package/dist/pill.css +1 -0
- package/dist/popover.css +1 -0
- package/dist/preview-card.css +1 -0
- package/dist/radio-group.css +1 -0
- package/dist/safePolygon-DnkzOIur.js +558 -0
- package/dist/search-bar.css +1 -0
- package/dist/select.css +1 -0
- package/dist/{index-DVjyPAD4.js → separator-fh_wDZNf.js} +7 -11
- package/dist/separator.css +1 -0
- package/dist/slider.css +1 -0
- package/dist/spinner.css +1 -0
- package/dist/stacked-avatars.css +1 -0
- package/dist/status-banner.css +1 -0
- package/dist/styles/core.css +1 -1
- package/dist/surface.css +1 -0
- package/dist/switch.css +1 -0
- package/dist/tabs.css +1 -0
- package/dist/text.css +1 -0
- package/dist/timestamp.css +1 -0
- package/dist/toaster.css +1 -0
- package/dist/tooltip-oCp-elli.js +765 -0
- package/dist/tooltip.css +1 -0
- package/dist/transitions.css +1 -1
- package/dist/{transitions.module-CWX8e5cx.js → transitions.module-D9mMAtfI.js} +11 -11
- package/dist/{useAnimationFrame-451ugS_6.js → useAnimationFrame-DvK1s63A.js} +1 -1
- package/dist/{useButton-DfIwsdb8.js → useButton-d3_JgBNr.js} +3 -3
- package/dist/{useCompositeListItem-OkcAim_1.js → useCompositeListItem-CZp9WTnF.js} +2 -2
- package/dist/{useLabelableId-Ci_jDvmv.js → useLabelableId-CX4tcfzK.js} +3 -3
- package/dist/{useOpenChangeComplete-Dse9kY9E.js → useOpenChangeComplete-BHd-N7Ig.js} +5 -5
- package/dist/{useRender-CLx7dR_1.js → useRender-C3vlzS3t.js} +1 -1
- package/dist/{useRenderElement-DwToLA61.js → useRenderElement-DngNDu_P.js} +2 -2
- package/dist/{useRole-oDBdbuwQ.js → useRole-BD3OL1rr.js} +3 -3
- package/dist/{useStableCallback-CkTrVkNX.js → useStableCallback-DKZHlUAT.js} +1 -1
- package/dist/{useSyncedFloatingRootContext-Dorsv-jf.js → useSyncedFloatingRootContext-BB1vwkV-.js} +20 -20
- package/dist/{useTimeout-CflX-kz3.js → useTimeout-BNni6aw5.js} +1 -1
- package/dist/{useTransitionStatus-CUfcuGAV.js → useTransitionStatus-CmMyUh74.js} +1 -1
- package/dist/{useTypeahead-D85V2IUx.js → useTypeahead-BiL5IAVb.js} +11 -11
- package/dist/{useValueAsRef-HURLzret.js → useValueAsRef-B4EriRsI.js} +1 -1
- package/dist/{useValueChanged-DL757-yD.js → useValueChanged-MJRmEWz1.js} +1 -1
- package/dist/view.css +1 -1
- package/dist/view.module-Dj7wj0kk.js +6 -0
- package/dist/view2.css +1 -0
- package/package.json +1 -1
- package/dist/components/radio/index.d.ts +0 -13
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/index.js +0 -8
- package/dist/components/toast/toast.d.ts +0 -2
- package/dist/components/toast/toast.js +0 -921
- package/dist/components/tooltip/tooltip-arrow.d.ts +0 -3
- package/dist/components/tooltip/tooltip-arrow.js +0 -6
- package/dist/index10.css +0 -1
- package/dist/index11.css +0 -1
- package/dist/index12.css +0 -1
- package/dist/index13.css +0 -1
- package/dist/index14.css +0 -1
- package/dist/index15.css +0 -1
- package/dist/index16.css +0 -1
- package/dist/index17.css +0 -1
- package/dist/index18.css +0 -1
- package/dist/index19.css +0 -1
- package/dist/index20.css +0 -1
- package/dist/index21.css +0 -1
- package/dist/index22.css +0 -1
- package/dist/index23.css +0 -1
- package/dist/index24.css +0 -1
- package/dist/index25.css +0 -1
- package/dist/index26.css +0 -1
- package/dist/index27.css +0 -1
- package/dist/index28.css +0 -1
- package/dist/index29.css +0 -1
- package/dist/index3.css +0 -1
- package/dist/index30.css +0 -1
- package/dist/index31.css +0 -1
- package/dist/index32.css +0 -1
- package/dist/index33.css +0 -1
- package/dist/index34.css +0 -1
- package/dist/index35.css +0 -1
- package/dist/index36.css +0 -1
- package/dist/index37.css +0 -1
- package/dist/index4.css +0 -1
- package/dist/index5.css +0 -1
- package/dist/index6.css +0 -1
- package/dist/index7.css +0 -1
- package/dist/index8.css +0 -1
- package/dist/index9.css +0 -1
- package/dist/input.module-DDQY_Ij6.js +0 -7
- package/dist/safePolygon-DWy1dGKJ.js +0 -308
- package/dist/toast.css +0 -1
- package/dist/tooltip-arrow-cs6vjjqZ.js +0 -24
- package/dist/tooltip-arrow.css +0 -1
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +0 -264
- package/dist/usePopupAutoResize-CNR6Ekmx.js +0 -85
- package/dist/view.module-DfDLgJE0.js +0 -6
- /package/dist/components/{icon/icon-names.js → dialog/dialog.types.js} +0 -0
- /package/dist/components/{toast → toaster}/use-toast-manager.js +0 -0
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { jsx as M, jsxs as ne } from "react/jsx-runtime";
|
|
2
|
+
import { c as ce } from "./clsx-OuTLNxxd.js";
|
|
3
|
+
import { textify as we } from "./-utils.js";
|
|
4
|
+
import { R as Oe, P as Me, c as D, d as Ie, e as Ne, f as De, p as J, t as Ae } from "./transitions.module-D9mMAtfI.js";
|
|
5
|
+
import { Surface as _e } from "./components/surface/surface.js";
|
|
6
|
+
import * as a from "react";
|
|
7
|
+
import { u as N } from "./useIsoLayoutEffect-CIDbvm3Q.js";
|
|
8
|
+
import { f as z } from "./formatErrorMessage-BqPuTBN-.js";
|
|
9
|
+
import { c as F, n as pe, b as G, a as de, e as fe, t as se, q as Le, i as ke } from "./createBaseUIEventDetails-CCSfZ2vM.js";
|
|
10
|
+
import * as Ve from "react-dom";
|
|
11
|
+
import { E as Fe, a as Be, u as $ } from "./useRenderElement-DngNDu_P.js";
|
|
12
|
+
import { p as He, b as Ue, c as ze, u as $e, a as je, d as We } from "./useSyncedFloatingRootContext-BB1vwkV-.js";
|
|
13
|
+
import { g as ge, a as re, i as me, f as Ye } from "./floating-ui.utils.dom-cbi420Pg.js";
|
|
14
|
+
import { f as Xe, b as Ge } from "./detectBrowser-Bl8Ki_1I.js";
|
|
15
|
+
import { T as qe, u as Ke } from "./useTimeout-BNni6aw5.js";
|
|
16
|
+
import { c as Je, P as Qe } from "./FloatingPortal-BQsQhvIr.js";
|
|
17
|
+
import { h as he, f as q, d as ie, j as Ze, m as et, e as tt } from "./element-u5WgOZX1.js";
|
|
18
|
+
import { u as U } from "./useStableCallback-DKZHlUAT.js";
|
|
19
|
+
import { b as ot } from "./event-B89-Ng5h.js";
|
|
20
|
+
import { u as nt } from "./useBaseUiId-B7WyxtIE.js";
|
|
21
|
+
import { g as st, a as rt, s as it, b as at } from "./safePolygon-DnkzOIur.js";
|
|
22
|
+
import { F as ut } from "./FloatingPortalLite-_ECdFE7b.js";
|
|
23
|
+
import { a as lt, b as ct, g as ye } from "./getDisabledMountTransitionStyles-E2x-_lte.js";
|
|
24
|
+
import { a as pt, u as dt, t as ft } from "./useOpenChangeComplete-BHd-N7Ig.js";
|
|
25
|
+
import { u as gt } from "./useAnimationFrame-DvK1s63A.js";
|
|
26
|
+
import { t as ae } from "./floating-ui.utils-DUVaIF3G.js";
|
|
27
|
+
import { u as mt } from "./DirectionContext-C2o_MF_i.js";
|
|
28
|
+
import './tooltip.css';const ve = /* @__PURE__ */ a.createContext({
|
|
29
|
+
hasProvider: !1,
|
|
30
|
+
timeoutMs: 0,
|
|
31
|
+
delayRef: {
|
|
32
|
+
current: 0
|
|
33
|
+
},
|
|
34
|
+
initialDelayRef: {
|
|
35
|
+
current: 0
|
|
36
|
+
},
|
|
37
|
+
timeout: new qe(),
|
|
38
|
+
currentIdRef: {
|
|
39
|
+
current: null
|
|
40
|
+
},
|
|
41
|
+
currentContextRef: {
|
|
42
|
+
current: null
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
process.env.NODE_ENV !== "production" && (ve.displayName = "FloatingDelayGroupContext");
|
|
46
|
+
function ht(n, e = {
|
|
47
|
+
open: !1
|
|
48
|
+
}) {
|
|
49
|
+
const t = "rootStore" in n ? n.rootStore : n, r = t.useState("floatingId"), {
|
|
50
|
+
enabled: g = !0,
|
|
51
|
+
open: u
|
|
52
|
+
} = e, c = a.useContext(ve), {
|
|
53
|
+
currentIdRef: l,
|
|
54
|
+
delayRef: p,
|
|
55
|
+
timeoutMs: d,
|
|
56
|
+
initialDelayRef: f,
|
|
57
|
+
currentContextRef: s,
|
|
58
|
+
hasProvider: i,
|
|
59
|
+
timeout: o
|
|
60
|
+
} = c, [v, y] = a.useState(!1);
|
|
61
|
+
return N(() => {
|
|
62
|
+
function C() {
|
|
63
|
+
y(!1), s.current?.setIsInstantPhase(!1), l.current = null, s.current = null, p.current = f.current;
|
|
64
|
+
}
|
|
65
|
+
if (g && l.current && !u && l.current === r) {
|
|
66
|
+
if (y(!1), d) {
|
|
67
|
+
const m = r;
|
|
68
|
+
return o.start(d, () => {
|
|
69
|
+
t.select("open") || l.current && l.current !== m || C();
|
|
70
|
+
}), () => {
|
|
71
|
+
o.clear();
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
C();
|
|
75
|
+
}
|
|
76
|
+
}, [g, u, r, l, p, d, f, s, o, t]), N(() => {
|
|
77
|
+
if (!g || !u)
|
|
78
|
+
return;
|
|
79
|
+
const C = s.current, m = l.current;
|
|
80
|
+
o.clear(), s.current = {
|
|
81
|
+
onOpenChange: t.setOpen,
|
|
82
|
+
setIsInstantPhase: y
|
|
83
|
+
}, l.current = r, p.current = {
|
|
84
|
+
open: 0,
|
|
85
|
+
close: st(f.current, "close")
|
|
86
|
+
}, m !== null && m !== r ? (y(!0), C?.setIsInstantPhase(!0), C?.onOpenChange(!1, F(pe))) : (y(!1), C?.setIsInstantPhase(!1));
|
|
87
|
+
}, [g, u, r, t, l, p, d, f, s, o]), N(() => () => {
|
|
88
|
+
s.current = null;
|
|
89
|
+
}, [s]), a.useMemo(() => ({
|
|
90
|
+
hasProvider: i,
|
|
91
|
+
delayRef: p,
|
|
92
|
+
isInstantPhase: v
|
|
93
|
+
}), [i, p, v]);
|
|
94
|
+
}
|
|
95
|
+
function yt(n, e) {
|
|
96
|
+
let t = null, r = null, g = !1;
|
|
97
|
+
return {
|
|
98
|
+
contextElement: n || void 0,
|
|
99
|
+
getBoundingClientRect() {
|
|
100
|
+
const u = n?.getBoundingClientRect() || {
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 0,
|
|
103
|
+
x: 0,
|
|
104
|
+
y: 0
|
|
105
|
+
}, c = e.axis === "x" || e.axis === "both", l = e.axis === "y" || e.axis === "both", p = ["mouseenter", "mousemove"].includes(e.dataRef.current.openEvent?.type || "") && e.pointerType !== "touch";
|
|
106
|
+
let d = u.width, f = u.height, s = u.x, i = u.y;
|
|
107
|
+
return t == null && e.x && c && (t = u.x - e.x), r == null && e.y && l && (r = u.y - e.y), s -= t || 0, i -= r || 0, d = 0, f = 0, !g || p ? (d = e.axis === "y" ? u.width : 0, f = e.axis === "x" ? u.height : 0, s = c && e.x != null ? e.x : s, i = l && e.y != null ? e.y : i) : g && !p && (f = e.axis === "x" ? u.height : f, d = e.axis === "y" ? u.width : d), g = !0, {
|
|
108
|
+
width: d,
|
|
109
|
+
height: f,
|
|
110
|
+
x: s,
|
|
111
|
+
y: i,
|
|
112
|
+
top: i,
|
|
113
|
+
right: s + d,
|
|
114
|
+
bottom: i + f,
|
|
115
|
+
left: s
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function ue(n) {
|
|
121
|
+
return n != null && n.clientX != null;
|
|
122
|
+
}
|
|
123
|
+
function vt(n, e = {}) {
|
|
124
|
+
const t = "rootStore" in n ? n.rootStore : n, r = t.useState("open"), g = t.useState("floatingElement"), u = t.useState("domReferenceElement"), c = t.context.dataRef, {
|
|
125
|
+
enabled: l = !0,
|
|
126
|
+
axis: p = "both",
|
|
127
|
+
x: d = null,
|
|
128
|
+
y: f = null
|
|
129
|
+
} = e, s = a.useRef(!1), i = a.useRef(null), [o, v] = a.useState(), [y, C] = a.useState([]), m = U((P, T) => {
|
|
130
|
+
s.current || c.current.openEvent && !ue(c.current.openEvent) || t.set("positionReference", yt(u, {
|
|
131
|
+
x: P,
|
|
132
|
+
y: T,
|
|
133
|
+
axis: p,
|
|
134
|
+
dataRef: c,
|
|
135
|
+
pointerType: o
|
|
136
|
+
}));
|
|
137
|
+
}), h = U((P) => {
|
|
138
|
+
d != null || f != null || (r ? i.current || C([]) : m(P.clientX, P.clientY));
|
|
139
|
+
}), w = ot(o) ? g : r, E = a.useCallback(() => {
|
|
140
|
+
if (!w || !l || d != null || f != null)
|
|
141
|
+
return;
|
|
142
|
+
const P = ge(g);
|
|
143
|
+
function T(b) {
|
|
144
|
+
const x = he(b);
|
|
145
|
+
q(g, x) ? (P.removeEventListener("mousemove", T), i.current = null) : m(b.clientX, b.clientY);
|
|
146
|
+
}
|
|
147
|
+
if (!c.current.openEvent || ue(c.current.openEvent)) {
|
|
148
|
+
P.addEventListener("mousemove", T);
|
|
149
|
+
const b = () => {
|
|
150
|
+
P.removeEventListener("mousemove", T), i.current = null;
|
|
151
|
+
};
|
|
152
|
+
return i.current = b, b;
|
|
153
|
+
}
|
|
154
|
+
t.set("positionReference", u);
|
|
155
|
+
}, [w, l, d, f, g, c, u, t, m]);
|
|
156
|
+
a.useEffect(() => E(), [E, y]), a.useEffect(() => {
|
|
157
|
+
l && !g && (s.current = !1);
|
|
158
|
+
}, [l, g]), a.useEffect(() => {
|
|
159
|
+
!l && r && (s.current = !0);
|
|
160
|
+
}, [l, r]), N(() => {
|
|
161
|
+
l && (d != null || f != null) && (s.current = !1, m(d, f));
|
|
162
|
+
}, [l, d, f, m]);
|
|
163
|
+
const R = a.useMemo(() => {
|
|
164
|
+
function P(T) {
|
|
165
|
+
v(T.pointerType);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
onPointerDown: P,
|
|
169
|
+
onPointerEnter: P,
|
|
170
|
+
onMouseMove: h,
|
|
171
|
+
onMouseEnter: h
|
|
172
|
+
};
|
|
173
|
+
}, [h]);
|
|
174
|
+
return a.useMemo(() => l ? {
|
|
175
|
+
reference: R
|
|
176
|
+
} : {}, [l, R]);
|
|
177
|
+
}
|
|
178
|
+
const X = Xe && Ge;
|
|
179
|
+
function Pt(n, e = {}) {
|
|
180
|
+
const t = "rootStore" in n ? n.rootStore : n, {
|
|
181
|
+
events: r,
|
|
182
|
+
dataRef: g
|
|
183
|
+
} = t.context, {
|
|
184
|
+
enabled: u = !0,
|
|
185
|
+
visibleOnly: c = !0
|
|
186
|
+
} = e, l = a.useRef(!1), p = Ke(), d = a.useRef(!0);
|
|
187
|
+
a.useEffect(() => {
|
|
188
|
+
const s = t.select("domReferenceElement");
|
|
189
|
+
if (!u)
|
|
190
|
+
return;
|
|
191
|
+
const i = ge(s);
|
|
192
|
+
function o() {
|
|
193
|
+
!t.select("open") && me(s) && s === ie(tt(s)) && (l.current = !0);
|
|
194
|
+
}
|
|
195
|
+
function v() {
|
|
196
|
+
d.current = !0;
|
|
197
|
+
}
|
|
198
|
+
function y() {
|
|
199
|
+
d.current = !1;
|
|
200
|
+
}
|
|
201
|
+
return i.addEventListener("blur", o), X && (i.addEventListener("keydown", v, !0), i.addEventListener("pointerdown", y, !0)), () => {
|
|
202
|
+
i.removeEventListener("blur", o), X && (i.removeEventListener("keydown", v, !0), i.removeEventListener("pointerdown", y, !0));
|
|
203
|
+
};
|
|
204
|
+
}, [t, u]), a.useEffect(() => {
|
|
205
|
+
if (!u)
|
|
206
|
+
return;
|
|
207
|
+
function s(i) {
|
|
208
|
+
(i.reason === de || i.reason === fe) && (l.current = !0);
|
|
209
|
+
}
|
|
210
|
+
return r.on("openchange", s), () => {
|
|
211
|
+
r.off("openchange", s);
|
|
212
|
+
};
|
|
213
|
+
}, [r, u]);
|
|
214
|
+
const f = a.useMemo(() => ({
|
|
215
|
+
onMouseLeave() {
|
|
216
|
+
l.current = !1;
|
|
217
|
+
},
|
|
218
|
+
onFocus(s) {
|
|
219
|
+
if (l.current)
|
|
220
|
+
return;
|
|
221
|
+
const i = he(s.nativeEvent);
|
|
222
|
+
if (c && re(i)) {
|
|
223
|
+
if (X && !s.relatedTarget) {
|
|
224
|
+
if (!d.current && !Ze(i))
|
|
225
|
+
return;
|
|
226
|
+
} else if (!et(i))
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
t.setOpen(!0, F(G, s.nativeEvent, s.currentTarget));
|
|
230
|
+
},
|
|
231
|
+
onBlur(s) {
|
|
232
|
+
l.current = !1;
|
|
233
|
+
const i = s.relatedTarget, o = s.nativeEvent, v = re(i) && i.hasAttribute(Je("focus-guard")) && i.getAttribute("data-type") === "outside";
|
|
234
|
+
p.start(0, () => {
|
|
235
|
+
const y = t.select("domReferenceElement"), C = ie(y ? y.ownerDocument : document);
|
|
236
|
+
!i && C === y || q(g.current.floatingContext?.refs.floating.current, C) || q(y, C) || v || t.context.triggerElements.hasElement(s.relatedTarget) || t.setOpen(!1, F(G, o));
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}), [g, t, c, p]);
|
|
240
|
+
return a.useMemo(() => u ? {
|
|
241
|
+
reference: f,
|
|
242
|
+
trigger: f
|
|
243
|
+
} : {}, [u, f]);
|
|
244
|
+
}
|
|
245
|
+
function le(n) {
|
|
246
|
+
const e = Ye(n);
|
|
247
|
+
let t = parseFloat(e.width) || 0, r = parseFloat(e.height) || 0;
|
|
248
|
+
const g = me(n), u = g ? n.offsetWidth : t, c = g ? n.offsetHeight : r;
|
|
249
|
+
return (ae(t) !== u || ae(r) !== c) && (t = u, r = c), {
|
|
250
|
+
width: t,
|
|
251
|
+
height: r
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
const Tt = typeof ResizeObserver < "u", Ct = () => !0;
|
|
255
|
+
function bt(n) {
|
|
256
|
+
const {
|
|
257
|
+
popupElement: e,
|
|
258
|
+
positionerElement: t,
|
|
259
|
+
content: r,
|
|
260
|
+
mounted: g,
|
|
261
|
+
enabled: u = Ct,
|
|
262
|
+
onMeasureLayout: c,
|
|
263
|
+
onMeasureLayoutComplete: l,
|
|
264
|
+
side: p,
|
|
265
|
+
direction: d
|
|
266
|
+
} = n, f = a.useRef(!0), s = pt(e, !0, !1), i = gt(), o = a.useRef(null), v = U(c), y = U(l), C = a.useMemo(() => {
|
|
267
|
+
let m = p === "top", h = p === "left";
|
|
268
|
+
return d === "rtl" ? (m = m || p === "inline-end", h = h || p === "inline-end") : (m = m || p === "inline-start", h = h || p === "inline-start"), m ? {
|
|
269
|
+
position: "absolute",
|
|
270
|
+
[p === "top" ? "bottom" : "top"]: "0",
|
|
271
|
+
[h ? "right" : "left"]: "0"
|
|
272
|
+
} : Fe;
|
|
273
|
+
}, [p, d]);
|
|
274
|
+
N(() => {
|
|
275
|
+
if (!g || !u() || !Tt) {
|
|
276
|
+
f.current = !0, o.current = null;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (!e || !t)
|
|
280
|
+
return;
|
|
281
|
+
Object.entries(C).forEach(([x, O]) => {
|
|
282
|
+
e.style.setProperty(x, O);
|
|
283
|
+
});
|
|
284
|
+
const m = new ResizeObserver((x) => {
|
|
285
|
+
const O = x[0];
|
|
286
|
+
O && (o.current === null ? o.current = {
|
|
287
|
+
width: Math.ceil(O.borderBoxSize[0].inlineSize),
|
|
288
|
+
height: Math.ceil(O.borderBoxSize[0].blockSize)
|
|
289
|
+
} : (o.current.width = Math.ceil(O.borderBoxSize[0].inlineSize), o.current.height = Math.ceil(O.borderBoxSize[0].blockSize)));
|
|
290
|
+
});
|
|
291
|
+
m.observe(e), e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto");
|
|
292
|
+
const h = V(e, "position", "static"), w = V(e, "transform", "none"), E = V(e, "scale", "1"), R = V(t, "--available-width", "max-content"), P = V(t, "--available-height", "max-content");
|
|
293
|
+
if (v?.(), f.current || o.current === null) {
|
|
294
|
+
t.style.setProperty("--positioner-width", "max-content"), t.style.setProperty("--positioner-height", "max-content");
|
|
295
|
+
const x = le(e);
|
|
296
|
+
return t.style.setProperty("--positioner-width", `${x.width}px`), t.style.setProperty("--positioner-height", `${x.height}px`), h(), w(), E(), R(), P(), y?.(null, x), f.current = !1, () => {
|
|
297
|
+
m.disconnect();
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto"), t.style.setProperty("--positioner-width", "max-content"), t.style.setProperty("--positioner-height", "max-content");
|
|
301
|
+
const T = le(e);
|
|
302
|
+
e.style.setProperty("--popup-width", `${o.current.width}px`), e.style.setProperty("--popup-height", `${o.current.height}px`), h(), w(), R(), P(), y?.(o.current, T), t.style.setProperty("--positioner-width", `${T.width}px`), t.style.setProperty("--positioner-height", `${T.height}px`);
|
|
303
|
+
const b = new AbortController();
|
|
304
|
+
return i.request(() => {
|
|
305
|
+
e.style.setProperty("--popup-width", `${T.width}px`), e.style.setProperty("--popup-height", `${T.height}px`), s(() => {
|
|
306
|
+
e.style.setProperty("--popup-width", "auto"), e.style.setProperty("--popup-height", "auto");
|
|
307
|
+
}, b.signal);
|
|
308
|
+
}), () => {
|
|
309
|
+
m.disconnect(), b.abort(), i.cancel();
|
|
310
|
+
};
|
|
311
|
+
}, [r, e, t, s, i, u, g, v, y, C]);
|
|
312
|
+
}
|
|
313
|
+
function V(n, e, t) {
|
|
314
|
+
const r = n.style.getPropertyValue(e);
|
|
315
|
+
return n.style.setProperty(e, t), () => {
|
|
316
|
+
n.style.setProperty(e, r);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
const Q = /* @__PURE__ */ a.createContext(void 0);
|
|
320
|
+
process.env.NODE_ENV !== "production" && (Q.displayName = "TooltipRootContext");
|
|
321
|
+
function B(n) {
|
|
322
|
+
const e = a.useContext(Q);
|
|
323
|
+
if (e === void 0 && !n)
|
|
324
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : z(72));
|
|
325
|
+
return e;
|
|
326
|
+
}
|
|
327
|
+
const xt = {
|
|
328
|
+
...He,
|
|
329
|
+
disabled: D((n) => n.disabled),
|
|
330
|
+
instantType: D((n) => n.instantType),
|
|
331
|
+
isInstantPhase: D((n) => n.isInstantPhase),
|
|
332
|
+
trackCursorAxis: D((n) => n.trackCursorAxis),
|
|
333
|
+
disableHoverablePopup: D((n) => n.disableHoverablePopup),
|
|
334
|
+
lastOpenChangeReason: D((n) => n.openChangeReason),
|
|
335
|
+
closeDelay: D((n) => n.closeDelay)
|
|
336
|
+
};
|
|
337
|
+
class Z extends Oe {
|
|
338
|
+
constructor(e) {
|
|
339
|
+
super({
|
|
340
|
+
...St(),
|
|
341
|
+
...e
|
|
342
|
+
}, {
|
|
343
|
+
popupRef: /* @__PURE__ */ a.createRef(),
|
|
344
|
+
onOpenChange: void 0,
|
|
345
|
+
onOpenChangeComplete: void 0,
|
|
346
|
+
triggerElements: new Me()
|
|
347
|
+
}, xt);
|
|
348
|
+
}
|
|
349
|
+
setOpen = (e, t) => {
|
|
350
|
+
const r = t.reason, g = r === se, u = e && r === G, c = !e && (r === de || r === fe);
|
|
351
|
+
if (t.preventUnmountOnClose = () => {
|
|
352
|
+
this.set("preventUnmountingOnClose", !0);
|
|
353
|
+
}, this.context.onOpenChange?.(e, t), t.isCanceled)
|
|
354
|
+
return;
|
|
355
|
+
const l = () => {
|
|
356
|
+
const p = {
|
|
357
|
+
open: e,
|
|
358
|
+
openChangeReason: r
|
|
359
|
+
};
|
|
360
|
+
u ? p.instantType = "focus" : c ? p.instantType = "dismiss" : r === se && (p.instantType = void 0);
|
|
361
|
+
const d = t.trigger?.id ?? null;
|
|
362
|
+
(d || e) && (p.activeTriggerId = d, p.activeTriggerElement = t.trigger ?? null), this.update(p);
|
|
363
|
+
};
|
|
364
|
+
g ? Ve.flushSync(l) : l();
|
|
365
|
+
};
|
|
366
|
+
static useStore(e, t) {
|
|
367
|
+
const r = Be(() => e ?? new Z(t)).current, g = Ue({
|
|
368
|
+
popupStore: r,
|
|
369
|
+
onOpenChange: r.setOpen
|
|
370
|
+
});
|
|
371
|
+
return r.state.floatingRootContext = g, r;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
function St() {
|
|
375
|
+
return {
|
|
376
|
+
...ze(),
|
|
377
|
+
disabled: !1,
|
|
378
|
+
instantType: void 0,
|
|
379
|
+
isInstantPhase: !1,
|
|
380
|
+
trackCursorAxis: "none",
|
|
381
|
+
disableHoverablePopup: !1,
|
|
382
|
+
openChangeReason: null,
|
|
383
|
+
closeDelay: 0
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function Et(n) {
|
|
387
|
+
const {
|
|
388
|
+
disabled: e = !1,
|
|
389
|
+
defaultOpen: t = !1,
|
|
390
|
+
open: r,
|
|
391
|
+
disableHoverablePopup: g = !1,
|
|
392
|
+
trackCursorAxis: u = "none",
|
|
393
|
+
actionsRef: c,
|
|
394
|
+
onOpenChange: l,
|
|
395
|
+
onOpenChangeComplete: p,
|
|
396
|
+
handle: d,
|
|
397
|
+
triggerId: f,
|
|
398
|
+
defaultTriggerId: s = null,
|
|
399
|
+
children: i
|
|
400
|
+
} = n, o = Z.useStore(d?.store, {
|
|
401
|
+
open: r ?? t,
|
|
402
|
+
activeTriggerId: f !== void 0 ? f : s
|
|
403
|
+
});
|
|
404
|
+
o.useControlledProp("open", r, t), o.useControlledProp("activeTriggerId", f, s), o.useContextCallback("onOpenChange", l), o.useContextCallback("onOpenChangeComplete", p);
|
|
405
|
+
const v = o.useState("open"), y = o.useState("activeTriggerId"), C = o.useState("payload");
|
|
406
|
+
o.useSyncedValues({
|
|
407
|
+
trackCursorAxis: u,
|
|
408
|
+
disableHoverablePopup: g
|
|
409
|
+
});
|
|
410
|
+
const m = !e && v;
|
|
411
|
+
N(() => {
|
|
412
|
+
v && e && o.setOpen(!1, F(Le));
|
|
413
|
+
}, [v, e, o]), o.useSyncedValue("disabled", e), $e(o);
|
|
414
|
+
const {
|
|
415
|
+
forceUnmount: h,
|
|
416
|
+
transitionStatus: w
|
|
417
|
+
} = je(m, o), E = o.useState("isInstantPhase"), R = o.useState("instantType"), P = o.useState("lastOpenChangeReason"), T = a.useRef(null);
|
|
418
|
+
N(() => {
|
|
419
|
+
w === "ending" && P === pe || w !== "ending" && E ? (R !== "delay" && (T.current = R), o.set("instantType", "delay")) : T.current !== null && (o.set("instantType", T.current), T.current = null);
|
|
420
|
+
}, [w, E, P, R, o]), N(() => {
|
|
421
|
+
m && y == null && o.set("payload", void 0);
|
|
422
|
+
}, [o, y, m]);
|
|
423
|
+
const b = a.useCallback(() => {
|
|
424
|
+
o.setOpen(!1, Rt(o, ke));
|
|
425
|
+
}, [o]);
|
|
426
|
+
a.useImperativeHandle(c, () => ({
|
|
427
|
+
unmount: h,
|
|
428
|
+
close: b
|
|
429
|
+
}), [h, b]);
|
|
430
|
+
const x = o.useState("floatingRootContext"), O = Pt(x, {
|
|
431
|
+
enabled: !e
|
|
432
|
+
}), S = Ie(x, {
|
|
433
|
+
enabled: !e,
|
|
434
|
+
referencePress: !0
|
|
435
|
+
}), k = vt(x, {
|
|
436
|
+
enabled: !e && u !== "none",
|
|
437
|
+
axis: u === "none" ? void 0 : u
|
|
438
|
+
}), {
|
|
439
|
+
getReferenceProps: I,
|
|
440
|
+
getFloatingProps: A,
|
|
441
|
+
getTriggerProps: _
|
|
442
|
+
} = Ne([O, S, k]), L = a.useMemo(() => I(), [I]), j = a.useMemo(() => _(), [_]), oe = a.useMemo(() => A(), [A]);
|
|
443
|
+
return o.useSyncedValues({
|
|
444
|
+
floatingRootContext: x,
|
|
445
|
+
activeTriggerProps: L,
|
|
446
|
+
inactiveTriggerProps: j,
|
|
447
|
+
popupProps: oe
|
|
448
|
+
}), /* @__PURE__ */ M(Q.Provider, {
|
|
449
|
+
value: o,
|
|
450
|
+
children: typeof i == "function" ? i({
|
|
451
|
+
payload: C
|
|
452
|
+
}) : i
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function Rt(n, e) {
|
|
456
|
+
const t = F(e);
|
|
457
|
+
return t.preventUnmountOnClose = () => {
|
|
458
|
+
n.set("preventUnmountingOnClose", !0);
|
|
459
|
+
}, t;
|
|
460
|
+
}
|
|
461
|
+
const Pe = /* @__PURE__ */ a.createContext(void 0);
|
|
462
|
+
process.env.NODE_ENV !== "production" && (Pe.displayName = "TooltipProviderContext");
|
|
463
|
+
function wt() {
|
|
464
|
+
return a.useContext(Pe);
|
|
465
|
+
}
|
|
466
|
+
const Ot = 600, Te = /* @__PURE__ */ a.forwardRef(function(e, t) {
|
|
467
|
+
const {
|
|
468
|
+
className: r,
|
|
469
|
+
render: g,
|
|
470
|
+
handle: u,
|
|
471
|
+
payload: c,
|
|
472
|
+
disabled: l,
|
|
473
|
+
delay: p,
|
|
474
|
+
closeDelay: d,
|
|
475
|
+
id: f,
|
|
476
|
+
...s
|
|
477
|
+
} = e, i = B(!0), o = u?.store ?? i;
|
|
478
|
+
if (!o)
|
|
479
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : z(82));
|
|
480
|
+
const v = nt(f), y = o.useState("isTriggerActive", v), C = o.useState("floatingRootContext"), m = o.useState("isOpenedByTrigger", v), h = a.useRef(null), w = p ?? Ot, E = d ?? 0, {
|
|
481
|
+
registerTrigger: R,
|
|
482
|
+
isMountedByThisTrigger: P
|
|
483
|
+
} = We(v, h, o, {
|
|
484
|
+
payload: c,
|
|
485
|
+
closeDelay: E
|
|
486
|
+
}), T = wt(), {
|
|
487
|
+
delayRef: b,
|
|
488
|
+
isInstantPhase: x,
|
|
489
|
+
hasProvider: O
|
|
490
|
+
} = ht(C, {
|
|
491
|
+
open: m
|
|
492
|
+
});
|
|
493
|
+
o.useSyncedValue("isInstantPhase", x);
|
|
494
|
+
const S = o.useState("disabled"), k = l ?? S, I = o.useState("trackCursorAxis"), A = o.useState("disableHoverablePopup"), _ = rt(C, {
|
|
495
|
+
enabled: !k,
|
|
496
|
+
mouseOnly: !0,
|
|
497
|
+
move: !1,
|
|
498
|
+
handleClose: !A && I !== "both" ? it() : null,
|
|
499
|
+
restMs() {
|
|
500
|
+
const W = T?.delay, H = typeof b.current == "object" ? b.current.open : void 0;
|
|
501
|
+
let Y = w;
|
|
502
|
+
return O && (H !== 0 ? Y = p ?? W ?? w : Y = 0), Y;
|
|
503
|
+
},
|
|
504
|
+
delay() {
|
|
505
|
+
const W = typeof b.current == "object" ? b.current.close : void 0;
|
|
506
|
+
let H = E;
|
|
507
|
+
return d == null && O && (H = W), {
|
|
508
|
+
close: H
|
|
509
|
+
};
|
|
510
|
+
},
|
|
511
|
+
triggerElementRef: h,
|
|
512
|
+
isActiveTrigger: y
|
|
513
|
+
}), L = a.useMemo(() => ({
|
|
514
|
+
open: m
|
|
515
|
+
}), [m]), j = o.useState("triggerProps", P);
|
|
516
|
+
return $("button", e, {
|
|
517
|
+
state: L,
|
|
518
|
+
ref: [t, R, h],
|
|
519
|
+
props: [_, j, {
|
|
520
|
+
id: v
|
|
521
|
+
}, s],
|
|
522
|
+
stateAttributesMapping: De
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
process.env.NODE_ENV !== "production" && (Te.displayName = "TooltipTrigger");
|
|
526
|
+
const ee = /* @__PURE__ */ a.createContext(void 0);
|
|
527
|
+
process.env.NODE_ENV !== "production" && (ee.displayName = "TooltipPortalContext");
|
|
528
|
+
function Mt() {
|
|
529
|
+
const n = a.useContext(ee);
|
|
530
|
+
if (n === void 0)
|
|
531
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Tooltip.Portal> is missing." : z(70));
|
|
532
|
+
return n;
|
|
533
|
+
}
|
|
534
|
+
const Ce = /* @__PURE__ */ a.forwardRef(function(e, t) {
|
|
535
|
+
const {
|
|
536
|
+
keepMounted: r = !1,
|
|
537
|
+
...g
|
|
538
|
+
} = e;
|
|
539
|
+
return B().useState("mounted") || r ? /* @__PURE__ */ M(ee.Provider, {
|
|
540
|
+
value: r,
|
|
541
|
+
children: /* @__PURE__ */ M(ut, {
|
|
542
|
+
ref: t,
|
|
543
|
+
...g
|
|
544
|
+
})
|
|
545
|
+
}) : null;
|
|
546
|
+
});
|
|
547
|
+
process.env.NODE_ENV !== "production" && (Ce.displayName = "TooltipPortal");
|
|
548
|
+
const te = /* @__PURE__ */ a.createContext(void 0);
|
|
549
|
+
process.env.NODE_ENV !== "production" && (te.displayName = "TooltipPositionerContext");
|
|
550
|
+
function be() {
|
|
551
|
+
const n = a.useContext(te);
|
|
552
|
+
if (n === void 0)
|
|
553
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : z(71));
|
|
554
|
+
return n;
|
|
555
|
+
}
|
|
556
|
+
const xe = /* @__PURE__ */ a.forwardRef(function(e, t) {
|
|
557
|
+
const {
|
|
558
|
+
render: r,
|
|
559
|
+
className: g,
|
|
560
|
+
anchor: u,
|
|
561
|
+
positionMethod: c = "absolute",
|
|
562
|
+
side: l = "top",
|
|
563
|
+
align: p = "center",
|
|
564
|
+
sideOffset: d = 0,
|
|
565
|
+
alignOffset: f = 0,
|
|
566
|
+
collisionBoundary: s = "clipping-ancestors",
|
|
567
|
+
collisionPadding: i = 5,
|
|
568
|
+
arrowPadding: o = 5,
|
|
569
|
+
sticky: v = !1,
|
|
570
|
+
disableAnchorTracking: y = !1,
|
|
571
|
+
collisionAvoidance: C = Qe,
|
|
572
|
+
...m
|
|
573
|
+
} = e, h = B(), w = Mt(), E = h.useState("open"), R = h.useState("mounted"), P = h.useState("trackCursorAxis"), T = h.useState("disableHoverablePopup"), b = h.useState("floatingRootContext"), x = h.useState("instantType"), O = h.useState("transitionStatus"), S = lt({
|
|
574
|
+
anchor: u,
|
|
575
|
+
positionMethod: c,
|
|
576
|
+
floatingRootContext: b,
|
|
577
|
+
mounted: R,
|
|
578
|
+
side: l,
|
|
579
|
+
sideOffset: d,
|
|
580
|
+
align: p,
|
|
581
|
+
alignOffset: f,
|
|
582
|
+
collisionBoundary: s,
|
|
583
|
+
collisionPadding: i,
|
|
584
|
+
sticky: v,
|
|
585
|
+
arrowPadding: o,
|
|
586
|
+
disableAnchorTracking: y,
|
|
587
|
+
keepMounted: w,
|
|
588
|
+
collisionAvoidance: C,
|
|
589
|
+
adaptiveOrigin: ct
|
|
590
|
+
}), k = a.useMemo(() => {
|
|
591
|
+
const L = {};
|
|
592
|
+
return (!E || P === "both" || T) && (L.pointerEvents = "none"), {
|
|
593
|
+
role: "presentation",
|
|
594
|
+
hidden: !R,
|
|
595
|
+
style: {
|
|
596
|
+
...S.positionerStyles,
|
|
597
|
+
...L
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
}, [E, P, T, R, S.positionerStyles]), I = a.useMemo(() => ({
|
|
601
|
+
open: E,
|
|
602
|
+
side: S.side,
|
|
603
|
+
align: S.align,
|
|
604
|
+
anchorHidden: S.anchorHidden,
|
|
605
|
+
instant: P !== "none" ? "tracking-cursor" : x
|
|
606
|
+
}), [E, S.side, S.align, S.anchorHidden, P, x]), A = a.useMemo(() => ({
|
|
607
|
+
...I,
|
|
608
|
+
arrowRef: S.arrowRef,
|
|
609
|
+
arrowStyles: S.arrowStyles,
|
|
610
|
+
arrowUncentered: S.arrowUncentered
|
|
611
|
+
}), [I, S.arrowRef, S.arrowStyles, S.arrowUncentered]), _ = $("div", e, {
|
|
612
|
+
state: I,
|
|
613
|
+
props: [k, ye(O), m],
|
|
614
|
+
ref: [t, h.useStateSetter("positionerElement")],
|
|
615
|
+
stateAttributesMapping: J
|
|
616
|
+
});
|
|
617
|
+
return /* @__PURE__ */ M(te.Provider, {
|
|
618
|
+
value: A,
|
|
619
|
+
children: _
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
process.env.NODE_ENV !== "production" && (xe.displayName = "TooltipPositioner");
|
|
623
|
+
const It = {
|
|
624
|
+
...J,
|
|
625
|
+
...ft
|
|
626
|
+
}, Se = /* @__PURE__ */ a.forwardRef(function(e, t) {
|
|
627
|
+
const {
|
|
628
|
+
className: r,
|
|
629
|
+
render: g,
|
|
630
|
+
...u
|
|
631
|
+
} = e, c = B(), {
|
|
632
|
+
side: l,
|
|
633
|
+
align: p
|
|
634
|
+
} = be(), d = c.useState("open"), f = c.useState("mounted"), s = c.useState("instantType"), i = c.useState("transitionStatus"), o = c.useState("popupProps"), v = c.useState("payload"), y = c.useState("popupElement"), C = c.useState("positionerElement"), m = c.useState("floatingRootContext"), h = mt();
|
|
635
|
+
dt({
|
|
636
|
+
open: d,
|
|
637
|
+
ref: c.context.popupRef,
|
|
638
|
+
onComplete() {
|
|
639
|
+
d && c.context.onOpenChangeComplete?.(!0);
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
function w() {
|
|
643
|
+
m.context.events.emit("measure-layout");
|
|
644
|
+
}
|
|
645
|
+
function E(O, S) {
|
|
646
|
+
m.context.events.emit("measure-layout-complete", {
|
|
647
|
+
previousDimensions: O,
|
|
648
|
+
nextDimensions: S
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
const R = a.useCallback(() => c.context.triggerElements.size > 1, [c]);
|
|
652
|
+
bt({
|
|
653
|
+
popupElement: y,
|
|
654
|
+
positionerElement: C,
|
|
655
|
+
mounted: f,
|
|
656
|
+
content: v,
|
|
657
|
+
enabled: R,
|
|
658
|
+
onMeasureLayout: w,
|
|
659
|
+
onMeasureLayoutComplete: E,
|
|
660
|
+
side: l,
|
|
661
|
+
direction: h
|
|
662
|
+
});
|
|
663
|
+
const P = c.useState("disabled"), T = c.useState("closeDelay");
|
|
664
|
+
at(m, {
|
|
665
|
+
enabled: !P,
|
|
666
|
+
closeDelay: T
|
|
667
|
+
});
|
|
668
|
+
const b = a.useMemo(() => ({
|
|
669
|
+
open: d,
|
|
670
|
+
side: l,
|
|
671
|
+
align: p,
|
|
672
|
+
instant: s,
|
|
673
|
+
transitionStatus: i
|
|
674
|
+
}), [d, l, p, s, i]);
|
|
675
|
+
return $("div", e, {
|
|
676
|
+
state: b,
|
|
677
|
+
ref: [t, c.context.popupRef, c.useStateSetter("popupElement")],
|
|
678
|
+
props: [o, ye(i), u],
|
|
679
|
+
stateAttributesMapping: It
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
process.env.NODE_ENV !== "production" && (Se.displayName = "TooltipPopup");
|
|
683
|
+
const Ee = /* @__PURE__ */ a.forwardRef(function(e, t) {
|
|
684
|
+
const {
|
|
685
|
+
className: r,
|
|
686
|
+
render: g,
|
|
687
|
+
...u
|
|
688
|
+
} = e, l = B().useState("instantType"), {
|
|
689
|
+
open: p,
|
|
690
|
+
arrowRef: d,
|
|
691
|
+
side: f,
|
|
692
|
+
align: s,
|
|
693
|
+
arrowUncentered: i,
|
|
694
|
+
arrowStyles: o
|
|
695
|
+
} = be(), v = a.useMemo(() => ({
|
|
696
|
+
open: p,
|
|
697
|
+
side: f,
|
|
698
|
+
align: s,
|
|
699
|
+
uncentered: i,
|
|
700
|
+
instant: l
|
|
701
|
+
}), [p, f, s, i, l]);
|
|
702
|
+
return $("div", e, {
|
|
703
|
+
state: v,
|
|
704
|
+
ref: [t, d],
|
|
705
|
+
props: [{
|
|
706
|
+
style: o,
|
|
707
|
+
"aria-hidden": !0
|
|
708
|
+
}, u],
|
|
709
|
+
stateAttributesMapping: J
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
process.env.NODE_ENV !== "production" && (Ee.displayName = "TooltipArrow");
|
|
713
|
+
const Nt = "_tooltip_1v2fg_2", Dt = "_tooltip__arrow_1v2fg_11", K = {
|
|
714
|
+
tooltip: Nt,
|
|
715
|
+
tooltip__arrow: Dt,
|
|
716
|
+
"tooltip__arrow-icon": "_tooltip__arrow-icon_1v2fg_36"
|
|
717
|
+
};
|
|
718
|
+
function At({
|
|
719
|
+
children: n,
|
|
720
|
+
trigger: e,
|
|
721
|
+
align: t,
|
|
722
|
+
side: r,
|
|
723
|
+
className: g,
|
|
724
|
+
...u
|
|
725
|
+
}) {
|
|
726
|
+
return /* @__PURE__ */ ne(Et, { ...u, children: [
|
|
727
|
+
e ? /* @__PURE__ */ M(Te, { render: e }) : null,
|
|
728
|
+
/* @__PURE__ */ M(Ce, { children: /* @__PURE__ */ M(xe, { align: t, side: r, sideOffset: 8, children: /* @__PURE__ */ ne(
|
|
729
|
+
Se,
|
|
730
|
+
{
|
|
731
|
+
render: /* @__PURE__ */ M(_e, { background: "highest" }),
|
|
732
|
+
className: ce(
|
|
733
|
+
K.tooltip,
|
|
734
|
+
Ae.transition_scale,
|
|
735
|
+
g
|
|
736
|
+
),
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ M(Ee, { className: K.tooltip__arrow, children: /* @__PURE__ */ M(Re, {}) }),
|
|
739
|
+
we(n)
|
|
740
|
+
]
|
|
741
|
+
}
|
|
742
|
+
) }) })
|
|
743
|
+
] });
|
|
744
|
+
}
|
|
745
|
+
function Re(n) {
|
|
746
|
+
return /* @__PURE__ */ M(
|
|
747
|
+
"svg",
|
|
748
|
+
{
|
|
749
|
+
width: "10",
|
|
750
|
+
height: "5",
|
|
751
|
+
viewBox: "0 0 30 10",
|
|
752
|
+
preserveAspectRatio: "none",
|
|
753
|
+
className: ce(K["tooltip__arrow-icon"], n.className),
|
|
754
|
+
children: /* @__PURE__ */ M("polygon", { points: "0,0 30,0 15,10" })
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
const ro = Object.assign(At, {
|
|
759
|
+
Arrow: Re
|
|
760
|
+
});
|
|
761
|
+
export {
|
|
762
|
+
ro as T,
|
|
763
|
+
K as t,
|
|
764
|
+
bt as u
|
|
765
|
+
};
|