@viasat/beam-react 2.30.0 → 2.37.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 (200) 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 +1 -0
  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/dialog.css +1 -1
  26. package/assets/fileUpload.css +1 -1
  27. package/assets/header.css +1 -1
  28. package/assets/index.css +1 -1
  29. package/assets/panel.css +1 -1
  30. package/assets/segmentedControl.css +1 -1
  31. package/assets/slider.css +1 -1
  32. package/assets/stepper.css +1 -1
  33. package/chunks/DateField.Segment.7oCeBSNo.js +1 -0
  34. package/chunks/DateField.Segment.DbjGMAPP.js +99 -0
  35. package/chunks/FloatingUI.arrow.BK0jH2ge.js +1 -0
  36. package/chunks/FloatingUI.arrow.BXR2atOC.js +28 -0
  37. package/chunks/dialog.module.Djvqgz-x.js +1 -0
  38. package/chunks/{dialog.module.TRHzVysh.js → dialog.module.vokt9Lwb.js} +2 -1
  39. package/chunks/panel.module.BVmRxZHo.js +1 -0
  40. package/chunks/{panel.module.BblnuBjO.js → panel.module.CnHWv4EZ.js} +1 -3
  41. package/lib/ActionList/ActionList.Group.d.ts +1 -1
  42. package/lib/Autocomplete/Autocomplete.cjs.js +1 -1
  43. package/lib/Autocomplete/Autocomplete.d.ts +5 -5
  44. package/lib/Autocomplete/Autocomplete.es.js +296 -268
  45. package/lib/Autocomplete/AutocompleteDropdown.cjs.js +1 -1
  46. package/lib/Autocomplete/AutocompleteDropdown.es.js +15 -12
  47. package/lib/Breadcrumbs/BreadcrumbsItem.d.ts +1 -1
  48. package/lib/Dialog/Dialog.Body.cjs.js +1 -1
  49. package/lib/Dialog/Dialog.Body.es.js +1 -1
  50. package/lib/Dialog/Dialog.Content.cjs.js +1 -1
  51. package/lib/Dialog/Dialog.Content.es.js +1 -1
  52. package/lib/Dialog/Dialog.Footer.cjs.js +1 -1
  53. package/lib/Dialog/Dialog.Footer.es.js +1 -1
  54. package/lib/Dialog/Dialog.Header.cjs.js +1 -1
  55. package/lib/Dialog/Dialog.Header.es.js +1 -1
  56. package/lib/Dialog/Dialog.cjs.js +1 -1
  57. package/lib/Dialog/Dialog.es.js +1 -1
  58. package/lib/FloatingUI/FloatingUI.arrow.cjs.js +1 -1
  59. package/lib/FloatingUI/FloatingUI.arrow.es.js +6 -17
  60. package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
  61. package/lib/FloatingUI/FloatingUI.content.es.js +31 -32
  62. package/lib/Search/SearchDropdown.cjs.js +1 -1
  63. package/lib/Search/SearchDropdown.es.js +1 -1
  64. package/lib/Select/Select.cjs.js +1 -1
  65. package/lib/Select/Select.d.ts +3 -2
  66. package/lib/Select/Select.es.js +208 -195
  67. package/lib/Select/SelectDropdown.cjs.js +1 -1
  68. package/lib/Select/SelectDropdown.es.js +15 -12
  69. package/lib/SideNav/SideNavActionList.es.js +1 -0
  70. package/lib/SideNav/SideNavActionListItemLabel.d.ts +1 -1
  71. package/lib/Slider/DualSlider.cjs.js +1 -1
  72. package/lib/Slider/DualSlider.es.js +28 -27
  73. package/lib/Slider/SingleSlider.cjs.js +1 -1
  74. package/lib/Slider/SingleSlider.es.js +1 -1
  75. package/lib/Slider/Slider.es.js +17 -17
  76. package/lib/Slider/hooks/useDualSliderLogic.cjs.js +1 -1
  77. package/lib/Slider/hooks/useDualSliderLogic.es.js +14 -14
  78. package/lib/Slider/hooks/useSingleSliderLogic.cjs.js +1 -1
  79. package/lib/Slider/hooks/useSingleSliderLogic.es.js +17 -17
  80. package/lib/Tabs/Tabs.Group.d.ts +2 -2
  81. package/lib/Tabs/Tabs.Item.d.ts +2 -2
  82. package/lib/Tabs/Tabs.Panel.d.ts +2 -2
  83. package/lib/Text/Text.d.ts +2 -2
  84. package/lib/Text/Text.es.js +12 -12
  85. package/lib/_Options/Option.cjs.js +1 -1
  86. package/lib/_Options/Option.context.cjs.js +1 -1
  87. package/lib/_Options/Option.context.d.ts +31 -13
  88. package/lib/_Options/Option.context.es.js +133 -88
  89. package/lib/_Options/Option.es.js +23 -21
  90. package/lib/_Options/Option.types.d.ts +23 -0
  91. package/lib/_Options/OptionGroup.cjs.js +1 -0
  92. package/lib/_Options/OptionGroup.context.cjs.js +1 -0
  93. package/lib/_Options/OptionGroup.context.d.ts +6 -0
  94. package/lib/_Options/OptionGroup.context.es.js +6 -0
  95. package/lib/_Options/OptionGroup.d.ts +3 -0
  96. package/lib/_Options/OptionGroup.es.js +22 -0
  97. package/lib/_Options/getLastVisibleStructureIndex.cjs.js +1 -0
  98. package/lib/_Options/getLastVisibleStructureIndex.d.ts +15 -0
  99. package/lib/_Options/getLastVisibleStructureIndex.es.js +14 -0
  100. package/lib/_Options/index.cjs.js +1 -1
  101. package/lib/_Options/index.d.ts +4 -0
  102. package/lib/_Options/index.es.js +13 -4
  103. package/lib/_Options/useRenderOption.cjs.js +1 -0
  104. package/lib/_Options/useRenderOption.d.ts +30 -0
  105. package/lib/_Options/useRenderOption.es.js +43 -0
  106. package/lib/wip/DateField/DateField.Segment.cjs.js +1 -0
  107. package/lib/wip/DateField/DateField.Segment.d.ts +2 -0
  108. package/lib/wip/DateField/DateField.Segment.es.js +8 -0
  109. package/lib/wip/DateField/DateField.Segments.cjs.js +1 -0
  110. package/lib/wip/DateField/DateField.Segments.d.ts +17 -0
  111. package/lib/wip/DateField/DateField.Segments.es.js +61 -0
  112. package/lib/wip/DateField/DateField.cjs.js +1 -0
  113. package/lib/wip/DateField/DateField.d.ts +3 -0
  114. package/lib/wip/DateField/DateField.es.js +191 -0
  115. package/lib/wip/DateField/DateField.types.cjs.js +1 -0
  116. package/lib/wip/DateField/DateField.types.d.ts +118 -0
  117. package/lib/wip/DateField/DateField.types.es.js +1 -0
  118. package/lib/wip/DateField/DateField.utils.cjs.js +1 -0
  119. package/lib/wip/DateField/DateField.utils.d.ts +26 -0
  120. package/lib/wip/DateField/DateField.utils.es.js +45 -0
  121. package/lib/wip/DateField/DateField.validation.cjs.js +1 -0
  122. package/lib/wip/DateField/DateField.validation.d.ts +26 -0
  123. package/lib/wip/DateField/DateField.validation.es.js +24 -0
  124. package/lib/wip/DateField/index.cjs.js +1 -0
  125. package/lib/wip/DateField/index.d.ts +2 -0
  126. package/lib/wip/DateField/index.es.js +4 -0
  127. package/lib/wip/DateField/useDateFieldFocus.cjs.js +1 -0
  128. package/lib/wip/DateField/useDateFieldFocus.d.ts +23 -0
  129. package/lib/wip/DateField/useDateFieldFocus.es.js +65 -0
  130. package/lib/wip/DateField/useDateFieldForm.cjs.js +1 -0
  131. package/lib/wip/DateField/useDateFieldForm.d.ts +32 -0
  132. package/lib/wip/DateField/useDateFieldForm.es.js +51 -0
  133. package/lib/wip/DateField/useDateFieldSegments.cjs.js +1 -0
  134. package/lib/wip/DateField/useDateFieldSegments.d.ts +7 -0
  135. package/lib/wip/DateField/useDateFieldSegments.es.js +13 -0
  136. package/lib/wip/DateField/useDateFieldValidity.cjs.js +1 -0
  137. package/lib/wip/DateField/useDateFieldValidity.d.ts +23 -0
  138. package/lib/wip/DateField/useDateFieldValidity.es.js +19 -0
  139. package/lib/wip/DateField/useDateFieldValue.cjs.js +1 -0
  140. package/lib/wip/DateField/useDateFieldValue.d.ts +19 -0
  141. package/lib/wip/DateField/useDateFieldValue.es.js +62 -0
  142. package/lib/wip/DateField/useInvalidState.cjs.js +1 -0
  143. package/lib/wip/DateField/useInvalidState.d.ts +13 -0
  144. package/lib/wip/DateField/useInvalidState.es.js +8 -0
  145. package/lib/wip/Panel/Footer/Panel.Footer.Actions.cjs.js +1 -1
  146. package/lib/wip/Panel/Footer/Panel.Footer.Actions.es.js +1 -1
  147. package/lib/wip/Panel/Footer/Panel.Footer.cjs.js +1 -1
  148. package/lib/wip/Panel/Footer/Panel.Footer.es.js +1 -1
  149. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.cjs.js +1 -1
  150. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.es.js +1 -1
  151. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.cjs.js +1 -1
  152. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.es.js +1 -1
  153. package/lib/wip/Panel/Header/Panel.Header.Description.cjs.js +1 -1
  154. package/lib/wip/Panel/Header/Panel.Header.Description.es.js +1 -1
  155. package/lib/wip/Panel/Header/Panel.Header.Heading.cjs.js +1 -1
  156. package/lib/wip/Panel/Header/Panel.Header.Heading.es.js +1 -1
  157. package/lib/wip/Panel/Header/Panel.Header.Row.cjs.js +1 -1
  158. package/lib/wip/Panel/Header/Panel.Header.Row.es.js +1 -1
  159. package/lib/wip/Panel/Header/Panel.Header.Subheader.cjs.js +1 -1
  160. package/lib/wip/Panel/Header/Panel.Header.Subheader.es.js +1 -1
  161. package/lib/wip/Panel/Header/Panel.Header.cjs.js +1 -1
  162. package/lib/wip/Panel/Header/Panel.Header.es.js +1 -1
  163. package/lib/wip/Panel/Panel.Body.cjs.js +1 -1
  164. package/lib/wip/Panel/Panel.Body.es.js +1 -1
  165. package/lib/wip/Panel/Panel.Inline.cjs.js +1 -1
  166. package/lib/wip/Panel/Panel.Inline.d.ts +3 -1
  167. package/lib/wip/Panel/Panel.Inline.es.js +44 -40
  168. package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -1
  169. package/lib/wip/Panel/Panel.Overlay.d.ts +18 -2
  170. package/lib/wip/Panel/Panel.Overlay.es.js +110 -84
  171. package/lib/wip/Panel/Panel.ResizeHandle.cjs.js +1 -1
  172. package/lib/wip/Panel/Panel.ResizeHandle.es.js +1 -1
  173. package/lib/wip/Panel/Panel.cjs.js +1 -1
  174. package/lib/wip/Panel/Panel.d.ts +1 -1
  175. package/lib/wip/Panel/Panel.es.js +125 -94
  176. package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
  177. package/lib/wip/Panel/Panel.helpers.d.ts +2 -1
  178. package/lib/wip/Panel/Panel.helpers.es.js +37 -35
  179. package/lib/wip/Panel/Panel.types.d.ts +64 -10
  180. package/lib/wip/Panel/Panel.useResize.cjs.js +1 -1
  181. package/lib/wip/Panel/Panel.useResize.d.ts +3 -1
  182. package/lib/wip/Panel/Panel.useResize.es.js +34 -30
  183. package/lib/wip/index.cjs.js +1 -1
  184. package/lib/wip/index.d.ts +1 -0
  185. package/lib/wip/index.es.js +4 -2
  186. package/package.json +6 -6
  187. package/utils/hooks/index.cjs.js +1 -1
  188. package/utils/hooks/index.d.ts +1 -0
  189. package/utils/hooks/index.es.js +12 -10
  190. package/utils/hooks/useElementResize.cjs.js +1 -1
  191. package/utils/hooks/useElementResize.d.ts +1 -1
  192. package/utils/hooks/useElementResize.es.js +33 -33
  193. package/utils/hooks/usePrevious.cjs.js +1 -0
  194. package/utils/hooks/usePrevious.d.ts +5 -0
  195. package/utils/hooks/usePrevious.es.js +10 -0
  196. package/assets/floatingui.css +0 -1
  197. package/chunks/dialog.module.C_6Qrg4w.js +0 -1
  198. package/chunks/floatingui.module.BcBFebz0.js +0 -10
  199. package/chunks/floatingui.module.D3Aw_aYe.js +0 -1
  200. package/chunks/panel.module.CVyUzyCZ.js +0 -1
@@ -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
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Panel/Panel.cjs.js");exports.Panel=e.Panel;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateField/DateField.cjs.js"),i=require("./Panel/Panel.cjs.js");exports.DateField=e.DateField;exports.Panel=i.Panel;
@@ -1 +1,2 @@
1
+ export * from './DateField';
1
2
  export * from './Panel';
@@ -1,4 +1,6 @@
1
- import { Panel as r } from "./Panel/Panel.es.js";
1
+ import { DateField as r } from "./DateField/DateField.es.js";
2
+ import { Panel as a } from "./Panel/Panel.es.js";
2
3
  export {
3
- r as Panel
4
+ r as DateField,
5
+ a as Panel
4
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.30.0",
3
+ "version": "2.37.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.30.0",
63
- "@viasat/beam-shared": "2.30.0",
64
- "@viasat/beam-styles": "2.30.0",
65
- "@viasat/beam-tokens": "2.30.0",
66
- "@viasat/beam-icons": "2.30.0",
62
+ "@viasat/beam-fonts": "2.37.0",
63
+ "@viasat/beam-shared": "2.37.0",
64
+ "@viasat/beam-styles": "2.37.0",
65
+ "@viasat/beam-tokens": "2.37.0",
66
+ "@viasat/beam-icons": "2.37.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;
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
  import { VoidFunction } from '@viasat/beam-shared/utils/constants';
3
3
  import { debounce } from '@viasat/beam-shared/utils/helpers';
4
4
  export { useId } from './useId';
5
+ export { usePrevious } from './usePrevious';
5
6
  export { useInteractiveProps, type UseInteractivePropsOptions, type InteractiveProps, type InteractiveElementType, } from './useInteractiveProps';
6
7
  type WaitFor = Parameters<typeof debounce>[1];
7
8
  /**
@@ -1,9 +1,10 @@
1
- import { useState as u, useEffect as d, useRef as w, useLayoutEffect as l } from "react";
2
- import { a as f } from "../../chunks/constants.CKKGf1-i.js";
1
+ import { useState as u, useEffect as d, useRef as f, useLayoutEffect as l } from "react";
2
+ import { a as w } from "../../chunks/constants.CKKGf1-i.js";
3
3
  import { d as m } from "../../chunks/helpers.CPNYYxrE.js";
4
4
  import { C as a } from "../../chunks/CSSLookup.DOOy1rxJ.js";
5
5
  import { useId as V } from "./useId.es.js";
6
- import { useInteractiveProps as M } from "./useInteractiveProps.es.js";
6
+ import { usePrevious as M } from "./usePrevious.es.js";
7
+ import { useInteractiveProps as k } from "./useInteractiveProps.es.js";
7
8
  function h(e, t = window.getComputedStyle(e)) {
8
9
  return parseInt(t.getPropertyValue("-webkit-line-clamp"), 10) >= 1 && t.getPropertyValue("display") === "-webkit-box" && t.getPropertyValue("overflow") === "hidden";
9
10
  }
@@ -25,8 +26,8 @@ const y = (e) => {
25
26
  t.style.position = "absolute", t.style.whiteSpace = "nowrap", t.style.width = "auto", t.style.height = "auto", t.style.visibility = "hidden", document.body.appendChild(t);
26
27
  const n = t.offsetWidth > e.offsetWidth;
27
28
  return document.body.removeChild(t), n;
28
- }, p = (e, t = f, n = []) => {
29
- const r = w(null);
29
+ }, p = (e, t = w, n = []) => {
30
+ const r = f(null);
30
31
  return l(() => {
31
32
  const { current: i } = r;
32
33
  if (!i) return;
@@ -43,12 +44,12 @@ const y = (e) => {
43
44
  r.current && t(b(r.current));
44
45
  }, { ref: r } = p(n);
45
46
  return { ref: r, isOverFlowing: e };
46
- }, E = (e) => {
47
+ }, P = (e) => {
47
48
  const [t, n] = u(!1), r = () => {
48
49
  i.current && n(y(i.current));
49
50
  }, { ref: i } = p(r, 200);
50
51
  return { ref: i, isTextWrapping: t };
51
- }, P = (e) => {
52
+ }, E = (e) => {
52
53
  const [t, n] = u(
53
54
  () => a.findVar(e) ?? ""
54
55
  );
@@ -99,12 +100,13 @@ const F = () => {
99
100
  }, []), e;
100
101
  };
101
102
  export {
102
- P as useCSSLookup,
103
+ E as useCSSLookup,
103
104
  V as useId,
104
- M as useInteractiveProps,
105
+ k as useInteractiveProps,
105
106
  L as useIsOverFlowing,
106
- E as useIsTextWrapping,
107
+ P as useIsTextWrapping,
107
108
  F as useMobileDetection,
109
+ M as usePrevious,
108
110
  T as useRTLDirection,
109
111
  p as useResizeObserver
110
112
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),m=(g,n,o,P=165,k=400,i=0,e="x",W=!1,M)=>{const[$,Y]=r.useState(i),h=r.useRef(0),X=r.useRef(!1),L=r.useRef(i),s=r.useRef(null),p=r.useRef(null),w=r.useRef(M);w.current=M,r.useLayoutEffect(()=>{if(!i||!n.current||!g)return;const t=e==="y"?"blockSize":"inlineSize";n.current.style[t]=`${i}px`},[]);const C=r.useCallback(t=>{if(!n.current)return;const u=k===1/0?e==="y"?window.innerHeight*.9:window.innerWidth*.5:k;if(e==="y"){const c=t.clientY-h.current,f=n.current.offsetHeight-c;f>=P&&f<=u&&(h.current=t.clientY,L.current=f,Y(f),n.current.style.blockSize=`${f}px`)}else{const c=t.clientX-h.current,v=n.current.offsetWidth,y=X.current!==W?v-c:v+c;y>=P&&y<=u&&(h.current=t.clientX,L.current=y,Y(y),n.current.style.inlineSize=`${y}px`)}},[n,P,k,e,W]),d=r.useCallback(t=>{s.current=t,p.current===null&&(p.current=requestAnimationFrame(()=>{p.current=null,s.current&&(C(s.current),s.current=null)}))},[C]),l=r.useCallback(t=>{var u,c;(u=o.current)==null||u.releasePointerCapture(t.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",l),p.current!==null&&(cancelAnimationFrame(p.current),p.current=null),s.current&&(C(s.current),s.current=null),n.current&&(n.current.style.transition=""),(c=w.current)==null||c.call(w,L.current)},[C,d,n,o]),I=r.useCallback(t=>{var u,c,v;t.preventDefault(),n.current&&(X.current=e==="x"?getComputedStyle(n.current).direction==="rtl":!1,n.current.style.transition="none"),(u=o.current)==null||u.setPointerCapture(t.pointerId),h.current=e==="y"?t.clientY:t.clientX,L.current=e==="y"?((c=n.current)==null?void 0:c.offsetHeight)??i:((v=n.current)==null?void 0:v.offsetWidth)??i,document.addEventListener("pointermove",d),document.addEventListener("pointerup",l)},[d,l,n,o,e,i]);return r.useEffect(()=>{if(!g||!o.current)return;const t=o.current;return t.addEventListener("pointerdown",I),()=>{t.removeEventListener("pointerdown",I),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",l)}},[I,d,l,g,o]),$};exports.useElementResize=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),A=(P,n,o,k=165,L=400,i=0,c="x",W=!1,Y)=>{const[q,X]=r.useState(i),l=r.useRef(0),$=r.useRef(!1),w=r.useRef(i),s=r.useRef(null),d=r.useRef(null),C=r.useRef(Y);C.current=Y,r.useLayoutEffect(()=>{if(!i||!n.current||!P)return;const t=c==="y"?"blockSize":"inlineSize";n.current.style[t]=`${i}px`},[]);const g=r.useCallback(t=>{if(!n.current)return;const e=typeof L=="function"?L():L,u=e===1/0?c==="y"?window.innerHeight*.9:window.innerWidth*.5:e;if(c==="y"){const p=t.clientY-l.current,v=n.current.offsetHeight-p;v>=k&&v<=u&&(l.current=t.clientY,w.current=v,X(v),n.current.style.blockSize=`${v}px`)}else{const p=t.clientX-l.current,M=n.current.offsetWidth,h=$.current!==W?M-p:M+p;h>=k&&h<=u&&(l.current=t.clientX,w.current=h,X(h),n.current.style.inlineSize=`${h}px`)}},[n,k,L,c,W]),f=r.useCallback(t=>{s.current=t,d.current===null&&(d.current=requestAnimationFrame(()=>{d.current=null,s.current&&(g(s.current),s.current=null)}))},[g]),y=r.useCallback(t=>{var e,u;(e=o.current)==null||e.releasePointerCapture(t.pointerId),document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",y),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null),s.current&&(g(s.current),s.current=null),n.current&&(n.current.style.transition=""),(u=C.current)==null||u.call(C,w.current)},[g,f,n,o]),I=r.useCallback(t=>{var e,u,p;t.preventDefault(),n.current&&($.current=c==="x"?getComputedStyle(n.current).direction==="rtl":!1,n.current.style.transition="none"),(e=o.current)==null||e.setPointerCapture(t.pointerId),l.current=c==="y"?t.clientY:t.clientX,w.current=c==="y"?((u=n.current)==null?void 0:u.offsetHeight)??i:((p=n.current)==null?void 0:p.offsetWidth)??i,document.addEventListener("pointermove",f),document.addEventListener("pointerup",y)},[f,y,n,o,c,i]);return r.useEffect(()=>{if(!P||!o.current)return;const t=o.current;return t.addEventListener("pointerdown",I),()=>{t.removeEventListener("pointerdown",I),document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",y)}},[I,f,y,P,o]),q};exports.useElementResize=A;
@@ -1 +1 @@
1
- export declare const useElementResize: (resizeEnabled: boolean, resizableElementRef: React.RefObject<HTMLElement>, resizeHandlerRef: React.RefObject<HTMLElement>, minSize?: number, maxSize?: number, defaultSize?: number, axis?: "x" | "y", invertX?: boolean, onDragEnd?: (size: number) => void) => number;
1
+ export declare const useElementResize: (resizeEnabled: boolean, resizableElementRef: React.RefObject<HTMLElement>, resizeHandlerRef: React.RefObject<HTMLElement>, minSize?: number, maxSize?: number | (() => number), defaultSize?: number, axis?: "x" | "y", invertX?: boolean, onDragEnd?: (size: number) => void) => number;
@@ -1,52 +1,52 @@
1
- import { useState as A, useRef as v, useLayoutEffect as F, useCallback as C, useEffect as q } from "react";
2
- const U = (I, n, o, P = 165, W = 400, e = 0, c = "x", k = !1, M) => {
3
- const [m, X] = A(e), y = v(0), $ = v(!1), w = v(e), i = v(null), s = v(null), g = v(M);
4
- g.current = M, F(() => {
5
- if (!e || !n.current || !I) return;
6
- const t = c === "y" ? "blockSize" : "inlineSize";
1
+ import { useState as m, useRef as h, useLayoutEffect as q, useCallback as I, useEffect as T } from "react";
2
+ const j = (P, n, u, W = 165, w = 400, e = 0, r = "x", k = !1, X) => {
3
+ const [F, $] = m(e), y = h(0), A = h(!1), l = h(e), i = h(null), p = h(null), g = h(X);
4
+ g.current = X, q(() => {
5
+ if (!e || !n.current || !P) return;
6
+ const t = r === "y" ? "blockSize" : "inlineSize";
7
7
  n.current.style[t] = `${e}px`;
8
8
  }, []);
9
- const l = C(
9
+ const C = I(
10
10
  (t) => {
11
11
  if (!n.current) return;
12
- const u = W === 1 / 0 ? c === "y" ? window.innerHeight * 0.9 : window.innerWidth * 0.5 : W;
13
- if (c === "y") {
14
- const r = t.clientY - y.current, h = n.current.offsetHeight - r;
15
- h >= P && h <= u && (y.current = t.clientY, w.current = h, X(h), n.current.style.blockSize = `${h}px`);
12
+ const c = typeof w == "function" ? w() : w, o = c === 1 / 0 ? r === "y" ? window.innerHeight * 0.9 : window.innerWidth * 0.5 : c;
13
+ if (r === "y") {
14
+ const s = t.clientY - y.current, v = n.current.offsetHeight - s;
15
+ v >= W && v <= o && (y.current = t.clientY, l.current = v, $(v), n.current.style.blockSize = `${v}px`);
16
16
  } else {
17
- const r = t.clientX - y.current, d = n.current.offsetWidth, L = $.current !== k ? d - r : d + r;
18
- L >= P && L <= u && (y.current = t.clientX, w.current = L, X(L), n.current.style.inlineSize = `${L}px`);
17
+ const s = t.clientX - y.current, Y = n.current.offsetWidth, L = A.current !== k ? Y - s : Y + s;
18
+ L >= W && L <= o && (y.current = t.clientX, l.current = L, $(L), n.current.style.inlineSize = `${L}px`);
19
19
  }
20
20
  },
21
- [n, P, W, c, k]
22
- ), p = C(
21
+ [n, W, w, r, k]
22
+ ), d = I(
23
23
  (t) => {
24
- i.current = t, s.current === null && (s.current = requestAnimationFrame(() => {
25
- s.current = null, i.current && (l(i.current), i.current = null);
24
+ i.current = t, p.current === null && (p.current = requestAnimationFrame(() => {
25
+ p.current = null, i.current && (C(i.current), i.current = null);
26
26
  }));
27
27
  },
28
- [l]
29
- ), f = C(
28
+ [C]
29
+ ), f = I(
30
30
  (t) => {
31
- var u, r;
32
- (u = o.current) == null || u.releasePointerCapture(t.pointerId), document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", f), s.current !== null && (cancelAnimationFrame(s.current), s.current = null), i.current && (l(i.current), i.current = null), n.current && (n.current.style.transition = ""), (r = g.current) == null || r.call(g, w.current);
31
+ var c, o;
32
+ (c = u.current) == null || c.releasePointerCapture(t.pointerId), document.removeEventListener("pointermove", d), document.removeEventListener("pointerup", f), p.current !== null && (cancelAnimationFrame(p.current), p.current = null), i.current && (C(i.current), i.current = null), n.current && (n.current.style.transition = ""), (o = g.current) == null || o.call(g, l.current);
33
33
  },
34
- [l, p, n, o]
35
- ), Y = C(
34
+ [C, d, n, u]
35
+ ), M = I(
36
36
  (t) => {
37
- var u, r, d;
38
- t.preventDefault(), n.current && ($.current = c === "x" ? getComputedStyle(n.current).direction === "rtl" : !1, n.current.style.transition = "none"), (u = o.current) == null || u.setPointerCapture(t.pointerId), y.current = c === "y" ? t.clientY : t.clientX, w.current = c === "y" ? ((r = n.current) == null ? void 0 : r.offsetHeight) ?? e : ((d = n.current) == null ? void 0 : d.offsetWidth) ?? e, document.addEventListener("pointermove", p), document.addEventListener("pointerup", f);
37
+ var c, o, s;
38
+ t.preventDefault(), n.current && (A.current = r === "x" ? getComputedStyle(n.current).direction === "rtl" : !1, n.current.style.transition = "none"), (c = u.current) == null || c.setPointerCapture(t.pointerId), y.current = r === "y" ? t.clientY : t.clientX, l.current = r === "y" ? ((o = n.current) == null ? void 0 : o.offsetHeight) ?? e : ((s = n.current) == null ? void 0 : s.offsetWidth) ?? e, document.addEventListener("pointermove", d), document.addEventListener("pointerup", f);
39
39
  },
40
- [p, f, n, o, c, e]
40
+ [d, f, n, u, r, e]
41
41
  );
42
- return q(() => {
43
- if (!I || !o.current) return;
44
- const t = o.current;
45
- return t.addEventListener("pointerdown", Y), () => {
46
- t.removeEventListener("pointerdown", Y), document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", f);
42
+ return T(() => {
43
+ if (!P || !u.current) return;
44
+ const t = u.current;
45
+ return t.addEventListener("pointerdown", M), () => {
46
+ t.removeEventListener("pointerdown", M), document.removeEventListener("pointermove", d), document.removeEventListener("pointerup", f);
47
47
  };
48
- }, [Y, p, f, I, o]), m;
48
+ }, [M, d, f, P, u]), F;
49
49
  };
50
50
  export {
51
- U as useElementResize
51
+ j as useElementResize
52
52
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function u(e){const r=t.useRef(void 0);return t.useEffect(()=>{r.current=e},[e]),r.current}exports.usePrevious=u;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the value from the previous render.
3
+ * Returns `undefined` on the first render.
4
+ */
5
+ export declare function usePrevious<T>(value: T): T | undefined;
@@ -0,0 +1,10 @@
1
+ import { useRef as t, useEffect as o } from "react";
2
+ function f(r) {
3
+ const e = t(void 0);
4
+ return o(() => {
5
+ e.current = r;
6
+ }, [r]), e.current;
7
+ }
8
+ export {
9
+ f as usePrevious
10
+ };
@@ -1 +0,0 @@
1
- .bm-floatingui{z-index:999;inset:unset;width:max-content;position:absolute;top:0;left:0}.bm-floatingui[popover]{overflow:unset;border:unset}.bm-floatingui__arrow{transform-origin:bottom;position:absolute}.bm-floatingui__overlay{background:var(--bm-comp-dialog-color-overlay);padding:var(--bm-comp-dialog-space-viewport-offset);z-index:1;justify-content:center;align-items:center;display:flex}.bm-floatingui__overlay--transparent{background:0 0}
@@ -1 +0,0 @@
1
- var i=require("../assets/dialog.css");const _={"bm-light":"bm-light","bm-dark":"bm-dark","bm-inverse":"bm-inverse","bm-enterprise":"bm-enterprise","bm-consumer":"bm-consumer","bm-dialog":"bm-dialog","bm-dialog--sm":"bm-dialog--sm","bm-dialog--md":"bm-dialog--md","bm-dialog--lg":"bm-dialog--lg","bm-dialog--xl":"bm-dialog--xl","bm-dialog__header":"bm-dialog__header","bm-dialog__header__row":"bm-dialog__header__row","bm-dialog__header__icon":"bm-dialog__header__icon","bm-dialog__header__icon--information":"bm-dialog__header__icon--information","bm-dialog__header__icon--positive":"bm-dialog__header__icon--positive","bm-dialog__header__icon--negative":"bm-dialog__header__icon--negative","bm-dialog__header__icon--warning":"bm-dialog__header__icon--warning","bm-dialog__header__heading":"bm-dialog__header__heading","bm-dialog__header__close-trigger":"bm-dialog__header__close-trigger","bm-dialog__header__description":"bm-dialog__header__description","bm-dialog__header__children":"bm-dialog__header__children","bm-dialog__header__divider":"bm-dialog__header__divider","bm-dialog__body":"bm-dialog__body","bm-dialog__footer":"bm-dialog__footer","bm-dialog__footer__divider":"bm-dialog__footer__divider","bm-dialog__footer__actions":"bm-dialog__footer__actions","bm-dialog__footer__tertiaryActions":"bm-dialog__footer__tertiaryActions"};exports.styles=_;
@@ -1,10 +0,0 @@
1
- import "../assets/floatingui.css";
2
- const i = {
3
- "bm-floatingui": "bm-floatingui",
4
- "bm-floatingui__arrow": "bm-floatingui__arrow",
5
- "bm-floatingui__overlay": "bm-floatingui__overlay",
6
- "bm-floatingui__overlay--transparent": "bm-floatingui__overlay--transparent"
7
- };
8
- export {
9
- i as f
10
- };
@@ -1 +0,0 @@
1
- var a=require("../assets/floatingui.css");const i={"bm-floatingui":"bm-floatingui","bm-floatingui__arrow":"bm-floatingui__arrow","bm-floatingui__overlay":"bm-floatingui__overlay","bm-floatingui__overlay--transparent":"bm-floatingui__overlay--transparent"};exports.floatinguiStyles=i;
@@ -1 +0,0 @@
1
- var n=require("../assets/panel.css");const e={"bm-light":"bm-light","bm-dark":"bm-dark","bm-inverse":"bm-inverse","bm-enterprise":"bm-enterprise","bm-consumer":"bm-consumer","bm-panel":"bm-panel","bm-panel--inline":"bm-panel--inline","bm-panel--overlay":"bm-panel--overlay","bm-panel--position-start":"bm-panel--position-start","bm-panel--position-end":"bm-panel--position-end","bm-panel--position-bottom":"bm-panel--position-bottom","bm-panel--size-full":"bm-panel--size-full","bm-panel--position-full":"bm-panel--position-full","bm-panel--floating":"bm-panel--floating","bm-panel--size-sm":"bm-panel--size-sm","bm-panel--size-md":"bm-panel--size-md","bm-panel--size-lg":"bm-panel--size-lg","bm-panel__body":"bm-panel__body","bm-panel--padding-sm":"bm-panel--padding-sm","bm-panel__header":"bm-panel__header","bm-panel__footer":"bm-panel__footer","bm-panel--padding-md":"bm-panel--padding-md","bm-panel__header__row":"bm-panel__header__row","bm-panel__header__content-before":"bm-panel__header__content-before","bm-panel__header__content-after":"bm-panel__header__content-after","bm-panel__header__heading":"bm-panel__header__heading","bm-panel__header__description":"bm-panel__header__description","bm-panel__header__close-button":"bm-panel__header__close-button","bm-panel__footer__actions":"bm-panel__footer__actions","bm-panel__footer__actions--start":"bm-panel__footer__actions--start","bm-panel__footer__actions--end":"bm-panel__footer__actions--end","bm-panel__footer__actions--spaceBetween":"bm-panel__footer__actions--spaceBetween","bm-panel__footer__actions--stacked":"bm-panel__footer__actions--stacked","bm-panel__overlay-divider":"bm-panel__overlay-divider","bm-panel__overlay-divider--start":"bm-panel__overlay-divider--start","bm-panel__overlay-divider--end":"bm-panel__overlay-divider--end","bm-panel__overlay-divider--bottom":"bm-panel__overlay-divider--bottom","bm-panel__resize-handle":"bm-panel__resize-handle","bm-panel--resizable":"bm-panel--resizable","bm-panel__inline-wrapper":"bm-panel__inline-wrapper","bm-panel__inline-wrapper--size-sm":"bm-panel__inline-wrapper--size-sm","bm-panel__inline-wrapper--size-md":"bm-panel__inline-wrapper--size-md","bm-panel__inline-wrapper--size-lg":"bm-panel__inline-wrapper--size-lg","bm-panel__inline-wrapper--size-full":"bm-panel__inline-wrapper--size-full","bm-panel__inline-wrapper-content":"bm-panel__inline-wrapper-content"};exports.styles=e;