@spectrum-web-components/menu 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/custom-elements.json +252 -0
  2. package/package.json +10 -10
  3. package/sp-menu-divider.d.ts +11 -0
  4. package/sp-menu-divider.dev.js.map +1 -1
  5. package/sp-menu-divider.js.map +1 -1
  6. package/sp-menu-group.d.ts +11 -0
  7. package/sp-menu-group.dev.js.map +1 -1
  8. package/sp-menu-group.js.map +1 -1
  9. package/sp-menu-item.d.ts +11 -0
  10. package/sp-menu-item.dev.js.map +1 -1
  11. package/sp-menu-item.js.map +1 -1
  12. package/sp-menu.d.ts +11 -0
  13. package/sp-menu.dev.js.map +1 -1
  14. package/sp-menu.js.map +1 -1
  15. package/src/Menu.d.ts +107 -0
  16. package/src/Menu.dev.js +133 -0
  17. package/src/Menu.dev.js.map +2 -2
  18. package/src/Menu.js +2 -2
  19. package/src/Menu.js.map +3 -3
  20. package/src/MenuDivider.d.ts +11 -0
  21. package/src/MenuDivider.dev.js.map +1 -1
  22. package/src/MenuDivider.js.map +1 -1
  23. package/src/MenuGroup.d.ts +11 -0
  24. package/src/MenuGroup.dev.js.map +1 -1
  25. package/src/MenuGroup.js.map +1 -1
  26. package/src/MenuItem.d.ts +11 -0
  27. package/src/MenuItem.dev.js +2 -2
  28. package/src/MenuItem.dev.js.map +1 -1
  29. package/src/MenuItem.js +2 -2
  30. package/src/MenuItem.js.map +1 -1
  31. package/src/checkmark-overrides.css.dev.js.map +1 -1
  32. package/src/checkmark-overrides.css.js.map +1 -1
  33. package/src/chevron-overrides.css.dev.js.map +1 -1
  34. package/src/chevron-overrides.css.js.map +1 -1
  35. package/src/index.d.ts +11 -0
  36. package/src/index.dev.js.map +1 -1
  37. package/src/index.js.map +1 -1
  38. package/src/menu-divider-overrides.css.dev.js.map +1 -1
  39. package/src/menu-divider-overrides.css.js.map +1 -1
  40. package/src/menu-divider.css.dev.js.map +1 -1
  41. package/src/menu-divider.css.js.map +1 -1
  42. package/src/menu-group.css.dev.js.map +1 -1
  43. package/src/menu-group.css.js.map +1 -1
  44. package/src/menu-item-overrides.css.dev.js.map +1 -1
  45. package/src/menu-item-overrides.css.js.map +1 -1
  46. package/src/menu-item.css.dev.js.map +1 -1
  47. package/src/menu-item.css.js.map +1 -1
  48. package/src/menu-overrides.css.dev.js.map +1 -1
  49. package/src/menu-overrides.css.js.map +1 -1
  50. package/src/menu-sectionHeading-overrides.css.dev.js.map +1 -1
  51. package/src/menu-sectionHeading-overrides.css.js.map +1 -1
  52. package/src/menu.css.dev.js.map +1 -1
  53. package/src/menu.css.js.map +1 -1
  54. package/src/spectrum-checkmark.css.dev.js.map +1 -1
  55. package/src/spectrum-checkmark.css.js.map +1 -1
  56. package/src/spectrum-chevron.css.dev.js.map +1 -1
  57. package/src/spectrum-chevron.css.js.map +1 -1
  58. package/src/spectrum-menu-divider.css.dev.js.map +1 -1
  59. package/src/spectrum-menu-divider.css.js.map +1 -1
  60. package/src/spectrum-menu-item.css.dev.js.map +1 -1
  61. package/src/spectrum-menu-item.css.js.map +1 -1
  62. package/src/spectrum-menu-sectionHeading.css.dev.js.map +1 -1
  63. package/src/spectrum-menu-sectionHeading.css.js.map +1 -1
  64. package/src/spectrum-menu.css.dev.js.map +1 -1
  65. package/src/spectrum-menu.css.js.map +1 -1
@@ -103,6 +103,63 @@
103
103
  },
104
104
  "privacy": "protected"
105
105
  },
106
+ {
107
+ "kind": "field",
108
+ "name": "touchStartY",
109
+ "type": {
110
+ "text": "number | undefined"
111
+ },
112
+ "privacy": "private",
113
+ "default": "undefined",
114
+ "description": "iPad scroll detection properties\n\nThis feature prevents menu item selection during iPad scrolling to avoid\naccidental selections when users are trying to scroll through a long menu.\n\nHow it works:\n1. On touchstart: Record initial Y position and timestamp\n2. On touchmove: Calculate vertical movement and time elapsed\n3. If movement > threshold AND time < threshold: Mark as scrolling\n4. On touchend: Reset scrolling state after a delay\n5. During selection: Prevent selection if scrolling is detected\n\nThis prevents the common iPad issue where users accidentally select menu\nitems while trying to scroll through the menu content.\n\nThreshold Values:\n- Movement threshold: 10px (consistent with Card component click vs. drag detection)\n- Time threshold: 300ms (consistent with longpress duration across the design system)\n- Reset delay: 100ms (allows final touch events to be processed)\n\nThese values are carefully chosen to balance preventing accidental triggers\nwhile allowing intentional scroll gestures. They represent a common UX pattern\nin mobile interfaces and are consistent with other components in the design system."
115
+ },
116
+ {
117
+ "kind": "field",
118
+ "name": "touchStartTime",
119
+ "type": {
120
+ "text": "number | undefined"
121
+ },
122
+ "privacy": "private",
123
+ "default": "undefined"
124
+ },
125
+ {
126
+ "kind": "field",
127
+ "name": "isCurrentlyScrolling",
128
+ "type": {
129
+ "text": "boolean"
130
+ },
131
+ "privacy": "private",
132
+ "default": "false"
133
+ },
134
+ {
135
+ "kind": "field",
136
+ "name": "scrollThreshold",
137
+ "type": {
138
+ "text": "number"
139
+ },
140
+ "privacy": "private",
141
+ "default": "10",
142
+ "description": "Minimum vertical movement (in pixels) required to trigger scrolling detection.\n\nThis threshold is consistent with other components in the design system:\n- Card component uses 10px for click vs. drag detection\n- Menu component uses 10px for scroll vs. selection detection\n\nThe 10px threshold is carefully chosen to:\n- Allow for natural finger tremor and accidental touches\n- Distinguish between intentional scroll gestures and taps\n- Provide consistent behavior across the platform"
143
+ },
144
+ {
145
+ "kind": "field",
146
+ "name": "scrollTimeThreshold",
147
+ "type": {
148
+ "text": "number"
149
+ },
150
+ "privacy": "private",
151
+ "default": "300",
152
+ "description": "Maximum time (in milliseconds) for a movement to be considered scrolling.\n\nThis threshold is consistent with other timing values in the design system:\n- Longpress duration: 300ms (ActionButton, LongpressController)\n- Scroll detection: 300ms (Menu component)\n\nQuick movements within this timeframe are likely intentional scrolls,\nwhile slower movements are more likely taps or selections."
153
+ },
154
+ {
155
+ "kind": "field",
156
+ "name": "isScrolling",
157
+ "type": {
158
+ "text": "boolean"
159
+ },
160
+ "privacy": "public",
161
+ "description": "Public getter for scrolling state\nReturns true if the component is currently in a scrolling state"
162
+ },
106
163
  {
107
164
  "kind": "field",
108
165
  "name": "label",
@@ -425,6 +482,57 @@
425
482
  }
426
483
  ]
427
484
  },
485
+ {
486
+ "kind": "method",
487
+ "name": "handleTouchStart",
488
+ "privacy": "private",
489
+ "return": {
490
+ "type": {
491
+ "text": "void"
492
+ }
493
+ },
494
+ "parameters": [
495
+ {
496
+ "name": "event",
497
+ "type": {
498
+ "text": "TouchEvent"
499
+ },
500
+ "description": "The TouchEvent from the touchstart event"
501
+ }
502
+ ],
503
+ "description": "Handles touchstart events for iPad scroll detection.\n\nRecords the initial touch position and timestamp to establish a baseline\nfor detecting scroll gestures. Only processes single-touch events to\navoid interference with multi-touch gestures."
504
+ },
505
+ {
506
+ "kind": "method",
507
+ "name": "handleTouchMove",
508
+ "privacy": "private",
509
+ "return": {
510
+ "type": {
511
+ "text": "void"
512
+ }
513
+ },
514
+ "parameters": [
515
+ {
516
+ "name": "event",
517
+ "type": {
518
+ "text": "TouchEvent"
519
+ },
520
+ "description": "The TouchEvent from the touchmove event"
521
+ }
522
+ ],
523
+ "description": "Handles touchmove events for iPad scroll detection.\n\nCalculates the vertical movement distance and time elapsed since touchstart.\nIf the movement exceeds the threshold (10px) and happens within the time\nthreshold (300ms), it marks the interaction as scrolling. This helps\ndistinguish between intentional scroll gestures and accidental touches."
524
+ },
525
+ {
526
+ "kind": "method",
527
+ "name": "handleTouchEnd",
528
+ "privacy": "private",
529
+ "return": {
530
+ "type": {
531
+ "text": "void"
532
+ }
533
+ },
534
+ "description": "Handles touchend events for iPad scroll detection.\n\nResets the scrolling state after a short delay (100ms) to allow for\nany final touch events to be processed. This delay prevents immediate\nstate changes that could interfere with the selection logic.\n\nThe 100ms delay is consistent with the design system's approach to\ntouch event handling and ensures that any final touch events or\ngesture recognition can complete before the scrolling state is reset."
535
+ },
428
536
  {
429
537
  "kind": "field",
430
538
  "name": "pointerUpTarget",
@@ -1044,6 +1152,87 @@
1044
1152
  "module": "src/Menu.js"
1045
1153
  }
1046
1154
  },
1155
+ {
1156
+ "kind": "field",
1157
+ "name": "touchStartY",
1158
+ "type": {
1159
+ "text": "number | undefined"
1160
+ },
1161
+ "privacy": "private",
1162
+ "default": "undefined",
1163
+ "description": "iPad scroll detection properties\n\nThis feature prevents menu item selection during iPad scrolling to avoid\naccidental selections when users are trying to scroll through a long menu.\n\nHow it works:\n1. On touchstart: Record initial Y position and timestamp\n2. On touchmove: Calculate vertical movement and time elapsed\n3. If movement > threshold AND time < threshold: Mark as scrolling\n4. On touchend: Reset scrolling state after a delay\n5. During selection: Prevent selection if scrolling is detected\n\nThis prevents the common iPad issue where users accidentally select menu\nitems while trying to scroll through the menu content.\n\nThreshold Values:\n- Movement threshold: 10px (consistent with Card component click vs. drag detection)\n- Time threshold: 300ms (consistent with longpress duration across the design system)\n- Reset delay: 100ms (allows final touch events to be processed)\n\nThese values are carefully chosen to balance preventing accidental triggers\nwhile allowing intentional scroll gestures. They represent a common UX pattern\nin mobile interfaces and are consistent with other components in the design system.",
1164
+ "inheritedFrom": {
1165
+ "name": "Menu",
1166
+ "module": "src/Menu.js"
1167
+ }
1168
+ },
1169
+ {
1170
+ "kind": "field",
1171
+ "name": "touchStartTime",
1172
+ "type": {
1173
+ "text": "number | undefined"
1174
+ },
1175
+ "privacy": "private",
1176
+ "default": "undefined",
1177
+ "inheritedFrom": {
1178
+ "name": "Menu",
1179
+ "module": "src/Menu.js"
1180
+ }
1181
+ },
1182
+ {
1183
+ "kind": "field",
1184
+ "name": "isCurrentlyScrolling",
1185
+ "type": {
1186
+ "text": "boolean"
1187
+ },
1188
+ "privacy": "private",
1189
+ "default": "false",
1190
+ "inheritedFrom": {
1191
+ "name": "Menu",
1192
+ "module": "src/Menu.js"
1193
+ }
1194
+ },
1195
+ {
1196
+ "kind": "field",
1197
+ "name": "scrollThreshold",
1198
+ "type": {
1199
+ "text": "number"
1200
+ },
1201
+ "privacy": "private",
1202
+ "default": "10",
1203
+ "description": "Minimum vertical movement (in pixels) required to trigger scrolling detection.\n\nThis threshold is consistent with other components in the design system:\n- Card component uses 10px for click vs. drag detection\n- Menu component uses 10px for scroll vs. selection detection\n\nThe 10px threshold is carefully chosen to:\n- Allow for natural finger tremor and accidental touches\n- Distinguish between intentional scroll gestures and taps\n- Provide consistent behavior across the platform",
1204
+ "inheritedFrom": {
1205
+ "name": "Menu",
1206
+ "module": "src/Menu.js"
1207
+ }
1208
+ },
1209
+ {
1210
+ "kind": "field",
1211
+ "name": "scrollTimeThreshold",
1212
+ "type": {
1213
+ "text": "number"
1214
+ },
1215
+ "privacy": "private",
1216
+ "default": "300",
1217
+ "description": "Maximum time (in milliseconds) for a movement to be considered scrolling.\n\nThis threshold is consistent with other timing values in the design system:\n- Longpress duration: 300ms (ActionButton, LongpressController)\n- Scroll detection: 300ms (Menu component)\n\nQuick movements within this timeframe are likely intentional scrolls,\nwhile slower movements are more likely taps or selections.",
1218
+ "inheritedFrom": {
1219
+ "name": "Menu",
1220
+ "module": "src/Menu.js"
1221
+ }
1222
+ },
1223
+ {
1224
+ "kind": "field",
1225
+ "name": "isScrolling",
1226
+ "type": {
1227
+ "text": "boolean"
1228
+ },
1229
+ "privacy": "public",
1230
+ "description": "Public getter for scrolling state\nReturns true if the component is currently in a scrolling state",
1231
+ "inheritedFrom": {
1232
+ "name": "Menu",
1233
+ "module": "src/Menu.js"
1234
+ }
1235
+ },
1047
1236
  {
1048
1237
  "kind": "field",
1049
1238
  "name": "label",
@@ -1456,6 +1645,69 @@
1456
1645
  "module": "src/Menu.js"
1457
1646
  }
1458
1647
  },
1648
+ {
1649
+ "kind": "method",
1650
+ "name": "handleTouchStart",
1651
+ "privacy": "private",
1652
+ "return": {
1653
+ "type": {
1654
+ "text": "void"
1655
+ }
1656
+ },
1657
+ "parameters": [
1658
+ {
1659
+ "name": "event",
1660
+ "type": {
1661
+ "text": "TouchEvent"
1662
+ },
1663
+ "description": "The TouchEvent from the touchstart event"
1664
+ }
1665
+ ],
1666
+ "description": "Handles touchstart events for iPad scroll detection.\n\nRecords the initial touch position and timestamp to establish a baseline\nfor detecting scroll gestures. Only processes single-touch events to\navoid interference with multi-touch gestures.",
1667
+ "inheritedFrom": {
1668
+ "name": "Menu",
1669
+ "module": "src/Menu.js"
1670
+ }
1671
+ },
1672
+ {
1673
+ "kind": "method",
1674
+ "name": "handleTouchMove",
1675
+ "privacy": "private",
1676
+ "return": {
1677
+ "type": {
1678
+ "text": "void"
1679
+ }
1680
+ },
1681
+ "parameters": [
1682
+ {
1683
+ "name": "event",
1684
+ "type": {
1685
+ "text": "TouchEvent"
1686
+ },
1687
+ "description": "The TouchEvent from the touchmove event"
1688
+ }
1689
+ ],
1690
+ "description": "Handles touchmove events for iPad scroll detection.\n\nCalculates the vertical movement distance and time elapsed since touchstart.\nIf the movement exceeds the threshold (10px) and happens within the time\nthreshold (300ms), it marks the interaction as scrolling. This helps\ndistinguish between intentional scroll gestures and accidental touches.",
1691
+ "inheritedFrom": {
1692
+ "name": "Menu",
1693
+ "module": "src/Menu.js"
1694
+ }
1695
+ },
1696
+ {
1697
+ "kind": "method",
1698
+ "name": "handleTouchEnd",
1699
+ "privacy": "private",
1700
+ "return": {
1701
+ "type": {
1702
+ "text": "void"
1703
+ }
1704
+ },
1705
+ "description": "Handles touchend events for iPad scroll detection.\n\nResets the scrolling state after a short delay (100ms) to allow for\nany final touch events to be processed. This delay prevents immediate\nstate changes that could interfere with the selection logic.\n\nThe 100ms delay is consistent with the design system's approach to\ntouch event handling and ensures that any final touch events or\ngesture recognition can complete before the scrolling state is reset.",
1706
+ "inheritedFrom": {
1707
+ "name": "Menu",
1708
+ "module": "src/Menu.js"
1709
+ }
1710
+ },
1459
1711
  {
1460
1712
  "kind": "field",
1461
1713
  "name": "pointerUpTarget",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/menu",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -96,15 +96,15 @@
96
96
  ],
97
97
  "dependencies": {
98
98
  "@lit-labs/observers": "^2.0.2",
99
- "@spectrum-web-components/action-button": "1.7.0",
100
- "@spectrum-web-components/base": "1.7.0",
101
- "@spectrum-web-components/divider": "1.7.0",
102
- "@spectrum-web-components/icon": "1.7.0",
103
- "@spectrum-web-components/icons-ui": "1.7.0",
104
- "@spectrum-web-components/overlay": "1.7.0",
105
- "@spectrum-web-components/popover": "1.7.0",
106
- "@spectrum-web-components/reactive-controllers": "1.7.0",
107
- "@spectrum-web-components/shared": "1.7.0"
99
+ "@spectrum-web-components/action-button": "1.8.0",
100
+ "@spectrum-web-components/base": "1.8.0",
101
+ "@spectrum-web-components/divider": "1.8.0",
102
+ "@spectrum-web-components/icon": "1.8.0",
103
+ "@spectrum-web-components/icons-ui": "1.8.0",
104
+ "@spectrum-web-components/overlay": "1.8.0",
105
+ "@spectrum-web-components/popover": "1.8.0",
106
+ "@spectrum-web-components/reactive-controllers": "1.8.0",
107
+ "@spectrum-web-components/shared": "1.8.0"
108
108
  },
109
109
  "types": "./src/index.d.ts",
110
110
  "customElements": "custom-elements.json",
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { MenuDivider } from './src/MenuDivider.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-divider.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuDivider } from './src/MenuDivider.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-divider', MenuDivider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-divider': MenuDivider;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuDivider } from './src/MenuDivider.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-divider', MenuDivider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-divider': MenuDivider;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,cAAc,mBAAmB,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-divider.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuDivider } from './src/MenuDivider.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-divider', MenuDivider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-divider': MenuDivider;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuDivider } from './src/MenuDivider.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-divider', MenuDivider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-divider': MenuDivider;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,eAAAA,MAAmB,uBAC5B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,kBAAmBD,CAAW",
6
6
  "names": ["MenuDivider", "defineElement"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { MenuGroup } from './src/MenuGroup.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-group.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuGroup } from './src/MenuGroup.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-group', MenuGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-group': MenuGroup;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuGroup } from './src/MenuGroup.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-group', MenuGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-group': MenuGroup;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAE9B,cAAc,iBAAiB,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-group.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuGroup } from './src/MenuGroup.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-group', MenuGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-group': MenuGroup;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuGroup } from './src/MenuGroup.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-group', MenuGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-group': MenuGroup;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,aAAAA,MAAiB,qBAC1B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,gBAAiBD,CAAS",
6
6
  "names": ["MenuGroup", "defineElement"]
7
7
  }
package/sp-menu-item.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { MenuItem } from './src/MenuItem.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-item.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuItem } from './src/MenuItem.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-item', MenuItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-item': MenuItem;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuItem } from './src/MenuItem.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-item', MenuItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-item': MenuItem;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAE9B,cAAc,gBAAgB,QAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu-item.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { MenuItem } from './src/MenuItem.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-item', MenuItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-item': MenuItem;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { MenuItem } from './src/MenuItem.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu-item', MenuItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-item': MenuItem;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,YAAAA,MAAgB,oBACzB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,eAAgBD,CAAQ",
6
6
  "names": ["MenuItem", "defineElement"]
7
7
  }
package/sp-menu.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { Menu } from './src/Menu.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Menu } from './src/Menu.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu', Menu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu': Menu;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Menu } from './src/Menu.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu', Menu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu': Menu;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,cAAc,WAAW,IAAI;",
6
6
  "names": []
7
7
  }
package/sp-menu.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-menu.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Menu } from './src/Menu.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu', Menu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu': Menu;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Menu } from './src/Menu.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-menu', Menu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu': Menu;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,QAAAA,MAAY,gBACrB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,UAAWD,CAAI",
6
6
  "names": ["Menu", "defineElement"]
7
7
  }
package/src/Menu.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { MenuItem } from './MenuItem.js';
3
14
  import type { MenuItemKeydownEvent } from './MenuItem.js';
@@ -35,6 +46,69 @@ export declare class Menu extends Menu_base {
35
46
  };
36
47
  private get isSubmenu();
37
48
  protected rovingTabindexController?: RovingTabindexController<MenuItem>;
49
+ /**
50
+ * iPad scroll detection properties
51
+ *
52
+ * This feature prevents menu item selection during iPad scrolling to avoid
53
+ * accidental selections when users are trying to scroll through a long menu.
54
+ *
55
+ * How it works:
56
+ * 1. On touchstart: Record initial Y position and timestamp
57
+ * 2. On touchmove: Calculate vertical movement and time elapsed
58
+ * 3. If movement > threshold AND time < threshold: Mark as scrolling
59
+ * 4. On touchend: Reset scrolling state after a delay
60
+ * 5. During selection: Prevent selection if scrolling is detected
61
+ *
62
+ * This prevents the common iPad issue where users accidentally select menu
63
+ * items while trying to scroll through the menu content.
64
+ *
65
+ * Threshold Values:
66
+ * - Movement threshold: 10px (consistent with Card component click vs. drag detection)
67
+ * - Time threshold: 300ms (consistent with longpress duration across the design system)
68
+ * - Reset delay: 100ms (allows final touch events to be processed)
69
+ *
70
+ * These values are carefully chosen to balance preventing accidental triggers
71
+ * while allowing intentional scroll gestures. They represent a common UX pattern
72
+ * in mobile interfaces and are consistent with other components in the design system.
73
+ */
74
+ private touchStartY;
75
+ private touchStartTime;
76
+ private isCurrentlyScrolling;
77
+ /**
78
+ * Minimum vertical movement (in pixels) required to trigger scrolling detection.
79
+ *
80
+ * This threshold is consistent with other components in the design system:
81
+ * - Card component uses 10px for click vs. drag detection
82
+ * - Menu component uses 10px for scroll vs. selection detection
83
+ *
84
+ * The 10px threshold is carefully chosen to:
85
+ * - Allow for natural finger tremor and accidental touches
86
+ * - Distinguish between intentional scroll gestures and taps
87
+ * - Provide consistent behavior across the platform
88
+ *
89
+ * @see {@link packages/card/src/Card.ts} for similar threshold usage
90
+ */
91
+ private scrollThreshold;
92
+ /**
93
+ * Maximum time (in milliseconds) for a movement to be considered scrolling.
94
+ *
95
+ * This threshold is consistent with other timing values in the design system:
96
+ * - Longpress duration: 300ms (ActionButton, LongpressController)
97
+ * - Scroll detection: 300ms (Menu component)
98
+ *
99
+ * Quick movements within this timeframe are likely intentional scrolls,
100
+ * while slower movements are more likely taps or selections.
101
+ *
102
+ * @see {@link packages/action-button/src/ActionButton.ts} for longpress duration
103
+ * @see {@link packages/overlay/src/LongpressController.ts} for longpress duration
104
+ */
105
+ private scrollTimeThreshold;
106
+ /**
107
+ * Public getter for scrolling state
108
+ * Returns true if the component is currently in a scrolling state
109
+ */
110
+ get isScrolling(): boolean;
111
+ set isScrolling(value: boolean);
38
112
  /**
39
113
  * label of the menu
40
114
  */
@@ -127,6 +201,39 @@ export declare class Menu extends Menu_base {
127
201
  */
128
202
  focusOnFirstSelectedItem({ preventScroll, }?: FocusOptions): void;
129
203
  focus({ preventScroll }?: FocusOptions): void;
204
+ /**
205
+ * Handles touchstart events for iPad scroll detection.
206
+ *
207
+ * Records the initial touch position and timestamp to establish a baseline
208
+ * for detecting scroll gestures. Only processes single-touch events to
209
+ * avoid interference with multi-touch gestures.
210
+ *
211
+ * @param event - The TouchEvent from the touchstart event
212
+ */
213
+ private handleTouchStart;
214
+ /**
215
+ * Handles touchmove events for iPad scroll detection.
216
+ *
217
+ * Calculates the vertical movement distance and time elapsed since touchstart.
218
+ * If the movement exceeds the threshold (10px) and happens within the time
219
+ * threshold (300ms), it marks the interaction as scrolling. This helps
220
+ * distinguish between intentional scroll gestures and accidental touches.
221
+ *
222
+ * @param event - The TouchEvent from the touchmove event
223
+ */
224
+ private handleTouchMove;
225
+ /**
226
+ * Handles touchend events for iPad scroll detection.
227
+ *
228
+ * Resets the scrolling state after a short delay (100ms) to allow for
229
+ * any final touch events to be processed. This delay prevents immediate
230
+ * state changes that could interfere with the selection logic.
231
+ *
232
+ * The 100ms delay is consistent with the design system's approach to
233
+ * touch event handling and ensures that any final touch events or
234
+ * gesture recognition can complete before the scrolling state is reset.
235
+ */
236
+ private handleTouchEnd;
130
237
  private pointerUpTarget;
131
238
  private handleFocusout;
132
239
  private handleClick;