@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
package/src/banner/banner.scss
CHANGED
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
display: block;
|
|
7
|
-
|
|
8
|
-
--banner-container-color: var(--color-tertiary-container);
|
|
9
|
-
--banner-label-text-color: var(--color-on-tertiary-container);
|
|
10
|
-
--banner-description-text-color: var(--color-on-tertiary-container);
|
|
11
|
-
--banner-icon-color: var(--color-on-tertiary-container);
|
|
12
|
-
--banner-border-radius: var(--shape-corner-small);
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
.banner {
|
|
@@ -17,7 +11,7 @@
|
|
|
17
11
|
background: var(--banner-container-color);
|
|
18
12
|
border-radius: var(--banner-border-radius);
|
|
19
13
|
display: grid;
|
|
20
|
-
gap: var(--spacing-
|
|
14
|
+
gap: var(--spacing-100);
|
|
21
15
|
grid-template-columns: auto 1fr;
|
|
22
16
|
padding: var(--spacing-200);
|
|
23
17
|
}
|
|
@@ -27,31 +21,32 @@
|
|
|
27
21
|
color: var(--banner-icon-color);
|
|
28
22
|
display: inline-flex;
|
|
29
23
|
justify-content: center;
|
|
30
|
-
|
|
31
|
-
padding-top: 0.1rem;
|
|
24
|
+
--icon-size: 1.5rem;
|
|
32
25
|
}
|
|
33
26
|
|
|
34
27
|
.banner-content {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
.banner-label {
|
|
29
|
+
display: inline;
|
|
30
|
+
@include mixin.get-typography(label-large);
|
|
31
|
+
color: var(--banner-label-text-color);
|
|
32
|
+
margin-inline-end: var(--spacing-050);
|
|
33
|
+
}
|
|
39
34
|
|
|
40
|
-
.banner-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
.banner-description {
|
|
36
|
+
display: inline;
|
|
37
|
+
@include mixin.get-typography(body-medium);
|
|
38
|
+
color: var(--banner-description-text-color);
|
|
39
|
+
}
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
.banner-description {
|
|
46
|
-
@include mixin.get-typography(body-medium);
|
|
47
|
-
color: var(--banner-description-text-color);
|
|
48
|
-
}
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
// Default styles for the banner and content. These will be overridden by the variant-specific styles below.
|
|
44
|
+
:host {
|
|
45
|
+
--banner-container-color: var(--color-tertiary-container);
|
|
46
|
+
--banner-label-text-color: var(--color-on-tertiary-container);
|
|
47
|
+
--banner-description-text-color: var(--color-on-tertiary-container);
|
|
48
|
+
--banner-icon-color: var(--color-on-tertiary-container);
|
|
49
|
+
--banner-border-radius: var(--shape-corner-small);
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
.banner.info,
|
package/src/banner/banner.ts
CHANGED
|
@@ -69,12 +69,6 @@ export class Banner extends LitElement {
|
|
|
69
69
|
@property({ type: String })
|
|
70
70
|
description = '';
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* When true, label and description are rendered on a single line.
|
|
74
|
-
*/
|
|
75
|
-
@property({ type: Boolean, reflect: true })
|
|
76
|
-
inline = false;
|
|
77
|
-
|
|
78
72
|
private get resolvedLabel() {
|
|
79
73
|
return this.label || VARIANT_LABELS[this.variant];
|
|
80
74
|
}
|
|
@@ -92,7 +86,7 @@ export class Banner extends LitElement {
|
|
|
92
86
|
</slot>
|
|
93
87
|
</div>
|
|
94
88
|
|
|
95
|
-
<div class=${classMap({ 'banner-content': true, [this.variant]: true
|
|
89
|
+
<div class=${classMap({ 'banner-content': true, [this.variant]: true })}>
|
|
96
90
|
<div class="banner-label">
|
|
97
91
|
<slot name="label">${this.resolvedLabel}:</slot>
|
|
98
92
|
</div>
|
package/src/button/BaseButton.ts
CHANGED
|
@@ -1,81 +1,21 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';
|
|
4
|
-
import
|
|
4
|
+
import BaseHyperlinkMixin from '@/__mixins/BaseHyperlinkMixin.js';
|
|
5
|
+
import BaseButtonMixin from '@/__mixins/BaseButtonMixin.js';
|
|
5
6
|
|
|
6
|
-
export class BaseButton extends BaseHyperlink(LitElement) {
|
|
7
|
-
protected static readonly DISABLED_REASON_ID = 'disabled-reason';
|
|
8
|
-
|
|
9
|
-
@property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
|
|
10
|
-
'button';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Type is preset of color and variant. Type will be only applied.
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
@property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The visual style of the button.
|
|
20
|
-
*
|
|
21
|
-
* Possible variant values:
|
|
22
|
-
* `"filled"` is a filled button.
|
|
23
|
-
* `"outlined"` is an outlined button.
|
|
24
|
-
* `"text"` is a transparent button.
|
|
25
|
-
* `"tonal"` is a light color button.
|
|
26
|
-
* `"elevated"` is elevated button
|
|
27
|
-
*/
|
|
28
|
-
@property() variant:
|
|
29
|
-
| 'elevated'
|
|
30
|
-
| 'filled'
|
|
31
|
-
| 'tonal'
|
|
32
|
-
| 'outlined'
|
|
33
|
-
| 'text'
|
|
34
|
-
| 'neo' = 'filled';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
38
|
-
*/
|
|
39
|
-
@property({ reflect: true }) color:
|
|
40
|
-
| 'primary'
|
|
41
|
-
| 'success'
|
|
42
|
-
| 'danger'
|
|
43
|
-
| 'warning'
|
|
44
|
-
| 'surface'
|
|
45
|
-
| 'on-surface' = 'primary';
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Button size.
|
|
49
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
50
|
-
*/
|
|
51
|
-
@property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
55
|
-
*/
|
|
56
|
-
@property({ type: Boolean, reflect: true })
|
|
57
|
-
disabled: boolean = false;
|
|
58
7
|
|
|
59
|
-
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
60
8
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
@property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
|
|
65
|
-
softDisabled: boolean = false;
|
|
9
|
+
export class BaseButton extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
10
|
+
protected static readonly DISABLED_REASON_ID = 'disabled-reason';
|
|
66
11
|
|
|
67
|
-
/**
|
|
68
|
-
* If button is disabled, the reason why it is disabled.
|
|
69
|
-
*/
|
|
70
|
-
@property({ attribute: 'disabled-reason' })
|
|
71
|
-
disabledReason: string = '';
|
|
72
12
|
|
|
13
|
+
color?: string;
|
|
73
14
|
|
|
74
|
-
|
|
75
|
-
configAria?: { [key: string]: any };
|
|
15
|
+
variant?: string;
|
|
76
16
|
|
|
17
|
+
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
77
18
|
|
|
78
|
-
|
|
79
19
|
@property({ type: Boolean, reflect: true }) toggle: boolean = false;
|
|
80
20
|
|
|
81
21
|
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
@@ -95,14 +35,6 @@ export class BaseButton extends BaseHyperlink(LitElement) {
|
|
|
95
35
|
|
|
96
36
|
@query('.button') readonly buttonElement!: HTMLElement | null;
|
|
97
37
|
|
|
98
|
-
override focus() {
|
|
99
|
-
this.buttonElement?.focus();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
override blur() {
|
|
103
|
-
this.buttonElement?.blur();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
38
|
override connectedCallback() {
|
|
107
39
|
super.connectedCallback();
|
|
108
40
|
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
@@ -157,33 +89,12 @@ export class BaseButton extends BaseHyperlink(LitElement) {
|
|
|
157
89
|
dispatchActivationClick(this.buttonElement);
|
|
158
90
|
};
|
|
159
91
|
|
|
160
|
-
|
|
161
|
-
if (this.type === 'primary') {
|
|
162
|
-
this.color = 'primary';
|
|
163
|
-
this.variant = 'filled';
|
|
164
|
-
} else if (this.type === 'secondary') {
|
|
165
|
-
this.color = 'surface';
|
|
166
|
-
this.variant = 'filled';
|
|
167
|
-
} else if (this.type === 'tertiary') {
|
|
168
|
-
this.color = 'primary';
|
|
169
|
-
this.variant = 'text';
|
|
170
|
-
} else if (this.type === 'danger') {
|
|
171
|
-
this.color = 'danger';
|
|
172
|
-
this.variant = 'filled';
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
protected get __disabledReasonID(): string | undefined {
|
|
177
|
-
return this.disabled && this.disabledReason
|
|
178
|
-
? BaseButton.DISABLED_REASON_ID
|
|
179
|
-
: undefined;
|
|
180
|
-
}
|
|
92
|
+
|
|
181
93
|
|
|
182
|
-
__renderDisabledReason() {
|
|
183
|
-
|
|
184
|
-
if (disabledReasonID)
|
|
94
|
+
__renderDisabledReason(softDisabled: boolean) {
|
|
95
|
+
if (softDisabled)
|
|
185
96
|
return html`<div
|
|
186
|
-
id=${
|
|
97
|
+
id=${BaseButton.DISABLED_REASON_ID}
|
|
187
98
|
role="tooltip"
|
|
188
99
|
aria-label=${this.disabledReason}
|
|
189
100
|
class="screen-reader-only"
|
|
@@ -67,11 +67,13 @@
|
|
|
67
67
|
letter-spacing: 0 !important;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
:host([size='xl'])
|
|
70
|
+
:host([size='xl']),
|
|
71
|
+
:host([size='extra-large']) {
|
|
71
72
|
--button-height: 8.5rem;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
:host([size='xl']) .button
|
|
75
|
+
:host([size='xl']) .button,
|
|
76
|
+
:host([size='extra-large']) .button {
|
|
75
77
|
--_button-icon-size: 2.5rem;
|
|
76
78
|
--_button_container-padding: 4rem;
|
|
77
79
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
import IndividualComponent from '@/IndividualComponent.js';
|
|
5
6
|
import styles from './button.scss';
|
|
6
7
|
import colorStyles from './button-colors.scss';
|
|
@@ -56,8 +57,6 @@ import { BaseButton } from '../BaseButton.js';
|
|
|
56
57
|
export class Button extends BaseButton {
|
|
57
58
|
static override styles = [styles, colorStyles, sizeStyles];
|
|
58
59
|
|
|
59
|
-
#tabindex?: number = 0;
|
|
60
|
-
|
|
61
60
|
/**
|
|
62
61
|
* Icon alignment.
|
|
63
62
|
* Possible values are `"start"`, `"end"`. Defaults to `"end"`.
|
|
@@ -65,6 +64,53 @@ export class Button extends BaseButton {
|
|
|
65
64
|
@property({ attribute: 'icon-align' })
|
|
66
65
|
iconAlign: 'start' | 'end' = 'end';
|
|
67
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Button size.
|
|
69
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
70
|
+
*/
|
|
71
|
+
@property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Type is preset of color and variant. Type will be only applied.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
@property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The visual style of the button.
|
|
81
|
+
*
|
|
82
|
+
* Possible variant values:
|
|
83
|
+
* `"filled"` is a filled button.
|
|
84
|
+
* `"outlined"` is an outlined button.
|
|
85
|
+
* `"text"` is a transparent button.
|
|
86
|
+
* `"tonal"` is a light color button.
|
|
87
|
+
* `"elevated"` is elevated button
|
|
88
|
+
*/
|
|
89
|
+
@property() variant:
|
|
90
|
+
| 'elevated'
|
|
91
|
+
| 'filled'
|
|
92
|
+
| 'tonal'
|
|
93
|
+
| 'outlined'
|
|
94
|
+
| 'text'
|
|
95
|
+
| 'neo' = 'filled';
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
99
|
+
*/
|
|
100
|
+
@property({ reflect: true }) color:
|
|
101
|
+
| 'primary'
|
|
102
|
+
| 'success'
|
|
103
|
+
| 'danger'
|
|
104
|
+
| 'warning'
|
|
105
|
+
| 'surface'
|
|
106
|
+
| 'on-surface' = 'primary';
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Additional ARIA attributes to pass to the inner button/anchor element.
|
|
110
|
+
*/
|
|
111
|
+
@property({ reflect: true })
|
|
112
|
+
configAria?: { [key: string]: any };
|
|
113
|
+
|
|
68
114
|
@state()
|
|
69
115
|
private slotHasContent = false;
|
|
70
116
|
|
|
@@ -76,18 +122,6 @@ export class Button extends BaseButton {
|
|
|
76
122
|
this.buttonElement?.blur();
|
|
77
123
|
}
|
|
78
124
|
|
|
79
|
-
override connectedCallback() {
|
|
80
|
-
super.connectedCallback();
|
|
81
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
82
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
override disconnectedCallback() {
|
|
86
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
87
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
88
|
-
super.disconnectedCallback();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
125
|
override firstUpdated() {
|
|
92
126
|
this.__dispatchClickWithThrottle = throttle(
|
|
93
127
|
this.__dispatchClick,
|
|
@@ -104,6 +138,22 @@ export class Button extends BaseButton {
|
|
|
104
138
|
this.__convertTypeToVariantAndColor();
|
|
105
139
|
}
|
|
106
140
|
|
|
141
|
+
__convertTypeToVariantAndColor() {
|
|
142
|
+
if (this.type === 'primary') {
|
|
143
|
+
this.color = 'primary';
|
|
144
|
+
this.variant = 'filled';
|
|
145
|
+
} else if (this.type === 'secondary') {
|
|
146
|
+
this.color = 'surface';
|
|
147
|
+
this.variant = 'filled';
|
|
148
|
+
} else if (this.type === 'tertiary') {
|
|
149
|
+
this.color = 'primary';
|
|
150
|
+
this.variant = 'text';
|
|
151
|
+
} else if (this.type === 'danger') {
|
|
152
|
+
this.color = 'danger';
|
|
153
|
+
this.variant = 'filled';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
107
157
|
override render() {
|
|
108
158
|
const isLink = this.__isLink();
|
|
109
159
|
|
|
@@ -124,14 +174,15 @@ export class Button extends BaseButton {
|
|
|
124
174
|
return html`<button
|
|
125
175
|
class=${classMap(cssClasses)}
|
|
126
176
|
id="button"
|
|
127
|
-
tabindex=${this.#tabindex}
|
|
128
177
|
type=${this.htmlType}
|
|
129
178
|
@click=${this.__dispatchClickWithThrottle}
|
|
130
179
|
@mousedown=${this.__handlePress}
|
|
131
180
|
@keydown=${this.__handlePress}
|
|
132
181
|
@keyup=${this.__handlePress}
|
|
133
|
-
|
|
134
|
-
aria-
|
|
182
|
+
|
|
183
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
184
|
+
?aria-disabled=${this.softDisabled}
|
|
185
|
+
|
|
135
186
|
?disabled=${this.disabled}
|
|
136
187
|
${spread(this.configAria)}
|
|
137
188
|
>
|
|
@@ -142,16 +193,19 @@ export class Button extends BaseButton {
|
|
|
142
193
|
return html`<a
|
|
143
194
|
class=${classMap(cssClasses)}
|
|
144
195
|
id="button"
|
|
145
|
-
tabindex=${this.#tabindex}
|
|
146
196
|
href=${this.href}
|
|
147
197
|
target=${this.target}
|
|
148
|
-
|
|
198
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
199
|
+
|
|
200
|
+
@click=${this.__dispatchClick}
|
|
149
201
|
@mousedown=${this.__handlePress}
|
|
150
202
|
@keydown=${this.__handlePress}
|
|
151
203
|
@keyup=${this.__handlePress}
|
|
152
204
|
role="button"
|
|
153
|
-
|
|
154
|
-
aria-
|
|
205
|
+
|
|
206
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
207
|
+
?aria-disabled=${this.softDisabled}
|
|
208
|
+
|
|
155
209
|
${spread(this.configAria)}
|
|
156
210
|
>
|
|
157
211
|
${this.renderButtonContent()}
|
|
@@ -161,7 +215,7 @@ export class Button extends BaseButton {
|
|
|
161
215
|
|
|
162
216
|
renderButtonContent() {
|
|
163
217
|
return html`
|
|
164
|
-
<wc-focus-ring class="focus-ring"
|
|
218
|
+
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
165
219
|
<wc-elevation class="elevation"></wc-elevation>
|
|
166
220
|
<div class="neo-background"></div>
|
|
167
221
|
<div class="background"></div>
|
|
@@ -177,7 +231,7 @@ export class Button extends BaseButton {
|
|
|
177
231
|
<slot name="icon"></slot>
|
|
178
232
|
</div>
|
|
179
233
|
|
|
180
|
-
${this.__renderDisabledReason()}
|
|
234
|
+
${this.__renderDisabledReason(this.softDisabled)}
|
|
181
235
|
`;
|
|
182
236
|
}
|
|
183
237
|
}
|
|
@@ -17,8 +17,8 @@ import { BaseButton } from '../BaseButton.js';
|
|
|
17
17
|
* @example
|
|
18
18
|
* ```html
|
|
19
19
|
* <wc-button-group variant="connected">
|
|
20
|
-
* <wc-icon-button name="home"
|
|
21
|
-
* <wc-icon-button name="alarm"
|
|
20
|
+
* <wc-icon-button toggle selected><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
21
|
+
* <wc-icon-button toggle><wc-icon name="alarm"></wc-icon></wc-icon-button>
|
|
22
22
|
* </wc-button-group>
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
import styles from '../button/button.scss';
|
|
5
6
|
import colorStyles from '../button/button-colors.scss';
|
|
6
7
|
import sizeStyles from './icon-button-sizes.scss';
|
|
7
8
|
import { spread } from '@/__directive/spread.js';
|
|
8
9
|
import { throttle } from '@/__utils/throttle.js';
|
|
9
10
|
import { BaseButton } from '../BaseButton.js';
|
|
10
|
-
import { IconProvider } from '../../icon/icon.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @label Icon Button
|
|
@@ -48,20 +48,59 @@ import { IconProvider } from '../../icon/icon.js';
|
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* ```html
|
|
51
|
-
* <wc-icon-button name="home"></wc-icon-button>
|
|
51
|
+
* <wc-icon-button><wc-icon name="home"></wc-icon></wc-icon-button>
|
|
52
52
|
* ```
|
|
53
53
|
* @tags display
|
|
54
54
|
*/
|
|
55
55
|
export class IconButton extends BaseButton {
|
|
56
56
|
static override styles = [styles, colorStyles, sizeStyles];
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Button size.
|
|
60
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
61
|
+
*/
|
|
62
|
+
@property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Type is preset of color and variant. Type will be only applied.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
@property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The visual style of the button.
|
|
72
|
+
*
|
|
73
|
+
* Possible variant values:
|
|
74
|
+
* `"filled"` is a filled button.
|
|
75
|
+
* `"outlined"` is an outlined button.
|
|
76
|
+
* `"text"` is a transparent button.
|
|
77
|
+
* `"tonal"` is a light color button.
|
|
78
|
+
* `"elevated"` is elevated button
|
|
79
|
+
*/
|
|
80
|
+
@property() variant:
|
|
81
|
+
| 'elevated'
|
|
82
|
+
| 'filled'
|
|
83
|
+
| 'tonal'
|
|
84
|
+
| 'outlined'
|
|
85
|
+
| 'text'
|
|
86
|
+
| 'neo' = 'filled';
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
90
|
+
*/
|
|
91
|
+
@property({ reflect: true }) color:
|
|
92
|
+
| 'primary'
|
|
93
|
+
| 'success'
|
|
94
|
+
| 'danger'
|
|
95
|
+
| 'warning'
|
|
96
|
+
| 'surface'
|
|
97
|
+
| 'on-surface' = 'primary';
|
|
63
98
|
|
|
64
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Additional ARIA attributes to pass to the inner button/anchor element.
|
|
101
|
+
*/
|
|
102
|
+
@property({ reflect: true })
|
|
103
|
+
configAria?: { [key: string]: any };
|
|
65
104
|
|
|
66
105
|
override focus() {
|
|
67
106
|
this.buttonElement?.focus();
|
|
@@ -70,18 +109,6 @@ export class IconButton extends BaseButton {
|
|
|
70
109
|
override blur() {
|
|
71
110
|
this.buttonElement?.blur();
|
|
72
111
|
}
|
|
73
|
-
|
|
74
|
-
override connectedCallback() {
|
|
75
|
-
super.connectedCallback();
|
|
76
|
-
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
77
|
-
window.addEventListener('mouseup', this.__handlePress);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
override disconnectedCallback() {
|
|
81
|
-
window.removeEventListener('mouseup', this.__handlePress);
|
|
82
|
-
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
83
|
-
super.disconnectedCallback();
|
|
84
|
-
}
|
|
85
112
|
|
|
86
113
|
override firstUpdated() {
|
|
87
114
|
this.__dispatchClickWithThrottle = throttle(
|
|
@@ -91,6 +118,22 @@ export class IconButton extends BaseButton {
|
|
|
91
118
|
this.__convertTypeToVariantAndColor();
|
|
92
119
|
}
|
|
93
120
|
|
|
121
|
+
__convertTypeToVariantAndColor() {
|
|
122
|
+
if (this.type === 'primary') {
|
|
123
|
+
this.color = 'primary';
|
|
124
|
+
this.variant = 'filled';
|
|
125
|
+
} else if (this.type === 'secondary') {
|
|
126
|
+
this.color = 'surface';
|
|
127
|
+
this.variant = 'filled';
|
|
128
|
+
} else if (this.type === 'tertiary') {
|
|
129
|
+
this.color = 'primary';
|
|
130
|
+
this.variant = 'text';
|
|
131
|
+
} else if (this.type === 'danger') {
|
|
132
|
+
this.color = 'danger';
|
|
133
|
+
this.variant = 'filled';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
94
137
|
override render() {
|
|
95
138
|
const isLink = this.__isLink();
|
|
96
139
|
|
|
@@ -109,14 +152,15 @@ export class IconButton extends BaseButton {
|
|
|
109
152
|
return html`<button
|
|
110
153
|
class=${classMap(cssClasses)}
|
|
111
154
|
id="button"
|
|
112
|
-
tabindex=${this.#tabindex}
|
|
113
155
|
type=${this.htmlType}
|
|
114
156
|
@click=${this.__dispatchClickWithThrottle}
|
|
115
157
|
@mousedown=${this.__handlePress}
|
|
116
158
|
@keydown=${this.__handlePress}
|
|
117
159
|
@keyup=${this.__handlePress}
|
|
118
|
-
|
|
119
|
-
aria-
|
|
160
|
+
|
|
161
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
162
|
+
?aria-disabled=${this.softDisabled}
|
|
163
|
+
|
|
120
164
|
?disabled=${this.disabled}
|
|
121
165
|
${spread(this.configAria)}
|
|
122
166
|
>
|
|
@@ -127,16 +171,18 @@ export class IconButton extends BaseButton {
|
|
|
127
171
|
return html`<a
|
|
128
172
|
class=${classMap(cssClasses)}
|
|
129
173
|
id="button"
|
|
130
|
-
tabindex=${this.#tabindex}
|
|
131
174
|
href=${this.href}
|
|
132
175
|
target=${this.target}
|
|
133
|
-
|
|
176
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
177
|
+
@click=${this.__dispatchClick}
|
|
134
178
|
@mousedown=${this.__handlePress}
|
|
135
179
|
@keydown=${this.__handlePress}
|
|
136
180
|
@keyup=${this.__handlePress}
|
|
137
181
|
role="button"
|
|
138
|
-
|
|
139
|
-
aria-
|
|
182
|
+
|
|
183
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
184
|
+
?aria-disabled=${this.softDisabled}
|
|
185
|
+
|
|
140
186
|
${spread(this.configAria)}
|
|
141
187
|
>
|
|
142
188
|
${this.renderButtonContent()}
|
|
@@ -146,7 +192,7 @@ export class IconButton extends BaseButton {
|
|
|
146
192
|
|
|
147
193
|
renderButtonContent() {
|
|
148
194
|
return html`
|
|
149
|
-
<wc-focus-ring class="focus-ring"
|
|
195
|
+
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
150
196
|
<wc-elevation class="elevation"></wc-elevation>
|
|
151
197
|
<div class="neo-background"></div>
|
|
152
198
|
<div class="background"></div>
|
|
@@ -155,14 +201,10 @@ export class IconButton extends BaseButton {
|
|
|
155
201
|
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
156
202
|
|
|
157
203
|
<div class="button-content">
|
|
158
|
-
<
|
|
159
|
-
name=${this.name}
|
|
160
|
-
src=${this.src}
|
|
161
|
-
provider=${this.provider}
|
|
162
|
-
></wc-icon>
|
|
204
|
+
<slot></slot>
|
|
163
205
|
</div>
|
|
164
206
|
|
|
165
|
-
${this.__renderDisabledReason()}
|
|
207
|
+
${this.__renderDisabledReason(this.softDisabled)}
|
|
166
208
|
`;
|
|
167
209
|
}
|
|
168
210
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { startOfDay, endOfDay } from './utils.js';
|
|
2
|
+
|
|
3
|
+
export class BaseEvent {
|
|
4
|
+
gid: string;
|
|
5
|
+
start: Date;
|
|
6
|
+
end: Date;
|
|
7
|
+
|
|
8
|
+
constructor(start: Date, end: Date) {
|
|
9
|
+
this.gid = crypto.randomUUID();
|
|
10
|
+
this.start = start;
|
|
11
|
+
this.end = end;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
length(): number {
|
|
15
|
+
return this.end.valueOf() - this.start.valueOf();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
isOverlapping(event: BaseEvent): boolean {
|
|
19
|
+
let totalLength: number;
|
|
20
|
+
if (this.start.valueOf() <= event.start.valueOf()) {
|
|
21
|
+
totalLength = event.end.valueOf() - this.start.valueOf();
|
|
22
|
+
} else {
|
|
23
|
+
totalLength = this.end.valueOf() - event.start.valueOf();
|
|
24
|
+
}
|
|
25
|
+
return this.length() + event.length() >= totalLength;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
isOverlappingWithoutTime(event: BaseEvent): boolean {
|
|
29
|
+
const thisStartDay = startOfDay(this.start);
|
|
30
|
+
const eventStartDay = startOfDay(event.start);
|
|
31
|
+
const thisEndDay = endOfDay(this.end);
|
|
32
|
+
const eventEndDay = endOfDay(event.end);
|
|
33
|
+
|
|
34
|
+
let totalLength: number;
|
|
35
|
+
if (thisStartDay.valueOf() <= eventStartDay.valueOf()) {
|
|
36
|
+
totalLength = eventEndDay.valueOf() - thisStartDay.valueOf();
|
|
37
|
+
} else {
|
|
38
|
+
totalLength = thisEndDay.valueOf() - eventStartDay.valueOf();
|
|
39
|
+
}
|
|
40
|
+
return this.length() + event.length() >= totalLength;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
isOverlappingWithDate(date: Date): boolean {
|
|
44
|
+
return (
|
|
45
|
+
this.start.valueOf() <= date.valueOf() &&
|
|
46
|
+
this.end.valueOf() >= date.valueOf()
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|