@assure-one/design-system 1.29.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 +6 -5
- package/dist/index.js +2 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5692,17 +5692,18 @@ interface DisplayMenuProps {
|
|
|
5692
5692
|
triggerLabel?: string;
|
|
5693
5693
|
/** Extra classes for the trigger button. */
|
|
5694
5694
|
className?: string;
|
|
5695
|
-
/**
|
|
5696
|
-
*
|
|
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
|
/** Which side of the panel the section flyouts open on. `"auto"` (default)
|
|
5699
|
-
* opens left whenever the panel has room there —
|
|
5700
|
-
*
|
|
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
|
|
5701
5702
|
* trigger lives in a left-anchored surface (e.g. an inbox panel) and the
|
|
5702
5703
|
* free space is on the right. */
|
|
5703
5704
|
flyoutSide?: "auto" | "left" | "right";
|
|
5704
5705
|
}
|
|
5705
|
-
declare function DisplayMenu({ sections, onReset, isAtDefault, tooltip, dataTour, triggerIcon, triggerLabel, className,
|
|
5706
|
+
declare function DisplayMenu({ sections, onReset, isAtDefault, tooltip, dataTour, triggerIcon, triggerLabel, className, flyoutSide, }: DisplayMenuProps): react_jsx_runtime.JSX.Element;
|
|
5706
5707
|
|
|
5707
5708
|
declare function cn(...inputs: ClassValue[]): string;
|
|
5708
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
|
|
18279
|
+
var COLLISION_PADDING_PX = 12;
|
|
18280
18280
|
function DisplayMenu({
|
|
18281
18281
|
sections,
|
|
18282
18282
|
onReset,
|
|
@@ -18286,7 +18286,6 @@ function DisplayMenu({
|
|
|
18286
18286
|
triggerIcon,
|
|
18287
18287
|
triggerLabel = "Display",
|
|
18288
18288
|
className,
|
|
18289
|
-
gutterPx = DEFAULT_GUTTER_PX,
|
|
18290
18289
|
flyoutSide = "auto"
|
|
18291
18290
|
}) {
|
|
18292
18291
|
const [open, setOpen] = useState(false);
|
|
@@ -18296,11 +18295,9 @@ function DisplayMenu({
|
|
|
18296
18295
|
side: "left",
|
|
18297
18296
|
maxHeight: 0
|
|
18298
18297
|
});
|
|
18299
|
-
const [panelShift, setPanelShift] = useState(0);
|
|
18300
18298
|
const [rootQuery, setRootQuery] = useState("");
|
|
18301
18299
|
const [sectionQuery, setSectionQuery] = useState("");
|
|
18302
18300
|
const panelRef = useRef(null);
|
|
18303
|
-
const triggerRef = useRef(null);
|
|
18304
18301
|
const rowRefs = useRef(/* @__PURE__ */ new Map());
|
|
18305
18302
|
const openTimer = useRef(null);
|
|
18306
18303
|
const closeTimer = useRef(null);
|
|
@@ -18358,22 +18355,8 @@ function DisplayMenu({
|
|
|
18358
18355
|
setOpenKey(null);
|
|
18359
18356
|
setRootQuery("");
|
|
18360
18357
|
setSectionQuery("");
|
|
18361
|
-
setPanelShift(0);
|
|
18362
18358
|
}
|
|
18363
18359
|
}, [open, clearTimers]);
|
|
18364
|
-
useEffect(() => {
|
|
18365
|
-
if (!open) return;
|
|
18366
|
-
const reposition = () => {
|
|
18367
|
-
const trigger = triggerRef.current;
|
|
18368
|
-
if (!trigger) return;
|
|
18369
|
-
const viewport = document.documentElement.clientWidth;
|
|
18370
|
-
const shift = viewport - gutterPx - trigger.getBoundingClientRect().right;
|
|
18371
|
-
setPanelShift(Math.max(0, Math.round(shift)));
|
|
18372
|
-
};
|
|
18373
|
-
reposition();
|
|
18374
|
-
window.addEventListener("resize", reposition);
|
|
18375
|
-
return () => window.removeEventListener("resize", reposition);
|
|
18376
|
-
}, [open, gutterPx]);
|
|
18377
18360
|
const activeSection = useMemo(
|
|
18378
18361
|
() => sections.find((s) => s.key === openKey) ?? null,
|
|
18379
18362
|
[sections, openKey]
|
|
@@ -18406,7 +18389,6 @@ function DisplayMenu({
|
|
|
18406
18389
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
18407
18390
|
Button,
|
|
18408
18391
|
{
|
|
18409
|
-
ref: triggerRef,
|
|
18410
18392
|
variant: "outline",
|
|
18411
18393
|
size: "sm",
|
|
18412
18394
|
"aria-label": showDot ? `${triggerLabel} (customised)` : triggerLabel,
|
|
@@ -18432,7 +18414,7 @@ function DisplayMenu({
|
|
|
18432
18414
|
{
|
|
18433
18415
|
align: "end",
|
|
18434
18416
|
sideOffset: 6,
|
|
18435
|
-
|
|
18417
|
+
collisionPadding: COLLISION_PADDING_PX,
|
|
18436
18418
|
className: "w-64 overflow-visible p-0",
|
|
18437
18419
|
onKeyDown: (e) => {
|
|
18438
18420
|
if (e.key === "Escape" && openKey) {
|