@lion/ui 0.18.0-menu-system.6 → 0.18.0-menu-system.7
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/components/menu/src/InteractiveListMixin.js +9 -10
- package/components/menu/src/LionMenu.js +1 -1
- package/components/menu/src/LionTree.js +1 -1
- package/components/menu/src/MultiLevelListMixin.js +46 -9
- package/components/menu/test/InteractiveListMixin.test.js +3 -0
- package/components/menu/test/MoreButtonMenuMixin.test.js +4 -0
- package/components/menu/test/MultiLevelListMixin.test.js +3 -0
- package/components/menu/test/lion-menu-hybrid.test.js +3 -0
- package/components/menu/test/lion-menu.test.js +7 -2
- package/components/menu/test/lion-toolbar.test.js +8 -0
- package/components/menu/test/lion-tree.test.js +7 -0
- package/components/menu/test-helpers/mimicKeyPress.js +9 -0
- package/components/menu/test-suites/InteractiveListMixin.suite.js +154 -342
- package/components/menu/test-suites/LionMenu.suite.js +113 -0
- package/components/menu/test-suites/LionMenuHybrid.suite.js +1 -1
- package/components/menu/test-suites/MoreButtonMenuMixin.suite.js +372 -0
- package/components/menu/test-suites/MultiLevelListMixin.suite.js +303 -0
- package/components/menu/types/InteractiveListMixinTypes.d.ts +2 -0
- package/components/overlays/types/OverlayMixinTypes.ts +2 -0
- package/custom-elements.json +245 -153
- package/dist-types/components/combobox/src/LionCombobox.d.ts +1 -1
- package/dist-types/components/dialog/src/LionDialog.d.ts +1 -1
- package/dist-types/components/input-datepicker/src/LionInputDatepicker.d.ts +1 -1
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts +3 -3
- package/dist-types/components/menu/src/InteractiveListMixin.d.ts.map +1 -1
- package/dist-types/components/menu/src/LionMenu.d.ts +75 -5
- package/dist-types/components/menu/src/LionMenu.d.ts.map +1 -1
- package/dist-types/components/menu/src/LionMenuOverlay.d.ts +4 -2
- package/dist-types/components/menu/src/LionMenuOverlay.d.ts.map +1 -1
- package/dist-types/components/menu/src/LionTree.d.ts +2 -2
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts +10 -2
- package/dist-types/components/menu/src/MultiLevelListMixin.d.ts.map +1 -1
- package/dist-types/components/menu/test/InteractiveListMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/InteractiveListMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/MoreButtonMenuMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/MoreButtonMenuMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/MultiLevelListMixin.test.d.ts +2 -0
- package/dist-types/components/menu/test/MultiLevelListMixin.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/lion-menu-hybrid.test.d.ts +2 -0
- package/dist-types/components/menu/test/lion-menu-hybrid.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/lion-toolbar.test.d.ts +2 -0
- package/dist-types/components/menu/test/lion-toolbar.test.d.ts.map +1 -0
- package/dist-types/components/menu/test/lion-tree.test.d.ts +2 -0
- package/dist-types/components/menu/test/lion-tree.test.d.ts.map +1 -0
- package/dist-types/components/menu/test-helpers/mimicKeyPress.d.ts +7 -0
- package/dist-types/components/menu/test-helpers/mimicKeyPress.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/InteractiveListMixin.suite.d.ts.map +1 -1
- package/dist-types/components/menu/test-suites/LionMenu.suite.d.ts +9 -0
- package/dist-types/components/menu/test-suites/LionMenu.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/MoreButtonMenuMixin.suite.d.ts +14 -0
- package/dist-types/components/menu/test-suites/MoreButtonMenuMixin.suite.d.ts.map +1 -0
- package/dist-types/components/menu/test-suites/MultiLevelListMixin.suite.d.ts +11 -0
- package/dist-types/components/menu/test-suites/MultiLevelListMixin.suite.d.ts.map +1 -0
- package/dist-types/components/overlays/types/OverlayMixinTypes.d.ts +1 -0
- package/dist-types/components/overlays/types/OverlayMixinTypes.d.ts.map +1 -1
- package/dist-types/components/select-rich/src/LionSelectRich.d.ts +1 -1
- package/dist-types/components/tooltip/src/LionTooltip.d.ts +1 -1
- package/dist-types/exports/menu-test-suites.d.ts +2 -0
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/menu/api-table.md +44 -39
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/use-cases.md +2 -2
- package/docs/components/tabs/examples.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/how-to/index.md +1 -1
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/exports/menu-test-suites.js +2 -0
- package/menu-test-suites.js +2 -0
- package/package.json +1 -1
- package/components/menu/src/utils/uuid.js +0 -3
- package/dist-types/components/menu/src/utils/uuid.d.ts +0 -2
- package/dist-types/components/menu/src/utils/uuid.d.ts.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
3
|
import { html, css, LitElement } from 'lit';
|
|
4
|
-
import { SlotMixin, DisabledMixin } from '@lion/ui/core.js';
|
|
4
|
+
import { SlotMixin, DisabledMixin, uuid } from '@lion/ui/core.js';
|
|
5
5
|
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
6
6
|
import { MoreButtonMenuMixin } from './MoreButtonMenuMixin.js';
|
|
7
|
-
import { uuid } from './utils/uuid.js';
|
|
8
7
|
import { isInView } from './utils/isInView.js';
|
|
9
8
|
import {
|
|
10
9
|
isDisabled,
|
|
@@ -167,7 +166,7 @@ const InteractiveListMixinImplementation = superclass =>
|
|
|
167
166
|
multipleChoice: { type: Boolean, attribute: 'multiple-choice' },
|
|
168
167
|
// TODO: align with name of open-ui
|
|
169
168
|
selectionFollowsFocus: { type: Boolean, attribute: 'selection-follows-focus' },
|
|
170
|
-
// TODO: align with name of open-ui => "wrap" in
|
|
169
|
+
// TODO: align with name of open-ui => "wrap" in focusgroup
|
|
171
170
|
rotateKeyboardNavigation: { type: Boolean, attribute: 'rotate-keyboard-navigation' },
|
|
172
171
|
// TODO: align with name of open-ui
|
|
173
172
|
noPreselect: { type: Boolean, attribute: 'no-preselect' },
|
|
@@ -556,7 +555,7 @@ const InteractiveListMixinImplementation = superclass =>
|
|
|
556
555
|
// having hideVisually as hide mechanism (opening on focus, closing on blur).
|
|
557
556
|
// N.B. this._listNode has `display:flex`. This means we need to add `text-wrap: nowrap;`
|
|
558
557
|
// to avoid elems going over two lines, or give them a max-height based on measuring the height of one item.
|
|
559
|
-
// 2. N.B. hideVisually needs to be
|
|
558
|
+
// 2. N.B. hideVisually needs to be implemented in OverlayController.
|
|
560
559
|
// 3. when the more menu opens a next level, MultiLevelListMixin will be applied to the host as well.
|
|
561
560
|
// That means it knows when a child menu is open. If _subListMap of one of the items is open, we should hide more menu like this:
|
|
562
561
|
// https://jsfiddle.net/a4ocktfp/19/
|
|
@@ -588,7 +587,7 @@ const InteractiveListMixinImplementation = superclass =>
|
|
|
588
587
|
}
|
|
589
588
|
});
|
|
590
589
|
|
|
591
|
-
this.
|
|
590
|
+
this._syncCurrentPageWithLocationHref(window.location);
|
|
592
591
|
}
|
|
593
592
|
|
|
594
593
|
/**
|
|
@@ -817,12 +816,12 @@ const InteractiveListMixinImplementation = superclass =>
|
|
|
817
816
|
/**
|
|
818
817
|
* @param {Location} location
|
|
819
818
|
*/
|
|
820
|
-
|
|
819
|
+
_syncCurrentPageWithLocationHref(location) {
|
|
821
820
|
this.listItems.forEach(item => {
|
|
822
821
|
if (/** @type {HTMLAnchorElement} */ (item).href) {
|
|
823
|
-
const pathname = location.
|
|
824
|
-
? location.
|
|
825
|
-
: location.
|
|
822
|
+
const pathname = location.href.endsWith('/')
|
|
823
|
+
? location.href.substring(0, location.href.length - 1)
|
|
824
|
+
: location.href;
|
|
826
825
|
if (pathname === /** @type {HTMLAnchorElement} */ (item).href) {
|
|
827
826
|
setChecked(item);
|
|
828
827
|
} else {
|
|
@@ -834,7 +833,7 @@ const InteractiveListMixinImplementation = superclass =>
|
|
|
834
833
|
|
|
835
834
|
/** @protected */
|
|
836
835
|
_onPopState = () => {
|
|
837
|
-
this.
|
|
836
|
+
this._syncCurrentPageWithLocationHref(document.location);
|
|
838
837
|
};
|
|
839
838
|
};
|
|
840
839
|
// @ts-ignore
|
|
@@ -22,7 +22,7 @@ export class LionTree extends MultiLevelListMixin(LitElement) {
|
|
|
22
22
|
super.updated(changedProperties);
|
|
23
23
|
|
|
24
24
|
if (changedProperties.has('level')) {
|
|
25
|
-
if (this.level >
|
|
25
|
+
if (this.level > 1) {
|
|
26
26
|
this._listNode.setAttribute('role', 'group');
|
|
27
27
|
}
|
|
28
28
|
this.__setAriaLevelForListItems();
|
|
@@ -3,10 +3,12 @@ import { html } from 'lit';
|
|
|
3
3
|
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
4
4
|
// import { DisclosureMixin } from '@lion/ui/collapsible.js';
|
|
5
5
|
import { InteractiveListMixin } from './InteractiveListMixin.js';
|
|
6
|
-
|
|
6
|
+
import { isChecked, setChecked } from './utils/listItemInteractions.js';
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {import('./InteractiveListMixin.js').LionItem} LionItem
|
|
9
9
|
* @typedef {import('../types/InteractiveListMixinTypes.js').InteractiveListHost} InteractiveList
|
|
10
|
+
* @typedef {typeof import('../../overlays/types/OverlayMixinTypes.js').OverlayHost} OverlayHost
|
|
11
|
+
* @typedef {import('./LionMenuOverlay.js').LionMenuOverlay} LionMenuOverlay
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -37,8 +39,13 @@ const MultiLevelListMixinImplementation = superclass =>
|
|
|
37
39
|
* @configure DisclosureMixin
|
|
38
40
|
*/
|
|
39
41
|
get _invokerNode() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const ctor = /** @type {OverlayHost} */ (this.constructor);
|
|
43
|
+
if (ctor._getFocusableInvokerEl && this.invokerNode) {
|
|
44
|
+
// @ts-ignore - accessing static method and super property
|
|
45
|
+
return ctor._getFocusableInvokerEl(this.invokerNode);
|
|
46
|
+
}
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
return super._invokerNode;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
/**
|
|
@@ -84,6 +91,7 @@ const MultiLevelListMixinImplementation = superclass =>
|
|
|
84
91
|
this.noPreselect = true;
|
|
85
92
|
/**
|
|
86
93
|
* @configure InteractiveListMixin
|
|
94
|
+
* @type {'activedescendant'|'roving-tabindex'|'tabbable-disclosure'}
|
|
87
95
|
*/
|
|
88
96
|
this._activeMode = 'roving-tabindex';
|
|
89
97
|
/**
|
|
@@ -184,12 +192,12 @@ const MultiLevelListMixinImplementation = superclass =>
|
|
|
184
192
|
* @param {*} ev
|
|
185
193
|
*/
|
|
186
194
|
_onListKeyDown(ev) {
|
|
187
|
-
const
|
|
195
|
+
const targetFromSubList = Array.from(this._subListMap).find(
|
|
188
196
|
// @ts-ignore - contains method on InteractiveListHost
|
|
189
197
|
([, s]) => s === ev.target || s.contains(ev.target),
|
|
190
198
|
);
|
|
191
199
|
|
|
192
|
-
if (
|
|
200
|
+
if (targetFromSubList) {
|
|
193
201
|
return;
|
|
194
202
|
}
|
|
195
203
|
|
|
@@ -228,22 +236,51 @@ const MultiLevelListMixinImplementation = superclass =>
|
|
|
228
236
|
if (this.orientation === 'horizontal' && parentListOfActiveItem) {
|
|
229
237
|
// @ts-ignore - close method
|
|
230
238
|
this.close();
|
|
231
|
-
|
|
232
|
-
|
|
239
|
+
if (
|
|
240
|
+
/** @type {InteractiveList & LionMenuOverlay} */ (parentListOfActiveItem)
|
|
241
|
+
._onOverlayShow
|
|
242
|
+
) {
|
|
243
|
+
// @ts-ignore - _onOverlayShow method
|
|
244
|
+
/** @type {OverlayHost} */ (parentListOfActiveItem)._onOverlayShow();
|
|
245
|
+
}
|
|
233
246
|
}
|
|
234
247
|
break;
|
|
235
248
|
case 'ArrowLeft':
|
|
236
249
|
if (this.orientation === 'vertical' && parentListOfActiveItem) {
|
|
237
250
|
// @ts-ignore - close method
|
|
238
251
|
this.close();
|
|
239
|
-
|
|
240
|
-
|
|
252
|
+
if (
|
|
253
|
+
/** @type {InteractiveList & LionMenuOverlay} */ (parentListOfActiveItem)
|
|
254
|
+
._onOverlayShow
|
|
255
|
+
) {
|
|
256
|
+
// @ts-ignore - _onOverlayShow method
|
|
257
|
+
/** @type {OverlayHost} */ (parentListOfActiveItem)._onOverlayShow();
|
|
258
|
+
}
|
|
241
259
|
}
|
|
242
260
|
break;
|
|
243
261
|
/* no default */
|
|
244
262
|
}
|
|
245
263
|
}
|
|
246
264
|
|
|
265
|
+
/**
|
|
266
|
+
* @param {Location} location
|
|
267
|
+
*/
|
|
268
|
+
_syncCurrentPageWithLocationHref(location) {
|
|
269
|
+
super._syncCurrentPageWithLocationHref(location);
|
|
270
|
+
|
|
271
|
+
this._subListMap.forEach(subList => {
|
|
272
|
+
subList.listItems.forEach(
|
|
273
|
+
/** @param {LionItem|HTMLElement} item */ item => {
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
if (isChecked(item) && subList._invokerNode) {
|
|
276
|
+
// @ts-ignore
|
|
277
|
+
setChecked(subList._invokerNode);
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
247
284
|
// /**
|
|
248
285
|
// * @enhance DisclosureMixin
|
|
249
286
|
// */
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { runInteractiveListMixinSuite } from '../test-suites/InteractiveListMixin.suite.js';
|
|
2
|
+
import { runMultiLevelListMixinSuite } from '../test-suites/MultiLevelListMixin.suite.js';
|
|
3
|
+
import { runMoreButtonMenuMixinSuite } from '../test-suites/MoreButtonMenuMixin.suite.js';
|
|
4
|
+
import { runLionMenuSuite } from '../test-suites/LionMenu.suite.js';
|
|
2
5
|
import '@lion/ui/define/lion-menu.js';
|
|
3
|
-
import
|
|
6
|
+
import '@lion/ui/define/lion-menu-overlay.js';
|
|
4
7
|
|
|
5
8
|
runInteractiveListMixinSuite({ tagString: 'lion-menu' });
|
|
6
|
-
|
|
9
|
+
runMultiLevelListMixinSuite({ tagString: 'lion-menu', tagChildString: 'lion-menu-overlay' });
|
|
10
|
+
runMoreButtonMenuMixinSuite({ tagString: 'lion-menu' });
|
|
11
|
+
runLionMenuSuite({ tagString: 'lion-menu' });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// import { runInteractiveListMixinSuite } from '../test-suites/InteractiveListMixin.suite.js';
|
|
2
|
+
// import { runMultiLevelListMixinSuite } from '../test-suites/MultiLevelListMixin.suite.js';
|
|
3
|
+
import { runMoreButtonMenuMixinSuite } from '../test-suites/MoreButtonMenuMixin.suite.js';
|
|
4
|
+
import '@lion/ui/define/lion-toolbar.js';
|
|
5
|
+
|
|
6
|
+
// runInteractiveListMixinSuite({ tagString: 'lion-toolbar' }); // 1 test fails
|
|
7
|
+
// runMultiLevelListMixinSuite({ tagString: 'lion-toolbar', tagChildString: 'lion-toolbar' }); // hangs
|
|
8
|
+
runMoreButtonMenuMixinSuite({ tagString: 'lion-toolbar' });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { runInteractiveListMixinSuite } from '../test-suites/InteractiveListMixin.suite.js';
|
|
2
|
+
// import { runMultiLevelListMixinSuite } from '../test-suites/MultiLevelListMixin.suite.js';
|
|
3
|
+
import '@lion/ui/define/lion-tree.js';
|
|
4
|
+
|
|
5
|
+
runInteractiveListMixinSuite({ tagString: 'lion-tree' });
|
|
6
|
+
// TODO: fix failing tests. LionTree is missing a close function, should this be coming from the DisclosureMixin?
|
|
7
|
+
// runMultiLevelListMixinSuite({ tagString: 'lion-tree', tagChildString: 'lion-tree' });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {HTMLElement} el
|
|
3
|
+
* @param {string} key
|
|
4
|
+
* @param {string} code
|
|
5
|
+
*/
|
|
6
|
+
export function mimicKeyPress(el, key, code = '') {
|
|
7
|
+
el.dispatchEvent(new KeyboardEvent('keydown', { key, code }));
|
|
8
|
+
el.dispatchEvent(new KeyboardEvent('keyup', { key, code }));
|
|
9
|
+
}
|