@redvars/peacock 3.6.3 → 3.8.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/ButtonConstants-D06bY4uy.js +114 -0
- package/dist/ButtonConstants-D06bY4uy.js.map +1 -0
- package/dist/{BaseHyperlinkMixin-BNuwbiEf.js → NativeHyperlinkMixin-DrYXyfMQ.js} +8 -10
- package/dist/NativeHyperlinkMixin-DrYXyfMQ.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/{button-colors-Cg6oxiz-.js → button-colors-DSuBHd-i.js} +200 -186
- package/dist/button-colors-DSuBHd-i.js.map +1 -0
- package/dist/button-group.js +8 -8
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +224 -124
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +0 -1
- package/dist/calendar-column-view.js.map +1 -1
- package/dist/calendar-month-view.js +0 -1
- package/dist/calendar-month-view.js.map +1 -1
- package/dist/card-content.js +0 -1
- package/dist/card-content.js.map +1 -1
- package/dist/card.js +96 -90
- package/dist/card.js.map +1 -1
- package/dist/cb-compound-expression.js +4 -1
- package/dist/cb-compound-expression.js.map +1 -1
- package/dist/cb-divider.js +0 -1
- package/dist/cb-divider.js.map +1 -1
- package/dist/cb-expression.js +0 -2
- package/dist/cb-expression.js.map +1 -1
- package/dist/cb-predicate.js +0 -1
- package/dist/cb-predicate.js.map +1 -1
- package/dist/code-highlighter.js +23 -6
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +5102 -18408
- package/dist/custom-elements.json +19630 -20205
- package/dist/fab.js +181 -117
- package/dist/fab.js.map +1 -1
- package/dist/{flow-designer-node-9Bqyn6qx.js → flow-designer-node-BWrPuxAR.js} +1 -2
- package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
- package/dist/flow-designer-node.js +1 -1
- package/dist/flow-designer.js +5 -5
- package/dist/icon-button-CYqrnMnF.js +318 -0
- package/dist/icon-button-CYqrnMnF.js.map +1 -0
- package/dist/index.js +8 -8
- package/dist/{navigation-rail-DAUuJ_Yp.js → navigation-rail-CM_svs5_.js} +511 -295
- package/dist/navigation-rail-CM_svs5_.js.map +1 -0
- package/dist/observe-slot-change-D8Xg-kSS.js +60 -0
- package/dist/observe-slot-change-D8Xg-kSS.js.map +1 -0
- package/dist/peacock-loader.js +7 -7
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-content.js +0 -1
- package/dist/popover-content.js.map +1 -1
- package/dist/search.js +4 -1
- package/dist/search.js.map +1 -1
- package/dist/src/__controllers/attachable-controller.d.ts +109 -0
- package/dist/src/__mixins/{BaseButtonMixin.d.ts → NativeButtonMixin.d.ts} +3 -3
- package/dist/src/__mixins/{BaseHyperlinkMixin.d.ts → NativeHyperlinkMixin.d.ts} +3 -4
- package/dist/src/__utils/is-link.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -1
- package/dist/src/accordion/accordion-item.d.ts +0 -1
- package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +0 -1
- package/dist/src/button/ButtonConstants.d.ts +1 -0
- package/dist/src/button/GroupButtonInterface.d.ts +4 -0
- package/dist/src/button/button/button.d.ts +32 -7
- package/dist/src/button/button-group/button-group.d.ts +2 -1
- package/dist/src/button/icon-button/icon-button.d.ts +26 -5
- package/dist/src/button/index.d.ts +1 -1
- package/dist/src/calendar/calendar-column-view.d.ts +0 -1
- package/dist/src/calendar/calendar-month-view.d.ts +0 -1
- package/dist/src/card/card-content.d.ts +0 -1
- package/dist/src/card/card.d.ts +9 -6
- package/dist/src/chip/chip/chip.d.ts +22 -3
- package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -1
- package/dist/src/condition-builder/cb-divider.d.ts +0 -1
- package/dist/src/condition-builder/cb-expression.d.ts +0 -1
- package/dist/src/condition-builder/cb-predicate.d.ts +0 -1
- package/dist/src/fab/fab.d.ts +20 -6
- package/dist/src/flow-designer/flow-designer-node.d.ts +0 -1
- package/dist/src/focus-ring/focus-ring.d.ts +26 -20
- package/dist/src/item/item.d.ts +2 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/list/list-item.d.ts +1 -2
- package/dist/src/menu/menu-item/menu-item.d.ts +1 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +0 -1
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +0 -2
- package/dist/src/popover/popover-content.d.ts +0 -1
- package/dist/src/ripple/ripple.d.ts +9 -1
- package/dist/src/segmented-button/segmented-button.d.ts +0 -1
- package/dist/src/select/option.d.ts +0 -1
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +0 -1
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +0 -1
- package/dist/src/tabs/tab-panel.d.ts +0 -1
- package/dist/src/tabs/tab.d.ts +4 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +2 -2
- package/scss/components.scss +0 -1
- package/scss/mixin.scss +10 -13
- package/scss/styles.scss +1 -3
- package/src/__controllers/attachable-controller.ts +198 -0
- package/src/__mixins/NativeButtonMixin.ts +87 -0
- package/src/__mixins/{BaseHyperlinkMixin.ts → NativeHyperlinkMixin.ts} +15 -15
- package/src/__utils/is-link.ts +3 -0
- package/src/__utils/observe-slot-change.ts +46 -14
- package/src/accordion/accordion-item.scss +1 -1
- package/src/accordion/accordion-item.ts +0 -1
- package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +0 -1
- package/src/button/ButtonConstants.ts +1 -0
- package/src/button/GroupButtonInterface.ts +4 -0
- package/src/button/button/button-colors.scss +2 -2
- package/src/button/button/button-layers.scss +124 -0
- package/src/button/button/button-sizes.scss +20 -42
- package/src/button/button/button.scss +71 -169
- package/src/button/button/button.ts +229 -78
- package/src/button/button/only-button.scss +13 -0
- package/src/button/button-group/button-group.ts +59 -17
- package/src/button/icon-button/icon-button-sizes.scss +6 -21
- package/src/button/icon-button/icon-button.ts +198 -93
- package/src/button/index.ts +1 -1
- package/src/calendar/calendar-column-view.ts +0 -1
- package/src/calendar/calendar-month-view.ts +0 -1
- package/src/card/card-content.ts +2 -3
- package/src/card/card.scss +87 -95
- package/src/card/card.ts +62 -60
- package/src/chip/chip/chip.scss +65 -70
- package/src/chip/chip/chip.ts +155 -56
- package/src/code-highlighter/code-highlighter.scss +1 -1
- package/src/code-highlighter/code-highlighter.ts +20 -5
- package/src/condition-builder/cb-compound-expression.scss +4 -0
- package/src/condition-builder/cb-compound-expression.ts +0 -1
- package/src/condition-builder/cb-divider.ts +0 -1
- package/src/condition-builder/cb-expression.scss +0 -1
- package/src/condition-builder/cb-expression.ts +0 -1
- package/src/condition-builder/cb-predicate.ts +0 -1
- package/src/elevation/elevation.scss +5 -1
- package/src/fab/fab-colors.scss +2 -2
- package/src/fab/fab-sizes.scss +24 -34
- package/src/fab/fab.scss +77 -71
- package/src/fab/fab.ts +141 -65
- package/src/flow-designer/flow-designer-node.ts +0 -1
- package/src/focus-ring/focus-ring.ts +81 -72
- package/src/item/item.scss +77 -66
- package/src/item/item.ts +61 -39
- package/src/link/link.scss +1 -10
- package/src/link/link.ts +4 -2
- package/src/list/list-item.ts +8 -8
- package/src/menu/menu-item/menu-item.ts +17 -8
- package/src/menu/sub-menu/sub-menu.ts +0 -1
- package/src/navigation-rail/navigation-rail-item.scss +5 -0
- package/src/navigation-rail/navigation-rail-item.ts +10 -15
- package/src/peacock-loader.ts +1 -1
- package/src/popover/popover-content.ts +0 -1
- package/src/ripple/ripple.ts +52 -20
- package/src/search/search.scss +3 -0
- package/src/segmented-button/segmented-button.ts +0 -1
- package/src/select/option.ts +0 -1
- package/src/sidebar-menu/sidebar-menu-item.ts +0 -1
- package/src/sidebar-menu/sidebar-sub-menu.ts +0 -1
- package/src/skeleton/skeleton.scss +5 -1
- package/src/tabs/tab-panel.ts +0 -1
- package/src/tabs/tab.ts +60 -70
- package/src/text/text.css-component.scss +3 -21
- package/src/tooltip/tooltip.scss +5 -8
- package/src/tooltip/tooltip.ts +1 -2
- package/dist/BaseButton-BNFAYn-S.js +0 -219
- package/dist/BaseButton-BNFAYn-S.js.map +0 -1
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +0 -1
- package/dist/button-colors-Cg6oxiz-.js.map +0 -1
- package/dist/flow-designer-node-9Bqyn6qx.js.map +0 -1
- package/dist/icon-button-AdJBEoNy.js +0 -251
- package/dist/icon-button-AdJBEoNy.js.map +0 -1
- package/dist/navigation-rail-DAUuJ_Yp.js.map +0 -1
- package/dist/observe-slot-change-BGJfgg2E.js +0 -31
- package/dist/observe-slot-change-BGJfgg2E.js.map +0 -1
- package/dist/src/button/BaseButton.d.ts +0 -28
- package/dist/src/focus-ring/FocusAttachableController.d.ts +0 -8
- package/src/__mixins/BaseButtonMixin.ts +0 -83
- package/src/button/BaseButton.ts +0 -113
- package/src/focus-ring/FocusAttachableController.ts +0 -28
- package/src/popover/tooltip.css-component.scss +0 -19
package/dist/fab.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { a as i,
|
|
1
|
+
import { a as i, i as i$1, b, A, _ as __decorate, I as IndividualComponent } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
|
-
import {
|
|
3
|
+
import { e as e$1 } from './query-QBcUV-L_.js';
|
|
4
4
|
import { e } from './class-map-YU7g0o3B.js';
|
|
5
|
-
import {
|
|
5
|
+
import { N as NativeButtonMixin, D as DISABLED_REASON_ID, o, s as spread } from './ButtonConstants-D06bY4uy.js';
|
|
6
6
|
import { i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
7
|
-
import { t as throttle } from './
|
|
7
|
+
import { N as NativeHyperlinkMixin, t as throttle, i as isLink } from './NativeHyperlinkMixin-DrYXyfMQ.js';
|
|
8
8
|
import './directive-ZPhl09Yt.js';
|
|
9
|
-
import './query-QBcUV-L_.js';
|
|
10
9
|
|
|
11
10
|
var css_248z$2 = i`* {
|
|
12
11
|
box-sizing: border-box;
|
|
@@ -17,6 +16,7 @@ var css_248z$2 = i`* {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
:host {
|
|
19
|
+
position: relative;
|
|
20
20
|
display: inline-flex;
|
|
21
21
|
--fab-container-shape: var(--shape-corner-large);
|
|
22
22
|
--fab-container-elevation-level: 3;
|
|
@@ -36,12 +36,14 @@ var css_248z$2 = i`* {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.fab {
|
|
39
|
-
position: relative;
|
|
40
39
|
display: inline-flex;
|
|
41
40
|
align-items: center;
|
|
42
41
|
justify-content: center;
|
|
42
|
+
width: var(--fab-container-size);
|
|
43
|
+
height: var(--fab-container-size);
|
|
43
44
|
border-radius: var(--fab-container-shape);
|
|
44
45
|
font-family: var(--font-family-sans) !important;
|
|
46
|
+
z-index: 0;
|
|
45
47
|
}
|
|
46
48
|
.fab .fab-content {
|
|
47
49
|
display: flex;
|
|
@@ -55,33 +57,42 @@ var css_248z$2 = i`* {
|
|
|
55
57
|
--icon-color: var(--_fab-label-text-color);
|
|
56
58
|
}
|
|
57
59
|
.fab .fab-label {
|
|
58
|
-
font-size:
|
|
59
|
-
font-weight: var(--font-weight
|
|
60
|
-
line-height:
|
|
61
|
-
letter-spacing:
|
|
60
|
+
font-size: var(--_fab-font-size) !important;
|
|
61
|
+
font-weight: var(--_fab-font-weight) !important;
|
|
62
|
+
line-height: var(--_fab-line-height) !important;
|
|
63
|
+
letter-spacing: var(--_fab-letter-spacing) !important;
|
|
62
64
|
white-space: nowrap;
|
|
63
65
|
}
|
|
64
66
|
.fab.disabled {
|
|
65
67
|
cursor: not-allowed;
|
|
66
68
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
/* Extended FAB */
|
|
71
|
+
.fab.extended {
|
|
72
|
+
width: auto;
|
|
73
|
+
min-width: var(--fab-extended-min-width);
|
|
74
|
+
padding: 0 1rem;
|
|
75
|
+
border-radius: var(--fab-container-shape);
|
|
71
76
|
}
|
|
72
|
-
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
Background layers
|
|
80
|
+
*/
|
|
81
|
+
.focus-ring {
|
|
73
82
|
z-index: 2;
|
|
74
83
|
--focus-ring-container-shape-start-start: var(--fab-container-shape);
|
|
75
84
|
--focus-ring-container-shape-start-end: var(--fab-container-shape);
|
|
76
85
|
--focus-ring-container-shape-end-start: var(--fab-container-shape);
|
|
77
86
|
--focus-ring-container-shape-end-end: var(--fab-container-shape);
|
|
78
87
|
}
|
|
79
|
-
|
|
88
|
+
|
|
89
|
+
.ripple {
|
|
80
90
|
border-radius: var(--fab-container-shape);
|
|
81
91
|
--ripple-state-opacity: var(--_fab-container-state-opacity, 0);
|
|
82
92
|
--ripple-pressed-color: var(--_fab-label-text-color);
|
|
83
93
|
}
|
|
84
|
-
|
|
94
|
+
|
|
95
|
+
.background {
|
|
85
96
|
display: block;
|
|
86
97
|
position: absolute;
|
|
87
98
|
inset: 0;
|
|
@@ -90,7 +101,8 @@ var css_248z$2 = i`* {
|
|
|
90
101
|
border-radius: var(--fab-container-shape);
|
|
91
102
|
pointer-events: none;
|
|
92
103
|
}
|
|
93
|
-
|
|
104
|
+
|
|
105
|
+
.elevation {
|
|
94
106
|
--elevation-level: var(--_fab-container-elevation-level, var(--fab-container-elevation-level));
|
|
95
107
|
transition-duration: 280ms;
|
|
96
108
|
--elevation-container-shape-start-start: var(--fab-container-shape);
|
|
@@ -98,41 +110,40 @@ var css_248z$2 = i`* {
|
|
|
98
110
|
--elevation-container-shape-end-start: var(--fab-container-shape);
|
|
99
111
|
--elevation-container-shape-end-end: var(--fab-container-shape);
|
|
100
112
|
}
|
|
101
|
-
|
|
113
|
+
|
|
114
|
+
/* State management */
|
|
115
|
+
:host:hover:not([disabled]) {
|
|
102
116
|
--_fab-container-elevation-level: 4;
|
|
103
117
|
--_fab-container-state-opacity: 0.08;
|
|
104
118
|
}
|
|
105
|
-
|
|
119
|
+
|
|
120
|
+
:host([pressed]):not([disabled]) {
|
|
106
121
|
--_fab-container-elevation-level: 3;
|
|
107
122
|
--_fab-container-state-opacity: 0.12;
|
|
108
123
|
}
|
|
109
|
-
|
|
124
|
+
|
|
125
|
+
:host([lowered]) {
|
|
110
126
|
--fab-container-elevation-level: 1;
|
|
111
127
|
}
|
|
112
|
-
|
|
128
|
+
:host([lowered]):hover:not([disabled]) {
|
|
113
129
|
--_fab-container-elevation-level: 2;
|
|
114
130
|
}
|
|
115
|
-
|
|
131
|
+
:host([lowered])[pressed]:not([disabled]) {
|
|
116
132
|
--_fab-container-elevation-level: 1;
|
|
117
133
|
}
|
|
118
|
-
|
|
134
|
+
|
|
135
|
+
:host([disabled]) {
|
|
119
136
|
--_fab-container-color: var(--color-on-surface);
|
|
120
137
|
--_fab-container-opacity: 0.12;
|
|
121
138
|
--_fab-label-text-color: var(--color-on-surface);
|
|
122
139
|
--_fab-label-text-opacity: 0.38;
|
|
123
140
|
--_fab-container-elevation-level: 0;
|
|
124
141
|
}
|
|
125
|
-
|
|
142
|
+
:host([disabled]) .ripple {
|
|
126
143
|
display: none;
|
|
127
144
|
}
|
|
128
|
-
|
|
145
|
+
:host([disabled]) .fab-content {
|
|
129
146
|
opacity: 0.38;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/* Extended FAB */
|
|
133
|
-
.fab.extended {
|
|
134
|
-
padding: 0 1rem;
|
|
135
|
-
border-radius: var(--fab-container-shape);
|
|
136
147
|
}`;
|
|
137
148
|
|
|
138
149
|
var css_248z$1 = i`:host {
|
|
@@ -170,62 +181,50 @@ var css_248z$1 = i`:host {
|
|
|
170
181
|
--filled-fab-label-text-color: var(--color-on-tertiary);
|
|
171
182
|
}
|
|
172
183
|
|
|
173
|
-
|
|
184
|
+
:host([variant=tonal]) {
|
|
174
185
|
--_fab-container-color: var(--tonal-fab-container-color);
|
|
175
186
|
--_fab-label-text-color: var(--tonal-fab-label-text-color);
|
|
176
187
|
}
|
|
177
188
|
|
|
178
|
-
|
|
189
|
+
:host([variant=filled]) {
|
|
179
190
|
--_fab-container-color: var(--filled-fab-container-color);
|
|
180
191
|
--_fab-label-text-color: var(--filled-fab-label-text-color);
|
|
181
192
|
}`;
|
|
182
193
|
|
|
183
|
-
var css_248z = i
|
|
194
|
+
var css_248z = i`@charset "UTF-8";
|
|
195
|
+
/* Small FAB: 40×40dp, shape-corner-medium */
|
|
184
196
|
:host([size=sm]) {
|
|
185
197
|
--fab-container-shape: var(--shape-corner-medium);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
:host([size=sm]) .fab {
|
|
189
|
-
width: 2.5rem;
|
|
190
|
-
height: 2.5rem;
|
|
198
|
+
--fab-container-size: 2.5rem;
|
|
191
199
|
--_fab-icon-size: 1.5rem;
|
|
200
|
+
--fab-extended-min-width: 4rem;
|
|
201
|
+
--_fab-font-size: 0.875rem;
|
|
202
|
+
--_fab-font-weight: var(--font-weight-medium);
|
|
203
|
+
--_fab-line-height: 1.25rem;
|
|
204
|
+
--_fab-letter-spacing: 0.1px;
|
|
192
205
|
}
|
|
193
206
|
|
|
194
|
-
/* Standard/Medium FAB:
|
|
195
|
-
:host([size=md])
|
|
196
|
-
|
|
197
|
-
height: 3.5rem;
|
|
207
|
+
/* Standard/Medium FAB: 56×56dp, shape-corner-large (default) */
|
|
208
|
+
:host([size=md]) {
|
|
209
|
+
--fab-container-size: 3.5rem;
|
|
198
210
|
--_fab-icon-size: 1.5rem;
|
|
211
|
+
--fab-extended-min-width: 5rem;
|
|
212
|
+
--_fab-font-size: 0.875rem;
|
|
213
|
+
--_fab-font-weight: var(--font-weight-medium);
|
|
214
|
+
--_fab-line-height: 1.25rem;
|
|
215
|
+
--_fab-letter-spacing: 0.1px;
|
|
199
216
|
}
|
|
200
217
|
|
|
201
|
-
/* Large FAB:
|
|
218
|
+
/* Large FAB: 96×96dp, shape-corner-extra-large */
|
|
202
219
|
:host([size=lg]) {
|
|
203
220
|
--fab-container-shape: var(--shape-corner-extra-large);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
:host([size=lg]) .fab {
|
|
207
|
-
width: 6rem;
|
|
208
|
-
height: 6rem;
|
|
221
|
+
--fab-container-size: 6rem;
|
|
209
222
|
--_fab-icon-size: 2.25rem;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
:
|
|
214
|
-
|
|
215
|
-
min-width: 4rem;
|
|
216
|
-
height: 2.5rem;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:host([size=md]) .fab.extended {
|
|
220
|
-
width: auto;
|
|
221
|
-
min-width: 5rem;
|
|
222
|
-
height: 3.5rem;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
:host([size=lg]) .fab.extended {
|
|
226
|
-
width: auto;
|
|
227
|
-
min-width: 6rem;
|
|
228
|
-
height: 6rem;
|
|
223
|
+
--fab-extended-min-width: 6rem;
|
|
224
|
+
--_fab-font-size: 1rem;
|
|
225
|
+
--_fab-font-weight: var(--font-weight-medium);
|
|
226
|
+
--_fab-line-height: 1.5rem;
|
|
227
|
+
--_fab-letter-spacing: 0.15px;
|
|
229
228
|
}`;
|
|
230
229
|
|
|
231
230
|
var _Fab_id;
|
|
@@ -251,7 +250,7 @@ var _Fab_id;
|
|
|
251
250
|
* ```
|
|
252
251
|
* @tags controls
|
|
253
252
|
*/
|
|
254
|
-
let Fab = class Fab extends
|
|
253
|
+
let Fab = class Fab extends NativeButtonMixin(NativeHyperlinkMixin(i$1)) {
|
|
255
254
|
constructor() {
|
|
256
255
|
super(...arguments);
|
|
257
256
|
_Fab_id.set(this, crypto.randomUUID());
|
|
@@ -284,9 +283,36 @@ let Fab = class Fab extends BaseButton {
|
|
|
284
283
|
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
285
284
|
*/
|
|
286
285
|
this.throttleDelay = 200;
|
|
287
|
-
this.
|
|
286
|
+
this.skeleton = false;
|
|
287
|
+
this.toggle = false;
|
|
288
|
+
this.selected = false;
|
|
289
|
+
/**
|
|
290
|
+
* States
|
|
291
|
+
*/
|
|
292
|
+
this.pressed = false;
|
|
293
|
+
this.__handlePress = (event) => {
|
|
294
|
+
if (this.disabled || this.skeleton || this.softDisabled)
|
|
295
|
+
return;
|
|
296
|
+
if (event instanceof KeyboardEvent &&
|
|
297
|
+
event.type === 'keydown' &&
|
|
298
|
+
(event.key === 'Enter' || event.key === ' ')) {
|
|
299
|
+
this.pressed = true;
|
|
300
|
+
}
|
|
301
|
+
else if (event.type === 'mousedown') {
|
|
302
|
+
this.pressed = true;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
this.pressed = false;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
this.__dispatchClickWithThrottle = event => {
|
|
309
|
+
this.__dispatchClick(event);
|
|
310
|
+
};
|
|
288
311
|
this.__dispatchClick = (event) => {
|
|
289
|
-
|
|
312
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
313
|
+
// prevent the click from propagating to other event listeners as well as
|
|
314
|
+
// prevent the default action.
|
|
315
|
+
if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {
|
|
290
316
|
event.stopImmediatePropagation();
|
|
291
317
|
event.preventDefault();
|
|
292
318
|
return;
|
|
@@ -294,10 +320,43 @@ let Fab = class Fab extends BaseButton {
|
|
|
294
320
|
if (!isActivationClick(event) || !this.buttonElement) {
|
|
295
321
|
return;
|
|
296
322
|
}
|
|
323
|
+
if (this.toggle) {
|
|
324
|
+
this.selected = !this.selected;
|
|
325
|
+
}
|
|
297
326
|
this.focus();
|
|
298
327
|
dispatchActivationClick(this.buttonElement);
|
|
299
328
|
};
|
|
300
329
|
}
|
|
330
|
+
connectedCallback() {
|
|
331
|
+
super.connectedCallback();
|
|
332
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
333
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
334
|
+
}
|
|
335
|
+
disconnectedCallback() {
|
|
336
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
337
|
+
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
338
|
+
super.disconnectedCallback();
|
|
339
|
+
}
|
|
340
|
+
__renderDisabledReason(softDisabled) {
|
|
341
|
+
if (softDisabled)
|
|
342
|
+
return b `<div
|
|
343
|
+
id=${DISABLED_REASON_ID}
|
|
344
|
+
role="tooltip"
|
|
345
|
+
aria-label=${this.disabledReason}
|
|
346
|
+
class="screen-reader-only"
|
|
347
|
+
>
|
|
348
|
+
${this.disabledReason}
|
|
349
|
+
</div>`;
|
|
350
|
+
return A;
|
|
351
|
+
}
|
|
352
|
+
__renderTooltip() {
|
|
353
|
+
if (this.tooltip) {
|
|
354
|
+
return b `<wc-tooltip class="tooltip" for="button"
|
|
355
|
+
>${this.tooltip}</wc-tooltip
|
|
356
|
+
>`;
|
|
357
|
+
}
|
|
358
|
+
return A;
|
|
359
|
+
}
|
|
301
360
|
focus() {
|
|
302
361
|
this.buttonElement?.focus();
|
|
303
362
|
}
|
|
@@ -307,12 +366,19 @@ let Fab = class Fab extends BaseButton {
|
|
|
307
366
|
firstUpdated() {
|
|
308
367
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
309
368
|
}
|
|
310
|
-
__getDisabledReasonID() {
|
|
311
|
-
return this.disabled ? `disabled-reason-${__classPrivateFieldGet(this, _Fab_id, "f")}` : A;
|
|
312
|
-
}
|
|
313
369
|
render() {
|
|
314
|
-
const isLink = this.__isLink();
|
|
315
370
|
const isExtended = !!this.label;
|
|
371
|
+
return b `
|
|
372
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
373
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
374
|
+
<div class="background"></div>
|
|
375
|
+
<wc-ripple class="ripple" for="button"></wc-ripple>
|
|
376
|
+
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
377
|
+
|
|
378
|
+
${this.__renderFabElement(isExtended)} ${this.__renderTooltip()}
|
|
379
|
+
`;
|
|
380
|
+
}
|
|
381
|
+
__renderFabElement(isExtended) {
|
|
316
382
|
const cssClasses = {
|
|
317
383
|
button: true,
|
|
318
384
|
fab: true,
|
|
@@ -323,65 +389,51 @@ let Fab = class Fab extends BaseButton {
|
|
|
323
389
|
extended: isExtended,
|
|
324
390
|
lowered: this.lowered,
|
|
325
391
|
disabled: this.disabled,
|
|
326
|
-
pressed: this.
|
|
392
|
+
pressed: this.pressed,
|
|
327
393
|
};
|
|
328
|
-
if (!isLink) {
|
|
394
|
+
if (!isLink(this)) {
|
|
329
395
|
return b `<button
|
|
330
|
-
class=${e(cssClasses)}
|
|
331
|
-
id="button"
|
|
332
|
-
type="button"
|
|
333
|
-
@click=${this.__dispatchClickWithThrottle}
|
|
334
|
-
@mousedown=${this.__handlePress}
|
|
335
|
-
@keydown=${this.__handlePress}
|
|
336
|
-
@keyup=${this.__handlePress}
|
|
337
|
-
|
|
338
|
-
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
339
|
-
?aria-disabled=${this.softDisabled}
|
|
340
|
-
|
|
341
|
-
?disabled=${this.disabled}
|
|
342
|
-
${spread(this.configAria)}
|
|
343
|
-
>
|
|
344
|
-
${this.__renderFabContent(isExtended)}
|
|
345
|
-
</button>
|
|
346
|
-
${this.__renderTooltip()}`;
|
|
347
|
-
}
|
|
348
|
-
return b `<a
|
|
349
396
|
class=${e(cssClasses)}
|
|
350
397
|
id="button"
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
target=${this.target}
|
|
354
|
-
@click=${this.__dispatchClick}
|
|
398
|
+
type="button"
|
|
399
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
355
400
|
@mousedown=${this.__handlePress}
|
|
356
401
|
@keydown=${this.__handlePress}
|
|
357
402
|
@keyup=${this.__handlePress}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
aria-describedby=${o(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
403
|
+
aria-describedby=${o(this.softDisabled ? DISABLED_REASON_ID : undefined)}
|
|
361
404
|
?aria-disabled=${this.softDisabled}
|
|
362
|
-
|
|
405
|
+
?disabled=${this.disabled}
|
|
363
406
|
${spread(this.configAria)}
|
|
364
407
|
>
|
|
365
408
|
${this.__renderFabContent(isExtended)}
|
|
366
|
-
</
|
|
367
|
-
|
|
409
|
+
</button>`;
|
|
410
|
+
}
|
|
411
|
+
return b `<a
|
|
412
|
+
class=${e(cssClasses)}
|
|
413
|
+
id="button"
|
|
414
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
415
|
+
href=${o(this.href)}
|
|
416
|
+
target=${this.target}
|
|
417
|
+
@click=${this.__dispatchClick}
|
|
418
|
+
@mousedown=${this.__handlePress}
|
|
419
|
+
@keydown=${this.__handlePress}
|
|
420
|
+
@keyup=${this.__handlePress}
|
|
421
|
+
role="button"
|
|
422
|
+
aria-describedby=${o(this.softDisabled ? DISABLED_REASON_ID : undefined)}
|
|
423
|
+
?aria-disabled=${this.softDisabled}
|
|
424
|
+
${spread(this.configAria)}
|
|
425
|
+
>
|
|
426
|
+
${this.__renderFabContent(isExtended)}
|
|
427
|
+
</a>`;
|
|
368
428
|
}
|
|
369
429
|
__renderFabContent(isExtended) {
|
|
370
430
|
return b `
|
|
371
|
-
<wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
|
|
372
|
-
<wc-elevation class="elevation"></wc-elevation>
|
|
373
|
-
<div class="background"></div>
|
|
374
|
-
<wc-ripple class="ripple"></wc-ripple>
|
|
375
|
-
<wc-skeleton class="skeleton"></wc-skeleton>
|
|
376
|
-
|
|
377
431
|
<div class="fab-content">
|
|
378
|
-
|
|
379
432
|
<slot></slot>
|
|
380
433
|
${isExtended
|
|
381
434
|
? b `<span class="fab-label">${this.label}</span>`
|
|
382
435
|
: A}
|
|
383
436
|
</div>
|
|
384
|
-
|
|
385
437
|
${this.__renderDisabledReason(this.softDisabled)}
|
|
386
438
|
`;
|
|
387
439
|
}
|
|
@@ -413,8 +465,20 @@ __decorate([
|
|
|
413
465
|
n()
|
|
414
466
|
], Fab.prototype, "tooltip", void 0);
|
|
415
467
|
__decorate([
|
|
416
|
-
|
|
417
|
-
], Fab.prototype, "
|
|
468
|
+
n({ type: Boolean, reflect: true })
|
|
469
|
+
], Fab.prototype, "skeleton", void 0);
|
|
470
|
+
__decorate([
|
|
471
|
+
n({ type: Boolean, reflect: true })
|
|
472
|
+
], Fab.prototype, "toggle", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
n({ type: Boolean, reflect: true })
|
|
475
|
+
], Fab.prototype, "selected", void 0);
|
|
476
|
+
__decorate([
|
|
477
|
+
n({ type: Boolean, reflect: true })
|
|
478
|
+
], Fab.prototype, "pressed", void 0);
|
|
479
|
+
__decorate([
|
|
480
|
+
e$1('.button')
|
|
481
|
+
], Fab.prototype, "buttonElement", void 0);
|
|
418
482
|
Fab = __decorate([
|
|
419
483
|
IndividualComponent
|
|
420
484
|
], Fab);
|
package/dist/fab.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fab.js","sources":["../../src/fab/fab.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';\nimport { throttle } from '@/__utils/throttle.js';\nimport { spread } from '@/__directive/spread.js';\n\nimport styles from './fab.scss';\nimport colorStyles from './fab-colors.scss';\nimport sizeStyles from './fab-sizes.scss';\nimport { BaseButton } from '@/button/BaseButton.js';\n\n/**\n * @label FAB\n * @tag wc-fab\n * @rawTag fab\n *\n * @summary The FAB (Floating Action Button) represents the primary action on a screen.\n * @overview\n * <p>A Floating Action Button (FAB) is a circular button that represents the primary action on a screen. It follows the Material Design 3 specification and supports four color roles and two variants.</p>\n *\n * @cssprop --fab-container-color: Background color of the FAB container.\n * @cssprop --fab-label-text-color: Text and icon color of the FAB label.\n * @cssprop --fab-container-shape: Corner radius of the FAB. Defaults to var(--shape-corner-large).\n * @cssprop --fab-container-elevation-level: Elevation level of the FAB. Defaults to 3.\n *\n * @fires {MouseEvent} click - Dispatched when the FAB is clicked.\n *\n * @example\n * ```html\n * <wc-fab><wc-icon name=\"add\"></wc-icon></wc-fab>\n * ```\n * @tags controls\n */\n@IndividualComponent\nexport class Fab extends BaseButton {\n static override styles = [styles, colorStyles, sizeStyles];\n\n #id = crypto.randomUUID();\n \n\n\n /**\n * Optional label text for the extended FAB variant.\n * When set, the FAB displays both the icon and a text label.\n */\n @property({ type: String }) label?: string;\n\n /**\n * The color role of the FAB.\n * `\"surface\"` uses the surface color role.\n * `\"primary\"` uses the primary color role.\n * `\"secondary\"` uses the secondary color role.\n * `\"tertiary\"` uses the tertiary color role.\n */\n @property({ reflect: true }) color: 'surface' | 'primary' | 'secondary' | 'tertiary' = 'surface';\n\n /**\n * The style variant of the FAB.\n * `\"tonal\"` uses container colors.\n * `\"filled\"` uses solid role colors.\n */\n @property({ reflect: true }) variant: 'tonal' | 'filled' = 'tonal';\n\n /**\n * The size of the FAB.\n * `\"sm\"` renders a small FAB (40×40dp).\n * `\"md\"` renders a standard FAB (56×56dp). This is the default.\n * `\"lg\"` renders a large FAB (96×96dp).\n */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * If `true`, the FAB is in a lowered (resting) state with reduced elevation.\n */\n @property({ type: Boolean, reflect: true }) lowered: boolean = false;\n\n /**\n * Additional ARIA attributes to pass to the inner button/anchor element.\n */\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n /**\n * Tooltip text shown on hover.\n */\n @property() tooltip?: string;\n\n @state()\n isPressed = false;\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n }\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n if (this.disabled && this.href) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n __getDisabledReasonID() {\n return this.disabled ? `disabled-reason-${this.#id}` : nothing;\n }\n\n override render() {\n const isLink = this.__isLink();\n const isExtended = !!this.label;\n\n const cssClasses = {\n button: true,\n fab: true,\n 'fab-element': true,\n [`size-${this.size}`]: true,\n [`color-${this.color}`]: true,\n [`variant-${this.variant}`]: true,\n extended: isExtended,\n lowered: this.lowered,\n disabled: this.disabled,\n pressed: this.isPressed,\n };\n\n if (!isLink) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n type=\"button\"\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n \n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.__renderFabContent(isExtended)}\n </button>\n ${this.__renderTooltip()}`;\n }\n\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.disabled ? '-1' : '0'}\n href=${ifDefined(this.href)}\n target=${this.target}\n @click=${this.__dispatchClick}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n\n aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}\n ?aria-disabled=${this.softDisabled}\n\n ${spread(this.configAria)}\n >\n ${this.__renderFabContent(isExtended)}\n </a>\n ${this.__renderTooltip()}`;\n }\n\n __renderFabContent(isExtended: boolean) {\n return html`\n <wc-focus-ring class=\"focus-ring\" for='button'></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"background\"></div>\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n <div class=\"fab-content\">\n\n <slot></slot>\n ${isExtended\n ? html`<span class=\"fab-label\">${this.label}</span>`\n : nothing}\n </div>\n\n ${this.__renderDisabledReason(this.softDisabled)}\n `;\n }\n\n}\n"],"names":["nothing","html","classMap","ifDefined","styles","colorStyles","sizeStyles","property","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEI,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQ,UAAU,CAAA;AAA5B,IAAA,WAAA,GAAA;;AAGL,QAAA,OAAA,CAAA,GAAA,CAAA,IAAA,EAAM,MAAM,CAAC,UAAU,EAAE,CAAA;AAUzB;;;;;;AAMG;QAC0B,IAAA,CAAA,KAAK,GAAqD,SAAS;AAEhG;;;;AAIG;QAC0B,IAAA,CAAA,OAAO,GAAuB,OAAO;AAElE;;;;;AAKG;QAC0B,IAAA,CAAA,IAAI,GAAuB,IAAI;AAE5D;;AAEG;QACyC,IAAA,CAAA,OAAO,GAAY,KAAK;AAQpE;;AAEG;QACS,IAAA,CAAA,aAAa,GAAG,GAAG;QAQ/B,IAAA,CAAA,SAAS,GA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E;AAA2B,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAMrE,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACS,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAKxB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAuB,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAKpB,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAG7B,UAAA,CAAA;AADC,IAAAC,CAAK;AACY,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AA3DP,GAAG,GAAA,UAAA,CAAA;IADf;AACY,CAAA,EAAA,GAAG,CA+Kf;;;;"}
|
|
1
|
+
{"version":3,"file":"fab.js","sources":["../../src/fab/fab.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '@/__utils/dispatch-event-utils.js';\nimport { isLink } from '@/__utils/is-link.js';\nimport { throttle } from '@/__utils/throttle.js';\nimport { spread } from '@/__directive/spread.js';\n\nimport styles from './fab.scss';\nimport colorStyles from './fab-colors.scss';\nimport sizeStyles from './fab-sizes.scss';\nimport NativeButtonMixin from '@/__mixins/NativeButtonMixin.js';\nimport NativeHyperlinkMixin from '@/__mixins/NativeHyperlinkMixin.js';\nimport { DISABLED_REASON_ID } from '@/button/ButtonConstants.js';\n\n/**\n * @label FAB\n * @tag wc-fab\n * @rawTag fab\n *\n * @summary The FAB (Floating Action Button) represents the primary action on a screen.\n * @overview\n * <p>A Floating Action Button (FAB) is a circular button that represents the primary action on a screen. It follows the Material Design 3 specification and supports four color roles and two variants.</p>\n *\n * @cssprop --fab-container-color: Background color of the FAB container.\n * @cssprop --fab-label-text-color: Text and icon color of the FAB label.\n * @cssprop --fab-container-shape: Corner radius of the FAB. Defaults to var(--shape-corner-large).\n * @cssprop --fab-container-elevation-level: Elevation level of the FAB. Defaults to 3.\n *\n * @fires {MouseEvent} click - Dispatched when the FAB is clicked.\n *\n * @example\n * ```html\n * <wc-fab><wc-icon name=\"add\"></wc-icon></wc-fab>\n * ```\n * @tags controls\n */\n@IndividualComponent\nexport class Fab extends NativeButtonMixin(NativeHyperlinkMixin(LitElement)) {\n static override styles = [styles, colorStyles, sizeStyles];\n\n #id = crypto.randomUUID();\n\n /**\n * Optional label text for the extended FAB variant.\n * When set, the FAB displays both the icon and a text label.\n */\n @property({ type: String }) label?: string;\n\n /**\n * The color role of the FAB.\n * `\"surface\"` uses the surface color role.\n * `\"primary\"` uses the primary color role.\n * `\"secondary\"` uses the secondary color role.\n * `\"tertiary\"` uses the tertiary color role.\n */\n @property({ reflect: true }) color:\n | 'surface'\n | 'primary'\n | 'secondary'\n | 'tertiary' = 'surface';\n\n /**\n * The style variant of the FAB.\n * `\"tonal\"` uses container colors.\n * `\"filled\"` uses solid role colors.\n */\n @property({ reflect: true }) variant: 'tonal' | 'filled' = 'tonal';\n\n /**\n * The size of the FAB.\n * `\"sm\"` renders a small FAB (40×40dp).\n * `\"md\"` renders a standard FAB (56×56dp). This is the default.\n * `\"lg\"` renders a large FAB (96×96dp).\n */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * If `true`, the FAB is in a lowered (resting) state with reduced elevation.\n */\n @property({ type: Boolean, reflect: true }) lowered: boolean = false;\n\n /**\n * Additional ARIA attributes to pass to the inner button/anchor element.\n */\n @property({ reflect: true })\n configAria?: { [key: string]: any };\n\n /**\n * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.\n */\n @property() throttleDelay = 200;\n\n /**\n * Tooltip text shown on hover.\n */\n @property() tooltip?: string;\n\n @property({ type: Boolean, reflect: true }) skeleton: boolean = false;\n\n @property({ type: Boolean, reflect: true }) toggle: boolean = false;\n\n @property({ type: Boolean, reflect: true }) selected: boolean = false;\n\n /**\n * States\n */\n @property({ type: Boolean, reflect: true })\n pressed = false;\n\n @query('.button') readonly buttonElement!: HTMLElement | null;\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.__dispatchClickWithThrottle);\n window.addEventListener('mouseup', this.__handlePress);\n }\n\n override disconnectedCallback() {\n window.removeEventListener('mouseup', this.__handlePress);\n this.removeEventListener('click', this.__dispatchClickWithThrottle);\n super.disconnectedCallback();\n }\n\n __handlePress = (event: KeyboardEvent | MouseEvent) => {\n if (this.disabled || this.skeleton || this.softDisabled) return;\n if (\n event instanceof KeyboardEvent &&\n event.type === 'keydown' &&\n (event.key === 'Enter' || event.key === ' ')\n ) {\n this.pressed = true;\n } else if (event.type === 'mousedown') {\n this.pressed = true;\n } else {\n this.pressed = false;\n }\n };\n\n __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =\n event => {\n this.__dispatchClick(event);\n };\n\n __dispatchClick = (event: MouseEvent | KeyboardEvent) => {\n // If the button is soft-disabled or a disabled link, we need to explicitly\n // prevent the click from propagating to other event listeners as well as\n // prevent the default action.\n if (this.softDisabled || (this.disabled && this.href) || this.skeleton) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n\n if (this.toggle) {\n this.selected = !this.selected;\n }\n\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n __renderDisabledReason(softDisabled: boolean) {\n if (softDisabled)\n return html`<div\n id=${DISABLED_REASON_ID}\n role=\"tooltip\"\n aria-label=${this.disabledReason}\n class=\"screen-reader-only\"\n >\n ${this.disabledReason}\n </div>`;\n return nothing;\n }\n\n __renderTooltip() {\n if (this.tooltip) {\n return html`<wc-tooltip class=\"tooltip\" for=\"button\"\n >${this.tooltip}</wc-tooltip\n >`;\n }\n return nothing;\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n override firstUpdated() {\n this.__dispatchClickWithThrottle = throttle(\n this.__dispatchClick,\n this.throttleDelay,\n );\n }\n\n override render() {\n const isExtended = !!this.label;\n\n return html`\n <wc-focus-ring class=\"focus-ring\" for=\"button\"></wc-focus-ring>\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"background\"></div>\n <wc-ripple class=\"ripple\" for=\"button\"></wc-ripple>\n <wc-skeleton class=\"skeleton\"></wc-skeleton>\n\n ${this.__renderFabElement(isExtended)} ${this.__renderTooltip()}\n `;\n }\n\n __renderFabElement(isExtended: boolean) {\n const cssClasses = {\n button: true,\n fab: true,\n 'fab-element': true,\n [`size-${this.size}`]: true,\n [`color-${this.color}`]: true,\n [`variant-${this.variant}`]: true,\n extended: isExtended,\n lowered: this.lowered,\n disabled: this.disabled,\n pressed: this.pressed,\n };\n\n if (!isLink(this)) {\n return html`<button\n class=${classMap(cssClasses)}\n id=\"button\"\n type=\"button\"\n @click=${this.__dispatchClickWithThrottle}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n ?disabled=${this.disabled}\n ${spread(this.configAria)}\n >\n ${this.__renderFabContent(isExtended)}\n </button>`;\n }\n\n return html`<a\n class=${classMap(cssClasses)}\n id=\"button\"\n tabindex=${this.disabled ? '-1' : '0'}\n href=${ifDefined(this.href)}\n target=${this.target}\n @click=${this.__dispatchClick}\n @mousedown=${this.__handlePress}\n @keydown=${this.__handlePress}\n @keyup=${this.__handlePress}\n role=\"button\"\n aria-describedby=${ifDefined(\n this.softDisabled ? DISABLED_REASON_ID : undefined,\n )}\n ?aria-disabled=${this.softDisabled}\n ${spread(this.configAria)}\n >\n ${this.__renderFabContent(isExtended)}\n </a>`;\n }\n\n __renderFabContent(isExtended: boolean) {\n return html`\n <div class=\"fab-content\">\n <slot></slot>\n ${isExtended\n ? html`<span class=\"fab-label\">${this.label}</span>`\n : nothing}\n </div>\n ${this.__renderDisabledReason(this.softDisabled)}\n `;\n }\n}\n"],"names":["LitElement","html","nothing","classMap","ifDefined","styles","colorStyles","sizeStyles","property","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEI,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQ,iBAAiB,CAAC,oBAAoB,CAACA,GAAU,CAAC,CAAC,CAAA;AAArE,IAAA,WAAA,GAAA;;AAGL,QAAA,OAAA,CAAA,GAAA,CAAA,IAAA,EAAM,MAAM,CAAC,UAAU,EAAE,CAAA;AAQzB;;;;;;AAMG;QAC0B,IAAA,CAAA,KAAK,GAIjB,SAAS;AAE1B;;;;AAIG;QAC0B,IAAA,CAAA,OAAO,GAAuB,OAAO;AAElE;;;;;AAKG;QAC0B,IAAA,CAAA,IAAI,GAAuB,IAAI;AAE5D;;AAEG;QACyC,IAAA,CAAA,OAAO,GAAY,KAAK;AAQpE;;AAEG;QACS,IAAA,CAAA,aAAa,GAAG,GAAG;QAOa,IAAA,CAAA,QAAQ,GAAY,KAAK;QAEzB,IAAA,CAAA,MAAM,GAAY,KAAK;QAEvB,IAAA,CAAA,QAAQ,GAAY,KAAK;AAErE;;AAEG;QAEH,IAAA,CAAA,O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AE,IAAI,EAAE;AAC1B,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAEW,UAAA,CAAA;IAA1BC,GAAK,CAAC,SAAS;AAA8C,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAxEnD,GAAG,GAAA,UAAA,CAAA;IADf;AACY,CAAA,EAAA,GAAG,CAqPf;;;;"}
|
|
@@ -395,7 +395,6 @@ marker#arrowhead polygon {
|
|
|
395
395
|
*
|
|
396
396
|
* @tag wc-flow-designer-node
|
|
397
397
|
* @rawTag flow-designer-node
|
|
398
|
-
* @parentRawTag flow-designer
|
|
399
398
|
* @wip true
|
|
400
399
|
*/
|
|
401
400
|
let FlowDesignerNode = class FlowDesignerNode extends i$1 {
|
|
@@ -546,4 +545,4 @@ FlowDesignerNode = __decorate([
|
|
|
546
545
|
], FlowDesignerNode);
|
|
547
546
|
|
|
548
547
|
export { FlowDesignerNode as F, css_248z as c };
|
|
549
|
-
//# sourceMappingURL=flow-designer-node-
|
|
548
|
+
//# sourceMappingURL=flow-designer-node-BWrPuxAR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-designer-node-BWrPuxAR.js","sources":["../../src/flow-designer/flow-designer-node.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './flow-designer.scss';\nimport type { WorkflowNode } from './types.js';\n\n/**\n * Individual node component for flow designer\n * Renders a single workflow node with customizable slot templates\n *\n * @tag wc-flow-designer-node\n * @rawTag flow-designer-node\n * @wip true\n */\n@IndividualComponent\nexport class FlowDesignerNode extends LitElement {\n static styles = [styles];\n\n /**\n * The workflow node to render\n */\n @property({ type: Object })\n node: WorkflowNode = { id: '', type: 'action', label: '' };\n\n /**\n * Whether this node is currently selected\n */\n @property({ type: Boolean, reflect: true, attribute: 'selected' })\n isSelected: boolean = false;\n\n /**\n * Whether this node is in edit mode\n */\n @property({ type: Boolean, reflect: true, attribute: 'editing' })\n isEditing: boolean = false;\n\n /**\n * Whether this node is disabled\n */\n @property({ type: Boolean, reflect: true })\n disabled: boolean = false;\n\n /**\n * Whether to show the delete button\n */\n @property({ type: Boolean, attribute: 'show-delete' })\n showDelete: boolean = true;\n\n private _handleClick = () => {\n this.dispatchEvent(\n new CustomEvent('node-click', {\n detail: { nodeId: this.node.id },\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private _handleDoubleClick = () => {\n this.dispatchEvent(\n new CustomEvent('node-edit-start', {\n detail: { nodeId: this.node.id },\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private _handleDelete = (e: Event) => {\n e.stopPropagation();\n if (confirm(`Delete \"${this.node.label}\"?`)) {\n this.dispatchEvent(\n new CustomEvent('node-delete', {\n detail: { nodeId: this.node.id },\n bubbles: true,\n composed: true,\n })\n );\n }\n };\n\n private _handleMouseEnter = () => {\n // Node hover state handled via CSS\n };\n\n private _handleMouseLeave = () => {\n // Node hover state handled via CSS\n };\n\n render() {\n const { node, isSelected, isEditing, disabled } = this;\n const nodeType = node.type || 'action';\n\n return html`\n <div\n class=\"node-card ${nodeType}\"\n ?selected=${isSelected}\n ?editing=${isEditing}\n ?disabled=${disabled}\n @click=${this._handleClick}\n @dblclick=${this._handleDoubleClick}\n role=\"button\"\n tabindex=\"0\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') this._handleClick();\n }}\n >\n <!-- Customizable header slot -->\n <slot name=\"${nodeType}-header\">\n ${this._renderDefaultHeader()}\n </slot>\n\n <!-- Customizable body slot -->\n <slot name=\"${nodeType}-body\">${this._renderDefaultBody()}</slot>\n\n <!-- Action buttons -->\n ${this.isEditing\n ? html`\n <div class=\"node-actions\">\n <button class=\"btn-sm\" @click=${this._handleDelete}>\n Delete\n </button>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n\n private _renderDefaultHeader() {\n const { node } = this;\n const iconMap: Record<string, string> = {\n trigger: 'play-circle',\n action: 'check-circle',\n decision: 'help-circle',\n loop_start: 'repeat',\n loop_end: 'repeat',\n fork: 'git-branch',\n join: 'git-merge',\n };\n\n const icon = iconMap[node.type] || 'activity';\n\n return html`\n <div class=\"node-header\">\n <wc-icon provider=\"carbon\" name=${icon} class=\"node-icon\"></wc-icon>\n <span class=\"node-title\">${node.label}</span>\n </div>\n `;\n }\n\n private _renderDefaultBody() {\n const { node } = this;\n return html`\n <div class=\"node-body\">\n ${node.description\n ? html`<p class=\"node-description\">${node.description}</p>`\n : nothing}\n <div class=\"node-metadata\">\n <span class=\"node-type-tag\">${node.type}</span>\n ${node.id ? html`<span class=\"node-id\">${node.id}</span>` : nothing}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'wc-flow-designer-node': FlowDesignerNode;\n }\n}\n"],"names":["LitElement","html","nothing","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;AAOG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQA,GAAU,CAAA;AAAzC,IAAA,WAAA,GAAA;;AAGL;;AAEG;AAEH,QAAA,IAAA,CAAA,IAAI,GAAiB,EAAE,EAAE,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AE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAM1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE;AAC1B,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AA/BhB,gBAAgB,GAAA,UAAA,CAAA;IAD5B;AACY,CAAA,EAAA,gBAAgB,CAsJ5B;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import './property-1psGvXOq.js';
|
|
3
|
-
export { F as FlowDesignerNode } from './flow-designer-node-
|
|
3
|
+
export { F as FlowDesignerNode } from './flow-designer-node-BWrPuxAR.js';
|
|
4
4
|
//# sourceMappingURL=flow-designer-node.js.map
|
package/dist/flow-designer.js
CHANGED
|
@@ -3,15 +3,15 @@ import { n } from './property-1psGvXOq.js';
|
|
|
3
3
|
import { r } from './state-DwbEjqVk.js';
|
|
4
4
|
import { e } from './query-QBcUV-L_.js';
|
|
5
5
|
import './toolbar.js';
|
|
6
|
-
import './icon-button-
|
|
6
|
+
import './icon-button-CYqrnMnF.js';
|
|
7
7
|
import './icon-CueRR7wx.js';
|
|
8
|
-
import { c as css_248z } from './flow-designer-node-
|
|
8
|
+
import { c as css_248z } from './flow-designer-node-BWrPuxAR.js';
|
|
9
9
|
import './class-map-YU7g0o3B.js';
|
|
10
10
|
import './directive-ZPhl09Yt.js';
|
|
11
|
-
import './
|
|
11
|
+
import './ButtonConstants-D06bY4uy.js';
|
|
12
|
+
import './button-colors-DSuBHd-i.js';
|
|
13
|
+
import './NativeHyperlinkMixin-DrYXyfMQ.js';
|
|
12
14
|
import './dispatch-event-utils-CuEqjlPT.js';
|
|
13
|
-
import './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
14
|
-
import './button-colors-Cg6oxiz-.js';
|
|
15
15
|
import './unsafe-html-BsGUjx94.js';
|
|
16
16
|
|
|
17
17
|
/**
|