@prismora/elements 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +21 -2
- package/components.json +15600 -0
- package/custom-elements.json +56320 -0
- package/dist/base.d.ts +42 -0
- package/dist/base.js +62 -0
- package/dist/catalog.d.ts +33 -0
- package/dist/catalog.js +803 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +63 -0
- package/dist/components/alert.d.ts +27 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/avatar-group.d.ts +23 -0
- package/dist/components/avatar-group.js +43 -0
- package/dist/components/avatar.d.ts +24 -0
- package/dist/components/avatar.js +43 -0
- package/dist/components/back-to-top.d.ts +32 -0
- package/dist/components/back-to-top.js +50 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +20 -0
- package/dist/components/banner.d.ts +34 -0
- package/dist/components/banner.js +54 -0
- package/dist/components/breadcrumb.d.ts +42 -0
- package/dist/components/breadcrumb.js +63 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +28 -0
- package/dist/components/button.d.ts +59 -0
- package/dist/components/button.js +162 -0
- package/dist/components/calendar.d.ts +48 -0
- package/dist/components/calendar.js +296 -0
- package/dist/components/card.d.ts +23 -0
- package/dist/components/card.js +44 -0
- package/dist/components/carousel.d.ts +41 -0
- package/dist/components/carousel.js +156 -0
- package/dist/components/cascader.d.ts +70 -0
- package/dist/components/cascader.js +220 -0
- package/dist/components/chart.d.ts +59 -0
- package/dist/components/chart.js +267 -0
- package/dist/components/chat.d.ts +98 -0
- package/dist/components/chat.js +134 -0
- package/dist/components/checkbox-group.d.ts +48 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +70 -0
- package/dist/components/code-block.d.ts +46 -0
- package/dist/components/code-block.js +86 -0
- package/dist/components/color-picker.d.ts +46 -0
- package/dist/components/color-picker.js +292 -0
- package/dist/components/combobox.d.ts +89 -0
- package/dist/components/combobox.js +384 -0
- package/dist/components/command.d.ts +96 -0
- package/dist/components/command.js +289 -0
- package/dist/components/context-menu.d.ts +23 -0
- package/dist/components/context-menu.js +110 -0
- package/dist/components/copy-button.d.ts +33 -0
- package/dist/components/copy-button.js +62 -0
- package/dist/components/countdown.d.ts +36 -0
- package/dist/components/countdown.js +56 -0
- package/dist/components/data-table.d.ts +180 -0
- package/dist/components/data-table.js +1060 -0
- package/dist/components/date-picker.d.ts +47 -0
- package/dist/components/date-picker.js +267 -0
- package/dist/components/description-list.d.ts +38 -0
- package/dist/components/description-list.js +41 -0
- package/dist/components/dialog.d.ts +47 -0
- package/dist/components/dialog.js +189 -0
- package/dist/components/divider.d.ts +16 -0
- package/dist/components/divider.js +23 -0
- package/dist/components/drawer.d.ts +19 -0
- package/dist/components/drawer.js +27 -0
- package/dist/components/editor.d.ts +50 -0
- package/dist/components/editor.js +474 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.js +27 -0
- package/dist/components/file-upload.d.ts +56 -0
- package/dist/components/file-upload.js +176 -0
- package/dist/components/form-control.d.ts +69 -0
- package/dist/components/form-control.js +134 -0
- package/dist/components/form.d.ts +38 -0
- package/dist/components/form.js +161 -0
- package/dist/components/format-number.d.ts +37 -0
- package/dist/components/format-number.js +86 -0
- package/dist/components/icon.d.ts +34 -0
- package/dist/components/icon.js +47 -0
- package/dist/components/image.d.ts +44 -0
- package/dist/components/image.js +53 -0
- package/dist/components/indicator.d.ts +41 -0
- package/dist/components/indicator.js +65 -0
- package/dist/components/inline-edit.d.ts +45 -0
- package/dist/components/inline-edit.js +129 -0
- package/dist/components/input.d.ts +55 -0
- package/dist/components/input.js +186 -0
- package/dist/components/kbd.d.ts +15 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/list.d.ts +68 -0
- package/dist/components/list.js +180 -0
- package/dist/components/menu.d.ts +22 -0
- package/dist/components/menu.js +182 -0
- package/dist/components/menubar.d.ts +20 -0
- package/dist/components/menubar.js +120 -0
- package/dist/components/meter.d.ts +38 -0
- package/dist/components/meter.js +48 -0
- package/dist/components/nav.d.ts +91 -0
- package/dist/components/nav.js +228 -0
- package/dist/components/number-input.d.ts +26 -0
- package/dist/components/number-input.js +70 -0
- package/dist/components/pagination.d.ts +44 -0
- package/dist/components/pagination.js +94 -0
- package/dist/components/pin-input.d.ts +25 -0
- package/dist/components/pin-input.js +128 -0
- package/dist/components/popover.d.ts +23 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/progress.d.ts +26 -0
- package/dist/components/progress.js +66 -0
- package/dist/components/pull-refresh.d.ts +41 -0
- package/dist/components/pull-refresh.js +101 -0
- package/dist/components/qr-code.d.ts +33 -0
- package/dist/components/qr-code.js +54 -0
- package/dist/components/radio-group.d.ts +37 -0
- package/dist/components/radio-group.js +82 -0
- package/dist/components/range-slider.d.ts +46 -0
- package/dist/components/range-slider.js +95 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +80 -0
- package/dist/components/relative-time.d.ts +31 -0
- package/dist/components/relative-time.js +51 -0
- package/dist/components/scheduler.d.ts +84 -0
- package/dist/components/scheduler.js +187 -0
- package/dist/components/segmented.d.ts +58 -0
- package/dist/components/segmented.js +129 -0
- package/dist/components/select.d.ts +62 -0
- package/dist/components/select.js +140 -0
- package/dist/components/share-button.d.ts +37 -0
- package/dist/components/share-button.js +60 -0
- package/dist/components/signature.d.ts +54 -0
- package/dist/components/signature.js +152 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.js +26 -0
- package/dist/components/slider.d.ts +31 -0
- package/dist/components/slider.js +80 -0
- package/dist/components/sortable.d.ts +22 -0
- package/dist/components/sortable.js +196 -0
- package/dist/components/sparkline.d.ts +28 -0
- package/dist/components/sparkline.js +46 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/splitter.d.ts +28 -0
- package/dist/components/splitter.js +89 -0
- package/dist/components/stat.d.ts +28 -0
- package/dist/components/stat.js +33 -0
- package/dist/components/steps.d.ts +53 -0
- package/dist/components/steps.js +91 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +18 -0
- package/dist/components/table.d.ts +58 -0
- package/dist/components/table.js +96 -0
- package/dist/components/tabs.d.ts +62 -0
- package/dist/components/tabs.js +310 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/textarea.d.ts +25 -0
- package/dist/components/textarea.js +56 -0
- package/dist/components/theme-switch.d.ts +51 -0
- package/dist/components/theme-switch.js +85 -0
- package/dist/components/time-picker.d.ts +39 -0
- package/dist/components/time-picker.js +257 -0
- package/dist/components/timeline.d.ts +38 -0
- package/dist/components/timeline.js +56 -0
- package/dist/components/toaster.d.ts +25 -0
- package/dist/components/toaster.js +44 -0
- package/dist/components/toggle-group.d.ts +70 -0
- package/dist/components/toggle-group.js +172 -0
- package/dist/components/toolbar.d.ts +23 -0
- package/dist/components/toolbar.js +81 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tour.d.ts +41 -0
- package/dist/components/tour.js +197 -0
- package/dist/components/transfer.d.ts +57 -0
- package/dist/components/transfer.js +161 -0
- package/dist/components/tree-select.d.ts +66 -0
- package/dist/components/tree-select.js +282 -0
- package/dist/components/tree.d.ts +129 -0
- package/dist/components/tree.js +427 -0
- package/dist/components/virtual-list.d.ts +41 -0
- package/dist/components/virtual-list.js +77 -0
- package/dist/confirm.d.ts +21 -0
- package/dist/confirm.js +69 -0
- package/dist/count.d.ts +5 -0
- package/dist/count.js +12 -0
- package/dist/data-table/icons.d.ts +8 -0
- package/dist/data-table/icons.js +10 -0
- package/dist/data-table/logic.d.ts +33 -0
- package/dist/data-table/logic.js +141 -0
- package/dist/data-table/strings.d.ts +37 -0
- package/dist/data-table/strings.js +36 -0
- package/dist/data-table/types.d.ts +76 -0
- package/dist/data-table/types.js +1 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.js +2 -0
- package/dist/field-validity.d.ts +42 -0
- package/dist/field-validity.js +58 -0
- package/dist/floating.d.ts +13 -0
- package/dist/floating.js +65 -0
- package/dist/highlight.d.ts +11 -0
- package/dist/highlight.js +103 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +3 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/manifest.d.ts +51 -0
- package/dist/manifest.js +11 -0
- package/dist/named-icon.d.ts +8 -0
- package/dist/named-icon.js +8 -0
- package/dist/patterns/account.d.ts +6 -0
- package/dist/patterns/account.js +137 -0
- package/dist/patterns/app.d.ts +7 -0
- package/dist/patterns/app.js +351 -0
- package/dist/patterns/commerce.d.ts +4 -0
- package/dist/patterns/commerce.js +200 -0
- package/dist/patterns/flows.d.ts +3 -0
- package/dist/patterns/flows.js +100 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.js +29 -0
- package/dist/patterns/marketing.d.ts +4 -0
- package/dist/patterns/marketing.js +173 -0
- package/dist/patterns/more.d.ts +15 -0
- package/dist/patterns/more.js +581 -0
- package/dist/patterns/shell.d.ts +9 -0
- package/dist/patterns/shell.js +48 -0
- package/dist/patterns/types.d.ts +19 -0
- package/dist/patterns/types.js +1 -0
- package/dist/position.d.ts +2 -0
- package/dist/position.js +33 -0
- package/dist/prismora.standalone.js +5222 -0
- package/dist/prismora.standalone.js.map +199 -0
- package/dist/qr.d.ts +14 -0
- package/dist/qr.js +258 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.js +21 -0
- package/dist/registry.d.ts +203 -0
- package/dist/registry.js +203 -0
- package/dist/remote.d.ts +58 -0
- package/dist/remote.js +130 -0
- package/dist/sheet.d.ts +34 -0
- package/dist/sheet.js +153 -0
- package/dist/styles/accordion.d.ts +2 -0
- package/dist/styles/accordion.js +3 -0
- package/dist/styles/alert.d.ts +2 -0
- package/dist/styles/alert.js +3 -0
- package/dist/styles/avatar.d.ts +2 -0
- package/dist/styles/avatar.js +3 -0
- package/dist/styles/badge.d.ts +2 -0
- package/dist/styles/badge.js +3 -0
- package/dist/styles/banner.d.ts +2 -0
- package/dist/styles/banner.js +3 -0
- package/dist/styles/breadcrumb.d.ts +2 -0
- package/dist/styles/breadcrumb.js +3 -0
- package/dist/styles/button.d.ts +2 -0
- package/dist/styles/button.js +3 -0
- package/dist/styles/calendar.d.ts +2 -0
- package/dist/styles/calendar.js +3 -0
- package/dist/styles/card.d.ts +2 -0
- package/dist/styles/card.js +3 -0
- package/dist/styles/carousel.d.ts +2 -0
- package/dist/styles/carousel.js +3 -0
- package/dist/styles/chart.d.ts +2 -0
- package/dist/styles/chart.js +3 -0
- package/dist/styles/chat.d.ts +2 -0
- package/dist/styles/chat.js +3 -0
- package/dist/styles/checkbox.d.ts +2 -0
- package/dist/styles/checkbox.js +3 -0
- package/dist/styles/color-picker.d.ts +2 -0
- package/dist/styles/color-picker.js +3 -0
- package/dist/styles/combobox.d.ts +2 -0
- package/dist/styles/combobox.js +3 -0
- package/dist/styles/command.d.ts +2 -0
- package/dist/styles/command.js +3 -0
- package/dist/styles/data-table.d.ts +2 -0
- package/dist/styles/data-table.js +3 -0
- package/dist/styles/description-list.d.ts +2 -0
- package/dist/styles/description-list.js +3 -0
- package/dist/styles/dialog.d.ts +2 -0
- package/dist/styles/dialog.js +3 -0
- package/dist/styles/drawer.d.ts +2 -0
- package/dist/styles/drawer.js +3 -0
- package/dist/styles/editor.d.ts +2 -0
- package/dist/styles/editor.js +3 -0
- package/dist/styles/empty-state.d.ts +2 -0
- package/dist/styles/empty-state.js +3 -0
- package/dist/styles/extras.d.ts +2 -0
- package/dist/styles/extras.js +3 -0
- package/dist/styles/field.d.ts +2 -0
- package/dist/styles/field.js +3 -0
- package/dist/styles/file-upload.d.ts +2 -0
- package/dist/styles/file-upload.js +3 -0
- package/dist/styles/foundation.d.ts +2 -0
- package/dist/styles/foundation.js +3 -0
- package/dist/styles/helpers.d.ts +2 -0
- package/dist/styles/helpers.js +3 -0
- package/dist/styles/icon.d.ts +2 -0
- package/dist/styles/icon.js +3 -0
- package/dist/styles/image.d.ts +2 -0
- package/dist/styles/image.js +3 -0
- package/dist/styles/indicator.d.ts +2 -0
- package/dist/styles/indicator.js +3 -0
- package/dist/styles/input.d.ts +2 -0
- package/dist/styles/input.js +3 -0
- package/dist/styles/kbd.d.ts +2 -0
- package/dist/styles/kbd.js +3 -0
- package/dist/styles/list.d.ts +2 -0
- package/dist/styles/list.js +3 -0
- package/dist/styles/listbox.d.ts +2 -0
- package/dist/styles/listbox.js +3 -0
- package/dist/styles/meter.d.ts +2 -0
- package/dist/styles/meter.js +3 -0
- package/dist/styles/nav.d.ts +2 -0
- package/dist/styles/nav.js +3 -0
- package/dist/styles/number-input.d.ts +2 -0
- package/dist/styles/number-input.js +3 -0
- package/dist/styles/overlay.d.ts +2 -0
- package/dist/styles/overlay.js +3 -0
- package/dist/styles/pagination.d.ts +2 -0
- package/dist/styles/pagination.js +3 -0
- package/dist/styles/pickers.d.ts +2 -0
- package/dist/styles/pickers.js +3 -0
- package/dist/styles/pin-input.d.ts +2 -0
- package/dist/styles/pin-input.js +3 -0
- package/dist/styles/popover.d.ts +2 -0
- package/dist/styles/popover.js +3 -0
- package/dist/styles/progress.d.ts +2 -0
- package/dist/styles/progress.js +3 -0
- package/dist/styles/pull-refresh.d.ts +2 -0
- package/dist/styles/pull-refresh.js +3 -0
- package/dist/styles/range-slider.d.ts +2 -0
- package/dist/styles/range-slider.js +3 -0
- package/dist/styles/rating.d.ts +2 -0
- package/dist/styles/rating.js +3 -0
- package/dist/styles/scheduler.d.ts +2 -0
- package/dist/styles/scheduler.js +3 -0
- package/dist/styles/segmented.d.ts +2 -0
- package/dist/styles/segmented.js +3 -0
- package/dist/styles/select.d.ts +2 -0
- package/dist/styles/select.js +3 -0
- package/dist/styles/separator.d.ts +2 -0
- package/dist/styles/separator.js +3 -0
- package/dist/styles/sheet.d.ts +2 -0
- package/dist/styles/sheet.js +3 -0
- package/dist/styles/skeleton.d.ts +2 -0
- package/dist/styles/skeleton.js +3 -0
- package/dist/styles/slider.d.ts +2 -0
- package/dist/styles/slider.js +3 -0
- package/dist/styles/sortable.d.ts +2 -0
- package/dist/styles/sortable.js +3 -0
- package/dist/styles/spinner.d.ts +2 -0
- package/dist/styles/spinner.js +3 -0
- package/dist/styles/splitter.d.ts +2 -0
- package/dist/styles/splitter.js +3 -0
- package/dist/styles/stat.d.ts +2 -0
- package/dist/styles/stat.js +3 -0
- package/dist/styles/steps.d.ts +2 -0
- package/dist/styles/steps.js +3 -0
- package/dist/styles/surface.d.ts +2 -0
- package/dist/styles/surface.js +3 -0
- package/dist/styles/switch.d.ts +2 -0
- package/dist/styles/switch.js +3 -0
- package/dist/styles/table.d.ts +2 -0
- package/dist/styles/table.js +3 -0
- package/dist/styles/tabs.d.ts +2 -0
- package/dist/styles/tabs.js +3 -0
- package/dist/styles/tag.d.ts +2 -0
- package/dist/styles/tag.js +3 -0
- package/dist/styles/time-picker.d.ts +2 -0
- package/dist/styles/time-picker.js +3 -0
- package/dist/styles/timeline.d.ts +2 -0
- package/dist/styles/timeline.js +3 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/toast.js +3 -0
- package/dist/styles/toggle.d.ts +2 -0
- package/dist/styles/toggle.js +3 -0
- package/dist/styles/toolbar.d.ts +2 -0
- package/dist/styles/toolbar.js +3 -0
- package/dist/styles/tooltip.d.ts +2 -0
- package/dist/styles/tooltip.js +3 -0
- package/dist/styles/tree.d.ts +2 -0
- package/dist/styles/tree.js +3 -0
- package/dist/table-core.d.ts +75 -0
- package/dist/table-core.js +205 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +206 -0
- package/dist/top-layer.d.ts +4 -0
- package/dist/top-layer.js +33 -0
- package/package.json +101 -4
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { SafeHTMLElement, defineElement } from '../base.js';
|
|
3
|
+
import { fallbackPosition } from '../position.js';
|
|
4
|
+
import overlayCss from '../styles/overlay.js';
|
|
5
|
+
import popoverCss from '../styles/popover.js';
|
|
6
|
+
import sheetCss from '../styles/sheet.js';
|
|
7
|
+
import { enableSheetDrag, isCompact } from '../sheet.js';
|
|
8
|
+
/**
|
|
9
|
+
* Menu (role="menu") opened from a button with `popovertarget`. Arrow keys, Home/End and typeahead.
|
|
10
|
+
*
|
|
11
|
+
* Items: `<button role="menuitem">` or `<a role="menuitem">`. `role="menuitemcheckbox"` toggles and
|
|
12
|
+
* `role="menuitemradio"` picks one within its `role="group"` (or the menu); both show a tick from `aria-checked`.
|
|
13
|
+
* A submenu is a nested `<pm-menu id="x">` opened by an item with `popovertarget="x"`: it opens on hover, click and
|
|
14
|
+
* Arrow Right, and closes with Arrow Left or Escape.
|
|
15
|
+
* @attr {boolean} mobile - Native mobile pattern on phones: opens as a swipeable bottom sheet (inherits from ancestors such as `<html mobile>`; `mobile="false"` opts out).
|
|
16
|
+
* @tag pm-menu
|
|
17
|
+
* @slot - Menu items: `<button role="menuitem">`, `<a role="menuitem">`, `<hr>` separators, nested `<pm-menu>` submenus.
|
|
18
|
+
* @fires pm-select - detail: { item, checked? } (`checked` for checkbox and radio items)
|
|
19
|
+
* @example <button popovertarget="m" aria-haspopup="menu">Actions</button>
|
|
20
|
+
* <pm-menu id="m"><button role="menuitem">Rename</button><button role="menuitem" data-tone="danger">Delete</button></pm-menu>
|
|
21
|
+
*/
|
|
22
|
+
export class PmMenu extends SafeHTMLElement {
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this.classList.add('pm-menu');
|
|
25
|
+
this.setAttribute('role', 'menu');
|
|
26
|
+
if (!this.hasAttribute('popover'))
|
|
27
|
+
this.setAttribute('popover', 'auto');
|
|
28
|
+
this.addEventListener('toggle', this.#onToggle);
|
|
29
|
+
this.addEventListener('keydown', this.#onKey);
|
|
30
|
+
this.addEventListener('click', this.#onClick);
|
|
31
|
+
this.addEventListener('beforetoggle', this.#onBefore);
|
|
32
|
+
this.addEventListener('pointerover', this.#onOver);
|
|
33
|
+
this.toggleAttribute('data-submenu', !!this.parentElement?.closest('pm-menu'));
|
|
34
|
+
this.#undrag ??= enableSheetDrag(this, () => { try {
|
|
35
|
+
this.hidePopover();
|
|
36
|
+
}
|
|
37
|
+
catch { /* closed */ } });
|
|
38
|
+
}
|
|
39
|
+
#undrag;
|
|
40
|
+
/** Decide sheet vs anchored before the first frame, so the menu never jumps. */
|
|
41
|
+
#onBefore = (e) => {
|
|
42
|
+
if (e.newState !== 'open')
|
|
43
|
+
return;
|
|
44
|
+
if (isCompact(this)) {
|
|
45
|
+
this.setAttribute('data-sheet', '');
|
|
46
|
+
for (const k of ['top', 'left', 'right', 'bottom', 'inset', 'position'])
|
|
47
|
+
this.style[k] = '';
|
|
48
|
+
}
|
|
49
|
+
else
|
|
50
|
+
this.removeAttribute('data-sheet');
|
|
51
|
+
};
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
this.#undrag?.();
|
|
54
|
+
this.#undrag = undefined;
|
|
55
|
+
this.removeEventListener('toggle', this.#onToggle);
|
|
56
|
+
this.removeEventListener('beforetoggle', this.#onBefore);
|
|
57
|
+
this.removeEventListener('keydown', this.#onKey);
|
|
58
|
+
this.removeEventListener('click', this.#onClick);
|
|
59
|
+
this.removeEventListener('pointerover', this.#onOver);
|
|
60
|
+
}
|
|
61
|
+
/** Own items only: a submenu's items belong to the submenu. */
|
|
62
|
+
get items() {
|
|
63
|
+
return [...this.querySelectorAll('[role^="menuitem"]')].filter((el) => el.closest('pm-menu') === this && !el.hasAttribute('disabled') && el.getAttribute('aria-disabled') !== 'true');
|
|
64
|
+
}
|
|
65
|
+
#invoker() {
|
|
66
|
+
return this.id ? document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`) : null;
|
|
67
|
+
}
|
|
68
|
+
#onToggle = (e) => {
|
|
69
|
+
const inv = this.#invoker();
|
|
70
|
+
inv?.setAttribute('aria-expanded', String(e.newState === 'open'));
|
|
71
|
+
if (e.newState === 'open') {
|
|
72
|
+
if (!this.hasAttribute('data-sheet') && inv)
|
|
73
|
+
fallbackPosition(this, inv, this.hasAttribute('data-submenu') ? 'end' : 'bottom');
|
|
74
|
+
for (const it of this.items)
|
|
75
|
+
it.tabIndex = -1;
|
|
76
|
+
this.items[0]?.focus();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/** The submenu an item opens, if any. */
|
|
80
|
+
#submenuOf(item) {
|
|
81
|
+
const id = item?.getAttribute('popovertarget');
|
|
82
|
+
const sub = id ? document.getElementById(id) : null;
|
|
83
|
+
return sub instanceof _a && sub !== this && this.contains(sub) ? sub : null;
|
|
84
|
+
}
|
|
85
|
+
/** Opens a submenu from script; `source` makes its item the anchor it is positioned against. */
|
|
86
|
+
#open(el, source) { try {
|
|
87
|
+
if (!el.matches(':popover-open'))
|
|
88
|
+
el.showPopover({ source });
|
|
89
|
+
}
|
|
90
|
+
catch { /* not connected */ } }
|
|
91
|
+
#close(el) { try {
|
|
92
|
+
if (el.matches(':popover-open'))
|
|
93
|
+
el.hidePopover();
|
|
94
|
+
}
|
|
95
|
+
catch { /* already closed */ } }
|
|
96
|
+
/** Fine pointers: hovering a submenu item opens it; hovering another item of this menu closes open submenus. */
|
|
97
|
+
#onOver = (e) => {
|
|
98
|
+
if (e.pointerType !== 'mouse')
|
|
99
|
+
return;
|
|
100
|
+
const item = e.target.closest('[role^="menuitem"]');
|
|
101
|
+
if (!item || item.closest('pm-menu') !== this)
|
|
102
|
+
return;
|
|
103
|
+
const sub = this.#submenuOf(item);
|
|
104
|
+
for (const other of this.querySelectorAll('pm-menu'))
|
|
105
|
+
if (other !== sub && other.parentElement?.closest('pm-menu') === this)
|
|
106
|
+
this.#close(other);
|
|
107
|
+
if (sub && !item.hasAttribute('disabled'))
|
|
108
|
+
this.#open(sub, item);
|
|
109
|
+
};
|
|
110
|
+
#onKey = (e) => {
|
|
111
|
+
// Keys pressed inside a submenu are that submenu's to handle.
|
|
112
|
+
if (e.target.closest('pm-menu') !== this)
|
|
113
|
+
return;
|
|
114
|
+
const sub = this.#submenuOf(document.activeElement);
|
|
115
|
+
const forward = getComputedStyle(this).direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
116
|
+
const back = forward === 'ArrowRight' ? 'ArrowLeft' : 'ArrowRight';
|
|
117
|
+
if (sub && (e.key === forward || e.key === 'Enter' || e.key === ' ')) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
this.#open(sub, document.activeElement);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (this.hasAttribute('data-submenu') && e.key === back) {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
this.#close(this);
|
|
126
|
+
this.#invoker()?.focus();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const items = this.items;
|
|
130
|
+
const i = items.indexOf(document.activeElement);
|
|
131
|
+
const go = (n) => { e.preventDefault(); items[(n + items.length) % items.length]?.focus(); };
|
|
132
|
+
if (e.key === 'ArrowDown')
|
|
133
|
+
go(i + 1);
|
|
134
|
+
else if (e.key === 'ArrowUp')
|
|
135
|
+
go(i - 1);
|
|
136
|
+
else if (e.key === 'Home')
|
|
137
|
+
go(0);
|
|
138
|
+
else if (e.key === 'End')
|
|
139
|
+
go(items.length - 1);
|
|
140
|
+
else if (e.key === 'Tab')
|
|
141
|
+
this.hidePopover();
|
|
142
|
+
else if (e.key.length === 1 && /\S/.test(e.key)) {
|
|
143
|
+
const k = e.key.toLowerCase();
|
|
144
|
+
const next = items.findIndex((it, j) => j > i && it.textContent?.trim().toLowerCase().startsWith(k));
|
|
145
|
+
const wrap = items.findIndex((it) => it.textContent?.trim().toLowerCase().startsWith(k));
|
|
146
|
+
const target = next >= 0 ? next : wrap;
|
|
147
|
+
if (target >= 0)
|
|
148
|
+
go(target);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
#onClick = (e) => {
|
|
152
|
+
const item = e.target.closest('[role^="menuitem"]');
|
|
153
|
+
if (!item || item.hasAttribute('disabled') || item.closest('pm-menu') !== this)
|
|
154
|
+
return;
|
|
155
|
+
// An item that opens a submenu only does that (the browser toggles it through popovertarget).
|
|
156
|
+
if (this.#submenuOf(item))
|
|
157
|
+
return;
|
|
158
|
+
const role = item.getAttribute('role');
|
|
159
|
+
if (role === 'menuitemcheckbox') {
|
|
160
|
+
const checked = item.getAttribute('aria-checked') !== 'true';
|
|
161
|
+
item.setAttribute('aria-checked', String(checked));
|
|
162
|
+
this.dispatchEvent(new CustomEvent('pm-select', { detail: { item, checked }, bubbles: true, composed: true }));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (role === 'menuitemradio') {
|
|
166
|
+
const group = item.closest('[role="group"]') ?? this;
|
|
167
|
+
for (const r of group.querySelectorAll('[role="menuitemradio"]'))
|
|
168
|
+
if (r.closest('pm-menu') === this)
|
|
169
|
+
r.setAttribute('aria-checked', String(r === item));
|
|
170
|
+
}
|
|
171
|
+
this.dispatchEvent(new CustomEvent('pm-select', { detail: role === 'menuitemradio' ? { item, checked: true } : { item }, bubbles: true, composed: true }));
|
|
172
|
+
// Close the whole chain: this menu and the menus it was opened from.
|
|
173
|
+
let root = this;
|
|
174
|
+
for (let m = this; m; m = m.parentElement?.closest('pm-menu') ?? null) {
|
|
175
|
+
root = m;
|
|
176
|
+
this.#close(m);
|
|
177
|
+
}
|
|
178
|
+
root.#invoker()?.focus();
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
_a = PmMenu;
|
|
182
|
+
defineElement('pm-menu', PmMenu, [overlayCss, popoverCss, sheetCss]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SafeHTMLElement } from '../base.js';
|
|
2
|
+
/**
|
|
3
|
+
* Menu bar (role="menubar"): a row of buttons that each open a `<pm-menu>`, as in desktop applications.
|
|
4
|
+
*
|
|
5
|
+
* Arrow Left and Right move along the bar (and switch menus while one is open), Arrow Down opens the focused
|
|
6
|
+
* menu, Home and End jump to the first and last button. Only one button is in the tab order.
|
|
7
|
+
* @tag pm-menubar
|
|
8
|
+
* @attr {string} label - Accessible name of the bar.
|
|
9
|
+
* @slot - `<button popovertarget="id">` elements, each followed by its `<pm-menu id="id">`.
|
|
10
|
+
* @example <pm-menubar label="Document"><button popovertarget="mb-file">File</button><pm-menu id="mb-file"><button role="menuitem">New</button></pm-menu></pm-menubar>
|
|
11
|
+
*/
|
|
12
|
+
export declare class PmMenubar extends SafeHTMLElement {
|
|
13
|
+
#private;
|
|
14
|
+
static get observedAttributes(): string[];
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
attributeChangedCallback(): void;
|
|
18
|
+
/** The bar's own buttons. */
|
|
19
|
+
get buttons(): HTMLButtonElement[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { SafeHTMLElement, defineElement } from '../base.js';
|
|
2
|
+
import popoverCss from '../styles/popover.js';
|
|
3
|
+
/**
|
|
4
|
+
* Menu bar (role="menubar"): a row of buttons that each open a `<pm-menu>`, as in desktop applications.
|
|
5
|
+
*
|
|
6
|
+
* Arrow Left and Right move along the bar (and switch menus while one is open), Arrow Down opens the focused
|
|
7
|
+
* menu, Home and End jump to the first and last button. Only one button is in the tab order.
|
|
8
|
+
* @tag pm-menubar
|
|
9
|
+
* @attr {string} label - Accessible name of the bar.
|
|
10
|
+
* @slot - `<button popovertarget="id">` elements, each followed by its `<pm-menu id="id">`.
|
|
11
|
+
* @example <pm-menubar label="Document"><button popovertarget="mb-file">File</button><pm-menu id="mb-file"><button role="menuitem">New</button></pm-menu></pm-menubar>
|
|
12
|
+
*/
|
|
13
|
+
export class PmMenubar extends SafeHTMLElement {
|
|
14
|
+
static get observedAttributes() { return ['label']; }
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
this.classList.add('pm-menubar');
|
|
17
|
+
this.setAttribute('role', 'menubar');
|
|
18
|
+
this.#label();
|
|
19
|
+
this.addEventListener('keydown', this.#onKey);
|
|
20
|
+
this.addEventListener('pointerover', this.#onOver);
|
|
21
|
+
this.addEventListener('focusin', this.#onFocus);
|
|
22
|
+
queueMicrotask(() => this.#roving());
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
this.removeEventListener('keydown', this.#onKey);
|
|
26
|
+
this.removeEventListener('pointerover', this.#onOver);
|
|
27
|
+
this.removeEventListener('focusin', this.#onFocus);
|
|
28
|
+
}
|
|
29
|
+
attributeChangedCallback() { this.#label(); }
|
|
30
|
+
#label() { const l = this.getAttribute('label'); if (l)
|
|
31
|
+
this.setAttribute('aria-label', l); }
|
|
32
|
+
/** The bar's own buttons. */
|
|
33
|
+
get buttons() {
|
|
34
|
+
return [...this.querySelectorAll(':scope > button')].filter((b) => !b.disabled);
|
|
35
|
+
}
|
|
36
|
+
#menuOf(b) {
|
|
37
|
+
const id = b?.getAttribute('popovertarget');
|
|
38
|
+
return id ? document.getElementById(id) : null;
|
|
39
|
+
}
|
|
40
|
+
#roving(current) {
|
|
41
|
+
const buttons = this.buttons;
|
|
42
|
+
const active = current ?? buttons.find((b) => b.tabIndex === 0) ?? buttons[0];
|
|
43
|
+
for (const b of buttons) {
|
|
44
|
+
b.setAttribute('role', 'menuitem');
|
|
45
|
+
b.setAttribute('aria-haspopup', 'menu');
|
|
46
|
+
b.tabIndex = b === active ? 0 : -1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
#openMenu() {
|
|
50
|
+
return this.buttons.map((b) => this.#menuOf(b)).find((m) => m?.matches(':popover-open')) ?? null;
|
|
51
|
+
}
|
|
52
|
+
#show(b) {
|
|
53
|
+
const menu = this.#menuOf(b);
|
|
54
|
+
const open = this.#openMenu();
|
|
55
|
+
if (open && open !== menu) {
|
|
56
|
+
try {
|
|
57
|
+
open.hidePopover();
|
|
58
|
+
}
|
|
59
|
+
catch { /* closed */ }
|
|
60
|
+
}
|
|
61
|
+
// `source` anchors the menu to its button when opened from script.
|
|
62
|
+
try {
|
|
63
|
+
if (menu && !menu.matches(':popover-open'))
|
|
64
|
+
menu.showPopover({ source: b });
|
|
65
|
+
}
|
|
66
|
+
catch { /* not connected */ }
|
|
67
|
+
}
|
|
68
|
+
#onFocus = (e) => {
|
|
69
|
+
const b = e.target.closest(':scope > button');
|
|
70
|
+
if (b && b.parentElement === this)
|
|
71
|
+
this.#roving(b);
|
|
72
|
+
};
|
|
73
|
+
/** With one menu open, hovering another button switches to its menu. */
|
|
74
|
+
#onOver = (e) => {
|
|
75
|
+
if (e.pointerType !== 'mouse' || !this.#openMenu())
|
|
76
|
+
return;
|
|
77
|
+
const b = e.target.closest('button');
|
|
78
|
+
if (b && b.parentElement === this && !b.disabled) {
|
|
79
|
+
this.#show(b);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
#onKey = (e) => {
|
|
83
|
+
const buttons = this.buttons;
|
|
84
|
+
const target = e.target;
|
|
85
|
+
const onBar = target.parentElement === this && target.localName === 'button';
|
|
86
|
+
// From inside an open top-level menu, Left and Right move to the neighbouring menu (unless a submenu uses the key).
|
|
87
|
+
const menu = target.closest('pm-menu');
|
|
88
|
+
const owner = menu && !menu.hasAttribute('data-submenu') ? buttons.find((b) => this.#menuOf(b) === menu) : undefined;
|
|
89
|
+
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
90
|
+
const step = e.key === 'ArrowRight' ? (rtl ? -1 : 1) : e.key === 'ArrowLeft' ? (rtl ? 1 : -1) : 0;
|
|
91
|
+
if (owner && step && !e.defaultPrevented) {
|
|
92
|
+
const next = buttons[(buttons.indexOf(owner) + step + buttons.length) % buttons.length];
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
this.#show(next);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (!onBar)
|
|
98
|
+
return;
|
|
99
|
+
const i = buttons.indexOf(target);
|
|
100
|
+
const go = (n) => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
const b = buttons[(n + buttons.length) % buttons.length];
|
|
103
|
+
const wasOpen = !!this.#openMenu();
|
|
104
|
+
b.focus();
|
|
105
|
+
if (wasOpen)
|
|
106
|
+
this.#show(b);
|
|
107
|
+
};
|
|
108
|
+
if (step)
|
|
109
|
+
go(i + step);
|
|
110
|
+
else if (e.key === 'Home')
|
|
111
|
+
go(0);
|
|
112
|
+
else if (e.key === 'End')
|
|
113
|
+
go(buttons.length - 1);
|
|
114
|
+
else if (e.key === 'ArrowDown') {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
this.#show(target);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
defineElement('pm-menubar', PmMenubar, [popoverCss]);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type PropertyDeclarations } from 'lit';
|
|
2
|
+
import { PmElement } from '../base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Meter: a measurement within a known range, such as storage used, a score or password strength. For the progress
|
|
5
|
+
* of a task, use `<pm-progress>`.
|
|
6
|
+
*
|
|
7
|
+
* With `low`, `high` and `optimum` the bar is coloured like the native `<meter>`: green in the best region, amber
|
|
8
|
+
* next to it, red furthest away. Without them it uses the `tone`. `segments` splits the bar into equal steps.
|
|
9
|
+
* @tag pm-meter
|
|
10
|
+
* @slot - Text under the bar (a hint or legend).
|
|
11
|
+
* @example <pm-meter label="Storage" value="72" max="100" low="60" high="85" optimum="20" value-text="72 GB of 100 GB"></pm-meter>
|
|
12
|
+
*/
|
|
13
|
+
export declare class PmMeter extends PmElement {
|
|
14
|
+
static componentName: string;
|
|
15
|
+
static styles: import("lit").CSSResult[];
|
|
16
|
+
static properties: PropertyDeclarations;
|
|
17
|
+
value: number;
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
/** Upper end of the low region. */
|
|
21
|
+
low?: number;
|
|
22
|
+
/** Lower end of the high region. */
|
|
23
|
+
high?: number;
|
|
24
|
+
/** The best value; decides which regions are good. */
|
|
25
|
+
optimum?: number;
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Text for the value, shown and announced (e.g. "72 GB of 100 GB", "Strong"). */
|
|
28
|
+
valueText?: string;
|
|
29
|
+
size?: 'sm' | 'md' | 'lg';
|
|
30
|
+
/** Split the bar into this many equal steps. */
|
|
31
|
+
segments?: number;
|
|
32
|
+
/** Hide the value text beside the label (it is still announced). */
|
|
33
|
+
hideValue?: boolean;
|
|
34
|
+
constructor();
|
|
35
|
+
/** Same rule as the native meter: the region holding `optimum` is good, the next one ok, the furthest bad. */
|
|
36
|
+
get level(): 'good' | 'ok' | 'bad' | undefined;
|
|
37
|
+
render(): import("lit").TemplateResult<1>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
|
+
import { PmElement, defineElement } from '../base.js';
|
|
3
|
+
import meterCss from '../styles/meter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Meter: a measurement within a known range, such as storage used, a score or password strength. For the progress
|
|
6
|
+
* of a task, use `<pm-progress>`.
|
|
7
|
+
*
|
|
8
|
+
* With `low`, `high` and `optimum` the bar is coloured like the native `<meter>`: green in the best region, amber
|
|
9
|
+
* next to it, red furthest away. Without them it uses the `tone`. `segments` splits the bar into equal steps.
|
|
10
|
+
* @tag pm-meter
|
|
11
|
+
* @slot - Text under the bar (a hint or legend).
|
|
12
|
+
* @example <pm-meter label="Storage" value="72" max="100" low="60" high="85" optimum="20" value-text="72 GB of 100 GB"></pm-meter>
|
|
13
|
+
*/
|
|
14
|
+
export class PmMeter extends PmElement {
|
|
15
|
+
static { this.componentName = 'meter'; }
|
|
16
|
+
static { this.styles = [...PmElement.styles, meterCss, css `:host { display: block; min-inline-size: 0; } :host([hidden]) { display: none; }`]; }
|
|
17
|
+
static { this.properties = {
|
|
18
|
+
value: { type: Number }, min: { type: Number }, max: { type: Number }, low: { type: Number }, high: { type: Number }, optimum: { type: Number },
|
|
19
|
+
label: {}, valueText: { attribute: 'value-text' }, size: { reflect: true }, segments: { type: Number }, hideValue: { type: Boolean, attribute: 'hide-value' },
|
|
20
|
+
}; }
|
|
21
|
+
constructor() { super(); this.value = 0; this.min = 0; this.max = 100; }
|
|
22
|
+
/** Same rule as the native meter: the region holding `optimum` is good, the next one ok, the furthest bad. */
|
|
23
|
+
get level() {
|
|
24
|
+
if (this.low === undefined && this.high === undefined)
|
|
25
|
+
return undefined;
|
|
26
|
+
const low = this.low ?? this.min;
|
|
27
|
+
const high = this.high ?? this.max;
|
|
28
|
+
const opt = this.optimum ?? (this.min + this.max) / 2;
|
|
29
|
+
const region = (v) => (v < low ? 0 : v > high ? 2 : 1);
|
|
30
|
+
const d = Math.abs(region(this.value) - region(opt));
|
|
31
|
+
return d === 0 ? 'good' : d === 1 ? 'ok' : 'bad';
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const span = this.max - this.min || 1;
|
|
35
|
+
const v = Math.min(Math.max(this.value, this.min), this.max);
|
|
36
|
+
const pct = ((v - this.min) / span) * 100;
|
|
37
|
+
const text = this.valueText ?? `${Math.round(pct)}%`;
|
|
38
|
+
return html `<div class="pm-meter" part="base" data-size=${this.size ?? nothing} data-level=${this.level ?? nothing} ?data-segments=${!!this.segments}
|
|
39
|
+
style=${`--_pct:${pct}%;${this.segments ? `--_n:${this.segments}` : ''}`}>
|
|
40
|
+
${this.label || !this.hideValue ? html `<div class="pm-meter-head"><span part="label">${this.label}</span>${this.hideValue ? nothing : html `<span class="pm-meter-value" part="value">${text}</span>`}</div>` : nothing}
|
|
41
|
+
<div class="pm-meter-track" part="track" role="meter" aria-label=${this.label ?? 'Meter'} aria-valuemin=${this.min} aria-valuemax=${this.max} aria-valuenow=${v} aria-valuetext=${text}>
|
|
42
|
+
<div class="pm-meter-fill" part="fill"></div>
|
|
43
|
+
</div>
|
|
44
|
+
<slot></slot>
|
|
45
|
+
</div>`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
defineElement('pm-meter', PmMeter);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
import { PmElement } from '../base.js';
|
|
3
|
+
/**
|
|
4
|
+
* App sidebar navigation: a `<nav>` landmark with labelled groups, icons, badges, collapsible sub-menus and a
|
|
5
|
+
* `collapsed` icon rail.
|
|
6
|
+
*
|
|
7
|
+
* `auto-current` marks the item whose `href` matches the current URL (and opens its parents). With native mobile on
|
|
8
|
+
* (`mobile` here or on an ancestor, or `setMobile(true)`), the same markup becomes a bottom tab bar on phones:
|
|
9
|
+
* top-level items, icons over labels, safe-area aware; parents open their sub-items in a sheet.
|
|
10
|
+
* `mobile-variant="sidebar"` keeps the sidebar and `mobile-variant="none"` hides it on phones.
|
|
11
|
+
* @attr {boolean} mobile - Native mobile patterns on phones (inherits from ancestors; `mobile="false"` opts out).
|
|
12
|
+
* @tag pm-nav
|
|
13
|
+
* @slot - `pm-nav-group` and/or `pm-nav-item` elements.
|
|
14
|
+
* @example <pm-nav label="Main"><pm-nav-item href="/" label="Home" current></pm-nav-item><pm-nav-item href="/inbox" label="Inbox"></pm-nav-item></pm-nav>
|
|
15
|
+
*/
|
|
16
|
+
export declare class PmNav extends PmElement {
|
|
17
|
+
#private;
|
|
18
|
+
static componentName: string;
|
|
19
|
+
static styles: import("lit").CSSResult[];
|
|
20
|
+
static properties: PropertyDeclarations;
|
|
21
|
+
mobile?: string;
|
|
22
|
+
/** Phone layout when native mobile is on: bottom tab `bar` (default), `sidebar`, or `none`. */
|
|
23
|
+
mobileVariant?: 'bar' | 'sidebar' | 'none';
|
|
24
|
+
_bar: boolean;
|
|
25
|
+
/** Accessible name of the navigation landmark. */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Show icons only (labels become tooltips and accessible names). */
|
|
28
|
+
collapsed: boolean;
|
|
29
|
+
/** Mark the item matching `location.pathname` as current. */
|
|
30
|
+
autoCurrent: boolean;
|
|
31
|
+
constructor();
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
35
|
+
/** Set `current` on the item whose href best matches `path` (defaults to the page URL). */
|
|
36
|
+
syncCurrent(path?: string): void;
|
|
37
|
+
protected updated(): void;
|
|
38
|
+
render(): import("lit").TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A labelled section of a `pm-nav`.
|
|
42
|
+
* @tag pm-nav-group
|
|
43
|
+
* @slot - `pm-nav-item` elements.
|
|
44
|
+
* @example <pm-nav-group label="Workspace"><pm-nav-item href="/projects" label="Projects"></pm-nav-item></pm-nav-group>
|
|
45
|
+
*/
|
|
46
|
+
export declare class PmNavGroup extends PmElement {
|
|
47
|
+
#private;
|
|
48
|
+
static componentName: string;
|
|
49
|
+
static styles: import("lit").CSSResult[];
|
|
50
|
+
static properties: PropertyDeclarations;
|
|
51
|
+
label?: string;
|
|
52
|
+
render(): import("lit").TemplateResult<1>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Navigation link, or a collapsible parent when it contains `pm-nav-item` children.
|
|
56
|
+
* @tag pm-nav-item
|
|
57
|
+
* @slot icon - Leading icon.
|
|
58
|
+
* Set `count` for unread or pending items (a pill at the end; on the icon in the phone tab bar; a dot on the
|
|
59
|
+
* collapsed rail), with `count-label` saying what it means to screen readers ("{count} unread").
|
|
60
|
+
* @slot end - Trailing badge or content (the `count` pill comes first).
|
|
61
|
+
* @slot - Child `pm-nav-item` elements (makes this a collapsible parent).
|
|
62
|
+
* @fires pm-toggle - A parent opened or closed. detail: { expanded }
|
|
63
|
+
* @example <pm-nav-item href="/inbox" label="Inbox"><pm-icon slot="icon" name="inbox"></pm-icon><pm-badge slot="end">4</pm-badge></pm-nav-item>
|
|
64
|
+
*/
|
|
65
|
+
export declare class PmNavItem extends PmElement {
|
|
66
|
+
#private;
|
|
67
|
+
static componentName: string;
|
|
68
|
+
static styles: import("lit").CSSResult[];
|
|
69
|
+
static properties: PropertyDeclarations;
|
|
70
|
+
/** Count shown on the item (unread, pending); hidden at 0. */
|
|
71
|
+
count?: number;
|
|
72
|
+
/** Highest count shown before "+" (default 99). */
|
|
73
|
+
max?: number;
|
|
74
|
+
/** What the count means for screen readers; `{count}` is filled in (default: just the number). */
|
|
75
|
+
countLabel?: string;
|
|
76
|
+
/** Show a dot ("something new") instead of a number. */
|
|
77
|
+
dot: boolean;
|
|
78
|
+
/** Registered icon name (see `registerIcons`); an `icon` slot overrides it. */
|
|
79
|
+
icon?: string;
|
|
80
|
+
href?: string;
|
|
81
|
+
label?: string;
|
|
82
|
+
/** This item is the current page (aria-current="page"). */
|
|
83
|
+
current: boolean;
|
|
84
|
+
/** Parent items: show children. Opens automatically when a child is current. */
|
|
85
|
+
expanded: boolean;
|
|
86
|
+
disabled: boolean;
|
|
87
|
+
constructor();
|
|
88
|
+
connectedCallback(): void;
|
|
89
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
90
|
+
render(): import("lit").TemplateResult<1>;
|
|
91
|
+
}
|