@webtides/element-library 0.3.1 → 0.5.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.
- package/CHANGELOG.md +300 -0
- package/README.md +72 -56
- package/all.js +16 -0
- package/catalog.js +17 -1
- package/custom-elements.json +15912 -10065
- package/package.json +1 -1
- package/src/components/accordion/accordion.changelog.md +11 -0
- package/src/components/accordion/accordion.js +15 -3
- package/src/components/accordion/accordion.readme.md +27 -1
- package/src/components/accordion/accordion.style.js +19 -0
- package/src/components/app-bar/app-bar.changelog.md +24 -0
- package/src/components/app-bar/app-bar.define.js +3 -0
- package/src/components/app-bar/app-bar.js +91 -0
- package/src/components/app-bar/app-bar.readme.md +130 -0
- package/src/components/app-bar/app-bar.style.js +103 -0
- package/src/components/app-frame/app-frame.changelog.md +59 -0
- package/src/components/app-frame/app-frame.define.js +3 -0
- package/src/components/app-frame/app-frame.events.js +6 -0
- package/src/components/app-frame/app-frame.js +1085 -0
- package/src/components/app-frame/app-frame.readme.md +425 -0
- package/src/components/app-frame/app-frame.style.js +534 -0
- package/src/components/button/button.changelog.md +21 -0
- package/src/components/button/button.events.js +3 -0
- package/src/components/button/button.js +145 -3
- package/src/components/button/button.readme.md +72 -4
- package/src/components/button/button.style.js +167 -8
- package/src/components/button-group/button-group.changelog.md +10 -0
- package/src/components/button-group/button-group.readme.md +2 -0
- package/src/components/button-group/button-group.style.js +6 -2
- package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +6 -0
- package/src/components/checkbox-group-field/checkbox-group-field.js +7 -2
- package/src/components/checkbox-group-field/checkbox-group-field.readme.md +23 -1
- package/src/components/combobox-field/combobox-field.changelog.md +6 -0
- package/src/components/combobox-field/combobox-field.readme.md +8 -0
- package/src/components/combobox-field/combobox-field.style.js +2 -0
- package/src/components/date-field/date-field.changelog.md +6 -0
- package/src/components/date-field/date-field.readme.md +10 -0
- package/src/components/date-field/date-field.style.js +8 -3
- package/src/components/description-list/description-list.changelog.md +42 -0
- package/src/components/description-list/description-list.define.js +3 -0
- package/src/components/description-list/description-list.js +49 -0
- package/src/components/description-list/description-list.readme.md +161 -0
- package/src/components/description-list/description-list.style.js +169 -0
- package/src/components/dialog/dialog.changelog.md +7 -0
- package/src/components/dialog/dialog.readme.md +5 -0
- package/src/components/dialog/dialog.style.js +17 -2
- package/src/components/divider/divider.changelog.md +6 -0
- package/src/components/divider/divider.readme.md +1 -1
- package/src/components/divider/divider.style.js +6 -0
- package/src/components/drawer/drawer.changelog.md +7 -0
- package/src/components/drawer/drawer.readme.md +7 -6
- package/src/components/drawer/drawer.style.js +35 -2
- package/src/components/dropdown/dropdown.readme.md +6 -1
- package/src/components/file-field/file-field.changelog.md +8 -0
- package/src/components/file-field/file-field.js +135 -5
- package/src/components/file-field/file-field.readme.md +35 -6
- package/src/components/file-field/file-field.style.js +71 -0
- package/src/components/form-field/form-field.js +1 -1
- package/src/components/input-field/input-field.changelog.md +10 -0
- package/src/components/input-field/input-field.js +192 -14
- package/src/components/input-field/input-field.readme.md +88 -2
- package/src/components/input-field/input-field.style.js +2 -0
- package/src/components/list/list.changelog.md +30 -0
- package/src/components/list/list.define.js +3 -0
- package/src/components/list/list.js +68 -0
- package/src/components/list/list.readme.md +123 -0
- package/src/components/list/list.style.js +56 -0
- package/src/components/list-item/list-item.changelog.md +40 -0
- package/src/components/list-item/list-item.define.js +3 -0
- package/src/components/list-item/list-item.js +130 -0
- package/src/components/list-item/list-item.readme.md +144 -0
- package/src/components/list-item/list-item.style.js +246 -0
- package/src/components/menu/menu.changelog.md +44 -0
- package/src/components/menu/menu.define.js +3 -0
- package/src/components/menu/menu.events.js +5 -0
- package/src/components/menu/menu.js +793 -0
- package/src/components/menu/menu.readme.md +313 -0
- package/src/components/menu/menu.style.js +59 -0
- package/src/components/menu-group/menu-group.changelog.md +20 -0
- package/src/components/menu-group/menu-group.define.js +3 -0
- package/src/components/menu-group/menu-group.js +44 -0
- package/src/components/menu-group/menu-group.readme.md +74 -0
- package/src/components/menu-group/menu-group.style.js +38 -0
- package/src/components/menu-item/menu-item.changelog.md +32 -0
- package/src/components/menu-item/menu-item.define.js +3 -0
- package/src/components/menu-item/menu-item.js +168 -0
- package/src/components/menu-item/menu-item.readme.md +132 -0
- package/src/components/menu-item/menu-item.style.js +117 -0
- package/src/components/nav/nav.changelog.md +35 -0
- package/src/components/nav/nav.define.js +3 -0
- package/src/components/nav/nav.js +212 -0
- package/src/components/nav/nav.readme.md +248 -0
- package/src/components/nav/nav.style.js +269 -0
- package/src/components/nav-item/nav-item.changelog.md +25 -0
- package/src/components/nav-item/nav-item.define.js +3 -0
- package/src/components/nav-item/nav-item.js +75 -0
- package/src/components/nav-item/nav-item.readme.md +111 -0
- package/src/components/nav-item/nav-item.style.js +159 -0
- package/src/components/otp-field/otp-field.changelog.md +6 -0
- package/src/components/otp-field/otp-field.readme.md +8 -0
- package/src/components/otp-field/otp-field.style.js +8 -3
- package/src/components/pagination/pagination.changelog.md +8 -0
- package/src/components/pagination/pagination.js +123 -49
- package/src/components/pagination/pagination.readme.md +24 -6
- package/src/components/pagination/pagination.style.js +11 -1
- package/src/components/password-field/password-field.changelog.md +7 -0
- package/src/components/password-field/password-field.readme.md +11 -1
- package/src/components/password-field/password-field.style.js +2 -0
- package/src/components/popover/popover.changelog.md +6 -0
- package/src/components/popover/popover.style.js +1 -0
- package/src/components/radio-field/radio-field.changelog.md +6 -0
- package/src/components/radio-field/radio-field.js +7 -2
- package/src/components/radio-field/radio-field.readme.md +23 -1
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
- package/src/components/scroll-to-top/scroll-to-top.js +16 -12
- package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
- package/src/components/segmented-field/segmented-field.changelog.md +27 -0
- package/src/components/segmented-field/segmented-field.define.js +3 -0
- package/src/components/segmented-field/segmented-field.js +175 -0
- package/src/components/segmented-field/segmented-field.readme.md +140 -0
- package/src/components/segmented-field/segmented-field.style.js +193 -0
- package/src/components/splitter/splitter.changelog.md +24 -0
- package/src/components/splitter/splitter.define.js +3 -0
- package/src/components/splitter/splitter.events.js +4 -0
- package/src/components/splitter/splitter.js +237 -0
- package/src/components/splitter/splitter.readme.md +164 -0
- package/src/components/splitter/splitter.style.js +100 -0
- package/src/components/status-bar/status-bar.changelog.md +25 -0
- package/src/components/status-bar/status-bar.define.js +3 -0
- package/src/components/status-bar/status-bar.js +74 -0
- package/src/components/status-bar/status-bar.readme.md +139 -0
- package/src/components/status-bar/status-bar.style.js +122 -0
- package/src/components/tab-group/tab-group.changelog.md +7 -0
- package/src/components/tab-group/tab-group.js +30 -9
- package/src/components/tab-group/tab-group.readme.md +14 -0
- package/src/components/textarea-field/textarea-field.changelog.md +6 -0
- package/src/components/textarea-field/textarea-field.js +14 -1
- package/src/components/textarea-field/textarea-field.readme.md +23 -1
- package/src/components/toast/toast.changelog.md +6 -0
- package/src/components/toast/toast.readme.md +5 -3
- package/src/components/toast/toast.style.js +22 -6
- package/src/components/toolbar/toolbar.changelog.md +24 -0
- package/src/components/toolbar/toolbar.define.js +3 -0
- package/src/components/toolbar/toolbar.js +233 -0
- package/src/components/toolbar/toolbar.readme.md +156 -0
- package/src/components/toolbar/toolbar.style.js +49 -0
- package/src/components/tooltip/tooltip.changelog.md +11 -0
- package/src/components/tooltip/tooltip.js +51 -4
- package/src/components/tooltip/tooltip.readme.md +26 -1
- package/src/components/tree/tree.changelog.md +23 -0
- package/src/components/tree/tree.define.js +3 -0
- package/src/components/tree/tree.js +138 -0
- package/src/components/tree/tree.readme.md +119 -0
- package/src/components/tree/tree.style.js +16 -0
- package/src/components/tree-item/tree-item.changelog.md +23 -0
- package/src/components/tree-item/tree-item.define.js +3 -0
- package/src/components/tree-item/tree-item.events.js +3 -0
- package/src/components/tree-item/tree-item.js +246 -0
- package/src/components/tree-item/tree-item.readme.md +128 -0
- package/src/components/tree-item/tree-item.style.js +226 -0
- package/src/styles/appearance.style.js +47 -0
- package/src/styles/choice-group.style.js +27 -1
- package/src/styles/input-control.style.js +87 -0
- package/src/styles/modal.style.js +14 -1
- package/src/styles/native.css +100 -0
- package/src/styles/size.style.js +41 -0
- package/src/utils/floating.js +15 -1
- package/src/utils/focus.js +69 -0
- package/src/utils/options.js +35 -0
- package/src/utils/scroll.js +24 -0
- package/src/utils/text-entry-attributes.js +13 -0
- package/types/all.d.ts +16 -0
- package/types/src/components/accordion/accordion.d.ts +3 -1
- package/types/src/components/app-bar/app-bar.d.ts +43 -0
- package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
- package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
- package/types/src/components/app-frame/app-frame.d.ts +497 -0
- package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
- package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
- package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
- package/types/src/components/button/button.d.ts +61 -0
- package/types/src/components/button/button.events.d.ts +4 -0
- package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +5 -2
- package/types/src/components/combobox-field/combobox-field.d.ts +10 -0
- package/types/src/components/date-field/date-field.d.ts +10 -0
- package/types/src/components/description-list/description-list.d.ts +34 -0
- package/types/src/components/description-list/description-list.define.d.ts +1 -0
- package/types/src/components/description-list/description-list.style.d.ts +2 -0
- package/types/src/components/file-field/file-field.d.ts +68 -3
- package/types/src/components/form-field/form-field.d.ts +1 -1
- package/types/src/components/input-field/input-field.d.ts +99 -0
- package/types/src/components/list/list.d.ts +41 -0
- package/types/src/components/list/list.define.d.ts +1 -0
- package/types/src/components/list/list.style.d.ts +2 -0
- package/types/src/components/list-item/list-item.d.ts +64 -0
- package/types/src/components/list-item/list-item.define.d.ts +1 -0
- package/types/src/components/list-item/list-item.style.d.ts +2 -0
- package/types/src/components/menu/menu.d.ts +362 -0
- package/types/src/components/menu/menu.define.d.ts +1 -0
- package/types/src/components/menu/menu.events.d.ts +6 -0
- package/types/src/components/menu/menu.style.d.ts +2 -0
- package/types/src/components/menu-group/menu-group.d.ts +24 -0
- package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
- package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
- package/types/src/components/menu-item/menu-item.d.ts +80 -0
- package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
- package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
- package/types/src/components/nav/nav.d.ts +103 -0
- package/types/src/components/nav/nav.define.d.ts +1 -0
- package/types/src/components/nav/nav.style.d.ts +2 -0
- package/types/src/components/nav-item/nav-item.d.ts +39 -0
- package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
- package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
- package/types/src/components/otp-field/otp-field.d.ts +10 -0
- package/types/src/components/pagination/pagination.d.ts +31 -2
- package/types/src/components/password-field/password-field.d.ts +10 -0
- package/types/src/components/radio-field/radio-field.d.ts +5 -2
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
- package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
- package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
- package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
- package/types/src/components/splitter/splitter.d.ts +127 -0
- package/types/src/components/splitter/splitter.define.d.ts +1 -0
- package/types/src/components/splitter/splitter.events.d.ts +5 -0
- package/types/src/components/splitter/splitter.style.d.ts +2 -0
- package/types/src/components/status-bar/status-bar.d.ts +44 -0
- package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
- package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +17 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +7 -0
- package/types/src/components/toolbar/toolbar.d.ts +96 -0
- package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
- package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
- package/types/src/components/tooltip/tooltip.d.ts +26 -0
- package/types/src/components/tree/tree.d.ts +62 -0
- package/types/src/components/tree/tree.define.d.ts +1 -0
- package/types/src/components/tree/tree.style.d.ts +2 -0
- package/types/src/components/tree-item/tree-item.d.ts +106 -0
- package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
- package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
- package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
- package/types/src/styles/appearance.style.d.ts +31 -0
- package/types/src/styles/choice-group.style.d.ts +1 -1
- package/types/src/styles/input-control.style.d.ts +15 -0
- package/types/src/styles/modal.style.d.ts +5 -0
- package/types/src/styles/size.style.d.ts +24 -0
- package/types/src/utils/floating.d.ts +11 -0
- package/types/src/utils/focus.d.ts +25 -0
- package/types/src/utils/options.d.ts +17 -0
- package/types/src/utils/scroll.d.ts +11 -0
- package/types/src/utils/text-entry-attributes.d.ts +10 -0
- package/web-types.json +2935 -308
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
import Events from './menu.events.js';
|
|
3
|
+
/**
|
|
4
|
+
* A menu button: a button that opens a list of actions. "Edit, Duplicate, Delete" for a row of a
|
|
5
|
+
* table, the account in a header, "More" at the end of a toolbar. The button is what the page
|
|
6
|
+
* puts into the `trigger` slot, the actions are `el-menu-item` elements.
|
|
7
|
+
*
|
|
8
|
+
* To assistive technology it is a menu (`role="menu"`) of menu items, and the button says that it
|
|
9
|
+
* opens one and whether it is open. The keyboard moves through the entries with the arrow keys,
|
|
10
|
+
* `Home`, `End` and the first letter of an entry. `Escape` closes the menu and gives the focus
|
|
11
|
+
* back to the button, the Tab key closes it and moves on.
|
|
12
|
+
*
|
|
13
|
+
* The panel is a native popover: it is in the top layer, so nothing clips it and it moves nothing
|
|
14
|
+
* on the page. It is placed at the button, at the side that `placement` names, on the other side
|
|
15
|
+
* without room there, and never outside of the viewport. A press beside it closes it.
|
|
16
|
+
*
|
|
17
|
+
* Choosing an entry closes the menu and fires `menu-select`.
|
|
18
|
+
*
|
|
19
|
+
* One menu can serve many things, the rows of a list: `showAt()` opens it at a point of the
|
|
20
|
+
* viewport, for a right click or a long press, or at an element of the page, a button of a row.
|
|
21
|
+
* What it was opened for is the `opener`, which gets the focus back and which `menu-select`
|
|
22
|
+
* names.
|
|
23
|
+
*
|
|
24
|
+
* @element el-menu
|
|
25
|
+
*
|
|
26
|
+
* @fires {CustomEvent} menu-show - Fired when the menu has opened.
|
|
27
|
+
* @fires {CustomEvent} menu-hide - Fired when the menu has closed.
|
|
28
|
+
* @fires {CustomEvent<{ item: HTMLElement, value: string, opener: Element | undefined }>} menu-select -
|
|
29
|
+
* Fired when the user has chosen an entry: the `el-menu-item` is in `detail.item`, its `value`
|
|
30
|
+
* in `detail.value`, and what the menu was opened for in `detail.opener`. The menu closes after
|
|
31
|
+
* it.
|
|
32
|
+
*
|
|
33
|
+
* @slot - The entries: `el-menu-item` elements, in `el-menu-group` elements where they are
|
|
34
|
+
* divided into groups. An `el-divider` is a line between two of them.
|
|
35
|
+
* @slot trigger - The button that opens the menu. It gets `aria-haspopup="menu"` and
|
|
36
|
+
* `aria-expanded`.
|
|
37
|
+
*
|
|
38
|
+
* @csspart trigger - Forwarded onto the `trigger` slot.
|
|
39
|
+
* @csspart panel - The floating panel, which is the menu (`role="menu"`): background, border,
|
|
40
|
+
* radius, elevation, width.
|
|
41
|
+
*
|
|
42
|
+
* @cssstate open - Set while the menu is shown.
|
|
43
|
+
*
|
|
44
|
+
* @property {boolean} open - Whether the menu is shown. Reflected to the `open` attribute.
|
|
45
|
+
* @property {string} label - The name of the menu for assistive technology. Without one the menu
|
|
46
|
+
* has the name of its button.
|
|
47
|
+
* @property {'top'|'top-start'|'top-end'|'bottom'|'bottom-start'|'bottom-end'|'left'|'left-start'|'left-end'|'right'|'right-start'|'right-end'} placement -
|
|
48
|
+
* The side of the button the menu is placed at, and with `-start` or `-end` the edge of the
|
|
49
|
+
* button it is aligned with. Without room there, the menu goes to the opposite side. Default
|
|
50
|
+
* `'bottom-start'`.
|
|
51
|
+
* @property {number} distance - The gap between the button and the menu, in pixels. Default `4`.
|
|
52
|
+
*/
|
|
53
|
+
export default class Menu extends TemplateElement {
|
|
54
|
+
open: any;
|
|
55
|
+
_openAtPointerDown: any;
|
|
56
|
+
_stopAutoUpdate: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Which entry gets the focus when the menu opens: the first one, or the last one for
|
|
59
|
+
* `ArrowUp` on the button.
|
|
60
|
+
* @private
|
|
61
|
+
* @type {'first'|'last'}
|
|
62
|
+
*/
|
|
63
|
+
private _enterAt;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the focus goes back to the button when the menu closes. It does after a choice and
|
|
66
|
+
* after `Escape`, and not where the user has moved it on.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private _restoreFocus;
|
|
70
|
+
/**
|
|
71
|
+
* Where the menu is placed while it is open somewhere else than at its own button: an element
|
|
72
|
+
* of the page, or a point of the viewport.
|
|
73
|
+
* @private
|
|
74
|
+
* @type {Element | { x: number, y: number } | undefined}
|
|
75
|
+
*/
|
|
76
|
+
private _place;
|
|
77
|
+
/**
|
|
78
|
+
* What the menu was opened for with `showAt()`.
|
|
79
|
+
* @private
|
|
80
|
+
* @type {Element | undefined}
|
|
81
|
+
*/
|
|
82
|
+
private _opener;
|
|
83
|
+
/**
|
|
84
|
+
* The button of the page that was told that the menu is open.
|
|
85
|
+
* @private
|
|
86
|
+
* @type {Element | undefined}
|
|
87
|
+
*/
|
|
88
|
+
private _expanded;
|
|
89
|
+
/**
|
|
90
|
+
* Where the menu opens next, and what for: what `showAt()` was given. It is taken when the
|
|
91
|
+
* menu opens, which is after the element has rendered.
|
|
92
|
+
* @private
|
|
93
|
+
* @type {{ place: Element | { x: number, y: number }, opener: Element | undefined } | undefined}
|
|
94
|
+
*/
|
|
95
|
+
private _next;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the Tab key was pressed in the menu, and the focus is about to leave it.
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private _leaving;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the panel is being placed, and whether it was asked to be placed again meanwhile.
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
private _placing;
|
|
106
|
+
/** @private */
|
|
107
|
+
private _placeAgain;
|
|
108
|
+
/**
|
|
109
|
+
* The entry that had the focus last while the menu is open. It gets the focus back when a
|
|
110
|
+
* press beside the entries has given it to the panel.
|
|
111
|
+
* @private
|
|
112
|
+
* @type {HTMLElement | undefined}
|
|
113
|
+
*/
|
|
114
|
+
private _current;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the menu is open and has not put the focus on an entry yet: its entries are not
|
|
117
|
+
* there, or not defined. The focus goes to them once they are.
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
private _entering;
|
|
121
|
+
/**
|
|
122
|
+
* Whether the pointer that went down last is on the element the menu is open at, the button
|
|
123
|
+
* of a row. The `showAt()` the page calls with the click of that press closes the menu.
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
private _pressedAtPlace;
|
|
127
|
+
/**
|
|
128
|
+
* A pointer that goes down beside the open menu closes it. The panel is a popover the menu
|
|
129
|
+
* opens and closes itself (`popover="manual"`): the platform would close one of its own
|
|
130
|
+
* (`auto`) when the pointer that opened it is let go, the finger after a long press.
|
|
131
|
+
* @private
|
|
132
|
+
* @param {PointerEvent} event
|
|
133
|
+
*/
|
|
134
|
+
private _onPressOutside;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the menu closes because the page has scrolled under it. The focus goes back to
|
|
137
|
+
* what the menu was opened for without scrolling to it then: the scroll of the user goes on.
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
private _closedByScroll;
|
|
141
|
+
/**
|
|
142
|
+
* What the menu listens on for a scroll while it is open at a point.
|
|
143
|
+
* @private
|
|
144
|
+
* @type {Array<Element | Window | Document> | undefined}
|
|
145
|
+
*/
|
|
146
|
+
private _scrollers;
|
|
147
|
+
/**
|
|
148
|
+
* What a menu at a point was opened for scrolls away under it: the page, or a region around
|
|
149
|
+
* the row. The menu closes, as the menu of the system does. At an element it follows the
|
|
150
|
+
* element instead, and it has no point to be left at.
|
|
151
|
+
*
|
|
152
|
+
* A scroll inside of the menu is none of these: a long menu scrolls in its panel. Neither is
|
|
153
|
+
* one of a region that does not move what the menu was opened for, another column of the
|
|
154
|
+
* page. A menu that was opened for nothing closes for every scroll in the page beside it.
|
|
155
|
+
* @private
|
|
156
|
+
* @param {Event} event
|
|
157
|
+
*/
|
|
158
|
+
private _onScroll;
|
|
159
|
+
/**
|
|
160
|
+
* The keys of a menu, for as long as it is open and wherever the focus is: an open menu that
|
|
161
|
+
* has lost the focus would be left with no key at all. The window hears a key before the
|
|
162
|
+
* page does, so `Escape` closes the menu and nothing behind it.
|
|
163
|
+
* @private
|
|
164
|
+
* @param {KeyboardEvent} event
|
|
165
|
+
*/
|
|
166
|
+
private _onKeyDown;
|
|
167
|
+
constructor();
|
|
168
|
+
properties(): {
|
|
169
|
+
open: boolean;
|
|
170
|
+
label: string;
|
|
171
|
+
placement: string;
|
|
172
|
+
distance: number;
|
|
173
|
+
};
|
|
174
|
+
connected(): void;
|
|
175
|
+
disconnected(): void;
|
|
176
|
+
afterUpdate(): void;
|
|
177
|
+
watch(): {
|
|
178
|
+
open: (open: any) => void;
|
|
179
|
+
};
|
|
180
|
+
events(): {
|
|
181
|
+
'[data-trigger]': {
|
|
182
|
+
pointerdown: () => void;
|
|
183
|
+
click: (event: any) => void;
|
|
184
|
+
keydown: (event: any) => void;
|
|
185
|
+
slotchange: () => void;
|
|
186
|
+
};
|
|
187
|
+
"[part~='panel']": {
|
|
188
|
+
click: (event: any) => void;
|
|
189
|
+
focusin: (event: any) => void;
|
|
190
|
+
focusout: (event: any) => void;
|
|
191
|
+
slotchange: () => number;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Opens the menu, with the focus on its first entry.
|
|
196
|
+
* @returns {void}
|
|
197
|
+
*/
|
|
198
|
+
show(): void;
|
|
199
|
+
/**
|
|
200
|
+
* Opens the menu somewhere else than at its own button: one menu for the rows of a list.
|
|
201
|
+
*
|
|
202
|
+
* At a point of the viewport, from a `contextmenu` event or a long press: the corner of the
|
|
203
|
+
* menu is at the point, and the menu stays inside of the viewport. Or at an element of the
|
|
204
|
+
* page, the button of a row: the menu is placed at it as at its own button.
|
|
205
|
+
*
|
|
206
|
+
* `opener` is what the menu is opened for. It gets the focus back when the menu closes, and
|
|
207
|
+
* `menu-select` names it (`detail.opener`). Without one it is the element the menu is placed
|
|
208
|
+
* at.
|
|
209
|
+
*
|
|
210
|
+
* Called with the click of a press on the element the menu is open at, it closes the menu:
|
|
211
|
+
* the button of a row closes what it has opened, with the listener that opens it.
|
|
212
|
+
* @param {Element | { x: number, y: number }} place - The element, or the point in the
|
|
213
|
+
* coordinates of the viewport (`clientX`, `clientY`).
|
|
214
|
+
* @param {Element} [opener] - The row or the button the menu is opened for.
|
|
215
|
+
* @returns {void}
|
|
216
|
+
*/
|
|
217
|
+
showAt(place: Element | {
|
|
218
|
+
x: number;
|
|
219
|
+
y: number;
|
|
220
|
+
}, opener?: Element): void;
|
|
221
|
+
/**
|
|
222
|
+
* Closes the menu.
|
|
223
|
+
* @returns {void}
|
|
224
|
+
*/
|
|
225
|
+
hide(): void;
|
|
226
|
+
/**
|
|
227
|
+
* What the menu is open for: the row or the button it was opened for with `showAt()`, or its
|
|
228
|
+
* own button. Nothing while it is closed.
|
|
229
|
+
* @returns {Element | undefined}
|
|
230
|
+
*/
|
|
231
|
+
get opener(): Element | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Opens the menu when it is closed, and closes it when it is open.
|
|
234
|
+
* @returns {void}
|
|
235
|
+
*/
|
|
236
|
+
toggle(): void;
|
|
237
|
+
/**
|
|
238
|
+
* The button of the menu: what is in the `trigger` slot.
|
|
239
|
+
* @private
|
|
240
|
+
* @returns {HTMLElement | undefined}
|
|
241
|
+
*/
|
|
242
|
+
private _trigger;
|
|
243
|
+
/**
|
|
244
|
+
* The entries the user can reach, in the order of the page. An entry that is disabled is one
|
|
245
|
+
* of them: the keyboard gets to it, so a screen reader finds it, and it cannot be chosen.
|
|
246
|
+
* @private
|
|
247
|
+
* @returns {HTMLElement[]}
|
|
248
|
+
*/
|
|
249
|
+
private _items;
|
|
250
|
+
/**
|
|
251
|
+
* The text of an entry, without its icon: what a letter of the keyboard is compared with.
|
|
252
|
+
* @private
|
|
253
|
+
* @param {Element} item
|
|
254
|
+
* @returns {string}
|
|
255
|
+
*/
|
|
256
|
+
private _textOf;
|
|
257
|
+
/**
|
|
258
|
+
* The button says that it opens a menu, and whether the menu is open. An `el-button` passes
|
|
259
|
+
* both on to the control inside of it.
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
private _syncTrigger;
|
|
263
|
+
/**
|
|
264
|
+
* Whether the focus is on an entry of the menu.
|
|
265
|
+
* @private
|
|
266
|
+
* @returns {boolean}
|
|
267
|
+
*/
|
|
268
|
+
private _hasFocusOnEntry;
|
|
269
|
+
/**
|
|
270
|
+
* Whether the focus is in the menu: on an entry, or on the panel around the entries.
|
|
271
|
+
* @private
|
|
272
|
+
* @returns {boolean}
|
|
273
|
+
*/
|
|
274
|
+
private _hasFocusInPanel;
|
|
275
|
+
/**
|
|
276
|
+
* The arrow keys on the button open the menu: down at its first entry, up at its last one.
|
|
277
|
+
* `Enter` and `Space` are a click of the button.
|
|
278
|
+
* @private
|
|
279
|
+
* @param {KeyboardEvent} event
|
|
280
|
+
*/
|
|
281
|
+
private _onTriggerKeyDown;
|
|
282
|
+
/**
|
|
283
|
+
* A click in the panel: the user has chosen the entry it is on, unless that one is disabled.
|
|
284
|
+
* @private
|
|
285
|
+
* @param {MouseEvent} event
|
|
286
|
+
*/
|
|
287
|
+
private _onClick;
|
|
288
|
+
/**
|
|
289
|
+
* The focus has left the menu with the Tab key, which closes it and moves on. The focus is
|
|
290
|
+
* where the user has put it, and stays there.
|
|
291
|
+
*
|
|
292
|
+
* Only the key closes it this way. A pointer that goes down beside the menu closes it by
|
|
293
|
+
* itself, and the finger of a long press gives the focus to the row it is on when it is
|
|
294
|
+
* lifted: the menu it has just opened stays open.
|
|
295
|
+
* @private
|
|
296
|
+
* @param {FocusEvent} event
|
|
297
|
+
*/
|
|
298
|
+
private _onFocusOut;
|
|
299
|
+
/**
|
|
300
|
+
* The focus has come into the menu. On an entry: the menu remembers it. On the panel itself:
|
|
301
|
+
* the user has pressed beside the entries, on the heading of a group, a line or the padding,
|
|
302
|
+
* and the entry that had the focus gets it back. The keyboard goes on from there.
|
|
303
|
+
* @private
|
|
304
|
+
* @param {FocusEvent} event
|
|
305
|
+
*/
|
|
306
|
+
private _onFocusIn;
|
|
307
|
+
/**
|
|
308
|
+
* Puts the focus on the entry the menu is entered at. An entry that is not there yet, or
|
|
309
|
+
* whose element is not defined yet, cannot take it: the menu waits for it.
|
|
310
|
+
* @private
|
|
311
|
+
*/
|
|
312
|
+
private _focusEntry;
|
|
313
|
+
/**
|
|
314
|
+
* Other entries in the open menu, or entries that have rendered by now. The panel has
|
|
315
|
+
* another size, and a menu at a point is placed once. And the focus goes to the entry the
|
|
316
|
+
* menu is entered at, where none could take it when the menu opened and nothing in the menu
|
|
317
|
+
* has it by now.
|
|
318
|
+
* @private
|
|
319
|
+
*/
|
|
320
|
+
private _entriesChanged;
|
|
321
|
+
/** @private */
|
|
322
|
+
private _applyOpen;
|
|
323
|
+
/** @private */
|
|
324
|
+
private _applyClose;
|
|
325
|
+
/**
|
|
326
|
+
* What the panel is placed at: its own button, the element of `showAt()`, or its point. A
|
|
327
|
+
* point is an element for the placing that has no size and does not move.
|
|
328
|
+
* @private
|
|
329
|
+
* @returns {Element | { getBoundingClientRect: () => DOMRect }}
|
|
330
|
+
*/
|
|
331
|
+
private _anchor;
|
|
332
|
+
/**
|
|
333
|
+
* Places the panel now, and again whenever the button moves: on scroll, on resize, when the
|
|
334
|
+
* button or the panel changes its size.
|
|
335
|
+
* @private
|
|
336
|
+
*/
|
|
337
|
+
private _startPositioning;
|
|
338
|
+
/**
|
|
339
|
+
* A scroll does not bubble and does not leave a shadow root, so the menu listens where it
|
|
340
|
+
* happens: on every region around what it was opened for, and on the window for the page.
|
|
341
|
+
* Opened for nothing, it hears every scroll of the page on its way down from the document.
|
|
342
|
+
* @private
|
|
343
|
+
*/
|
|
344
|
+
private _listenForScroll;
|
|
345
|
+
/** @private */
|
|
346
|
+
private _stopPositioning;
|
|
347
|
+
/**
|
|
348
|
+
* Places the panel at what the menu is open at.
|
|
349
|
+
*
|
|
350
|
+
* Not before the panel is shown: the element renders when `open` is set, before the menu has
|
|
351
|
+
* taken its place from `showAt()`, and would be placed at its own element. And one placement
|
|
352
|
+
* at a time: a placement takes a few turns, more where the panel has to try the other side,
|
|
353
|
+
* so one that was asked for first can be done last. A menu whose own element is out of view,
|
|
354
|
+
* below a long list, was taken there that way. What is asked for while the panel is being
|
|
355
|
+
* placed is placed after it, at what the menu is open at by then.
|
|
356
|
+
* @private
|
|
357
|
+
*/
|
|
358
|
+
private _position;
|
|
359
|
+
template(): any;
|
|
360
|
+
}
|
|
361
|
+
export declare function define(): void;
|
|
362
|
+
export { Events };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* A group of entries in an `el-menu`, with a heading where it has a `label`. A group to assistive
|
|
4
|
+
* technology (`role="group"`), which has the heading as its name. A line divides it from what is
|
|
5
|
+
* before it in the menu.
|
|
6
|
+
*
|
|
7
|
+
* @element el-menu-group
|
|
8
|
+
*
|
|
9
|
+
* @slot - The entries of the group: `el-menu-item` elements.
|
|
10
|
+
*
|
|
11
|
+
* @csspart base - The group, with the line over it.
|
|
12
|
+
* @csspart label - The heading of the group.
|
|
13
|
+
*
|
|
14
|
+
* @property {string} label - The heading of the group, and its name for assistive technology.
|
|
15
|
+
* Default `''`.
|
|
16
|
+
*/
|
|
17
|
+
export default class MenuGroup extends TemplateElement {
|
|
18
|
+
constructor();
|
|
19
|
+
properties(): {
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
template(): any;
|
|
23
|
+
}
|
|
24
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* One entry of an `el-menu`: an action, or a link with an address. A menu item to assistive
|
|
4
|
+
* technology (`role="menuitem"`). The menu moves the focus of the keyboard to it, so it is no stop
|
|
5
|
+
* of the Tab key itself.
|
|
6
|
+
*
|
|
7
|
+
* Choosing an entry is a click on it: listen for `click` on the entry, or for `menu-select` on the
|
|
8
|
+
* menu, which names the entry and its `value`.
|
|
9
|
+
*
|
|
10
|
+
* An entry can set something instead of doing something. With `type="checkbox"` it is on or off
|
|
11
|
+
* (`role="menuitemcheckbox"`), with `type="radio"` it is one of several of which one is chosen
|
|
12
|
+
* (`role="menuitemradio"`), and `checked` is its state, which it says (`aria-checked`) and shows
|
|
13
|
+
* with a mark in front of its text. The page sets `checked`: the entry does not change it when
|
|
14
|
+
* it is chosen.
|
|
15
|
+
*
|
|
16
|
+
* @element el-menu-item
|
|
17
|
+
*
|
|
18
|
+
* @slot - The text of the entry.
|
|
19
|
+
* @slot icon - An icon in front of the text: a decoration, the text is the name.
|
|
20
|
+
*
|
|
21
|
+
* @csspart base - The entry: a `<button>`, or an `<a>` with `href`.
|
|
22
|
+
* @csspart mark - The place of the mark of an entry with a `type`: a check, or a dot. It is
|
|
23
|
+
* there while the entry is not checked as well.
|
|
24
|
+
* @csspart icon - The place of the icon.
|
|
25
|
+
* @csspart label - The text of the entry.
|
|
26
|
+
*
|
|
27
|
+
* @property {string} href - The address the entry leads to. With one it is a link.
|
|
28
|
+
* @property {string} target - Where to open the address.
|
|
29
|
+
* @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
|
|
30
|
+
* `'noreferrer noopener'`.
|
|
31
|
+
* @property {string} value - What the entry stands for, for the listener of `menu-select`:
|
|
32
|
+
* `'delete'`. Default `''`.
|
|
33
|
+
* @property {boolean} disabled - Whether the entry cannot be chosen. The keyboard still gets to
|
|
34
|
+
* it. Default `false`.
|
|
35
|
+
* @property {'normal'|'checkbox'|'radio'} type - What the entry is: an action or a link
|
|
36
|
+
* (`'normal'`), an entry that is on or off (`'checkbox'`), or one of several of which one is
|
|
37
|
+
* chosen (`'radio'`). Default `'normal'`.
|
|
38
|
+
* @property {boolean} checked - Whether an entry with the `type` `checkbox` is on, or one with
|
|
39
|
+
* the `type` `radio` is the chosen one. The page sets it. Default `false`.
|
|
40
|
+
* @property {'neutral'|'brand'|'success'|'warning'|'danger'} variant - The variant of the entry:
|
|
41
|
+
* `danger` for something that cannot be undone. Default `'neutral'`. Reflected to the `variant`
|
|
42
|
+
* attribute.
|
|
43
|
+
*/
|
|
44
|
+
export default class MenuItem extends TemplateElement {
|
|
45
|
+
constructor();
|
|
46
|
+
properties(): {
|
|
47
|
+
href: string;
|
|
48
|
+
target: string;
|
|
49
|
+
rel: string;
|
|
50
|
+
value: string;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
type: string;
|
|
53
|
+
checked: boolean;
|
|
54
|
+
variant: string;
|
|
55
|
+
};
|
|
56
|
+
events(): {
|
|
57
|
+
"[part~='base']": {
|
|
58
|
+
slotchange: () => any;
|
|
59
|
+
click: (event: any) => void;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Puts the focus on the entry: on the control inside of it.
|
|
64
|
+
* @param {FocusOptions} [options]
|
|
65
|
+
*/
|
|
66
|
+
focus(options?: FocusOptions): void;
|
|
67
|
+
/**
|
|
68
|
+
* @private
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
*/
|
|
71
|
+
private _disabled;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the entry is checked: `checked` is there as an attribute without a value, or true.
|
|
74
|
+
* @private
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
*/
|
|
77
|
+
private _checked;
|
|
78
|
+
template(): any;
|
|
79
|
+
}
|
|
80
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* The destinations of an application: the places the user goes to all the time. Each destination
|
|
4
|
+
* is an `el-nav-item`: a link with an icon and a short text, and the one of the current view is
|
|
5
|
+
* marked. The element is a navigation landmark, named by `label`.
|
|
6
|
+
*
|
|
7
|
+
* Three layouts. A **bar** for the lower edge of a phone, in which three to five destinations share
|
|
8
|
+
* the width in equal parts. A **rail** for the side of a wider screen: a narrow column of icons
|
|
9
|
+
* with a word under each. A **list** for a sidebar: an icon and its text in one row, as wide as
|
|
10
|
+
* its place. A rail and a list have a group at their top and one at their lower end, and scroll
|
|
11
|
+
* where they have more destinations than height.
|
|
12
|
+
*
|
|
13
|
+
* `layout="auto"`, the default, is a bar, and where an `el-app-frame` has the element in the
|
|
14
|
+
* column at its side it is what `column` names, a rail or a list: the page writes the
|
|
15
|
+
* destinations once.
|
|
16
|
+
*
|
|
17
|
+
* A second group takes the destinations that have no room among the five of a bar (the
|
|
18
|
+
* `secondary` slot, with `secondary-label` as its heading). A bar leaves it out.
|
|
19
|
+
*
|
|
20
|
+
* In a region of an `el-app-frame` the surface reaches the edge of the screen, and the
|
|
21
|
+
* destinations stay clear of the home indicator and the notch. Alone it keeps them clear itself.
|
|
22
|
+
*
|
|
23
|
+
* The look is the stylesheet alone, so server-rendered destinations do not change when the
|
|
24
|
+
* element takes over. The script adds the tooltips of destinations that show an icon alone.
|
|
25
|
+
*
|
|
26
|
+
* @element el-nav
|
|
27
|
+
*
|
|
28
|
+
* @slot - The destinations: `el-nav-item` elements.
|
|
29
|
+
* @slot secondary - A second group of destinations, below the first: the pages that have no room
|
|
30
|
+
* in a bar, which leaves them out.
|
|
31
|
+
* @slot end - The destinations at the lower end of a rail or a list: the settings, the account. A
|
|
32
|
+
* bar has no room for them, and leaves them out.
|
|
33
|
+
*
|
|
34
|
+
* @csspart base - The navigation landmark (`<nav>`): the surface and its line to the content.
|
|
35
|
+
* @csspart groups - The two groups at the top, which scroll where a rail or a list has more
|
|
36
|
+
* destinations than height.
|
|
37
|
+
* @csspart list - The list of the destinations.
|
|
38
|
+
* @csspart secondary - The second group: its heading and its list.
|
|
39
|
+
* @csspart secondary-label - The heading of the second group, which a list shows.
|
|
40
|
+
* @csspart secondary-list - The list of the destinations of the second group.
|
|
41
|
+
* @csspart end - The list of the destinations at the lower end of a rail or a list.
|
|
42
|
+
* @csspart tooltip - The tooltip of a destination that shows an icon alone: an `el-tooltip`.
|
|
43
|
+
*
|
|
44
|
+
* @cssproperty --el-nav-rail-size - The width of a rail. Default `5rem`.
|
|
45
|
+
* @cssproperty --el-nav-list-size - The width of a list where its place is as wide as what is in
|
|
46
|
+
* it. Default `16rem`.
|
|
47
|
+
*
|
|
48
|
+
* @property {string} label - The name of the navigation for assistive technology, "Main". A page
|
|
49
|
+
* with more than one navigation needs it to tell them apart.
|
|
50
|
+
* @property {'auto'|'bar'|'rail'|'list'} layout - How the destinations lie: `bar`, a row in which
|
|
51
|
+
* they share the width in equal parts; `rail`, a narrow column; `list`, rows of an icon and its
|
|
52
|
+
* text; `auto`, a bar, and in the column at the side of an `el-app-frame` what `column` names.
|
|
53
|
+
* Default `'auto'`.
|
|
54
|
+
* @property {'rail'|'list'} column - What the destinations are in the column at the side of an
|
|
55
|
+
* `el-app-frame`, with `layout="auto"`. Default `'rail'`.
|
|
56
|
+
* @property {string} secondaryLabel - The heading of the second group, and its name for assistive
|
|
57
|
+
* technology: "More". Default `''`.
|
|
58
|
+
* @property {boolean} labels - Whether the destinations show their texts. With `false` they show
|
|
59
|
+
* an icon alone: the text stays the name of the link, and shows as a tooltip. Default `true`.
|
|
60
|
+
*/
|
|
61
|
+
export default class Nav extends TemplateElement {
|
|
62
|
+
/**
|
|
63
|
+
* Whether the element has started in a browser, see `connected()`.
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
private _started;
|
|
67
|
+
constructor();
|
|
68
|
+
properties(): {
|
|
69
|
+
label: string;
|
|
70
|
+
layout: string;
|
|
71
|
+
column: string;
|
|
72
|
+
secondaryLabel: string;
|
|
73
|
+
labels: boolean;
|
|
74
|
+
};
|
|
75
|
+
connected(): void;
|
|
76
|
+
events(): {
|
|
77
|
+
"[part~='base']": {
|
|
78
|
+
slotchange: () => any;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
*/
|
|
85
|
+
private _showsLabels;
|
|
86
|
+
/**
|
|
87
|
+
* The destinations with their texts: what is in a destination and in none of its named slots.
|
|
88
|
+
* None before the element has started, and none while the texts show: a tooltip is for an
|
|
89
|
+
* icon alone, and on a server there is no pointer to show one to.
|
|
90
|
+
* @private
|
|
91
|
+
* @returns {Array<[Element, string]>}
|
|
92
|
+
*/
|
|
93
|
+
private _named;
|
|
94
|
+
/**
|
|
95
|
+
* Where the tooltip of a destination goes: beside a rail, on the side of the content, and
|
|
96
|
+
* above a bar. The stylesheet decides what the destinations are; this reads what it decided.
|
|
97
|
+
* @private
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
private _tooltipPlacement;
|
|
101
|
+
template(): any;
|
|
102
|
+
}
|
|
103
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TemplateElement } from '@webtides/element-js';
|
|
2
|
+
/**
|
|
3
|
+
* One destination of an `el-nav`: a link with an icon and a short text under it. The destination
|
|
4
|
+
* of the current view is marked: for assistive technology (`aria-current="page"`), and for the
|
|
5
|
+
* eye by more than its colour.
|
|
6
|
+
*
|
|
7
|
+
* A count or a dot goes into the `badge` slot, an `el-badge` as a rule. It is part of the link and
|
|
8
|
+
* comes after the text, so a screen reader reads it with the name of the destination: "Inbox 12".
|
|
9
|
+
*
|
|
10
|
+
* @element el-nav-item
|
|
11
|
+
*
|
|
12
|
+
* @slot - The short text of the destination. One line: a text that does not fit is cut.
|
|
13
|
+
* @slot icon - The icon of the destination: a decoration, the text is the name.
|
|
14
|
+
* @slot badge - A count or a dot at the corner of the icon, an `el-badge` as a rule.
|
|
15
|
+
*
|
|
16
|
+
* @csspart base - The entry of the list (`role="listitem"`).
|
|
17
|
+
* @csspart link - The link: the whole destination is its target.
|
|
18
|
+
* @csspart icon - The icon, with the shape behind it that marks the current destination.
|
|
19
|
+
* @csspart badge - The place of the badge, at the corner of the icon.
|
|
20
|
+
* @csspart label - The text of the destination.
|
|
21
|
+
*
|
|
22
|
+
* @property {string} href - The address the destination leads to.
|
|
23
|
+
* @property {string} target - Where to open the address.
|
|
24
|
+
* @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
|
|
25
|
+
* `'noreferrer noopener'`.
|
|
26
|
+
* @property {boolean} current - The destination of the current view: the link gets
|
|
27
|
+
* `aria-current="page"`, a heavier text and a shape behind its icon.
|
|
28
|
+
*/
|
|
29
|
+
export default class NavItem extends TemplateElement {
|
|
30
|
+
constructor();
|
|
31
|
+
properties(): {
|
|
32
|
+
href: string;
|
|
33
|
+
target: string;
|
|
34
|
+
rel: string;
|
|
35
|
+
current: boolean;
|
|
36
|
+
};
|
|
37
|
+
template(): any;
|
|
38
|
+
}
|
|
39
|
+
export declare function define(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -49,6 +49,10 @@ export default class OtpField extends InputField {
|
|
|
49
49
|
size: string;
|
|
50
50
|
placeholder: string;
|
|
51
51
|
pattern: boolean;
|
|
52
|
+
clearable: boolean;
|
|
53
|
+
clearLabel: string;
|
|
54
|
+
maxlength: any;
|
|
55
|
+
minlength: any;
|
|
52
56
|
enterkeyhint: any;
|
|
53
57
|
autocapitalize: any;
|
|
54
58
|
autocorrect: any;
|
|
@@ -70,6 +74,12 @@ export default class OtpField extends InputField {
|
|
|
70
74
|
click: () => void;
|
|
71
75
|
touchstart: () => void;
|
|
72
76
|
};
|
|
77
|
+
'.control': {
|
|
78
|
+
click: (event: any) => void;
|
|
79
|
+
};
|
|
80
|
+
'[data-clear]': {
|
|
81
|
+
click: () => void;
|
|
82
|
+
};
|
|
73
83
|
'[ref=input]': {
|
|
74
84
|
focus: () => void;
|
|
75
85
|
blur: () => void;
|