@jobber/components 9.6.0 → 9.6.2

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 (187) hide show
  1. package/dist/ActivityIndicator-cjs.js +1 -0
  2. package/dist/ActivityIndicator-es.js +1 -0
  3. package/dist/Autocomplete/index.cjs +2 -0
  4. package/dist/Autocomplete/index.mjs +2 -0
  5. package/dist/Autocomplete-cjs.js +6 -4
  6. package/dist/Autocomplete-es.js +3 -1
  7. package/dist/Banner-cjs.js +1 -0
  8. package/dist/Banner-es.js +1 -0
  9. package/dist/Card/index.cjs +2 -1
  10. package/dist/Card/index.mjs +2 -1
  11. package/dist/Chip/index.cjs +2 -0
  12. package/dist/Chip/index.mjs +2 -0
  13. package/dist/Chip-cjs.js +1 -0
  14. package/dist/Chip-es.js +1 -0
  15. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -0
  16. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -0
  17. package/dist/Chips/InternalChipDismissible/index.cjs +2 -0
  18. package/dist/Chips/InternalChipDismissible/index.mjs +2 -0
  19. package/dist/Chips/index.cjs +2 -0
  20. package/dist/Chips/index.mjs +2 -0
  21. package/dist/Combobox/index.cjs +4 -2
  22. package/dist/Combobox/index.mjs +4 -2
  23. package/dist/{ComboboxSeparator-cjs.js → ComboboxChipRemove-cjs.js} +455 -501
  24. package/dist/{ComboboxSeparator-es.js → ComboboxChipRemove-es.js} +456 -500
  25. package/dist/ComboboxPrimitive-cjs.js +30 -29
  26. package/dist/ComboboxPrimitive-es.js +3 -2
  27. package/dist/ConfirmationModal/index.cjs +2 -0
  28. package/dist/ConfirmationModal/index.mjs +2 -0
  29. package/dist/ConfirmationModal-cjs.js +1 -0
  30. package/dist/ConfirmationModal-es.js +1 -0
  31. package/dist/DataDump/index.cjs +2 -1
  32. package/dist/DataDump/index.mjs +2 -1
  33. package/dist/DataDump-cjs.js +1 -0
  34. package/dist/DataDump-es.js +1 -0
  35. package/dist/DataList/components/DataListActions/index.cjs +2 -0
  36. package/dist/DataList/components/DataListActions/index.mjs +2 -0
  37. package/dist/DataList/components/DataListBulkActions/index.cjs +2 -0
  38. package/dist/DataList/components/DataListBulkActions/index.mjs +2 -0
  39. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +2 -0
  40. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +2 -0
  41. package/dist/DataList/components/DataListFilters/index.cjs +2 -0
  42. package/dist/DataList/components/DataListFilters/index.mjs +2 -0
  43. package/dist/DataList/components/DataListHeader/index.cjs +2 -0
  44. package/dist/DataList/components/DataListHeader/index.mjs +2 -0
  45. package/dist/DataList/components/DataListItem/index.cjs +2 -0
  46. package/dist/DataList/components/DataListItem/index.mjs +2 -0
  47. package/dist/DataList/components/DataListItemActions/index.cjs +2 -0
  48. package/dist/DataList/components/DataListItemActions/index.mjs +2 -0
  49. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +2 -0
  50. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +2 -0
  51. package/dist/DataList/components/DataListItems/index.cjs +2 -0
  52. package/dist/DataList/components/DataListItems/index.mjs +2 -0
  53. package/dist/DataList/components/DataListLayout/index.cjs +2 -0
  54. package/dist/DataList/components/DataListLayout/index.mjs +2 -0
  55. package/dist/DataList/components/DataListLayoutActions/index.cjs +2 -0
  56. package/dist/DataList/components/DataListLayoutActions/index.mjs +2 -0
  57. package/dist/DataList/index.cjs +2 -0
  58. package/dist/DataList/index.mjs +2 -0
  59. package/dist/DataTable-cjs.js +1 -0
  60. package/dist/DataTable-es.js +1 -0
  61. package/dist/DatePicker/index.cjs +2 -0
  62. package/dist/DatePicker/index.mjs +2 -0
  63. package/dist/DatePicker-cjs.js +8 -7
  64. package/dist/DatePicker-es.js +6 -5
  65. package/dist/Dialog/index.cjs +2 -1
  66. package/dist/Dialog/index.mjs +2 -1
  67. package/dist/DrawerDescription-cjs.js +99 -268
  68. package/dist/DrawerDescription-es.js +103 -270
  69. package/dist/DrawerGrid-cjs.js +1 -0
  70. package/dist/DrawerGrid-es.js +1 -0
  71. package/dist/DrawerTitle-cjs.js +6 -2
  72. package/dist/DrawerTitle-es.js +7 -3
  73. package/dist/FeatureSwitch-cjs.js +1 -0
  74. package/dist/FeatureSwitch-es.js +1 -0
  75. package/dist/FieldDescription-cjs.js +181 -184
  76. package/dist/FieldDescription-es.js +184 -187
  77. package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +2 -0
  78. package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +2 -0
  79. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +2 -0
  80. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +2 -0
  81. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +2 -0
  82. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +2 -0
  83. package/dist/FilterPicker/index.cjs +2 -0
  84. package/dist/FilterPicker/index.mjs +2 -0
  85. package/dist/FilterPickerContent-cjs.js +5 -4
  86. package/dist/FilterPickerContent-es.js +2 -1
  87. package/dist/FormFieldWrapper-cjs.js +1 -0
  88. package/dist/FormFieldWrapper-es.js +1 -0
  89. package/dist/FormatFile/index.cjs +2 -0
  90. package/dist/FormatFile/index.mjs +2 -0
  91. package/dist/FormatFile-cjs.js +1 -0
  92. package/dist/FormatFile-es.js +1 -0
  93. package/dist/Gallery/index.cjs +2 -0
  94. package/dist/Gallery/index.mjs +2 -0
  95. package/dist/InputAvatar-cjs.js +1 -0
  96. package/dist/InputAvatar-es.js +1 -0
  97. package/dist/InputDate/index.cjs +2 -0
  98. package/dist/InputDate/index.mjs +2 -0
  99. package/dist/InputDate-cjs.js +1 -0
  100. package/dist/InputDate-es.js +1 -0
  101. package/dist/InputNumber/index.cjs +2 -1
  102. package/dist/InputNumber/index.mjs +2 -1
  103. package/dist/InternalChipDismissible-cjs.js +1 -0
  104. package/dist/InternalChipDismissible-es.js +1 -0
  105. package/dist/LightBox/index.cjs +2 -0
  106. package/dist/LightBox/index.mjs +2 -0
  107. package/dist/LightBox-cjs.js +1 -0
  108. package/dist/LightBox-es.js +1 -0
  109. package/dist/Menu/index.cjs +2 -1
  110. package/dist/Menu/index.mjs +2 -1
  111. package/dist/Menu-cjs.js +6 -4
  112. package/dist/Menu-es.js +3 -1
  113. package/dist/MenuSubmenuTrigger-cjs.js +164 -206
  114. package/dist/MenuSubmenuTrigger-es.js +152 -194
  115. package/dist/Modal/index.cjs +3 -1
  116. package/dist/Modal/index.mjs +4 -2
  117. package/dist/NumberFieldInput-cjs.js +308 -187
  118. package/dist/NumberFieldInput-es.js +308 -187
  119. package/dist/Page/index.cjs +2 -1
  120. package/dist/Page/index.mjs +2 -1
  121. package/dist/Page-cjs.js +1 -0
  122. package/dist/Page-es.js +1 -0
  123. package/dist/Popover/index.cjs +2 -0
  124. package/dist/Popover/index.mjs +2 -0
  125. package/dist/Popover-cjs.js +9 -7
  126. package/dist/Popover-es.js +3 -1
  127. package/dist/ProgressBar-cjs.js +1 -0
  128. package/dist/ProgressBar-es.js +1 -0
  129. package/dist/ScrollAreaViewport-cjs.js +1093 -747
  130. package/dist/ScrollAreaViewport-es.js +1081 -734
  131. package/dist/Select/index.cjs +2 -1
  132. package/dist/Select/index.mjs +2 -1
  133. package/dist/SelectGroupLabel-cjs.js +306 -207
  134. package/dist/SelectGroupLabel-es.js +302 -203
  135. package/dist/SideDrawer-cjs.js +1 -0
  136. package/dist/SideDrawer-es.js +1 -0
  137. package/dist/Spinner-cjs.js +1 -0
  138. package/dist/Spinner-es.js +1 -0
  139. package/dist/Tooltip/index.cjs +2 -0
  140. package/dist/Tooltip/index.mjs +2 -0
  141. package/dist/Tooltip-cjs.js +7 -6
  142. package/dist/Tooltip-es.js +2 -1
  143. package/dist/dialogReturnFocus-cjs.js +1 -1
  144. package/dist/dialogReturnFocus-es.js +2 -2
  145. package/dist/floating-ui.react-cjs.js +192 -2564
  146. package/dist/floating-ui.react-dom-cjs.js +2103 -0
  147. package/dist/floating-ui.react-dom-es.js +2072 -0
  148. package/dist/floating-ui.react-es.js +156 -2519
  149. package/dist/floating-ui.utils-cjs.js +342 -0
  150. package/dist/floating-ui.utils-es.js +300 -0
  151. package/dist/index.cjs +4 -3
  152. package/dist/index.mjs +4 -3
  153. package/dist/primitives/BottomSheet/index.cjs +1 -1
  154. package/dist/primitives/BottomSheet/index.mjs +1 -1
  155. package/dist/primitives/ComboboxPrimitive/index.cjs +4 -2
  156. package/dist/primitives/ComboboxPrimitive/index.mjs +4 -2
  157. package/dist/primitives/SelectPrimitive/index.cjs +2 -0
  158. package/dist/primitives/SelectPrimitive/index.mjs +2 -0
  159. package/dist/primitives/index.cjs +3 -2
  160. package/dist/primitives/index.mjs +3 -2
  161. package/dist/scrollEdges-cjs.js +11 -1
  162. package/dist/scrollEdges-es.js +11 -1
  163. package/dist/sharedHelpers/i18n/index.cjs +1 -0
  164. package/dist/sharedHelpers/i18n/index.d.ts +1 -0
  165. package/dist/sharedHelpers/i18n/index.mjs +1 -1
  166. package/dist/sharedHelpers/i18n/releasedLanguages.d.ts +12 -0
  167. package/dist/sharedHelpers/i18n/useReleasedLocale.d.ts +6 -0
  168. package/dist/showToast-cjs.js +1 -1
  169. package/dist/showToast-es.js +1 -1
  170. package/dist/testUtils/releasedLanguages.d.ts +16 -0
  171. package/dist/unstyledPrimitives/index.cjs +478 -720
  172. package/dist/unstyledPrimitives/index.mjs +421 -663
  173. package/dist/useAtlantisI18n-cjs.js +44 -11
  174. package/dist/useAtlantisI18n-es.js +44 -12
  175. package/dist/useCompositeListItem-cjs.js +361 -2108
  176. package/dist/useCompositeListItem-es.js +331 -2076
  177. package/dist/useLabel-cjs.js +3 -2
  178. package/dist/useLabel-es.js +3 -2
  179. package/dist/useRenderElement-cjs.js +7 -9
  180. package/dist/useRenderElement-es.js +7 -9
  181. package/dist/useScrollLock-cjs.js +344 -819
  182. package/dist/useScrollLock-es.js +296 -732
  183. package/dist/useScrollToActive-cjs.js +5 -4
  184. package/dist/useScrollToActive-es.js +2 -1
  185. package/package.json +3 -3
  186. package/dist/scrollable-cjs.js +0 -58
  187. package/dist/scrollable-es.js +0 -54
@@ -4,11 +4,12 @@ var React = require('react');
4
4
  var classnames = require('classnames');
5
5
  var floatingUi_react = require('./floating-ui.react-cjs.js');
6
6
  var ReactDOM = require('react-dom');
7
+ var floatingUi_reactDom = require('./floating-ui.react-dom-cjs.js');
7
8
  var jobberHooks = require('@jobber/hooks');
8
9
  var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
10
+ var AtlantisContext = require('./AtlantisContext-cjs.js');
9
11
  var Typography = require('./Typography-cjs.js');
10
12
  var Button = require('./Button-cjs.js');
11
- var AtlantisContext = require('./AtlantisContext-cjs.js');
12
13
  var _commonjsHelpers = require('./_commonjsHelpers-cjs.js');
13
14
  var _getAllKeys = require('./_getAllKeys-cjs.js');
14
15
  var identity = require('./identity-cjs.js');
@@ -11632,10 +11633,10 @@ function withFloating(Component) {
11632
11633
  var _a;
11633
11634
  var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
11634
11635
  var arrowRef = React.useRef(null);
11635
- var floatingProps = floatingUi_react.useFloating(_assign({ open: !hidePopper, whileElementsMounted: floatingUi_react.autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
11636
- floatingUi_react.flip({ padding: 15 }),
11637
- floatingUi_react.offset(10),
11638
- floatingUi_react.arrow({ element: arrowRef })
11636
+ var floatingProps = floatingUi_react.useFloating(_assign({ open: !hidePopper, whileElementsMounted: floatingUi_reactDom.autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
11637
+ floatingUi_reactDom.flip({ padding: 15 }),
11638
+ floatingUi_reactDom.offset(10),
11639
+ floatingUi_reactDom.arrow({ element: arrowRef })
11639
11640
  ], ((_a = props.popperModifiers) !== null && _a !== void 0 ? _a : []), true) }, props.popperProps));
11640
11641
  var componentProps = _assign(_assign({}, props), { hidePopper: hidePopper, popperProps: _assign(_assign({}, floatingProps), { arrowRef: arrowRef }) });
11641
11642
  return React.createElement(Component, _assign({}, componentProps));
@@ -12680,12 +12681,12 @@ const datePickerMessages = useAtlantisI18n.defineMessages({
12680
12681
  });
12681
12682
 
12682
12683
  function DatePickerCustomHeader({ monthDate, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, }) {
12683
- const { locale } = AtlantisContext.useAtlantisContext();
12684
+ const locale = useAtlantisI18n.useReleasedLocale();
12684
12685
  const { t } = useAtlantisI18n.useAtlantisI18n(datePickerMessages);
12685
12686
  return (React.createElement("div", { className: styles.header },
12686
12687
  React.createElement(Button.Button, { onClick: decreaseMonth, disabled: prevMonthButtonDisabled, icon: "arrowLeft", ariaLabel: t("previousMonth"), variation: "work", type: "tertiary" }),
12687
12688
  React.createElement("div", { className: styles.month },
12688
- React.createElement(Typography.Typography, { element: "span", fontFamily: "display", size: "large" }, monthDate.toLocaleString(locale || "en-US", {
12689
+ React.createElement(Typography.Typography, { element: "span", fontFamily: "display", size: "large" }, monthDate.toLocaleString(locale, {
12689
12690
  month: "long",
12690
12691
  year: "numeric",
12691
12692
  }))),
@@ -1,12 +1,13 @@
1
1
  import React__default, { cloneElement, Component, createRef, useRef, useCallback, useEffect, createElement, forwardRef, isValidElement, useState, useId } from 'react';
2
2
  import classnames from 'classnames';
3
- import { u as useFloating, b as autoUpdate, f as flip, o as offset, a as arrow, w as FloatingArrow, d as useFloatingNodeId, c as useFloatingParentNodeId, i as FloatingTree, j as FloatingNode, F as FloatingPortal } from './floating-ui.react-es.js';
3
+ import { u as useFloating, m as FloatingArrow, b as useFloatingNodeId, a as useFloatingParentNodeId, e as FloatingTree, f as FloatingNode, F as FloatingPortal } from './floating-ui.react-es.js';
4
4
  import ReactDOM__default from 'react-dom';
5
+ import { b as autoUpdate, f as flip, o as offset, a as arrow } from './floating-ui.react-dom-es.js';
5
6
  import { useRefocusOnActivator } from '@jobber/hooks';
6
- import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
7
+ import { d as defineMessages, a as useReleasedLocale, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
8
+ import { u as useAtlantisContext } from './AtlantisContext-es.js';
7
9
  import { T as Typography } from './Typography-es.js';
8
10
  import { B as Button } from './Button-es.js';
9
- import { u as useAtlantisContext } from './AtlantisContext-es.js';
10
11
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
11
12
  import { k as keys_1, g as _getSymbols, _ as _arrayPush, s as stubArray_1, h as _baseGetAllKeys, c as _getAllKeys, b as _baseGet, d as _castPath, e as _toKey, a as _arrayMap } from './_getAllKeys-es.js';
12
13
  import { c as _Stack } from './identity-es.js';
@@ -12678,12 +12679,12 @@ const datePickerMessages = defineMessages({
12678
12679
  });
12679
12680
 
12680
12681
  function DatePickerCustomHeader({ monthDate, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, }) {
12681
- const { locale } = useAtlantisContext();
12682
+ const locale = useReleasedLocale();
12682
12683
  const { t } = useAtlantisI18n(datePickerMessages);
12683
12684
  return (React__default.createElement("div", { className: styles.header },
12684
12685
  React__default.createElement(Button, { onClick: decreaseMonth, disabled: prevMonthButtonDisabled, icon: "arrowLeft", ariaLabel: t("previousMonth"), variation: "work", type: "tertiary" }),
12685
12686
  React__default.createElement("div", { className: styles.month },
12686
- React__default.createElement(Typography, { element: "span", fontFamily: "display", size: "large" }, monthDate.toLocaleString(locale || "en-US", {
12687
+ React__default.createElement(Typography, { element: "span", fontFamily: "display", size: "large" }, monthDate.toLocaleString(locale, {
12687
12688
  month: "long",
12688
12689
  year: "numeric",
12689
12690
  }))),
@@ -14,10 +14,10 @@ require('../Typography-cjs.js');
14
14
  require('../useRenderElement-cjs.js');
15
15
  require('../ScrollAreaViewport-cjs.js');
16
16
  require('../useScrollLock-cjs.js');
17
+ require('../floating-ui.utils-cjs.js');
17
18
  require('react/jsx-runtime');
18
19
  require('react-dom');
19
20
  require('../scrollEdges-cjs.js');
20
- require('../scrollable-cjs.js');
21
21
  require('../OverlaySeparator-cjs.js');
22
22
  require('../Separator-cjs.js');
23
23
  require('../BottomSheet-cjs.js');
@@ -27,6 +27,7 @@ require('../SelectPrimitive-cjs.js');
27
27
  require('../mergeClassName-cjs.js');
28
28
  require('../SelectGroupLabel-cjs.js');
29
29
  require('../useCompositeListItem-cjs.js');
30
+ require('../floating-ui.react-dom-cjs.js');
30
31
  require('../Heading-cjs.js');
31
32
  require('../DrawerTitle-cjs.js');
32
33
  require('../DrawerDescription-cjs.js');
@@ -12,10 +12,10 @@ import '../Typography-es.js';
12
12
  import '../useRenderElement-es.js';
13
13
  import '../ScrollAreaViewport-es.js';
14
14
  import '../useScrollLock-es.js';
15
+ import '../floating-ui.utils-es.js';
15
16
  import 'react/jsx-runtime';
16
17
  import 'react-dom';
17
18
  import '../scrollEdges-es.js';
18
- import '../scrollable-es.js';
19
19
  import '../OverlaySeparator-es.js';
20
20
  import '../Separator-es.js';
21
21
  import '../BottomSheet-es.js';
@@ -25,6 +25,7 @@ import '../SelectPrimitive-es.js';
25
25
  import '../mergeClassName-es.js';
26
26
  import '../SelectGroupLabel-es.js';
27
27
  import '../useCompositeListItem-es.js';
28
+ import '../floating-ui.react-dom-es.js';
28
29
  import '../Heading-es.js';
29
30
  import '../DrawerTitle-es.js';
30
31
  import '../DrawerDescription-es.js';
@@ -26,223 +26,10 @@ function _interopNamespaceDefault(e) {
26
26
 
27
27
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
28
 
29
- /**
30
- * Minimal store contract exposed by popup handles to detached triggers.
31
- *
32
- * Detached triggers read `store` during render and subscribe to be notified when the handle switches
33
- * between its fallback store and a root's live store.
34
- *
35
- * @template HandleStore Store shape exposed to detached triggers.
36
- */
37
-
38
- /**
39
- * Store shape holding a trigger registry, required by `BasePopupHandle.openByTrigger` to resolve a
40
- * trigger element by id on both the attached root's store and the fallback store.
41
- */
42
-
43
- /**
44
- * Store shape required by `BasePopupHandle.openByTrigger`/`closePopup` to drive open/close state.
45
- * Only the root-owned `Store` needs this — the `HandleStore` view exposed to detached triggers may
46
- * omit `setOpen` entirely (as Dialog and PreviewCard's do) since it is never called while detached.
47
- */
48
-
49
- /**
50
- * Shared implementation for popup handles that coordinate detached triggers with a mounted root.
51
- *
52
- * Subclasses provide the component-specific imperative methods, while this base class owns the
53
- * fallback store, root store attachment stack, subscriber notifications, and development warning for
54
- * overlapping roots.
55
- *
56
- * @template HandleStore Store shape exposed to detached triggers.
57
- * @template Store Root-owned store attached by the component root.
58
- */
59
- class BasePopupHandle {
60
- /**
61
- * Stores of every root currently using this handle, in attach order. A handle is meant to be used
62
- * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
63
- * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
64
- * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
65
- */
66
- attachedStores = [];
67
-
68
- /**
69
- * Store of the root that currently controls the handle: the most recently attached one still
70
- * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
71
- */
72
- attachedStoreValue = null;
73
-
74
- /**
75
- * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
76
- */
77
- storeListeners = new Set();
78
-
79
- /**
80
- * Creates a handle backed by the store used while no root is attached.
81
- *
82
- * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
83
- * so they can render and register without a mounted root. Triggers register into whichever store
84
- * `store` currently resolves to, so while detached they live in this store's trigger map and
85
- * migrate themselves to the root's store (and back) as it attaches/detaches.
86
- * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
87
- * `MenuHandle.open()` in warning text.
88
- * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
89
- * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
90
- * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
91
- */
92
- constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
93
- this.fallbackStore = fallbackStore;
94
- this.componentName = componentName;
95
- this.throwOnMissingTrigger = throwOnMissingTrigger;
96
- }
97
- get attachedStore() {
98
- return this.attachedStoreValue;
99
- }
100
-
101
- /**
102
- * Store that detached triggers read from: the attached root's store, or an inert fallback store
103
- * used while no root is attached.
104
- * @internal
105
- */
106
- get store() {
107
- return this.attachedStoreValue ?? this.fallbackStore;
108
- }
109
-
110
- /**
111
- * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
112
- * the handle during render because a handle can be shared by concurrent server-rendered requests.
113
- * @internal
114
- */
115
- get serverStore() {
116
- return this.fallbackStore;
117
- }
118
-
119
- /**
120
- * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
121
- * when a root attaches or detaches. Returns a function that removes the listener.
122
- * @internal
123
- */
124
- subscribeStore(listener) {
125
- this.storeListeners.add(listener);
126
- return () => {
127
- this.storeListeners.delete(listener);
128
- };
129
- }
130
-
131
- /**
132
- * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
133
- * re-register into it (their registration ref re-fires on the store-pointer change). Returns a
134
- * cleanup function that detaches the store again.
135
- * @internal
136
- */
137
- attachStore(newStore) {
138
- this.attachedStores.push(newStore);
139
- this.setActiveStore(newStore);
140
- if (process.env.NODE_ENV !== 'production') {
141
- if (this.attachedStores.length > 1) {
142
- // More than one root is attached at once. This is usually a transient overlap during an
143
- // animated route transition, where the outgoing root unmounts shortly after the incoming
144
- // one mounts. Defer the check by a frame and only warn if the overlap is still present once
145
- // the transition has settled (more than one root stayed mounted), so a clean handoff doesn't
146
- // warn regardless of the exact unmount timing.
147
- // The warning frame only exists in development; it is created lazily so it never appears on
148
- // instances in production (like `controlledValues` in `ReactStore`).
149
- const dev = this;
150
- (dev.overlapWarningFrame ??= useScrollLock.AnimationFrame.create()).request(() => {
151
- if (this.attachedStores.length > 1) {
152
- console.warn('Base UI: A handle is attached to more than one mounted root at the same time. ' + 'The most recently mounted root takes over and the previous one stops being controlled by the handle. ' + 'A handle should be used by a single root that stays mounted for the lifetime of the handle.');
153
- }
154
- });
155
- }
156
- }
157
- return () => {
158
- const index = this.attachedStores.lastIndexOf(newStore);
159
- if (index !== -1) {
160
- this.attachedStores.splice(index, 1);
161
- }
162
- // Restore control to the most recently attached root that is still mounted (or detach fully if
163
- // none remain). Clearing unconditionally would leave a still-mounted older root uncontrollable
164
- // when a newer overlapping root detaches first (e.g. a canceled route transition).
165
- this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
166
- };
167
- }
168
-
169
- /**
170
- * Sets the store that currently controls the handle and notifies subscribers when it changes, so
171
- * detached triggers re-render and migrate their registration to the new store.
172
- */
173
- setActiveStore(store) {
174
- if (this.attachedStoreValue !== store) {
175
- this.attachedStoreValue = store;
176
- this.storeListeners.forEach(listener => {
177
- listener();
178
- });
179
- }
180
- }
181
-
182
- /**
183
- * Opens the attached root's store and associates it with the trigger with the given id, or a
184
- * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
185
- * `open()` method, which only narrows the parameter type.
186
- *
187
- * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
188
- * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
189
- *
190
- * This method should only be called in an event handler or an effect (not during rendering).
191
- *
192
- * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
193
- * without associating any trigger.
194
- */
195
- openByTrigger(triggerId) {
196
- const attachedStore = this.attachedStore;
197
- if (attachedStore === null) {
198
- if (process.env.NODE_ENV !== 'production') {
199
- console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. ` + 'The call was ignored; mount a root with this handle before opening it imperatively.');
200
- }
201
- return;
202
- }
203
-
204
- // Registered triggers normally live in the active root's store. During the commit in which a
205
- // root attaches, a still-mounted detached trigger has not re-registered into that store yet (it
206
- // migrates on its next render): it is still registered wherever it lived before — the fallback
207
- // store when this is the first root to attach, or a previously attached root's store during a
208
- // transient overlap (e.g. an animated route transition). Search the whole attachment stack
209
- // (newest first) and the fallback map so an imperative open-by-id called in that commit (e.g.
210
- // from a layout effect) still resolves the trigger instead of treating it as missing.
211
- let triggerElement;
212
- if (triggerId) {
213
- for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
214
- triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
215
- }
216
- triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
217
- }
218
- if (triggerId && !triggerElement) {
219
- if (this.throwOnMissingTrigger) {
220
- throw new Error(process.env.NODE_ENV !== "production" ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", ` + 'but no matching trigger is registered with this handle. ' + 'An anchored popup cannot open without a trigger to anchor to. ' + `Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : useRenderElement.formatErrorMessage(99, this.componentName, triggerId, this.componentName));
221
- }
222
- if (process.env.NODE_ENV !== 'production') {
223
- console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". ` + 'The popup will open, but the trigger will not be associated with it.');
224
- }
225
- }
226
- attachedStore.setOpen(true, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction, undefined, triggerElement));
227
- }
228
-
229
- /**
230
- * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
231
- * while no root is attached. Shared by every concrete handle's public `close()` method.
232
- *
233
- * This method should only be called in an event handler or an effect (not during rendering).
234
- */
235
- closePopup() {
236
- const attachedStore = this.attachedStore;
237
- if (attachedStore === null) {
238
- if (process.env.NODE_ENV !== 'production') {
239
- console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. ` + 'The call was ignored.');
240
- }
241
- return;
242
- }
243
- attachedStore.setOpen(false, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction));
244
- }
245
- }
29
+ const stateAttributesMapping$1 = {
30
+ ...useScrollLock.popupStateMapping,
31
+ ...useScrollLock.transitionStatusMapping
32
+ };
246
33
 
247
34
  /**
248
35
  * An overlay displayed beneath the popup.
@@ -258,7 +45,9 @@ const DialogBackdrop = /*#__PURE__*/React__namespace.forwardRef(function DialogB
258
45
  forceRender = false,
259
46
  ...elementProps
260
47
  } = componentProps;
261
- const store = ScrollAreaViewport.useDialogRootContext();
48
+ const {
49
+ store
50
+ } = ScrollAreaViewport.useDialogRootContext();
262
51
  const open = store.useState('open');
263
52
  const nested = store.useState('nested');
264
53
  const mounted = store.useState('mounted');
@@ -270,7 +59,7 @@ const DialogBackdrop = /*#__PURE__*/React__namespace.forwardRef(function DialogB
270
59
  return useRenderElement.useRenderElement('div', componentProps, {
271
60
  state,
272
61
  ref: [store.context.backdropRef, forwardedRef],
273
- stateAttributesMapping: useScrollLock.popupTransitionStateMapping,
62
+ stateAttributesMapping: stateAttributesMapping$1,
274
63
  props: [{
275
64
  role: 'presentation',
276
65
  hidden: !mounted,
@@ -298,7 +87,9 @@ const DialogDescription = /*#__PURE__*/React__namespace.forwardRef(function Dial
298
87
  id: idProp,
299
88
  ...elementProps
300
89
  } = componentProps;
301
- const store = ScrollAreaViewport.useDialogRootContext();
90
+ const {
91
+ store
92
+ } = ScrollAreaViewport.useDialogRootContext();
302
93
  const id = useScrollLock.useBaseUiId(idProp);
303
94
  store.useSyncedValueWithCleanup('descriptionElementId', id);
304
95
  return useRenderElement.useRenderElement('p', componentProps, {
@@ -310,6 +101,59 @@ const DialogDescription = /*#__PURE__*/React__namespace.forwardRef(function Dial
310
101
  });
311
102
  if (process.env.NODE_ENV !== "production") DialogDescription.displayName = "DialogDescription";
312
103
 
104
+ let DialogPopupCssVars = /*#__PURE__*/function (DialogPopupCssVars) {
105
+ /**
106
+ * Indicates how many dialogs are nested within.
107
+ * @type {number}
108
+ */
109
+ DialogPopupCssVars["nestedDialogs"] = "--nested-dialogs";
110
+ return DialogPopupCssVars;
111
+ }({});
112
+
113
+ let DialogPopupDataAttributes = function (DialogPopupDataAttributes) {
114
+ /**
115
+ * Present when the dialog is open.
116
+ */
117
+ DialogPopupDataAttributes[DialogPopupDataAttributes["open"] = useScrollLock.CommonPopupDataAttributes.open] = "open";
118
+ /**
119
+ * Present when the dialog is closed.
120
+ */
121
+ DialogPopupDataAttributes[DialogPopupDataAttributes["closed"] = useScrollLock.CommonPopupDataAttributes.closed] = "closed";
122
+ /**
123
+ * Present when the dialog is animating in.
124
+ */
125
+ DialogPopupDataAttributes[DialogPopupDataAttributes["startingStyle"] = useScrollLock.CommonPopupDataAttributes.startingStyle] = "startingStyle";
126
+ /**
127
+ * Present when the dialog is animating out.
128
+ */
129
+ DialogPopupDataAttributes[DialogPopupDataAttributes["endingStyle"] = useScrollLock.CommonPopupDataAttributes.endingStyle] = "endingStyle";
130
+ /**
131
+ * Present when the dialog is nested within another dialog.
132
+ */
133
+ DialogPopupDataAttributes["nested"] = "data-nested";
134
+ /**
135
+ * Present when the dialog has other open dialogs nested within it.
136
+ */
137
+ DialogPopupDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
138
+ return DialogPopupDataAttributes;
139
+ }({});
140
+
141
+ const stateAttributesMapping = {
142
+ ...useScrollLock.popupStateMapping,
143
+ ...useScrollLock.transitionStatusMapping,
144
+ nestedDialogOpen(value) {
145
+ return value ? {
146
+ [DialogPopupDataAttributes.nestedDialogOpen]: ''
147
+ } : null;
148
+ }
149
+ };
150
+
151
+ /**
152
+ * A container for the dialog contents.
153
+ * Renders a `<div>` element.
154
+ *
155
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
156
+ */
313
157
  const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopup(componentProps, forwardedRef) {
314
158
  const {
315
159
  render,
@@ -319,7 +163,9 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
319
163
  initialFocus,
320
164
  ...elementProps
321
165
  } = componentProps;
322
- const store = ScrollAreaViewport.useDialogRootContext();
166
+ const {
167
+ store
168
+ } = ScrollAreaViewport.useDialogRootContext();
323
169
  const descriptionElementId = store.useState('descriptionElementId');
324
170
  const disablePointerDismissal = store.useState('disablePointerDismissal');
325
171
  const floatingRootContext = store.useState('floatingRootContext');
@@ -334,6 +180,7 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
334
180
  const transitionStatus = store.useState('transitionStatus');
335
181
  const role = store.useState('role');
336
182
  const floatingId = floatingRootContext.useState('floatingId');
183
+ const popupId = elementProps.id ?? floatingId;
337
184
  ScrollAreaViewport.useDialogPortalContext();
338
185
  useScrollLock.useOpenChangeComplete({
339
186
  open,
@@ -356,9 +203,9 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
356
203
  const element = useRenderElement.useRenderElement('div', componentProps, {
357
204
  state,
358
205
  props: [rootPopupProps, {
359
- id: floatingId,
360
- 'aria-labelledby': titleElementId,
361
- 'aria-describedby': descriptionElementId,
206
+ id: popupId,
207
+ 'aria-labelledby': titleElementId ?? undefined,
208
+ 'aria-describedby': descriptionElementId ?? undefined,
362
209
  role,
363
210
  ...useScrollLock.FOCUSABLE_POPUP_PROPS,
364
211
  hidden: !mounted,
@@ -368,11 +215,11 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
368
215
  }
369
216
  },
370
217
  style: {
371
- '--nested-dialogs': nestedOpenDialogCount
218
+ [DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
372
219
  }
373
220
  }, elementProps],
374
221
  ref: [forwardedRef, store.context.popupRef, setPopupElement],
375
- stateAttributesMapping: ScrollAreaViewport.dialogStateAttributesMapping
222
+ stateAttributesMapping
376
223
  });
377
224
  return /*#__PURE__*/jsxRuntime.jsx(useScrollLock.FloatingFocusManager, {
378
225
  context: floatingRootContext,
@@ -389,73 +236,59 @@ const DialogPopup = /*#__PURE__*/React__namespace.forwardRef(function DialogPopu
389
236
  if (process.env.NODE_ENV !== "production") DialogPopup.displayName = "DialogPopup";
390
237
 
391
238
  /**
392
- * Groups all parts of the dialog.
393
- * Doesn't render its own HTML element.
394
- *
395
- * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
239
+ * A handle to control a Dialog imperatively and to associate detached triggers with it.
396
240
  */
397
- function DialogRoot(props) {
398
- return ScrollAreaViewport.useRenderDialogRoot('dialog', props);
399
- }
241
+ class DialogHandle {
242
+ /**
243
+ * Internal store holding the dialog state.
244
+ * @internal
245
+ */
400
246
 
401
- /**
402
- * Controls a Dialog imperatively and associates detached `Dialog.Trigger` components with a
403
- * `Dialog.Root`. Create one with `Dialog.createHandle()` and pass it to the `handle` prop of the
404
- * root and of any triggers rendered outside of it.
405
- *
406
- * The imperative methods take effect only while a root using this handle is mounted; calls made
407
- * before a root attaches (or after it unmounts) are ignored.
408
- */
409
- class DialogHandle extends BasePopupHandle {
410
- constructor() {
411
- super(ScrollAreaViewport.createNullDialogStore(), 'Dialog', false);
247
+ constructor(store) {
248
+ this.store = store ?? new ScrollAreaViewport.DialogStore();
412
249
  }
413
250
 
414
251
  /**
415
- * Opens the dialog, optionally associating it with a trigger.
252
+ * Opens the dialog and associates it with the trigger with the given id.
253
+ * The trigger, if provided, must be a matching Trigger component with this handle passed as a prop.
416
254
  *
417
255
  * This method should only be called in an event handler or an effect (not during rendering).
418
256
  *
419
- * @param triggerId ID of the trigger to associate with the dialog. The trigger must be a matching
420
- * `Dialog.Trigger` with this handle passed as a prop. Pass `null` to open without associating any trigger.
257
+ * @param triggerId ID of the trigger to associate with the dialog. If null, the dialog will open without a trigger association.
421
258
  */
422
259
  open(triggerId) {
423
- this.openByTrigger(triggerId);
260
+ const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : undefined;
261
+ if (process.env.NODE_ENV !== 'production') {
262
+ if (triggerId && !triggerElement) {
263
+ console.warn(`Base UI: DialogHandle.open: No trigger found with id "${triggerId}". The dialog will open, but the trigger will not be associated with the dialog.`);
264
+ }
265
+ }
266
+ this.store.setOpen(true, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction, undefined, triggerElement));
424
267
  }
425
268
 
426
269
  /**
427
- * Opens the dialog with the given payload, without associating it with any trigger.
428
- *
429
- * This method should only be called in an event handler or an effect (not during rendering).
270
+ * Opens the dialog and sets the payload.
271
+ * Does not associate the dialog with any trigger.
430
272
  *
431
- * @param payload Payload to set when opening the dialog. It is exposed to the root's render-prop children.
273
+ * @param payload Payload to set when opening the dialog.
432
274
  */
433
275
  openWithPayload(payload) {
434
- const attachedStore = this.attachedStore;
435
- if (attachedStore === null) {
436
- if (process.env.NODE_ENV !== 'production') {
437
- console.warn('Base UI: DialogHandle.openWithPayload() was called while no root using this handle is mounted. ' + 'The call and its payload were ignored; mount a root with this handle before opening it imperatively.');
438
- }
439
- return;
440
- }
441
- attachedStore.set('payload', payload);
442
- attachedStore.setOpen(true, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction));
276
+ this.store.set('payload', payload);
277
+ this.store.setOpen(true, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction, undefined, undefined));
443
278
  }
444
279
 
445
280
  /**
446
281
  * Closes the dialog.
447
- *
448
- * This method should only be called in an event handler or an effect (not during rendering).
449
282
  */
450
283
  close() {
451
- this.closePopup();
284
+ this.store.setOpen(false, useScrollLock.createChangeEventDetails(useScrollLock.imperativeAction, undefined, undefined));
452
285
  }
453
286
 
454
287
  /**
455
- * Whether the dialog is currently open. Returns `false` while no root is attached to the handle.
288
+ * Indicates whether the dialog is currently open.
456
289
  */
457
290
  get isOpen() {
458
- return this.attachedStore?.select('open') ?? false;
291
+ return this.store.select('open');
459
292
  }
460
293
  }
461
294
 
@@ -474,11 +307,9 @@ function createDialogHandle() {
474
307
  */
475
308
  const DrawerDescription = DialogDescription;
476
309
 
477
- exports.BasePopupHandle = BasePopupHandle;
478
310
  exports.DialogBackdrop = DialogBackdrop;
479
311
  exports.DialogDescription = DialogDescription;
480
312
  exports.DialogHandle = DialogHandle;
481
313
  exports.DialogPopup = DialogPopup;
482
- exports.DialogRoot = DialogRoot;
483
314
  exports.DrawerDescription = DrawerDescription;
484
315
  exports.createDialogHandle = createDialogHandle;