Repository navigation
Commit fc210bc
committed
feat(core): createMenuPress runs the menu press model without React
createMenuPress(menu, options) runs the press model on any element: the row
under a release acts, the highlight follows a held pointer, a mouse press on
the trigger opens the menu, and a finger held on it opens it after the
long-press delay, on the shared long-press detector. It keeps the options it
is created with, and destroy() removes every listener it added.
useMenuPress(menuRef, options) is its React form, with nothing to spread. It
calls the latest callbacks, reads only committed options, and creates a new
factory when the menu, its document, the trigger, a value option or the set
of given callbacks changes. ContextMenu, DropdownMenuSubMenu,
MenuBottomSheetActionList, Selector and TabMenu use it. ContextMenu's press
rides its menu element, which carries the press marker in its markup as
before, never the items sheet's container, so the sheet's Back keeps its
press paint. The options form is unchanged, and its doc keeps its returns.
useLongPressDetector folds into useLongPress, since the menu press runs the
detector directly.
The core API report gains the factory, its types and the ref form. The
DropdownMenu record proposes that the trigger props' press handlers leave
only with a ref path, and the useMenuPress record that the options form is
deprecated together with its callers' migration, both pending owner review.1 parent 5719467 commit fc210bc
18 files changed
Lines changed: 1324 additions & 811 deletions
File tree
- .changeset
- docs/specs/components/DropdownMenu
- modules
- internal/eslint-plugin-astryx
- packages/core
- src
- ContextMenu
- DropdownMenu
- Selector
- TabList
- hooks
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
548 | 560 | | |
549 | 561 | | |
550 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
329 | 342 | | |
330 | 343 | | |
331 | 344 | | |
| |||
334 | 347 | | |
335 | 348 | | |
336 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
337 | 354 | | |
338 | 355 | | |
339 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
127 | | - | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
296 | 331 | | |
297 | 332 | | |
298 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
749 | 750 | | |
750 | 751 | | |
751 | 752 | | |
752 | | - | |
753 | | - | |
754 | | - | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
755 | 763 | | |
756 | 764 | | |
757 | 765 | | |
758 | 766 | | |
759 | 767 | | |
760 | 768 | | |
761 | 769 | | |
762 | | - | |
| 770 | + | |
| 771 | + | |
763 | 772 | | |
764 | 773 | | |
765 | 774 | | |
766 | 775 | | |
767 | 776 | | |
768 | 777 | | |
769 | 778 | | |
770 | | - | |
771 | 779 | | |
772 | 780 | | |
773 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1044 | 1044 | | |
1045 | 1045 | | |
1046 | 1046 | | |
1047 | | - | |
1048 | | - | |
| 1047 | + | |
1049 | 1048 | | |
1050 | 1049 | | |
1051 | 1050 | | |
| |||
1274 | 1273 | | |
1275 | 1274 | | |
1276 | 1275 | | |
1277 | | - | |
1278 | 1276 | | |
1279 | 1277 | | |
1280 | 1278 | | |
| |||
1312 | 1310 | | |
1313 | 1311 | | |
1314 | 1312 | | |
1315 | | - | |
1316 | 1313 | | |
1317 | 1314 | | |
1318 | 1315 | | |
| |||
1336 | 1333 | | |
1337 | 1334 | | |
1338 | 1335 | | |
1339 | | - | |
1340 | 1336 | | |
1341 | 1337 | | |
1342 | 1338 | | |
| |||
1370 | 1366 | | |
1371 | 1367 | | |
1372 | 1368 | | |
1373 | | - | |
1374 | 1369 | | |
1375 | 1370 | | |
1376 | 1371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
| |||
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 150 | + | |
156 | 151 | | |
157 | 152 | | |
158 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1412 | 1412 | | |
1413 | 1413 | | |
1414 | 1414 | | |
1415 | | - | |
1416 | | - | |
| 1415 | + | |
1417 | 1416 | | |
1418 | 1417 | | |
1419 | 1418 | | |
| |||
1834 | 1833 | | |
1835 | 1834 | | |
1836 | 1835 | | |
1837 | | - | |
1838 | 1836 | | |
1839 | 1837 | | |
1840 | 1838 | | |
| |||
1852 | 1850 | | |
1853 | 1851 | | |
1854 | 1852 | | |
1855 | | - | |
1856 | 1853 | | |
1857 | 1854 | | |
1858 | 1855 | | |
| |||
0 commit comments