@servicetitan/anvil2 1.27.1 → 1.28.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/CHANGELOG.md +61 -0
- package/dist/{Alert-BmiMaHHl-C4TKrNF3.js → Alert-CRv6t4jJ-g1uOIz5i.js} +3 -3
- package/dist/{Alert-BmiMaHHl-C4TKrNF3.js.map → Alert-CRv6t4jJ-g1uOIz5i.js.map} +1 -1
- package/dist/{Alert-DhJoO6si.js → Alert-DPNaYO2Q.js} +2 -2
- package/dist/{Alert-DhJoO6si.js.map → Alert-DPNaYO2Q.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Announcement-DDIsOYU0.js → Announcement-CJmTMhbr.js} +2 -2
- package/dist/{Announcement-DDIsOYU0.js.map → Announcement-CJmTMhbr.js.map} +1 -1
- package/dist/Announcement.js +1 -1
- package/dist/AnvilProvider-C7Li86-d.js +16 -0
- package/dist/AnvilProvider-C7Li86-d.js.map +1 -0
- package/dist/AnvilProvider.js +1 -1
- package/dist/{Button-B2ruRsLb.js → Button-3sLNiaQN.js} +2 -2
- package/dist/{Button-B2ruRsLb.js.map → Button-3sLNiaQN.js.map} +1 -1
- package/dist/{Button-BHwg8Uip-DPU6y8-l.js → Button-Ce--YZ9L-Csh0Zzuf.js} +21 -21
- package/dist/{Button-BHwg8Uip-DPU6y8-l.js.map → Button-Ce--YZ9L-Csh0Zzuf.js.map} +1 -1
- package/dist/{Button-BHwg8Uip.css → Button-Ce--YZ9L.css} +47 -45
- package/dist/Button.js +1 -1
- package/dist/{ButtonCompound-DQ9LGk2K.js → ButtonCompound-CGci3MbQ.js} +2 -2
- package/dist/{ButtonCompound-DQ9LGk2K.js.map → ButtonCompound-CGci3MbQ.js.map} +1 -1
- package/dist/ButtonCompound.js +1 -1
- package/dist/{ButtonLink-CjxVUldA.js → ButtonLink-DcFTS_ob.js} +2 -2
- package/dist/{ButtonLink-CjxVUldA.js.map → ButtonLink-DcFTS_ob.js.map} +1 -1
- package/dist/ButtonLink.js +1 -1
- package/dist/{ButtonToggle-9HqVrCoP-DsNu__N0.js → ButtonToggle-BYwKq0iP-B4gHrxUt.js} +2 -2
- package/dist/{ButtonToggle-9HqVrCoP-DsNu__N0.js.map → ButtonToggle-BYwKq0iP-B4gHrxUt.js.map} +1 -1
- package/dist/{ButtonToggle-DYKdmH_u.js → ButtonToggle-CEHlQT_K.js} +2 -2
- package/dist/{ButtonToggle-DYKdmH_u.js.map → ButtonToggle-CEHlQT_K.js.map} +1 -1
- package/dist/ButtonToggle.js +1 -1
- package/dist/{Calendar-Z_nAtpoV-B0uWpOrw.js → Calendar-9iYMS0Iw-D_XWYjOE.js} +3 -3
- package/dist/{Calendar-Z_nAtpoV-B0uWpOrw.js.map → Calendar-9iYMS0Iw-D_XWYjOE.js.map} +1 -1
- package/dist/{Calendar-Dg_yoWxL.js → Calendar-CFsWEulW.js} +2 -2
- package/dist/{Calendar-Dg_yoWxL.js.map → Calendar-CFsWEulW.js.map} +1 -1
- package/dist/Calendar.js +1 -1
- package/dist/{Combobox-BRZIYucw.js → Combobox-JAm3x-tw.js} +1988 -118
- package/dist/Combobox-JAm3x-tw.js.map +1 -0
- package/dist/Combobox.css +343 -1
- package/dist/Combobox.js +1 -1
- package/dist/{DateField-DHIXyi2_.js → DateField-5mNXaJ7q.js} +549 -12
- package/dist/DateField-5mNXaJ7q.js.map +1 -0
- package/dist/DateField.js +1 -1
- package/dist/{Dialog-wuBdQ785.js → Dialog-B4M0DXxG.js} +2 -2
- package/dist/{Dialog-wuBdQ785.js.map → Dialog-B4M0DXxG.js.map} +1 -1
- package/dist/{Dialog-DDsVwnZZ-s9GGnSax.js → Dialog-CUK5YvVY-Dv5edacC.js} +6 -6
- package/dist/Dialog-CUK5YvVY-Dv5edacC.js.map +1 -0
- package/dist/Dialog.js +1 -1
- package/dist/Drawer-BqqZB3Sn.js +66 -0
- package/dist/Drawer-BqqZB3Sn.js.map +1 -0
- package/dist/{Drawer-BX7LCwCa.js → Drawer-CrXiK2w0-BMzKuNFt.js} +16 -76
- package/dist/Drawer-CrXiK2w0-BMzKuNFt.js.map +1 -0
- package/dist/Drawer.js +1 -1
- package/dist/{EditCard-CrlcI07q.js → EditCard-Nwz2BjY0.js} +2 -2
- package/dist/{EditCard-CrlcI07q.js.map → EditCard-Nwz2BjY0.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{Grid-kKviwk2y.js → Grid-DaeLjn0g.js} +35 -3
- package/dist/Grid-DaeLjn0g.js.map +1 -0
- package/dist/Grid.js +1 -1
- package/dist/{AnvilProvider-DNJk1Ait.js → HammerProvider-DuxhW0gv-C2voN5ro.js} +26 -15
- package/dist/HammerProvider-DuxhW0gv-C2voN5ro.js.map +1 -0
- package/dist/{InputMask-Cifzg7Ee.js → InputMask-BmXj5mob.js} +2 -2
- package/dist/{InputMask-Cifzg7Ee.js.map → InputMask-BmXj5mob.js.map} +1 -1
- package/dist/{InputMask-CiAjFhsc-Bnbf_ZQq.js → InputMask-CQzrMoEy-CLNvXsm7.js} +3 -3
- package/dist/{InputMask-CiAjFhsc-Bnbf_ZQq.js.map → InputMask-CQzrMoEy-CLNvXsm7.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/{Label-Do6kKzVr-BvIRT-vF.js → Label-CbYy5kwu-BCTOKxOk.js} +3 -3
- package/dist/{Label-Do6kKzVr-BvIRT-vF.js.map → Label-CbYy5kwu-BCTOKxOk.js.map} +1 -1
- package/dist/Menu-IEBrkdoN.js +1090 -0
- package/dist/Menu-IEBrkdoN.js.map +1 -0
- package/dist/Menu.css +116 -1
- package/dist/Menu.js +1 -1
- package/dist/{Page-C5GjTBZh.js → Page-qlpHVAMH.js} +72 -57
- package/dist/Page-qlpHVAMH.js.map +1 -0
- package/dist/Page.css +103 -70
- package/dist/Page.js +1 -1
- package/dist/{Popover-DAxtbeRA.js → Popover-B7K3o_l4.js} +2 -2
- package/dist/{Popover-DAxtbeRA.js.map → Popover-B7K3o_l4.js.map} +1 -1
- package/dist/{Popover-tcXHJePS-CMjz_uId.js → Popover-C1B3UJXp-B5obSIvA.js} +431 -39
- package/dist/Popover-C1B3UJXp-B5obSIvA.js.map +1 -0
- package/dist/{Popover-tcXHJePS.css → Popover-C1B3UJXp.css} +53 -1
- package/dist/Popover.js +1 -1
- package/dist/{ProgressBar-BrXijLda-BDwH4WrE.js → ProgressBar-BLg29adn-CMz5eu5f.js} +3 -3
- package/dist/{ProgressBar-BrXijLda-BDwH4WrE.js.map → ProgressBar-BLg29adn-CMz5eu5f.js.map} +1 -1
- package/dist/{ProgressBar-aP7gOxee.js → ProgressBar-_DyYSgfx.js} +2 -2
- package/dist/{ProgressBar-aP7gOxee.js.map → ProgressBar-_DyYSgfx.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{SearchField-CWb0kaV8.js → SearchField-C-4icPUa.js} +2 -2
- package/dist/{SearchField-CWb0kaV8.js.map → SearchField-C-4icPUa.js.map} +1 -1
- package/dist/SearchField.js +1 -1
- package/dist/{Stepper-CAuH-6cR.js → Stepper-c7C22LVq.js} +2 -2
- package/dist/{Stepper-CAuH-6cR.js.map → Stepper-c7C22LVq.js.map} +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/{TextField-C614D1ZV-DeVOfPoS.js → TextField-Lwe9XAou-tH8gcQTq.js} +2 -2
- package/dist/{TextField-C614D1ZV-DeVOfPoS.js.map → TextField-Lwe9XAou-tH8gcQTq.js.map} +1 -1
- package/dist/{TextField-BWHsVZiC.js → TextField-tF-ERwA8.js} +2 -2
- package/dist/{TextField-BWHsVZiC.js.map → TextField-tF-ERwA8.js.map} +1 -1
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-Dj47MRiF.js → Textarea-BrzxOEx3.js} +2 -2
- package/dist/Textarea-BrzxOEx3.js.map +1 -0
- package/dist/Textarea.js +1 -1
- package/dist/Toast.js +1 -1
- package/dist/{Toolbar-BAvsl6fK.js → Toolbar-D9fMSiGU.js} +24 -15
- package/dist/Toolbar-D9fMSiGU.js.map +1 -0
- package/dist/Toolbar.css +18 -18
- package/dist/Toolbar.js +1 -1
- package/dist/{Tooltip-DVBEjajY-DN86i_oi.js → Tooltip-36nMbVT3-DMkvo60s.js} +222 -22
- package/dist/Tooltip-36nMbVT3-DMkvo60s.js.map +1 -0
- package/dist/{Tooltip-DVBEjajY.css → Tooltip-36nMbVT3.css} +43 -1
- package/dist/{Tooltip-D38gdiV_.js → Tooltip-BEo0IRDf.js} +2 -2
- package/dist/{Tooltip-D38gdiV_.js.map → Tooltip-BEo0IRDf.js.map} +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components/Grid/Grid.d.ts +5 -2
- package/dist/components/Page/Page.d.ts +4 -1
- package/dist/floating-ui.react-4AwURJA3.js +5989 -0
- package/dist/floating-ui.react-4AwURJA3.js.map +1 -0
- package/dist/{useKeyboardFocusables-C3hMtJK_-Cz39LRmZ.js → index.esm-CunAFnrh.js} +167 -53
- package/dist/index.esm-CunAFnrh.js.map +1 -0
- package/dist/index.js +26 -26
- package/dist/more_vert-C_lJSyxt.js +6 -0
- package/dist/more_vert-C_lJSyxt.js.map +1 -0
- package/dist/supportsPopover-8aJR37cf-8aJR37cf.js +6 -0
- package/dist/supportsPopover-8aJR37cf-8aJR37cf.js.map +1 -0
- package/dist/{toast-DMKrL2Ew.js → toast-DkO9HWpH.js} +4 -4
- package/dist/{toast-DMKrL2Ew.js.map → toast-DkO9HWpH.js.map} +1 -1
- package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js +61 -0
- package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js.map +1 -0
- package/package.json +2 -2
- package/dist/AnvilProvider-DNJk1Ait.js.map +0 -1
- package/dist/Combobox-BRZIYucw.js.map +0 -1
- package/dist/DateField-DHIXyi2_.js.map +0 -1
- package/dist/Dialog-DDsVwnZZ-s9GGnSax.js.map +0 -1
- package/dist/Drawer-BX7LCwCa.js.map +0 -1
- package/dist/Grid-kKviwk2y.js.map +0 -1
- package/dist/Menu-COlGXBmd.js +0 -706
- package/dist/Menu-COlGXBmd.js.map +0 -1
- package/dist/Page-C5GjTBZh.js.map +0 -1
- package/dist/Popover-tcXHJePS-CMjz_uId.js.map +0 -1
- package/dist/Textarea-Dj47MRiF.js.map +0 -1
- package/dist/Toolbar-BAvsl6fK.js.map +0 -1
- package/dist/Tooltip-DVBEjajY-DN86i_oi.js.map +0 -1
- package/dist/floating-ui.react-P5949bpO.js +0 -28
- package/dist/floating-ui.react-P5949bpO.js.map +0 -1
- package/dist/floating-ui.react-dom-D912oS4K.js +0 -1841
- package/dist/floating-ui.react-dom-D912oS4K.js.map +0 -1
- package/dist/useKeyboardFocusables-C3hMtJK_-Cz39LRmZ.js.map +0 -1
- /package/dist/{Alert-BmiMaHHl.css → Alert-CRv6t4jJ.css} +0 -0
- /package/dist/{Calendar-Z_nAtpoV.css → Calendar-9iYMS0Iw.css} +0 -0
- /package/dist/{Dialog-DDsVwnZZ.css → Dialog-CUK5YvVY.css} +0 -0
- /package/dist/{Drawer.css → Drawer-CrXiK2w0.css} +0 -0
- /package/dist/{Label-Do6kKzVr.css → Label-CbYy5kwu.css} +0 -0
- /package/dist/{ProgressBar-BrXijLda.css → ProgressBar-BLg29adn.css} +0 -0
|
@@ -1,13 +1,324 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import { e as DialogContext } from './Dialog-
|
|
4
|
-
import { B as Button } from './Button-
|
|
5
|
-
import {
|
|
6
|
-
import { g as
|
|
2
|
+
import { createContext, useRef, forwardRef, useContext, useMemo, useState, useEffect, useLayoutEffect, useId, useCallback } from 'react';
|
|
3
|
+
import { e as DialogContext } from './Dialog-CUK5YvVY-Dv5edacC.js';
|
|
4
|
+
import { B as Button } from './Button-Ce--YZ9L-Csh0Zzuf.js';
|
|
5
|
+
import { s as supportsPopover } from './supportsPopover-8aJR37cf-8aJR37cf.js';
|
|
6
|
+
import { F as FloatingPortal, q as FloatingFocusManager, b as FloatingArrow, d as useFloating, e as autoUpdate, o as offset, r as size, f as flip, s as shift, l as limitShift, g as arrow$1, t as useClick, h as useHover, i as safePolygon, k as useDismiss, m as useRole, n as useInteractions, p as computePosition } from './floating-ui.react-4AwURJA3.js';
|
|
7
7
|
import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as cx } from './index-tZvMCc77.js';
|
|
9
|
+
import { a as PortalProviderContext } from './PortalProvider-9lXkQ0xY-BKoGegS1.js';
|
|
10
|
+
import { e as DrawerContext } from './Drawer-CrXiK2w0-BMzKuNFt.js';
|
|
11
|
+
import { T as ThemeProvider, a as ThemeProviderContext } from './ThemeProvider-CioBp3gk-B6HyDICa.js';
|
|
12
|
+
import { u as useKeyboardFocusables } from './useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js';
|
|
13
|
+
|
|
14
|
+
import './Popover-C1B3UJXp.css';function usePopoverLegacy({
|
|
15
|
+
defaultOpen,
|
|
16
|
+
placement = "bottom",
|
|
17
|
+
modal,
|
|
18
|
+
open: controlledOpen,
|
|
19
|
+
onOpenChange: setControlledOpen,
|
|
20
|
+
onOutsidePress,
|
|
21
|
+
onClose,
|
|
22
|
+
disableCloseOnClickOutside,
|
|
23
|
+
disableCloseOnEscape,
|
|
24
|
+
openOnHover,
|
|
25
|
+
fillAvailableHeight,
|
|
26
|
+
fitScreen,
|
|
27
|
+
maxHeight,
|
|
28
|
+
minHeight = "2.875rem",
|
|
29
|
+
matchReferenceWidth,
|
|
30
|
+
fixedWidth,
|
|
31
|
+
disableCaret,
|
|
32
|
+
noPadding,
|
|
33
|
+
disableShift,
|
|
34
|
+
disableFlip,
|
|
35
|
+
disableFlipFallback,
|
|
36
|
+
disableAutoUpdate,
|
|
37
|
+
disableFocusLock,
|
|
38
|
+
disableTriggerFocus,
|
|
39
|
+
root
|
|
40
|
+
} = {}) {
|
|
41
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
42
|
+
const [labelId, setLabelId] = useState();
|
|
43
|
+
const [descriptionId, setDescriptionId] = useState();
|
|
44
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
45
|
+
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
46
|
+
const arrowRef = useRef(null);
|
|
47
|
+
const processMinHeight = typeof minHeight === "string" ? minHeight : `${minHeight}px`;
|
|
48
|
+
const data = useFloating({
|
|
49
|
+
placement,
|
|
50
|
+
open,
|
|
51
|
+
onOpenChange: setOpen,
|
|
52
|
+
whileElementsMounted: !disableAutoUpdate ? autoUpdate : undefined,
|
|
53
|
+
middleware: [
|
|
54
|
+
offset(8),
|
|
55
|
+
size({
|
|
56
|
+
padding: 5,
|
|
57
|
+
apply({ rects, availableHeight, elements }) {
|
|
58
|
+
Object.assign(elements.floating.style, {
|
|
59
|
+
...matchReferenceWidth ? { width: `${rects.reference.width}px` } : fixedWidth ? { width: "40dvw" } : {},
|
|
60
|
+
...fillAvailableHeight ? {
|
|
61
|
+
height: `${availableHeight - 20}px`,
|
|
62
|
+
minHeight: processMinHeight
|
|
63
|
+
} : {},
|
|
64
|
+
...maxHeight ? {
|
|
65
|
+
minHeight: processMinHeight,
|
|
66
|
+
height: fitScreen ? typeof maxHeight === "string" ? maxHeight : `${maxHeight}px` : undefined,
|
|
67
|
+
maxHeight: fitScreen ? `${availableHeight - 20}px` : typeof maxHeight === "string" ? maxHeight : `${maxHeight}px`
|
|
68
|
+
} : {},
|
|
69
|
+
...fitScreen && !maxHeight ? {
|
|
70
|
+
minHeight: processMinHeight,
|
|
71
|
+
maxHeight: `${availableHeight - 20}px`
|
|
72
|
+
} : {},
|
|
73
|
+
zIndex: 1
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
flip({
|
|
78
|
+
mainAxis: !disableFlip,
|
|
79
|
+
crossAxis: false,
|
|
80
|
+
fallbackAxisSideDirection: disableFlipFallback ? "none" : "end",
|
|
81
|
+
padding: 5
|
|
82
|
+
}),
|
|
83
|
+
shift({
|
|
84
|
+
padding: 5,
|
|
85
|
+
mainAxis: !disableShift,
|
|
86
|
+
crossAxis: false,
|
|
87
|
+
limiter: limitShift({
|
|
88
|
+
mainAxis: !disableShift
|
|
89
|
+
})
|
|
90
|
+
}),
|
|
91
|
+
arrow$1({ element: !disableCaret ? arrowRef : null, padding: 5 })
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
const context = data.context;
|
|
95
|
+
const click = useClick(context, {
|
|
96
|
+
enabled: controlledOpen == null && !openOnHover
|
|
97
|
+
});
|
|
98
|
+
const hover = useHover(context, {
|
|
99
|
+
enabled: controlledOpen == null && !!openOnHover,
|
|
100
|
+
handleClose: safePolygon()
|
|
101
|
+
});
|
|
102
|
+
const dismiss = useDismiss(context, {
|
|
103
|
+
escapeKey: !disableCloseOnEscape,
|
|
104
|
+
outsidePress: (event) => {
|
|
105
|
+
if (disableCloseOnClickOutside) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const result = typeof onOutsidePress === "function" ? onOutsidePress?.(event) : true;
|
|
109
|
+
if (!result) {
|
|
110
|
+
return result;
|
|
111
|
+
} else {
|
|
112
|
+
onClose?.();
|
|
113
|
+
setOpen(false);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const role = useRole(context);
|
|
119
|
+
const interactions = useInteractions([click, hover, dismiss, role]);
|
|
120
|
+
return useMemo(
|
|
121
|
+
() => ({
|
|
122
|
+
open,
|
|
123
|
+
setOpen,
|
|
124
|
+
onClose,
|
|
125
|
+
...interactions,
|
|
126
|
+
...data,
|
|
127
|
+
modal,
|
|
128
|
+
labelId,
|
|
129
|
+
descriptionId,
|
|
130
|
+
setLabelId,
|
|
131
|
+
setDescriptionId,
|
|
132
|
+
arrowRef,
|
|
133
|
+
disableCaret,
|
|
134
|
+
noPadding,
|
|
135
|
+
fillAvailableHeight,
|
|
136
|
+
maxHeight,
|
|
137
|
+
matchReferenceWidth,
|
|
138
|
+
fixedWidth,
|
|
139
|
+
disableFlipFallback,
|
|
140
|
+
disableAutoUpdate,
|
|
141
|
+
disableFocusLock,
|
|
142
|
+
disableTriggerFocus,
|
|
143
|
+
root
|
|
144
|
+
}),
|
|
145
|
+
[
|
|
146
|
+
open,
|
|
147
|
+
setOpen,
|
|
148
|
+
onClose,
|
|
149
|
+
interactions,
|
|
150
|
+
data,
|
|
151
|
+
modal,
|
|
152
|
+
labelId,
|
|
153
|
+
descriptionId,
|
|
154
|
+
disableCaret,
|
|
155
|
+
noPadding,
|
|
156
|
+
fillAvailableHeight,
|
|
157
|
+
maxHeight,
|
|
158
|
+
matchReferenceWidth,
|
|
159
|
+
fixedWidth,
|
|
160
|
+
disableFlipFallback,
|
|
161
|
+
disableAutoUpdate,
|
|
162
|
+
disableFocusLock,
|
|
163
|
+
disableTriggerFocus,
|
|
164
|
+
root
|
|
165
|
+
]
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const PopoverLegacyContext = createContext(null);
|
|
170
|
+
const usePopoverLegacyContext = () => {
|
|
171
|
+
const context = useContext(PopoverLegacyContext);
|
|
172
|
+
if (context == null) {
|
|
173
|
+
throw new Error("Popover components must be wrapped in <Popover />");
|
|
174
|
+
}
|
|
175
|
+
return context;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const PopoverLegacyTrigger = function PopoverLegacyTrigger2(props) {
|
|
179
|
+
const { children } = props;
|
|
180
|
+
const context = usePopoverLegacyContext();
|
|
181
|
+
const ref = useRef(null);
|
|
182
|
+
const mergedRef = useMergeRefs([context.refs.setReference, ref]);
|
|
183
|
+
return children({
|
|
184
|
+
"data-state": context.open ? "open" : "closed",
|
|
185
|
+
"data-anv": "popover-trigger",
|
|
186
|
+
...context.getReferenceProps({ ref: mergedRef })
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const styles$1 = {
|
|
191
|
+
"content-legacy": "_content-legacy_v59n0_4",
|
|
192
|
+
"scroller-legacy": "_scroller-legacy_v59n0_28",
|
|
193
|
+
"arrow-legacy": "_arrow-legacy_v59n0_35",
|
|
194
|
+
"no-padding": "_no-padding_v59n0_46"
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const PopoverLegacyContent = forwardRef(function PopoverContent({ className, style, ...props }, propRef) {
|
|
198
|
+
const {
|
|
199
|
+
context: floatingContext,
|
|
200
|
+
theme,
|
|
201
|
+
mode,
|
|
202
|
+
disableCaret,
|
|
203
|
+
noPadding,
|
|
204
|
+
onClose,
|
|
205
|
+
disableFocusLock,
|
|
206
|
+
disableTriggerFocus,
|
|
207
|
+
root,
|
|
208
|
+
...context
|
|
209
|
+
} = usePopoverLegacyContext();
|
|
210
|
+
const dialogContext = useContext(DialogContext);
|
|
211
|
+
const drawerContext = useContext(DrawerContext);
|
|
212
|
+
const { root: portalRoot } = useContext(PortalProviderContext);
|
|
213
|
+
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
214
|
+
if (!floatingContext.open) return null;
|
|
215
|
+
if (dialogContext && !dialogContext?.ref?.current) return null;
|
|
216
|
+
const popoverClassNames = cx(className, styles$1["content-legacy"], {
|
|
217
|
+
[styles$1["no-padding"]]: noPadding
|
|
218
|
+
});
|
|
219
|
+
const onKeyDownHandler = (e) => {
|
|
220
|
+
if (e.code === "Escape") {
|
|
221
|
+
onClose?.();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
return /* @__PURE__ */ jsx(
|
|
225
|
+
FloatingPortal,
|
|
226
|
+
{
|
|
227
|
+
root: root ?? dialogContext?.ref?.current ?? drawerContext?.ref?.current ?? portalRoot,
|
|
228
|
+
children: /* @__PURE__ */ jsx(
|
|
229
|
+
FloatingFocusManager,
|
|
230
|
+
{
|
|
231
|
+
context: floatingContext,
|
|
232
|
+
modal: context.modal,
|
|
233
|
+
order: disableTriggerFocus ? ["content"] : ["reference", "content"],
|
|
234
|
+
disabled: disableFocusLock,
|
|
235
|
+
children: /* @__PURE__ */ jsx(ThemeProvider, { theme, mode, children: /* @__PURE__ */ jsxs(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
ref,
|
|
239
|
+
"data-anv": "popover-content",
|
|
240
|
+
style: { ...context.floatingStyles, ...style },
|
|
241
|
+
"aria-labelledby": context.labelId,
|
|
242
|
+
"aria-describedby": context.descriptionId,
|
|
243
|
+
className: popoverClassNames,
|
|
244
|
+
...context.getFloatingProps(props),
|
|
245
|
+
onKeyDown: onKeyDownHandler,
|
|
246
|
+
role: "presentation",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsx("div", { className: styles$1["scroller-legacy"], children: props.children }),
|
|
249
|
+
!disableCaret && /* @__PURE__ */ jsx(
|
|
250
|
+
FloatingArrow,
|
|
251
|
+
{
|
|
252
|
+
ref: context.arrowRef,
|
|
253
|
+
context: floatingContext,
|
|
254
|
+
className: styles$1["arrow-legacy"]
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
) })
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
});
|
|
9
265
|
|
|
10
|
-
|
|
266
|
+
const PopoverLegacyClose = forwardRef(function PopoverClose(props, ref) {
|
|
267
|
+
const { setOpen, onClose } = usePopoverLegacyContext();
|
|
268
|
+
return /* @__PURE__ */ jsx(
|
|
269
|
+
Button,
|
|
270
|
+
{
|
|
271
|
+
ref,
|
|
272
|
+
"data-anv": "popover-close",
|
|
273
|
+
...props,
|
|
274
|
+
onClick: (event) => {
|
|
275
|
+
props.onClick?.(event);
|
|
276
|
+
onClose?.();
|
|
277
|
+
setOpen(false);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
const PopoverLegacyButton = forwardRef(function PopoverButton(props, ref) {
|
|
284
|
+
const { children, size, ...rest } = props;
|
|
285
|
+
const context = usePopoverLegacyContext();
|
|
286
|
+
const childrenRef = children.ref;
|
|
287
|
+
const mergedRef = useMergeRefs([context.refs.setReference, ref, childrenRef]);
|
|
288
|
+
return /* @__PURE__ */ jsx(
|
|
289
|
+
Button,
|
|
290
|
+
{
|
|
291
|
+
ref: mergedRef,
|
|
292
|
+
size,
|
|
293
|
+
"data-state": context.open ? "open" : "closed",
|
|
294
|
+
"data-anv": "popover-button",
|
|
295
|
+
...context.getReferenceProps(rest),
|
|
296
|
+
children
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
function PopoverLegacyElement({
|
|
302
|
+
children,
|
|
303
|
+
modal,
|
|
304
|
+
...restOptions
|
|
305
|
+
}) {
|
|
306
|
+
const popover = usePopoverLegacy({ modal, ...restOptions });
|
|
307
|
+
const { theme, mode = "light" } = useContext(ThemeProviderContext);
|
|
308
|
+
const value = useMemo(
|
|
309
|
+
() => ({ ...popover, theme, mode }),
|
|
310
|
+
[mode, popover, theme]
|
|
311
|
+
);
|
|
312
|
+
return /* @__PURE__ */ jsx(PopoverLegacyContext.Provider, { value, children });
|
|
313
|
+
}
|
|
314
|
+
const PopoverLegacy = Object.assign(PopoverLegacyElement, {
|
|
315
|
+
Trigger: PopoverLegacyTrigger,
|
|
316
|
+
Close: PopoverLegacyClose,
|
|
317
|
+
Content: PopoverLegacyContent,
|
|
318
|
+
Button: PopoverLegacyButton
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const useOnClickOutside = ({
|
|
11
322
|
onOutsidePress,
|
|
12
323
|
targets,
|
|
13
324
|
onClose
|
|
@@ -52,6 +363,52 @@ import './Popover-tcXHJePS.css';const useOnClickOutside = ({
|
|
|
52
363
|
}, [onClose, onOutsidePress, targets]);
|
|
53
364
|
};
|
|
54
365
|
|
|
366
|
+
function compareElements(el1, el2, excludeAttributes = []) {
|
|
367
|
+
if (!el1 || !el2 || el1.tagName !== el2.tagName) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
const getFilteredAttributes = (attrs) => {
|
|
371
|
+
const filtered = {};
|
|
372
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
373
|
+
const attr = attrs[i];
|
|
374
|
+
if (!excludeAttributes.includes(attr.name)) {
|
|
375
|
+
filtered[attr.name] = attr.value;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return filtered;
|
|
379
|
+
};
|
|
380
|
+
const filteredAttrs1 = getFilteredAttributes(el1.attributes);
|
|
381
|
+
const filteredAttrs2 = getFilteredAttributes(el2.attributes);
|
|
382
|
+
const keys1 = Object.keys(filteredAttrs1);
|
|
383
|
+
const keys2 = Object.keys(filteredAttrs2);
|
|
384
|
+
if (keys1.length !== keys2.length) return false;
|
|
385
|
+
for (const key of keys1) {
|
|
386
|
+
if (filteredAttrs1[key] !== filteredAttrs2[key]) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const isOnlyText1 = el1.childNodes.length === 1 && el1.childNodes[0].nodeType === Node.TEXT_NODE;
|
|
391
|
+
const isOnlyText2 = el2.childNodes.length === 1 && el2.childNodes[0].nodeType === Node.TEXT_NODE;
|
|
392
|
+
if (isOnlyText1 && isOnlyText2) {
|
|
393
|
+
if (el1.textContent?.trim() !== el2.textContent?.trim()) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const children1 = el1.children;
|
|
398
|
+
const children2 = el2.children;
|
|
399
|
+
if (children1.length !== children2.length) return false;
|
|
400
|
+
for (let i = 0; i < children1.length; i++) {
|
|
401
|
+
if (!compareElements(
|
|
402
|
+
children1[i],
|
|
403
|
+
children2[i],
|
|
404
|
+
excludeAttributes
|
|
405
|
+
)) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
|
|
55
412
|
function usePopoverContext() {
|
|
56
413
|
const context = useContext(PopoverContext);
|
|
57
414
|
const invokerRef = useRef(null);
|
|
@@ -87,18 +444,12 @@ function usePopoverContext() {
|
|
|
87
444
|
};
|
|
88
445
|
const onKeyDownHandler = (e) => {
|
|
89
446
|
if (!context?.openState) return;
|
|
90
|
-
if (e.code === "Escape" && !context
|
|
447
|
+
if (e.code === "Escape" && !context?.disableCloseOnEscape && !context?.controlled) {
|
|
91
448
|
context?.closePopover();
|
|
92
449
|
return;
|
|
93
450
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (e.code === "Tab" && !e.shiftKey && context?.modal) {
|
|
97
|
-
focusables[0].focus();
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (e.code === "Tab" && e.shiftKey && context?.modal) {
|
|
451
|
+
const focusables = context.focusables;
|
|
452
|
+
if (e.code === "Tab" && e.shiftKey && context?.modal && focusables) {
|
|
102
453
|
focusables[focusables.length - 1].focus();
|
|
103
454
|
e.preventDefault();
|
|
104
455
|
return;
|
|
@@ -144,6 +495,7 @@ function usePopoverContext() {
|
|
|
144
495
|
arrowRef,
|
|
145
496
|
key: context.resetKey
|
|
146
497
|
},
|
|
498
|
+
rootNode: context.rootNode,
|
|
147
499
|
onClose: context.onClose,
|
|
148
500
|
setOpen: context.setOpenState,
|
|
149
501
|
open: context.openState,
|
|
@@ -161,7 +513,8 @@ function usePopoverContext() {
|
|
|
161
513
|
fixedWidth: context.fixedWidth,
|
|
162
514
|
disableFlipFallback: context.disableFlipFallback,
|
|
163
515
|
disableFocusLock: context.modal,
|
|
164
|
-
disableTriggerFocus: context.disableTriggerFocus
|
|
516
|
+
disableTriggerFocus: context.disableTriggerFocus,
|
|
517
|
+
focusables: context.focusables
|
|
165
518
|
};
|
|
166
519
|
}
|
|
167
520
|
|
|
@@ -203,10 +556,19 @@ const PopoverButton = forwardRef(
|
|
|
203
556
|
onClick?.(e);
|
|
204
557
|
context?.invoker.onClick();
|
|
205
558
|
};
|
|
559
|
+
const buttonRef = useMergeRefs([context?.invoker.ref, ref]);
|
|
560
|
+
if (!supportsPopover())
|
|
561
|
+
return /* @__PURE__ */ jsx(
|
|
562
|
+
PopoverLegacyButton,
|
|
563
|
+
{
|
|
564
|
+
...props,
|
|
565
|
+
ref
|
|
566
|
+
}
|
|
567
|
+
);
|
|
206
568
|
return /* @__PURE__ */ jsx(
|
|
207
569
|
Button,
|
|
208
570
|
{
|
|
209
|
-
ref:
|
|
571
|
+
ref: buttonRef,
|
|
210
572
|
size,
|
|
211
573
|
onClick: onClickHandler,
|
|
212
574
|
onKeyDown: onKeyDownHandler,
|
|
@@ -230,6 +592,8 @@ const PopoverClose = forwardRef(
|
|
|
230
592
|
function PopoverClose2(props, ref) {
|
|
231
593
|
const { onClick, ...rest } = props;
|
|
232
594
|
const context = usePopoverContext();
|
|
595
|
+
if (!supportsPopover())
|
|
596
|
+
return /* @__PURE__ */ jsx(PopoverLegacyClose, { ...props, ref });
|
|
233
597
|
return /* @__PURE__ */ jsx(
|
|
234
598
|
Button,
|
|
235
599
|
{
|
|
@@ -280,15 +644,11 @@ const PopoverContent = forwardRef(
|
|
|
280
644
|
[styles["no-padding"]]: context?.noPadding
|
|
281
645
|
});
|
|
282
646
|
const childrenRef = useRef(null);
|
|
283
|
-
const focusItems = useRef();
|
|
284
647
|
const combinedStyles = {
|
|
285
648
|
...style,
|
|
286
649
|
...context?.popover.style
|
|
287
650
|
};
|
|
288
|
-
|
|
289
|
-
const focusElements = getKeyboardFocusableElements(childrenRef.current);
|
|
290
|
-
focusItems.current = focusElements;
|
|
291
|
-
}, [childrenRef, children, context?.open]);
|
|
651
|
+
const focusables = context?.focusables;
|
|
292
652
|
const onMouseEnterHandler = (e) => {
|
|
293
653
|
onMouseEnter?.(e);
|
|
294
654
|
if (!context?.openOnHover) return;
|
|
@@ -310,15 +670,18 @@ const PopoverContent = forwardRef(
|
|
|
310
670
|
};
|
|
311
671
|
const onKeyDownHandler = (e) => {
|
|
312
672
|
onKeyDown?.(e);
|
|
313
|
-
if (!context?.
|
|
314
|
-
if (e.code === "Escape" && !context.disableCloseOnEscape) {
|
|
673
|
+
if (e.code === "Escape" && !context?.disableCloseOnEscape) {
|
|
315
674
|
context?.popover.close();
|
|
316
675
|
}
|
|
317
|
-
if (!context
|
|
676
|
+
if (!context?.modal) return;
|
|
318
677
|
if (e.code === "Tab" && !e.shiftKey) {
|
|
319
|
-
if (
|
|
678
|
+
if (focusables && compareElements(
|
|
679
|
+
context.rootNode?.activeElement,
|
|
680
|
+
focusables[focusables.length - 1],
|
|
681
|
+
["tabindex"]
|
|
682
|
+
)) {
|
|
320
683
|
if (context.disableTriggerFocus) {
|
|
321
|
-
|
|
684
|
+
focusables[0].focus();
|
|
322
685
|
} else {
|
|
323
686
|
context.invoker.element?.focus();
|
|
324
687
|
context.popover.show();
|
|
@@ -327,9 +690,13 @@ const PopoverContent = forwardRef(
|
|
|
327
690
|
}
|
|
328
691
|
}
|
|
329
692
|
if (e.code === "Tab" && e.shiftKey) {
|
|
330
|
-
if (
|
|
693
|
+
if (focusables && compareElements(
|
|
694
|
+
context.rootNode.activeElement,
|
|
695
|
+
focusables[0],
|
|
696
|
+
["tabindex"]
|
|
697
|
+
)) {
|
|
331
698
|
if (context.disableTriggerFocus) {
|
|
332
|
-
|
|
699
|
+
focusables[focusables.length - 1].focus();
|
|
333
700
|
} else {
|
|
334
701
|
context.invoker.element?.focus();
|
|
335
702
|
context.popover.show();
|
|
@@ -339,6 +706,16 @@ const PopoverContent = forwardRef(
|
|
|
339
706
|
}
|
|
340
707
|
};
|
|
341
708
|
const manualPopover = context?.controlled || context?.disableCloseOnClickOutside || context?.disableCloseOnEscape || context?.openOnHover;
|
|
709
|
+
const popoverContentRef = useMergeRefs([context?.popover.ref, ref]);
|
|
710
|
+
const popoverScrollerRef = useMergeRefs([childrenRef, scrollerRef]);
|
|
711
|
+
if (!supportsPopover())
|
|
712
|
+
return /* @__PURE__ */ jsx(
|
|
713
|
+
PopoverLegacyContent,
|
|
714
|
+
{
|
|
715
|
+
...props,
|
|
716
|
+
ref
|
|
717
|
+
}
|
|
718
|
+
);
|
|
342
719
|
return /* @__PURE__ */ jsxs(
|
|
343
720
|
"div",
|
|
344
721
|
{
|
|
@@ -346,7 +723,7 @@ const PopoverContent = forwardRef(
|
|
|
346
723
|
id: context?.popover.id,
|
|
347
724
|
"data-anv": "popover-content",
|
|
348
725
|
className: popoverClassNames,
|
|
349
|
-
ref:
|
|
726
|
+
ref: popoverContentRef,
|
|
350
727
|
style: combinedStyles,
|
|
351
728
|
onMouseEnter: onMouseEnterHandler,
|
|
352
729
|
onMouseLeave: onMouseLeaveHandler,
|
|
@@ -361,7 +738,7 @@ const PopoverContent = forwardRef(
|
|
|
361
738
|
className: styles.scroller,
|
|
362
739
|
role: "presentation",
|
|
363
740
|
tabIndex: -1,
|
|
364
|
-
ref:
|
|
741
|
+
ref: popoverScrollerRef,
|
|
365
742
|
onKeyDown: onKeyDownHandler,
|
|
366
743
|
onScroll,
|
|
367
744
|
onScrollCapture,
|
|
@@ -382,9 +759,11 @@ const PopoverContent = forwardRef(
|
|
|
382
759
|
function PopoverTrigger(props) {
|
|
383
760
|
const { children } = props;
|
|
384
761
|
const context = usePopoverContext();
|
|
762
|
+
if (!supportsPopover())
|
|
763
|
+
return /* @__PURE__ */ jsx(PopoverLegacyTrigger, { ...props });
|
|
385
764
|
if (!context) return;
|
|
386
765
|
const { element, ...rest } = context.invoker;
|
|
387
|
-
return children(rest);
|
|
766
|
+
return children({ "data-test": "hello", ...rest });
|
|
388
767
|
}
|
|
389
768
|
|
|
390
769
|
const PopoverContext = createContext(null);
|
|
@@ -414,7 +793,8 @@ const PopoverElement = (props) => {
|
|
|
414
793
|
modal,
|
|
415
794
|
noPadding,
|
|
416
795
|
onOutsidePress,
|
|
417
|
-
onClose
|
|
796
|
+
onClose,
|
|
797
|
+
root
|
|
418
798
|
} = props;
|
|
419
799
|
const uid = useId();
|
|
420
800
|
const [invoker, setInvoker] = useState(undefined);
|
|
@@ -429,6 +809,7 @@ const PopoverElement = (props) => {
|
|
|
429
809
|
const processMinHeight = typeof minHeight === "string" ? minHeight : `${minHeight}px`;
|
|
430
810
|
const updatePosition = useCallback(() => {
|
|
431
811
|
if (!invoker || !popover) return;
|
|
812
|
+
if (!openState) return;
|
|
432
813
|
computePosition(invoker, popover, {
|
|
433
814
|
placement,
|
|
434
815
|
middleware: [
|
|
@@ -516,6 +897,7 @@ const PopoverElement = (props) => {
|
|
|
516
897
|
invoker,
|
|
517
898
|
matchReferenceWidth,
|
|
518
899
|
maxHeight,
|
|
900
|
+
openState,
|
|
519
901
|
placement,
|
|
520
902
|
popover,
|
|
521
903
|
processMinHeight
|
|
@@ -536,11 +918,17 @@ const PopoverElement = (props) => {
|
|
|
536
918
|
cleanup();
|
|
537
919
|
};
|
|
538
920
|
}, [invoker, popover, updatePosition, openState]);
|
|
921
|
+
popover?.getRootNode();
|
|
922
|
+
const { focusables } = useKeyboardFocusables(popover, {
|
|
923
|
+
observeChange: true
|
|
924
|
+
});
|
|
539
925
|
const popoverHoverTriggered = useRef(false);
|
|
540
926
|
const openPopover = useCallback(async () => {
|
|
541
927
|
popoverHoverTriggered.current = true;
|
|
542
928
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
543
|
-
if (!popoverHoverTriggered.current || !popover || !rootNode?.querySelector(
|
|
929
|
+
if (!popoverHoverTriggered.current || !popover || !rootNode?.querySelector(
|
|
930
|
+
`#${id ?? `popover-${uid.replace(/:/g, "")}`}`
|
|
931
|
+
))
|
|
544
932
|
return;
|
|
545
933
|
popover.showPopover();
|
|
546
934
|
setOpenState(true);
|
|
@@ -612,7 +1000,8 @@ const PopoverElement = (props) => {
|
|
|
612
1000
|
arrowRef,
|
|
613
1001
|
resetKey: resetKey.current,
|
|
614
1002
|
rootNode,
|
|
615
|
-
setRootNode
|
|
1003
|
+
setRootNode,
|
|
1004
|
+
focusables
|
|
616
1005
|
};
|
|
617
1006
|
}, [
|
|
618
1007
|
id,
|
|
@@ -642,8 +1031,11 @@ const PopoverElement = (props) => {
|
|
|
642
1031
|
arrowRef,
|
|
643
1032
|
resetKey,
|
|
644
1033
|
rootNode,
|
|
645
|
-
setRootNode
|
|
1034
|
+
setRootNode,
|
|
1035
|
+
focusables
|
|
646
1036
|
]);
|
|
1037
|
+
if (!supportsPopover())
|
|
1038
|
+
return /* @__PURE__ */ jsx(PopoverLegacyElement, { ...props });
|
|
647
1039
|
return /* @__PURE__ */ jsx(PopoverContext.Provider, { value, children });
|
|
648
1040
|
};
|
|
649
1041
|
const Popover = Object.assign(PopoverElement, {
|
|
@@ -654,5 +1046,5 @@ const Popover = Object.assign(PopoverElement, {
|
|
|
654
1046
|
Context: PopoverContext
|
|
655
1047
|
});
|
|
656
1048
|
|
|
657
|
-
export { PopoverTrigger as P, PopoverContent as a, PopoverClose as b, PopoverButton as c, Popover as d, usePopoverContext as u };
|
|
658
|
-
//# sourceMappingURL=Popover-
|
|
1049
|
+
export { PopoverTrigger as P, PopoverContent as a, PopoverClose as b, PopoverButton as c, Popover as d, PopoverLegacy as e, usePopoverContext as f, usePopoverLegacyContext as u };
|
|
1050
|
+
//# sourceMappingURL=Popover-C1B3UJXp-B5obSIvA.js.map
|