@redvars/peacock 3.5.0 → 3.6.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/dist/BaseButton-BNFAYn-S.js +219 -0
- package/dist/BaseButton-BNFAYn-S.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +14 -30
- package/dist/banner.js.map +1 -1
- package/dist/{button-DMN1dPAg.js → button-colors-Ccys3hvS.js} +5 -468
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +228 -8
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +294 -8
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +634 -0
- package/dist/calendar-column-view.js.map +1 -0
- package/dist/calendar-event-BrQ_SEKD.js +199 -0
- package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
- package/dist/calendar-month-view.js +376 -0
- package/dist/calendar-month-view.js.map +1 -0
- package/dist/calendar.js +339 -0
- package/dist/calendar.js.map +1 -0
- package/dist/canvas.js +361 -0
- package/dist/canvas.js.map +1 -0
- package/dist/card.js +18 -73
- package/dist/card.js.map +1 -1
- package/dist/cb-compound-expression.js +125 -0
- package/dist/cb-compound-expression.js.map +1 -0
- package/dist/cb-divider.js +150 -0
- package/dist/cb-divider.js.map +1 -0
- package/dist/cb-expression.js +75 -0
- package/dist/cb-expression.js.map +1 -0
- package/dist/cb-predicate.js +137 -0
- package/dist/cb-predicate.js.map +1 -0
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -1
- package/dist/code-highlighter.js.map +1 -1
- package/dist/condition-builder.js +58 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +10860 -5567
- package/dist/custom-elements.json +16180 -7996
- package/dist/dropdown-button.js +216 -0
- package/dist/dropdown-button.js.map +1 -0
- package/dist/event-manager-D-QCmUgR.js +113 -0
- package/dist/event-manager-D-QCmUgR.js.map +1 -0
- package/dist/fab.js +421 -9
- package/dist/fab.js.map +1 -1
- package/dist/flow-designer-dZnLJOQT.js +1656 -0
- package/dist/flow-designer-dZnLJOQT.js.map +1 -0
- package/dist/flow-designer-node-XMe-jlKg.js +548 -0
- package/dist/flow-designer-node-XMe-jlKg.js.map +1 -0
- package/dist/flow-designer-node.js +4 -0
- package/dist/flow-designer-node.js.map +1 -0
- package/dist/flow-designer.js +16 -0
- package/dist/flow-designer.js.map +1 -0
- package/dist/html-editor.js +358 -0
- package/dist/html-editor.js.map +1 -0
- package/dist/icon-button-CK1ZuE-2.js +247 -0
- package/dist/icon-button-CK1ZuE-2.js.map +1 -0
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
- package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
- package/dist/modal.js +418 -0
- package/dist/modal.js.map +1 -0
- package/dist/{select-4pl4XBj7.js → navigation-rail-DyO0oAZU.js} +2000 -2767
- package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/notification.js +3 -2
- package/dist/notification.js.map +1 -1
- package/dist/peacock-loader.js +102 -14
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-NC7b1lTq.js +1971 -0
- package/dist/popover-NC7b1lTq.js.map +1 -0
- package/dist/popover-content.js +125 -0
- package/dist/popover-content.js.map +1 -0
- package/dist/popover.js +4 -0
- package/dist/popover.js.map +1 -0
- package/dist/search.js +4 -0
- package/dist/search.js.map +1 -1
- package/dist/split-button.js +388 -0
- package/dist/split-button.js.map +1 -0
- package/dist/src/__controllers/floating-controller.d.ts +35 -0
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/banner/banner.d.ts +0 -4
- package/dist/src/button/BaseButton.d.ts +4 -47
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/calendar/base-event.d.ts +10 -0
- package/dist/src/calendar/calendar-column-view.d.ts +41 -0
- package/dist/src/calendar/calendar-event.d.ts +7 -0
- package/dist/src/calendar/calendar-month-view.d.ts +31 -0
- package/dist/src/calendar/calendar.d.ts +65 -0
- package/dist/src/calendar/event-manager.d.ts +17 -0
- package/dist/src/calendar/index.d.ts +4 -0
- package/dist/src/calendar/types.d.ts +13 -0
- package/dist/src/calendar/utils.d.ts +31 -0
- package/dist/src/canvas/canvas.d.ts +92 -0
- package/dist/src/canvas/index.d.ts +2 -0
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-divider.d.ts +26 -0
- package/dist/src/condition-builder/cb-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
- package/dist/src/condition-builder/condition-builder.d.ts +27 -0
- package/dist/src/condition-builder/index.d.ts +5 -0
- package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
- package/dist/src/dropdown-button/index.d.ts +1 -0
- package/dist/src/fab/fab.d.ts +4 -35
- package/dist/src/flow-designer/commands.d.ts +66 -0
- package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
- package/dist/src/flow-designer/flow-designer.d.ts +133 -0
- package/dist/src/flow-designer/index.d.ts +7 -0
- package/dist/src/flow-designer/layout.d.ts +30 -0
- package/dist/src/flow-designer/types.d.ts +142 -0
- package/dist/src/flow-designer/validation.d.ts +43 -0
- package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/html-editor/html-editor.d.ts +56 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +16 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/menu/menu/menu.d.ts +5 -7
- package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
- package/dist/src/modal/index.d.ts +1 -0
- package/dist/src/modal/modal.d.ts +63 -0
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/popover/index.d.ts +2 -0
- package/dist/src/popover/popover-content.d.ts +29 -0
- package/dist/src/popover/popover.d.ts +62 -0
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/toolbar/toolbar.d.ts +10 -10
- package/dist/src/tooltip/tooltip.d.ts +5 -15
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/toolbar.js +10 -10
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/{__base_element → __mixins}/README.md +2 -2
- package/src/banner/banner.scss +20 -25
- package/src/banner/banner.ts +1 -7
- package/src/button/BaseButton.ts +11 -100
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +77 -23
- package/src/button/button-group/button-group.ts +2 -2
- package/src/button/icon-button/icon-button.ts +75 -33
- package/src/calendar/base-event.ts +49 -0
- package/src/calendar/calendar-column-view.scss +326 -0
- package/src/calendar/calendar-column-view.ts +392 -0
- package/src/calendar/calendar-event.ts +20 -0
- package/src/calendar/calendar-month-view.scss +192 -0
- package/src/calendar/calendar-month-view.ts +244 -0
- package/src/calendar/calendar.scss +71 -0
- package/src/calendar/calendar.ts +298 -0
- package/src/calendar/event-manager.ts +117 -0
- package/src/calendar/index.ts +4 -0
- package/src/calendar/types.ts +14 -0
- package/src/calendar/utils.ts +180 -0
- package/src/canvas/canvas.scss +60 -0
- package/src/canvas/canvas.ts +391 -0
- package/src/canvas/index.ts +2 -0
- package/src/card/card.ts +11 -71
- package/src/chart-bar/chart-bar.ts +9 -14
- package/src/chart-bar/chart-stacked-bar.ts +12 -18
- package/src/chart-doughnut/chart-doughnut.ts +23 -27
- package/src/chart-pie/chart-pie.ts +19 -23
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +3 -1
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/condition-builder/cb-compound-expression.scss +37 -0
- package/src/condition-builder/cb-compound-expression.ts +80 -0
- package/src/condition-builder/cb-divider.scss +93 -0
- package/src/condition-builder/cb-divider.ts +56 -0
- package/src/condition-builder/cb-expression.scss +14 -0
- package/src/condition-builder/cb-expression.ts +49 -0
- package/src/condition-builder/cb-predicate.scss +35 -0
- package/src/condition-builder/cb-predicate.ts +102 -0
- package/src/condition-builder/condition-builder.scss +13 -0
- package/src/condition-builder/condition-builder.ts +38 -0
- package/src/condition-builder/index.ts +5 -0
- package/src/date-picker/date-picker.ts +1 -1
- package/src/dropdown-button/demo/index.html +110 -0
- package/src/dropdown-button/dropdown-button.scss +22 -0
- package/src/dropdown-button/dropdown-button.ts +206 -0
- package/src/dropdown-button/index.ts +1 -0
- package/src/elevation/elevation.scss +5 -5
- package/src/fab/fab.ts +29 -100
- package/src/flow-designer/DEMO.md +239 -0
- package/src/flow-designer/commands.ts +278 -0
- package/src/flow-designer/flow-designer-node.ts +172 -0
- package/src/flow-designer/flow-designer.scss +457 -0
- package/src/flow-designer/flow-designer.ts +611 -0
- package/src/flow-designer/index.ts +41 -0
- package/src/flow-designer/layout.ts +357 -0
- package/src/flow-designer/types.ts +166 -0
- package/src/flow-designer/validation.ts +284 -0
- package/src/flow-designer/workflow-utils.ts +282 -0
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/html-editor/html-editor.scss +146 -0
- package/src/html-editor/html-editor.ts +276 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +28 -1
- package/src/input/input.ts +3 -1
- package/src/link/link.ts +2 -2
- package/src/menu/menu/menu.scss +2 -2
- package/src/menu/menu/menu.ts +91 -101
- package/src/menu/menu-item/menu-item.scss +4 -0
- package/src/menu/menu-item/menu-item.ts +85 -79
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +201 -0
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/notification.ts +3 -2
- package/src/notification-manager/index.ts +1 -0
- package/src/notification-manager/notification-manager.scss +113 -0
- package/src/notification-manager/notification-manager.ts +199 -0
- package/src/number-field/number-field.ts +6 -4
- package/src/pagination/pagination.ts +6 -4
- package/src/peacock-loader.ts +93 -5
- package/src/popover/index.ts +2 -0
- package/src/popover/popover-content.scss +69 -0
- package/src/popover/popover-content.ts +51 -0
- package/src/popover/popover.scss +7 -0
- package/src/popover/popover.ts +170 -0
- package/src/search/search.ts +4 -0
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/snackbar/snackbar.ts +1 -1
- package/src/split-button/index.ts +1 -0
- package/src/split-button/split-button-colors.scss +56 -0
- package/src/split-button/split-button-sizes.scss +28 -0
- package/src/split-button/split-button.scss +79 -0
- package/src/split-button/split-button.ts +236 -0
- package/src/table/table.ts +2 -2
- package/src/tabs/tab.ts +4 -3
- package/src/text/text.css-component.scss +7 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/toolbar/toolbar.ts +10 -10
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +64 -98
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-DMN1dPAg.js.map +0 -1
- package/dist/button-group-CX9CUUXk.js +0 -435
- package/dist/button-group-CX9CUUXk.js.map +0 -1
- package/dist/fab-C5Nzxk0E.js +0 -497
- package/dist/fab-C5Nzxk0E.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/select-4pl4XBj7.js.map +0 -1
- package/dist/spread-B5cgadZl.js +0 -32
- package/dist/spread-B5cgadZl.js.map +0 -1
- package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/test/tree-view.test.d.ts +0 -1
- package/dist/throttle-C7ZAPqtu.js +0 -24
- package/dist/throttle-C7ZAPqtu.js.map +0 -1
- package/src/__base_element/BaseHyperlink.ts +0 -42
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { html, LitElement, nothing } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
|
+
import { throttle } from '@/__utils/throttle.js';
|
|
7
|
+
import styles from './navigation-rail-item.scss';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @label Navigation Rail Item
|
|
11
|
+
* @tag wc-navigation-rail-item
|
|
12
|
+
* @rawTag navigation-rail-item
|
|
13
|
+
* @parentRawTag navigation-rail
|
|
14
|
+
*
|
|
15
|
+
* @summary An individual item within a navigation rail.
|
|
16
|
+
* @overview
|
|
17
|
+
* <p>Navigation rail items display a destination with an icon and optional label.</p>
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```html
|
|
21
|
+
* <wc-navigation-rail-item>
|
|
22
|
+
* <wc-icon slot="icon">home</wc-icon>
|
|
23
|
+
* Home
|
|
24
|
+
* </wc-navigation-rail-item>
|
|
25
|
+
* ```
|
|
26
|
+
* @tags navigation
|
|
27
|
+
*/
|
|
28
|
+
export class NavigationRailItem extends LitElement {
|
|
29
|
+
#id = crypto.randomUUID();
|
|
30
|
+
|
|
31
|
+
static styles = [styles];
|
|
32
|
+
|
|
33
|
+
/** Whether this item is currently active/selected. */
|
|
34
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
35
|
+
|
|
36
|
+
/** Whether this item is disabled. */
|
|
37
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
38
|
+
|
|
39
|
+
/** Whether the parent rail is in collapsed mode (labels hidden). */
|
|
40
|
+
@property({ type: Boolean, reflect: true }) collapsed = false;
|
|
41
|
+
|
|
42
|
+
/** If provided, the item renders as a link. */
|
|
43
|
+
@property({ reflect: true }) href?: string;
|
|
44
|
+
|
|
45
|
+
/** Link target. */
|
|
46
|
+
@property() target: string = '_self';
|
|
47
|
+
|
|
48
|
+
/** Value used for identification when managing active state externally. */
|
|
49
|
+
@property({ reflect: true }) value?: string;
|
|
50
|
+
|
|
51
|
+
/** Reason the item is disabled (shown to screen readers). */
|
|
52
|
+
@property({ attribute: 'disabled-reason' }) disabledReason: string = '';
|
|
53
|
+
|
|
54
|
+
/** Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds. */
|
|
55
|
+
@property({ type: Number }) throttleDelay = 200;
|
|
56
|
+
|
|
57
|
+
@state() private _isPressed = false;
|
|
58
|
+
|
|
59
|
+
@state() private _hasLabel = false;
|
|
60
|
+
|
|
61
|
+
@state() private _hasActiveIcon = false;
|
|
62
|
+
|
|
63
|
+
@query('.item-element') readonly itemElement!: HTMLElement | null;
|
|
64
|
+
|
|
65
|
+
override focus() {
|
|
66
|
+
this.itemElement?.focus();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override blur() {
|
|
70
|
+
this.itemElement?.blur();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override firstUpdated() {
|
|
74
|
+
this.__dispatchClickWithThrottle = throttle(
|
|
75
|
+
this.__dispatchClick,
|
|
76
|
+
this.throttleDelay,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
observerSlotChangesWithCallback(
|
|
80
|
+
this.renderRoot.querySelector('slot:not([name])'),
|
|
81
|
+
hasContent => {
|
|
82
|
+
this._hasLabel = hasContent;
|
|
83
|
+
this.requestUpdate();
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
observerSlotChangesWithCallback(
|
|
88
|
+
this.renderRoot.querySelector('slot[name="active-icon"]'),
|
|
89
|
+
hasContent => {
|
|
90
|
+
this._hasActiveIcon = hasContent;
|
|
91
|
+
this.requestUpdate();
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
__dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
|
|
97
|
+
event => {
|
|
98
|
+
this.__dispatchClick(event);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
102
|
+
if (this.disabled && this.href) {
|
|
103
|
+
event.stopImmediatePropagation();
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!isActivationClick(event) || !this.itemElement) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.focus();
|
|
113
|
+
dispatchActivationClick(this.itemElement);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
117
|
+
if (this.disabled) return;
|
|
118
|
+
if (
|
|
119
|
+
event instanceof KeyboardEvent &&
|
|
120
|
+
event.type === 'keydown' &&
|
|
121
|
+
(event.key === 'Enter' || event.key === ' ')
|
|
122
|
+
) {
|
|
123
|
+
this._isPressed = true;
|
|
124
|
+
} else if (event.type === 'mousedown') {
|
|
125
|
+
this._isPressed = true;
|
|
126
|
+
} else {
|
|
127
|
+
this._isPressed = false;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
__isLink() {
|
|
132
|
+
return !!this.href;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
__getDisabledReasonID() {
|
|
136
|
+
return this.disabled && this.disabledReason
|
|
137
|
+
? `disabled-reason-${this.#id}`
|
|
138
|
+
: nothing;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
__renderDisabledReason() {
|
|
142
|
+
const disabledReasonID = this.__getDisabledReasonID();
|
|
143
|
+
if (disabledReasonID)
|
|
144
|
+
return html`<div
|
|
145
|
+
id="disabled-reason-${this.#id}"
|
|
146
|
+
role="tooltip"
|
|
147
|
+
aria-label=${this.disabledReason}
|
|
148
|
+
class="screen-reader-only"
|
|
149
|
+
>
|
|
150
|
+
${this.disabledReason}
|
|
151
|
+
</div>`;
|
|
152
|
+
return nothing;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
__renderItemContent() {
|
|
156
|
+
return html`
|
|
157
|
+
<wc-focus-ring class="focus-ring" for='item'></wc-focus-ring>
|
|
158
|
+
<div class="state-layer"></div>
|
|
159
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
160
|
+
|
|
161
|
+
<div class="item-content">
|
|
162
|
+
<div class="indicator">
|
|
163
|
+
<div class="icon-container">
|
|
164
|
+
<slot name="active-icon" class="active-icon-slot"></slot>
|
|
165
|
+
<slot name="icon" class="icon-slot"></slot>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
${this._hasLabel && !this.collapsed
|
|
169
|
+
? html`<div class="label"><slot></slot></div>`
|
|
170
|
+
: html`<slot class="hidden-slot"></slot>`}
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
${this.__renderDisabledReason()}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
render() {
|
|
178
|
+
const isLink = this.__isLink();
|
|
179
|
+
|
|
180
|
+
const cssClasses = {
|
|
181
|
+
item: true,
|
|
182
|
+
'item-element': true,
|
|
183
|
+
active: this.active,
|
|
184
|
+
disabled: this.disabled,
|
|
185
|
+
pressed: this._isPressed,
|
|
186
|
+
'has-label': this._hasLabel,
|
|
187
|
+
'has-active-icon': this._hasActiveIcon,
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
if (!isLink) {
|
|
191
|
+
return html`<button
|
|
192
|
+
id="item"
|
|
193
|
+
class=${classMap(cssClasses)}
|
|
194
|
+
?disabled=${this.disabled}
|
|
195
|
+
aria-disabled=${`${this.disabled}`}
|
|
196
|
+
aria-current=${this.active ? 'page' : nothing}
|
|
197
|
+
?aria-describedby=${this.__getDisabledReasonID()}
|
|
198
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
199
|
+
@mousedown=${this.__handlePress}
|
|
200
|
+
@keydown=${this.__handlePress}
|
|
201
|
+
@keyup=${this.__handlePress}
|
|
202
|
+
>
|
|
203
|
+
${this.__renderItemContent()}
|
|
204
|
+
</button>`;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return html`<a
|
|
208
|
+
id="item"
|
|
209
|
+
class=${classMap(cssClasses)}
|
|
210
|
+
href=${this.href}
|
|
211
|
+
target=${this.target}
|
|
212
|
+
aria-current=${this.active ? 'page' : nothing}
|
|
213
|
+
aria-disabled=${`${this.disabled}`}
|
|
214
|
+
?aria-describedby=${this.__getDisabledReasonID()}
|
|
215
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
216
|
+
@mousedown=${this.__handlePress}
|
|
217
|
+
@keydown=${this.__handlePress}
|
|
218
|
+
@keyup=${this.__handlePress}
|
|
219
|
+
>
|
|
220
|
+
${this.__renderItemContent()}
|
|
221
|
+
</a>`;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
height: 100%;
|
|
8
|
+
width: var(--nav-rail-width, 5rem); /* 80dp */
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.rail {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: center;
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 100%;
|
|
18
|
+
border-radius: inherit;
|
|
19
|
+
background-color: var(--nav-rail-container-color, var(--color-surface));
|
|
20
|
+
padding-block: var(--nav-rail-padding-block, 0.75rem); /* 12dp */
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
|
|
23
|
+
.header {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
width: 100%;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
|
|
30
|
+
&:empty {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
wc-divider {
|
|
36
|
+
width: calc(100% - 1rem);
|
|
37
|
+
margin-block: 0.5rem;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.items {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
width: 100%;
|
|
46
|
+
gap: 0.75rem; /* 12dp between items */
|
|
47
|
+
flex: 1;
|
|
48
|
+
|
|
49
|
+
::slotted(wc-navigation-rail-item) {
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Alignment variants */
|
|
55
|
+
&.align-top {
|
|
56
|
+
.items {
|
|
57
|
+
justify-content: flex-start;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.align-center {
|
|
62
|
+
.items {
|
|
63
|
+
justify-content: center;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.align-bottom {
|
|
68
|
+
.items {
|
|
69
|
+
justify-content: flex-end;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import styles from './navigation-rail.scss';
|
|
5
|
+
import { NavigationRailItem } from './navigation-rail-item.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @label Navigation Rail
|
|
9
|
+
* @tag wc-navigation-rail
|
|
10
|
+
* @rawTag navigation-rail
|
|
11
|
+
*
|
|
12
|
+
* @summary A vertical side navigation for medium-sized screens, following Material Design 3 specs.
|
|
13
|
+
* @overview
|
|
14
|
+
* <p>Navigation rail provides access to primary destinations in an app using icons—with or without labels—on a vertical rail.</p>
|
|
15
|
+
* <p>Use navigation rail on medium-sized screens (tablets) with 3–7 destinations.</p>
|
|
16
|
+
*
|
|
17
|
+
* @cssprop --nav-rail-width - Width of the rail container. Defaults to 5rem (80dp).
|
|
18
|
+
* @cssprop --nav-rail-container-color - Background color of the rail. Defaults to surface color.
|
|
19
|
+
* @cssprop --nav-rail-indicator-color - Color of the active indicator. Defaults to secondary-container.
|
|
20
|
+
* @cssprop --nav-rail-indicator-shape - Shape (border-radius) of the active indicator. Defaults to full (pill).
|
|
21
|
+
* @cssprop --nav-rail-indicator-width - Width of the active indicator. Defaults to 3.5rem (56dp).
|
|
22
|
+
* @cssprop --nav-rail-indicator-height - Height of the active indicator. Defaults to 2rem (32dp).
|
|
23
|
+
* @cssprop --nav-rail-inactive-icon-color - Color of inactive icons. Defaults to on-surface-variant.
|
|
24
|
+
* @cssprop --nav-rail-active-icon-color - Color of active icons. Defaults to on-secondary-container.
|
|
25
|
+
* @cssprop --nav-rail-inactive-label-color - Color of inactive labels. Defaults to on-surface-variant.
|
|
26
|
+
* @cssprop --nav-rail-active-label-color - Color of active labels. Defaults to on-surface.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <wc-navigation-rail>
|
|
31
|
+
* <wc-navigation-rail-item active>
|
|
32
|
+
* <wc-icon slot="icon">home</wc-icon>
|
|
33
|
+
* Home
|
|
34
|
+
* </wc-navigation-rail-item>
|
|
35
|
+
* <wc-navigation-rail-item>
|
|
36
|
+
* <wc-icon slot="icon">search</wc-icon>
|
|
37
|
+
* Search
|
|
38
|
+
* </wc-navigation-rail-item>
|
|
39
|
+
* <wc-navigation-rail-item>
|
|
40
|
+
* <wc-icon slot="icon">settings</wc-icon>
|
|
41
|
+
* Settings
|
|
42
|
+
* </wc-navigation-rail-item>
|
|
43
|
+
* </wc-navigation-rail>
|
|
44
|
+
* ```
|
|
45
|
+
* @tags navigation
|
|
46
|
+
*/
|
|
47
|
+
export class NavigationRail extends LitElement {
|
|
48
|
+
static styles = [styles];
|
|
49
|
+
|
|
50
|
+
static Item = NavigationRailItem;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Vertical alignment of items within the rail.
|
|
54
|
+
* - `"top"`: Items align to the top.
|
|
55
|
+
* - `"center"`: Items are centered (default).
|
|
56
|
+
* - `"bottom"`: Items align to the bottom.
|
|
57
|
+
*/
|
|
58
|
+
@property({ reflect: true }) alignment: 'top' | 'center' | 'bottom' = 'center';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Display mode of the navigation rail.
|
|
62
|
+
* - `"expanded"`: shows labels.
|
|
63
|
+
* - `"collapsed"`: hides labels.
|
|
64
|
+
*/
|
|
65
|
+
@property({ reflect: true }) mode: 'expanded' | 'collapsed' = 'expanded';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Whether to show a divider between the header and items sections.
|
|
69
|
+
*/
|
|
70
|
+
@property({ type: Boolean, attribute: 'show-divider' }) showDivider = false;
|
|
71
|
+
|
|
72
|
+
connectedCallback() {
|
|
73
|
+
super.connectedCallback();
|
|
74
|
+
this.addEventListener('click', this._handleItemClick);
|
|
75
|
+
this.setAttribute('role', 'navigation');
|
|
76
|
+
this.setAttribute('aria-label', this.getAttribute('aria-label') ?? 'Main navigation');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
disconnectedCallback() {
|
|
80
|
+
this.removeEventListener('click', this._handleItemClick);
|
|
81
|
+
super.disconnectedCallback();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected override firstUpdated() {
|
|
85
|
+
this._syncItemMode();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
protected override updated(changedProperties: PropertyValues<this>) {
|
|
89
|
+
if (changedProperties.has('mode')) {
|
|
90
|
+
this._syncItemMode();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private _handleItemClick = (event: Event) => {
|
|
95
|
+
const target = event.target as HTMLElement;
|
|
96
|
+
const item = target.closest('wc-navigation-rail-item') as NavigationRailItem | null;
|
|
97
|
+
|
|
98
|
+
if (!item || item.disabled) return;
|
|
99
|
+
|
|
100
|
+
// Deactivate all items and activate the clicked one
|
|
101
|
+
for (const railItem of this._getItems()) {
|
|
102
|
+
railItem.active = railItem === item;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.dispatchEvent(
|
|
106
|
+
new CustomEvent('nav-change', {
|
|
107
|
+
detail: {
|
|
108
|
+
value: item.value,
|
|
109
|
+
item,
|
|
110
|
+
},
|
|
111
|
+
bubbles: true,
|
|
112
|
+
composed: true,
|
|
113
|
+
}),
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
private _getItems(): NavigationRailItem[] {
|
|
118
|
+
return Array.from(
|
|
119
|
+
this.querySelectorAll('wc-navigation-rail-item'),
|
|
120
|
+
) as NavigationRailItem[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private _syncItemMode = () => {
|
|
124
|
+
const isCollapsed = this.mode === 'collapsed';
|
|
125
|
+
for (const railItem of this._getItems()) {
|
|
126
|
+
railItem.collapsed = isCollapsed;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
render() {
|
|
131
|
+
const cssClasses = {
|
|
132
|
+
rail: true,
|
|
133
|
+
[`align-${this.alignment}`]: true,
|
|
134
|
+
[`mode-${this.mode}`]: true,
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return html`
|
|
138
|
+
<div class=${classMap(cssClasses)}>
|
|
139
|
+
<div class="header">
|
|
140
|
+
<slot name="header"></slot>
|
|
141
|
+
</div>
|
|
142
|
+
${this.showDivider ? html`<wc-divider></wc-divider>` : ''}
|
|
143
|
+
<nav class="items" role="presentation">
|
|
144
|
+
<slot @slotchange=${this._syncItemMode}></slot>
|
|
145
|
+
</nav>
|
|
146
|
+
</div>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -193,11 +193,12 @@ export class Notification extends LitElement {
|
|
|
193
193
|
variant="text"
|
|
194
194
|
size="sm"
|
|
195
195
|
aria-label="Close notification"
|
|
196
|
-
name="close"
|
|
197
196
|
@click=${() => {
|
|
198
197
|
this.hideAndEmitDismiss('dismiss');
|
|
199
198
|
}}
|
|
200
|
-
|
|
199
|
+
>
|
|
200
|
+
<wc-icon name="close"></wc-icon>
|
|
201
|
+
</wc-icon-button>
|
|
201
202
|
</div>`
|
|
202
203
|
: nothing}
|
|
203
204
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NotificationManager } from './notification-manager.js';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
@keyframes reveal-top {
|
|
6
|
+
0% {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
transform: translateY(-1rem);
|
|
9
|
+
max-height: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
100% {
|
|
13
|
+
max-height: 500px;
|
|
14
|
+
opacity: 1;
|
|
15
|
+
transform: translateY(0);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes reveal-bottom {
|
|
20
|
+
0% {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
transform: translateY(1rem);
|
|
23
|
+
max-height: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
100% {
|
|
27
|
+
max-height: 500px;
|
|
28
|
+
opacity: 1;
|
|
29
|
+
transform: translateY(0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
position: var(--notification-manager-position, absolute);
|
|
36
|
+
width: 20rem;
|
|
37
|
+
z-index: var(--z-index-notification-manager, 9000);
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.notification-manager {
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--spacing-100);
|
|
46
|
+
margin: var(--spacing-150);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.notification {
|
|
50
|
+
pointer-events: auto;
|
|
51
|
+
max-height: 500px;
|
|
52
|
+
transition: max-height 0.5s ease-out, opacity 0.5s ease-out;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.notification.hidden {
|
|
57
|
+
max-height: 0;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Position variants */
|
|
62
|
+
|
|
63
|
+
:host([position='bottom-right']) {
|
|
64
|
+
bottom: 0;
|
|
65
|
+
right: 0;
|
|
66
|
+
|
|
67
|
+
.notification-manager {
|
|
68
|
+
align-items: flex-end;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.notification {
|
|
72
|
+
animation: reveal-bottom 0.5s ease-in;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([position='bottom-left']) {
|
|
77
|
+
bottom: 0;
|
|
78
|
+
left: 0;
|
|
79
|
+
|
|
80
|
+
.notification-manager {
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.notification {
|
|
85
|
+
animation: reveal-bottom 0.5s ease-in;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([position='top-right']) {
|
|
90
|
+
top: 0;
|
|
91
|
+
right: 0;
|
|
92
|
+
|
|
93
|
+
.notification-manager {
|
|
94
|
+
align-items: flex-end;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.notification {
|
|
98
|
+
animation: reveal-top 0.5s ease-in;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host([position='top-left']) {
|
|
103
|
+
top: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
|
|
106
|
+
.notification-manager {
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.notification {
|
|
111
|
+
animation: reveal-top 0.5s ease-in;
|
|
112
|
+
}
|
|
113
|
+
}
|