@jsenv/navi 0.29.355 → 0.29.357
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/dev/jsenv_navi.js +131 -114
- package/dist/dev/jsenv_navi.js.map +14 -14
- package/dist/jsenv_navi.js +106 -110
- package/dist/jsenv_navi.js.map +14 -14
- package/docs/AI_INSTRUCTIONS.md +2 -1
- package/docs/form_changed.md +27 -0
- package/docs/popup_backdrop.md +15 -15
- package/docs/popup_lift.md +3 -0
- package/docs/popup_open.md +7 -7
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -6975,7 +6975,7 @@ const css$13 = /* css */ `
|
|
|
6975
6975
|
* for free (`status`/`alert`); reach for this when the role is not enough to tell two
|
|
6976
6976
|
* callouts apart.
|
|
6977
6977
|
* @param {Function} [options.onClose] - Callback when callout is closed
|
|
6978
|
-
* @param {boolean} [options.
|
|
6978
|
+
* @param {boolean} [options.closeByPressOutside] - Whether a press outside closes the callout (defaults to true for "info" status)
|
|
6979
6979
|
* @param {boolean|number} [options.closeByScroll=false] - Dismiss the callout once the page has
|
|
6980
6980
|
* scrolled under it. `true` uses a short distance, a number sets it in pixels
|
|
6981
6981
|
* (`closeByScroll: 100` waits for 100px). Measured from where the scroll containers stood when
|
|
@@ -7043,15 +7043,15 @@ const openCallout = (
|
|
|
7043
7043
|
status = "",
|
|
7044
7044
|
testId,
|
|
7045
7045
|
onClose,
|
|
7046
|
-
|
|
7047
|
-
closeOnFocusLeave =
|
|
7046
|
+
closeByPressOutside = status === "info",
|
|
7047
|
+
closeOnFocusLeave = closeByPressOutside,
|
|
7048
7048
|
closeByScroll = false,
|
|
7049
|
+
closeButton = true,
|
|
7049
7050
|
openingEvent,
|
|
7050
7051
|
reopen = "toggle",
|
|
7051
7052
|
showErrorStack,
|
|
7052
7053
|
skipFocus = false,
|
|
7053
7054
|
icon = true,
|
|
7054
|
-
closeButton = true,
|
|
7055
7055
|
debug = () => {},
|
|
7056
7056
|
} = {},
|
|
7057
7057
|
) => {
|
|
@@ -7139,7 +7139,7 @@ const openCallout = (
|
|
|
7139
7139
|
const clickOrSpaceOutside =
|
|
7140
7140
|
reason === "click_outside" || reason === "space_outside";
|
|
7141
7141
|
if (clickOrSpaceOutside) {
|
|
7142
|
-
if (!
|
|
7142
|
+
if (!closeByPressOutside) {
|
|
7143
7143
|
return;
|
|
7144
7144
|
}
|
|
7145
7145
|
if (callout.status === "error") {
|
|
@@ -7267,9 +7267,9 @@ const openCallout = (
|
|
|
7267
7267
|
updateStatus(options.status);
|
|
7268
7268
|
}
|
|
7269
7269
|
|
|
7270
|
-
if (Object.hasOwn(options, "
|
|
7271
|
-
|
|
7272
|
-
if (
|
|
7270
|
+
if (Object.hasOwn(options, "closeByPressOutside")) {
|
|
7271
|
+
closeByPressOutside = options.closeByPressOutside;
|
|
7272
|
+
if (closeByPressOutside) {
|
|
7273
7273
|
closeOnFocusLeave = true;
|
|
7274
7274
|
}
|
|
7275
7275
|
}
|
|
@@ -7473,7 +7473,7 @@ const openCallout = (
|
|
|
7473
7473
|
const openingDownEvent =
|
|
7474
7474
|
findEvent(openingEvent, "mousedown") ||
|
|
7475
7475
|
findEvent(openingEvent, "pointerdown");
|
|
7476
|
-
if (
|
|
7476
|
+
if (closeByPressOutside && openingEvent && openingDownEvent) {
|
|
7477
7477
|
const upType =
|
|
7478
7478
|
openingDownEvent.type === "pointerdown" ? "pointerup" : "mouseup";
|
|
7479
7479
|
debug(
|
|
@@ -8718,7 +8718,7 @@ const createCalloutManager = (
|
|
|
8718
8718
|
testId: tokenData.testId,
|
|
8719
8719
|
icon: tokenData.icon,
|
|
8720
8720
|
closeButton: tokenData.closeButton,
|
|
8721
|
-
|
|
8721
|
+
closeByPressOutside: tokenData.status !== "error",
|
|
8722
8722
|
closeByScroll: tokenData.closeByScroll,
|
|
8723
8723
|
anchorElement,
|
|
8724
8724
|
openingEvent: event,
|
|
@@ -12618,7 +12618,7 @@ defineInteractionDetector({
|
|
|
12618
12618
|
// button to press, and what closes it is the hand going quiet.
|
|
12619
12619
|
skipFocus: true,
|
|
12620
12620
|
closeButton: false,
|
|
12621
|
-
|
|
12621
|
+
closeByPressOutside: false,
|
|
12622
12622
|
closeOnFocusLeave: false,
|
|
12623
12623
|
onClose: () => {
|
|
12624
12624
|
hint = null;
|
|
@@ -36306,7 +36306,7 @@ const INSIDE_ATTRIBUTE = "data-navi-popup-inside";
|
|
|
36306
36306
|
*/
|
|
36307
36307
|
const handlePressOnOutsideRegion = (
|
|
36308
36308
|
mouseDownEvent,
|
|
36309
|
-
{ popupEl, openController,
|
|
36309
|
+
{ popupEl, openController, pressOutside },
|
|
36310
36310
|
) => {
|
|
36311
36311
|
if (mouseDownEvent.button !== 0) {
|
|
36312
36312
|
return;
|
|
@@ -36329,16 +36329,13 @@ const handlePressOnOutsideRegion = (
|
|
|
36329
36329
|
) {
|
|
36330
36330
|
return;
|
|
36331
36331
|
}
|
|
36332
|
-
if (
|
|
36332
|
+
if (pressOutside === "capture") {
|
|
36333
36333
|
mouseDownEvent.preventDefault();
|
|
36334
36334
|
return;
|
|
36335
36335
|
}
|
|
36336
|
-
if (
|
|
36337
|
-
pointerInteractionOutsideEffect === "close" ||
|
|
36338
|
-
pointerInteractionOutsideEffect === "cancel"
|
|
36339
|
-
) {
|
|
36336
|
+
if (pressOutside === "close" || pressOutside === "cancel") {
|
|
36340
36337
|
openController.requestClose(mouseDownEvent, {
|
|
36341
|
-
isCancel:
|
|
36338
|
+
isCancel: pressOutside === "cancel",
|
|
36342
36339
|
});
|
|
36343
36340
|
}
|
|
36344
36341
|
};
|
|
@@ -36408,11 +36405,7 @@ const warnAboutUnreachableOutsideRegions = (popupEl) => {
|
|
|
36408
36405
|
*/
|
|
36409
36406
|
const armOutsidePressClose = (
|
|
36410
36407
|
popupEl,
|
|
36411
|
-
{
|
|
36412
|
-
openController,
|
|
36413
|
-
pointerInteractionOutsideEffect,
|
|
36414
|
-
pressEventType = "pointerdown",
|
|
36415
|
-
},
|
|
36408
|
+
{ openController, pressOutside, pressEventType = "pointerdown" },
|
|
36416
36409
|
) => {
|
|
36417
36410
|
const onDocumentPointerDown = (pointerDownEvent) => {
|
|
36418
36411
|
if (pointerDownEvent.button !== 0) {
|
|
@@ -36474,7 +36467,7 @@ const armOutsidePressClose = (
|
|
|
36474
36467
|
return;
|
|
36475
36468
|
}
|
|
36476
36469
|
openController.requestClose(pointerDownEvent, {
|
|
36477
|
-
isCancel:
|
|
36470
|
+
isCancel: pressOutside === "cancel",
|
|
36478
36471
|
});
|
|
36479
36472
|
};
|
|
36480
36473
|
document.addEventListener(pressEventType, onDocumentPointerDown, {
|
|
@@ -60468,6 +60461,9 @@ const liftPopupFromAnchor = (
|
|
|
60468
60461
|
popupEl.removeAttribute(ARRIVING_ATTRIBUTE);
|
|
60469
60462
|
};
|
|
60470
60463
|
const liftTarget = (target) => {
|
|
60464
|
+
if (lift === "box") {
|
|
60465
|
+
warnDrawingLiftedAsBox(target);
|
|
60466
|
+
}
|
|
60471
60467
|
publishBoxPaint(target);
|
|
60472
60468
|
startMovement(reveal, () => target);
|
|
60473
60469
|
};
|
|
@@ -60491,6 +60487,24 @@ const liftPopupFromAnchor = (
|
|
|
60491
60487
|
});
|
|
60492
60488
|
};
|
|
60493
60489
|
|
|
60490
|
+
// A drawing under lift="box" is drawn at its own size in a box that is not:
|
|
60491
|
+
// the big picture cropped to a corner of the shrinking box, the small one
|
|
60492
|
+
// riding a corner of the growing box, then a swap. Nothing about it errors,
|
|
60493
|
+
// and at normal speed it only reads as a jolt, so it is named here.
|
|
60494
|
+
const DRAWING_SELECTOR = "svg, img, picture, canvas, video";
|
|
60495
|
+
const warnDrawingLiftedAsBox = (liftedElement) => {
|
|
60496
|
+
let current = liftedElement;
|
|
60497
|
+
while (current) {
|
|
60498
|
+
if (current.matches(DRAWING_SELECTOR)) {
|
|
60499
|
+
console.warn(
|
|
60500
|
+
`[navi] animation="lifting" with lift="box" lifts a <${current.localName}>: its pictures keep their own size while the box moving between them changes size, so the drawing is cropped then swapped rather than scaled. For a drawing, a photo or a video, use lift="scene".`,
|
|
60501
|
+
);
|
|
60502
|
+
return;
|
|
60503
|
+
}
|
|
60504
|
+
current = sameBoxChild(current);
|
|
60505
|
+
}
|
|
60506
|
+
};
|
|
60507
|
+
|
|
60494
60508
|
const publishBoxPaint = (liftedElement) => {
|
|
60495
60509
|
const { backgroundColor, backgroundImage } = getComputedStyle(
|
|
60496
60510
|
findPaintedBox(liftedElement),
|
|
@@ -60996,7 +61010,7 @@ const css$E = /* css */`
|
|
|
60996
61010
|
--backdrop-background: var(--navi-backdrop-lift-background);
|
|
60997
61011
|
--backdrop-filter: var(--navi-backdrop-lift-backdrop-filter);
|
|
60998
61012
|
}
|
|
60999
|
-
&[data-
|
|
61013
|
+
&[data-press-outside="capture"] {
|
|
61000
61014
|
--backdrop-background: var(--navi-backdrop-capture-background);
|
|
61001
61015
|
--backdrop-filter: var(--navi-backdrop-capture-backdrop-filter);
|
|
61002
61016
|
}
|
|
@@ -61148,7 +61162,7 @@ const css$E = /* css */`
|
|
|
61148
61162
|
a real sibling element instead, same idea/CSS shape as Popover's own
|
|
61149
61163
|
.navi_popover_backdrop (see popover.jsx's top comment for the design this
|
|
61150
61164
|
mirrors). Rendered whenever backdrop={true}, whatever
|
|
61151
|
-
|
|
61165
|
+
pressOutside says: a wall that closes nothing still
|
|
61152
61166
|
absorbs the press, matching what showModal() gives a modal for free. */
|
|
61153
61167
|
.navi_dialog_backdrop {
|
|
61154
61168
|
--popup-animation-duration: 0.18s;
|
|
@@ -61188,9 +61202,9 @@ const css$E = /* css */`
|
|
|
61188
61202
|
display: none;
|
|
61189
61203
|
}
|
|
61190
61204
|
|
|
61191
|
-
/* Makes
|
|
61192
|
-
&[data-
|
|
61193
|
-
&[data-
|
|
61205
|
+
/* Makes pressOutside have a visible impact on backdrop */
|
|
61206
|
+
&[data-press-outside="close"],
|
|
61207
|
+
&[data-press-outside="cancel"] {
|
|
61194
61208
|
--backdrop-background: var(--navi-backdrop-close-background);
|
|
61195
61209
|
--backdrop-filter: var(--navi-backdrop-close-backdrop-filter);
|
|
61196
61210
|
}
|
|
@@ -61203,7 +61217,7 @@ const css$E = /* css */`
|
|
|
61203
61217
|
--backdrop-background: var(--navi-backdrop-lift-background);
|
|
61204
61218
|
--backdrop-filter: var(--navi-backdrop-lift-backdrop-filter);
|
|
61205
61219
|
}
|
|
61206
|
-
&[data-
|
|
61220
|
+
&[data-press-outside="capture"] {
|
|
61207
61221
|
--backdrop-background: var(--navi-backdrop-capture-background);
|
|
61208
61222
|
--backdrop-filter: var(--navi-backdrop-capture-backdrop-filter);
|
|
61209
61223
|
}
|
|
@@ -61458,24 +61472,24 @@ const css$E = /* css */`
|
|
|
61458
61472
|
* the dialog and the page at all — asked before any question of what an
|
|
61459
61473
|
* outside press does or how the backdrop is painted. `false` leaves the page
|
|
61460
61474
|
* reachable: a press outside closes the dialog (per
|
|
61461
|
-
* `
|
|
61475
|
+
* `pressOutside`) *and* is answered by whatever it landed
|
|
61462
61476
|
* on, in the same gesture; focus is free to leave too, the page behind being
|
|
61463
61477
|
* meant to be reached. Works in either layer — a top-layer dialog with no
|
|
61464
61478
|
* wall is shown through the Popover API rather than `showModal()`, which is
|
|
61465
61479
|
* what a sheet docked to the screen's bottom edge over a still-readable map
|
|
61466
61480
|
* needs. What it gives up is what only a modal gets natively: the hardware
|
|
61467
61481
|
* back button no longer dismisses it. See docs/popup_backdrop.md.
|
|
61468
|
-
* @param {"close"|"cancel"|"capture"|"
|
|
61469
|
-
* - `"close"` closes the dialog on an outside
|
|
61470
|
-
* both just absorb the
|
|
61482
|
+
* @param {"close"|"cancel"|"capture"|"ignore"} [props.pressOutside="close"]
|
|
61483
|
+
* - `"close"` closes the dialog on an outside press. `"capture"`/`"ignore"`
|
|
61484
|
+
* both just absorb the press without closing (visually dimmed backdrop vs.
|
|
61471
61485
|
* not) — a dialog with a backdrop is modal one way or another, so there's
|
|
61472
|
-
* always at least a
|
|
61486
|
+
* always at least a press-absorbing backdrop regardless of this prop.
|
|
61473
61487
|
* "Outside" is the dialog's own border box; a see-through dialog whose box is
|
|
61474
61488
|
* bigger than what it paints marks the difference with
|
|
61475
61489
|
* `data-navi-popup-outside` (see docs/popup_backdrop.md).
|
|
61476
61490
|
* @param {"auto"|"lift"|"discrete"|"invisible"} [props.backdropVariant="auto"]
|
|
61477
61491
|
* - How visible the backdrop is, independently of what it does. `"auto"`:
|
|
61478
|
-
* the paint `
|
|
61492
|
+
* the paint `pressOutside` implies (dimmed for
|
|
61479
61493
|
* `"close"`/`"cancel"`, blurred glass for `"capture"`), or the opaque wall
|
|
61480
61494
|
* `animation="lifting"` asks for. `"lift"`: that same opaque, blurred wall
|
|
61481
61495
|
* (`--navi-backdrop-lift-*`) asked for on its own, for a dialog whose
|
|
@@ -61855,20 +61869,20 @@ const useDialogProps = props => {
|
|
|
61855
61869
|
expand,
|
|
61856
61870
|
expandX: expandXProp,
|
|
61857
61871
|
expandY: expandYProp,
|
|
61858
|
-
// "close" (default) closes on an outside
|
|
61872
|
+
// "close" (default) closes on an outside press. "capture"/"ignore" both
|
|
61859
61873
|
// just absorb it without closing — for a modal, showModal() already makes
|
|
61860
61874
|
// the rest of the page inert, so there's nothing for a click to reach
|
|
61861
61875
|
// either way; otherwise there's no native inert-ing, so the real backdrop
|
|
61862
|
-
// below is what makes "capture"/"
|
|
61863
|
-
|
|
61876
|
+
// below is what makes "capture"/"ignore" behave the same way here too.
|
|
61877
|
+
pressOutside = "close",
|
|
61864
61878
|
// Whether there is a wall between the dialog and the page at all, asked
|
|
61865
|
-
// before what a press on it does (
|
|
61879
|
+
// before what a press on it does (pressOutside) and
|
|
61866
61880
|
// before how it is painted (backdropVariant below). It also picks the show
|
|
61867
61881
|
// call for layer="top": a wall is what showModal() is for, and without one
|
|
61868
61882
|
// the dialog goes to the same top layer through the Popover API instead.
|
|
61869
61883
|
backdrop = true,
|
|
61870
61884
|
// How loudly the backdrop says it is there — independent of what it
|
|
61871
|
-
// *does* (that's
|
|
61885
|
+
// *does* (that's pressOutside above). "lift" is the
|
|
61872
61886
|
// opaque wall at one end, "invisible" a wall that is not seen at the
|
|
61873
61887
|
// other — not the absence of one, it only stops the dim from being
|
|
61874
61888
|
// drawn.
|
|
@@ -61933,8 +61947,8 @@ const useDialogProps = props => {
|
|
|
61933
61947
|
const isTopLayer = layer === "top";
|
|
61934
61948
|
const isModal = isTopLayer && backdrop;
|
|
61935
61949
|
const isTopLayerPopover = isTopLayer && !backdrop;
|
|
61936
|
-
if (!backdrop &&
|
|
61937
|
-
console.warn(`Dialog:
|
|
61950
|
+
if (!backdrop && pressOutside === "capture") {
|
|
61951
|
+
console.warn(`Dialog: pressOutside="capture" needs a backdrop. Absorbing a press is what a wall does, and backdrop={false} takes it away.`);
|
|
61938
61952
|
}
|
|
61939
61953
|
const ref = props.ref;
|
|
61940
61954
|
const expandY = Boolean(expand) || Boolean(expandYProp);
|
|
@@ -62519,10 +62533,10 @@ const useDialogProps = props => {
|
|
|
62519
62533
|
// file's top comment), and a local one the caller asked to leave the page
|
|
62520
62534
|
// reachable. Active for the dialog's entire open lifetime, not just
|
|
62521
62535
|
// mid-transition.
|
|
62522
|
-
if ((isModal || !backdrop) && (
|
|
62536
|
+
if ((isModal || !backdrop) && (pressOutside === "close" || pressOutside === "cancel")) {
|
|
62523
62537
|
addCleanup(armOutsidePressClose(dialogEl, {
|
|
62524
62538
|
openController,
|
|
62525
|
-
|
|
62539
|
+
pressOutside,
|
|
62526
62540
|
// A modal wall spends the press the page acts on (mousedown); a
|
|
62527
62541
|
// local dialog with no wall lets that same press through
|
|
62528
62542
|
// (pointerdown). See armOutsidePressClose for why the two differ on
|
|
@@ -62622,7 +62636,7 @@ const useDialogProps = props => {
|
|
|
62622
62636
|
"navi-hidden": openController.openedInDom ? undefined : "",
|
|
62623
62637
|
"styleCSSVars": DIALOG_STYLE_CSS_VARS,
|
|
62624
62638
|
"animationDuration": rest.animationDuration,
|
|
62625
|
-
"data-
|
|
62639
|
+
"data-press-outside": pressOutside,
|
|
62626
62640
|
"data-backdrop-variant": backdropVariant,
|
|
62627
62641
|
"data-lifting": lifting ? "" : undefined,
|
|
62628
62642
|
backdropColor,
|
|
@@ -62654,7 +62668,7 @@ const useDialogProps = props => {
|
|
|
62654
62668
|
// navi-animation above. Harmless for a local dialog too (its own real
|
|
62655
62669
|
// backdrop element already gets the same attribute via backdropProps
|
|
62656
62670
|
// above, which is what its own CSS actually keys off).
|
|
62657
|
-
"data-
|
|
62671
|
+
"data-press-outside": pressOutside,
|
|
62658
62672
|
// Only load-bearing for a modal's own native ::backdrop, same "a
|
|
62659
62673
|
// pseudo-element can't carry attributes" reasoning as the prop just above
|
|
62660
62674
|
// (and harmless for a local dialog, whose real backdrop element gets it
|
|
@@ -62705,7 +62719,7 @@ const useDialogProps = props => {
|
|
|
62705
62719
|
// The top layer without a wall: showPopover() is what puts it there, and
|
|
62706
62720
|
// it only accepts an element that declares itself a popover. "manual" so
|
|
62707
62721
|
// the browser's own light dismiss stays out of it — what an outside press
|
|
62708
|
-
// does is
|
|
62722
|
+
// does is pressOutside's answer, given by the
|
|
62709
62723
|
// document-level listener in openEffect above.
|
|
62710
62724
|
"popover": isTopLayerPopover ? "manual" : undefined,
|
|
62711
62725
|
"baseClassName": "navi_dialog",
|
|
@@ -62748,7 +62762,7 @@ const useDialogProps = props => {
|
|
|
62748
62762
|
handlePressOnOutsideRegion(e, {
|
|
62749
62763
|
popupEl: ref.current,
|
|
62750
62764
|
openController,
|
|
62751
|
-
|
|
62765
|
+
pressOutside
|
|
62752
62766
|
});
|
|
62753
62767
|
},
|
|
62754
62768
|
"onKeyDown": e => {
|
|
@@ -62801,12 +62815,12 @@ const useDialogProps = props => {
|
|
|
62801
62815
|
if (popupUnderPointer && popupUnderPointer !== dialogEl && !dialogEl?.contains(popupUnderPointer)) {
|
|
62802
62816
|
return;
|
|
62803
62817
|
}
|
|
62804
|
-
if (
|
|
62818
|
+
if (pressOutside === "close" || pressOutside === "cancel") {
|
|
62805
62819
|
openController.requestClose(mouseDownEvent, {
|
|
62806
|
-
isCancel:
|
|
62820
|
+
isCancel: pressOutside === "cancel"
|
|
62807
62821
|
});
|
|
62808
62822
|
}
|
|
62809
|
-
// "capture"/"
|
|
62823
|
+
// "capture"/"ignore" both just absorb the press without closing — see
|
|
62810
62824
|
// this hook's own destructuring comment for why the two collapse to
|
|
62811
62825
|
// the same behavior for Dialog.
|
|
62812
62826
|
};
|
|
@@ -63144,13 +63158,13 @@ const css$D = /* css */`
|
|
|
63144
63158
|
display: none !important;
|
|
63145
63159
|
}
|
|
63146
63160
|
|
|
63147
|
-
/* Makes
|
|
63148
|
-
&[data-
|
|
63149
|
-
&[data-
|
|
63161
|
+
/* Makes pressOutside have a visible impact on backdrop */
|
|
63162
|
+
&[data-press-outside="close"],
|
|
63163
|
+
&[data-press-outside="cancel"] {
|
|
63150
63164
|
--backdrop-background: var(--navi-backdrop-close-background);
|
|
63151
63165
|
--backdrop-filter: var(--navi-backdrop-close-backdrop-filter);
|
|
63152
63166
|
}
|
|
63153
|
-
&[data-
|
|
63167
|
+
&[data-press-outside="capture"] {
|
|
63154
63168
|
--backdrop-background: var(--navi-backdrop-capture-background);
|
|
63155
63169
|
--backdrop-filter: var(--navi-backdrop-capture-backdrop-filter);
|
|
63156
63170
|
}
|
|
@@ -63159,7 +63173,7 @@ const css$D = /* css */`
|
|
|
63159
63173
|
specificity (class + one attribute), so these have to stay *after*
|
|
63160
63174
|
them to win. Only the paint changes: the element is still rendered
|
|
63161
63175
|
and still pointer-events: auto, so an outside click keeps doing
|
|
63162
|
-
exactly what
|
|
63176
|
+
exactly what pressOutside says. */
|
|
63163
63177
|
/* "lift": the wall a lifted popup brings (see navi_css_vars.js), asked
|
|
63164
63178
|
for on its own — a popover whose own content is what must be looked at
|
|
63165
63179
|
wants the page gone behind it, without moving out of anything. */
|
|
@@ -63244,15 +63258,15 @@ const css$D = /* css */`
|
|
|
63244
63258
|
* the popover and the page at all — asked before what an outside press does
|
|
63245
63259
|
* and before how the backdrop is painted. `false` leaves the page
|
|
63246
63260
|
* reachable: a press outside closes the popover (per
|
|
63247
|
-
* `
|
|
63261
|
+
* `pressOutside`) *and* is answered by whatever it landed
|
|
63248
63262
|
* on, in the same gesture — one press where a wall would have cost two. It
|
|
63249
63263
|
* is a `Popover`-level answer only for `"close"`/`"cancel"`; `"capture"` has
|
|
63250
|
-
* nothing left to absorb without a wall, and `"
|
|
63264
|
+
* nothing left to absorb without a wall, and `"ignore"` renders no wall anyway.
|
|
63251
63265
|
* See docs/popup_backdrop.md.
|
|
63252
|
-
* @param {"close"|"cancel"|"capture"|"
|
|
63253
|
-
* - `"
|
|
63254
|
-
* through. `"close"` closes the popover on an outside
|
|
63255
|
-
* absorbs the
|
|
63266
|
+
* @param {"close"|"cancel"|"capture"|"ignore"} [props.pressOutside="ignore"]
|
|
63267
|
+
* - `"ignore"` (default): no backdrop at all, outside presses pass straight
|
|
63268
|
+
* through. `"close"` closes the popover on an outside press. `"capture"`
|
|
63269
|
+
* absorbs the press (dims the backdrop) without closing. Note this
|
|
63256
63270
|
* default differs from `Dialog`'s own (`"close"`) — a popover is
|
|
63257
63271
|
* typically a lightweight, non-modal affordance. "Outside" is the popover's
|
|
63258
63272
|
* own border box; a see-through popover whose box is bigger than what it
|
|
@@ -63260,7 +63274,7 @@ const css$D = /* css */`
|
|
|
63260
63274
|
* docs/popup_backdrop.md).
|
|
63261
63275
|
* @param {"auto"|"lift"|"discrete"|"invisible"} [props.backdropVariant="auto"]
|
|
63262
63276
|
* - How visible the backdrop is, independently of what it does. `"auto"`:
|
|
63263
|
-
* the paint `
|
|
63277
|
+
* the paint `pressOutside` implies (dimmed for
|
|
63264
63278
|
* `"close"`/`"cancel"`, blurred glass for `"capture"`). `"lift"`: the
|
|
63265
63279
|
* opaque, blurred wall (`--navi-backdrop-lift-*`) a lifted popup brings,
|
|
63266
63280
|
* for content that is the thing to look at rather than a surface shown over
|
|
@@ -63269,7 +63283,7 @@ const css$D = /* css */`
|
|
|
63269
63283
|
* catching every outside click. This only
|
|
63270
63284
|
* changes how much the popover insists on being the thing you deal with;
|
|
63271
63285
|
* whether there is a wall to paint at all is `backdrop` above. Ignored when
|
|
63272
|
-
* there is none (`
|
|
63286
|
+
* there is none (`pressOutside="ignore"`, or
|
|
63273
63287
|
* `backdrop={false}`).
|
|
63274
63288
|
* @param {string} [props.backdropColor] - The wash painted over what is
|
|
63275
63289
|
* behind, for this popup alone: any CSS color (`"rgb(6 10 20 / 88%)"`).
|
|
@@ -63593,16 +63607,16 @@ const usePopoverProps = props => {
|
|
|
63593
63607
|
// "close" → pointer press outside closes (a plain close = commit)
|
|
63594
63608
|
// "cancel" → pointer press outside closes AS A CANCEL (revert)
|
|
63595
63609
|
// "capture"→ absorb the press, stay open
|
|
63596
|
-
// "
|
|
63597
|
-
|
|
63610
|
+
// "ignore" → no backdrop
|
|
63611
|
+
pressOutside = "ignore",
|
|
63598
63612
|
// Whether there is a wall between the popover and the page at all, asked
|
|
63599
|
-
// before what a press on it does (
|
|
63613
|
+
// before what a press on it does (pressOutside) and
|
|
63600
63614
|
// before how it is painted (backdropVariant below). false with a closing
|
|
63601
63615
|
// effect is a press that both dismisses the popover and reaches whatever
|
|
63602
63616
|
// it landed on.
|
|
63603
63617
|
backdrop = true,
|
|
63604
63618
|
// How loudly the backdrop says it is there — independent of what it
|
|
63605
|
-
// *does* (that's
|
|
63619
|
+
// *does* (that's pressOutside above). "auto" keeps
|
|
63606
63620
|
// the paint the effect implies; "lift" asks for the opaque wall, and
|
|
63607
63621
|
// "discrete"/"invisible" tone it down or stop drawing it — none of them
|
|
63608
63622
|
// gives up the outside click, a wall that is not seen is still a wall
|
|
@@ -63675,9 +63689,9 @@ const usePopoverProps = props => {
|
|
|
63675
63689
|
// animation={true} or "auto" always resolves to "sliding" or "scaling"
|
|
63676
63690
|
// (see resolveAutoAnimationKind).
|
|
63677
63691
|
const isAutoAnimation = animation === true || animation === "auto";
|
|
63678
|
-
const hasBackdrop =
|
|
63679
|
-
if (!backdrop &&
|
|
63680
|
-
console.warn(`Popover:
|
|
63692
|
+
const hasBackdrop = pressOutside !== "ignore" && backdrop;
|
|
63693
|
+
if (!backdrop && pressOutside === "capture") {
|
|
63694
|
+
console.warn(`Popover: pressOutside="capture" needs a backdrop. Absorbing a press is what a wall does, and backdrop={false} takes it away — every press outside reaches the page, exactly as with "ignore".`);
|
|
63681
63695
|
}
|
|
63682
63696
|
// positionPopover lives in openEffect's closure — created once, when the
|
|
63683
63697
|
// popover opens. Reading the placement props through a ref instead of that
|
|
@@ -63736,7 +63750,7 @@ const usePopoverProps = props => {
|
|
|
63736
63750
|
openController.getElement = () => ref.current;
|
|
63737
63751
|
openController.openEffect = e => {
|
|
63738
63752
|
const popoverEl = ref.current;
|
|
63739
|
-
// backdropEl is null when
|
|
63753
|
+
// backdropEl is null when pressOutside is "ignore" —
|
|
63740
63754
|
// the backdrop isn't rendered at all in that case.
|
|
63741
63755
|
const backdropEl = backdropRef.current;
|
|
63742
63756
|
if (!popoverEl) {
|
|
@@ -64037,10 +64051,10 @@ const usePopoverProps = props => {
|
|
|
64037
64051
|
// With no backdrop of its own to catch a press, the popover hears an
|
|
64038
64052
|
// outside one from the document and takes nothing from it: it closes, and
|
|
64039
64053
|
// the press goes on to whatever it landed on (armOutsidePressClose).
|
|
64040
|
-
if (!hasBackdrop && (
|
|
64054
|
+
if (!hasBackdrop && (pressOutside === "close" || pressOutside === "cancel")) {
|
|
64041
64055
|
addCleanup(armOutsidePressClose(popoverEl, {
|
|
64042
64056
|
openController,
|
|
64043
|
-
|
|
64057
|
+
pressOutside
|
|
64044
64058
|
}));
|
|
64045
64059
|
}
|
|
64046
64060
|
if (scrollCapture) {
|
|
@@ -64353,7 +64367,7 @@ const usePopoverProps = props => {
|
|
|
64353
64367
|
"navi-hidden": openController.openedInDom ? undefined : "",
|
|
64354
64368
|
"styleCSSVars": POPUP_STYLE_CSS_VARS,
|
|
64355
64369
|
"animationDuration": rest.animationDuration,
|
|
64356
|
-
"data-
|
|
64370
|
+
"data-press-outside": pressOutside,
|
|
64357
64371
|
"data-backdrop-variant": backdropVariant,
|
|
64358
64372
|
backdropColor,
|
|
64359
64373
|
backdropFilter,
|
|
@@ -64375,16 +64389,16 @@ const usePopoverProps = props => {
|
|
|
64375
64389
|
return;
|
|
64376
64390
|
}
|
|
64377
64391
|
// "capture" absorbs the click so it doesn't reach whatever's
|
|
64378
|
-
// behind the popover, without closing it. "
|
|
64392
|
+
// behind the popover, without closing it. "ignore" never reaches
|
|
64379
64393
|
// here at all — the backdrop isn't rendered in that case.
|
|
64380
|
-
if (
|
|
64394
|
+
if (pressOutside === "capture") {
|
|
64381
64395
|
mouseDownEvent.preventDefault();
|
|
64382
64396
|
return;
|
|
64383
64397
|
}
|
|
64384
64398
|
// "close" commits (plain close), "cancel" reverts. Both dismiss.
|
|
64385
|
-
if (
|
|
64399
|
+
if (pressOutside === "close" || pressOutside === "cancel") {
|
|
64386
64400
|
openController.requestClose(mouseDownEvent, {
|
|
64387
|
-
isCancel:
|
|
64401
|
+
isCancel: pressOutside === "cancel"
|
|
64388
64402
|
});
|
|
64389
64403
|
return;
|
|
64390
64404
|
}
|
|
@@ -64448,7 +64462,7 @@ const usePopoverProps = props => {
|
|
|
64448
64462
|
handlePressOnOutsideRegion(e, {
|
|
64449
64463
|
popupEl: ref.current,
|
|
64450
64464
|
openController,
|
|
64451
|
-
|
|
64465
|
+
pressOutside
|
|
64452
64466
|
});
|
|
64453
64467
|
},
|
|
64454
64468
|
"onKeyDown": e => {
|
|
@@ -64595,15 +64609,15 @@ const css$C = /* css */`@layer navi {
|
|
|
64595
64609
|
* `Popover` have different own defaults (`"center"` vs. `"bottom"`),
|
|
64596
64610
|
* deliberately not homogenized here (each reads best for its own typical
|
|
64597
64611
|
* use case).
|
|
64598
|
-
* @param {"close"|"cancel"|"capture"|"
|
|
64612
|
+
* @param {"close"|"cancel"|"capture"|"ignore"} [props.pressOutside="close"]
|
|
64599
64613
|
* - Forwarded to whichever component renders, defaulted here to `"close"`
|
|
64600
|
-
* specifically to override `Popover`'s own different default (`"
|
|
64614
|
+
* specifically to override `Popover`'s own different default (`"ignore"`)
|
|
64601
64615
|
* — without this, the exact same `<Popup>` usage would behave
|
|
64602
|
-
* differently (close
|
|
64616
|
+
* differently (close on an outside press or not) purely based on which mode
|
|
64603
64617
|
* the screen-size check happens to pick, which defeats the point of
|
|
64604
64618
|
* having one shared API in the first place. Note this only says what a
|
|
64605
64619
|
* press outside *does*; whether it reaches the page at all is `backdrop`
|
|
64606
|
-
* below, and `"
|
|
64620
|
+
* below, and `"ignore"`/`"capture"` describe a wall either way — the popup
|
|
64607
64621
|
* absorbs the press without closing, dimmed or not.
|
|
64608
64622
|
* @param {boolean} [props.backdrop] - Whether anything is laid between the
|
|
64609
64623
|
* popup and the page at all: `false` lets a press outside both dismiss the
|
|
@@ -64617,7 +64631,7 @@ const css$C = /* css */`@layer navi {
|
|
|
64617
64631
|
* as-is to whichever component renders (both understand it identically):
|
|
64618
64632
|
* how visible the backdrop is, independently of what an outside click
|
|
64619
64633
|
* does — a wall that is not seen is still a wall (that is `backdrop`
|
|
64620
|
-
* above). Unlike `
|
|
64634
|
+
* above). Unlike `pressOutside`, this one needs no
|
|
64621
64635
|
* default here — `"auto"` already means the same thing on both sides.
|
|
64622
64636
|
* @param {string} [props.backdropColor] - Forwarded as-is (both understand it
|
|
64623
64637
|
* identically): the wash the backdrop paints over what is behind.
|
|
@@ -64679,10 +64693,10 @@ const Popup = props => {
|
|
|
64679
64693
|
className,
|
|
64680
64694
|
children,
|
|
64681
64695
|
// Both default here (not left to each component's own, *different*
|
|
64682
|
-
// default — Dialog's own is "close", Popover's own is "
|
|
64696
|
+
// default — Dialog's own is "close", Popover's own is "ignore") so the
|
|
64683
64697
|
// exact same <Popup> usage behaves identically regardless of which
|
|
64684
64698
|
// mode the automatic screen-size resolution happens to pick.
|
|
64685
|
-
|
|
64699
|
+
pressOutside = "close",
|
|
64686
64700
|
backdrop,
|
|
64687
64701
|
// Popover-only (see this component's own doc) — destructured out so
|
|
64688
64702
|
// they're never part of ...rest, and therefore never forwarded to
|
|
@@ -64718,7 +64732,7 @@ const Popup = props => {
|
|
|
64718
64732
|
sizeFromAnchor: sizeFromAnchor,
|
|
64719
64733
|
lift: lift,
|
|
64720
64734
|
maxWidth: maxWidth,
|
|
64721
|
-
|
|
64735
|
+
pressOutside: pressOutside,
|
|
64722
64736
|
backdrop: backdrop,
|
|
64723
64737
|
className: withPropsClassName("navi_popup", className),
|
|
64724
64738
|
expand: expand,
|
|
@@ -64731,7 +64745,7 @@ const Popup = props => {
|
|
|
64731
64745
|
return jsx(Popover, {
|
|
64732
64746
|
...rest,
|
|
64733
64747
|
maxWidth: maxWidth,
|
|
64734
|
-
|
|
64748
|
+
pressOutside: pressOutside,
|
|
64735
64749
|
backdrop: backdrop,
|
|
64736
64750
|
marginWithAnchor: marginWithAnchor,
|
|
64737
64751
|
focusCapture: focusCapture,
|
|
@@ -65541,7 +65555,7 @@ const PickerContentInsidePopup = props => {
|
|
|
65541
65555
|
// Clicking outside the popup closes it and COMMITS by default (fires the
|
|
65542
65556
|
// action if the value changed) — Escape still cancels. Pass "cancel" to make
|
|
65543
65557
|
// clicking outside revert instead, or "capture" to keep it open.
|
|
65544
|
-
|
|
65558
|
+
pressOutside = "close",
|
|
65545
65559
|
// Named/forwarded rather than left in ...rest: rest goes to the picker
|
|
65546
65560
|
// element itself, not the popup, and these belong to the popup.
|
|
65547
65561
|
backdrop,
|
|
@@ -65662,7 +65676,7 @@ const PickerContentInsidePopup = props => {
|
|
|
65662
65676
|
marginWithAnchor: isPopover ? popoverSpacing : undefined,
|
|
65663
65677
|
marginWithContainer: marginWithContainer === undefined && isPopover ? popoverSpacing : marginWithContainer,
|
|
65664
65678
|
scrollCapture: scrollCapture,
|
|
65665
|
-
|
|
65679
|
+
pressOutside: pointerLock ? "capture" : pressOutside,
|
|
65666
65680
|
backdrop: backdrop,
|
|
65667
65681
|
backdropVariant: backdropVariant,
|
|
65668
65682
|
backdropColor: backdropColor,
|
|
@@ -75120,7 +75134,7 @@ const PickerFirstResolver = props => {
|
|
|
75120
75134
|
* marginWithContainer?: number | string,
|
|
75121
75135
|
* anchor?: import("ignore:preact").RefObject<HTMLElement> | HTMLElement,
|
|
75122
75136
|
* escapeEffect?: "cancel" | "close",
|
|
75123
|
-
*
|
|
75137
|
+
* pressOutside?: "close" | "cancel" | "capture",
|
|
75124
75138
|
* backdrop?: boolean,
|
|
75125
75139
|
* backdropVariant?: "auto" | "lift" | "discrete" | "invisible",
|
|
75126
75140
|
* backdropColor?: string,
|
|
@@ -75470,8 +75484,8 @@ const PickerFirstResolver = props => {
|
|
|
75470
75484
|
* part of that group's value and nothing that group does — distributing,
|
|
75471
75485
|
* resetting, validating — reaches it. For a door that only opens something,
|
|
75472
75486
|
* and for a picker that commits on its own inside a form.
|
|
75473
|
-
* @param {"close"|"cancel"|"capture"} [
|
|
75474
|
-
* What a
|
|
75487
|
+
* @param {"close"|"cancel"|"capture"} [pressOutside="close"]
|
|
75488
|
+
* What a press outside the popup does: close and keep ("close"), close and
|
|
75475
75489
|
* put back the value at open ("cancel"), or nothing at all ("capture"). The
|
|
75476
75490
|
* default is what gives a popup with no confirm button its way out that
|
|
75477
75491
|
* keeps — see the same section.
|
|
@@ -75485,7 +75499,7 @@ const PickerFirstResolver = props => {
|
|
|
75485
75499
|
* leaves the plan behind it live.
|
|
75486
75500
|
* @param {"auto"|"lift"|"discrete"|"invisible"} [backdropVariant="auto"] How
|
|
75487
75501
|
* visible the popup's backdrop is, independently of what a click outside
|
|
75488
|
-
* does: `"auto"` is the paint `
|
|
75502
|
+
* does: `"auto"` is the paint `pressOutside` implies,
|
|
75489
75503
|
* `"lift"` the opaque blurred wall `animation="lifting"` brings, asked for
|
|
75490
75504
|
* without the movement, `"discrete"` a barely-there dim, `"invisible"` fully
|
|
75491
75505
|
* transparent — a wall that is not seen is still a wall, which is what
|
|
@@ -78099,7 +78113,7 @@ const css$n = /* css */`.navi_split_button {
|
|
|
78099
78113
|
* backdropVariant?: "auto" | "lift" | "discrete" | "invisible",
|
|
78100
78114
|
* backdropColor?: string,
|
|
78101
78115
|
* backdropFilter?: string,
|
|
78102
|
-
*
|
|
78116
|
+
* pressOutside?: "close" | "cancel" | "capture",
|
|
78103
78117
|
* escapeEffect?: "cancel" | "close",
|
|
78104
78118
|
* popupLayer?: "top" | "local",
|
|
78105
78119
|
* popupTestId?: string,
|
|
@@ -78146,7 +78160,7 @@ const css$n = /* css */`.navi_split_button {
|
|
|
78146
78160
|
* `marginWithContainer`, `popoverMode`, `popoverSpacing`, `popupLayer`,
|
|
78147
78161
|
* `popupTestId`, `popupWidthFitContent`, `popoverMaxHeight`, `backdrop`,
|
|
78148
78162
|
* `backdropVariant`, `backdropColor`, `backdropFilter`,
|
|
78149
|
-
* `
|
|
78163
|
+
* `pressOutside`, `escapeEffect`, `closeOnFocusOut`,
|
|
78150
78164
|
* `scrollCapture`, `focusCapture`, `popupBackgroundColor`,
|
|
78151
78165
|
* `popupBorderRadius`, `animation`. See picker.jsx for what each one says.
|
|
78152
78166
|
* Anything else lands on the split button's own box.
|
|
@@ -78346,7 +78360,7 @@ const SplitButton = props => {
|
|
|
78346
78360
|
// What the Picker's popup answers to — Picker's own popup props, named here so
|
|
78347
78361
|
// a caller reaches all of them through the split button (see picker.jsx's JSDoc
|
|
78348
78362
|
// for what each one says).
|
|
78349
|
-
const POPUP_PROP_SET = new Set(["mode", "popupLayer", "popupTestId", "positionArea", "popoverMode", "popoverSpacing", "popupWidthFitContent", "popoverMaxHeight", "dialogMinWidth", "dialogMinHeight", "dialogMaxWidth", "dialogMaxHeight", "dialogExpand", "dialogExpandX", "dialogExpandY", "dockedOnSmallTouchScreen", "marginWithContainer", "backdrop", "backdropVariant", "backdropColor", "backdropFilter", "
|
|
78363
|
+
const POPUP_PROP_SET = new Set(["mode", "popupLayer", "popupTestId", "positionArea", "popoverMode", "popoverSpacing", "popupWidthFitContent", "popoverMaxHeight", "dialogMinWidth", "dialogMinHeight", "dialogMaxWidth", "dialogMaxHeight", "dialogExpand", "dialogExpandX", "dialogExpandY", "dockedOnSmallTouchScreen", "marginWithContainer", "backdrop", "backdropVariant", "backdropColor", "backdropFilter", "pressOutside", "escapeEffect", "closeOnFocusOut", "scrollCapture", "focusCapture", "popupBackgroundColor", "popupBorderRadius", "animation"]);
|
|
78350
78364
|
const splitPopupProps = props => {
|
|
78351
78365
|
const popupProps = {};
|
|
78352
78366
|
const boxProps = {};
|
|
@@ -87832,19 +87846,19 @@ const css = /* css */`.navi_side_panel {
|
|
|
87832
87846
|
* (`slide-from-<side>`); `"fading"` is the other common choice. Other
|
|
87833
87847
|
* values are forwarded as-is but not a documented/encouraged part of this
|
|
87834
87848
|
* component's own API.
|
|
87835
|
-
* @param {boolean} [props.
|
|
87836
|
-
* maps to `
|
|
87849
|
+
* @param {boolean} [props.closeByPressOutside=false] - `false` (default):
|
|
87850
|
+
* maps to `pressOutside="ignore"` — in popover mode, no
|
|
87837
87851
|
* backdrop at all, outside clicks pass straight through; in dialog mode,
|
|
87838
87852
|
* the outside click is absorbed by the panel's own wall but changes
|
|
87839
87853
|
* nothing. Pass `backdrop={false}` (forwarded to `Popup`) for a panel with
|
|
87840
87854
|
* no wall in either mode, whose outside presses reach the page. `true`:
|
|
87841
|
-
* closes the panel on an outside
|
|
87855
|
+
* closes the panel on an outside press instead, and also enables trapping
|
|
87842
87856
|
* Tab navigation inside the panel (`focusCapture`) — closing on outside
|
|
87843
87857
|
* interaction only makes sense paired with not letting focus silently
|
|
87844
87858
|
* leave the panel first. A box of the page whose press must not close the
|
|
87845
87859
|
* panel (a card that fills it) names the panel:
|
|
87846
87860
|
* `data-navi-popup-inside={id}` — see docs/popup_backdrop.md.
|
|
87847
|
-
* @param {boolean} [props.
|
|
87861
|
+
* @param {boolean} [props.closeByDrag=true] - Pushing the panel back
|
|
87848
87862
|
* towards the edge it is docked to closes it: the panel follows the
|
|
87849
87863
|
* pointer and finishes leaving (or comes back to rest) when it is
|
|
87850
87864
|
* released. Set to `false` for a panel that must only ever be dismissed
|
|
@@ -87853,13 +87867,16 @@ const css = /* css */`.navi_side_panel {
|
|
|
87853
87867
|
* one underlying renderer instead of its automatic screen-size
|
|
87854
87868
|
* resolution. Note that if `Popup` ends up in dialog mode (small screen, or
|
|
87855
87869
|
* forced here), the panel is modal unless it says `backdrop={false}`:
|
|
87856
|
-
* `
|
|
87870
|
+
* `closeByPressOutside`/`pressOutside` only say what a
|
|
87857
87871
|
* press on the wall does, not whether there is one (see `dialog.jsx`'s own
|
|
87858
87872
|
* doc).
|
|
87859
87873
|
* @param {import("ignore:preact").ComponentChildren} props.children - No built-in
|
|
87860
87874
|
* close button — add one wherever it makes sense for the layout (e.g. a
|
|
87861
87875
|
* plain `<Button command="--navi-close">`), use `SidePanel.Head`'s own
|
|
87862
|
-
* `closeButton` prop, or rely on `
|
|
87876
|
+
* `closeButton` prop, or rely on `closeByPressOutside`/Escape instead.
|
|
87877
|
+
* A form sent inside the panel closes it, as in any popup: a panel one
|
|
87878
|
+
* keeps editing in says `command="--navi-void"` on that form (see
|
|
87879
|
+
* docs/form_changed.md).
|
|
87863
87880
|
*/
|
|
87864
87881
|
const SidePanel = ({
|
|
87865
87882
|
open,
|
|
@@ -87874,15 +87891,15 @@ const SidePanel = ({
|
|
|
87874
87891
|
minWidth,
|
|
87875
87892
|
minHeight,
|
|
87876
87893
|
animation,
|
|
87877
|
-
|
|
87878
|
-
|
|
87894
|
+
closeByPressOutside = false,
|
|
87895
|
+
closeByDrag = true,
|
|
87879
87896
|
mode,
|
|
87880
87897
|
layer = "top",
|
|
87881
87898
|
className,
|
|
87882
87899
|
...rest
|
|
87883
87900
|
}) => {
|
|
87884
87901
|
import.meta.css = [css, "@jsenv/navi/src/layout/side_panel.jsx"];
|
|
87885
|
-
const onSwipePointerDown =
|
|
87902
|
+
const onSwipePointerDown = closeByDrag ? createSwipeToClose(side) : null;
|
|
87886
87903
|
return jsx(Popup, {
|
|
87887
87904
|
mode: mode
|
|
87888
87905
|
// Spread rather than written: the collision warning between `signal` and
|
|
@@ -87905,26 +87922,26 @@ const SidePanel = ({
|
|
|
87905
87922
|
,
|
|
87906
87923
|
marginWithContainer: 0,
|
|
87907
87924
|
animation: animation === true ? `slide-from-${side}` : animation,
|
|
87908
|
-
|
|
87909
|
-
focusCapture:
|
|
87925
|
+
pressOutside: closeByPressOutside ? "close" : "ignore",
|
|
87926
|
+
focusCapture: closeByPressOutside,
|
|
87910
87927
|
minWidth: toCssLength(minWidth),
|
|
87911
87928
|
minHeight: toCssLength(minHeight),
|
|
87912
87929
|
className: withPropsClassName("navi_side_panel", className),
|
|
87913
87930
|
"navi-side": side,
|
|
87914
|
-
"data-swipe-to-close":
|
|
87931
|
+
"data-swipe-to-close": closeByDrag ? "" : undefined
|
|
87915
87932
|
// The axis the panel travels on when it is pushed back, said to the
|
|
87916
87933
|
// shared gesture layer: it keeps the panel's scrolling from spilling onto
|
|
87917
87934
|
// the page, and it is what a box travelling inside the panel reads to
|
|
87918
87935
|
// know this axis is already walked (see @jsenv/dom's drag_to_travel).
|
|
87919
87936
|
,
|
|
87920
|
-
"data-drag-travel":
|
|
87921
|
-
"data-travel-by-drag":
|
|
87937
|
+
"data-drag-travel": closeByDrag ? SWIPE_AXIS_BY_SIDE[side] : undefined,
|
|
87938
|
+
"data-travel-by-drag": closeByDrag ? SWIPE_AXIS_BY_SIDE[side] : undefined
|
|
87922
87939
|
// A touch this panel may take has to be refusable before the finger
|
|
87923
87940
|
// lands, or the browser can cancel the close gesture mid-swipe by
|
|
87924
87941
|
// scrolling the panel's content — see keepTouchRefusable for why a JSX
|
|
87925
87942
|
// prop is enough (an element-level touchmove listener is non-passive).
|
|
87926
87943
|
,
|
|
87927
|
-
onTouchMove:
|
|
87944
|
+
onTouchMove: closeByDrag ? keepTouchRefusable : undefined,
|
|
87928
87945
|
...rest,
|
|
87929
87946
|
onPointerDown: pointerDownEvent => {
|
|
87930
87947
|
rest.onPointerDown?.(pointerDownEvent);
|