@astryxdesign/core 0.7.16 → 0.7.17-canary.g335a172
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/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +10 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +5 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +10 -4
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +20 -8
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -1
- package/dist/DropdownMenu/menuItemRoles.js +5 -2
- package/dist/Icon/Icon.js +4 -4
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +16 -6
- package/dist/Icon/useIcon.js +5 -5
- package/dist/Item/Item.d.ts +49 -67
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +91 -99
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -1
- package/dist/List/ListItem.d.ts +5 -7
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +11 -1
- package/dist/MetadataList/MetadataListItem.d.ts +7 -2
- package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListItem.js +3 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +32 -23
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +15 -7
- package/dist/Pagination/Pagination.d.ts +25 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +87 -47
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +11 -5
- package/dist/Swipe/SwipeActionsLayer.d.ts +11 -0
- package/dist/Swipe/SwipeActionsLayer.d.ts.map +1 -0
- package/dist/Swipe/SwipeActionsLayer.js +358 -0
- package/dist/Swipe/createSwipe.d.ts +26 -0
- package/dist/Swipe/createSwipe.d.ts.map +1 -0
- package/dist/Swipe/createSwipe.js +97 -0
- package/dist/Swipe/index.d.ts +3 -0
- package/dist/Swipe/index.d.ts.map +1 -0
- package/dist/Swipe/index.js +5 -0
- package/dist/Swipe/swipeHost.d.ts +208 -0
- package/dist/Swipe/swipeHost.d.ts.map +1 -0
- package/dist/Swipe/swipeHost.js +122 -0
- package/dist/Swipe/swipeHost.stylex.d.ts +21 -0
- package/dist/Swipe/swipeHost.stylex.d.ts.map +1 -0
- package/dist/Swipe/swipeHost.stylex.js +27 -0
- package/dist/Swipe/useSwipeAction.d.ts +219 -0
- package/dist/Swipe/useSwipeAction.d.ts.map +1 -0
- package/dist/Swipe/useSwipeAction.js +1120 -0
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +2 -2
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +25 -3
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +20 -2
- package/dist/Table/tableContextMenu.d.ts +6 -0
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +10 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +10 -5
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +6 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +6 -1
- package/dist/astryx.css +29 -18
- package/dist/dragToSnapPoints/compositorSettle.d.ts +38 -0
- package/dist/dragToSnapPoints/compositorSettle.d.ts.map +1 -0
- package/dist/dragToSnapPoints/compositorSettle.js +140 -0
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts +29 -5
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts.map +1 -1
- package/dist/dragToSnapPoints/createDragToSnapPoints.js +123 -7
- package/dist/hooks/useHotkeys.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/motion/uikit/swipeActions.d.ts +148 -0
- package/dist/motion/uikit/swipeActions.d.ts.map +1 -0
- package/dist/motion/uikit/swipeActions.js +150 -0
- package/dist/privateAttributes/pressHeld.stylex.d.ts +5 -0
- package/dist/privateAttributes/pressHeld.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHeld.stylex.js +31 -0
- package/dist/theme/defineTheme.d.ts +19 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +18 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +121 -76
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/mergeComponents.d.ts +2 -1
- package/dist/theme/mergeComponents.d.ts.map +1 -1
- package/dist/theme/mergeComponents.js +18 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +4 -1
- package/package.json +10 -5
- package/src/Button/Button.tsx +16 -5
- package/src/Chat/useChatDictation.doc.mjs +246 -0
- package/src/CheckboxInput/CheckboxInput.tsx +5 -1
- package/src/ComplexSelector/ComplexSelector.tsx +20 -8
- package/src/ContextMenu/ContextMenu.tsx +22 -12
- package/src/DropdownMenu/menuItemRoles.ts +9 -6
- package/src/Icon/Icon.tsx +4 -4
- package/src/Icon/globalIconRegistry.tsx +27 -15
- package/src/Icon/useIcon.ts +5 -5
- package/src/Item/Item.doc.mjs +8 -2
- package/src/Item/Item.tsx +143 -158
- package/src/Link/Link.tsx +14 -6
- package/src/List/ListItem.doc.mjs +21 -6
- package/src/List/ListItem.tsx +16 -7
- package/src/MetadataList/MetadataListItem.doc.mjs +36 -1
- package/src/MetadataList/MetadataListItem.tsx +7 -2
- package/src/MobileNav/MobileNav.tsx +45 -28
- package/src/MultiSelector/MultiSelector.tsx +28 -11
- package/src/Pagination/Pagination.doc.mjs +39 -3
- package/src/Pagination/Pagination.tsx +122 -55
- package/src/Selector/Selector.tsx +21 -9
- package/src/Swipe/SwipeActionsLayer.tsx +438 -0
- package/src/Swipe/createSwipe.doc.mjs +118 -0
- package/src/Swipe/createSwipe.ts +112 -0
- package/src/Swipe/index.ts +6 -0
- package/src/Swipe/swipeHost.stylex.ts +27 -0
- package/src/Swipe/swipeHost.ts +255 -0
- package/src/Swipe/useSwipeAction.ts +1413 -0
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/TableCell.tsx +5 -4
- package/src/Table/TableHeaderCell.tsx +31 -3
- package/src/Table/plugins/selection/useTableSelection.tsx +18 -2
- package/src/Table/tableContextMenu.tsx +15 -1
- package/src/Toast/Toast.tsx +28 -5
- package/src/Tokenizer/Tokenizer.tsx +18 -5
- package/src/TopNav/TopNav.tsx +17 -1
- package/src/dragToSnapPoints/compositorSettle.ts +175 -0
- package/src/dragToSnapPoints/createDragToSnapPoints.ts +146 -11
- package/src/hooks/useHotkeys.doc.mjs +4 -4
- package/src/hooks/useHotkeys.ts +1 -1
- package/src/index.ts +1 -0
- package/src/motion/MEASUREMENTS.md +16 -0
- package/src/motion/README.md +1 -0
- package/src/motion/uikit/swipeActions.ts +142 -0
- package/src/privateAttributes/pressHeld.stylex.ts +31 -0
- package/src/theme/defineTheme.ts +23 -1
- package/src/theme/generateThemeRules.ts +194 -116
- package/src/theme/index.ts +1 -0
- package/src/theme/mergeComponents.ts +15 -5
- package/src/theme/syntax/useSyntaxTheme.doc.mjs +95 -0
- package/src/utils/pressFeedback.ts +8 -1
- package/dist/Item/ItemSwipeLayer.d.ts +0 -51
- package/dist/Item/ItemSwipeLayer.d.ts.map +0 -1
- package/dist/Item/ItemSwipeLayer.js +0 -282
- package/dist/Item/useSwipeAction.d.ts +0 -77
- package/dist/Item/useSwipeAction.d.ts.map +0 -1
- package/dist/Item/useSwipeAction.js +0 -551
- package/src/Item/ItemSwipeLayer.tsx +0 -400
- package/src/Item/useSwipeAction.ts +0 -752
package/dist/Item/Item.js
CHANGED
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
* those slots' own layout.
|
|
15
15
|
* @position Core layout primitive; consumed by index.ts, tested by Item.test.tsx
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
17
|
+
* Swipe actions come in through `swipe`, a value `createSwipe` makes. That
|
|
18
|
+
* value carries the swipe's runtime. This module hands the runtime the row's
|
|
19
|
+
* root and facts, then renders what it gets back. The runtime gates the row,
|
|
20
|
+
* routes its keys and attaches the gesture to the root. This module imports
|
|
21
|
+
* nothing of the gesture. Its only swipe code is the deprecated path for
|
|
22
|
+
* `swipeActions` and `swipeBehavior`. That path keeps the released loader,
|
|
23
|
+
* row style, role gate, key bridge and coexistence warning.
|
|
24
|
+
* Item.source-build.test.mjs pins the import graph.
|
|
24
25
|
*
|
|
25
26
|
* SYNC: When modified, update these files to stay in sync:
|
|
26
27
|
* - /packages/core/src/Item/Item.doc.mjs
|
|
27
28
|
* - /packages/core/src/Item/Item.test.tsx
|
|
28
|
-
* - /packages/core/src/
|
|
29
|
+
* - /packages/core/src/Swipe/swipeHost.ts
|
|
29
30
|
* - /packages/core/src/Item/index.ts
|
|
30
31
|
* - /apps/storybook/stories/Item.stories.tsx
|
|
31
32
|
* - /packages/cli/assets/templates/blocks/components/Item/ (showcase blocks)
|
|
@@ -55,33 +56,28 @@ import { rowPressLayerStyles } from "../privateAttributes/press.stylex.js";
|
|
|
55
56
|
import { isCoarsePointer } from "../utils/coarsePointer.js";
|
|
56
57
|
import { disabledInteractionProps } from "../utils/disabledInteraction.js";
|
|
57
58
|
import { usePressFeedback } from "../hooks/usePressFeedback.js";
|
|
59
|
+
import { swipeHostOf } from "../Swipe/swipeHost.js";
|
|
60
|
+
// The deprecated path's row style: a row given `swipeActions` takes it from
|
|
61
|
+
// its first render, as released.
|
|
62
|
+
import { swipeHostStyles } from "../Swipe/swipeHost.stylex.js";
|
|
63
|
+
|
|
64
|
+
// The released loader: the deprecated `swipeActions` load the gesture and the
|
|
65
|
+
// panels the first time a row has them. While the chunk loads the row is
|
|
66
|
+
// already painted and at rest. The panels show nothing at rest, so nothing
|
|
67
|
+
// appears or moves when the layer mounts.
|
|
58
68
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
59
|
-
|
|
60
|
-
// row without them never bundles useSwipeAction. While the chunk loads the
|
|
61
|
-
// row is already painted and at rest — the panels show nothing at rest, so
|
|
62
|
-
// nothing appears or moves when the layer mounts; the gesture simply attaches
|
|
63
|
-
// once the chunk is ready, as ProgressBar's and Timestamp's lazy affordances do.
|
|
64
|
-
const LazyItemSwipeLayer = /*#__PURE__*/lazy(async () => import("./ItemSwipeLayer.js"));
|
|
69
|
+
const DeprecatedSwipeLayer = /*#__PURE__*/lazy(async () => import("../Swipe/SwipeActionsLayer.js"));
|
|
65
70
|
|
|
66
71
|
// =============================================================================
|
|
67
72
|
// Types
|
|
68
73
|
// =============================================================================
|
|
69
74
|
|
|
70
75
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
76
|
+
* @deprecated Use `SwipeAction`, whose `id` is required and whose
|
|
77
|
+
* `onActivate` receives the action's `id` and the row's `itemKey`.
|
|
73
78
|
*/
|
|
74
79
|
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* `reveal`: past half the panel, or after a fling, the row rests open with
|
|
79
|
-
* every entry a real button; a long drag fires the outermost. On a side with
|
|
80
|
-
* two or more entries, only a drag that starts on the open row fires it.
|
|
81
|
-
* `commit`: a release past the commit point slides the row out and fires a
|
|
82
|
-
* side's one entry; nothing rests, and the panel is presentational. On a side
|
|
83
|
-
* with two or more entries, `commit` fires none. A fling never fires an entry.
|
|
84
|
-
*/
|
|
80
|
+
/** @deprecated Use `CreateSwipeOptions`. */
|
|
85
81
|
|
|
86
82
|
// =============================================================================
|
|
87
83
|
// Constants
|
|
@@ -94,38 +90,44 @@ const LazyItemSwipeLayer = /*#__PURE__*/lazy(async () => import("./ItemSwipeLaye
|
|
|
94
90
|
const ARIA_SELECTED_ROLES = new Set(['option', 'tab', 'row', 'gridcell', 'columnheader', 'rowheader', 'treeitem']);
|
|
95
91
|
|
|
96
92
|
/**
|
|
97
|
-
*
|
|
98
|
-
* panel's buttons may live inside the
|
|
99
|
-
* qualifies too; `option`, the `menuitem*`
|
|
93
|
+
* The deprecated path's released role gate: roles whose content model permits
|
|
94
|
+
* interactive descendants, so a swipe panel's buttons may live inside the
|
|
95
|
+
* row. A row with no role at all qualifies too; `option`, the `menuitem*`
|
|
96
|
+
* roles and the rest do not. A row given `swipe` is gated by its runtime
|
|
97
|
+
* (Swipe/createSwipe.ts).
|
|
100
98
|
*/
|
|
101
99
|
const SWIPE_ROLES = new Set(['listitem']);
|
|
102
100
|
|
|
103
101
|
/**
|
|
104
102
|
* Whether a row serves swipe actions, and so is a stacking context at rest:
|
|
105
|
-
* its root translates
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* List/ListItem.tsx raises such a row, so its touch band stays above
|
|
112
|
-
* after it.
|
|
103
|
+
* its root translates. Swipe actions need a role that permits interactive
|
|
104
|
+
* descendants, since a swipe panel holds buttons. That is a `listitem`, or no
|
|
105
|
+
* role at all. A root that is itself a link is not served, nor is a role that
|
|
106
|
+
* forbids interactive descendants. A disabled row, a row with no entry on
|
|
107
|
+
* either side, and the enlarged target of a nested control are not served
|
|
108
|
+
* either. `swipe` wins over the deprecated `swipeActions`. Internal: under a
|
|
109
|
+
* finger, List/ListItem.tsx raises such a row, so its touch band stays above
|
|
110
|
+
* the rows after it.
|
|
113
111
|
*/
|
|
114
112
|
export function servesSwipeActions({
|
|
113
|
+
swipe,
|
|
115
114
|
swipeActions,
|
|
116
115
|
isDisabled,
|
|
117
116
|
isDelegate,
|
|
118
117
|
isLinkRoot,
|
|
119
118
|
role
|
|
120
119
|
}) {
|
|
120
|
+
if (swipe != null) {
|
|
121
|
+
return swipeHostOf(swipe)?.serves({
|
|
122
|
+
role: role ?? undefined,
|
|
123
|
+
isDisabled,
|
|
124
|
+
isDelegate,
|
|
125
|
+
isLinkRoot
|
|
126
|
+
}) ?? false;
|
|
127
|
+
}
|
|
121
128
|
return swipeActions != null && ((swipeActions.leading?.length ?? 0) > 0 || (swipeActions.trailing?.length ?? 0) > 0) && !isDisabled && !isDelegate && !isLinkRoot && (role == null || SWIPE_ROLES.has(role));
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
/** The travel a drag writes on the row root, in physical px (see useSwipeAction). */
|
|
125
|
-
const SWIPE_TRAVEL = 'var(--_item-swipe-travel, 0px)';
|
|
126
|
-
/** The settle clock, `0s` while the finger drives the row. */
|
|
127
|
-
const SWIPE_DURATION = 'var(--_item-swipe-duration, 0s)';
|
|
128
|
-
|
|
129
131
|
// =============================================================================
|
|
130
132
|
// Styles
|
|
131
133
|
// =============================================================================
|
|
@@ -220,14 +222,6 @@ const styles = {
|
|
|
220
222
|
k1xSpc: "x104kibb",
|
|
221
223
|
kgKLqz: "x1ua5tub",
|
|
222
224
|
$$css: true
|
|
223
|
-
},
|
|
224
|
-
swipeRoot: {
|
|
225
|
-
kFalU9: "xge0x1e",
|
|
226
|
-
k3aq6I: "x1kncwj0",
|
|
227
|
-
k1ekBW: "xuo13n2",
|
|
228
|
-
kIyJzY: "x15p14ac",
|
|
229
|
-
kAMwcw: "x158wxwp",
|
|
230
|
-
$$css: true
|
|
231
225
|
}
|
|
232
226
|
};
|
|
233
227
|
const dynamicStyles = {
|
|
@@ -294,8 +288,9 @@ export function Item({
|
|
|
294
288
|
isHighlighted = false,
|
|
295
289
|
isSelected = false,
|
|
296
290
|
isDisabled = false,
|
|
291
|
+
swipe,
|
|
297
292
|
swipeActions,
|
|
298
|
-
swipeBehavior
|
|
293
|
+
swipeBehavior,
|
|
299
294
|
xstyle,
|
|
300
295
|
className,
|
|
301
296
|
style,
|
|
@@ -356,23 +351,40 @@ export function Item({
|
|
|
356
351
|
// card still treats it as part of its own surface.
|
|
357
352
|
const hasOwnAction = (onClick != null || href != null) && !hasParentRole && !isLinkRoot;
|
|
358
353
|
const pressOnRow = event => cancelNestedPress(event, event.currentTarget, href != null ? actionLinkRef.current : actionButtonRef.current);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
354
|
+
|
|
355
|
+
// The bridge the swipe layer fills, on a row given `swipe` and on the
|
|
356
|
+
// deprecated path. It is empty until the layer has mounted, when the
|
|
357
|
+
// forwarder below does nothing.
|
|
358
|
+
const swipeBridgeRef = useRef(null);
|
|
359
|
+
const setSwipeBridge = useCallback(bridge => {
|
|
360
|
+
swipeBridgeRef.current = bridge;
|
|
361
|
+
}, []);
|
|
362
|
+
// Swipe actions given as `swipe`: the row hands the runtime its facts and its
|
|
363
|
+
// key bridge, and renders what it gets back. Whether the row is served, and
|
|
364
|
+
// everything it is served with, is the runtime's.
|
|
365
|
+
const swipeAttachment = swipe != null ? swipeHostOf(swipe)?.attach({
|
|
366
|
+
role,
|
|
367
|
+
isDisabled,
|
|
368
|
+
isDelegate,
|
|
369
|
+
isLinkRoot
|
|
370
|
+
}, setSwipeBridge) ?? null : null;
|
|
371
|
+
|
|
372
|
+
// The deprecated path, as released, for the deprecated `swipeActions` and
|
|
373
|
+
// `swipeBehavior`. `swipe` wins over them.
|
|
374
|
+
const deprecatedSwipe = swipe == null ? swipeActions : undefined;
|
|
375
|
+
const deprecatedLeading = deprecatedSwipe?.leading ?? [];
|
|
376
|
+
const deprecatedTrailing = deprecatedSwipe?.trailing ?? [];
|
|
377
|
+
const hasDeprecatedSwipe = servesSwipeActions({
|
|
378
|
+
swipe: undefined,
|
|
379
|
+
swipeActions: deprecatedSwipe,
|
|
363
380
|
isDisabled,
|
|
364
381
|
isDelegate,
|
|
365
382
|
isLinkRoot,
|
|
366
383
|
role
|
|
367
384
|
});
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
// row without swipe actions, when the forwarders below do nothing.
|
|
372
|
-
const swipeBridgeRef = useRef(null);
|
|
373
|
-
const setSwipeBridge = useCallback(bridge => {
|
|
374
|
-
swipeBridgeRef.current = bridge;
|
|
375
|
-
}, []);
|
|
385
|
+
// The released warning for the released props.
|
|
386
|
+
useDevWarning('Item', '`swipeBehavior="commit"` fires no entry on a side with two or more ' + 'entries. Give a committing side one entry, or use ' + '`swipeBehavior="reveal"`.', hasDeprecatedSwipe && swipeBehavior === 'commit' && (deprecatedLeading.length > 1 || deprecatedTrailing.length > 1));
|
|
387
|
+
useDevWarning('Item', '`swipe` is set, so the deprecated `swipeActions` and `swipeBehavior` are ignored.', swipe != null && (swipeActions != null || swipeBehavior != null));
|
|
376
388
|
const linkRootProps = isLinkRoot ? {
|
|
377
389
|
// A disabled row keeps its place in the tree but goes nowhere.
|
|
378
390
|
href: isDisabled ? undefined : href,
|
|
@@ -559,30 +571,16 @@ export function Item({
|
|
|
559
571
|
}), trailing]
|
|
560
572
|
});
|
|
561
573
|
const mergedRef = useMergedRefs(ref, containerRef);
|
|
562
|
-
const rootRef =
|
|
574
|
+
const rootRef = isDelegate || isLinkRow ? mergedRef : ref;
|
|
563
575
|
|
|
564
|
-
// The row's own primary
|
|
565
|
-
//
|
|
576
|
+
// The row's own primary. The click the browser synthesizes after a swipe
|
|
577
|
+
// never reaches it: the gesture system swallows it.
|
|
566
578
|
const primaryOnClick = isDelegate ? containerOnClick : hasParentRole ? onClick : isInteractive ? handleContainerClick : undefined;
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
} : primaryOnClick;
|
|
573
|
-
|
|
574
|
-
// The gesture's handlers, forwarded from the root into the bridge the swipe
|
|
575
|
-
// layer fills: the root keeps the event model it had before the split — React's
|
|
576
|
-
// own pointer, click-capture and key events on the row's root — while the
|
|
577
|
-
// gesture itself lives in the lazily loaded layer. Until the layer has
|
|
578
|
-
// mounted the bridge is empty and each forwarder does nothing.
|
|
579
|
-
const swipeHandlers = hasSwipe ? {
|
|
580
|
-
onPointerDown: event => swipeBridgeRef.current?.handlers.onPointerDown(event),
|
|
581
|
-
onPointerMove: event => swipeBridgeRef.current?.handlers.onPointerMove(event),
|
|
582
|
-
onPointerUp: event => swipeBridgeRef.current?.handlers.onPointerUp(event),
|
|
583
|
-
onPointerCancel: event => swipeBridgeRef.current?.handlers.onPointerCancel(event),
|
|
584
|
-
onClickCapture: event => swipeBridgeRef.current?.handlers.onClickCapture(event),
|
|
585
|
-
onKeyDown: event => swipeBridgeRef.current?.handlers.onKeyDown(event)
|
|
579
|
+
// The root forwards its key events into the bridge the swipe layer fills, on
|
|
580
|
+
// both paths, as released. Until the layer has mounted the forwarder does
|
|
581
|
+
// nothing.
|
|
582
|
+
const swipeHandlers = swipeAttachment != null || hasDeprecatedSwipe ? {
|
|
583
|
+
onKeyDown: event => swipeBridgeRef.current?.onKeyDown(event)
|
|
586
584
|
} : undefined;
|
|
587
585
|
return /*#__PURE__*/_jsxs(Component, {
|
|
588
586
|
ref: rootRef,
|
|
@@ -592,7 +590,7 @@ export function Item({
|
|
|
592
590
|
...(isDelegate ? {
|
|
593
591
|
onPointerDown: chainEventHandlers(restProps.onPointerDown, delegatedOnPointerDown)
|
|
594
592
|
} : hasOwnAction && !isDisabled ? {
|
|
595
|
-
onPointerDown: chainEventHandlers(
|
|
593
|
+
onPointerDown: chainEventHandlers(restProps.onPointerDown, pressOnRow)
|
|
596
594
|
} : null),
|
|
597
595
|
...(isDelegate ? {
|
|
598
596
|
[PRESSABLE_CONTAINER_ATTRIBUTE]: 'true'
|
|
@@ -622,9 +620,9 @@ export function Item({
|
|
|
622
620
|
isInteractive && rowPressLayerStyles.cell,
|
|
623
621
|
// A highlighted row's fill is already the hover tone, so it shows
|
|
624
622
|
// only its press. A selected row also shows its hover.
|
|
625
|
-
isInteractive && hasStateFill && (isSelected ? rowPressLayerStyles.cellOnImage : rowPressLayerStyles.cellOnImagePressOnly), isLinkRoot && styles.linkRoot, isHighlighted && styles.highlighted, isSelected && styles.selected, isDisabled && !hasParentRole && styles.disabled,
|
|
623
|
+
isInteractive && hasStateFill && (isSelected ? rowPressLayerStyles.cellOnImage : rowPressLayerStyles.cellOnImagePressOnly), isLinkRoot && styles.linkRoot, isHighlighted && styles.highlighted, isSelected && styles.selected, isDisabled && !hasParentRole && styles.disabled, swipeAttachment?.rootStyle, hasDeprecatedSwipe && swipeHostStyles.root, xstyle), className, style),
|
|
626
624
|
role: role,
|
|
627
|
-
onClick:
|
|
625
|
+
onClick: primaryOnClick,
|
|
628
626
|
children: [/*#__PURE__*/_jsx(ItemTrailingContext, {
|
|
629
627
|
value: null,
|
|
630
628
|
children: /*#__PURE__*/_jsx(ItemDescriptionContext, {
|
|
@@ -650,19 +648,13 @@ export function Item({
|
|
|
650
648
|
})
|
|
651
649
|
})
|
|
652
650
|
})
|
|
653
|
-
}),
|
|
654
|
-
/*#__PURE__*/
|
|
655
|
-
// The panels: out-of-flow children of this root, so the DOM is the one
|
|
656
|
-
// the row had before the split. Suspense and lazy add no element, and
|
|
657
|
-
// the fallback is nothing — at rest a panel shows nothing either.
|
|
658
|
-
_jsx(Suspense, {
|
|
651
|
+
}), swipeAttachment?.layer, hasDeprecatedSwipe && /*#__PURE__*/_jsx(Suspense, {
|
|
659
652
|
fallback: null,
|
|
660
|
-
children: /*#__PURE__*/_jsx(
|
|
661
|
-
rootRef: swipeRootRef,
|
|
653
|
+
children: /*#__PURE__*/_jsx(DeprecatedSwipeLayer, {
|
|
662
654
|
onBridge: setSwipeBridge,
|
|
663
|
-
leading:
|
|
664
|
-
trailing:
|
|
665
|
-
behavior: swipeBehavior
|
|
655
|
+
leading: deprecatedLeading,
|
|
656
|
+
trailing: deprecatedTrailing,
|
|
657
|
+
behavior: swipeBehavior ?? 'reveal'
|
|
666
658
|
})
|
|
667
659
|
})]
|
|
668
660
|
});
|
package/dist/Link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgB5C,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgB5C,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AA0I/C,MAAM,WAAW,SAAU,SAAQ,SAAS,CAC1C,iBAAiB,GAAG,iBAAiB,CACtC;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;IACvD;;;;;OAKG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;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AAoB,EACpB,IAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAgB,EAChB,OAAkB,EAClB,QAAY,EACZ,QAAQ,EACR,GAAG,EAAE,YAAY,EACjB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,+BA2KX;yBApMe,IAAI"}
|
package/dist/Link/Link.js
CHANGED
|
@@ -44,6 +44,7 @@ registerEnglishFallback(english);
|
|
|
44
44
|
const styles = {
|
|
45
45
|
base: {
|
|
46
46
|
k1xSpc: "x3nfvp2",
|
|
47
|
+
ks0D6T: "x193iq5w",
|
|
47
48
|
kGNEyG: "x6s0dn4",
|
|
48
49
|
kOIVth: "x1lsbc85",
|
|
49
50
|
kMv6JI: "xjb2p0i",
|
|
@@ -58,7 +59,10 @@ const styles = {
|
|
|
58
59
|
$$css: true
|
|
59
60
|
},
|
|
60
61
|
truncating: {
|
|
61
|
-
|
|
62
|
+
k7Eaqz: "xeuugli",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
label: {
|
|
62
66
|
k7Eaqz: "xeuugli",
|
|
63
67
|
$$css: true
|
|
64
68
|
},
|
|
@@ -235,6 +239,7 @@ export function Link({
|
|
|
235
239
|
color: labelColor,
|
|
236
240
|
display: display,
|
|
237
241
|
maxLines: maxLines,
|
|
242
|
+
xstyle: styles.label,
|
|
238
243
|
children: children
|
|
239
244
|
}), isExternalWithIcon && /*#__PURE__*/_jsxs(_Fragment, {
|
|
240
245
|
children: [/*#__PURE__*/_jsx(Icon, {
|
package/dist/List/ListItem.d.ts
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
import { type ReactNode } from 'react';
|
|
35
35
|
import type { BaseProps } from '../BaseProps.js';
|
|
36
36
|
import type { ItemAlign, ItemSwipeActions, ItemSwipeBehavior } from '../Item/index.js';
|
|
37
|
+
import { type Swipe } from '../Swipe/swipeHost.js';
|
|
37
38
|
export interface ListItemProps extends BaseProps<HTMLLIElement> {
|
|
38
39
|
/** Ref forwarded to the root element */
|
|
39
40
|
ref?: React.Ref<HTMLLIElement>;
|
|
@@ -118,15 +119,12 @@ export interface ListItemProps extends BaseProps<HTMLLIElement> {
|
|
|
118
119
|
* React's `key`, which stays React's own.
|
|
119
120
|
*/
|
|
120
121
|
itemKey?: string | number;
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* clips the rows in the inline axis for them.
|
|
125
|
-
*/
|
|
122
|
+
/** Swipe actions from `createSwipe`, passed to `Item` with this row's `itemKey` added. */
|
|
123
|
+
swipe?: Swipe;
|
|
124
|
+
/** @deprecated Pass `swipe` instead. */
|
|
126
125
|
swipeActions?: ItemSwipeActions;
|
|
127
126
|
/**
|
|
128
|
-
*
|
|
129
|
-
* `Item.swipeBehavior`.
|
|
127
|
+
* @deprecated Set it in `swipe` instead.
|
|
130
128
|
* @default 'reveal'
|
|
131
129
|
*/
|
|
132
130
|
swipeBehavior?: ItemSwipeBehavior;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../src/List/ListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAuB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAS3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../src/List/ListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAuB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAS3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EA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C,EACvB,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,cAAc,EACd,IAAI,EACJ,MAAM,EACN,GAAG,EACH,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,SAAS,EACb,EAAE,aAAa,+BAwNf;yBA3Oe,QAAQ"}
|
package/dist/List/ListItem.js
CHANGED
|
@@ -48,6 +48,7 @@ import { ItemListRowContext } from "../Item/ItemListRowContext.js";
|
|
|
48
48
|
import { ItemMarkerColumnsContext } from "../Item/ItemMarkerColumnsContext.js";
|
|
49
49
|
import { ItemLabelNeededContext } from "../Item/ItemLabelContext.js";
|
|
50
50
|
import { ItemTrailingContext } from "../Item/ItemTrailingContext.js";
|
|
51
|
+
import { swipeWithItemKey } from "../Swipe/swipeHost.js";
|
|
51
52
|
import { themeProps } from "../utils/themeProps.js";
|
|
52
53
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
53
54
|
import { isReportedRow, keepPresentation } from "./listLayoutUpdates.js";
|
|
@@ -262,6 +263,13 @@ export function ListItem({
|
|
|
262
263
|
...restProps
|
|
263
264
|
}) {
|
|
264
265
|
const ctx = use(ListContext);
|
|
266
|
+
// The row's swipe, attached with its key for each action's `onActivate`.
|
|
267
|
+
// Kept per swipe value and key: a render that changes neither hands the row
|
|
268
|
+
// the same value. So an open row stays as it is.
|
|
269
|
+
const {
|
|
270
|
+
swipe
|
|
271
|
+
} = restProps;
|
|
272
|
+
const keyedSwipe = useMemo(() => swipe == null ? undefined : swipeWithItemKey(swipe, itemKey), [swipe, itemKey]);
|
|
265
273
|
// The row's element, which a row without a handle names for the reorder.
|
|
266
274
|
const rowRef = useRef(null);
|
|
267
275
|
// A List isolates its rows, so what a row raises stays below a page-level
|
|
@@ -296,6 +304,7 @@ export function ListItem({
|
|
|
296
304
|
// its band's own z-index orders only inside it, and under a finger the row
|
|
297
305
|
// raises itself. Its root is its `<li>`, never a link.
|
|
298
306
|
const isRaisedSwipeRow = isInList && isTouchTarget && servesSwipeActions({
|
|
307
|
+
swipe: restProps.swipe,
|
|
299
308
|
swipeActions: restProps.swipeActions,
|
|
300
309
|
isDisabled,
|
|
301
310
|
isDelegate: interactiveRef != null,
|
|
@@ -371,7 +380,8 @@ export function ListItem({
|
|
|
371
380
|
style
|
|
372
381
|
}),
|
|
373
382
|
...itemKeyProps(itemKey),
|
|
374
|
-
...restProps
|
|
383
|
+
...restProps,
|
|
384
|
+
swipe: keyedSwipe
|
|
375
385
|
});
|
|
376
386
|
const row = /*#__PURE__*/_jsx(ItemListRowContext, {
|
|
377
387
|
value: true,
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/MetadataList/MetadataList.doc.mjs
|
|
9
|
+
* - /packages/core/src/MetadataList/MetadataListItem.doc.mjs
|
|
9
10
|
* - /packages/core/src/MetadataList/MetadataList.test.tsx
|
|
11
|
+
* - /packages/core/src/MetadataList/MetadataListItem.test.tsx
|
|
10
12
|
* - /packages/core/src/MetadataList/index.ts
|
|
11
13
|
* - /apps/storybook/stories/MetadataList.stories.tsx
|
|
12
14
|
* - /packages/cli/assets/templates/blocks/components/MetadataList/ (showcase blocks)
|
|
@@ -14,7 +16,10 @@
|
|
|
14
16
|
import { type ReactNode } from 'react';
|
|
15
17
|
import type { BaseProps } from '../BaseProps.js';
|
|
16
18
|
export interface MetadataListItemProps extends BaseProps<HTMLDivElement> {
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Ref forwarded to the item element: the label `dt` side by side, or the
|
|
21
|
+
* stacked wrapper.
|
|
22
|
+
*/
|
|
18
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
19
24
|
/**
|
|
20
25
|
* Content value for this metadata item.
|
|
@@ -34,7 +39,7 @@ export interface MetadataListItemProps extends BaseProps<HTMLDivElement> {
|
|
|
34
39
|
'data-testid'?: string;
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
|
-
* A single labeled metadata value within
|
|
42
|
+
* A single labeled metadata value within a MetadataList.
|
|
38
43
|
*
|
|
39
44
|
* Renders a `<dt>` / `<dd>` pair. Layout (side-by-side or stacked) is
|
|
40
45
|
* determined by the parent MetadataList's label configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataListItem.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListItem.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"MetadataListItem.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAS1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,MAAM,WAAW,qBAAsB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACtE;;;OAGG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAqED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,qBAAqB,+BAwDvB;yBAlEe,gBAAgB"}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/MetadataList/MetadataList.doc.mjs
|
|
13
|
+
* - /packages/core/src/MetadataList/MetadataListItem.doc.mjs
|
|
13
14
|
* - /packages/core/src/MetadataList/MetadataList.test.tsx
|
|
15
|
+
* - /packages/core/src/MetadataList/MetadataListItem.test.tsx
|
|
14
16
|
* - /packages/core/src/MetadataList/index.ts
|
|
15
17
|
* - /apps/storybook/stories/MetadataList.stories.tsx
|
|
16
18
|
* - /packages/cli/assets/templates/blocks/components/MetadataList/ (showcase blocks)
|
|
@@ -60,7 +62,7 @@ const styles = {
|
|
|
60
62
|
// =============================================================================
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
|
-
* A single labeled metadata value within
|
|
65
|
+
* A single labeled metadata value within a MetadataList.
|
|
64
66
|
*
|
|
65
67
|
* Renders a `<dt>` / `<dd>` pair. Layout (side-by-side or stacked) is
|
|
66
68
|
* determined by the parent MetadataList's label configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNav.d.ts","sourceRoot":"","sources":["../../src/MobileNav/MobileNav.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAuBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MobileNav.d.ts","sourceRoot":"","sources":["../../src/MobileNav/MobileNav.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAuBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6M5C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,MAAM,CAAC;AAI/B;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBpE;AAkED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EACR,MAAM,EACN,KAAW,EACX,IAAa,EACb,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BAkThB;yBAjUe,SAAS"}
|
|
@@ -64,6 +64,8 @@ import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
|
64
64
|
import { themeProps } from "../utils/themeProps.js";
|
|
65
65
|
import { matchesMediaQuery } from "../utils/coarsePointer.js";
|
|
66
66
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
67
|
+
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
68
|
+
import { useIsHydrating } from "../hooks/useIsHydrating.js";
|
|
67
69
|
import { useScrollLock } from "../hooks/useScrollLock.js";
|
|
68
70
|
import { useFocusRegionContainment } from "../hooks/useFocusTrap.js";
|
|
69
71
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -364,33 +366,40 @@ export function MobileNav({
|
|
|
364
366
|
// open/close effect below, so it measures the scrollbar gutter before
|
|
365
367
|
// showModal() can hide the scrollbar.
|
|
366
368
|
useScrollLock(isOpen);
|
|
367
|
-
//
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
//
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
//
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
369
|
+
// For side='auto', the edge is resolved while rendering the transition to
|
|
370
|
+
// open (or to `auto` while open). An Effect would commit the default `end`
|
|
371
|
+
// first, so the drawer would slide in from the wrong edge. An explicit
|
|
372
|
+
// `side` is used directly.
|
|
373
|
+
const [autoSide, setAutoSide] = useState('end');
|
|
374
|
+
const [wasAutoOpen, setWasAutoOpen] = useState(false);
|
|
375
|
+
const isAutoOpen = isOpen && side === 'auto';
|
|
376
|
+
// Hydration must not read focus or layout; resolve after it.
|
|
377
|
+
const canReadDom = !useIsHydrating();
|
|
378
|
+
if (canReadDom && isAutoOpen !== wasAutoOpen) {
|
|
379
|
+
setWasAutoOpen(isAutoOpen);
|
|
380
|
+
if (isAutoOpen) {
|
|
381
|
+
// The opener is the focused element. If a tap left no focus, or focus is
|
|
382
|
+
// already inside this dialog (a server-open drawer, where showModal()
|
|
383
|
+
// ran before this render), fall back to the element whose
|
|
384
|
+
// `aria-controls` names this dialog.
|
|
385
|
+
const active = document.activeElement;
|
|
386
|
+
const hasOpenerFocus = active !== null && active !== document.body && !dialogRef.current?.contains(active);
|
|
387
|
+
const dialogIds = [dialogId, dialogRef.current?.id, rest.id];
|
|
388
|
+
const trigger = hasOpenerFocus && active ? active : Array.from(
|
|
389
|
+
// eslint-disable-next-line @eslint-react/purity -- runs only on the closed-to-open render. Never on the server or while hydrating.
|
|
390
|
+
document.querySelectorAll('[aria-controls]')).find(el => (el.getAttribute('aria-controls') ?? '').split(/\s+/).some(token => token !== '' && dialogIds.includes(token)));
|
|
391
|
+
if (trigger) {
|
|
384
392
|
const rect = trigger.getBoundingClientRect();
|
|
385
393
|
const triggerCenter = rect.left + rect.width / 2;
|
|
386
|
-
|
|
387
|
-
|
|
394
|
+
const half = window.innerWidth / 2;
|
|
395
|
+
// An opener in the inline-start half opens the drawer at the start. A
|
|
396
|
+
// centred opener opens it at the end in both directions.
|
|
397
|
+
const isInStartHalf = isRtlElement(trigger) ? triggerCenter > half : triggerCenter < half;
|
|
398
|
+
setAutoSide(isInStartHalf ? 'start' : 'end');
|
|
388
399
|
}
|
|
389
|
-
} else {
|
|
390
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- side prop changes must update the open dialog placement
|
|
391
|
-
setResolvedSide(side);
|
|
392
400
|
}
|
|
393
|
-
}
|
|
401
|
+
}
|
|
402
|
+
const resolvedSide = side === 'auto' ? autoSide : side;
|
|
394
403
|
|
|
395
404
|
// Open/close the dialog via showModal()/close()
|
|
396
405
|
// close() is delayed so the slide-out transition can play.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAWZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAe5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAcpD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["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