@astryxdesign/core 0.7.8-canary.fbb81c6 → 0.7.8
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/CHANGELOG.md +132 -0
- package/dist/ClickableCard/ClickableCard.d.ts +1 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +1 -5
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +1 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -9
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +4 -9
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +2 -3
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +2 -3
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +2 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +2 -3
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +1 -6
- package/dist/Layer/preserveAnimations.d.ts +5 -1
- package/dist/Layer/preserveAnimations.d.ts.map +1 -1
- package/dist/Layer/preserveAnimations.js +214 -12
- package/dist/MoreMenu/MoreMenu.d.ts +3 -5
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +1 -5
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +1 -3
- package/dist/astryx.css +2 -6
- package/dist/hooks/menuPressGesture.d.ts +21 -132
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +30 -155
- package/dist/hooks/useClickableContainer.d.ts +5 -19
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +5 -28
- package/dist/hooks/useMenuPress.d.ts +1 -34
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +5 -93
- package/dist/motion/transientCopy.d.ts +2 -4
- package/dist/motion/transientCopy.d.ts.map +1 -1
- package/dist/motion/transientCopy.js +5 -34
- package/dist/motion/uikit/gestures.d.ts +0 -41
- package/dist/motion/uikit/gestures.d.ts.map +1 -1
- package/dist/motion/uikit/gestures.js +0 -25
- package/dist/motion/uikit/index.d.ts +1 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +1 -1
- package/dist/utils/pressFeedback.d.ts +0 -7
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +1 -16
- package/package.json +5 -5
- package/src/ClickableCard/ClickableCard.tsx +1 -8
- package/src/DateInput/PickerWheel.tsx +2 -7
- package/src/DropdownMenu/DropdownMenu.doc.mjs +2 -1
- package/src/DropdownMenu/DropdownMenu.tsx +5 -29
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +1 -5
- package/src/DropdownMenu/DropdownMenuItem.tsx +4 -8
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +1 -5
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +1 -5
- package/src/Item/Item.tsx +5 -15
- package/src/Layer/preserveAnimations.ts +275 -12
- package/src/MoreMenu/MoreMenu.doc.mjs +4 -2
- package/src/MoreMenu/MoreMenu.tsx +3 -5
- package/src/SelectableCard/SelectableCard.tsx +1 -8
- package/src/TreeList/TreeListItem.tsx +6 -8
- package/src/hooks/menuPressGesture.ts +38 -243
- package/src/hooks/useClickableContainer.doc.mjs +2 -8
- package/src/hooks/useClickableContainer.ts +6 -52
- package/src/hooks/useMenuPress.ts +11 -118
- package/src/motion/MEASUREMENTS.md +0 -11
- package/src/motion/transientCopy.ts +5 -45
- package/src/motion/uikit/gestures.ts +0 -22
- package/src/motion/uikit/index.ts +0 -1
- package/src/utils/pressFeedback.ts +1 -16
- package/dist/hooks/menuPressValues.d.ts +0 -16
- package/dist/hooks/menuPressValues.d.ts.map +0 -1
- package/dist/hooks/menuPressValues.js +0 -18
- package/dist/motion/carryAnimations.d.ts +0 -58
- package/dist/motion/carryAnimations.d.ts.map +0 -1
- package/dist/motion/carryAnimations.js +0 -305
- package/dist/privateAttributes/menuPressLit.stylex.d.ts +0 -52
- package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +0 -1
- package/dist/privateAttributes/menuPressLit.stylex.js +0 -99
- package/src/hooks/menuPressValues.ts +0 -18
- package/src/motion/carryAnimations.ts +0 -389
- package/src/privateAttributes/menuPressLit.stylex.ts +0 -104
|
@@ -15,12 +15,9 @@
|
|
|
15
15
|
* technology, carries no ids or test ids, joins no form or radio group (a
|
|
16
16
|
* copied checked radio would uncheck the live one), and its frames and media
|
|
17
17
|
* load nothing. Laying it out changes no ancestor's position, and a scaled
|
|
18
|
-
* host draws it at the old size.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Laid in a host outside the element's own ancestors, it keeps what it
|
|
22
|
-
* inherited from them: its inherited properties and custom properties that
|
|
23
|
-
* differ from the host's are written on it.
|
|
18
|
+
* host draws it at the old size. Laid in a host outside the element's own
|
|
19
|
+
* ancestors, it keeps what it inherited from them: its inherited properties
|
|
20
|
+
* and custom properties that differ from the host's are written on it.
|
|
24
21
|
* Limits: a rule keyed on a removed `id`, or matched through an ancestor
|
|
25
22
|
* between the host and the element (`.collapsed .label`), does not style the
|
|
26
23
|
* copy as it styled the element; and content holding a canvas whose pixels read back
|
|
@@ -31,8 +28,6 @@
|
|
|
31
28
|
* SYNC: When modified, update /packages/core/src/motion/animatedLayout.ts
|
|
32
29
|
*/
|
|
33
30
|
|
|
34
|
-
import { carryAnimations, saveAnimations } from "./carryAnimations.js";
|
|
35
|
-
|
|
36
31
|
/** Above this many elements, old content is not copied: the new one enters. */
|
|
37
32
|
const MAX_COPIED_ELEMENTS = 1500;
|
|
38
33
|
|
|
@@ -120,19 +115,11 @@ function readInherited(element) {
|
|
|
120
115
|
/** Scroll offsets a copy restores once laid out (a clone carries none). */
|
|
121
116
|
const scrollOffsets = new WeakMap();
|
|
122
117
|
|
|
123
|
-
/**
|
|
124
|
-
* The CSS animations and transitions a copy's element ran, and the copy of
|
|
125
|
-
* each element in the copied subtree. The copy carries them on once laid out
|
|
126
|
-
* (`placeOver`).
|
|
127
|
-
*/
|
|
128
|
-
const carriedMotion = new WeakMap();
|
|
129
|
-
|
|
130
118
|
/**
|
|
131
119
|
* A copy that takes no part: no ids or test ids, no form or radio group (a
|
|
132
120
|
* copied checked radio would uncheck the live one), no label for a live
|
|
133
121
|
* control, and copied frames and media load nothing. Scrolled descendants
|
|
134
|
-
* keep their offsets
|
|
135
|
-
* on from where they were, once the copy is laid out (`placeOver`).
|
|
122
|
+
* keep their offsets once the copy is laid out (`placeOver`).
|
|
136
123
|
*/
|
|
137
124
|
export function inertCopy(element) {
|
|
138
125
|
const copy = element.cloneNode(true);
|
|
@@ -146,10 +133,6 @@ export function inertCopy(element) {
|
|
|
146
133
|
});
|
|
147
134
|
scrollOffsets.set(copy, offsets);
|
|
148
135
|
inheritedValues.set(copy, readInherited(element));
|
|
149
|
-
carriedMotion.set(copy, {
|
|
150
|
-
saved: saveAnimations(element),
|
|
151
|
-
copyOf: new Map(sourceNodes.map((node, index) => [node, copyNodes[index]]))
|
|
152
|
-
});
|
|
153
136
|
for (const node of copyNodes) {
|
|
154
137
|
for (const name of ['id', 'data-testid', 'name', 'form', 'for', 'autofocus']) {
|
|
155
138
|
node.removeAttribute(name);
|
|
@@ -187,8 +170,7 @@ export function paintedBackground(element) {
|
|
|
187
170
|
/**
|
|
188
171
|
* Lay `element` over `rect` (viewport coordinates), absolutely, as the last
|
|
189
172
|
* child of `host`, wherever its containing block is: no ancestor's position
|
|
190
|
-
* changes.
|
|
191
|
-
* CSS animations and transitions its element ran carry on in it.
|
|
173
|
+
* changes.
|
|
192
174
|
*/
|
|
193
175
|
export function placeOver(element, host, rect) {
|
|
194
176
|
Object.assign(element.style, {
|
|
@@ -239,11 +221,6 @@ export function placeOver(element, host, rect) {
|
|
|
239
221
|
node.scrollLeft = left;
|
|
240
222
|
}
|
|
241
223
|
}
|
|
242
|
-
const carried = carriedMotion.get(element);
|
|
243
|
-
if (carried != null) {
|
|
244
|
-
carriedMotion.delete(element);
|
|
245
|
-
carryAnimations(carried.saved, element, node => carried.copyOf.get(node) ?? null);
|
|
246
|
-
}
|
|
247
224
|
}
|
|
248
225
|
|
|
249
226
|
/**
|
|
@@ -287,12 +264,6 @@ export function visiblePartCopy(element) {
|
|
|
287
264
|
if (values != null) {
|
|
288
265
|
inheritedValues.set(holder, values);
|
|
289
266
|
}
|
|
290
|
-
// The content's CSS motion carries on when the holder is laid out.
|
|
291
|
-
const carried = carriedMotion.get(content);
|
|
292
|
-
if (carried != null) {
|
|
293
|
-
carriedMotion.set(holder, carried);
|
|
294
|
-
carriedMotion.delete(content);
|
|
295
|
-
}
|
|
296
267
|
const box = element.getBoundingClientRect();
|
|
297
268
|
return {
|
|
298
269
|
copy: holder,
|
|
@@ -253,29 +253,6 @@ export declare const UIKIT_PRESS: {
|
|
|
253
253
|
readonly unit: "ms";
|
|
254
254
|
};
|
|
255
255
|
};
|
|
256
|
-
/**
|
|
257
|
-
* UIMenu presented by a button whose menu is its primary action: how far the
|
|
258
|
-
* finger that opened it travels before it picks. DropdownMenu's press model
|
|
259
|
-
* reads a copy in `hooks/menuPressValues.ts`.
|
|
260
|
-
*/
|
|
261
|
-
export declare const UIKIT_MENU_PRESS: {
|
|
262
|
-
/**
|
|
263
|
-
* After the menu opens under a still-held finger, the finger travels this
|
|
264
|
-
* far before it starts picking. The distance is a straight line from the
|
|
265
|
-
* first sample the menu receives after it opened. Until then nothing is
|
|
266
|
-
* lit, and lifting acts on nothing.
|
|
267
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
268
|
-
* iPhone 17 Pro, gesture-state hook, steps 150 ms apart, Oct 23 2026
|
|
269
|
-
* (M-MN2): with the menu open under a held finger and a 1 pt first step,
|
|
270
|
-
* moves of (0, 9) and (7, 7) picked nothing; (0, 10), (0, 11), (10, 0),
|
|
271
|
-
* (9, 9) and (10, 10) picked; a 9 pt step followed by 3 pt more picked
|
|
272
|
-
* nothing
|
|
273
|
-
*/
|
|
274
|
-
readonly handoff: {
|
|
275
|
-
readonly value: 10;
|
|
276
|
-
readonly unit: "px";
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
256
|
export declare const UIKIT_VELOCITY: {
|
|
280
257
|
/**
|
|
281
258
|
* UIPanGestureRecognizer.velocity(in:) is this times the newest event's
|
|
@@ -590,24 +567,6 @@ export declare const UIKIT_GESTURES: {
|
|
|
590
567
|
readonly unit: "ms";
|
|
591
568
|
};
|
|
592
569
|
};
|
|
593
|
-
readonly menuPress: {
|
|
594
|
-
/**
|
|
595
|
-
* After the menu opens under a still-held finger, the finger travels this
|
|
596
|
-
* far before it starts picking. The distance is a straight line from the
|
|
597
|
-
* first sample the menu receives after it opened. Until then nothing is
|
|
598
|
-
* lit, and lifting acts on nothing.
|
|
599
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
600
|
-
* iPhone 17 Pro, gesture-state hook, steps 150 ms apart, Oct 23 2026
|
|
601
|
-
* (M-MN2): with the menu open under a held finger and a 1 pt first step,
|
|
602
|
-
* moves of (0, 9) and (7, 7) picked nothing; (0, 10), (0, 11), (10, 0),
|
|
603
|
-
* (9, 9) and (10, 10) picked; a 9 pt step followed by 3 pt more picked
|
|
604
|
-
* nothing
|
|
605
|
-
*/
|
|
606
|
-
readonly handoff: {
|
|
607
|
-
readonly value: 10;
|
|
608
|
-
readonly unit: "px";
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
570
|
readonly velocity: {
|
|
612
571
|
/**
|
|
613
572
|
* UIPanGestureRecognizer.velocity(in:) is this times the newest event's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/gestures.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,mBAAmB,GAC7B,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM;IACzC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,SAAS;IACpB;;;;;;;OAOG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;IAEH;;;;;OAKG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,SAAS;IACpB;;;;;;;;;;OAUG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;;;OAOG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;;;;CAG+C,CAAC;AAErD,eAAO,MAAM,qBAAqB;IAChC;;;;;;OAMG;;;;;IAEH;;;;OAIG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,aAAa;IACxB;;;;;;;OAOG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/gestures.ts"],"names":[],"mappings":"AAgDA,MAAM,MAAM,mBAAmB,GAC7B,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM;IACzC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,SAAS;IACpB;;;;;;;OAOG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;IAEH;;;;;OAKG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,gBAAgB;IAC3B;;;;;;OAMG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,SAAS;IACpB;;;;;;;;;;OAUG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;;;OAOG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,cAAc;IACzB;;;;;;OAMG;;;;;CAG+C,CAAC;AAErD,eAAO,MAAM,qBAAqB;IAChC;;;;;;OAMG;;;;;IAEH;;;;OAIG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,aAAa;IACxB;;;;;;;OAOG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,WAAW;IACtB;;;;;OAKG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;IAEH;;;;;OAKG;;;;;IAEH;;;;;;OAMG;;;;;CAE+C,CAAC;AAErD,eAAO,MAAM,cAAc;IACzB;;;;;;;;;;;;OAYG;;;;;IAEH;;;;;;;;OAQG;;;;;IAEH;;;;;;;OAOG;;;;;CAE+C,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,WAAW;IACtB;;;;OAIG;;;;;CAE+C,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;QAzPzB;;;;;;;WAOG;;;;;QAEH;;;;;WAKG;;;;;QAEH;;;;;;WAMG;;;;;QAEH;;;;;WAKG;;;;;;;QAKH;;;;;;WAMG;;;;;QAEH;;;;;;WAMG;;;;;;;QAKH;;;;;;;;;;WAUG;;;;;;;QAKH;;;;;WAKG;;;;;QAEH;;;;;WAKG;;;;;QAEH;;;;;WAKG;;;;;QAEH;;;;;;WAMG;;;;;;;QAKH;;;;;;;WAOG;;;;;;;QAKH;;;;;;WAMG;;;;;;;QAMH;;;;;;WAMG;;;;;QAEH;;;;WAIG;;;;;;;QAKH;;;;;;;WAOG;;;;;;;QAKH;;;;;WAKG;;;;;QAEH;;;;;WAKG;;;;;QAEH;;;;;;WAMG;;;;;QAEH;;;;;WAKG;;;;;QAEH;;;;;;WAMG;;;;;;;QAKH;;;;;;;;;;;;WAYG;;;;;QAEH;;;;;;;;WAQG;;;;;QAEH;;;;;;;WAOG;;;;;;CAoCK,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sKAUxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,kBAAkB,EAClB,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAWvC,CAAC"}
|
|
@@ -295,30 +295,6 @@ export const UIKIT_PRESS = {
|
|
|
295
295
|
unit: 'ms'
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* UIMenu presented by a button whose menu is its primary action: how far the
|
|
301
|
-
* finger that opened it travels before it picks. DropdownMenu's press model
|
|
302
|
-
* reads a copy in `hooks/menuPressValues.ts`.
|
|
303
|
-
*/
|
|
304
|
-
export const UIKIT_MENU_PRESS = {
|
|
305
|
-
/**
|
|
306
|
-
* After the menu opens under a still-held finger, the finger travels this
|
|
307
|
-
* far before it starts picking. The distance is a straight line from the
|
|
308
|
-
* first sample the menu receives after it opened. Until then nothing is
|
|
309
|
-
* lit, and lifting acts on nothing.
|
|
310
|
-
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
311
|
-
* iPhone 17 Pro, gesture-state hook, steps 150 ms apart, Oct 23 2026
|
|
312
|
-
* (M-MN2): with the menu open under a held finger and a 1 pt first step,
|
|
313
|
-
* moves of (0, 9) and (7, 7) picked nothing; (0, 10), (0, 11), (10, 0),
|
|
314
|
-
* (9, 9) and (10, 10) picked; a 9 pt step followed by 3 pt more picked
|
|
315
|
-
* nothing
|
|
316
|
-
*/
|
|
317
|
-
handoff: {
|
|
318
|
-
value: 10,
|
|
319
|
-
unit: 'px'
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
298
|
export const UIKIT_VELOCITY = {
|
|
323
299
|
/**
|
|
324
300
|
* UIPanGestureRecognizer.velocity(in:) is this times the newest event's
|
|
@@ -398,7 +374,6 @@ export const UIKIT_GESTURES = {
|
|
|
398
374
|
screenEdgePan: UIKIT_SCREEN_EDGE_PAN,
|
|
399
375
|
control: UIKIT_CONTROL,
|
|
400
376
|
press: UIKIT_PRESS,
|
|
401
|
-
menuPress: UIKIT_MENU_PRESS,
|
|
402
377
|
velocity: UIKIT_VELOCITY
|
|
403
378
|
};
|
|
404
379
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* SYNC: When a domain file is added, re-export it here and list it in
|
|
18
18
|
* /packages/core/src/motion/README.md.
|
|
19
19
|
*/
|
|
20
|
-
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS,
|
|
20
|
+
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS, UIKIT_PAN, UIKIT_PINCH, UIKIT_PRESS, UIKIT_ROTATION, UIKIT_SCREEN_EDGE_PAN, UIKIT_SWIPE, UIKIT_TAP, UIKIT_VELOCITY, type GestureConstant, type GestureConstantUnit, type HapticFeedbackKind, } from './gestures.js';
|
|
21
21
|
export { datePicker } from './datePicker.js';
|
|
22
22
|
export { navigation, registerNavigationTable } from './navigation.js';
|
|
23
23
|
export { picker } from './picker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/motion/uikit/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,WAAW,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,mBAAmB,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,wCAAwC,EACxC,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* /packages/core/src/motion/README.md.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS,
|
|
23
|
+
export { HAPTIC_FEEDBACK_KINDS, HAPTIC_VIBRATION_PATTERNS, UIKIT_CLICK, UIKIT_CONTROL, UIKIT_GESTURES, UIKIT_LONG_PRESS, UIKIT_PAN, UIKIT_PINCH, UIKIT_PRESS, UIKIT_ROTATION, UIKIT_SCREEN_EDGE_PAN, UIKIT_SWIPE, UIKIT_TAP, UIKIT_VELOCITY } from "./gestures.js";
|
|
24
24
|
export { datePicker } from "./datePicker.js";
|
|
25
25
|
export { navigation, registerNavigationTable } from "./navigation.js";
|
|
26
26
|
export { picker } from "./picker.js";
|
|
@@ -29,13 +29,6 @@ export declare const PRESS_GESTURE_MEMORY_MS = 3000;
|
|
|
29
29
|
* Reduce Motion a tempo may shorten the fade, never lengthen it past 200 ms.
|
|
30
30
|
*/
|
|
31
31
|
export declare function pressFadeMs(element: Element): number;
|
|
32
|
-
/**
|
|
33
|
-
* Ends the press the controller follows on `element`, and its paint, at once.
|
|
34
|
-
* A clickable container calls it when a press starts on an interactive
|
|
35
|
-
* element inside it: that press does not activate the container, so the
|
|
36
|
-
* container shows no press.
|
|
37
|
-
*/
|
|
38
|
-
export declare function cancelPress(element: Element): void;
|
|
39
32
|
/**
|
|
40
33
|
* Install the touch press controller on this document, once, however many
|
|
41
34
|
* times it is called: the listeners exist while at least one caller holds it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAkDA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE;IAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;CAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AA0E5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUpD;
|
|
1
|
+
{"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAkDA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE;IAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;CAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AA0E5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUpD;AAkoBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* press-group markers and the document's pointer, keyboard, scroll and
|
|
7
7
|
* visibility events
|
|
8
8
|
* @output PRESSABLE_ATTRIBUTE, PRESSED_ATTRIBUTE, pressableProps,
|
|
9
|
-
* pressFadeMs
|
|
9
|
+
* pressFadeMs and installPressFeedback
|
|
10
10
|
* @position The DOM half of the touch press model. usePressFeedback installs
|
|
11
11
|
* it, and the CSS arms live in interactionOverlay.stylex.ts.
|
|
12
12
|
*
|
|
@@ -334,21 +334,6 @@ function finish(slot) {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
/**
|
|
338
|
-
* Ends the press the controller follows on `element`, and its paint, at once.
|
|
339
|
-
* A clickable container calls it when a press starts on an interactive
|
|
340
|
-
* element inside it: that press does not activate the container, so the
|
|
341
|
-
* container shows no press.
|
|
342
|
-
*/
|
|
343
|
-
export function cancelPress(element) {
|
|
344
|
-
if (finger.live?.element === element) {
|
|
345
|
-
finish(finger);
|
|
346
|
-
}
|
|
347
|
-
if (button.live?.element === element) {
|
|
348
|
-
finish(button);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
337
|
/** A new press on an element owns its paint: the other slot's gesture there ends. */
|
|
353
338
|
function takeOver(other, element) {
|
|
354
339
|
if (other.live?.element === element) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.8
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -870,9 +870,6 @@
|
|
|
870
870
|
"react-dom": ">=19.0.0"
|
|
871
871
|
},
|
|
872
872
|
"devDependencies": {
|
|
873
|
-
"@astryxdesign/a11y-spec": "0.7.8-canary.fbb81c6",
|
|
874
|
-
"@astryxdesign/cli": "0.7.8-canary.fbb81c6",
|
|
875
|
-
"@astryxdesign/interaction-harness": "0.7.8-canary.fbb81c6",
|
|
876
873
|
"@babel/cli": "^7.29.7",
|
|
877
874
|
"@babel/core": "^7.29.7",
|
|
878
875
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -883,7 +880,10 @@
|
|
|
883
880
|
"@testing-library/jest-dom": "^6.6.0",
|
|
884
881
|
"@testing-library/react": "^16.3.2",
|
|
885
882
|
"@types/babel__core": "^7.20.5",
|
|
886
|
-
"tailwindcss": "^4.3.2"
|
|
883
|
+
"tailwindcss": "^4.3.2",
|
|
884
|
+
"@astryxdesign/cli": "0.7.8",
|
|
885
|
+
"@astryxdesign/interaction-harness": "0.0.0",
|
|
886
|
+
"@astryxdesign/a11y-spec": "0.0.0"
|
|
887
887
|
},
|
|
888
888
|
"dependencies": {
|
|
889
889
|
"intl-messageformat": "^11.2.9"
|
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
} from '../theme/tokens.stylex';
|
|
47
47
|
import type {SizeValue, SpacingStep, Elevation} from '../utils/types';
|
|
48
48
|
import {mergeProps} from '../utils';
|
|
49
|
-
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
50
49
|
import {Card} from '../Card/Card';
|
|
51
50
|
import type {CardVariant} from '../Card/Card';
|
|
52
51
|
import {useClickableContainer} from '../hooks/useClickableContainer';
|
|
@@ -315,7 +314,6 @@ export function ClickableCard({
|
|
|
315
314
|
label,
|
|
316
315
|
onClick: onClickProp,
|
|
317
316
|
onMouseUp: onMouseUpProp,
|
|
318
|
-
onPointerDown: onPointerDownProp,
|
|
319
317
|
href,
|
|
320
318
|
target,
|
|
321
319
|
isDisabled = false,
|
|
@@ -372,7 +370,7 @@ export function ClickableCard({
|
|
|
372
370
|
|
|
373
371
|
const LinkComponent = useLinkComponent();
|
|
374
372
|
|
|
375
|
-
const {onClick, onMouseUp
|
|
373
|
+
const {onClick, onMouseUp} = useClickableContainer({
|
|
376
374
|
containerRef,
|
|
377
375
|
interactiveRef,
|
|
378
376
|
onClick: onClickProp,
|
|
@@ -429,11 +427,6 @@ export function ClickableCard({
|
|
|
429
427
|
}
|
|
430
428
|
onClick={!isDisabled ? onClick : undefined}
|
|
431
429
|
onMouseUp={!isDisabled ? handleMouseUp : undefined}
|
|
432
|
-
onPointerDown={
|
|
433
|
-
!isDisabled
|
|
434
|
-
? chainEventHandlers(onPointerDown, onPointerDownProp)
|
|
435
|
-
: onPointerDownProp
|
|
436
|
-
}
|
|
437
430
|
{...props}>
|
|
438
431
|
{isLink ? (
|
|
439
432
|
<LinkRoot
|
|
@@ -73,12 +73,6 @@ const UIKIT_SCALE = ROW_HEIGHT / picker.geometry.rowHeight;
|
|
|
73
73
|
/** UIKit's rubber band dimension for the picker's table, at that pitch. */
|
|
74
74
|
const RUBBER_BAND_DIMENSION = picker.geometry.rubberBandDimension * UIKIT_SCALE;
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* The rows' opacity at the column's edges. At 0.7 the row four from the band
|
|
78
|
-
* keeps 5:1 or more in every shipped theme, a margin over WCAG AA's 4.5:1.
|
|
79
|
-
*/
|
|
80
|
-
const FADE_FLOOR = 0.7;
|
|
81
|
-
|
|
82
76
|
const styles = stylex.create({
|
|
83
77
|
// The scrolling column's box, band and rows (Wheel.tsx), moved by the
|
|
84
78
|
// gesture system and the compositor instead of a native scroller.
|
|
@@ -98,7 +92,8 @@ const styles = stylex.create({
|
|
|
98
92
|
position: 'absolute',
|
|
99
93
|
inset: 0,
|
|
100
94
|
pointerEvents: 'none',
|
|
101
|
-
maskImage:
|
|
95
|
+
maskImage:
|
|
96
|
+
'linear-gradient(to bottom, rgb(0 0 0 / 0.3), rgb(0 0 0) 50%, rgb(0 0 0 / 0.3))',
|
|
102
97
|
},
|
|
103
98
|
/**
|
|
104
99
|
* The selection band: a centred row-height plate behind the rows.
|
|
@@ -201,7 +201,8 @@ export const docs = {
|
|
|
201
201
|
name: 'presentation',
|
|
202
202
|
type: "'popover' | 'bottom-sheet' | 'adaptive'",
|
|
203
203
|
description:
|
|
204
|
-
"Presentation surface for data-driven items. 'popover' stays anchored, 'bottom-sheet' always renders the actions in a modal BottomSheet, and 'adaptive' uses a BottomSheet on compact coarse-pointer layouts while remaining anchored elsewhere. Compound children currently support popover only.
|
|
204
|
+
"Presentation surface for data-driven items. 'popover' stays anchored, 'bottom-sheet' always renders the actions in a modal BottomSheet, and 'adaptive' uses a BottomSheet on compact coarse-pointer layouts while remaining anchored elsewhere. Compound children currently support popover only.",
|
|
205
|
+
default: "'popover'",
|
|
205
206
|
},
|
|
206
207
|
{
|
|
207
208
|
name: 'isMenuOpen',
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
71
71
|
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
72
72
|
import {useListFocus} from '../hooks/useListFocus';
|
|
73
|
-
import {
|
|
73
|
+
import {useMenuPress} from '../hooks/useMenuPress';
|
|
74
74
|
import type {MenuPressPointerType} from '../hooks/menuPressGesture';
|
|
75
75
|
import {useTypeahead} from '../hooks/useTypeahead';
|
|
76
76
|
import {useFocusReturnVisibility} from '../hooks/useFocusReturnVisibility';
|
|
@@ -460,10 +460,7 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
|
|
|
460
460
|
* Surface used to present the actions. Pass a value selected by product
|
|
461
461
|
* policy (for example, a compact-touch media query) when the presentation
|
|
462
462
|
* should adapt. Bottom-sheet presentation is intended for short action sets.
|
|
463
|
-
*
|
|
464
|
-
* device, the finger that opened it picks as UIMenu's does, once it has
|
|
465
|
-
* moved. `'popover'` pins the anchored popover with the pointer behavior on
|
|
466
|
-
* every device (the opening press follows the settle rule, as before).
|
|
463
|
+
* @default 'popover'
|
|
467
464
|
*/
|
|
468
465
|
presentation?: DropdownMenuPresentation;
|
|
469
466
|
items: DropdownMenuOption[];
|
|
@@ -471,11 +468,6 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
|
|
|
471
468
|
}
|
|
472
469
|
|
|
473
470
|
interface DropdownMenuCompoundProps extends DropdownMenuBaseProps {
|
|
474
|
-
/**
|
|
475
|
-
* `'popover'` pins the pointer behavior on every device (the opening press
|
|
476
|
-
* follows the settle rule, as before). Omitted, on every device, the finger
|
|
477
|
-
* that opened the menu picks as UIMenu's does, once it has moved.
|
|
478
|
-
*/
|
|
479
471
|
presentation?: 'popover';
|
|
480
472
|
items?: undefined;
|
|
481
473
|
children: ReactNode;
|
|
@@ -889,7 +881,6 @@ function DropdownMenuPopover({
|
|
|
889
881
|
placement = 'below',
|
|
890
882
|
alignment = 'start',
|
|
891
883
|
presentation: _presentation,
|
|
892
|
-
pressTouchModel = 'uikit',
|
|
893
884
|
header,
|
|
894
885
|
footer,
|
|
895
886
|
className,
|
|
@@ -897,13 +888,7 @@ function DropdownMenuPopover({
|
|
|
897
888
|
xstyle,
|
|
898
889
|
'data-testid': testId,
|
|
899
890
|
...props
|
|
900
|
-
}: DropdownMenuProps
|
|
901
|
-
/**
|
|
902
|
-
* How a finger's press runs, on every device: UIMenu's, unless the caller
|
|
903
|
-
* pins `presentation="popover"`.
|
|
904
|
-
*/
|
|
905
|
-
pressTouchModel?: 'pointer' | 'uikit';
|
|
906
|
-
}) {
|
|
891
|
+
}: DropdownMenuProps) {
|
|
907
892
|
const t = useComponentTranslator();
|
|
908
893
|
const button = buttonFromProps ?? {label: t(DEFAULT_BUTTON_I18N_KEY)};
|
|
909
894
|
|
|
@@ -1374,15 +1359,12 @@ function DropdownMenuPopover({
|
|
|
1374
1359
|
// The press model: the row under a release acts, the highlight follows a
|
|
1375
1360
|
// held pointer. A mouse released outside the menu dismisses it; a finger
|
|
1376
1361
|
// released outside leaves it open, so the hook never calls onDismiss then.
|
|
1377
|
-
const menuPress =
|
|
1362
|
+
const menuPress = useMenuPress({
|
|
1378
1363
|
menuRef: listRef,
|
|
1379
1364
|
triggerRef: buttonRef,
|
|
1380
1365
|
itemSelector: MENU_ITEM_SELECTOR,
|
|
1381
1366
|
onTriggerPress: handleTriggerPress,
|
|
1382
1367
|
onDismiss: closeMenu,
|
|
1383
|
-
// Under a finger, on every device, the opening finger picks as UIMenu's
|
|
1384
|
-
// does. `presentation="popover"` pins the pointer model.
|
|
1385
|
-
touchModel: pressTouchModel,
|
|
1386
1368
|
});
|
|
1387
1369
|
cancelMenuPressRef.current = menuPress.cancel;
|
|
1388
1370
|
|
|
@@ -1804,13 +1786,7 @@ export function DropdownMenu(props: DropdownMenuProps) {
|
|
|
1804
1786
|
);
|
|
1805
1787
|
}
|
|
1806
1788
|
|
|
1807
|
-
return
|
|
1808
|
-
<DropdownMenuPopover
|
|
1809
|
-
{...sharedProps}
|
|
1810
|
-
presentation="popover"
|
|
1811
|
-
pressTouchModel={props.presentation === 'popover' ? 'pointer' : 'uikit'}
|
|
1812
|
-
/>
|
|
1813
|
-
);
|
|
1789
|
+
return <DropdownMenuPopover {...sharedProps} presentation="popover" />;
|
|
1814
1790
|
}
|
|
1815
1791
|
|
|
1816
1792
|
DropdownMenu.displayName = 'DropdownMenu';
|
|
@@ -38,7 +38,6 @@ import {useIndicator} from '../Indicator';
|
|
|
38
38
|
import {Item} from '../Item';
|
|
39
39
|
import {useDropdownMenuContext} from './DropdownMenuContext';
|
|
40
40
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
41
|
-
import {menuPressLitRowStyle} from '../privateAttributes/menuPressLit.stylex';
|
|
42
41
|
import {focusMenuItemOnHover} from './menuItemHover';
|
|
43
42
|
import {colorVars, focusVars, spacingVars} from '../theme/tokens.stylex';
|
|
44
43
|
import {composeEventHandlers, mergeProps, themeProps} from '../utils';
|
|
@@ -51,9 +50,7 @@ const styles = stylex.create({
|
|
|
51
50
|
color: colorVars['--color-text-primary'],
|
|
52
51
|
backgroundColor: {
|
|
53
52
|
default: 'transparent',
|
|
54
|
-
|
|
55
|
-
// lights.
|
|
56
|
-
':focus': `var(--_menu-row-focus-paint, ${colorVars['--color-overlay-hover']})`,
|
|
53
|
+
':focus': colorVars['--color-overlay-hover'],
|
|
57
54
|
},
|
|
58
55
|
cursor: {
|
|
59
56
|
default: 'pointer',
|
|
@@ -234,7 +231,6 @@ export function DropdownMenuCheckboxItem({
|
|
|
234
231
|
xstyle={[
|
|
235
232
|
focusOutlineStyles.focusVisible,
|
|
236
233
|
styles.root,
|
|
237
|
-
menuPressLitRowStyle,
|
|
238
234
|
isDisabled && styles.disabled,
|
|
239
235
|
xstyle,
|
|
240
236
|
]}
|
|
@@ -49,7 +49,6 @@ import {composeEventHandlers, mergeProps} from '../utils';
|
|
|
49
49
|
import type {BaseProps} from '../BaseProps';
|
|
50
50
|
import {useDropdownMenuContext} from './DropdownMenuContext';
|
|
51
51
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
52
|
-
import {menuPressLitRowStyle} from '../privateAttributes/menuPressLit.stylex';
|
|
53
52
|
import {focusMenuItemOnHover} from './menuItemHover';
|
|
54
53
|
import {isModifiedClick} from './menuItemRoles';
|
|
55
54
|
import {themeProps} from '../utils/themeProps';
|
|
@@ -67,16 +66,14 @@ const menuItemStyles = stylex.create({
|
|
|
67
66
|
color: colorVars['--color-text-primary'],
|
|
68
67
|
backgroundColor: {
|
|
69
68
|
default: 'transparent',
|
|
70
|
-
|
|
71
|
-
// lights.
|
|
72
|
-
':focus': `var(--_menu-row-focus-paint, ${colorVars['--color-overlay-hover']})`,
|
|
69
|
+
':focus': colorVars['--color-overlay-hover'],
|
|
73
70
|
// The pressed look only where hover exists. Under a finger the row a
|
|
74
71
|
// press BEGAN on would otherwise stay painted while the highlight (focus)
|
|
75
|
-
// moves to the row under the finger — two rows lit.
|
|
76
|
-
// sets the variable on the menu. Then only the lit row keeps the look.
|
|
72
|
+
// moves to the row under the finger — two rows lit.
|
|
77
73
|
'@media (hover: hover)': {
|
|
78
74
|
default: null,
|
|
79
|
-
':active:where(:not(:disabled,[aria-disabled="true"]))':
|
|
75
|
+
':active:where(:not(:disabled,[aria-disabled="true"]))':
|
|
76
|
+
colorVars['--color-overlay-pressed'],
|
|
80
77
|
},
|
|
81
78
|
},
|
|
82
79
|
borderWidth: 0,
|
|
@@ -306,7 +303,6 @@ export function DropdownMenuItem({
|
|
|
306
303
|
xstyle={[
|
|
307
304
|
focusOutlineStyles.focusVisible,
|
|
308
305
|
menuItemStyles.root,
|
|
309
|
-
menuPressLitRowStyle,
|
|
310
306
|
itemSizeStyles[menuSize],
|
|
311
307
|
isDestructive && menuItemStyles.destructive,
|
|
312
308
|
isDisabled && menuItemStyles.disabled,
|
|
@@ -34,7 +34,6 @@ import {useIndicator} from '../Indicator';
|
|
|
34
34
|
import {Item} from '../Item';
|
|
35
35
|
import {useDropdownMenuContext} from './DropdownMenuContext';
|
|
36
36
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
37
|
-
import {menuPressLitRowStyle} from '../privateAttributes/menuPressLit.stylex';
|
|
38
37
|
import {focusMenuItemOnHover} from './menuItemHover';
|
|
39
38
|
import {colorVars, focusVars, spacingVars} from '../theme/tokens.stylex';
|
|
40
39
|
import {composeEventHandlers, mergeProps, themeProps} from '../utils';
|
|
@@ -48,9 +47,7 @@ const styles = stylex.create({
|
|
|
48
47
|
color: colorVars['--color-text-primary'],
|
|
49
48
|
backgroundColor: {
|
|
50
49
|
default: 'transparent',
|
|
51
|
-
|
|
52
|
-
// lights.
|
|
53
|
-
':focus': `var(--_menu-row-focus-paint, ${colorVars['--color-overlay-hover']})`,
|
|
50
|
+
':focus': colorVars['--color-overlay-hover'],
|
|
54
51
|
},
|
|
55
52
|
cursor: {
|
|
56
53
|
default: 'pointer',
|
|
@@ -221,7 +218,6 @@ export function DropdownMenuRadioItem({
|
|
|
221
218
|
xstyle={[
|
|
222
219
|
focusOutlineStyles.focusVisible,
|
|
223
220
|
styles.root,
|
|
224
|
-
menuPressLitRowStyle,
|
|
225
221
|
isDisabled && styles.disabled,
|
|
226
222
|
xstyle,
|
|
227
223
|
]}
|
|
@@ -99,7 +99,6 @@ import {
|
|
|
99
99
|
rtlStyles,
|
|
100
100
|
} from '../utils';
|
|
101
101
|
import {focusOutlineStyles} from '../utils/focusOutline.stylex';
|
|
102
|
-
import {menuPressLitRowStyle} from '../privateAttributes/menuPressLit.stylex';
|
|
103
102
|
import {getInteractionModality} from '../utils/interactionModality';
|
|
104
103
|
import {useMergedRefs} from '../hooks/useMergedRefs';
|
|
105
104
|
import {useDevWarning} from '../hooks/useDevWarning';
|
|
@@ -147,9 +146,7 @@ const triggerStyles = stylex.create({
|
|
|
147
146
|
color: colorVars['--color-text-primary'],
|
|
148
147
|
backgroundColor: {
|
|
149
148
|
default: 'transparent',
|
|
150
|
-
|
|
151
|
-
// lights.
|
|
152
|
-
':focus': `var(--_menu-row-focus-paint, ${colorVars['--color-overlay-hover']})`,
|
|
149
|
+
':focus': colorVars['--color-overlay-hover'],
|
|
153
150
|
},
|
|
154
151
|
borderWidth: 0,
|
|
155
152
|
borderStyle: 'none',
|
|
@@ -1246,7 +1243,6 @@ export function DropdownMenuSubMenu(
|
|
|
1246
1243
|
xstyle={[
|
|
1247
1244
|
focusOutlineStyles.focusVisible,
|
|
1248
1245
|
triggerStyles.root,
|
|
1249
|
-
menuPressLitRowStyle,
|
|
1250
1246
|
triggerSizeStyles[menuSize],
|
|
1251
1247
|
isOpen && triggerStyles.open,
|
|
1252
1248
|
isDisabled && triggerStyles.disabled,
|
package/src/Item/Item.tsx
CHANGED
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
import type {BaseProps} from '../BaseProps';
|
|
51
51
|
import {isRenderable} from '../utils/isRenderable';
|
|
52
52
|
import {mergeProps} from '../utils/mergeProps';
|
|
53
|
-
import {chainEventHandlers} from '../utils/chainEventHandlers';
|
|
54
53
|
import {useFocusAcrossSwap} from '../utils/useFocusAcrossSwap';
|
|
55
54
|
import {ItemDescriptionContext} from './ItemDescriptionContext';
|
|
56
55
|
import {ItemMarkerColumnsContext} from './ItemMarkerColumnsContext';
|
|
@@ -628,12 +627,11 @@ export function Item({
|
|
|
628
627
|
const containerRef = useRef<HTMLElement | null>(null);
|
|
629
628
|
// Only onClick is needed: onMouseUp handles middle-click href navigation,
|
|
630
629
|
// which delegation mode never has (href is ignored here).
|
|
631
|
-
const {onClick: delegatedOnClick
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
});
|
|
630
|
+
const {onClick: delegatedOnClick} = useClickableContainer({
|
|
631
|
+
containerRef,
|
|
632
|
+
interactiveRef: interactiveRef ?? undefined,
|
|
633
|
+
disabled: isDisabled,
|
|
634
|
+
});
|
|
637
635
|
|
|
638
636
|
useDevWarning(
|
|
639
637
|
'Item',
|
|
@@ -898,14 +896,6 @@ export function Item({
|
|
|
898
896
|
{...restProps}
|
|
899
897
|
{...swipeHandlers}
|
|
900
898
|
{...linkRootProps}
|
|
901
|
-
{...(isDelegate
|
|
902
|
-
? {
|
|
903
|
-
onPointerDown: chainEventHandlers(
|
|
904
|
-
restProps.onPointerDown,
|
|
905
|
-
delegatedOnPointerDown,
|
|
906
|
-
),
|
|
907
|
-
}
|
|
908
|
-
: null)}
|
|
909
899
|
aria-selected={(allowsAriaSelected && isSelected) || undefined}
|
|
910
900
|
// aria-selected is invalid on roles that don't permit it (listitem, a
|
|
911
901
|
// bare div, etc.). For those, convey selection via aria-current — valid
|