@astryxdesign/core 0.4.7-canary.ad3eb9b → 0.4.7-canary.d334c4a

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 (157) hide show
  1. package/dist/AspectRatio/AspectRatio.d.ts +24 -0
  2. package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
  3. package/dist/AspectRatio/AspectRatio.js +23 -4
  4. package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
  5. package/dist/Breadcrumbs/BreadcrumbItem.js +5 -5
  6. package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  7. package/dist/ButtonGroup/ButtonGroup.js +9 -1
  8. package/dist/Calendar/Calendar.d.ts +3 -1
  9. package/dist/Calendar/Calendar.d.ts.map +1 -1
  10. package/dist/Calendar/Calendar.js +13 -14
  11. package/dist/Calendar/getInitialFocusDate.d.ts +46 -0
  12. package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -0
  13. package/dist/Calendar/getInitialFocusDate.js +62 -0
  14. package/dist/Chat/ChatMessageList.d.ts +22 -3
  15. package/dist/Chat/ChatMessageList.d.ts.map +1 -1
  16. package/dist/Chat/ChatMessageList.js +6 -3
  17. package/dist/Dialog/Dialog.d.ts.map +1 -1
  18. package/dist/Dialog/Dialog.js +37 -33
  19. package/dist/Heading/Heading.d.ts.map +1 -1
  20. package/dist/Heading/Heading.js +6 -2
  21. package/dist/HoverCard/HoverCard.d.ts +6 -0
  22. package/dist/HoverCard/HoverCard.d.ts.map +1 -1
  23. package/dist/HoverCard/useHoverCard.d.ts +5 -0
  24. package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
  25. package/dist/HoverCard/useHoverCard.js +67 -25
  26. package/dist/Layer/LayerDepthContext.d.ts +52 -0
  27. package/dist/Layer/LayerDepthContext.d.ts.map +1 -0
  28. package/dist/Layer/LayerDepthContext.js +66 -0
  29. package/dist/Layer/index.d.ts +3 -0
  30. package/dist/Layer/index.d.ts.map +1 -1
  31. package/dist/Layer/index.js +4 -0
  32. package/dist/Layer/layerStack.d.ts +98 -0
  33. package/dist/Layer/layerStack.d.ts.map +1 -0
  34. package/dist/Layer/layerStack.js +306 -0
  35. package/dist/Layer/useLayerDismissal.d.ts +93 -0
  36. package/dist/Layer/useLayerDismissal.d.ts.map +1 -0
  37. package/dist/Layer/useLayerDismissal.js +91 -0
  38. package/dist/Lightbox/Lightbox.d.ts +1 -0
  39. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  40. package/dist/Lightbox/Lightbox.js +99 -78
  41. package/dist/MobileNav/MobileNav.d.ts +6 -1
  42. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  43. package/dist/MobileNav/MobileNav.js +58 -33
  44. package/dist/MultiSelector/MultiSelector.d.ts +15 -1
  45. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  46. package/dist/MultiSelector/MultiSelector.js +11 -6
  47. package/dist/MultiSelector/index.d.ts +1 -1
  48. package/dist/MultiSelector/index.d.ts.map +1 -1
  49. package/dist/Popover/usePopover.d.ts.map +1 -1
  50. package/dist/Popover/usePopover.js +20 -17
  51. package/dist/Table/plugins/pagination/useTablePagination.d.ts +3 -0
  52. package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
  53. package/dist/Table/plugins/pagination/useTablePagination.js +21 -4
  54. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  55. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
  56. package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
  57. package/dist/Table/plugins/rowStatus/useTableRowStatus.js +10 -3
  58. package/dist/Text/Text.d.ts.map +1 -1
  59. package/dist/Text/Text.js +6 -2
  60. package/dist/Tooltip/Tooltip.d.ts +5 -0
  61. package/dist/Tooltip/Tooltip.d.ts.map +1 -1
  62. package/dist/Tooltip/useTooltip.d.ts +5 -0
  63. package/dist/Tooltip/useTooltip.d.ts.map +1 -1
  64. package/dist/Tooltip/useTooltip.js +39 -24
  65. package/dist/astryx.css +2 -0
  66. package/dist/hooks/index.d.ts +1 -0
  67. package/dist/hooks/index.d.ts.map +1 -1
  68. package/dist/hooks/index.js +1 -0
  69. package/dist/hooks/useFocusTrap.d.ts +7 -4
  70. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  71. package/dist/hooks/useFocusTrap.js +52 -91
  72. package/dist/hooks/useMergedRefs.d.ts +18 -0
  73. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  74. package/dist/hooks/useMergedRefs.js +25 -0
  75. package/dist/utils/timeParser.d.ts +1 -1
  76. package/dist/utils/timeParser.d.ts.map +1 -1
  77. package/dist/utils/timeParser.js +26 -12
  78. package/locales/en.json +17 -1
  79. package/locales/pseudo.json +12 -0
  80. package/package.json +2 -2
  81. package/src/AspectRatio/AspectRatio.doc.mjs +6 -3
  82. package/src/AspectRatio/AspectRatio.test.tsx +57 -10
  83. package/src/AspectRatio/AspectRatio.tsx +40 -1
  84. package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -1
  85. package/src/Button/Button.doc.mjs +22 -0
  86. package/src/ButtonGroup/ButtonGroup.doc.mjs +7 -1
  87. package/src/ButtonGroup/ButtonGroup.test.tsx +185 -1
  88. package/src/ButtonGroup/ButtonGroup.tsx +8 -1
  89. package/src/Calendar/Calendar.doc.mjs +4 -3
  90. package/src/Calendar/Calendar.test.tsx +52 -0
  91. package/src/Calendar/Calendar.tsx +18 -15
  92. package/src/Calendar/getInitialFocusDate.test.ts +94 -0
  93. package/src/Calendar/getInitialFocusDate.ts +93 -0
  94. package/src/Chat/ChatMessageList.doc.mjs +9 -1
  95. package/src/Chat/ChatMessageList.test.tsx +46 -0
  96. package/src/Chat/ChatMessageList.tsx +28 -4
  97. package/src/CodeBlock/CodeBlock.doc.mjs +6 -0
  98. package/src/ContextMenu/ContextMenu.doc.mjs +5 -0
  99. package/src/Dialog/Dialog.doc.mjs +5 -0
  100. package/src/Dialog/Dialog.test.tsx +190 -1
  101. package/src/Dialog/Dialog.tsx +32 -36
  102. package/src/DropdownMenu/DropdownMenu.doc.mjs +6 -0
  103. package/src/Field/Field.doc.mjs +11 -0
  104. package/src/Heading/Heading.test.tsx +23 -1
  105. package/src/Heading/Heading.tsx +6 -2
  106. package/src/HoverCard/HoverCard.doc.mjs +5 -0
  107. package/src/HoverCard/HoverCard.tsx +6 -0
  108. package/src/HoverCard/useHoverCard.tsx +81 -30
  109. package/src/Layer/LayerDepthContext.tsx +62 -0
  110. package/src/Layer/index.ts +9 -0
  111. package/src/Layer/layerDismissalFamilies.test.tsx +359 -0
  112. package/src/Layer/layerDismissalInvariants.test.tsx +417 -0
  113. package/src/Layer/layerStack.ts +362 -0
  114. package/src/Layer/useLayerDismissal.test.tsx +469 -0
  115. package/src/Layer/useLayerDismissal.ts +173 -0
  116. package/src/Layout/Layout.doc.mjs +2 -2
  117. package/src/Lightbox/Lightbox.doc.mjs +12 -0
  118. package/src/Lightbox/Lightbox.tsx +120 -100
  119. package/src/Link/Link.doc.mjs +39 -0
  120. package/src/MobileNav/MobileNav.tsx +59 -34
  121. package/src/MoreMenu/MoreMenu.doc.mjs +7 -1
  122. package/src/MultiSelector/MultiSelector.doc.mjs +27 -0
  123. package/src/MultiSelector/MultiSelector.test.tsx +84 -0
  124. package/src/MultiSelector/MultiSelector.tsx +40 -5
  125. package/src/MultiSelector/index.ts +1 -0
  126. package/src/NumberInput/NumberInput.doc.mjs +5 -0
  127. package/src/Popover/usePopover.tsx +31 -28
  128. package/src/PowerSearch/PowerSearch.doc.mjs +26 -0
  129. package/src/Selector/Selector.doc.mjs +11 -0
  130. package/src/Table/plugins/pagination/useTablePagination.test.tsx +34 -4
  131. package/src/Table/plugins/pagination/useTablePagination.tsx +35 -3
  132. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -2
  133. package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +13 -7
  134. package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +12 -3
  135. package/src/Table/useTablePagination.doc.mjs +7 -0
  136. package/src/Table/useTableRowStatus.doc.mjs +1 -1
  137. package/src/Text/Text.test.tsx +23 -1
  138. package/src/Text/Text.tsx +6 -2
  139. package/src/TextInput/TextInput.doc.mjs +10 -0
  140. package/src/Toast/Toast.doc.mjs +6 -0
  141. package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
  142. package/src/Toolbar/Toolbar.doc.mjs +5 -0
  143. package/src/Tooltip/Tooltip.doc.mjs +5 -0
  144. package/src/Tooltip/Tooltip.test.tsx +32 -0
  145. package/src/Tooltip/Tooltip.tsx +5 -0
  146. package/src/Tooltip/useTooltip.tsx +47 -24
  147. package/src/Typeahead/Typeahead.doc.mjs +5 -0
  148. package/src/__tests__/complexComponentContract.test.tsx +81 -0
  149. package/src/hooks/index.ts +2 -0
  150. package/src/hooks/useFocusTrap.ts +54 -107
  151. package/src/hooks/useFocusTrapEscapeShim.test.tsx +165 -0
  152. package/src/hooks/useMergedRefs.doc.mjs +79 -0
  153. package/src/hooks/useMergedRefs.test.tsx +62 -0
  154. package/src/hooks/useMergedRefs.ts +36 -0
  155. package/src/utils/timeParser.test.ts +6 -1
  156. package/src/utils/timeParser.ts +35 -13
  157. package/src/__tests__/inputWidthContract.test.tsx +0 -69
@@ -34,6 +34,25 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
34
34
  ref?: React.Ref<HTMLDivElement>;
35
35
  /**
36
36
  * The aspect ratio as width/height (e.g., 16/9 = 1.777..., 4/3 = 1.333..., 1 for square).
37
+ *
38
+ * The ratio is emitted as a class-level declaration — never an inline
39
+ * style — so it can be made responsive:
40
+ * - StyleX consumers pass an `aspect-ratio` rule via `xstyle`, including
41
+ * under `@media`/`@container` conditions.
42
+ * - Plain-CSS/Tailwind consumers override `aspect-ratio` from their own
43
+ * (unlayered) rules: the compiled component styles live in the
44
+ * `astryx-base` cascade layer, and unlayered CSS wins over layered
45
+ * rules regardless of specificity.
46
+ *
47
+ * @example
48
+ * ```
49
+ * // 3:1 hero that becomes 3:2 when its container stacks
50
+ * <AspectRatio ratio={3 / 1} className="gallery-hero">…</AspectRatio>
51
+ *
52
+ * // CSS: @container gallery (max-width: 720px) {
53
+ * // .gallery-hero { aspect-ratio: 3 / 2; }
54
+ * // }
55
+ * ```
37
56
  */
38
57
  ratio: number;
39
58
  /**
@@ -102,6 +121,11 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
102
121
  * `ratio={1}` or an oval at other ratios. Both shapes respect the provided
103
122
  * `ratio`.
104
123
  *
124
+ * The ratio is a class-level declaration (not an inline style), so it can be
125
+ * overridden responsively — via `xstyle` for StyleX consumers, or with a
126
+ * plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
127
+ * styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
128
+ *
105
129
  * Sizing: the box takes its width from its container and derives its height
106
130
  * from the ratio, so it needs an ancestor with a definite width. Two
107
131
  * consequences are worth knowing. Constraining only the height (`height` or
@@ -1 +1 @@
1
- {"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../src/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EA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AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAmB,EACnB,GAAG,EACH,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,+BA4BlB;yBAtCe,WAAW"}
@@ -49,6 +49,23 @@ const styles = {
49
49
  }
50
50
  };
51
51
 
52
+ // The ratio compiles to a CSS variable + a class-level declaration
53
+ // (aspect-ratio: var(--x)) instead of a raw inline style, so consumer
54
+ // overrides — `xstyle` rules, including ones inside @media/@container
55
+ // queries — can still win. A raw inline `aspect-ratio` would beat any class
56
+ // (same rationale as Grid's dynamic track values). Non-StyleX consumers
57
+ // don't need a dedicated hook: the compiled declaration sits in the
58
+ // `astryx-base` cascade layer, so any unlayered consumer rule wins
59
+ // regardless of specificity.
60
+ const dynamicStyles = {
61
+ ratio: ratio => [{
62
+ kOBAk4: ratio != null ? "x10y9f9r" : ratio,
63
+ $$css: true
64
+ }, {
65
+ "--x-aspectRatio": ratio != null ? ratio : undefined
66
+ }]
67
+ };
68
+
52
69
  /**
53
70
  * AspectRatio component for maintaining a specific aspect ratio for its children.
54
71
  *
@@ -64,6 +81,11 @@ const styles = {
64
81
  * `ratio={1}` or an oval at other ratios. Both shapes respect the provided
65
82
  * `ratio`.
66
83
  *
84
+ * The ratio is a class-level declaration (not an inline style), so it can be
85
+ * overridden responsively — via `xstyle` for StyleX consumers, or with a
86
+ * plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
87
+ * styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
88
+ *
67
89
  * Sizing: the box takes its width from its container and derives its height
68
90
  * from the ratio, so it needs an ancestor with a definite width. Two
69
91
  * consequences are worth knowing. Constraining only the height (`height` or
@@ -102,10 +124,7 @@ export function AspectRatio({
102
124
  ref: ref,
103
125
  ...mergeProps(themeProps('aspect-ratio', {
104
126
  shape
105
- }), stylex.props(styles.container, shape === 'ellipse' && styles.ellipse, xstyle), className, {
106
- ...style,
107
- aspectRatio: ratio
108
- }),
127
+ }), stylex.props(styles.container, dynamicStyles.ratio(ratio), shape === 'ellipse' && styles.ellipse, xstyle), className, style),
109
128
  ...props,
110
129
  children: /*#__PURE__*/_jsx("div", {
111
130
  "data-astryx-aspect-ratio-override": fit,
@@ -1 +1 @@
1
- {"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAMrE,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,SAAS,CAAC,aAAa,CAAC,EACxB,SAAS,CACV;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;IACxC;;;;OAIG;IACH,QAA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;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAyHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,GAAG,EACH,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EAAE,aAAa,EACxB,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,mBAAmB,qBAoMrB;yBAnNe,cAAc"}
@@ -24,7 +24,7 @@
24
24
  import React, { use, useCallback, useId, useMemo, useRef, useEffect } from 'react';
25
25
  import * as stylex from '@stylexjs/stylex';
26
26
  import "../theme/tokens.stylex.js";
27
- import { colorVars, spacingVars, typeScaleVars, radiusVars } from "../theme/tokens.stylex.js";
27
+ import { colorVars, spacingVars, typeScaleVars, radiusVars, fontWeightVars } from "../theme/tokens.stylex.js";
28
28
  import { BreadcrumbContext } from "./Breadcrumbs.js";
29
29
  import { useLinkComponent } from "../Link/useLinkComponent.js";
30
30
  import { mergeProps, mergeRefs } from "../utils/index.js";
@@ -240,10 +240,10 @@ export function BreadcrumbItem({
240
240
  }) : /*#__PURE__*/_jsx("span", {
241
241
  ...{
242
242
  0: {
243
- className: "x78zum5 x6s0dn4 xzye2dw x1pd3egz x1tgivj0"
243
+ className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
244
244
  },
245
245
  1: {
246
- className: "x78zum5 x6s0dn4 xzye2dw x1pd3egz xv1l7n4"
246
+ className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
247
247
  }
248
248
  }[!!isSupporting << 0],
249
249
  "aria-current": "page",
@@ -290,10 +290,10 @@ export function BreadcrumbItem({
290
290
  ref: contentRef,
291
291
  ...{
292
292
  0: {
293
- className: "x78zum5 x6s0dn4 xzye2dw x1pd3egz x1tgivj0"
293
+ className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
294
294
  },
295
295
  1: {
296
- className: "x78zum5 x6s0dn4 xzye2dw x1pd3egz xv1l7n4"
296
+ className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
297
297
  }
298
298
  }[!!isSupporting << 0],
299
299
  children: content
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AAOjE,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAErC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAwCD;;;;;;;;;;;;;;;;;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H,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,WAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,UAAkB,EAClB,SAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CA+C9B;yBA7De,WAAW"}
@@ -131,6 +131,13 @@ export function ButtonGroup({
131
131
  handleKeyDown
132
132
  } = useListFocus({
133
133
  itemSelector: 'button, [tabindex="0"]',
134
+ // A member's layer renders inline inside the group (useLayer does not
135
+ // portal it), so a key pressed in an open DropdownMenu bubbles here. The
136
+ // boundary is the group's own root or any layer, whichever is nearer to
137
+ // the target. Naming the group's own root is what keeps a group rendered
138
+ // inside a Popover or Toast working: bailing on any [popover] ancestor
139
+ // instead would swallow every arrow key it owns.
140
+ boundarySelector: '[role="group"], [popover]',
134
141
  orientation
135
142
  });
136
143
  const contextValue = useMemo(() => ({
@@ -146,7 +153,8 @@ export function ButtonGroup({
146
153
  ...props,
147
154
  ...mergeProps(themeProps('button-group', {
148
155
  size,
149
- orientation
156
+ orientation,
157
+ elevation
150
158
  }), stylex.props(styles.group, orientation === 'vertical' && styles.vertical, elevationStyles[elevation], xstyle), className, style),
151
159
  role: "group",
152
160
  "aria-label": label,
@@ -41,7 +41,9 @@ interface CalendarBaseProps extends Omit<BaseProps<HTMLDivElement>, 'onChange' |
41
41
  minRangeSpan?: number;
42
42
  /**
43
43
  * Controlled focus date (which month is visible).
44
- * If not provided, defaults to selected date or today.
44
+ * If not provided, defaults to the selected date, else today clamped into
45
+ * the `min`/`max` window (so a window that excludes today opens on the
46
+ * bound nearest to it, not on an all-disabled month).
45
47
  */
46
48
  focusDate?: ISODateString;
47
49
  /** Callback when visible month changes via navigation */
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mapp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,CAAC,EAAE,aAAa,CAAC;IAE7B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;CAC9D;AAED,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD,qBAAqB;IACrB,IAAI,EAAE,OAAO,CAAC;IAEd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAMrE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EAAC,GAAG,EAAE,GAAG,KAAK,EAAC,EAAE,aAAa,+BAsXtD;yBAtXe,QAAQ"}
@@ -11,6 +11,7 @@
11
11
  *
12
12
  * SYNC: When modified, update these files to stay in sync:
13
13
  * - /packages/core/src/Calendar/Calendar.doc.mjs (props table, features, implementation notes)
14
+ * - /packages/core/src/Calendar/getInitialFocusDate.ts (which month the calendar opens on)
14
15
  * - /packages/core/src/Calendar/Calendar.test.tsx (tests for new/changed behavior)
15
16
  * - /packages/core/src/Calendar/index.ts (exports if types change)
16
17
  * - /apps/storybook/stories/Calendar.stories.tsx (storybook stories)
@@ -26,6 +27,7 @@ import { calendarStyles, monthGridStyles, dayCellStyles, dayCellTheme } from "./
26
27
  import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
27
28
  import { mergeProps, composeEventHandlers, rtlStyles } from "../utils/index.js";
28
29
  import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
30
+ import { getInitialFocusDate } from "./getInitialFocusDate.js";
29
31
  import { computeDayCellState, computeRangeRounding, computePreviewRounding, computeDayNeighborContinuity, isEndpoint } from "./dayCellUtils.js";
30
32
 
31
33
  // =============================================================================
@@ -114,20 +116,17 @@ export function Calendar({
114
116
  // Determine effective value
115
117
  const effectiveValue = value !== undefined ? value : internalValue;
116
118
 
117
- // Focus date state (which month is visible)
118
- const [internalFocusDate, setInternalFocusDate] = useState(() => {
119
- if (focusDateProp) {
120
- return plainDateFromISO(focusDateProp);
121
- }
122
- if (effectiveValue) {
123
- if (typeof effectiveValue === 'string') {
124
- return plainDateFromISO(effectiveValue);
125
- } else {
126
- return plainDateFromISO(effectiveValue.start);
127
- }
128
- }
129
- return plainDateToday();
130
- });
119
+ // Focus date state (which month is visible). Falls back to today, clamped
120
+ // into the min/max window so a window that doesn't contain today doesn't
121
+ // open on an all-disabled month.
122
+ const [internalFocusDate, setInternalFocusDate] = useState(() => getInitialFocusDate({
123
+ focusDate: focusDateProp,
124
+ value: effectiveValue,
125
+ min,
126
+ max,
127
+ numberOfMonths,
128
+ today
129
+ }));
131
130
 
132
131
  // Use controlled focusDate if callback is provided, otherwise use internal state
133
132
  const isControlledFocus = focusDateProp !== undefined && onFocusDateChange !== undefined;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @file getInitialFocusDate.ts
3
+ * @input PlainDate utilities, min/max bounds, today
4
+ * @output Exports getInitialFocusDate — the month Calendar opens on
5
+ * @position Calendar-specific helper; used by Calendar.tsx
6
+ *
7
+ * SYNC: When modified, update:
8
+ * - /packages/core/src/Calendar/getInitialFocusDate.test.ts
9
+ * - /packages/core/src/Calendar/Calendar.tsx (the only caller)
10
+ */
11
+ import type { ISODateString, DateRange } from '../utils/dateTypes';
12
+ import { type PlainDate } from '../utils/plainDate';
13
+ export interface InitialFocusDateOptions {
14
+ /** Controlled visible month, if the consumer supplied one. */
15
+ focusDate?: ISODateString;
16
+ /** Selected value (single date or range), controlled or uncontrolled. */
17
+ value?: ISODateString | DateRange;
18
+ /** Earliest selectable date. */
19
+ min?: ISODateString;
20
+ /** Latest selectable date. */
21
+ max?: ISODateString;
22
+ /** How many month panes the calendar renders (1 or 2). */
23
+ numberOfMonths: number;
24
+ /** Today, injected so the caller keeps a single memoized source of "now". */
25
+ today: PlainDate;
26
+ }
27
+ /**
28
+ * Picks the date whose month the calendar opens on.
29
+ *
30
+ * An explicit `focusDate` wins, then the selected value — both are the
31
+ * consumer's own instruction about where to look, so neither is second-guessed
32
+ * against `min`/`max`.
33
+ *
34
+ * Otherwise the calendar opens on today, clamped into the `min`/`max` window.
35
+ * Without the clamp a window that doesn't contain today (a 2019 audit range, a
36
+ * booking window opening next spring) opened on today's month with every day
37
+ * disabled, leaving prev/next clicking as the only way in.
38
+ *
39
+ * When clamping forward to `min`, that month leads: the whole selectable window
40
+ * runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
41
+ * month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
42
+ * spend half the calendar on a month that is entirely out of bounds. That
43
+ * shift never crosses `min`'s month.
44
+ */
45
+ export declare function getInitialFocusDate(options: InitialFocusDateOptions): PlainDate;
46
+ //# sourceMappingURL=getInitialFocusDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getInitialFocusDate.d.ts","sourceRoot":"","sources":["../../src/Calendar/getInitialFocusDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,yEAAyE;IACzE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,uBAAuB,GAC/B,SAAS,CAkCX"}
@@ -0,0 +1,62 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file getInitialFocusDate.ts
5
+ * @input PlainDate utilities, min/max bounds, today
6
+ * @output Exports getInitialFocusDate — the month Calendar opens on
7
+ * @position Calendar-specific helper; used by Calendar.tsx
8
+ *
9
+ * SYNC: When modified, update:
10
+ * - /packages/core/src/Calendar/getInitialFocusDate.test.ts
11
+ * - /packages/core/src/Calendar/Calendar.tsx (the only caller)
12
+ */
13
+
14
+ import { plainDateFromISO, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateIsBefore, plainDateIsAfter } from "../utils/plainDate.js";
15
+ /**
16
+ * Picks the date whose month the calendar opens on.
17
+ *
18
+ * An explicit `focusDate` wins, then the selected value — both are the
19
+ * consumer's own instruction about where to look, so neither is second-guessed
20
+ * against `min`/`max`.
21
+ *
22
+ * Otherwise the calendar opens on today, clamped into the `min`/`max` window.
23
+ * Without the clamp a window that doesn't contain today (a 2019 audit range, a
24
+ * booking window opening next spring) opened on today's month with every day
25
+ * disabled, leaving prev/next clicking as the only way in.
26
+ *
27
+ * When clamping forward to `min`, that month leads: the whole selectable window
28
+ * runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
29
+ * month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
30
+ * spend half the calendar on a month that is entirely out of bounds. That
31
+ * shift never crosses `min`'s month.
32
+ */
33
+ export function getInitialFocusDate(options) {
34
+ const {
35
+ focusDate,
36
+ value,
37
+ min,
38
+ max,
39
+ numberOfMonths,
40
+ today
41
+ } = options;
42
+ if (focusDate) {
43
+ return plainDateFromISO(focusDate);
44
+ }
45
+ if (value) {
46
+ return plainDateFromISO(typeof value === 'string' ? value : value.start);
47
+ }
48
+ const minDate = min ? plainDateFromISO(min) : null;
49
+ const maxDate = max ? plainDateFromISO(max) : null;
50
+ if (minDate && plainDateIsBefore(today, minDate)) {
51
+ return minDate;
52
+ }
53
+ if (maxDate && plainDateIsAfter(today, maxDate)) {
54
+ const lastPaneOffset = Math.max(0, numberOfMonths - 1);
55
+ const shifted = plainDateAddMonths(plainDateSetFirstOfMonth(maxDate), -lastPaneOffset);
56
+ if (minDate && plainDateIsBefore(shifted, plainDateSetFirstOfMonth(minDate))) {
57
+ return minDate;
58
+ }
59
+ return shifted;
60
+ }
61
+ return today;
62
+ }
@@ -6,7 +6,8 @@
6
6
  *
7
7
  * Renders a container with role="log" for chat message histories.
8
8
  * Handles density context, configurable gap, empty state,
9
- * a spacer that pushes messages to the bottom, and an infinite scroll sentinel.
9
+ * a configurable spacer (align) that pushes messages to the bottom,
10
+ * and an infinite scroll sentinel.
10
11
  *
11
12
  * Auto-scroll and the scroll-to-bottom button are owned by
12
13
  * ChatLayout. When used standalone (without a layout), the list
@@ -52,6 +53,23 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
52
53
  * be grouped) and row spacing should be tuned separately from density.
53
54
  */
54
55
  gap?: SpacingStep;
56
+ /**
57
+ * Vertical alignment of messages when the list is shorter than its
58
+ * container.
59
+ *
60
+ * - `'bottom'` (default): a spacer fills the free space and pushes
61
+ * messages to the bottom, so a short conversation sits just above the
62
+ * composer — the familiar messaging-app layout.
63
+ * - `'top'`: the spacer is omitted, so messages start at the top and grow
64
+ * downward — better for document-style or log-style lists.
65
+ *
66
+ * This only changes the resting position of a non-full list. Once messages
67
+ * overflow the container the spacer collapses to zero in both modes, so
68
+ * ChatLayout auto-scroll-to-bottom behavior is identical either way.
69
+ *
70
+ * @default 'bottom'
71
+ */
72
+ align?: 'top' | 'bottom';
55
73
  /**
56
74
  * Whether an assistant message is actively streaming into the list.
57
75
  *
@@ -71,7 +89,8 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
71
89
  *
72
90
  * Renders messages in a flex column with density-based spacing.
73
91
  * Override gap to tune row spacing separately from density.
74
- * A spacer pushes content to the bottom when the list isn't full.
92
+ * By default a spacer pushes content to the bottom when the list isn't full;
93
+ * set `align='top'` to start messages at the top instead.
75
94
  * Supports loading older messages via `scrollToTopAction`.
76
95
  *
77
96
  * Auto-scroll and the scroll-to-bottom button are owned by
@@ -86,7 +105,7 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
86
105
  * </ChatMessageList>
87
106
  * ```
88
107
  */
89
- export declare function ChatMessageList({ children, emptyState, scrollToTopAction, density, gap, isStreaming, xstyle, className, style, 'data-testid': testId, ref, ...rest }: ChatMessageListProps): import("react").JSX.Element;
108
+ export declare function ChatMessageList({ children, emptyState, scrollToTopAction, density, gap, align, isStreaming, xstyle, className, style, 'data-testid': testId, ref, ...rest }: ChatMessageListProps): import("react").JSX.Element;
90
109
  export declare namespace ChatMessageList {
91
110
  var displayName: string;
92
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageList.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAC;AAGhF,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC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;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4FD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,OAAoB,EACpB,GAAG,EACH,KAAgB,EAChB,WAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,oBAAoB,+BAgGtB;yBA9Ge,eAAe"}
@@ -10,7 +10,8 @@
10
10
  *
11
11
  * Renders a container with role="log" for chat message histories.
12
12
  * Handles density context, configurable gap, empty state,
13
- * a spacer that pushes messages to the bottom, and an infinite scroll sentinel.
13
+ * a configurable spacer (align) that pushes messages to the bottom,
14
+ * and an infinite scroll sentinel.
14
15
  *
15
16
  * Auto-scroll and the scroll-to-bottom button are owned by
16
17
  * ChatLayout. When used standalone (without a layout), the list
@@ -124,7 +125,8 @@ const gapStyles = {
124
125
  *
125
126
  * Renders messages in a flex column with density-based spacing.
126
127
  * Override gap to tune row spacing separately from density.
127
- * A spacer pushes content to the bottom when the list isn't full.
128
+ * By default a spacer pushes content to the bottom when the list isn't full;
129
+ * set `align='top'` to start messages at the top instead.
128
130
  * Supports loading older messages via `scrollToTopAction`.
129
131
  *
130
132
  * Auto-scroll and the scroll-to-bottom button are owned by
@@ -145,6 +147,7 @@ export function ChatMessageList({
145
147
  scrollToTopAction,
146
148
  density = 'balanced',
147
149
  gap,
150
+ align = 'bottom',
148
151
  isStreaming = false,
149
152
  xstyle,
150
153
  className,
@@ -217,7 +220,7 @@ export function ChatMessageList({
217
220
  children: /*#__PURE__*/_jsx(Spinner, {
218
221
  size: "md"
219
222
  })
220
- }), /*#__PURE__*/_jsx("div", {
223
+ }), align === 'bottom' && /*#__PURE__*/_jsx("div", {
221
224
  ...{
222
225
  className: "x98rzlu x2lwn1j"
223
226
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAuB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAsB9C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzD,4EAA4E;AAC5E,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,mBAAmB;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AA8JD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc;;;;;EAUpE;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM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AAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,QAAgB,EAChB,YAAY,EACZ,KAAW,EACX,SAAmB,EACnB,QAAQ,EACR,OAAoB,EACpB,OAAgB,EAChB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCA+Sb;yBA/Te,MAAM"}
@@ -24,8 +24,8 @@
24
24
  import { useCallback, useEffect, useId, useMemo, useRef } from 'react';
25
25
  import * as stylex from '@stylexjs/stylex';
26
26
  import { useScrollLock } from "../hooks/useScrollLock.js";
27
- import { hasActiveFocusTrapEscape } from "../hooks/useFocusTrap.js";
28
- import { isImeKeyEvent } from "../utils/ime.js";
27
+ import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
28
+ import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
29
29
  import "../theme/tokens.stylex.js";
30
30
  import { colorVars, radiusVars, durationVars, easeVars, shadowVars, spacingVars } from "../theme/tokens.stylex.js";
31
31
  import { container } from "../Layout/container.stylex.js";
@@ -366,32 +366,26 @@ export function Dialog({
366
366
  // Skip for inline rendering — no modal overlay to compensate for.
367
367
  useScrollLock(isOpen && !isInline);
368
368
 
369
- // Handle Escape key — skip for inline rendering
370
- useEffect(() => {
371
- if (isInline) {
372
- return;
373
- }
374
- const dialog = dialogRef.current;
375
- if (!dialog || !isOpen) {
376
- return;
369
+ // Join the shared layer dismissal stack. The stack owns the Escape listener
370
+ // and routes each press to the top-most layer, so this dialog does not listen
371
+ // itself — that is what stops a modal opened from inside another modal (or a
372
+ // popover opened inside this one) from closing two layers on one press.
373
+ //
374
+ // A `required` dialog registers as `block`: it must not be dismissed, and the
375
+ // press must not fall through and dismiss a layer behind it either.
376
+ //
377
+ // Inline mode opts out — it renders dialog content in normal flow, with
378
+ // nothing layered over anything.
379
+ const {
380
+ shouldDismissOnCloseRequest
381
+ } = useLayerDismissal({
382
+ isActive: isOpen,
383
+ isEnabled: !isInline,
384
+ escapeBehavior: allowEscape ? 'close' : 'block',
385
+ onDismiss: () => {
386
+ onOpenChange(false);
377
387
  }
378
- const handleKeyDown = event => {
379
- if (event.key === 'Escape') {
380
- // Ignore IME composition-cancel, and defer to any popover/menu layered
381
- // on top of this dialog so a single Escape closes only the top-most
382
- // layer (the popover's own focus trap handles it and stops propagation).
383
- if (isImeKeyEvent(event) || hasActiveFocusTrapEscape()) {
384
- return;
385
- }
386
- event.preventDefault();
387
- if (allowEscape) {
388
- onOpenChange(false);
389
- }
390
- }
391
- };
392
- dialog.addEventListener('keydown', handleKeyDown);
393
- return () => dialog.removeEventListener('keydown', handleKeyDown);
394
- }, [isOpen, isInline, allowEscape, onOpenChange]);
388
+ });
395
389
 
396
390
  // Dev-time guardrail: an open modal should always have an accessible name.
397
391
  // The header-title check reads the DOM, so this stays in an effect; the ref
@@ -416,12 +410,18 @@ export function Dialog({
416
410
  }
417
411
  };
418
412
 
419
- // Handle native cancel event (browser Escape handling)
413
+ // The native `cancel` event is the browser's own close-watcher firing: an
414
+ // Android back gesture, or a close request the stack never saw a press for.
415
+ // Escape presses the stack owns never arrive here — it preventDefault()s
416
+ // those, which suppresses the close watcher.
417
+ //
418
+ // Always preventDefault so the browser cannot close a controlled <dialog>
419
+ // behind React's back, then answer the request with the stack's own rules:
420
+ // only the top-most layer dismisses, a `required` dialog swallows it, and
421
+ // nothing dismisses while an IME composition is in progress.
420
422
  const handleCancel = event => {
421
423
  event.preventDefault();
422
- // Defer to a popover/menu layered on top of this dialog; it will dismiss
423
- // itself on the same Escape press.
424
- if (hasActiveFocusTrapEscape()) {
424
+ if (!shouldDismissOnCloseRequest()) {
425
425
  return;
426
426
  }
427
427
  if (allowEscape) {
@@ -463,7 +463,9 @@ export function Dialog({
463
463
  variant
464
464
  }), stylex.props(styles.inlineWrapper, overlayPaddingReset.reset, standardSizing && dynamicStyles.sizing(standardSizing.width, standardSizing.maxWidth, standardSizing.maxHeight), isFullscreen && styles.fullscreen, xstyle), className, style),
465
465
  "data-testid": props['data-testid'],
466
- children: innerContent
466
+ children: /*#__PURE__*/_jsx(LayerDepthProvider, {
467
+ children: innerContent
468
+ })
467
469
  });
468
470
  }
469
471
 
@@ -488,7 +490,9 @@ export function Dialog({
488
490
  ...(purpose === 'required' ? {
489
491
  role: 'alertdialog'
490
492
  } : undefined),
491
- children: innerContent
493
+ children: /*#__PURE__*/_jsx(LayerDepthProvider, {
494
+ children: innerContent
495
+ })
492
496
  });
493
497
  }
494
498
  Dialog.displayName = 'Dialog';
@@ -1 +1 @@
1
- {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../src/Heading/Heading.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAyB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAiBxB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAElE,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,CAAC,kBAAkB,CAAC,EAC7B,UAAU,CACX;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACpC;;;OAGG;IACH,KAAK,EAAE,YAAY,CAAC;IAEpB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IA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ACjB,QAAY,EACZ,kBAAyB,EACzB,SAAS,EACT,QAAQ,EACR,OAAiB,EACjB,UAAkB,EAClB,gBAAwB,EACxB,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,YAAY,+BAsFd;yBAzGe,OAAO"}
@@ -21,7 +21,8 @@ import * as stylex from '@stylexjs/stylex';
21
21
  import { colorStyles, sizeByLevelStyles, sizeByTypeStyles, defaultWeightByTypeStyles, displayStyles, justifyStyles, truncationStyles, wordBreakStyles, textWrapStyles, capsizeStyles, decorationStyles, truncationTooltipStyles } from "../Text/text.stylex.js";
22
22
  import { useTruncation } from "../Text/useTruncation.js";
23
23
  import { resolveStyleColor } from "../Text/Text.js";
24
- import { mergeProps, mergeRefs } from "../utils/index.js";
24
+ import { mergeProps } from "../utils/index.js";
25
+ import { useMergedRefs } from "../hooks/useMergedRefs.js";
25
26
  import { themeProps } from "../utils/themeProps.js";
26
27
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
27
28
  const LazyXDSTooltip = /*#__PURE__*/lazy(async () => import("../Tooltip/Tooltip.js").then(mod => ({
@@ -107,13 +108,16 @@ export function Heading({
107
108
  // Ref for the heading element (used as tooltip anchor)
108
109
  const headingRef = useRef(null);
109
110
 
111
+ // Keep the merged ref stable across rerenders.
112
+ const mergedRef = useMergedRefs(ref, truncation.ref, headingRef);
113
+
110
114
  // Build inline style for -webkit-line-clamp (dynamic value)
111
115
  const inlineStyle = maxLines > 1 ? {
112
116
  WebkitLineClamp: maxLines
113
117
  } : undefined;
114
118
  return /*#__PURE__*/_jsxs(_Fragment, {
115
119
  children: [/*#__PURE__*/_jsx(Component, {
116
- ref: mergeRefs(ref, truncation.ref, headingRef),
120
+ ref: mergedRef,
117
121
  ...mergeProps(themeProps('heading', {
118
122
  level,
119
123
  color,
@@ -97,6 +97,12 @@ export interface HoverCardProps extends Pick<BaseProps, 'xstyle' | 'className' |
97
97
  * - `true`: force-show the hover card (hover/focus hide is suppressed)
98
98
  * - `false`: force-hide the hover card
99
99
  * - `undefined`: uncontrolled — hover/focus triggers manage visibility
100
+ *
101
+ * A controlled hover card still takes Escape when it is the top-most layer,
102
+ * and answers by calling `onOpenChange(false)` without hiding itself —
103
+ * closing is your update's decision, exactly as for a controlled Dialog.
104
+ * Ignore the call and the card stays, and so does the press: nothing
105
+ * underneath dismisses.
100
106
  */
101
107
  isOpen?: boolean;
102
108
  /**