@viasat/beam-react 2.29.1 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/assets/ActionList.css +1 -1
  2. package/assets/Avatar.css +1 -1
  3. package/assets/Badge.css +1 -1
  4. package/assets/Button.css +1 -1
  5. package/assets/Checkbox.css +1 -1
  6. package/assets/Chip.css +1 -1
  7. package/assets/ChipGroup.css +1 -1
  8. package/assets/CloseButton.css +1 -1
  9. package/assets/DateField.css +1 -0
  10. package/assets/EmptyState.css +1 -1
  11. package/assets/{floatingui.css → FloatingUI.css} +1 -1
  12. package/assets/InputChoiceGroup.css +1 -1
  13. package/assets/Link.css +1 -1
  14. package/assets/NativeSelect.css +1 -1
  15. package/assets/Pagination.css +1 -1
  16. package/assets/ProgressBar.css +1 -1
  17. package/assets/RadioButton.css +1 -1
  18. package/assets/Search.css +1 -1
  19. package/assets/SpinnerWrap.css +1 -1
  20. package/assets/Switch.css +1 -1
  21. package/assets/TextArea.css +1 -1
  22. package/assets/TextField.css +1 -1
  23. package/assets/card.css +1 -1
  24. package/assets/combobox.css +1 -1
  25. package/assets/fileUpload.css +1 -1
  26. package/assets/header.css +1 -1
  27. package/assets/index.css +1 -1
  28. package/assets/panel.css +1 -1
  29. package/assets/segmentedControl.css +1 -1
  30. package/assets/slider.css +1 -1
  31. package/assets/stepper.css +1 -1
  32. package/chunks/DateField.Segment.7oCeBSNo.js +1 -0
  33. package/chunks/DateField.Segment.DbjGMAPP.js +99 -0
  34. package/chunks/FloatingUI.arrow.DFhYQv_F.js +1 -0
  35. package/chunks/FloatingUI.arrow.tN5_IctZ.js +27 -0
  36. package/chunks/panel.module.BVmRxZHo.js +1 -0
  37. package/chunks/{panel.module.BblnuBjO.js → panel.module.CnHWv4EZ.js} +1 -3
  38. package/index.cjs.js +1 -1
  39. package/index.es.js +35 -33
  40. package/lib/ActionList/ActionList.Group.d.ts +1 -1
  41. package/lib/Autocomplete/Autocomplete.cjs.js +1 -1
  42. package/lib/Autocomplete/Autocomplete.d.ts +5 -5
  43. package/lib/Autocomplete/Autocomplete.es.js +296 -268
  44. package/lib/Autocomplete/AutocompleteDropdown.cjs.js +1 -1
  45. package/lib/Autocomplete/AutocompleteDropdown.es.js +15 -12
  46. package/lib/FloatingUI/FloatingUI.arrow.cjs.js +1 -1
  47. package/lib/FloatingUI/FloatingUI.arrow.es.js +6 -17
  48. package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
  49. package/lib/FloatingUI/FloatingUI.content.es.js +17 -18
  50. package/lib/Search/SearchDropdown.cjs.js +1 -1
  51. package/lib/Search/SearchDropdown.es.js +1 -1
  52. package/lib/Select/Select.cjs.js +1 -1
  53. package/lib/Select/Select.d.ts +3 -2
  54. package/lib/Select/Select.es.js +208 -195
  55. package/lib/Select/SelectDropdown.cjs.js +1 -1
  56. package/lib/Select/SelectDropdown.es.js +15 -12
  57. package/lib/_Options/Option.cjs.js +1 -1
  58. package/lib/_Options/Option.context.cjs.js +1 -1
  59. package/lib/_Options/Option.context.d.ts +31 -13
  60. package/lib/_Options/Option.context.es.js +133 -88
  61. package/lib/_Options/Option.es.js +23 -21
  62. package/lib/_Options/Option.types.d.ts +23 -0
  63. package/lib/_Options/OptionGroup.cjs.js +1 -0
  64. package/lib/_Options/OptionGroup.context.cjs.js +1 -0
  65. package/lib/_Options/OptionGroup.context.d.ts +6 -0
  66. package/lib/_Options/OptionGroup.context.es.js +6 -0
  67. package/lib/_Options/OptionGroup.d.ts +3 -0
  68. package/lib/_Options/OptionGroup.es.js +22 -0
  69. package/lib/_Options/getLastVisibleStructureIndex.cjs.js +1 -0
  70. package/lib/_Options/getLastVisibleStructureIndex.d.ts +15 -0
  71. package/lib/_Options/getLastVisibleStructureIndex.es.js +14 -0
  72. package/lib/_Options/index.cjs.js +1 -1
  73. package/lib/_Options/index.d.ts +4 -0
  74. package/lib/_Options/index.es.js +13 -4
  75. package/lib/_Options/useRenderOption.cjs.js +1 -0
  76. package/lib/_Options/useRenderOption.d.ts +30 -0
  77. package/lib/_Options/useRenderOption.es.js +43 -0
  78. package/lib/index.cjs.js +1 -1
  79. package/lib/index.d.ts +1 -0
  80. package/lib/index.es.js +27 -25
  81. package/lib/wip/DateField/DateField.Segment.cjs.js +1 -0
  82. package/lib/wip/DateField/DateField.Segment.d.ts +2 -0
  83. package/lib/wip/DateField/DateField.Segment.es.js +8 -0
  84. package/lib/wip/DateField/DateField.Segments.cjs.js +1 -0
  85. package/lib/wip/DateField/DateField.Segments.d.ts +17 -0
  86. package/lib/wip/DateField/DateField.Segments.es.js +61 -0
  87. package/lib/wip/DateField/DateField.cjs.js +1 -0
  88. package/lib/wip/DateField/DateField.d.ts +3 -0
  89. package/lib/wip/DateField/DateField.es.js +191 -0
  90. package/lib/wip/DateField/DateField.types.cjs.js +1 -0
  91. package/lib/wip/DateField/DateField.types.d.ts +118 -0
  92. package/lib/wip/DateField/DateField.types.es.js +1 -0
  93. package/lib/wip/DateField/DateField.utils.cjs.js +1 -0
  94. package/lib/wip/DateField/DateField.utils.d.ts +26 -0
  95. package/lib/wip/DateField/DateField.utils.es.js +45 -0
  96. package/lib/wip/DateField/DateField.validation.cjs.js +1 -0
  97. package/lib/wip/DateField/DateField.validation.d.ts +26 -0
  98. package/lib/wip/DateField/DateField.validation.es.js +24 -0
  99. package/lib/wip/DateField/index.cjs.js +1 -0
  100. package/lib/wip/DateField/index.d.ts +2 -0
  101. package/lib/wip/DateField/index.es.js +4 -0
  102. package/lib/wip/DateField/useDateFieldFocus.cjs.js +1 -0
  103. package/lib/wip/DateField/useDateFieldFocus.d.ts +23 -0
  104. package/lib/wip/DateField/useDateFieldFocus.es.js +65 -0
  105. package/lib/wip/DateField/useDateFieldForm.cjs.js +1 -0
  106. package/lib/wip/DateField/useDateFieldForm.d.ts +32 -0
  107. package/lib/wip/DateField/useDateFieldForm.es.js +51 -0
  108. package/lib/wip/DateField/useDateFieldSegments.cjs.js +1 -0
  109. package/lib/wip/DateField/useDateFieldSegments.d.ts +7 -0
  110. package/lib/wip/DateField/useDateFieldSegments.es.js +13 -0
  111. package/lib/wip/DateField/useDateFieldValidity.cjs.js +1 -0
  112. package/lib/wip/DateField/useDateFieldValidity.d.ts +23 -0
  113. package/lib/wip/DateField/useDateFieldValidity.es.js +19 -0
  114. package/lib/wip/DateField/useDateFieldValue.cjs.js +1 -0
  115. package/lib/wip/DateField/useDateFieldValue.d.ts +19 -0
  116. package/lib/wip/DateField/useDateFieldValue.es.js +62 -0
  117. package/lib/wip/DateField/useInvalidState.cjs.js +1 -0
  118. package/lib/wip/DateField/useInvalidState.d.ts +13 -0
  119. package/lib/wip/DateField/useInvalidState.es.js +8 -0
  120. package/lib/wip/Panel/Footer/Panel.Footer.Actions.cjs.js +1 -1
  121. package/lib/wip/Panel/Footer/Panel.Footer.Actions.es.js +1 -1
  122. package/lib/wip/Panel/Footer/Panel.Footer.cjs.js +1 -1
  123. package/lib/wip/Panel/Footer/Panel.Footer.es.js +1 -1
  124. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.cjs.js +1 -1
  125. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.es.js +1 -1
  126. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.cjs.js +1 -1
  127. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.es.js +1 -1
  128. package/lib/wip/Panel/Header/Panel.Header.Description.cjs.js +1 -1
  129. package/lib/wip/Panel/Header/Panel.Header.Description.es.js +1 -1
  130. package/lib/wip/Panel/Header/Panel.Header.Heading.cjs.js +1 -1
  131. package/lib/wip/Panel/Header/Panel.Header.Heading.es.js +1 -1
  132. package/lib/wip/Panel/Header/Panel.Header.Row.cjs.js +1 -1
  133. package/lib/wip/Panel/Header/Panel.Header.Row.es.js +1 -1
  134. package/lib/wip/Panel/Header/Panel.Header.Subheader.cjs.js +1 -1
  135. package/lib/wip/Panel/Header/Panel.Header.Subheader.es.js +1 -1
  136. package/lib/wip/Panel/Header/Panel.Header.cjs.js +1 -1
  137. package/lib/wip/Panel/Header/Panel.Header.es.js +1 -1
  138. package/lib/wip/Panel/Panel.Body.cjs.js +1 -1
  139. package/lib/wip/Panel/Panel.Body.es.js +1 -1
  140. package/lib/wip/Panel/Panel.Inline.cjs.js +1 -1
  141. package/lib/wip/Panel/Panel.Inline.d.ts +5 -1
  142. package/lib/wip/Panel/Panel.Inline.es.js +54 -47
  143. package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -1
  144. package/lib/wip/Panel/Panel.Overlay.d.ts +20 -2
  145. package/lib/wip/Panel/Panel.Overlay.es.js +117 -80
  146. package/lib/wip/Panel/Panel.ResizeHandle.cjs.js +1 -1
  147. package/lib/wip/Panel/Panel.ResizeHandle.es.js +1 -1
  148. package/lib/wip/Panel/Panel.cjs.js +1 -1
  149. package/lib/wip/Panel/Panel.d.ts +1 -1
  150. package/lib/wip/Panel/Panel.es.js +139 -100
  151. package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
  152. package/lib/wip/Panel/Panel.helpers.d.ts +2 -1
  153. package/lib/wip/Panel/Panel.helpers.es.js +37 -35
  154. package/lib/wip/Panel/Panel.types.d.ts +64 -10
  155. package/lib/wip/Panel/Panel.useResize.cjs.js +1 -1
  156. package/lib/wip/Panel/Panel.useResize.d.ts +3 -1
  157. package/lib/wip/Panel/Panel.useResize.es.js +34 -30
  158. package/package.json +6 -6
  159. package/utils/hooks/index.cjs.js +1 -1
  160. package/utils/hooks/index.d.ts +1 -0
  161. package/utils/hooks/index.es.js +12 -10
  162. package/utils/hooks/useElementResize.cjs.js +1 -1
  163. package/utils/hooks/useElementResize.d.ts +1 -1
  164. package/utils/hooks/useElementResize.es.js +33 -33
  165. package/utils/hooks/usePrevious.cjs.js +1 -0
  166. package/utils/hooks/usePrevious.d.ts +5 -0
  167. package/utils/hooks/usePrevious.es.js +10 -0
  168. package/chunks/floatingui.module.BcBFebz0.js +0 -10
  169. package/chunks/floatingui.module.D3Aw_aYe.js +0 -1
  170. package/chunks/panel.module.CVyUzyCZ.js +0 -1
@@ -1,116 +1,155 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import S from "clsx";
3
- import { useMemo as z } from "react";
4
- import { g as V } from "../../../chunks/classNames.BTJmrO_L.js";
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import H from "clsx";
3
+ import { useMemo as K } from "react";
4
+ import { g as oe } from "../../../chunks/classNames.BTJmrO_L.js";
5
5
  import "../../../chunks/constants.CKKGf1-i.js";
6
- import { Header as W } from "./Header/Panel.Header.es.js";
7
- import { Body as q } from "./Panel.Body.es.js";
8
- import { Footer as G } from "./Footer/Panel.Footer.es.js";
9
- import { resolveOffset as U, usePanelClose as J, getPanelDividerState as Q, PANEL_TRANSITION_DURATION_MS as X, getResolvedPanelPosition as Y } from "./Panel.helpers.es.js";
10
- import { InlinePanel as Z } from "./Panel.Inline.es.js";
11
- import { OverlayPanel as k } from "./Panel.Overlay.es.js";
12
- import { s as e } from "../../../chunks/panel.module.BblnuBjO.js";
13
- const ee = 165, oe = 100, se = (s, m) => {
14
- if (!s || m === "full") return;
15
- const p = m === "bottom", r = typeof s == "object" ? s : {}, c = r.minSize ?? (p ? oe : ee), n = r.maxSize ?? 1 / 0, f = r.storageKey ?? "";
16
- return { minSize: c, maxSize: n, storageKey: f };
17
- }, { baseClassNamePrefix: o } = V("panel"), d = ({
18
- children: s,
19
- className: m,
6
+ import { usePrevious as R } from "../../../utils/hooks/usePrevious.es.js";
7
+ import { Header as ne } from "./Header/Panel.Header.es.js";
8
+ import { Body as se } from "./Panel.Body.es.js";
9
+ import { Footer as ie } from "./Footer/Panel.Footer.es.js";
10
+ import { resolveOffset as te, usePanelClose as re, getPanelDividerState as ae, PANEL_TRANSITION_DURATION_MS as le, getResolvedPanelPosition as ce, isPresetSize as fe } from "./Panel.helpers.es.js";
11
+ import { InlinePanel as me } from "./Panel.Inline.es.js";
12
+ import { OverlayPanel as ve } from "./Panel.Overlay.es.js";
13
+ import { s as n } from "../../../chunks/panel.module.CnHWv4EZ.js";
14
+ const pe = 165, de = 100, ue = (e, v) => {
15
+ if (!e) return;
16
+ const p = v === "bottom", a = typeof e == "object" ? e : {}, t = a.minSize ?? (p ? de : pe), d = a.maxSize ?? 1 / 0, f = a.storageKey ?? "";
17
+ return { minSize: t, maxSize: d, storageKey: f };
18
+ }, { baseClassNamePrefix: s, variable: ye } = oe("panel");
19
+ function ge(e) {
20
+ return fe(e) ? {
21
+ overlaySizeClass: n[`${s}--size-${e}`],
22
+ inlineSizeClass: n[`${s}__inline-wrapper--size-${e}`],
23
+ sizeStyle: void 0
24
+ } : e !== void 0 ? {
25
+ overlaySizeClass: void 0,
26
+ inlineSizeClass: void 0,
27
+ sizeStyle: { [ye("size")]: e }
28
+ } : { overlaySizeClass: void 0, inlineSizeClass: void 0, sizeStyle: void 0 };
29
+ }
30
+ const m = ({
31
+ children: e,
32
+ className: v,
20
33
  padding: p = "md",
21
- onOpenChange: r,
22
- open: c,
23
- size: n = "md",
34
+ onOpenChange: a,
35
+ open: t,
36
+ size: d,
24
37
  dismissible: f = !0,
25
- closeButtonAriaLabel: N = "Close panel",
26
- kind: i = "inline",
27
- position: g,
28
- divider: M = !0,
29
- dividerColor: v,
30
- isAnimated: P = !0,
31
- onBeforeClose: x,
32
- modalType: a,
33
- offset: O,
34
- resizable: D,
35
- id: _,
36
- ...u
38
+ closeButtonAriaLabel: P = "Close panel",
39
+ kind: o = "inline",
40
+ position: u,
41
+ divider: F = !0,
42
+ dividerColor: S,
43
+ isAnimated: C = !0,
44
+ onBeforeClose: j,
45
+ modalType: l,
46
+ offset: z,
47
+ resizable: L,
48
+ id: h,
49
+ ...N
37
50
  }) => {
38
- const t = Y(g), l = se(D, t), B = !!l;
51
+ const r = ce(u), c = ue(L, r), V = !!c, { container: O, triggerRef: W, ...w } = N, i = o === "overlay" ? O : void 0;
39
52
  if (process.env.NODE_ENV !== "production") {
40
- l && !l.storageKey && console.warn("Panel: provide a `storageKey` in the `resizable` config to persist panel size across sessions."), a === "alert" && f && console.warn('Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.');
41
- const { closeOnOutsidePress: L } = u;
42
- L && a !== "nonModal" && a !== void 0 && console.warn('Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.');
53
+ c && !c.storageKey && console.warn(
54
+ "Panel: provide a `storageKey` in the `resizable` config to persist panel size across sessions."
55
+ ), l === "alert" && f && console.warn(
56
+ 'Panel: `dismissible` is ignored when `modalType="alert"`. The close button is always hidden.'
57
+ );
58
+ const { closeOnOutsidePress: ee } = N;
59
+ if (ee && l !== "nonModal" && l !== void 0 && console.warn(
60
+ 'Panel: `closeOnOutsidePress` has no effect when `modalType` is not `"nonModal"`.'
61
+ ), O && o === "inline" && console.warn('Panel: `container` has no effect when `kind="inline"`.'), i)
62
+ try {
63
+ if (typeof getComputedStyle == "function") {
64
+ const y = getComputedStyle(i);
65
+ y.position === "static" && console.warn(
66
+ "Panel: container element should have `position: relative` (or another non-static value) for proper scoping."
67
+ );
68
+ const g = r === "bottom" ? y.overflowY : y.overflowX;
69
+ (g === "visible" || g === "auto" || g === "scroll") && console.warn(
70
+ "Panel: container element should use `overflow: hidden` (or `clip`) so the slide-in/out transform does not trigger a transient scrollbar."
71
+ );
72
+ }
73
+ } catch {
74
+ }
43
75
  }
44
- const y = a === "alert" ? !1 : f, T = n && (t !== "bottom" || n === "full"), $ = i === "overlay" && O ? U(O) : void 0, C = !!$, I = S(
45
- e[o],
46
- e[`${o}--${i}`],
47
- T && e[`${o}--size-${n}`],
48
- e[`${o}--padding-${p}`],
49
- e[`${o}--position-${t}`],
50
- C && e[`${o}--floating`],
51
- B && e[`${o}--resizable`],
52
- m
53
- ), A = S(
54
- e[`${o}__inline-wrapper`],
55
- e[`${o}__inline-wrapper--size-${n}`]
56
- ), { requestClose: h, handleOverlayOpenChange: H } = J(
57
- x,
58
- r
59
- ), b = z(
76
+ const _ = l === "alert" ? !1 : f, { overlaySizeClass: q, inlineSizeClass: G, sizeStyle: $ } = ge(d), b = o === "overlay" && z ? te(z) : void 0, I = !!b, E = H(
77
+ n[s],
78
+ n[`${s}--${o}`],
79
+ o === "overlay" && q,
80
+ n[`${s}--padding-${p}`],
81
+ n[`${s}--position-${r}`],
82
+ I && n[`${s}--floating`],
83
+ V && n[`${s}--resizable`],
84
+ o === "overlay" && i && n[`${s}--contained`],
85
+ v
86
+ ), U = H(
87
+ n[`${s}__inline-wrapper`],
88
+ G
89
+ ), { requestClose: M, handleOverlayOpenChange: X } = re(
90
+ j,
91
+ a
92
+ ), x = K(
60
93
  () => ({
61
- kind: i,
62
- dismissible: y,
63
- closeButtonAriaLabel: N,
64
- position: g,
65
- requestClose: h
94
+ kind: o,
95
+ dismissible: _,
96
+ closeButtonAriaLabel: P,
97
+ position: u,
98
+ requestClose: M
66
99
  }),
67
- [i, y, N, g, h]
68
- ), { showDivider: K, dividerBefore: R, dividerInner: F, dividerAfter: j } = Q(M && !C, t), w = z(
69
- () => ({ duration: P ? X : 0 }),
70
- [P]
71
- );
72
- return i === "inline" ? /* @__PURE__ */ E(
73
- Z,
100
+ [o, _, P, u, M]
101
+ ), { showDivider: Y, dividerBefore: J, dividerInner: Q, dividerAfter: Z } = ae(F && !I, r), D = K(
102
+ () => ({ duration: C ? le : 0 }),
103
+ [C]
104
+ ), B = R(o), k = R(i), T = B !== void 0 && B !== o && t === !0 || k === null && i != null && t === !0;
105
+ return i === null ? null : o === "inline" ? /* @__PURE__ */ A(
106
+ me,
74
107
  {
75
- contextValue: b,
76
- panelClassName: I,
77
- inlineWrapperClassName: A,
78
- resolvedPosition: t,
79
- dividerBefore: R,
80
- dividerInner: F,
81
- dividerAfter: j,
82
- dividerColor: v,
83
- open: c,
84
- transitionConfig: w,
85
- resizeConfig: l,
86
- id: _,
87
- ...u,
88
- children: s
108
+ contextValue: x,
109
+ panelClassName: E,
110
+ inlineWrapperClassName: U,
111
+ resolvedPosition: r,
112
+ dividerBefore: J,
113
+ dividerInner: Q,
114
+ dividerAfter: Z,
115
+ dividerColor: S,
116
+ open: t,
117
+ transitionConfig: D,
118
+ resizeConfig: c,
119
+ skipMountAnimation: T,
120
+ sizeStyle: $,
121
+ id: h,
122
+ ...w,
123
+ children: e
89
124
  }
90
- ) : /* @__PURE__ */ E(
91
- k,
125
+ ) : /* @__PURE__ */ A(
126
+ ve,
92
127
  {
93
- contextValue: b,
94
- panelClassName: I,
95
- resolvedPosition: t,
96
- showDivider: K,
97
- dividerColor: v,
98
- modalType: a,
99
- floatingOffset: $,
100
- open: c,
101
- onOpenChange: H,
102
- transitionConfig: w,
103
- resizeConfig: l,
104
- id: _,
105
- ...u,
106
- children: s
128
+ contextValue: x,
129
+ panelClassName: E,
130
+ resolvedPosition: r,
131
+ showDivider: Y,
132
+ dividerColor: S,
133
+ modalType: l,
134
+ floatingOffset: b,
135
+ open: t,
136
+ onOpenChange: X,
137
+ transitionConfig: D,
138
+ resizeConfig: c,
139
+ skipMountAnimation: T,
140
+ sizeStyle: $,
141
+ id: h,
142
+ ...w,
143
+ container: i,
144
+ triggerRef: W,
145
+ children: e
107
146
  }
108
147
  );
109
148
  };
110
- d.displayName = "Panel";
111
- d.Header = W;
112
- d.Body = q;
113
- d.Footer = G;
149
+ m.displayName = "Panel";
150
+ m.Header = ne;
151
+ m.Body = se;
152
+ m.Footer = ie;
114
153
  export {
115
- d as Panel
154
+ m as Panel
116
155
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),d=400;function P(e){return e===!0?{x:"1rem",y:"1rem"}:typeof e=="string"?{x:e,y:e}:{x:e.x,y:e.y}}const f="01",a=e=>e||"end",v=(e,t)=>{const r=e&&t!=="full";return{showDivider:r,dividerBefore:r&&t!=="start"&&t!=="bottom",dividerInner:r&&t==="bottom",dividerAfter:r&&t==="start"}},D=(e,t)=>{if(e!=="isModal")return e==="alert"?{escapeKey:!1,outsidePress:!1}:{escapeKey:!0,outsidePress:t??!1}},_=e=>e==="escape-key"?"escapeKey":e==="outside-press"?"outsidePress":"programmatic",y=(e,t)=>{const r=u.useCallback(i=>{if(!e){t==null||t(!1);return}const s=e(i);s instanceof Promise?s.then(l=>{l&&(t==null||t(!1))}).catch(()=>{}):s&&(t==null||t(!1))},[e,t]),c=u.useCallback((i,s,l)=>{i?t==null||t(!0):r(_(l))},[t,r]);return{requestClose:r,handleOverlayOpenChange:c}};exports.DEFAULT_PANEL_DIVIDER_COLOR=f;exports.PANEL_TRANSITION_DURATION_MS=d;exports.getPanelDismissConfig=D;exports.getPanelDividerState=v;exports.getResolvedPanelPosition=a;exports.resolveOffset=P;exports.usePanelClose=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),o=e=>e==="sm"||e==="md"||e==="lg",a=400;function P(e){return e===!0?{x:"1rem",y:"1rem"}:typeof e=="string"?{x:e,y:e}:{x:e.x,y:e.y}}const d="01",f=e=>e||"end",D=(e,s)=>({showDivider:e,dividerBefore:e&&s!=="start"&&s!=="bottom",dividerInner:e&&s==="bottom",dividerAfter:e&&s==="start"}),_=(e,s)=>{if(e!=="isModal")return e==="alert"?{escapeKey:!1,outsidePress:!1}:{escapeKey:!0,outsidePress:s??!1}},v=e=>e==="escape-key"?"escapeKey":e==="outside-press"?"outsidePress":"programmatic",y=(e,s)=>{const i=c.useCallback(l=>{if(!e){s==null||s(!1);return}const r=e(l);r instanceof Promise?r.then(t=>{t&&(s==null||s(!1))}).catch(t=>{process.env.NODE_ENV!=="production"&&console.warn("Panel: `onBeforeClose` rejected; close cancelled (panel stays open). If this was not intentional, handle the error inside `onBeforeClose`.",t)}):r&&(s==null||s(!1))},[e,s]),u=c.useCallback((l,r,t)=>{l?s==null||s(!0):i(v(t))},[s,i]);return{requestClose:i,handleOverlayOpenChange:u}};exports.DEFAULT_PANEL_DIVIDER_COLOR=d;exports.PANEL_TRANSITION_DURATION_MS=a;exports.getPanelDismissConfig=_;exports.getPanelDividerState=D;exports.getResolvedPanelPosition=f;exports.isPresetSize=o;exports.resolveOffset=P;exports.usePanelClose=y;
@@ -1,5 +1,6 @@
1
1
  import { OpenChangeReason } from '@floating-ui/react';
2
- import { OverlayPanelProps, PanelCloseReason, PanelDividerColor, PanelModalType, PanelPosition, PanelProps, ResolvedPanelOffset } from './Panel.types';
2
+ import { OverlayPanelProps, PanelCloseReason, PanelDividerColor, PanelModalType, PanelPosition, PanelProps, PanelSize, ResolvedPanelOffset } from './Panel.types';
3
+ export declare const isPresetSize: (s: PanelSize | undefined) => s is "sm" | "md" | "lg";
3
4
  export declare const PANEL_TRANSITION_DURATION_MS = 400;
4
5
  export declare function resolveOffset(offset: Exclude<OverlayPanelProps['offset'], false | undefined>): ResolvedPanelOffset;
5
6
  export declare const DEFAULT_PANEL_DIVIDER_COLOR: PanelDividerColor;
@@ -1,49 +1,51 @@
1
- import { useCallback as l } from "react";
2
- const P = 400;
3
- function v(t) {
1
+ import { useCallback as c } from "react";
2
+ const o = (t) => t === "sm" || t === "md" || t === "lg", a = 400;
3
+ function P(t) {
4
4
  return t === !0 ? { x: "1rem", y: "1rem" } : typeof t == "string" ? { x: t, y: t } : { x: t.x, y: t.y };
5
5
  }
6
- const m = "01", y = (t) => t || "end", D = (t, r) => {
7
- const s = t && r !== "full";
8
- return {
9
- showDivider: s,
10
- dividerBefore: s && r !== "start" && r !== "bottom",
11
- // For 'bottom' panels the divider must sit inside the scrollable wrapper (above the content),
12
- // not outside it — so it is rendered via dividerInner rather than dividerBefore.
13
- dividerInner: s && r === "bottom",
14
- dividerAfter: s && r === "start"
15
- };
16
- }, _ = (t, r) => {
6
+ const m = "01", y = (t) => t || "end", v = (t, e) => ({
7
+ showDivider: t,
8
+ dividerBefore: t && e !== "start" && e !== "bottom",
9
+ // For 'bottom' panels the divider must sit inside the scrollable wrapper (above the content),
10
+ // not outside it — so it is rendered via dividerInner rather than dividerBefore.
11
+ dividerInner: t && e === "bottom",
12
+ dividerAfter: t && e === "start"
13
+ }), D = (t, e) => {
17
14
  if (t !== "isModal")
18
- return t === "alert" ? { escapeKey: !1, outsidePress: !1 } : { escapeKey: !0, outsidePress: r ?? !1 };
19
- }, d = (t) => t === "escape-key" ? "escapeKey" : t === "outside-press" ? "outsidePress" : "programmatic", A = (t, r) => {
20
- const s = l(
21
- (i) => {
15
+ return t === "alert" ? { escapeKey: !1, outsidePress: !1 } : { escapeKey: !0, outsidePress: e ?? !1 };
16
+ }, f = (t) => t === "escape-key" ? "escapeKey" : t === "outside-press" ? "outsidePress" : "programmatic", _ = (t, e) => {
17
+ const i = c(
18
+ (l) => {
22
19
  if (!t) {
23
- r == null || r(!1);
20
+ e == null || e(!1);
24
21
  return;
25
22
  }
26
- const e = t(i);
27
- e instanceof Promise ? e.then((u) => {
28
- u && (r == null || r(!1));
29
- }).catch(() => {
30
- }) : e && (r == null || r(!1));
23
+ const s = t(l);
24
+ s instanceof Promise ? s.then((r) => {
25
+ r && (e == null || e(!1));
26
+ }).catch((r) => {
27
+ process.env.NODE_ENV !== "production" && console.warn(
28
+ "Panel: `onBeforeClose` rejected; close cancelled (panel stays open). If this was not intentional, handle the error inside `onBeforeClose`.",
29
+ r
30
+ );
31
+ }) : s && (e == null || e(!1));
31
32
  },
32
- [t, r]
33
- ), c = l(
34
- (i, e, u) => {
35
- i ? r == null || r(!0) : s(d(u));
33
+ [t, e]
34
+ ), u = c(
35
+ (l, s, r) => {
36
+ l ? e == null || e(!0) : i(f(r));
36
37
  },
37
- [r, s]
38
+ [e, i]
38
39
  );
39
- return { requestClose: s, handleOverlayOpenChange: c };
40
+ return { requestClose: i, handleOverlayOpenChange: u };
40
41
  };
41
42
  export {
42
43
  m as DEFAULT_PANEL_DIVIDER_COLOR,
43
- P as PANEL_TRANSITION_DURATION_MS,
44
- _ as getPanelDismissConfig,
45
- D as getPanelDividerState,
44
+ a as PANEL_TRANSITION_DURATION_MS,
45
+ D as getPanelDismissConfig,
46
+ v as getPanelDividerState,
46
47
  y as getResolvedPanelPosition,
47
- v as resolveOffset,
48
- A as usePanelClose
48
+ o as isPresetSize,
49
+ P as resolveOffset,
50
+ _ as usePanelClose
49
51
  };
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithoutRef } from 'react';
1
+ import { ComponentPropsWithoutRef, RefObject } from 'react';
2
2
  import { PanelDividerColor, PanelDividerColors } from '@viasat/beam-shared/components/panel';
3
3
  export type { PanelDividerColor };
4
4
  export { PanelDividerColors };
@@ -7,9 +7,9 @@ export type ResolvedPanelOffset = {
7
7
  x: string;
8
8
  y: string;
9
9
  };
10
- export type PanelPosition = 'start' | 'end' | 'bottom' | 'full';
10
+ export type PanelPosition = 'start' | 'end' | 'bottom';
11
11
  export type PanelModalType = 'nonModal' | 'isModal' | 'alert';
12
- export type PanelSize = 'sm' | 'md' | 'lg' | 'full';
12
+ export type PanelSize = 'sm' | 'md' | 'lg' | (string & {});
13
13
  export type PanelPadding = 'sm' | 'md';
14
14
  /**
15
15
  * Configuration for resizable panels.
@@ -60,9 +60,20 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
60
60
  onOpenChange?: (open: boolean) => void;
61
61
  /**
62
62
  * Specify the size of the Panel.
63
- * When `position="bottom"`, only `size="full"` has an effect (enables full-viewport height).
64
- * All other values are ignored for bottom panels — width is always 100%.
65
- * @default 'md'
63
+ *
64
+ * **Named presets** (`'sm'`, `'md'`, `'lg'`) map to design tokens via the
65
+ * `.bm-panel--size-{sm|md|lg}` modifier class, which sets `--bm-comp-panel-size`.
66
+ *
67
+ * **Arbitrary strings** (e.g. `"480px"`, `"100dvh"`) are applied directly as
68
+ * `--bm-comp-panel-size` via inline style, giving full CSS flexibility.
69
+ *
70
+ * For `position="bottom"`, the variable drives `height` instead of `width`
71
+ * (axis-awareness is in SCSS). Width is always `100%` for bottom panels.
72
+ *
73
+ * When omitted: non-bottom panels fall back to the `md` token; bottom panels
74
+ * fall back to `auto` (content-driven height, capped at `90dvh`). Prefer
75
+ * omitting `size` over `size="auto"` for bottom panels — explicitly passing
76
+ * `"auto"` sets `max-height: auto`, removing the `90dvh` viewport cap.
66
77
  */
67
78
  size?: PanelSize;
68
79
  /**
@@ -83,7 +94,10 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
83
94
  */
84
95
  closeButtonAriaLabel?: string;
85
96
  /**
86
- * Whether to animate the panel on open/close
97
+ * Whether to animate the panel on open/close.
98
+ * When `false`, floating-ui's transition timing collapses to zero, which clips
99
+ * the close animation. CSS `transition-duration` values in the stylesheet are
100
+ * unaffected — use `prefers-reduced-motion` in SCSS for motion-sensitive contexts.
87
101
  * @default true
88
102
  */
89
103
  isAnimated?: boolean;
@@ -98,15 +112,15 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
98
112
  */
99
113
  dividerColor?: PanelDividerColor;
100
114
  /**
101
- * Specify the position of the Panel
102
- * 'start' | 'end' | 'bottom' | 'full'
115
+ * Specify the position of the Panel.
116
+ * `'start'` | `'end'` | `'bottom'`
103
117
  * @default 'end'
104
118
  */
105
119
  position?: PanelPosition;
106
120
  /**
107
121
  * Enables user-resizing via a drag handle at the panel edge.
108
122
  * Pass `true` to use default min/max constraints, or an object to set custom
109
- * values in pixels. Has no effect when `position="full"`.
123
+ * values in pixels.
110
124
  * Provide a `storageKey` in the config object to persist the panel's last-used size across sessions.
111
125
  * @default false
112
126
  */
@@ -186,6 +200,46 @@ export interface OverlayPanelProps extends BasePanelProps {
186
200
  x: string;
187
201
  y: string;
188
202
  };
203
+ /**
204
+ * Portal target for the overlay. When set, the panel renders inside this
205
+ * element using `position: absolute` instead of `position: fixed`. The
206
+ * container must:
207
+ * - establish a containing block (e.g. `position: relative`)
208
+ * - have an appropriate `z-index`
209
+ * - use `overflow: hidden` (or `clip`) so the panel's slide-in/out
210
+ * transform doesn't trigger a transient scrollbar on the container.
211
+ *
212
+ * Pass the resolved element (or `null` until it exists) — the consumer owns
213
+ * resolution. Use a callback ref or state so the value is reactive; when it
214
+ * flips from `null` to the element, the panel re-renders into the container.
215
+ * A plain `useRef` whose `.current` is mutated will not trigger that update.
216
+ *
217
+ * @example
218
+ * ```tsx
219
+ * const [container, setContainer] = useState<HTMLElement | null>(null);
220
+ * return (
221
+ * <div ref={setContainer} style={{ position: 'relative', overflow: 'hidden' }}>
222
+ * <Panel kind="overlay" container={container} ... />
223
+ * </div>
224
+ * );
225
+ * ```
226
+ *
227
+ * Has no effect on `kind="inline"`.
228
+ */
229
+ container?: HTMLElement | null;
230
+ /**
231
+ * The element that opens the panel; clicks on it are excluded from outside-press
232
+ * dismissal so it can toggle the panel without the close immediately re-firing.
233
+ * Focus returns to the previously-focused element (typically this trigger) on close.
234
+ * No effect on `kind="inline"`.
235
+ *
236
+ * Note: the exclusion is implemented as a raw `outsidePress` predicate rather than
237
+ * a FloatingUI reference registration. This avoids `autoUpdate` re-renders that
238
+ * interfere with the slide-in CSS transition, but means FloatingUI's nested-floating
239
+ * tree-scoping (`__outsidePressBubbles`) is bypassed for this panel. Avoid using
240
+ * `triggerRef` when the panel is nested inside another FloatingUI floating element.
241
+ */
242
+ triggerRef?: RefObject<HTMLElement | null>;
189
243
  }
190
244
  export type PanelProps = InlinePanelProps | OverlayPanelProps;
191
245
  /**
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),k=require("../../../utils/hooks/useElementResize.cjs.js"),y=require("../../../utils/hooks/useLocalStorage.cjs.js"),R=({resizeConfig:u,position:l,floatingRef:c,requireMount:s=!1})=>{const n=!!u,{minSize:z=0,maxSize:b=0,storageKey:o=""}=u??{},i=t.useRef(null),[r,_]=t.useState(!1),m=t.useCallback(e=>{i.current=e,s&&_(!!e)},[s]),[S,d]=y.useLocalStorage(o||"__panel_no_key__","0",n&&!!o),a=n&&Number(S)>0?Number(S):0,f=t.useCallback(e=>{o&&d(e.toString())},[o,d]);return k.useElementResize(s?n&&r:n,c,i,z,b,a,l==="bottom"?"y":"x",l==="end",f),t.useEffect(()=>{if(!s||!r||!a||!c.current)return;const e=l==="bottom"?"blockSize":"inlineSize";c.current.style[e]=`${a}px`},[r]),{handleRef:m}};exports.usePanelResize=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),R=require("../../../utils/hooks/useElementResize.cjs.js"),g=require("../../../utils/hooks/useLocalStorage.cjs.js"),x=({resizeConfig:i,position:s,floatingRef:o,requireMount:n=!1,container:r})=>{const l=!!i,{minSize:f=0,maxSize:S=0,storageKey:c=""}=i??{},m=t.useCallback(()=>{const e=r;return e?s==="bottom"?e.clientHeight*.9:e.clientWidth*.5:1/0},[r,s]),_=r&&S===1/0?m:S,d=t.useRef(null),[a,y]=t.useState(!1),k=t.useCallback(e=>{d.current=e,n&&y(!!e)},[n]),[b,z]=g.useLocalStorage(c||"__panel_no_key__","0",l&&!!c),u=l&&Number(b)>0?Number(b):0,h=t.useCallback(e=>{c&&z(e.toString())},[c,z]);return R.useElementResize(n?l&&a:l,o,d,f,_,u,s==="bottom"?"y":"x",s==="end",h),t.useEffect(()=>{if(!n||!a||!u||!o.current)return;const e=s==="bottom"?"blockSize":"inlineSize";o.current.style[e]=`${u}px`},[a]),{handleRef:k}};exports.usePanelResize=x;
@@ -10,8 +10,10 @@ type UsePanelResizeOptions = {
10
10
  * ref and re-applies the stored size each time the panel opens.
11
11
  */
12
12
  requireMount?: boolean;
13
+ /** When set, max resize bounds are derived from this element instead of the viewport. */
14
+ container?: HTMLElement;
13
15
  };
14
- export declare const usePanelResize: ({ resizeConfig, position, floatingRef, requireMount, }: UsePanelResizeOptions) => {
16
+ export declare const usePanelResize: ({ resizeConfig, position, floatingRef, requireMount, container, }: UsePanelResizeOptions) => {
15
17
  handleRef: (el: HTMLDivElement | null) => void;
16
18
  };
17
19
  export {};
@@ -1,42 +1,46 @@
1
- import { useRef as _, useState as x, useCallback as u, useEffect as y } from "react";
2
- import { useElementResize as k } from "../../../utils/hooks/useElementResize.es.js";
3
- import { useLocalStorage as E } from "../../../utils/hooks/useLocalStorage.es.js";
1
+ import { useCallback as a, useRef as p, useState as k, useEffect as E } from "react";
2
+ import { useElementResize as H } from "../../../utils/hooks/useElementResize.es.js";
3
+ import { useLocalStorage as R } from "../../../utils/hooks/useLocalStorage.es.js";
4
4
  const N = ({
5
- resizeConfig: l,
6
- position: o,
7
- floatingRef: r,
8
- requireMount: t = !1
5
+ resizeConfig: m,
6
+ position: t,
7
+ floatingRef: o,
8
+ requireMount: n = !1,
9
+ container: c
9
10
  }) => {
10
- const n = !!l, { minSize: S = 0, maxSize: z = 0, storageKey: s = "" } = l ?? {}, m = _(null), [c, f] = x(!1), b = u(
11
+ const s = !!m, { minSize: z = 0, maxSize: f = 0, storageKey: r = "" } = m ?? {}, b = a(() => {
12
+ const e = c;
13
+ return e ? t === "bottom" ? e.clientHeight * 0.9 : e.clientWidth * 0.5 : 1 / 0;
14
+ }, [c, t]), x = c && f === 1 / 0 ? b : f, u = p(null), [l, y] = k(!1), _ = a(
11
15
  (e) => {
12
- m.current = e, t && f(!!e);
16
+ u.current = e, n && y(!!e);
13
17
  },
14
- [t]
15
- ), [i, d] = E(
16
- s || "__panel_no_key__",
18
+ [n]
19
+ ), [d, S] = R(
20
+ r || "__panel_no_key__",
17
21
  "0",
18
- n && !!s
19
- ), a = n && Number(i) > 0 ? Number(i) : 0, p = u(
22
+ s && !!r
23
+ ), i = s && Number(d) > 0 ? Number(d) : 0, h = a(
20
24
  (e) => {
21
- s && d(e.toString());
25
+ r && S(e.toString());
22
26
  },
23
- [s, d]
27
+ [r, S]
24
28
  );
25
- return k(
26
- t ? n && c : n,
27
- r,
28
- m,
29
- S,
29
+ return H(
30
+ n ? s && l : s,
31
+ o,
32
+ u,
30
33
  z,
31
- a,
32
- o === "bottom" ? "y" : "x",
33
- o === "end",
34
- p
35
- ), y(() => {
36
- if (!t || !c || !a || !r.current) return;
37
- const e = o === "bottom" ? "blockSize" : "inlineSize";
38
- r.current.style[e] = `${a}px`;
39
- }, [c]), { handleRef: b };
34
+ x,
35
+ i,
36
+ t === "bottom" ? "y" : "x",
37
+ t === "end",
38
+ h
39
+ ), E(() => {
40
+ if (!n || !l || !i || !o.current) return;
41
+ const e = t === "bottom" ? "blockSize" : "inlineSize";
42
+ o.current.style[e] = `${i}px`;
43
+ }, [l]), { handleRef: _ };
40
44
  };
41
45
  export {
42
46
  N as usePanelResize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.29.1",
3
+ "version": "2.36.0",
4
4
  "description": "React component library for the Beam design system",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",
@@ -59,11 +59,11 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@viasat/beam-fonts": "2.29.1",
63
- "@viasat/beam-shared": "2.29.1",
64
- "@viasat/beam-styles": "2.29.1",
65
- "@viasat/beam-tokens": "2.29.1",
66
- "@viasat/beam-icons": "2.29.1",
62
+ "@viasat/beam-fonts": "2.36.0",
63
+ "@viasat/beam-shared": "2.36.0",
64
+ "@viasat/beam-styles": "2.36.0",
65
+ "@viasat/beam-tokens": "2.36.0",
66
+ "@viasat/beam-icons": "2.36.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),d=require("../../chunks/constants.hwjHOsvT.js"),p=require("../../chunks/helpers.COm6C5Gf.js"),a=require("../../chunks/CSSLookup.DESAWWRT.js"),w=require("./useId.cjs.js"),f=require("./useInteractiveProps.cjs.js");function g(e,t=window.getComputedStyle(e)){return parseInt(t.getPropertyValue("-webkit-line-clamp"),10)>=1&&t.getPropertyValue("display")==="-webkit-box"&&t.getPropertyValue("overflow")==="hidden"}function h(e,t=window.getComputedStyle(e)){return t.getPropertyValue("text-overflow")==="ellipsis"&&t.getPropertyValue("white-space")==="nowrap"&&t.getPropertyValue("overflow")==="hidden"&&e.scrollWidth>e.clientWidth}function v(e){return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}function S(e){if(!e)return!1;if(v(e))return!0;const t=window.getComputedStyle(e);return g(e,t)||h(e,t)}const b=e=>{if(!e)return!1;const t=e.cloneNode(!0);t.style.position="absolute",t.style.whiteSpace="nowrap",t.style.width="auto",t.style.height="auto",t.style.visibility="hidden",document.body.appendChild(t);const n=t.offsetWidth>e.offsetWidth;return document.body.removeChild(t),n},l=(e,t=d.FPS_120,n=[])=>{const r=s.useRef(null);return s.useLayoutEffect(()=>{const{current:i}=r;if(!i)return;e();const u=p.debounce(()=>{e()},t),c=new ResizeObserver(u);return c.observe(i),()=>{c.disconnect(),u.cancel()}},[r,e,t,n]),{ref:r}},m=()=>{const[e,t]=s.useState(!1),n=()=>{r.current&&t(S(r.current))},{ref:r}=l(n);return{ref:r,isOverFlowing:e}},y=e=>{const[t,n]=s.useState(!1),r=()=>{i.current&&n(b(i.current))},{ref:i}=l(r,200);return{ref:i,isTextWrapping:t}},C=e=>{const[t,n]=s.useState(()=>a.CSSManager.findVar(e)??"");return s.useEffect(()=>{const r=i=>{n(i)};return a.CSSManager.findVar(e,r),()=>{a.CSSManager.unsubscribe(e,r)}},[e]),t};function W(e){const[t,n]=s.useState(!1);return s.useLayoutEffect(()=>{if(typeof window>"u")return;const r=o=>o?getComputedStyle(o).direction:"ltr",i=()=>{const o=e.current;return o?r(o)==="rtl"||!!o.closest('[dir="rtl"]')||r(document.documentElement)==="rtl":!1};n(i());const u=new MutationObserver(()=>n(i()));u.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","class"],subtree:!0});const c=requestAnimationFrame(function o(){n(i()),requestAnimationFrame(o)});return()=>{u.disconnect(),cancelAnimationFrame(c)}},[e]),t}const I=()=>{const[e,t]=s.useState(!1);return s.useEffect(()=>{if(typeof window>"u")return;const n=()=>{const r="ontouchstart"in window||navigator.maxTouchPoints>0,i=window.innerHeight>window.innerWidth,u=i?window.innerWidth:window.innerHeight,c=i?window.innerHeight:window.innerWidth,o=u<1024||c<768;t(r&&o)};return n(),window.addEventListener("resize",n,{passive:!0}),window.addEventListener("orientationchange",n,{passive:!0}),()=>{window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n)}},[]),e};exports.useId=w.useId;exports.useInteractiveProps=f.useInteractiveProps;exports.useCSSLookup=C;exports.useIsOverFlowing=m;exports.useIsTextWrapping=y;exports.useMobileDetection=I;exports.useRTLDirection=W;exports.useResizeObserver=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),d=require("../../chunks/constants.hwjHOsvT.js"),p=require("../../chunks/helpers.COm6C5Gf.js"),a=require("../../chunks/CSSLookup.DESAWWRT.js"),w=require("./useId.cjs.js"),f=require("./usePrevious.cjs.js"),g=require("./useInteractiveProps.cjs.js");function h(e,t=window.getComputedStyle(e)){return parseInt(t.getPropertyValue("-webkit-line-clamp"),10)>=1&&t.getPropertyValue("display")==="-webkit-box"&&t.getPropertyValue("overflow")==="hidden"}function v(e,t=window.getComputedStyle(e)){return t.getPropertyValue("text-overflow")==="ellipsis"&&t.getPropertyValue("white-space")==="nowrap"&&t.getPropertyValue("overflow")==="hidden"&&e.scrollWidth>e.clientWidth}function S(e){return e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}function b(e){if(!e)return!1;if(S(e))return!0;const t=window.getComputedStyle(e);return h(e,t)||v(e,t)}const m=e=>{if(!e)return!1;const t=e.cloneNode(!0);t.style.position="absolute",t.style.whiteSpace="nowrap",t.style.width="auto",t.style.height="auto",t.style.visibility="hidden",document.body.appendChild(t);const n=t.offsetWidth>e.offsetWidth;return document.body.removeChild(t),n},l=(e,t=d.FPS_120,n=[])=>{const r=s.useRef(null);return s.useLayoutEffect(()=>{const{current:i}=r;if(!i)return;e();const u=p.debounce(()=>{e()},t),c=new ResizeObserver(u);return c.observe(i),()=>{c.disconnect(),u.cancel()}},[r,e,t,n]),{ref:r}},y=()=>{const[e,t]=s.useState(!1),n=()=>{r.current&&t(b(r.current))},{ref:r}=l(n);return{ref:r,isOverFlowing:e}},C=e=>{const[t,n]=s.useState(!1),r=()=>{i.current&&n(m(i.current))},{ref:i}=l(r,200);return{ref:i,isTextWrapping:t}},W=e=>{const[t,n]=s.useState(()=>a.CSSManager.findVar(e)??"");return s.useEffect(()=>{const r=i=>{n(i)};return a.CSSManager.findVar(e,r),()=>{a.CSSManager.unsubscribe(e,r)}},[e]),t};function P(e){const[t,n]=s.useState(!1);return s.useLayoutEffect(()=>{if(typeof window>"u")return;const r=o=>o?getComputedStyle(o).direction:"ltr",i=()=>{const o=e.current;return o?r(o)==="rtl"||!!o.closest('[dir="rtl"]')||r(document.documentElement)==="rtl":!1};n(i());const u=new MutationObserver(()=>n(i()));u.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","class"],subtree:!0});const c=requestAnimationFrame(function o(){n(i()),requestAnimationFrame(o)});return()=>{u.disconnect(),cancelAnimationFrame(c)}},[e]),t}const I=()=>{const[e,t]=s.useState(!1);return s.useEffect(()=>{if(typeof window>"u")return;const n=()=>{const r="ontouchstart"in window||navigator.maxTouchPoints>0,i=window.innerHeight>window.innerWidth,u=i?window.innerWidth:window.innerHeight,c=i?window.innerHeight:window.innerWidth,o=u<1024||c<768;t(r&&o)};return n(),window.addEventListener("resize",n,{passive:!0}),window.addEventListener("orientationchange",n,{passive:!0}),()=>{window.removeEventListener("resize",n),window.removeEventListener("orientationchange",n)}},[]),e};exports.useId=w.useId;exports.usePrevious=f.usePrevious;exports.useInteractiveProps=g.useInteractiveProps;exports.useCSSLookup=W;exports.useIsOverFlowing=y;exports.useIsTextWrapping=C;exports.useMobileDetection=I;exports.useRTLDirection=P;exports.useResizeObserver=l;