@eightshift/ui-components 0.0.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.
Files changed (112) hide show
  1. package/README.md +27 -0
  2. package/dist/Checkbox-BLcVbhiO.js +178 -0
  3. package/dist/ColorSwatch-Cmlex_kT.js +66 -0
  4. package/dist/FieldError-wtMA4667.js +42 -0
  5. package/dist/FocusScope-1u9yyfIN.js +725 -0
  6. package/dist/Form-Cq3fu75_.js +5 -0
  7. package/dist/GridList-BZPXp3_O.js +1256 -0
  8. package/dist/Group-DyqpTRPe.js +49 -0
  9. package/dist/Input-jsbb4ugq.js +130 -0
  10. package/dist/Label-BPzS-sR7.js +17 -0
  11. package/dist/ListBox-w9gDaJkV.js +4423 -0
  12. package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
  13. package/dist/NumberFormatter-LzoKy975.js +160 -0
  14. package/dist/RSPContexts-CrNYmadY.js +14 -0
  15. package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
  16. package/dist/SelectionManager-mefd0ThJ.js +2155 -0
  17. package/dist/Separator-DHn0CwdK.js +325 -0
  18. package/dist/Slider-Pyh2V4bY.js +885 -0
  19. package/dist/Text-BM136LvS.js +17 -0
  20. package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
  21. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  22. package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
  23. package/dist/assets/style.css +1 -0
  24. package/dist/button-BkkdyHfJ.js +307 -0
  25. package/dist/components/animated-visibility/animated-visibility.js +7165 -0
  26. package/dist/components/base-control/base-control.js +97 -0
  27. package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
  28. package/dist/components/button/button.js +10 -0
  29. package/dist/components/checkbox/checkbox.js +119 -0
  30. package/dist/components/color-pickers/color-picker.js +242 -0
  31. package/dist/components/color-pickers/color-swatch.js +62 -0
  32. package/dist/components/color-pickers/gradient-editor.js +516 -0
  33. package/dist/components/color-pickers/solid-color-picker.js +1633 -0
  34. package/dist/components/component-toggle/component-toggle.js +71 -0
  35. package/dist/components/container-panel/container-panel.js +39 -0
  36. package/dist/components/expandable/expandable.js +144 -0
  37. package/dist/components/input-field/input-field.js +224 -0
  38. package/dist/components/link-input/link-input.js +937 -0
  39. package/dist/components/list-box/list-box.js +152 -0
  40. package/dist/components/matrix-align/matrix-align.js +185 -0
  41. package/dist/components/menu/menu.js +1608 -0
  42. package/dist/components/notice/notice.js +119 -0
  43. package/dist/components/number-picker/number-picker.js +277 -0
  44. package/dist/components/popover/popover.js +9 -0
  45. package/dist/components/radio/radio.js +552 -0
  46. package/dist/components/repeater/repeater-item.js +127 -0
  47. package/dist/components/repeater/repeater.js +248 -0
  48. package/dist/components/responsive/responsive-legacy.js +326 -0
  49. package/dist/components/responsive/responsive.js +499 -0
  50. package/dist/components/responsive-preview/responsive-preview.js +119 -0
  51. package/dist/components/rich-label/rich-label.js +56 -0
  52. package/dist/components/select/async-multi-select.js +144 -0
  53. package/dist/components/select/async-single-select.js +126 -0
  54. package/dist/components/select/custom-select-default-components.js +38 -0
  55. package/dist/components/select/multi-select-components.js +8 -0
  56. package/dist/components/select/multi-select.js +134 -0
  57. package/dist/components/select/react-select-component-wrappers.js +90 -0
  58. package/dist/components/select/shared.js +45 -0
  59. package/dist/components/select/single-select.js +116 -0
  60. package/dist/components/select/styles.js +55 -0
  61. package/dist/components/slider/column-config-slider.js +225 -0
  62. package/dist/components/slider/slider.js +362 -0
  63. package/dist/components/slider/utils.js +45 -0
  64. package/dist/components/spacer/spacer.js +93 -0
  65. package/dist/components/tabs/tabs.js +626 -0
  66. package/dist/components/toggle/switch.js +140 -0
  67. package/dist/components/toggle/toggle.js +58 -0
  68. package/dist/components/toggle-button/toggle-button.js +206 -0
  69. package/dist/components/tooltip/tooltip.js +10 -0
  70. package/dist/context-jMy6xdVq.js +98 -0
  71. package/dist/default-i18n-BhE-OUmt.js +873 -0
  72. package/dist/filterDOMProps-DG2RfOUr.js +30 -0
  73. package/dist/focusSafely-C3K8zAKj.js +743 -0
  74. package/dist/hooks/use-cell-edit-mode.js +35 -0
  75. package/dist/icons/block-icon.js +42 -0
  76. package/dist/icons/generic-color-swatch.js +21 -0
  77. package/dist/icons/icons.js +3636 -0
  78. package/dist/index-Bfb9bWcb.js +28844 -0
  79. package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
  80. package/dist/index.js +109 -0
  81. package/dist/intlStrings-CUhoK9EN.js +2484 -0
  82. package/dist/isScrollable-PcyglExV.js +10 -0
  83. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  84. package/dist/multi-select-components-CjVpCNko.js +3677 -0
  85. package/dist/number-rWqELA8W.js +39 -0
  86. package/dist/popover-Dx3vKXUX.js +1061 -0
  87. package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
  88. package/dist/react-select.esm-BjRWqf0E.js +15 -0
  89. package/dist/style.js +1 -0
  90. package/dist/textSelection-BosCCRVE.js +89 -0
  91. package/dist/tooltip-CkCndvTI.js +1094 -0
  92. package/dist/useButton-CuG5UzUw.js +74 -0
  93. package/dist/useEvent-DHv-yhOH.js +24 -0
  94. package/dist/useFocusRing-Cc-4eouh.js +41 -0
  95. package/dist/useFocusable-5q1Gek1J.js +81 -0
  96. package/dist/useFormReset-Buc9YJcv.js +23 -0
  97. package/dist/useFormValidationState-BAPPNXic.js +238 -0
  98. package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
  99. package/dist/useLabel-CGlkoFG0.js +28 -0
  100. package/dist/useLabels-Dg62M_3P.js +25 -0
  101. package/dist/useListData-BelKu4kx.js +211 -0
  102. package/dist/useListState-Domq0blV.js +137 -0
  103. package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
  104. package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
  105. package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
  106. package/dist/usePress-BQgVor4T.js +698 -0
  107. package/dist/useToggle-C9ETOBaZ.js +58 -0
  108. package/dist/useToggleState-DJ_z5E2S.js +21 -0
  109. package/dist/utilities/classnames.js +16 -0
  110. package/dist/utilities/text-helpers.js +79 -0
  111. package/dist/utils-BsiH7-5Y.js +488 -0
  112. package/package.json +71 -0
@@ -0,0 +1,1094 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, o as $b5e257d569688ac6$export$535bd6ca7f90a273, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$4d86445c2cf5e3, j as $64fa3d84918910a7$export$2881499e37b75b9a, q as $64fa3d84918910a7$export$45fda7c47f93fd48, r as $64fa3d84918910a7$export$6d3443f2c48bfc20 } from "./utils-BsiH7-5Y.js";
3
+ import React__default, { useEffect, useState, useRef, useCallback, useContext, useMemo, forwardRef, createContext } from "react";
4
+ import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c, b as $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 } from "./useFocusable-5q1Gek1J.js";
5
+ import { p as $c87311424ea30a05$export$78551043582a6a98, $ as $6179b936705e76d3$export$ae780daf29e6d456, t as $507fabe10e71c6fb$export$630ff653c5ada6a9, a as $507fabe10e71c6fb$export$b9b3dfddab17db27, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, d as $9ab94262bd0047c7$export$420e68273165f4ec } from "./focusSafely-C3K8zAKj.js";
6
+ import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-DG2RfOUr.js";
7
+ import { $ as $dbSRa$reactdom } from "./index-Bfb9bWcb.js";
8
+ import { $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-rWqELA8W.js";
9
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-jMy6xdVq.js";
10
+ import { classnames } from "./utilities/classnames.js";
11
+ function $9daab02d461809db$var$hasResizeObserver() {
12
+ return typeof window.ResizeObserver !== "undefined";
13
+ }
14
+ function $9daab02d461809db$export$683480f191c0e3ea(options) {
15
+ const { ref, onResize } = options;
16
+ useEffect(() => {
17
+ let element = ref === null || ref === void 0 ? void 0 : ref.current;
18
+ if (!element)
19
+ return;
20
+ if (!$9daab02d461809db$var$hasResizeObserver()) {
21
+ window.addEventListener("resize", onResize, false);
22
+ return () => {
23
+ window.removeEventListener("resize", onResize, false);
24
+ };
25
+ } else {
26
+ const resizeObserverInstance = new window.ResizeObserver((entries) => {
27
+ if (!entries.length)
28
+ return;
29
+ onResize();
30
+ });
31
+ resizeObserverInstance.observe(element);
32
+ return () => {
33
+ if (element)
34
+ resizeObserverInstance.unobserve(element);
35
+ };
36
+ }
37
+ }, [
38
+ onResize,
39
+ ref
40
+ ]);
41
+ }
42
+ const $edcf132a9284368a$var$AXIS = {
43
+ top: "top",
44
+ bottom: "top",
45
+ left: "left",
46
+ right: "left"
47
+ };
48
+ const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
49
+ top: "bottom",
50
+ bottom: "top",
51
+ left: "right",
52
+ right: "left"
53
+ };
54
+ const $edcf132a9284368a$var$CROSS_AXIS = {
55
+ top: "left",
56
+ left: "top"
57
+ };
58
+ const $edcf132a9284368a$var$AXIS_SIZE = {
59
+ top: "height",
60
+ left: "width"
61
+ };
62
+ const $edcf132a9284368a$var$TOTAL_SIZE = {
63
+ width: "totalWidth",
64
+ height: "totalHeight"
65
+ };
66
+ const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
67
+ let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
68
+ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
69
+ let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
70
+ let scroll = {};
71
+ let isPinchZoomedIn = ($edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) > 1;
72
+ if (containerNode.tagName === "BODY") {
73
+ let documentElement = document.documentElement;
74
+ totalWidth = documentElement.clientWidth;
75
+ totalHeight = documentElement.clientHeight;
76
+ var _visualViewport_width;
77
+ width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
78
+ var _visualViewport_height;
79
+ height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
80
+ scroll.top = documentElement.scrollTop || containerNode.scrollTop;
81
+ scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
82
+ if ($edcf132a9284368a$var$visualViewport) {
83
+ top = $edcf132a9284368a$var$visualViewport.offsetTop;
84
+ left = $edcf132a9284368a$var$visualViewport.offsetLeft;
85
+ }
86
+ } else {
87
+ ({ width, height, top, left } = $edcf132a9284368a$var$getOffset(containerNode));
88
+ scroll.top = containerNode.scrollTop;
89
+ scroll.left = containerNode.scrollLeft;
90
+ totalWidth = width;
91
+ totalHeight = height;
92
+ }
93
+ if ($c87311424ea30a05$export$78551043582a6a98() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
94
+ scroll.top = 0;
95
+ scroll.left = 0;
96
+ top = $edcf132a9284368a$var$visualViewport.pageTop;
97
+ left = $edcf132a9284368a$var$visualViewport.pageLeft;
98
+ }
99
+ return {
100
+ width,
101
+ height,
102
+ totalWidth,
103
+ totalHeight,
104
+ scroll,
105
+ top,
106
+ left
107
+ };
108
+ }
109
+ function $edcf132a9284368a$var$getScroll(node) {
110
+ return {
111
+ top: node.scrollTop,
112
+ left: node.scrollLeft,
113
+ width: node.scrollWidth,
114
+ height: node.scrollHeight
115
+ };
116
+ }
117
+ function $edcf132a9284368a$var$getDelta(axis, offset, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
118
+ let containerScroll = containerDimensions.scroll[axis];
119
+ let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
120
+ let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
121
+ let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
122
+ let startEdgeOffset = offset - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
123
+ let endEdgeOffset = offset - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
124
+ if (startEdgeOffset < boundaryStartEdge)
125
+ return boundaryStartEdge - startEdgeOffset;
126
+ else if (endEdgeOffset > boundaryEndEdge)
127
+ return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
128
+ else
129
+ return 0;
130
+ }
131
+ function $edcf132a9284368a$var$getMargins(node) {
132
+ let style = window.getComputedStyle(node);
133
+ return {
134
+ top: parseInt(style.marginTop, 10) || 0,
135
+ bottom: parseInt(style.marginBottom, 10) || 0,
136
+ left: parseInt(style.marginLeft, 10) || 0,
137
+ right: parseInt(style.marginRight, 10) || 0
138
+ };
139
+ }
140
+ function $edcf132a9284368a$var$parsePlacement(input) {
141
+ if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input])
142
+ return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
143
+ let [placement, crossPlacement] = input.split(" ");
144
+ let axis = $edcf132a9284368a$var$AXIS[placement] || "right";
145
+ let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
146
+ if (!$edcf132a9284368a$var$AXIS[crossPlacement])
147
+ crossPlacement = "center";
148
+ let size = $edcf132a9284368a$var$AXIS_SIZE[axis];
149
+ let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
150
+ $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input] = {
151
+ placement,
152
+ crossPlacement,
153
+ axis,
154
+ crossAxis,
155
+ size,
156
+ crossSize
157
+ };
158
+ return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
159
+ }
160
+ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
161
+ let { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;
162
+ let position = {};
163
+ position[crossAxis] = childOffset[crossAxis];
164
+ if (crossPlacement === "center")
165
+ position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
166
+ else if (crossPlacement !== crossAxis)
167
+ position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
168
+ position[crossAxis] += crossOffset;
169
+ const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
170
+ const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
171
+ position[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(position[crossAxis], minPosition, maxPosition);
172
+ if (placement === axis) {
173
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size]];
174
+ position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
175
+ } else
176
+ position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
177
+ return position;
178
+ }
179
+ function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
180
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
181
+ let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - position.bottom - overlayHeight);
182
+ let maxHeight = heightGrowthDirection !== "top" ? (
183
+ // We want the distance between the top of the overlay to the bottom of the boundary
184
+ Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top - overlayTop - (margins.top + margins.bottom + padding))
185
+ ) : Math.max(0, overlayTop + overlayHeight - (boundaryDimensions.top + boundaryDimensions.scroll.top) - (margins.top + margins.bottom + padding));
186
+ return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
187
+ }
188
+ function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
189
+ let { placement, axis, size } = placementInfo;
190
+ if (placement === axis)
191
+ return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
192
+ return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
193
+ }
194
+ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
195
+ let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
196
+ let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
197
+ let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
198
+ let normalizedOffset = offset;
199
+ let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
200
+ if (flip && scrollSize[size] > space) {
201
+ let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
202
+ let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
203
+ let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
204
+ if (flippedSpace > space) {
205
+ placementInfo = flippedPlacementInfo;
206
+ position = flippedPosition;
207
+ normalizedOffset = offset;
208
+ }
209
+ }
210
+ let heightGrowthDirection = "bottom";
211
+ if (placementInfo.axis === "top") {
212
+ if (placementInfo.placement === "top")
213
+ heightGrowthDirection = "top";
214
+ else if (placementInfo.placement === "bottom")
215
+ heightGrowthDirection = "bottom";
216
+ } else if (placementInfo.crossAxis === "top") {
217
+ if (placementInfo.crossPlacement === "top")
218
+ heightGrowthDirection = "bottom";
219
+ else if (placementInfo.crossPlacement === "bottom")
220
+ heightGrowthDirection = "top";
221
+ }
222
+ let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
223
+ position[crossAxis] += delta;
224
+ let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
225
+ if (userSetMaxHeight && userSetMaxHeight < maxHeight)
226
+ maxHeight = userSetMaxHeight;
227
+ overlaySize.height = Math.min(overlaySize.height, maxHeight);
228
+ position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
229
+ delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
230
+ position[crossAxis] += delta;
231
+ let arrowPosition = {};
232
+ let preferredArrowPosition = childOffset[crossAxis] + 0.5 * childOffset[crossSize] - position[crossAxis];
233
+ const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
234
+ const arrowMaxPosition = overlaySize[crossSize] - arrowSize / 2 - arrowBoundaryOffset;
235
+ const arrowOverlappingChildMinEdge = childOffset[crossAxis] - position[crossAxis] + arrowSize / 2;
236
+ const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - position[crossAxis] - arrowSize / 2;
237
+ const arrowPositionOverlappingChild = $9446cca9a3875146$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
238
+ arrowPosition[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
239
+ return {
240
+ position,
241
+ maxHeight,
242
+ arrowOffsetLeft: arrowPosition.left,
243
+ arrowOffsetTop: arrowPosition.top,
244
+ placement: placementInfo.placement
245
+ };
246
+ }
247
+ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
248
+ let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts;
249
+ let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
250
+ let isViewportContainer = container === document.documentElement;
251
+ const containerPositionStyle = window.getComputedStyle(container).position;
252
+ let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
253
+ let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
254
+ if (!isViewportContainer) {
255
+ let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
256
+ childOffset.top += parseInt(marginTop, 10) || 0;
257
+ childOffset.left += parseInt(marginLeft, 10) || 0;
258
+ }
259
+ let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
260
+ let margins = $edcf132a9284368a$var$getMargins(overlayNode);
261
+ overlaySize.width += margins.left + margins.right;
262
+ overlaySize.height += margins.top + margins.bottom;
263
+ let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
264
+ let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
265
+ let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
266
+ let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
267
+ if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
268
+ containerDimensions.scroll.top = 0;
269
+ containerDimensions.scroll.left = 0;
270
+ }
271
+ return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
272
+ }
273
+ function $edcf132a9284368a$var$getOffset(node) {
274
+ let { top, left, width, height } = node.getBoundingClientRect();
275
+ let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
276
+ return {
277
+ top: top + scrollTop - clientTop,
278
+ left: left + scrollLeft - clientLeft,
279
+ width,
280
+ height
281
+ };
282
+ }
283
+ function $edcf132a9284368a$var$getPosition(node, parent) {
284
+ let style = window.getComputedStyle(node);
285
+ let offset;
286
+ if (style.position === "fixed") {
287
+ let { top, left, width, height } = node.getBoundingClientRect();
288
+ offset = {
289
+ top,
290
+ left,
291
+ width,
292
+ height
293
+ };
294
+ } else {
295
+ offset = $edcf132a9284368a$var$getOffset(node);
296
+ let parentOffset = $edcf132a9284368a$var$getOffset(parent);
297
+ let parentStyle = window.getComputedStyle(parent);
298
+ parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
299
+ parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
300
+ offset.top -= parentOffset.top;
301
+ offset.left -= parentOffset.left;
302
+ }
303
+ offset.top -= parseInt(style.marginTop, 10) || 0;
304
+ offset.left -= parseInt(style.marginLeft, 10) || 0;
305
+ return offset;
306
+ }
307
+ function $edcf132a9284368a$var$getContainingBlock(node) {
308
+ let offsetParent = node.offsetParent;
309
+ if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
310
+ offsetParent = document.documentElement;
311
+ if (offsetParent == null) {
312
+ offsetParent = node.parentElement;
313
+ while (offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
314
+ offsetParent = offsetParent.parentElement;
315
+ }
316
+ return offsetParent || document.documentElement;
317
+ }
318
+ function $edcf132a9284368a$var$isContainingBlock(node) {
319
+ let style = window.getComputedStyle(node);
320
+ return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || // @ts-ignore
321
+ "backdropFilter" in style && style.backdropFilter !== "none" || // @ts-ignore
322
+ "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none";
323
+ }
324
+ const $dd149f63282afbbf$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
325
+ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
326
+ let { triggerRef, isOpen, onClose } = opts;
327
+ useEffect(() => {
328
+ if (!isOpen || onClose === null)
329
+ return;
330
+ let onScroll = (e) => {
331
+ let target = e.target;
332
+ if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current))
333
+ return;
334
+ let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
335
+ if (onCloseHandler)
336
+ onCloseHandler();
337
+ };
338
+ window.addEventListener("scroll", onScroll, true);
339
+ return () => {
340
+ window.removeEventListener("scroll", onScroll, true);
341
+ };
342
+ }, [
343
+ isOpen,
344
+ onClose,
345
+ triggerRef
346
+ ]);
347
+ }
348
+ let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
349
+ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
350
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
351
+ let { arrowSize = 0, targetRef, overlayRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = true, boundaryElement = typeof document !== "undefined" ? document.body : null, offset = 0, crossOffset = 0, shouldUpdatePosition = true, isOpen = true, onClose, maxHeight, arrowBoundaryOffset = 0 } = props;
352
+ let [position, setPosition] = useState({
353
+ position: {},
354
+ arrowOffsetLeft: void 0,
355
+ arrowOffsetTop: void 0,
356
+ maxHeight: void 0,
357
+ placement: void 0
358
+ });
359
+ let deps = [
360
+ shouldUpdatePosition,
361
+ placement,
362
+ overlayRef.current,
363
+ targetRef.current,
364
+ scrollRef.current,
365
+ containerPadding,
366
+ shouldFlip,
367
+ boundaryElement,
368
+ offset,
369
+ crossOffset,
370
+ isOpen,
371
+ direction,
372
+ maxHeight,
373
+ arrowBoundaryOffset,
374
+ arrowSize
375
+ ];
376
+ let lastScale = useRef($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale);
377
+ useEffect(() => {
378
+ if (isOpen)
379
+ lastScale.current = $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale;
380
+ }, [
381
+ isOpen
382
+ ]);
383
+ let updatePosition = useCallback(() => {
384
+ if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement)
385
+ return;
386
+ if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current)
387
+ return;
388
+ let overlay = overlayRef.current;
389
+ if (!maxHeight && overlayRef.current) {
390
+ var _window_visualViewport;
391
+ overlay.style.top = "0px";
392
+ overlay.style.bottom = "";
393
+ var _window_visualViewport_height;
394
+ overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + "px";
395
+ }
396
+ let position2 = $edcf132a9284368a$export$b3ceb0cbf1056d98({
397
+ placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
398
+ overlayNode: overlayRef.current,
399
+ targetNode: targetRef.current,
400
+ scrollNode: scrollRef.current,
401
+ padding: containerPadding,
402
+ shouldFlip,
403
+ boundaryElement,
404
+ offset,
405
+ crossOffset,
406
+ maxHeight,
407
+ arrowSize,
408
+ arrowBoundaryOffset
409
+ });
410
+ overlay.style.top = "";
411
+ overlay.style.bottom = "";
412
+ Object.keys(position2.position).forEach((key) => overlay.style[key] = position2.position[key] + "px");
413
+ overlay.style.maxHeight = position2.maxHeight != null ? position2.maxHeight + "px" : void 0;
414
+ setPosition(position2);
415
+ }, deps);
416
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updatePosition, deps);
417
+ $2a41e45df1593e64$var$useResize(updatePosition);
418
+ $9daab02d461809db$export$683480f191c0e3ea({
419
+ ref: overlayRef,
420
+ onResize: updatePosition
421
+ });
422
+ let isResizing = useRef(false);
423
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
424
+ let timeout;
425
+ let onResize = () => {
426
+ isResizing.current = true;
427
+ clearTimeout(timeout);
428
+ timeout = setTimeout(() => {
429
+ isResizing.current = false;
430
+ }, 500);
431
+ updatePosition();
432
+ };
433
+ let onScroll = () => {
434
+ if (isResizing.current)
435
+ onResize();
436
+ };
437
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
438
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll);
439
+ return () => {
440
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
441
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll);
442
+ };
443
+ }, [
444
+ updatePosition
445
+ ]);
446
+ let close = useCallback(() => {
447
+ if (!isResizing.current)
448
+ onClose();
449
+ }, [
450
+ onClose,
451
+ isResizing
452
+ ]);
453
+ $dd149f63282afbbf$export$18fc8428861184da({
454
+ triggerRef: targetRef,
455
+ isOpen,
456
+ onClose: onClose && close
457
+ });
458
+ return {
459
+ overlayProps: {
460
+ style: {
461
+ position: "absolute",
462
+ zIndex: 1e5,
463
+ ...position.position,
464
+ maxHeight: position.maxHeight
465
+ }
466
+ },
467
+ placement: position.placement,
468
+ arrowProps: {
469
+ "aria-hidden": "true",
470
+ role: "presentation",
471
+ style: {
472
+ left: position.arrowOffsetLeft,
473
+ top: position.arrowOffsetTop
474
+ }
475
+ },
476
+ updatePosition
477
+ };
478
+ }
479
+ function $2a41e45df1593e64$var$useResize(onResize) {
480
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
481
+ window.addEventListener("resize", onResize, false);
482
+ return () => {
483
+ window.removeEventListener("resize", onResize, false);
484
+ };
485
+ }, [
486
+ onResize
487
+ ]);
488
+ }
489
+ function $2a41e45df1593e64$var$translateRTL(position, direction) {
490
+ if (direction === "rtl")
491
+ return position.replace("start", "right").replace("end", "left");
492
+ return position.replace("start", "left").replace("end", "right");
493
+ }
494
+ const $f57aed4a881a3485$var$Context = /* @__PURE__ */ React__default.createContext(null);
495
+ function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
496
+ let { children } = props;
497
+ let parent = useContext($f57aed4a881a3485$var$Context);
498
+ let [modalCount, setModalCount] = useState(0);
499
+ let context = useMemo(() => ({
500
+ parent,
501
+ modalCount,
502
+ addModal() {
503
+ setModalCount((count) => count + 1);
504
+ if (parent)
505
+ parent.addModal();
506
+ },
507
+ removeModal() {
508
+ setModalCount((count) => count - 1);
509
+ if (parent)
510
+ parent.removeModal();
511
+ }
512
+ }), [
513
+ parent,
514
+ modalCount
515
+ ]);
516
+ return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$var$Context.Provider, {
517
+ value: context
518
+ }, children);
519
+ }
520
+ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
521
+ let context = useContext($f57aed4a881a3485$var$Context);
522
+ return {
523
+ modalProviderProps: {
524
+ "aria-hidden": context && context.modalCount > 0 ? true : null
525
+ }
526
+ };
527
+ }
528
+ function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
529
+ let { modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
530
+ return /* @__PURE__ */ React__default.createElement("div", {
531
+ "data-overlay-container": true,
532
+ ...props,
533
+ ...modalProviderProps
534
+ });
535
+ }
536
+ function $f57aed4a881a3485$export$bf688221f59024e5(props) {
537
+ return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
538
+ }
539
+ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
540
+ let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
541
+ let { portalContainer = isSSR ? null : document.body, ...rest } = props;
542
+ React__default.useEffect(() => {
543
+ if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]"))
544
+ throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
545
+ }, [
546
+ portalContainer
547
+ ]);
548
+ if (!portalContainer)
549
+ return null;
550
+ let contents = /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
551
+ return /* @__PURE__ */ $dbSRa$reactdom.createPortal(contents, portalContainer);
552
+ }
553
+ function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
554
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
555
+ labelable: true
556
+ });
557
+ let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
558
+ onHoverStart: () => state === null || state === void 0 ? void 0 : state.open(true),
559
+ onHoverEnd: () => state === null || state === void 0 ? void 0 : state.close()
560
+ });
561
+ return {
562
+ tooltipProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, hoverProps, {
563
+ role: "tooltip"
564
+ })
565
+ };
566
+ }
567
+ function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
568
+ let { isDisabled, trigger } = props;
569
+ let tooltipId = $bdb11010cef70236$export$f680877a34711e37();
570
+ let isHovered = useRef(false);
571
+ let isFocused = useRef(false);
572
+ let handleShow = () => {
573
+ if (isHovered.current || isFocused.current)
574
+ state.open(isFocused.current);
575
+ };
576
+ let handleHide = (immediate) => {
577
+ if (!isHovered.current && !isFocused.current)
578
+ state.close(immediate);
579
+ };
580
+ useEffect(() => {
581
+ let onKeyDown = (e) => {
582
+ if (ref && ref.current) {
583
+ if (e.key === "Escape") {
584
+ e.stopPropagation();
585
+ state.close(true);
586
+ }
587
+ }
588
+ };
589
+ if (state.isOpen) {
590
+ document.addEventListener("keydown", onKeyDown, true);
591
+ return () => {
592
+ document.removeEventListener("keydown", onKeyDown, true);
593
+ };
594
+ }
595
+ }, [
596
+ ref,
597
+ state
598
+ ]);
599
+ let onHoverStart = () => {
600
+ if (trigger === "focus")
601
+ return;
602
+ if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "pointer")
603
+ isHovered.current = true;
604
+ else
605
+ isHovered.current = false;
606
+ handleShow();
607
+ };
608
+ let onHoverEnd = () => {
609
+ if (trigger === "focus")
610
+ return;
611
+ isFocused.current = false;
612
+ isHovered.current = false;
613
+ handleHide();
614
+ };
615
+ let onPressStart = () => {
616
+ isFocused.current = false;
617
+ isHovered.current = false;
618
+ handleHide(true);
619
+ };
620
+ let onFocus = () => {
621
+ let isVisible = $507fabe10e71c6fb$export$b9b3dfddab17db27();
622
+ if (isVisible) {
623
+ isFocused.current = true;
624
+ handleShow();
625
+ }
626
+ };
627
+ let onBlur = () => {
628
+ isFocused.current = false;
629
+ isHovered.current = false;
630
+ handleHide(true);
631
+ };
632
+ let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
633
+ isDisabled,
634
+ onHoverStart,
635
+ onHoverEnd
636
+ });
637
+ let { focusableProps } = $e6afbd83fe6ebbd2$export$4c014de7c8940b4c({
638
+ isDisabled,
639
+ onFocus,
640
+ onBlur
641
+ }, ref);
642
+ return {
643
+ triggerProps: {
644
+ "aria-describedby": state.isOpen ? tooltipId : void 0,
645
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(focusableProps, hoverProps, {
646
+ onPointerDown: onPressStart,
647
+ onKeyDown: onPressStart
648
+ })
649
+ },
650
+ tooltipProps: {
651
+ id: tooltipId
652
+ }
653
+ };
654
+ }
655
+ function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
656
+ let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isOpen, props.defaultOpen || false, props.onOpenChange);
657
+ const open = useCallback(() => {
658
+ setOpen(true);
659
+ }, [
660
+ setOpen
661
+ ]);
662
+ const close = useCallback(() => {
663
+ setOpen(false);
664
+ }, [
665
+ setOpen
666
+ ]);
667
+ const toggle = useCallback(() => {
668
+ setOpen(!isOpen);
669
+ }, [
670
+ setOpen,
671
+ isOpen
672
+ ]);
673
+ return {
674
+ isOpen,
675
+ setOpen,
676
+ open,
677
+ close,
678
+ toggle
679
+ };
680
+ }
681
+ const $8796f90736e175cb$var$TOOLTIP_DELAY = 1500;
682
+ const $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500;
683
+ let $8796f90736e175cb$var$tooltips = {};
684
+ let $8796f90736e175cb$var$tooltipId = 0;
685
+ let $8796f90736e175cb$var$globalWarmedUp = false;
686
+ let $8796f90736e175cb$var$globalWarmUpTimeout = null;
687
+ let $8796f90736e175cb$var$globalCooldownTimeout = null;
688
+ function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
689
+ let { delay = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
690
+ let { isOpen, open, close } = $fc909762b330b746$export$61c6a8c84e605fb6(props);
691
+ let id = useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []);
692
+ let closeTimeout = useRef();
693
+ let ensureTooltipEntry = () => {
694
+ $8796f90736e175cb$var$tooltips[id] = hideTooltip;
695
+ };
696
+ let closeOpenTooltips = () => {
697
+ for (let hideTooltipId in $8796f90736e175cb$var$tooltips)
698
+ if (hideTooltipId !== id) {
699
+ $8796f90736e175cb$var$tooltips[hideTooltipId](true);
700
+ delete $8796f90736e175cb$var$tooltips[hideTooltipId];
701
+ }
702
+ };
703
+ let showTooltip = () => {
704
+ clearTimeout(closeTimeout.current);
705
+ closeTimeout.current = null;
706
+ closeOpenTooltips();
707
+ ensureTooltipEntry();
708
+ $8796f90736e175cb$var$globalWarmedUp = true;
709
+ open();
710
+ if ($8796f90736e175cb$var$globalWarmUpTimeout) {
711
+ clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
712
+ $8796f90736e175cb$var$globalWarmUpTimeout = null;
713
+ }
714
+ if ($8796f90736e175cb$var$globalCooldownTimeout) {
715
+ clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
716
+ $8796f90736e175cb$var$globalCooldownTimeout = null;
717
+ }
718
+ };
719
+ let hideTooltip = (immediate) => {
720
+ if (immediate || closeDelay <= 0) {
721
+ clearTimeout(closeTimeout.current);
722
+ closeTimeout.current = null;
723
+ close();
724
+ } else if (!closeTimeout.current)
725
+ closeTimeout.current = setTimeout(() => {
726
+ closeTimeout.current = null;
727
+ close();
728
+ }, closeDelay);
729
+ if ($8796f90736e175cb$var$globalWarmUpTimeout) {
730
+ clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
731
+ $8796f90736e175cb$var$globalWarmUpTimeout = null;
732
+ }
733
+ if ($8796f90736e175cb$var$globalWarmedUp) {
734
+ if ($8796f90736e175cb$var$globalCooldownTimeout)
735
+ clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
736
+ $8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => {
737
+ delete $8796f90736e175cb$var$tooltips[id];
738
+ $8796f90736e175cb$var$globalCooldownTimeout = null;
739
+ $8796f90736e175cb$var$globalWarmedUp = false;
740
+ }, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay));
741
+ }
742
+ };
743
+ let warmupTooltip = () => {
744
+ closeOpenTooltips();
745
+ ensureTooltipEntry();
746
+ if (!isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp)
747
+ $8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => {
748
+ $8796f90736e175cb$var$globalWarmUpTimeout = null;
749
+ $8796f90736e175cb$var$globalWarmedUp = true;
750
+ showTooltip();
751
+ }, delay);
752
+ else if (!isOpen)
753
+ showTooltip();
754
+ };
755
+ useEffect(() => {
756
+ return () => {
757
+ clearTimeout(closeTimeout.current);
758
+ let tooltip = $8796f90736e175cb$var$tooltips[id];
759
+ if (tooltip)
760
+ delete $8796f90736e175cb$var$tooltips[id];
761
+ };
762
+ }, [
763
+ id
764
+ ]);
765
+ return {
766
+ isOpen,
767
+ open: (immediate) => {
768
+ if (!immediate && delay > 0 && !closeTimeout.current)
769
+ warmupTooltip();
770
+ else
771
+ showTooltip();
772
+ },
773
+ close: hideTooltip
774
+ };
775
+ }
776
+ const $44f671af83e7d9e0$export$2de4954e8ae13b9f = /* @__PURE__ */ createContext({
777
+ placement: "bottom"
778
+ });
779
+ function $44f671af83e7d9e0$var$OverlayArrow(props, ref) {
780
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $44f671af83e7d9e0$export$2de4954e8ae13b9f);
781
+ let placement = props.placement;
782
+ let style = {
783
+ position: "absolute",
784
+ [placement]: "100%",
785
+ transform: placement === "top" || placement === "bottom" ? "translateX(-50%)" : "translateY(-50%)"
786
+ };
787
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
788
+ ...props,
789
+ defaultClassName: "react-aria-OverlayArrow",
790
+ values: {
791
+ placement
792
+ }
793
+ });
794
+ if (renderProps.style)
795
+ Object.keys(renderProps.style).forEach((key) => renderProps.style[key] === void 0 && delete renderProps.style[key]);
796
+ return /* @__PURE__ */ React__default.createElement("div", {
797
+ ...props,
798
+ ...renderProps,
799
+ style: {
800
+ ...style,
801
+ ...renderProps.style
802
+ },
803
+ ref,
804
+ "data-placement": placement
805
+ });
806
+ }
807
+ const $44f671af83e7d9e0$export$746d02f47f4d381 = /* @__PURE__ */ forwardRef($44f671af83e7d9e0$var$OverlayArrow);
808
+ const $4e3b923658d69c60$export$7a7623236eec67fa = /* @__PURE__ */ createContext(null);
809
+ const $4e3b923658d69c60$export$39ae08fa83328b12 = /* @__PURE__ */ createContext(null);
810
+ function $4e3b923658d69c60$export$8c610744efcf8a1d(props) {
811
+ let state = $8796f90736e175cb$export$4d40659c25ecb50b(props);
812
+ let ref = useRef(null);
813
+ let { triggerProps, tooltipProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref);
814
+ return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
815
+ values: [
816
+ [
817
+ $4e3b923658d69c60$export$7a7623236eec67fa,
818
+ state
819
+ ],
820
+ [
821
+ $4e3b923658d69c60$export$39ae08fa83328b12,
822
+ {
823
+ ...tooltipProps,
824
+ triggerRef: ref
825
+ }
826
+ ]
827
+ ]
828
+ }, /* @__PURE__ */ React__default.createElement($e6afbd83fe6ebbd2$export$13f3202a3e5ddd5, {
829
+ ...triggerProps,
830
+ ref
831
+ }, props.children));
832
+ }
833
+ function $4e3b923658d69c60$var$Tooltip({ UNSTABLE_portalContainer, ...props }, ref) {
834
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e3b923658d69c60$export$39ae08fa83328b12);
835
+ let contextState = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
836
+ let localState = $8796f90736e175cb$export$4d40659c25ecb50b(props);
837
+ let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
838
+ let isExiting = $64fa3d84918910a7$export$45fda7c47f93fd48(ref, state.isOpen) || props.isExiting || false;
839
+ if (!state.isOpen && !isExiting)
840
+ return null;
841
+ return /* @__PURE__ */ React__default.createElement($f57aed4a881a3485$export$b47c3594eab58386, {
842
+ portalContainer: UNSTABLE_portalContainer
843
+ }, /* @__PURE__ */ React__default.createElement($4e3b923658d69c60$var$TooltipInner, {
844
+ ...props,
845
+ tooltipRef: ref,
846
+ isExiting
847
+ }));
848
+ }
849
+ const $4e3b923658d69c60$export$28c660c63b792dea = /* @__PURE__ */ forwardRef($4e3b923658d69c60$var$Tooltip);
850
+ function $4e3b923658d69c60$var$TooltipInner(props) {
851
+ let state = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
852
+ let arrowRef = useRef(null);
853
+ let [arrowWidth, setArrowWidth] = useState(0);
854
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
855
+ if (arrowRef.current && state.isOpen)
856
+ setArrowWidth(arrowRef.current.getBoundingClientRect().width);
857
+ }, [
858
+ state.isOpen,
859
+ arrowRef
860
+ ]);
861
+ let { overlayProps, arrowProps, placement } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
862
+ placement: props.placement || "top",
863
+ targetRef: props.triggerRef,
864
+ overlayRef: props.tooltipRef,
865
+ offset: props.offset,
866
+ crossOffset: props.crossOffset,
867
+ isOpen: state.isOpen,
868
+ arrowSize: arrowWidth,
869
+ arrowBoundaryOffset: props.arrowBoundaryOffset,
870
+ shouldFlip: props.shouldFlip
871
+ });
872
+ let isEntering = $64fa3d84918910a7$export$6d3443f2c48bfc20(props.tooltipRef, !!placement) || props.isEntering || false;
873
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
874
+ ...props,
875
+ defaultClassName: "react-aria-Tooltip",
876
+ values: {
877
+ placement,
878
+ isEntering,
879
+ isExiting: props.isExiting,
880
+ state
881
+ }
882
+ });
883
+ props = $3ef42575df84b30b$export$9d1611c77c2fe928(props, overlayProps);
884
+ let { tooltipProps } = $326e436e94273fe1$export$1c4b08e0eca38426(props, state);
885
+ return /* @__PURE__ */ React__default.createElement("div", {
886
+ ...tooltipProps,
887
+ ref: props.tooltipRef,
888
+ ...renderProps,
889
+ style: {
890
+ ...overlayProps.style,
891
+ ...renderProps.style
892
+ },
893
+ "data-placement": placement,
894
+ "data-entering": isEntering || void 0,
895
+ "data-exiting": props.isExiting || void 0
896
+ }, /* @__PURE__ */ React__default.createElement($44f671af83e7d9e0$export$2de4954e8ae13b9f.Provider, {
897
+ value: {
898
+ ...arrowProps,
899
+ placement,
900
+ ref: arrowRef
901
+ }
902
+ }, renderProps.children));
903
+ }
904
+ /**
905
+ * A simple tooltip component.
906
+ *
907
+ * It can be used in two modes:
908
+ * - **Controlled mode**: You can control the tooltip with the `open` prop.
909
+ * - **Uncontrolled mode**: The tooltip will be open by default with the `defaultOpen` prop.
910
+ *
911
+ * @component
912
+ * @param {Object} props - Component props.
913
+ * @param {string|JSX.Element} props.text - The text to display in the tooltip.
914
+ * @param {TooltipTheme} [props.theme='dark'] - The theme of the tooltip.
915
+ * @param {number} [props.offset=0] - Additional offset between the tooltip and the element on the main axis (same axis as element).
916
+ * @param {number} [props.crossOffset=0] - Additional offset between the tooltip and the element on the cross axis (opposite axis as element).
917
+ * @param {number} [props.containerPadding=12] - Space that should be left between the tooltip and the main containing element (usually browser window).
918
+ * @param {number} [props.openDelay=1500] - Duration before the tooltip is shown, in milliseconds.
919
+ * @param {number} [props.closeDelay=500] - Duration before the tooltip is hidden, in milliseconds.
920
+ * @param {boolean} [props.shouldFlip=true] - If `false`, the tooltip will not flip to the opposite side if there is not enough space.
921
+ * @param {boolean} [props.defaultOpen] - (**Uncontrolled mode**) Whether the tooltip is initially open.
922
+ * @param {boolean} [props.open] - (**Controlled mode**) Whether the tooltip is open.
923
+ * @param {Function} [props.onOpenChange] - (**Controlled mode**) Function to run when the tooltip is opened or closed.
924
+ * @param {TooltipPlacement} [props.placement] - The side of the trigger element where the tooltip will be displayed.
925
+ * @param {string} [props.className] - Classes to pass to the tooltip.
926
+ * @param {RefObject<Element>} [props.triggerRef] - Ref to anchor the tooltip to. If not provided, the tooltip will be anchored to the trigger element.
927
+ * @param {boolean} [props.arrow] - If `true`, an arrow is shown on the tooltip.
928
+ *
929
+ * @returns {JSX.Element} The Tooltip component.
930
+ *
931
+ * @typedef {'light' | 'dark'} TooltipTheme
932
+ * @typedef {'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom'} TooltipPlacement
933
+ *
934
+ * @example
935
+ * <Tooltip text='My tooltip'>
936
+ * <Button>Hover me</Button>
937
+ * </Tooltip>
938
+ *
939
+ * @preserve
940
+ */
941
+ const Tooltip = (props) => {
942
+ const {
943
+ children,
944
+ text,
945
+ theme = "dark",
946
+ offset = 0,
947
+ crossOffset = 0,
948
+ containerPadding = 12,
949
+ openDelay = 1500,
950
+ closeDelay = 500,
951
+ shouldFlip = true,
952
+ arrow,
953
+ open,
954
+ defaultOpen,
955
+ onOpenChange,
956
+ placement,
957
+ className,
958
+ triggerRef,
959
+ disabled
960
+ } = props;
961
+ return /* @__PURE__ */ jsxs(
962
+ $4e3b923658d69c60$export$8c610744efcf8a1d,
963
+ {
964
+ delay: openDelay,
965
+ closeDelay,
966
+ isDisabled: disabled,
967
+ isOpen: open,
968
+ onOpenChange,
969
+ defaultOpen,
970
+ children: [
971
+ children,
972
+ /* @__PURE__ */ jsxs(
973
+ $4e3b923658d69c60$export$28c660c63b792dea,
974
+ {
975
+ containerPadding,
976
+ placement,
977
+ shouldFlip,
978
+ triggerRef,
979
+ offset,
980
+ crossOffset,
981
+ className: ({ isEntering, isExiting }) => classnames(
982
+ "es-uic-group",
983
+ "es-uic-z-20 es-uic-select-none es-uic-rounded-md es-uic-border es-uic-px-1.5 es-uic-py-0.5 es-uic-text-sm es-uic-shadow es-uic-backdrop-blur-xl es-uic-will-change-[transform,opacity]",
984
+ theme === "light" && "es-uic-border-gray-200 es-uic-bg-white/60 es-uic-text-gray-700",
985
+ theme === "dark" && "es-uic-border-gray-600 es-uic-bg-black/60 es-uic-text-gray-100",
986
+ isEntering && "es-uic-duration-300 es-uic-ease-out es-uic-animate-in es-uic-fade-in",
987
+ isEntering && "placement-left:es-uic-slide-in-from-right-0.5 placement-right:es-uic-slide-in-from-left-0.5 placement-top:es-uic-slide-in-from-bottom-0.5 placement-bottom:es-uic-slide-in-from-top-0.5",
988
+ isExiting && "es-uic-duration-150 es-uic-ease-in es-uic-animate-out es-uic-fade-out",
989
+ isExiting && "placement-left:es-uic-slide-out-to-right-0.5 placement-right:es-uic-slide-out-to-left-0.5 placement-top:es-uic-slide-out-to-bottom-0.5 placement-bottom:es-uic-slide-out-to-top-0.5",
990
+ className
991
+ ),
992
+ children: [
993
+ arrow && /* @__PURE__ */ jsx($44f671af83e7d9e0$export$746d02f47f4d381, { children: /* @__PURE__ */ jsx(
994
+ "svg",
995
+ {
996
+ width: 8,
997
+ height: 8,
998
+ viewBox: "0 0 8 8",
999
+ className: classnames(
1000
+ "es-uic-m-px es-uic-stroke-none es-uic-drop-shadow-sm",
1001
+ theme === "light" && "es-uic-fill-gray-200",
1002
+ theme === "dark" && "es-uic-fill-gray-600",
1003
+ "group-placement-left:-es-uic-rotate-90 group-placement-right:es-uic-rotate-90 group-placement-bottom:es-uic-rotate-180",
1004
+ "forced-colors:es-uic-fill-[Canvas] forced-colors:es-uic-stroke-[ButtonBorder]"
1005
+ ),
1006
+ children: /* @__PURE__ */ jsx("path", { d: "M0 0 L4 4 L8 0" })
1007
+ }
1008
+ ) }),
1009
+ text
1010
+ ]
1011
+ }
1012
+ )
1013
+ ]
1014
+ }
1015
+ );
1016
+ };
1017
+ /**
1018
+ * A "decorative" tooltip than can be used with element that usually don't support tooltips.
1019
+ * Usually the only elements that support tooltips are interactive elements like buttons or links.
1020
+ *
1021
+ * This component will wrap the element and add the tooltip functionality to it.
1022
+ * The tooltip will be shown when the element is hovered or anything within is focused.
1023
+ *
1024
+ * **Note**: This is not officially supported by the ARIA spec, so use with caution.
1025
+ *
1026
+ * @see {@link Tooltip} before using this component.
1027
+ *
1028
+ * @component
1029
+ * @param {Object} props - Component props.
1030
+ * @param {string|JSX.Element} props.text - The text to display in the tooltip.
1031
+ * @param {TooltipTheme} [props.theme='dark'] - The theme of the tooltip.
1032
+ * @param {number} [props.offset=0] - Additional offset between the tooltip and the element on the main axis (same axis as element).
1033
+ * @param {number} [props.crossOffset=0] - Additional offset between the tooltip and the element on the cross axis (opposite axis as element).
1034
+ * @param {number} [props.containerPadding=12] - Space that should be left between the tooltip and the main containing element (usually browser window).
1035
+ * @param {number} [props.openDelay=1500] - Duration before the tooltip is shown, in milliseconds.
1036
+ * @param {number} [props.closeDelay=500] - Duration before the tooltip is hidden, in milliseconds.
1037
+ * @param {boolean} [props.shouldFlip=true] - If `false`, the tooltip will not flip to the opposite side if there is not enough space.
1038
+ * @param {TooltipPlacement} [props.placement] - The side of the trigger element where the tooltip will be displayed.
1039
+ * @param {string} [props.className] - Classes to pass to the tooltip.
1040
+ * @param {string} [props.wrapperClassName] - Classes to pass to the tooltip wrapper (if `doNotReplaceChild` is `false`).
1041
+ * @param {boolean} [props.arrow] - If `true`, an arrow is shown on the tooltip.
1042
+ *
1043
+ * @returns {JSX.Element} The DecorativeTooltip component.
1044
+ *
1045
+ * @typedef {'light' | 'dark'} TooltipTheme
1046
+ * @typedef {'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' | 'top' | 'top left' | 'top right' | 'top start' | 'top end' | 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' | 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | 'end bottom'} TooltipPlacement
1047
+ *
1048
+ * @example
1049
+ * <DecorativeTooltip text='My tooltip'>
1050
+ * <span>Hover me</span>
1051
+ * </DecorativeTooltip>
1052
+ *
1053
+ * @preserve
1054
+ */
1055
+ const DecorativeTooltip = (props) => {
1056
+ const { openDelay, closeDelay, children, text, wrapperClassName, ...rest } = props;
1057
+ const [open, setOpen] = useState(false);
1058
+ let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
1059
+ onHoverStart: () => setTimeout(() => setOpen(true), openDelay),
1060
+ onHoverEnd: () => setTimeout(() => setOpen(false), closeDelay)
1061
+ });
1062
+ let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
1063
+ onFocusWithinChange: (isFocusWithin) => setOpen(isFocusWithin)
1064
+ });
1065
+ const ref = useRef(null);
1066
+ return /* @__PURE__ */ jsx(
1067
+ Tooltip,
1068
+ {
1069
+ triggerRef: ref,
1070
+ text,
1071
+ open,
1072
+ className: "es-uic-pointer-events-none",
1073
+ ...rest,
1074
+ children: /* @__PURE__ */ jsx(
1075
+ "div",
1076
+ {
1077
+ ref,
1078
+ className: classnames("es-uic-inline", wrapperClassName),
1079
+ ...$3ef42575df84b30b$export$9d1611c77c2fe928(hoverProps, focusWithinProps),
1080
+ children
1081
+ }
1082
+ )
1083
+ }
1084
+ );
1085
+ };
1086
+ export {
1087
+ $9daab02d461809db$export$683480f191c0e3ea as $,
1088
+ DecorativeTooltip as D,
1089
+ Tooltip as T,
1090
+ $fc909762b330b746$export$61c6a8c84e605fb6 as a,
1091
+ $dd149f63282afbbf$export$f6211563215e3b37 as b,
1092
+ $2a41e45df1593e64$export$d39e1813b3bdd0e1 as c,
1093
+ $44f671af83e7d9e0$export$2de4954e8ae13b9f as d
1094
+ };