@redvars/peacock 3.5.1 → 3.6.1
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-DuASuVth.js → BaseButton-BNFAYn-S.js} +2 -2
- package/dist/{BaseButton-DuASuVth.js.map → BaseButton-BNFAYn-S.js.map} +1 -1
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/banner.js +2 -3
- package/dist/banner.js.map +1 -1
- package/dist/{button-DouvOfEU.js → button-colors-Ccys3hvS.js} +5 -294
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +226 -6
- 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/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/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +1 -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 +8479 -3965
- package/dist/custom-elements.json +15228 -7544
- 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 +1 -1
- package/dist/flow-designer-DvTUrDp5.js +1656 -0
- package/dist/flow-designer-DvTUrDp5.js.map +1 -0
- package/dist/flow-designer-node-BWrPuxAR.js +548 -0
- package/dist/flow-designer-node-BWrPuxAR.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 +27516 -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 +29 -6
- 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 +412 -0
- package/dist/modal.js.map +1 -0
- package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DTTkqohi.js} +1049 -2391
- package/dist/navigation-rail-DTTkqohi.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/peacock-loader.js +93 -8
- 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/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/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/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/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/html-editor/html-editor.d.ts +89 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/list/index.d.ts +2 -0
- package/dist/src/list/list-item.d.ts +35 -0
- package/dist/src/list/list.d.ts +28 -0
- 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 +57 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +3 -7
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/number-field/number-field.d.ts +2 -2
- 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/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/svg/index.d.ts +1 -0
- package/dist/src/svg/svg.d.ts +38 -0
- package/dist/src/toolbar/toolbar.d.ts +3 -3
- package/dist/src/tooltip/tooltip.d.ts +2 -15
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/toolbar.js +3 -3
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -2
- package/readme.md +3 -3
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/banner/banner.scss +2 -3
- package/src/button/button/button.ts +1 -0
- 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/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/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/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/html-editor/html-editor.scss +188 -0
- package/src/html-editor/html-editor.ts +491 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +27 -1
- package/src/list/index.ts +2 -0
- package/src/list/list-item.scss +111 -0
- package/src/list/list-item.ts +175 -0
- package/src/list/list.scss +24 -0
- package/src/list/list.ts +51 -0
- 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 +82 -78
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +195 -0
- package/src/navigation-rail/navigation-rail-item.scss +7 -38
- package/src/navigation-rail/navigation-rail-item.ts +1 -2
- package/src/navigation-rail/navigation-rail.scss +17 -21
- package/src/navigation-rail/navigation-rail.ts +6 -9
- 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 +2 -2
- package/src/peacock-loader.ts +83 -0
- 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/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/svg/index.ts +1 -0
- package/src/svg/svg.scss +91 -0
- package/src/svg/svg.ts +160 -0
- package/src/table/table.ts +2 -2
- package/src/toolbar/toolbar.ts +3 -3
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +46 -104
- package/dist/button-DouvOfEU.js.map +0 -1
- package/dist/button-group-CEdMwvJJ.js +0 -464
- package/dist/button-group-CEdMwvJJ.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/navigation-rail-Lxetd5-Z.js.map +0 -1
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
package/src/index.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { Elevation } from './elevation/index.js';
|
|
|
7
7
|
export { Button, ButtonGroup, IconButton } from './button/index.js';
|
|
8
8
|
export { Fab } from './fab/index.js';
|
|
9
9
|
export { SegmentedButton, SegmentedButtonGroup } from './segmented-button/index.js';
|
|
10
|
+
export { SplitButton } from './split-button/index.js';
|
|
11
|
+
export { DropdownButton } from './dropdown-button/index.js';
|
|
10
12
|
|
|
11
13
|
export { FocusRing } from './focus-ring/index.js';
|
|
12
14
|
export { Ripple } from './ripple/index.js';
|
|
@@ -32,12 +34,16 @@ export { Container } from './container/index.js';
|
|
|
32
34
|
export { NumberCounter } from './number-counter/index.js';
|
|
33
35
|
export { EmptyState } from './empty-state/index.js';
|
|
34
36
|
export { Tooltip } from './popover/index.js';
|
|
37
|
+
export { Popover, PopoverContent } from './popover/index.js';
|
|
35
38
|
export { Breadcrumb, BreadcrumbItem } from './breadcrumb/index.js';
|
|
36
39
|
export { Menu, MenuItem, SubMenu } from './menu/index.js';
|
|
40
|
+
export { List, ListItem } from './list/index.js';
|
|
37
41
|
|
|
38
42
|
export { CodeHighlighter } from './code-highlighter/index.js';
|
|
39
43
|
export { CodeEditor } from './code-editor/index.js';
|
|
44
|
+
export { HtmlEditor } from './html-editor/index.js';
|
|
40
45
|
export { Image } from './image/index.js';
|
|
46
|
+
export { Svg } from './svg/index.js';
|
|
41
47
|
export { Tab, TabGroup, TabPanel, Tabs } from './tabs/index.js';
|
|
42
48
|
export { Slider } from './slider/index.js';
|
|
43
49
|
export { ChartDoughnut } from './chart-doughnut/index.js';
|
|
@@ -49,8 +55,10 @@ export { SidebarMenu, SidebarMenuItem, SidebarSubMenu } from './sidebar-menu/ind
|
|
|
49
55
|
export { Card } from './card/index.js';
|
|
50
56
|
export { Banner } from './banner/index.js';
|
|
51
57
|
export { Notification } from './notification/index.js';
|
|
58
|
+
export { NotificationManager } from './notification-manager/index.js';
|
|
52
59
|
export { Snackbar } from './snackbar/index.js';
|
|
53
60
|
export { Radio } from './radio/index.js';
|
|
61
|
+
export { Modal } from './modal/index.js';
|
|
54
62
|
export { BottomSheet } from './bottom-sheet/index.js';
|
|
55
63
|
export { SideSheet } from './side-sheet/index.js';
|
|
56
64
|
export { Select } from './select/index.js';
|
|
@@ -59,4 +67,22 @@ export { SelectOptionElement } from './select/index.js';
|
|
|
59
67
|
export { Search } from './search/index.js';
|
|
60
68
|
export { Toolbar } from './toolbar/index.js';
|
|
61
69
|
export { NavigationRail, NavigationRailItem } from './navigation-rail/index.js';
|
|
62
|
-
|
|
70
|
+
export { Calendar, CalendarColumnView, CalendarMonthView } from './calendar/index.js';
|
|
71
|
+
export type { CalendarViewType, EventType } from './calendar/index.js';
|
|
72
|
+
export { Canvas } from './canvas/index.js';
|
|
73
|
+
export type { CanvasShape } from './canvas/index.js';
|
|
74
|
+
export { FlowDesigner, FlowDesignerNode } from './flow-designer/index.js';
|
|
75
|
+
export type {
|
|
76
|
+
Workflow,
|
|
77
|
+
WorkflowNode,
|
|
78
|
+
WorkflowCommand,
|
|
79
|
+
PositionedNode,
|
|
80
|
+
ValidationError,
|
|
81
|
+
HistoryEntry,
|
|
82
|
+
EditorState,
|
|
83
|
+
NodeType,
|
|
84
|
+
WorkflowChangeEvent,
|
|
85
|
+
SwimlaneConfig,
|
|
86
|
+
NodeTemplate,
|
|
87
|
+
} from './flow-designer/index.js';
|
|
88
|
+
export { ConditionBuilder, CbPredicate, CbCompoundExpression, CbExpression, CbDivider } from './condition-builder/index.js';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
@use "../../scss/mixin";
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
padding-inline: var(--spacing-050);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.item-element {
|
|
11
|
+
position: relative;
|
|
12
|
+
min-height: 3.5rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
border: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
outline: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
text-align: initial;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
@include mixin.get-typography(body-large);
|
|
24
|
+
|
|
25
|
+
.list-item-content {
|
|
26
|
+
position: relative;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(--spacing-200);
|
|
31
|
+
min-height: 3.5rem;
|
|
32
|
+
padding-inline: var(--spacing-200);
|
|
33
|
+
color: var(--_label-text-color);
|
|
34
|
+
opacity: var(--_label-text-opacity, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.leading,
|
|
38
|
+
.trailing {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
min-width: 1.5rem;
|
|
43
|
+
color: var(--_leading-trailing-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.trailing {
|
|
47
|
+
margin-inline-start: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.content {
|
|
51
|
+
display: block;
|
|
52
|
+
flex: 1;
|
|
53
|
+
min-inline-size: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.background {
|
|
57
|
+
position: absolute;
|
|
58
|
+
inset: 0;
|
|
59
|
+
background-color: var(--_container-color);
|
|
60
|
+
opacity: var(--_container-opacity, 1);
|
|
61
|
+
border-radius: var(--shape-corner-medium);
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.focus-ring {
|
|
66
|
+
--focus-ring-container-shape-start-start: var(--shape-corner-medium);
|
|
67
|
+
--focus-ring-container-shape-start-end: var(--shape-corner-medium);
|
|
68
|
+
--focus-ring-container-shape-end-start: var(--shape-corner-medium);
|
|
69
|
+
--focus-ring-container-shape-end-end: var(--shape-corner-medium);
|
|
70
|
+
z-index: 2;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ripple {
|
|
74
|
+
--ripple-state-opacity: var(--_container-state-opacity, 0);
|
|
75
|
+
--ripple-pressed-color: var(--_container-state-color);
|
|
76
|
+
border-radius: var(--shape-corner-medium);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.item-element {
|
|
80
|
+
--_container-color: transparent;
|
|
81
|
+
--_label-text-color: var(--color-on-surface);
|
|
82
|
+
--_leading-trailing-color: var(--color-on-surface-variant);
|
|
83
|
+
--_container-state-color: var(--color-on-surface);
|
|
84
|
+
|
|
85
|
+
&:hover:not(:where(.disabled, .selected)) {
|
|
86
|
+
--_container-state-opacity: 0.08;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.pressed:not(:where(.disabled)) {
|
|
90
|
+
--_container-state-opacity: 0.12;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.selected {
|
|
94
|
+
--_container-color: var(--color-secondary-container);
|
|
95
|
+
--_label-text-color: var(--color-on-secondary-container);
|
|
96
|
+
--_leading-trailing-color: var(--color-on-secondary-container);
|
|
97
|
+
--_container-state-color: var(--color-on-secondary-container);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.disabled {
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
--_label-text-color: var(--color-on-surface);
|
|
103
|
+
--_label-text-opacity: 0.38;
|
|
104
|
+
--_leading-trailing-color: var(--color-on-surface);
|
|
105
|
+
--_container-opacity: 0.12;
|
|
106
|
+
|
|
107
|
+
.ripple {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import styles from './list-item.scss';
|
|
6
|
+
import BaseButtonMixin from '@/__mixins/BaseButtonMixin.js';
|
|
7
|
+
import BaseHyperlinkMixin from '@/__mixins/BaseHyperlinkMixin.js';
|
|
8
|
+
import {
|
|
9
|
+
dispatchActivationClick,
|
|
10
|
+
isActivationClick,
|
|
11
|
+
} from '@/__utils/dispatch-event-utils.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @label List Item
|
|
15
|
+
* @tag wc-list-item
|
|
16
|
+
* @rawTag list-item
|
|
17
|
+
* @parentRawTag list
|
|
18
|
+
*
|
|
19
|
+
* @summary A Material 3 list item with leading, trailing and content slots.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```html
|
|
23
|
+
* <wc-list-item selected>
|
|
24
|
+
* <wc-icon slot="leading" name="person"></wc-icon>
|
|
25
|
+
* Profile
|
|
26
|
+
* <wc-icon slot="trailing" name="chevron_right"></wc-icon>
|
|
27
|
+
* </wc-list-item>
|
|
28
|
+
* ```
|
|
29
|
+
* @tags display
|
|
30
|
+
*/
|
|
31
|
+
export class ListItem extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
32
|
+
static styles = [styles];
|
|
33
|
+
|
|
34
|
+
@property({ type: Boolean, reflect: true }) selected = false;
|
|
35
|
+
|
|
36
|
+
@query('#item') readonly itemElement!: HTMLElement | null;
|
|
37
|
+
|
|
38
|
+
@state() isPressed = false;
|
|
39
|
+
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
// eslint-disable-next-line wc/guard-super-call
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
|
|
44
|
+
if (!this.hasAttribute('role')) {
|
|
45
|
+
this.setAttribute('role', 'listitem');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override focus() {
|
|
50
|
+
this.itemElement?.focus();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override blur() {
|
|
54
|
+
this.itemElement?.blur();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
58
|
+
if (this.softDisabled || (this.disabled && this.href)) {
|
|
59
|
+
event.stopImmediatePropagation();
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!isActivationClick(event) || !this.itemElement) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.focus();
|
|
69
|
+
dispatchActivationClick(this.itemElement);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
__handleKeyDown = (event: KeyboardEvent) => {
|
|
73
|
+
this.__handlePress(event);
|
|
74
|
+
|
|
75
|
+
if (this.disabled || this.softDisabled || !this.itemElement) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (event.key === ' ') {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
this.itemElement.click();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (event.key === 'Enter' && !this.__isLink()) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
this.itemElement.click();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
92
|
+
if (this.disabled || this.softDisabled) return;
|
|
93
|
+
|
|
94
|
+
if (
|
|
95
|
+
event instanceof KeyboardEvent &&
|
|
96
|
+
event.type === 'keydown' &&
|
|
97
|
+
(event.key === 'Enter' || event.key === ' ')
|
|
98
|
+
) {
|
|
99
|
+
this.isPressed = true;
|
|
100
|
+
} else if (event.type === 'mousedown') {
|
|
101
|
+
this.isPressed = true;
|
|
102
|
+
} else {
|
|
103
|
+
this.isPressed = false;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
render() {
|
|
108
|
+
const isLink = this.__isLink();
|
|
109
|
+
|
|
110
|
+
const cssClasses = {
|
|
111
|
+
'list-item': true,
|
|
112
|
+
'item-element': true,
|
|
113
|
+
selected: this.selected,
|
|
114
|
+
disabled: this.disabled || this.softDisabled,
|
|
115
|
+
pressed: this.isPressed,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
if (!isLink) {
|
|
119
|
+
return html`
|
|
120
|
+
<button
|
|
121
|
+
id="item"
|
|
122
|
+
class=${classMap(cssClasses)}
|
|
123
|
+
type=${this.htmlType}
|
|
124
|
+
?disabled=${this.disabled}
|
|
125
|
+
?aria-disabled=${this.softDisabled}
|
|
126
|
+
@click=${this.__dispatchClick}
|
|
127
|
+
@mousedown=${this.__handlePress}
|
|
128
|
+
@keydown=${this.__handleKeyDown}
|
|
129
|
+
@keyup=${this.__handlePress}
|
|
130
|
+
>
|
|
131
|
+
${this.renderContent()}
|
|
132
|
+
</button>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return html`
|
|
137
|
+
<a
|
|
138
|
+
id="item"
|
|
139
|
+
class=${classMap(cssClasses)}
|
|
140
|
+
href=${this.href}
|
|
141
|
+
target=${this.target}
|
|
142
|
+
rel=${ifDefined(this.rel)}
|
|
143
|
+
download=${ifDefined(this.download)}
|
|
144
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
145
|
+
aria-disabled=${String(this.disabled || this.softDisabled)}
|
|
146
|
+
@click=${this.__dispatchClick}
|
|
147
|
+
@mousedown=${this.__handlePress}
|
|
148
|
+
@keydown=${this.__handleKeyDown}
|
|
149
|
+
@keyup=${this.__handlePress}
|
|
150
|
+
>
|
|
151
|
+
${this.renderContent()}
|
|
152
|
+
</a>
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
renderContent() {
|
|
157
|
+
return html`
|
|
158
|
+
<wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
|
|
159
|
+
<div class="background"></div>
|
|
160
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
161
|
+
|
|
162
|
+
<div class="list-item-content">
|
|
163
|
+
<div class="leading">
|
|
164
|
+
<slot name="leading"></slot>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="content">
|
|
167
|
+
<slot></slot>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="trailing">
|
|
170
|
+
<slot name="trailing"></slot>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@use "../../scss/mixin";
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.list {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--spacing-050);
|
|
13
|
+
padding-block: var(--spacing-050);
|
|
14
|
+
border-radius: var(--shape-corner-large);
|
|
15
|
+
background-color: var(--_container-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.list.variant-standard {
|
|
19
|
+
--_container-color: var(--color-surface-container);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.list.variant-vibrant {
|
|
23
|
+
--_container-color: var(--color-tertiary-container);
|
|
24
|
+
}
|
package/src/list/list.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { LitElement, html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import styles from './list.scss';
|
|
5
|
+
import { ListItem } from './list-item.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @label List
|
|
9
|
+
* @tag wc-list
|
|
10
|
+
* @rawTag list
|
|
11
|
+
*
|
|
12
|
+
* @summary A Material 3 list container for one or more list items.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <wc-list>
|
|
17
|
+
* <wc-list-item>
|
|
18
|
+
* <wc-icon slot="leading" name="inbox"></wc-icon>
|
|
19
|
+
* Inbox
|
|
20
|
+
* <span slot="trailing">24</span>
|
|
21
|
+
* </wc-list-item>
|
|
22
|
+
* </wc-list>
|
|
23
|
+
* ```
|
|
24
|
+
* @tags display
|
|
25
|
+
*/
|
|
26
|
+
export class List extends LitElement {
|
|
27
|
+
static styles = [styles];
|
|
28
|
+
|
|
29
|
+
static Item = ListItem;
|
|
30
|
+
|
|
31
|
+
@property({ type: String, reflect: true }) variant: 'standard' | 'vibrant' =
|
|
32
|
+
'standard';
|
|
33
|
+
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this.setAttribute('role', 'list');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
const cssClasses = {
|
|
41
|
+
list: true,
|
|
42
|
+
[`variant-${this.variant}`]: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return html`
|
|
46
|
+
<div class=${classMap(cssClasses)}>
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/menu/menu/menu.scss
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
padding-block: var(--spacing-050);
|
|
13
13
|
transform-origin: top center;
|
|
14
14
|
|
|
15
|
-
--_menu-enter-duration: var(--duration-medium1
|
|
16
|
-
--_menu-exit-duration: var(--duration-
|
|
15
|
+
--_menu-enter-duration: var(--duration-medium1);
|
|
16
|
+
--_menu-exit-duration: var(--duration-medium2);
|
|
17
17
|
--_menu-enter-easing: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
18
18
|
--_menu-exit-easing: cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
19
19
|
|