tfy-web-components 0.0.43 → 0.0.45

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 (190) hide show
  1. package/dist/{Button-CPJYHldw.js → Button-HHEfL8b9.js} +5 -4
  2. package/dist/{Button-CPJYHldw.js.map → Button-HHEfL8b9.js.map} +1 -1
  3. package/dist/CSPContext-Cldo9QDp.js +13 -0
  4. package/dist/CSPContext-Cldo9QDp.js.map +1 -0
  5. package/dist/{CompositeItem-DJWNsIwE.js → CompositeItem-GNejxLcK.js} +3 -3
  6. package/dist/{CompositeItem-DJWNsIwE.js.map → CompositeItem-GNejxLcK.js.map} +1 -1
  7. package/dist/{CompositeRoot-BlljDWkR.js → CompositeRoot-7_u1HqDT.js} +9 -47
  8. package/dist/CompositeRoot-7_u1HqDT.js.map +1 -0
  9. package/dist/DropdownMenu-Crlf-J4E.js +3304 -0
  10. package/dist/DropdownMenu-Crlf-J4E.js.map +1 -0
  11. package/dist/{Input-Dcxu6SVO.js → Input-BS9fWUAf.js} +3 -3
  12. package/dist/{Input-Dcxu6SVO.js.map → Input-BS9fWUAf.js.map} +1 -1
  13. package/dist/{Modal-BUWlwJcN.js → Modal-DaHG8mjy.js} +10 -10
  14. package/dist/{Modal-BUWlwJcN.js.map → Modal-DaHG8mjy.js.map} +1 -1
  15. package/dist/Popover-A8IyEt2w.js +400 -0
  16. package/dist/Popover-A8IyEt2w.js.map +1 -0
  17. package/dist/{Popover-BqqXJnK1.js → PopoverPopup-teGm7D5T.js} +25 -498
  18. package/dist/PopoverPopup-teGm7D5T.js.map +1 -0
  19. package/dist/PrehydrationScript-B3u_PP2W.js +49 -0
  20. package/dist/PrehydrationScript-B3u_PP2W.js.map +1 -0
  21. package/dist/Select-BtX40h2K.js +2187 -0
  22. package/dist/Select-BtX40h2K.js.map +1 -0
  23. package/dist/{useValueAsRef-BfFRcMg6.js → addEventListener-D-i9O6BG.js} +8 -8
  24. package/dist/addEventListener-D-i9O6BG.js.map +1 -0
  25. package/dist/clamp-D7_nsB8C.js +30 -0
  26. package/dist/clamp-D7_nsB8C.js.map +1 -0
  27. package/dist/components/atoms/Accordion.es.js +9 -9
  28. package/dist/components/atoms/Avatar.es.js +9 -9
  29. package/dist/components/atoms/Avatar.es.js.map +1 -1
  30. package/dist/components/atoms/Badge.d.ts +5 -6
  31. package/dist/components/atoms/Badge.es.js +80 -43
  32. package/dist/components/atoms/Badge.es.js.map +1 -1
  33. package/dist/components/atoms/Button.d.ts +1 -1
  34. package/dist/components/atoms/Button.es.js +2 -2
  35. package/dist/components/atoms/ButtonGroup.es.js +1 -1
  36. package/dist/components/atoms/Combobox.d.ts +34 -0
  37. package/dist/components/atoms/Combobox.es.js +3252 -0
  38. package/dist/components/atoms/Combobox.es.js.map +1 -0
  39. package/dist/components/atoms/ContextMenu.d.ts +12 -0
  40. package/dist/components/atoms/ContextMenu.es.js +259 -0
  41. package/dist/components/atoms/ContextMenu.es.js.map +1 -0
  42. package/dist/components/atoms/DropdownMenu.d.ts +51 -0
  43. package/dist/components/atoms/DropdownMenu.es.js +31 -0
  44. package/dist/components/atoms/DropdownMenu.es.js.map +1 -0
  45. package/dist/components/atoms/IconButton.d.ts +1 -1
  46. package/dist/components/atoms/IconButton.es.js +3 -3
  47. package/dist/components/atoms/IconButton.es.js.map +1 -1
  48. package/dist/components/atoms/IconProvider.es.js +4 -1
  49. package/dist/components/atoms/IconProvider.es.js.map +1 -1
  50. package/dist/components/atoms/Modal.es.js +1 -1
  51. package/dist/components/atoms/OverflowButton.es.js +2 -2
  52. package/dist/components/atoms/PaginationDot.d.ts +14 -0
  53. package/dist/components/atoms/PaginationDot.es.js +58 -0
  54. package/dist/components/atoms/PaginationDot.es.js.map +1 -0
  55. package/dist/components/atoms/PaginationItem.d.ts +15 -0
  56. package/dist/components/atoms/PaginationItem.es.js +87 -0
  57. package/dist/components/atoms/PaginationItem.es.js.map +1 -0
  58. package/dist/components/atoms/Popover.d.ts +10 -0
  59. package/dist/components/atoms/Popover.es.js +50 -0
  60. package/dist/components/atoms/Popover.es.js.map +1 -0
  61. package/dist/components/atoms/Select.d.ts +63 -0
  62. package/dist/components/atoms/Select.es.js +23 -0
  63. package/dist/components/atoms/Select.es.js.map +1 -0
  64. package/dist/components/atoms/Switch.es.js +7 -6
  65. package/dist/components/atoms/Switch.es.js.map +1 -1
  66. package/dist/components/atoms/TabButton.d.ts +31 -6
  67. package/dist/components/atoms/TabButton.es.js +425 -55
  68. package/dist/components/atoms/TabButton.es.js.map +1 -1
  69. package/dist/components/atoms/Tag.d.ts +2 -2
  70. package/dist/components/atoms/Tag.es.js +66 -33
  71. package/dist/components/atoms/Tag.es.js.map +1 -1
  72. package/dist/components/atoms/Tooltip.es.js +1153 -19
  73. package/dist/components/atoms/Tooltip.es.js.map +1 -1
  74. package/dist/components/atoms/stories/OverlayThemePanels.d.ts +8 -0
  75. package/dist/components/molecules/Alert.es.js +3 -3
  76. package/dist/components/molecules/CopyField.es.js +2 -2
  77. package/dist/components/molecules/CustomDrawer.es.js +1 -1
  78. package/dist/components/molecules/Dialog.es.js +1 -1
  79. package/dist/components/molecules/ImagesPreview.es.js +2 -2
  80. package/dist/components/molecules/Input.es.js +2 -2
  81. package/dist/components/molecules/Markdown.es.js +1 -1
  82. package/dist/components/molecules/Pagination.d.ts +58 -0
  83. package/dist/components/molecules/Pagination.es.js +272 -0
  84. package/dist/components/molecules/Pagination.es.js.map +1 -0
  85. package/dist/components/molecules/SimpleCodeEditor.es.js +3 -3
  86. package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
  87. package/dist/components/molecules/TagGroup.d.ts +11 -0
  88. package/dist/components/molecules/TagGroup.es.js +59 -0
  89. package/dist/components/molecules/TagGroup.es.js.map +1 -0
  90. package/dist/components/molecules/ToggleButton.es.js +2 -2
  91. package/dist/components/molecules/TopBar.d.ts +47 -0
  92. package/dist/components/molecules/TopBar.es.js +164 -0
  93. package/dist/components/molecules/TopBar.es.js.map +1 -0
  94. package/dist/components/molecules/agent-chat/AssistantMessage.d.ts +3 -1
  95. package/dist/components/molecules/agent-chat.es.js +4 -3
  96. package/dist/components/molecules/agent-chat.es.js.map +1 -1
  97. package/dist/components/theme/colors.es.js +1 -0
  98. package/dist/components/theme/colors.es.js.map +1 -1
  99. package/dist/composite-DnShFmi7.js +551 -0
  100. package/dist/composite-DnShFmi7.js.map +1 -0
  101. package/dist/{composite-C22yiNy1.js → composite-IA--dSel.js} +2 -2
  102. package/dist/{composite-C22yiNy1.js.map → composite-IA--dSel.js.map} +1 -1
  103. package/dist/constants-BaUKmVF_.js +103 -0
  104. package/dist/constants-BaUKmVF_.js.map +1 -0
  105. package/dist/{index-C-2yrwZl.js → element-B1vbc-LG.js} +69 -111
  106. package/dist/element-B1vbc-LG.js.map +1 -0
  107. package/dist/error-nCTLdGUr.js +6 -0
  108. package/dist/{error-FX4R42W-.js.map → error-nCTLdGUr.js.map} +1 -1
  109. package/dist/index.d.ts +12 -2
  110. package/dist/index.es.js +65 -12
  111. package/dist/index.es.js.map +1 -1
  112. package/dist/{inertValue-IJM5NA30.js → inertValue-C1Ml1s55.js} +2 -2
  113. package/dist/{inertValue-IJM5NA30.js.map → inertValue-C1Ml1s55.js.map} +1 -1
  114. package/dist/isElementDisabled-lq1fKien.js +47 -0
  115. package/dist/isElementDisabled-lq1fKien.js.map +1 -0
  116. package/dist/new-components/atoms/Alert.d.ts +9 -1
  117. package/dist/new-components/atoms/Alert.es.js +38 -13
  118. package/dist/new-components/atoms/Alert.es.js.map +1 -1
  119. package/dist/new-components/atoms/Checkbox.es.js +8 -7
  120. package/dist/new-components/atoms/Checkbox.es.js.map +1 -1
  121. package/dist/new-components/atoms/EmptyState.d.ts +3 -0
  122. package/dist/new-components/atoms/EmptyState.es.js +9 -4
  123. package/dist/new-components/atoms/EmptyState.es.js.map +1 -1
  124. package/dist/new-components/atoms/Popover.es.js +3 -2
  125. package/dist/new-components/atoms/Popover.es.js.map +1 -1
  126. package/dist/new-components/atoms/Radio.es.js +13 -24
  127. package/dist/new-components/atoms/Radio.es.js.map +1 -1
  128. package/dist/new-components/atoms/SegmentedControl.es.js +7 -7
  129. package/dist/new-components/atoms/Slider.es.js +14 -88
  130. package/dist/new-components/atoms/Slider.es.js.map +1 -1
  131. package/dist/new-components/atoms/Toast.d.ts +8 -12
  132. package/dist/new-components/atoms/Toast.es.js +202 -145
  133. package/dist/new-components/atoms/Toast.es.js.map +1 -1
  134. package/dist/new-components/atoms/Toggletip.d.ts +1 -1
  135. package/dist/new-components/atoms/Toggletip.es.js +3 -2
  136. package/dist/new-components/atoms/Toggletip.es.js.map +1 -1
  137. package/dist/new-components/atoms/stories/ThemeComparison.d.ts +2 -1
  138. package/dist/serializeValue-BLvnTy3o.js +17 -0
  139. package/dist/serializeValue-BLvnTy3o.js.map +1 -0
  140. package/dist/stringifyLocale-DOx30wH1.js +13 -0
  141. package/dist/stringifyLocale-DOx30wH1.js.map +1 -0
  142. package/dist/style.css +1 -1
  143. package/dist/tokens.css +24 -6
  144. package/dist/{useAnimationFrame-DwhymJoW.js → useAnimationFrame-DqvuRtgK.js} +2 -2
  145. package/dist/{useAnimationFrame-DwhymJoW.js.map → useAnimationFrame-DqvuRtgK.js.map} +1 -1
  146. package/dist/{useAriaLabelledBy-Lyj6n_TU.js → useAriaLabelledBy-CP4wKTYs.js} +3 -3
  147. package/dist/{useAriaLabelledBy-Lyj6n_TU.js.map → useAriaLabelledBy-CP4wKTYs.js.map} +1 -1
  148. package/dist/{useBaseUiId-CmLtG9DS.js → useBaseUiId-CYT1vFMG.js} +64 -44
  149. package/dist/{useBaseUiId-CmLtG9DS.js.map → useBaseUiId-CYT1vFMG.js.map} +1 -1
  150. package/dist/{useButton-D2BMuSfC.js → useButton-BlHadUfM.js} +4 -4
  151. package/dist/{useButton-D2BMuSfC.js.map → useButton-BlHadUfM.js.map} +1 -1
  152. package/dist/{CompositeList-D4xmSZ5V.js → useCompositeListItem-DlAKWsHE.js} +59 -59
  153. package/dist/useCompositeListItem-DlAKWsHE.js.map +1 -0
  154. package/dist/{useControlled-BSyYkg5C.js → useControlled-DMDWXIzj.js} +2 -2
  155. package/dist/{useControlled-BSyYkg5C.js.map → useControlled-DMDWXIzj.js.map} +1 -1
  156. package/dist/useFocus-C__7iwl1.js +137 -0
  157. package/dist/useFocus-C__7iwl1.js.map +1 -0
  158. package/dist/{useIsoLayoutEffect-e9VA-ICd.js → useIsoLayoutEffect-D2lpsB9D.js} +8 -4
  159. package/dist/{useIsoLayoutEffect-e9VA-ICd.js.map → useIsoLayoutEffect-D2lpsB9D.js.map} +1 -1
  160. package/dist/{usePopupHandleStore-CkW2IoED.js → usePopupHandleStore-C_Vw7xcw.js} +1966 -2002
  161. package/dist/usePopupHandleStore-C_Vw7xcw.js.map +1 -0
  162. package/dist/{Tooltip-uQIVdskf.js → usePositioner-BmYVsMO_.js} +17 -1402
  163. package/dist/usePositioner-BmYVsMO_.js.map +1 -0
  164. package/dist/{useOpenInteractionType-CDFYOw2d.js → useScrollLock-By-42HSc.js} +74 -58
  165. package/dist/useScrollLock-By-42HSc.js.map +1 -0
  166. package/dist/{useLabelableId-CcIE3RU0.js → useSetFieldFocused-CcdG6FNp.js} +27 -35
  167. package/dist/useSetFieldFocused-CcdG6FNp.js.map +1 -0
  168. package/dist/{useTimeout-BXf1hDIL.js → useTimeout-D1vYJgq4.js} +3 -3
  169. package/dist/{useTimeout-BXf1hDIL.js.map → useTimeout-D1vYJgq4.js.map} +1 -1
  170. package/dist/{useTransitionStatus-C9gg_XJ-.js → useTransitionStatus-CHrs3i5F.js} +3 -3
  171. package/dist/{useTransitionStatus-C9gg_XJ-.js.map → useTransitionStatus-CHrs3i5F.js.map} +1 -1
  172. package/dist/useTriggerFocusGuards-CXAhW8P6.js +100 -0
  173. package/dist/useTriggerFocusGuards-CXAhW8P6.js.map +1 -0
  174. package/dist/useValueChanged-BnlOop8k.js +16 -0
  175. package/dist/useValueChanged-BnlOop8k.js.map +1 -0
  176. package/package.json +1 -1
  177. package/dist/CompositeList-D4xmSZ5V.js.map +0 -1
  178. package/dist/CompositeRoot-BlljDWkR.js.map +0 -1
  179. package/dist/Popover-BqqXJnK1.js.map +0 -1
  180. package/dist/Tooltip-uQIVdskf.js.map +0 -1
  181. package/dist/composite-BL4bbAWg.js +0 -66
  182. package/dist/composite-BL4bbAWg.js.map +0 -1
  183. package/dist/error-FX4R42W-.js +0 -6
  184. package/dist/index-C-2yrwZl.js.map +0 -1
  185. package/dist/shadowDom-BfewIqRj.js +0 -52
  186. package/dist/shadowDom-BfewIqRj.js.map +0 -1
  187. package/dist/useLabelableId-CcIE3RU0.js.map +0 -1
  188. package/dist/useOpenInteractionType-CDFYOw2d.js.map +0 -1
  189. package/dist/usePopupHandleStore-CkW2IoED.js.map +0 -1
  190. package/dist/useValueAsRef-BfFRcMg6.js.map +0 -1
@@ -1,25 +1,21 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
4
  import * as React from "react";
6
- import { c as cva } from "./index-DSVg79g-.js";
7
- import { C as ControlButton } from "./Button-CPJYHldw.js";
8
- import IconProvider from "./components/atoms/IconProvider.es.js";
9
- import { c as classNames } from "./classNames-B1XpQHle.js";
10
- import { f as formatErrorMessage, a as useStableCallback, b as useRenderElement, u as useIsoLayoutEffect } from "./useIsoLayoutEffect-e9VA-ICd.js";
11
- import { a as closePress, t as triggerHover, f as focusOut, b as triggerPress, e as escapeKey, c as createChangeEventDetails, h as imperativeAction, u as useBaseUiId, j as isHTMLElement } from "./useBaseUiId-CmLtG9DS.js";
12
- import { a as useButton } from "./useButton-D2BMuSfC.js";
13
- import { R as ReactStore, p as popupStoreSelectors, a as attachPreventUnmountOnClose, P as PATIENT_CLICK_THRESHOLD, c as createPopupOpenState, b as createInitialPopupStoreState, d as PopupTriggerMap, f as fastComponent, F as FloatingTree, u as usePopupRootSync, e as useImplicitActiveTrigger, g as useOpenStateTransitions, h as PopupHandleAttachment, i as usePopupRootStore, j as useDismiss, k as usePopupInteractionProps, l as isOutsideEvent, m as getTabbableNearElement, n as fastComponentRef, o as usePopupHandleStore, q as useTriggerDataForwarding, r as FocusGuard, C as CLICK_TRIGGER_IDENTIFIER, s as pressableTriggerOpenStateMapping, t as triggerOpenStateMapping, v as FloatingPortal, w as useFloatingNodeId, x as FloatingNode, y as POPUP_COLLISION_AVOIDANCE, z as createDefaultInitialFocus, A as FOCUSABLE_POPUP_PROPS, B as popupTransitionStateMapping, D as popupStateMapping } from "./usePopupHandleStore-CkW2IoED.js";
14
- import { i as inertValue } from "./inertValue-IJM5NA30.js";
15
- import { u as useHoverReferenceInteraction, s as safePolygon, a as useAnchorPositioning, b as usePositioner, c as useHoverFloatingInteraction, g as getDisabledMountTransitionStyles } from "./Tooltip-uQIVdskf.js";
16
- import { u as useClick, a as useOpenMethodTriggerProps, b as useScrollLock, I as InternalBackdrop, F as FloatingFocusManager } from "./useOpenInteractionType-CDFYOw2d.js";
17
- import { b as useAnimationsFinished, a as useOpenChangeComplete } from "./useTransitionStatus-C9gg_XJ-.js";
18
- import { o as ownerDocument } from "./index-C-2yrwZl.js";
19
- import { C as COMPOSITE_KEYS } from "./composite-C22yiNy1.js";
20
- import { u as useToolbarRootContext } from "./ToolbarRootContext-B_HxjkNI.js";
5
+ import { R as ReactStore, l as popupStoreSelectors, a as attachPreventUnmountOnClose, H as PATIENT_CLICK_THRESHOLD, v as createPopupOpenState, n as createInitialPopupStoreState, P as PopupTriggerMap, o as fastComponent, A as FloatingTree, M as usePopupRootSync, r as useImplicitActiveTrigger, s as useOpenStateTransitions, z as PopupHandleAttachment, L as usePopupRootStore, b as useDismiss, y as usePopupInteractionProps, B as fastComponentRef, C as usePopupHandleStore, E as useTriggerDataForwarding, G as FocusGuard, N as CLICK_TRIGGER_IDENTIFIER, p as pressableTriggerOpenStateMapping, t as triggerOpenStateMapping, c as FloatingPortal, q as useFloatingNodeId, j as FloatingNode, k as POPUP_COLLISION_AVOIDANCE, K as createDefaultInitialFocus, F as FOCUSABLE_POPUP_PROPS, i as popupTransitionStateMapping } from "./usePopupHandleStore-C_Vw7xcw.js";
21
6
  import * as ReactDOM from "react-dom";
22
- import { T as Timeout } from "./useTimeout-BXf1hDIL.js";
7
+ import { T as Timeout } from "./useTimeout-D1vYJgq4.js";
8
+ import { z as closePress, I as triggerHover, s as focusOut, t as triggerPress, r as escapeKey, c as createChangeEventDetails, y as imperativeAction, u as useBaseUiId, i as isHTMLElement } from "./useBaseUiId-CYT1vFMG.js";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { f as formatErrorMessage, a as useStableCallback, b as useRenderElement, u as useIsoLayoutEffect } from "./useIsoLayoutEffect-D2lpsB9D.js";
11
+ import { a as useButton } from "./useButton-BlHadUfM.js";
12
+ import { b as useTriggerFocusGuards, a as useTriggerSwitchTransition, u as useAnchoredPopupScrollLock } from "./useTriggerFocusGuards-CXAhW8P6.js";
13
+ import { a as useClick, c as useOpenMethodTriggerProps, I as InternalBackdrop, F as FloatingFocusManager } from "./useScrollLock-By-42HSc.js";
14
+ import { c as useHoverReferenceInteraction, s as safePolygon, u as useAnchorPositioning, a as usePositioner, b as useHoverFloatingInteraction, g as getDisabledMountTransitionStyles } from "./usePositioner-BmYVsMO_.js";
15
+ import { i as inertValue } from "./inertValue-C1Ml1s55.js";
16
+ import { a as useOpenChangeComplete } from "./useTransitionStatus-CHrs3i5F.js";
17
+ import { C as COMPOSITE_KEYS } from "./composite-IA--dSel.js";
18
+ import { u as useToolbarRootContext } from "./ToolbarRootContext-B_HxjkNI.js";
23
19
  const PopoverRootContext = /* @__PURE__ */ React.createContext(void 0);
24
20
  if (process.env.NODE_ENV !== "production") PopoverRootContext.displayName = "PopoverRootContext";
25
21
  function usePopoverRootContext(optional) {
@@ -194,7 +190,7 @@ const PopoverRootComponent = fastComponent(function PopoverRootComponent2({
194
190
  });
195
191
  });
196
192
  if (process.env.NODE_ENV !== "production") PopoverRootComponent.displayName = "PopoverRootComponent";
197
- function PopoverRoot$1(props) {
193
+ function PopoverRoot(props) {
198
194
  if (usePopoverRootContext(true)) {
199
195
  return /* @__PURE__ */ jsx(PopoverRootComponent, {
200
196
  props
@@ -234,33 +230,7 @@ function PopoverInteractions({
234
230
  return null;
235
231
  }
236
232
  const OPEN_DELAY = 300;
237
- function useTriggerFocusGuards(store, triggerElementRef) {
238
- function closeAndFocus(event, direction, positionerElement) {
239
- var _a;
240
- const guard = event.currentTarget;
241
- ReactDOM.flushSync(() => {
242
- store.setOpen(false, createChangeEventDetails(focusOut, event.nativeEvent, guard));
243
- });
244
- (_a = getTabbableNearElement(guard.isConnected ? guard : triggerElementRef.current, direction, positionerElement)) == null ? void 0 : _a.focus();
245
- }
246
- function handlePreFocusGuardFocus(event) {
247
- closeAndFocus(event, -1, store.select("positionerElement"));
248
- }
249
- function handleFocusTargetFocus(event) {
250
- var _a;
251
- const positionerElement = store.select("positionerElement");
252
- if (positionerElement && isOutsideEvent(event, positionerElement)) {
253
- (_a = store.context.beforeContentFocusGuardRef.current) == null ? void 0 : _a.focus();
254
- } else {
255
- closeAndFocus(event, 1, positionerElement);
256
- }
257
- }
258
- return {
259
- handlePreFocusGuardFocus,
260
- handleFocusTargetFocus
261
- };
262
- }
263
- const PopoverTrigger$1 = fastComponentRef(function PopoverTrigger(componentProps, forwardedRef) {
233
+ const PopoverTrigger = fastComponentRef(function PopoverTrigger2(componentProps, forwardedRef) {
264
234
  const {
265
235
  render,
266
236
  className,
@@ -371,7 +341,7 @@ const PopoverTrigger$1 = fastComponentRef(function PopoverTrigger(componentProps
371
341
  }
372
342
  return keyedElement;
373
343
  });
374
- if (process.env.NODE_ENV !== "production") PopoverTrigger$1.displayName = "PopoverTrigger";
344
+ if (process.env.NODE_ENV !== "production") PopoverTrigger.displayName = "PopoverTrigger";
375
345
  const PopoverPortalContext = /* @__PURE__ */ React.createContext(void 0);
376
346
  if (process.env.NODE_ENV !== "production") PopoverPortalContext.displayName = "PopoverPortalContext";
377
347
  function usePopoverPortalContext() {
@@ -410,66 +380,6 @@ function usePopoverPositionerContext() {
410
380
  }
411
381
  return context;
412
382
  }
413
- function useTriggerSwitchTransition(parameters) {
414
- const {
415
- store,
416
- domReference,
417
- positionerElement,
418
- open
419
- } = parameters;
420
- const previousTriggerRef = React.useRef(null);
421
- const pendingSwitchRef = React.useRef(null);
422
- const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);
423
- useIsoLayoutEffect(() => {
424
- var _a;
425
- if (open) {
426
- return;
427
- }
428
- (_a = pendingSwitchRef.current) == null ? void 0 : _a.abort();
429
- pendingSwitchRef.current = null;
430
- if (store.state.instantType === "trigger-change") {
431
- store.set("instantType", void 0);
432
- }
433
- }, [open, store]);
434
- useIsoLayoutEffect(() => {
435
- const currentTrigger = domReference;
436
- const previousTrigger = previousTriggerRef.current;
437
- if (currentTrigger) {
438
- previousTriggerRef.current = currentTrigger;
439
- }
440
- if (!previousTrigger || !currentTrigger || currentTrigger === previousTrigger) {
441
- return void 0;
442
- }
443
- if (!store.select("open")) {
444
- return void 0;
445
- }
446
- store.set("instantType", void 0);
447
- const abortController = new AbortController();
448
- pendingSwitchRef.current = abortController;
449
- runOnceAnimationsFinish(() => {
450
- if (store.select("open")) {
451
- store.set("instantType", "trigger-change");
452
- }
453
- }, abortController.signal);
454
- return () => {
455
- abortController.abort();
456
- };
457
- }, [domReference, runOnceAnimationsFinish, store]);
458
- }
459
- const VIEWPORT_WIDTH_TOLERANCE_PX = 20;
460
- function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
461
- const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);
462
- useIsoLayoutEffect(() => {
463
- if (!enabled || !touchOpen || positionerElement == null) {
464
- setTouchOpenShouldLockScroll(false);
465
- return;
466
- }
467
- const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
468
- const popupWidth = positionerElement.offsetWidth;
469
- setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
470
- }, [enabled, touchOpen, positionerElement]);
471
- useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
472
- }
473
383
  const PopoverPositioner = /* @__PURE__ */ React.forwardRef(function PopoverPositioner2(componentProps, forwardedRef) {
474
384
  const {
475
385
  render,
@@ -678,397 +588,14 @@ const PopoverPopup = /* @__PURE__ */ React.forwardRef(function PopoverPopup2(com
678
588
  });
679
589
  });
680
590
  if (process.env.NODE_ENV !== "production") PopoverPopup.displayName = "PopoverPopup";
681
- const PopoverArrow$1 = /* @__PURE__ */ React.forwardRef(function PopoverArrow(componentProps, forwardedRef) {
682
- const {
683
- render,
684
- className,
685
- style,
686
- ...elementProps
687
- } = componentProps;
688
- const store = usePopoverRootContext();
689
- const open = store.useState("open");
690
- const {
691
- arrowRef,
692
- side,
693
- align,
694
- arrowUncentered,
695
- arrowStyles
696
- } = usePopoverPositionerContext();
697
- const state = {
698
- open,
699
- side,
700
- align,
701
- uncentered: arrowUncentered
702
- };
703
- const element = useRenderElement("div", componentProps, {
704
- state,
705
- ref: [forwardedRef, arrowRef],
706
- props: [{
707
- style: arrowStyles,
708
- "aria-hidden": true
709
- }, elementProps],
710
- stateAttributesMapping: popupStateMapping
711
- });
712
- return element;
713
- });
714
- if (process.env.NODE_ENV !== "production") PopoverArrow$1.displayName = "PopoverArrow";
715
- const PopoverTitle$1 = /* @__PURE__ */ React.forwardRef(function PopoverTitle(componentProps, forwardedRef) {
716
- const {
717
- render,
718
- className,
719
- style,
720
- ...elementProps
721
- } = componentProps;
722
- const store = usePopoverRootContext();
723
- const id = useBaseUiId(elementProps.id);
724
- store.useSyncedValueWithCleanup("titleElementId", id);
725
- const element = useRenderElement("h2", componentProps, {
726
- ref: forwardedRef,
727
- props: [{
728
- id
729
- }, elementProps]
730
- });
731
- return element;
732
- });
733
- if (process.env.NODE_ENV !== "production") PopoverTitle$1.displayName = "PopoverTitle";
734
- const PopoverDescription$1 = /* @__PURE__ */ React.forwardRef(function PopoverDescription(componentProps, forwardedRef) {
735
- const {
736
- render,
737
- className,
738
- style,
739
- ...elementProps
740
- } = componentProps;
741
- const store = usePopoverRootContext();
742
- const id = useBaseUiId(elementProps.id);
743
- store.useSyncedValueWithCleanup("descriptionElementId", id);
744
- const element = useRenderElement("p", componentProps, {
745
- ref: forwardedRef,
746
- props: [{
747
- id
748
- }, elementProps]
749
- });
750
- return element;
751
- });
752
- if (process.env.NODE_ENV !== "production") PopoverDescription$1.displayName = "PopoverDescription";
753
- const PopoverClose$1 = /* @__PURE__ */ React.forwardRef(function PopoverClose(componentProps, forwardedRef) {
754
- const {
755
- render,
756
- className,
757
- style,
758
- disabled = false,
759
- nativeButton = true,
760
- ...elementProps
761
- } = componentProps;
762
- const {
763
- buttonRef,
764
- getButtonProps
765
- } = useButton({
766
- disabled,
767
- focusableWhenDisabled: false,
768
- native: nativeButton
769
- });
770
- const store = usePopoverRootContext();
771
- useClosePartRegistration();
772
- const element = useRenderElement("button", componentProps, {
773
- ref: [forwardedRef, buttonRef],
774
- props: [{
775
- onClick(event) {
776
- store.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent));
777
- }
778
- }, elementProps, getButtonProps]
779
- });
780
- return element;
781
- });
782
- if (process.env.NODE_ENV !== "production") PopoverClose$1.displayName = "PopoverClose";
783
- const popoverContentVariants = cva(
784
- "focus-ring flex max-h-[min(25rem,var(--available-height))] flex-col overflow-hidden rounded-container border border-border-subtle bg-background-overlay text-text-primary elevation-2 outline-none",
785
- {
786
- variants: {
787
- size: {
788
- auto: "w-auto",
789
- sm: "w-60",
790
- md: "w-80",
791
- lg: "w-120"
792
- }
793
- },
794
- defaultVariants: {
795
- size: "md"
796
- }
797
- }
798
- );
799
- function PopoverRoot({ modal = false, ...props }) {
800
- return /* @__PURE__ */ jsx(PopoverRoot$1, { "data-slot": "popover", modal, ...props });
801
- }
802
- function PopoverTrigger2(props) {
803
- return /* @__PURE__ */ jsx(PopoverTrigger$1, { "data-slot": "popover-trigger", ...props });
804
- }
805
- function PopoverArrow2({ className, ...props }) {
806
- return /* @__PURE__ */ jsx(
807
- PopoverArrow$1,
808
- {
809
- "data-slot": "popover-arrow",
810
- className: classNames(
811
- "size-fit text-background-overlay",
812
- // Base UI only sets the cross-axis offset; the main-axis offset below pins the arrow
813
- // to the surface's facing edge (with a 1px overlap into the border) instead of leaving
814
- // it in normal flow, where it renders outside the visible card.
815
- "data-[side=bottom]:top-[-0.1875rem] data-[side=top]:bottom-[-0.1875rem] data-[side=top]:rotate-180",
816
- "data-[side=left]:right-[-0.3125rem] data-[side=left]:rotate-90 data-[side=right]:left-[-0.3125rem] data-[side=right]:-rotate-90",
817
- className
818
- ),
819
- ...props,
820
- children: /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", width: "8", height: "4", viewBox: "0 0 8 4", fill: "none", children: [
821
- /* @__PURE__ */ jsx("path", { d: "M0 4h8l-4-4L0 4Z", fill: "currentColor" }),
822
- /* @__PURE__ */ jsx("path", { d: "M0 4 4 0 8 4", className: "stroke-border-subtle" })
823
- ] })
824
- }
825
- );
826
- }
827
- function PopoverContent({
828
- alignment = "start",
829
- alignOffset = 0,
830
- anchor,
831
- arrow = false,
832
- arrowPadding = 12,
833
- children,
834
- className,
835
- collisionAvoidance,
836
- container,
837
- placement = "bottom",
838
- positionerId,
839
- positionerClassName,
840
- sideOffset = 4,
841
- size = "md",
842
- ...props
843
- }) {
844
- return /* @__PURE__ */ jsx(PopoverPortal, { container, children: /* @__PURE__ */ jsxs(
845
- PopoverPositioner,
846
- {
847
- id: positionerId,
848
- "data-slot": "popover-positioner",
849
- align: alignment,
850
- alignOffset,
851
- anchor,
852
- arrowPadding,
853
- collisionAvoidance,
854
- side: placement,
855
- sideOffset,
856
- className: classNames("isolate z-50", positionerClassName),
857
- children: [
858
- /* @__PURE__ */ jsx(
859
- PopoverPopup,
860
- {
861
- "data-slot": "popover-content",
862
- className: classNames(popoverContentVariants({ size }), className),
863
- ...props,
864
- children
865
- }
866
- ),
867
- arrow ? /* @__PURE__ */ jsx(PopoverArrow2, {}) : null
868
- ]
869
- }
870
- ) });
871
- }
872
- function PopoverHeader({ className, ...props }) {
873
- return /* @__PURE__ */ jsx(
874
- "div",
875
- {
876
- "data-slot": "popover-header",
877
- className: classNames(
878
- "flex shrink-0 items-center gap-space-8 border-b border-border-subtle py-space-8 pr-space-8 pl-space-12",
879
- className
880
- ),
881
- ...props
882
- }
883
- );
884
- }
885
- function PopoverTitle2({ className, ...props }) {
886
- return /* @__PURE__ */ jsx(
887
- PopoverTitle$1,
888
- {
889
- "data-slot": "popover-title",
890
- className: classNames("min-w-0 flex-1 truncate text-label-md text-text-primary", className),
891
- ...props
892
- }
893
- );
894
- }
895
- function PopoverClose2({
896
- children,
897
- className,
898
- "aria-label": ariaLabel = "Close",
899
- ...props
900
- }) {
901
- return /* @__PURE__ */ jsx(
902
- PopoverClose$1,
903
- {
904
- "data-slot": "popover-close",
905
- render: /* @__PURE__ */ jsx(
906
- ControlButton,
907
- {
908
- type: "icon",
909
- variant: "ghost",
910
- size: "icon-md",
911
- className: classNames("shrink-0 text-button-ghost-icon-rest", className)
912
- }
913
- ),
914
- "aria-label": ariaLabel,
915
- ...props,
916
- children: children ?? /* @__PURE__ */ jsx(IconProvider, { icon: "xmark", className: "size-4" })
917
- }
918
- );
919
- }
920
- function PopoverBody({ className, ...props }) {
921
- return /* @__PURE__ */ jsx("div", { "data-slot": "popover-body", className: classNames("min-h-0 overflow-auto p-space-12", className), ...props });
922
- }
923
- function PopoverDescription2({ className, ...props }) {
924
- return /* @__PURE__ */ jsx(
925
- PopoverDescription$1,
926
- {
927
- "data-slot": "popover-description",
928
- className: classNames("text-body-sm text-text-secondary", className),
929
- ...props
930
- }
931
- );
932
- }
933
- function PopoverFooter({ className, ...props }) {
934
- return /* @__PURE__ */ jsx(
935
- "div",
936
- {
937
- "data-slot": "popover-footer",
938
- className: classNames(
939
- "flex shrink-0 items-center justify-end gap-space-8 border-t border-border-subtle px-space-12 py-space-8",
940
- className
941
- ),
942
- ...props
943
- }
944
- );
945
- }
946
- const defaultAnchorOrigin = { horizontal: "left", vertical: "top" };
947
- const defaultTransformOrigin = { horizontal: "left", vertical: "top" };
948
- function resolveOriginPlacement(anchorOrigin, transformOrigin) {
949
- const anchorVertical = anchorOrigin.vertical;
950
- const anchorHorizontal = anchorOrigin.horizontal;
951
- const transformVertical = transformOrigin.vertical;
952
- const transformHorizontal = transformOrigin.horizontal;
953
- let side = "bottom";
954
- if (anchorVertical === "bottom" && transformVertical === "top") {
955
- side = "bottom";
956
- } else if (anchorVertical === "top" && transformVertical === "bottom") {
957
- side = "top";
958
- } else if (anchorHorizontal === "right" && transformHorizontal === "left") {
959
- side = "right";
960
- } else if (anchorHorizontal === "left" && transformHorizontal === "right") {
961
- side = "left";
962
- }
963
- const alignmentOrigin = side === "top" || side === "bottom" ? anchorHorizontal : anchorVertical;
964
- const align = alignmentOrigin === "left" || alignmentOrigin === "top" ? "start" : alignmentOrigin === "right" || alignmentOrigin === "bottom" ? "end" : "center";
965
- return { align, side };
966
- }
967
- function resolveAnchorElement(anchorEl) {
968
- return typeof anchorEl === "function" ? anchorEl() : anchorEl ?? null;
969
- }
970
- function Popover({
971
- action,
972
- align,
973
- anchorEl,
974
- anchorOrigin = defaultAnchorOrigin,
975
- className,
976
- classes,
977
- closeAfterTransition: _closeAfterTransition,
978
- children,
979
- contentClassName,
980
- defaultOpen,
981
- disableEnforceFocus = false,
982
- id,
983
- modal,
984
- onClose,
985
- onOpenChange,
986
- onOpenChangeComplete,
987
- open,
988
- side,
989
- sideOffset,
990
- slotProps,
991
- sx: _sx,
992
- transformOrigin = defaultTransformOrigin,
993
- trigger,
994
- triggerProps,
995
- ...contentProps
996
- }) {
997
- var _a, _b;
998
- const isExternallyAnchored = !trigger;
999
- const { align: originAlign, side: originSide } = resolveOriginPlacement(anchorOrigin, transformOrigin);
1000
- const resolvedModal = modal ?? (isExternallyAnchored && !disableEnforceFocus ? "trap-focus" : false);
1001
- React.useImperativeHandle(
1002
- action,
1003
- () => ({
1004
- // Base UI automatically tracks changes to the anchor and popup dimensions.
1005
- updatePosition: () => void 0
1006
- }),
1007
- []
1008
- );
1009
- return /* @__PURE__ */ jsxs(
1010
- PopoverRoot,
1011
- {
1012
- defaultOpen,
1013
- modal: resolvedModal,
1014
- onOpenChange: (nextOpen, details) => {
1015
- onOpenChange == null ? void 0 : onOpenChange(nextOpen, details);
1016
- if (!nextOpen) {
1017
- onClose == null ? void 0 : onClose(details.event, details.reason === "escape-key" ? "escapeKeyDown" : "backdropClick");
1018
- }
1019
- },
1020
- onOpenChangeComplete: (nextOpen) => {
1021
- var _a2, _b2;
1022
- onOpenChangeComplete == null ? void 0 : onOpenChangeComplete(nextOpen);
1023
- if (nextOpen) {
1024
- (_b2 = (_a2 = slotProps == null ? void 0 : slotProps.transition) == null ? void 0 : _a2.onEntered) == null ? void 0 : _b2.call(_a2);
1025
- }
1026
- },
1027
- open,
1028
- children: [
1029
- trigger ? /* @__PURE__ */ jsx(PopoverTrigger2, { ...triggerProps, render: trigger }) : null,
1030
- /* @__PURE__ */ jsxs(
1031
- PopoverContent,
1032
- {
1033
- ...contentProps,
1034
- ref: (_a = slotProps == null ? void 0 : slotProps.paper) == null ? void 0 : _a.ref,
1035
- alignment: align ?? originAlign,
1036
- anchor: anchorEl,
1037
- className: classNames(contentClassName, classes == null ? void 0 : classes.paper, (_b = slotProps == null ? void 0 : slotProps.paper) == null ? void 0 : _b.className),
1038
- finalFocus: isExternallyAnchored ? () => resolveAnchorElement(anchorEl) : contentProps.finalFocus,
1039
- placement: side ?? originSide,
1040
- positionerClassName: classNames(className, classes == null ? void 0 : classes.root),
1041
- positionerId: id,
1042
- sideOffset: sideOffset ?? (isExternallyAnchored ? 0 : void 0),
1043
- size: contentProps.size ?? (isExternallyAnchored ? "auto" : void 0),
1044
- children: [
1045
- children,
1046
- resolvedModal === "trap-focus" ? /* @__PURE__ */ jsx(PopoverClose$1, { className: "sr-only", children: "Close popover" }) : null
1047
- ]
1048
- }
1049
- )
1050
- ]
1051
- }
1052
- );
1053
- }
1054
591
  export {
1055
- Popover as P,
1056
- PopoverArrow2 as a,
1057
- PopoverBody as b,
1058
- PopoverClose2 as c,
1059
- PopoverContent as d,
1060
- PopoverDescription2 as e,
1061
- PopoverFooter as f,
1062
- PopoverHeader as g,
1063
- PopoverRoot as h,
1064
- PopoverTitle2 as i,
1065
- PopoverTrigger2 as j,
1066
- PopoverPortal as k,
1067
- PopoverPositioner as l,
1068
- PopoverPopup as m,
1069
- PopoverDescription$1 as n,
1070
- PopoverRoot$1 as o,
1071
- PopoverTitle$1 as p,
1072
- PopoverTrigger$1 as q
592
+ PopoverRoot as P,
593
+ PopoverPortal as a,
594
+ PopoverPositioner as b,
595
+ PopoverPopup as c,
596
+ PopoverTrigger as d,
597
+ usePopoverPositionerContext as e,
598
+ useClosePartRegistration as f,
599
+ usePopoverRootContext as u
1073
600
  };
1074
- //# sourceMappingURL=Popover-BqqXJnK1.js.map
601
+ //# sourceMappingURL=PopoverPopup-teGm7D5T.js.map