@assure-one/design-system 1.28.0 → 1.30.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.
package/dist/index.d.ts CHANGED
@@ -5692,11 +5692,18 @@ interface DisplayMenuProps {
5692
5692
  triggerLabel?: string;
5693
5693
  /** Extra classes for the trigger button. */
5694
5694
  className?: string;
5695
- /** Page gutter (px) the panel pins its right edge to. Defaults to the
5696
- * 24px dashboard padding; raise it for wider-inset layouts. */
5695
+ /** @deprecated Ignored since 1.30. The panel now anchors to the trigger, so
5696
+ * there is no gutter to pin to. Consumers that measured a gutter to drag the
5697
+ * panel back under its button can delete that plumbing and this prop. */
5697
5698
  gutterPx?: number;
5698
- }
5699
- declare function DisplayMenu({ sections, onReset, isAtDefault, tooltip, dataTour, triggerIcon, triggerLabel, className, gutterPx, }: DisplayMenuProps): react_jsx_runtime.JSX.Element;
5699
+ /** Which side of the panel the section flyouts open on. `"auto"` (default)
5700
+ * opens left whenever the panel has room there the usual case for a
5701
+ * Display button sitting at the right of a toolbar. Pass `"right"` when the
5702
+ * trigger lives in a left-anchored surface (e.g. an inbox panel) and the
5703
+ * free space is on the right. */
5704
+ flyoutSide?: "auto" | "left" | "right";
5705
+ }
5706
+ declare function DisplayMenu({ sections, onReset, isAtDefault, tooltip, dataTour, triggerIcon, triggerLabel, className, flyoutSide, }: DisplayMenuProps): react_jsx_runtime.JSX.Element;
5700
5707
 
5701
5708
  declare function cn(...inputs: ClassValue[]): string;
5702
5709
 
package/dist/index.js CHANGED
@@ -18276,7 +18276,7 @@ var HOVER_CLOSE_MS = 220;
18276
18276
  var FLYOUT_WIDTH = 224;
18277
18277
  var MIN_FLYOUT_HEIGHT = 120;
18278
18278
  var VIEWPORT_MARGIN = 24;
18279
- var DEFAULT_GUTTER_PX = 24;
18279
+ var COLLISION_PADDING_PX = 12;
18280
18280
  function DisplayMenu({
18281
18281
  sections,
18282
18282
  onReset,
@@ -18286,7 +18286,7 @@ function DisplayMenu({
18286
18286
  triggerIcon,
18287
18287
  triggerLabel = "Display",
18288
18288
  className,
18289
- gutterPx = DEFAULT_GUTTER_PX
18289
+ flyoutSide = "auto"
18290
18290
  }) {
18291
18291
  const [open, setOpen] = useState(false);
18292
18292
  const [openKey, setOpenKey] = useState(null);
@@ -18295,11 +18295,9 @@ function DisplayMenu({
18295
18295
  side: "left",
18296
18296
  maxHeight: 0
18297
18297
  });
18298
- const [panelShift, setPanelShift] = useState(0);
18299
18298
  const [rootQuery, setRootQuery] = useState("");
18300
18299
  const [sectionQuery, setSectionQuery] = useState("");
18301
18300
  const panelRef = useRef(null);
18302
- const triggerRef = useRef(null);
18303
18301
  const rowRefs = useRef(/* @__PURE__ */ new Map());
18304
18302
  const openTimer = useRef(null);
18305
18303
  const closeTimer = useRef(null);
@@ -18323,9 +18321,9 @@ function DisplayMenu({
18323
18321
  MIN_FLYOUT_HEIGHT,
18324
18322
  window.innerHeight - (panelRect.top + top) - VIEWPORT_MARGIN
18325
18323
  );
18326
- const side = panelRect.left >= FLYOUT_WIDTH + 16 ? "left" : "right";
18324
+ const side = flyoutSide === "auto" ? panelRect.left >= FLYOUT_WIDTH + 16 ? "left" : "right" : flyoutSide;
18327
18325
  setFlyout({ top, side, maxHeight });
18328
- }, []);
18326
+ }, [flyoutSide]);
18329
18327
  const openSection = useCallback(
18330
18328
  (key) => {
18331
18329
  clearTimers();
@@ -18357,22 +18355,8 @@ function DisplayMenu({
18357
18355
  setOpenKey(null);
18358
18356
  setRootQuery("");
18359
18357
  setSectionQuery("");
18360
- setPanelShift(0);
18361
18358
  }
18362
18359
  }, [open, clearTimers]);
18363
- useEffect(() => {
18364
- if (!open) return;
18365
- const reposition = () => {
18366
- const trigger = triggerRef.current;
18367
- if (!trigger) return;
18368
- const viewport = document.documentElement.clientWidth;
18369
- const shift = viewport - gutterPx - trigger.getBoundingClientRect().right;
18370
- setPanelShift(Math.max(0, Math.round(shift)));
18371
- };
18372
- reposition();
18373
- window.addEventListener("resize", reposition);
18374
- return () => window.removeEventListener("resize", reposition);
18375
- }, [open, gutterPx]);
18376
18360
  const activeSection = useMemo(
18377
18361
  () => sections.find((s) => s.key === openKey) ?? null,
18378
18362
  [sections, openKey]
@@ -18405,7 +18389,6 @@ function DisplayMenu({
18405
18389
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
18406
18390
  Button,
18407
18391
  {
18408
- ref: triggerRef,
18409
18392
  variant: "outline",
18410
18393
  size: "sm",
18411
18394
  "aria-label": showDot ? `${triggerLabel} (customised)` : triggerLabel,
@@ -18431,7 +18414,7 @@ function DisplayMenu({
18431
18414
  {
18432
18415
  align: "end",
18433
18416
  sideOffset: 6,
18434
- style: panelShift ? { transform: `translateX(${panelShift}px)` } : void 0,
18417
+ collisionPadding: COLLISION_PADDING_PX,
18435
18418
  className: "w-64 overflow-visible p-0",
18436
18419
  onKeyDown: (e) => {
18437
18420
  if (e.key === "Escape" && openKey) {