@spectrum-web-components/menu 0.12.2 → 0.12.3-express.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 (69) hide show
  1. package/package.json +3 -3
  2. package/sp-menu-divider.d.ts +6 -0
  3. package/sp-menu-divider.js +14 -0
  4. package/sp-menu-divider.js.map +1 -0
  5. package/sp-menu-group.d.ts +6 -0
  6. package/sp-menu-group.js +14 -0
  7. package/sp-menu-group.js.map +1 -0
  8. package/sp-menu-item.d.ts +6 -0
  9. package/sp-menu-item.js +14 -0
  10. package/sp-menu-item.js.map +1 -0
  11. package/sp-menu.d.ts +6 -0
  12. package/sp-menu.js +14 -0
  13. package/sp-menu.js.map +1 -0
  14. package/src/Menu.d.ts +104 -0
  15. package/src/Menu.js +625 -0
  16. package/src/Menu.js.map +1 -0
  17. package/src/MenuDivider.d.ts +8 -0
  18. package/src/MenuDivider.js +25 -0
  19. package/src/MenuDivider.js.map +1 -0
  20. package/src/MenuGroup.d.ts +20 -0
  21. package/src/MenuGroup.js +86 -0
  22. package/src/MenuGroup.js.map +1 -0
  23. package/src/MenuItem.d.ts +110 -0
  24. package/src/MenuItem.js +465 -0
  25. package/src/MenuItem.js.map +1 -0
  26. package/src/index.d.ts +4 -0
  27. package/src/index.js +16 -0
  28. package/src/index.js.map +1 -0
  29. package/src/menu-divider.css.d.ts +2 -0
  30. package/src/menu-divider.css.js +19 -0
  31. package/src/menu-divider.css.js.map +1 -0
  32. package/src/menu-group.css.d.ts +2 -0
  33. package/src/menu-group.css.js +19 -0
  34. package/src/menu-group.css.js.map +1 -0
  35. package/src/menu-item.css.d.ts +2 -0
  36. package/src/menu-item.css.js +76 -0
  37. package/src/menu-item.css.js.map +1 -0
  38. package/src/menu.css.d.ts +2 -0
  39. package/src/menu.css.js +74 -0
  40. package/src/menu.css.js.map +1 -0
  41. package/src/spectrum-checkmark.css.d.ts +2 -0
  42. package/src/spectrum-checkmark.css.js +21 -0
  43. package/src/spectrum-checkmark.css.js.map +1 -0
  44. package/src/spectrum-chevron.css.d.ts +2 -0
  45. package/src/spectrum-chevron.css.js +21 -0
  46. package/src/spectrum-chevron.css.js.map +1 -0
  47. package/src/spectrum-itemLabel.css.d.ts +2 -0
  48. package/src/spectrum-itemLabel.css.js +17 -0
  49. package/src/spectrum-itemLabel.css.js.map +1 -0
  50. package/src/spectrum-menu-divider.css.d.ts +2 -0
  51. package/src/spectrum-menu-divider.css.js +19 -0
  52. package/src/spectrum-menu-divider.css.js.map +1 -0
  53. package/src/spectrum-menu-item.css.d.ts +2 -0
  54. package/src/spectrum-menu-item.css.js +68 -0
  55. package/src/spectrum-menu-item.css.js.map +1 -0
  56. package/src/spectrum-menu-sectionHeading.css.d.ts +2 -0
  57. package/src/spectrum-menu-sectionHeading.css.js +19 -0
  58. package/src/spectrum-menu-sectionHeading.css.js.map +1 -0
  59. package/src/spectrum-menu.css.d.ts +2 -0
  60. package/src/spectrum-menu.css.js +74 -0
  61. package/src/spectrum-menu.css.js.map +1 -0
  62. package/stories/menu-group.stories.js +136 -0
  63. package/stories/menu-group.stories.js.map +1 -0
  64. package/stories/menu-item.stories.js +82 -0
  65. package/stories/menu-item.stories.js.map +1 -0
  66. package/stories/menu.stories.js +247 -0
  67. package/stories/menu.stories.js.map +1 -0
  68. package/stories/submenu.stories.js +302 -0
  69. package/stories/submenu.stories.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/menu",
3
- "version": "0.12.2",
3
+ "version": "0.12.3-express.0+7a2be85d7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -54,7 +54,7 @@
54
54
  "@spectrum-web-components/base": "^0.5.3",
55
55
  "@spectrum-web-components/icon": "^0.11.4",
56
56
  "@spectrum-web-components/icons-ui": "^0.8.4",
57
- "@spectrum-web-components/overlay": "^0.15.0",
57
+ "@spectrum-web-components/overlay": "^0.15.1-express.0+7a2be85d7",
58
58
  "@spectrum-web-components/shared": "^0.13.5",
59
59
  "tslib": "^2.0.0"
60
60
  },
@@ -66,5 +66,5 @@
66
66
  "sideEffects": [
67
67
  "./sp-*.js"
68
68
  ],
69
- "gitHead": "57aba8030b6af96af4015a0aa830e342a17dc219"
69
+ "gitHead": "7a2be85d7e231dcf4141a86b7056f6c139a43851"
70
70
  }
@@ -0,0 +1,6 @@
1
+ import { MenuDivider } from './src/MenuDivider.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-menu-divider': MenuDivider;
5
+ }
6
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ Copyright 2020 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
+ */
12
+ import { MenuDivider } from './src/MenuDivider.js';
13
+ customElements.define('sp-menu-divider', MenuDivider);
14
+ //# sourceMappingURL=sp-menu-divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sp-menu-divider.js","sourceRoot":"","sources":["sp-menu-divider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC","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';\n\ncustomElements.define('sp-menu-divider', MenuDivider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-divider': MenuDivider;\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { MenuGroup } from './src/MenuGroup.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-menu-group': MenuGroup;
5
+ }
6
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ Copyright 2020 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
+ */
12
+ import { MenuGroup } from './src/MenuGroup.js';
13
+ customElements.define('sp-menu-group', MenuGroup);
14
+ //# sourceMappingURL=sp-menu-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sp-menu-group.js","sourceRoot":"","sources":["sp-menu-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC","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';\n\ncustomElements.define('sp-menu-group', MenuGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-group': MenuGroup;\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { MenuItem } from './src/MenuItem.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-menu-item': MenuItem;
5
+ }
6
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ Copyright 2020 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
+ */
12
+ import { MenuItem } from './src/MenuItem.js';
13
+ customElements.define('sp-menu-item', MenuItem);
14
+ //# sourceMappingURL=sp-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sp-menu-item.js","sourceRoot":"","sources":["sp-menu-item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC","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';\n\ncustomElements.define('sp-menu-item', MenuItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu-item': MenuItem;\n }\n}\n"]}
package/sp-menu.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Menu } from './src/Menu.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-menu': Menu;
5
+ }
6
+ }
package/sp-menu.js ADDED
@@ -0,0 +1,14 @@
1
+ /*
2
+ Copyright 2020 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
+ */
12
+ import { Menu } from './src/Menu.js';
13
+ customElements.define('sp-menu', Menu);
14
+ //# sourceMappingURL=sp-menu.js.map
package/sp-menu.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sp-menu.js","sourceRoot":"","sources":["sp-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC","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';\n\ncustomElements.define('sp-menu', Menu);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-menu': Menu;\n }\n}\n"]}
package/src/Menu.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
+ import { MenuItem } from './MenuItem.js';
3
+ export interface MenuChildItem {
4
+ menuItem: MenuItem;
5
+ managed: boolean;
6
+ active: boolean;
7
+ focusable: boolean;
8
+ focusRoot: Menu;
9
+ }
10
+ /**
11
+ * Spectrum Menu Component
12
+ * @element sp-menu
13
+ *
14
+ * @slot - menu items to be listed in the menu
15
+ * @fires change - Announces that the `value` of the element has changed
16
+ * @attr selects - whether the element has a specific selection algorithm that it applies
17
+ * to its item descendants. `single` allows only one descendent to be selected at a time.
18
+ * `multiple` allows many descendants to be selected. `inherit` will be applied dynamically
19
+ * when an ancestor of this element is actively managing the selection of its descendents.
20
+ * When the `selects` attribute is not present a `value` will not be maintained and the Menu
21
+ * Item children of this Menu will not have their `selected` state managed.
22
+ */
23
+ export declare class Menu extends SpectrumElement {
24
+ static get styles(): CSSResultArray;
25
+ get closeSelfAsSubmenu(): (leave?: boolean) => void;
26
+ setCloseSelfAsSubmenu(cb: (leave?: boolean) => void): void;
27
+ _closeSelfAsSubmenu: () => void;
28
+ isSubmenu: boolean;
29
+ get closeOpenSubmenu(): (leave?: boolean) => void;
30
+ setCloseOpenSubmenu(cb: (leave?: boolean) => void): void;
31
+ _closeOpenSubmenu: () => void;
32
+ hasOpenSubmenu: boolean;
33
+ label: string;
34
+ selects: undefined | 'inherit' | 'single' | 'multiple';
35
+ value: string;
36
+ valueSeparator: string;
37
+ selected: string[];
38
+ selectedItems: MenuItem[];
39
+ menuSlot: HTMLSlotElement;
40
+ private childItemSet;
41
+ focusedItemIndex: number;
42
+ focusInItemIndex: number;
43
+ private selectedItemsMap;
44
+ get childItems(): MenuItem[];
45
+ private cachedChildItems;
46
+ private updateCachedMenuItems;
47
+ /**
48
+ * Hide this getter from web-component-analyzer until
49
+ * https://github.com/runem/web-component-analyzer/issues/131
50
+ * has been addressed.
51
+ *
52
+ * @private
53
+ */
54
+ get childRole(): string;
55
+ protected get ownRole(): string;
56
+ private resolvedSelects?;
57
+ private resolvedRole?;
58
+ /**
59
+ * When a descendant `<sp-menu-item>` element is added or updated it will dispatch
60
+ * this event to announce its presence in the DOM. During the capture phase the first
61
+ * Menu based element that the event encounters will manage the focus state of the
62
+ * dispatching `<sp-menu-item>` element.
63
+ * @param event
64
+ */
65
+ private onFocusableItemAddedOrUpdated;
66
+ /**
67
+ * When a descendant `<sp-menu-item>` element is added or updated it will dispatch
68
+ * this event to announce its presence in the DOM. During the bubble phase the first
69
+ * Menu based element that the event encounters that does not inherit selection will
70
+ * manage the selection state of the dispatching `<sp-menu-item>` element.
71
+ * @param event
72
+ */
73
+ private onSelectableItemAddedOrUpdated;
74
+ private addChildItem;
75
+ private removeChildItem;
76
+ constructor();
77
+ focus({ preventScroll }?: FocusOptions): void;
78
+ submenuWillCloseOn(menuItem: MenuItem): void;
79
+ private onClick;
80
+ handleFocusin(event: FocusEvent): void;
81
+ startListeningToKeyboard(): void;
82
+ handleFocusout(event: FocusEvent): void;
83
+ stopListeningToKeyboard(): void;
84
+ selectOrToggleItem(targetItem: MenuItem): Promise<void>;
85
+ protected navigateWithinMenu(event: KeyboardEvent): void;
86
+ protected navigateBetweenRelatedMenus(code: string): void;
87
+ handleKeydown(event: KeyboardEvent): void;
88
+ focusMenuItemByOffset(offset: number): MenuItem;
89
+ private prepareToCleanUp;
90
+ updateSelectedItemIndex(): void;
91
+ private _willUpdateItems;
92
+ private handleItemsChanged;
93
+ private updateItemFocus;
94
+ private forwardFocusVisibleToItem;
95
+ render(): TemplateResult;
96
+ private _notFirstUpdated;
97
+ protected firstUpdated(changed: PropertyValues): void;
98
+ protected updated(changes: PropertyValues<this>): void;
99
+ protected selectsChanged(): void;
100
+ connectedCallback(): void;
101
+ protected childItemsUpdated: Promise<unknown[]>;
102
+ protected cacheUpdated: Promise<void>;
103
+ protected getUpdateComplete(): Promise<boolean>;
104
+ }